summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r200/r200_swtcl.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@FreeBSD.org>2004-10-16 03:36:14 +0000
committerEric Anholt <anholt@FreeBSD.org>2004-10-16 03:36:14 +0000
commitb1ebd306bf4fdc4076d3d3daa410b08f477cb4c4 (patch)
treee815feb8221211e716d664be7093e5f344efcf3d /src/mesa/drivers/dri/r200/r200_swtcl.c
parenta1af92877d3d91886cf01be9e6c65311960e3baf (diff)
Add code to support projective texturing and fix mixed enabling of texture
coordinate generation. Original code by Roland Schiedegger, with changes by myself. While here, ensure that the swtcl path does tnl_install_attrs enough when fog/specular are being (en/dis)abled. Notable effects: - projtex test works with TCL and is closer with swtcl (Bugzilla #1461) - 8/9 squares work in texgenmix instead of 3. - texcyl "reflect" mode works (GL_SPHERE_MAP is now a fallback -- unclear if the hardware can actually support it). - flickering in doom3 replaced by just plain darkness. - blocktube fixed (Bugzilla #984) - fixes stex3d
Diffstat (limited to 'src/mesa/drivers/dri/r200/r200_swtcl.c')
-rw-r--r--src/mesa/drivers/dri/r200/r200_swtcl.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index 66662bb4d0..c40c7d09db 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -64,7 +64,6 @@ static void flush_last_swtcl_prim( r200ContextPtr rmesa );
* Initialization
***********************************************************************/
-#define EMIT_SZ(sz) (EMIT_1F + (sz) - 1)
#define EMIT_ATTR( ATTR, STYLE, F0 ) \
do { \
rmesa->swtcl.vertex_attrs[rmesa->swtcl.vertex_attr_count].attrib = (ATTR); \
@@ -145,28 +144,18 @@ static void r200SetVertexFormat( GLcontext *ctx )
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
if (index & _TNL_BIT_TEX(i)) {
GLuint sz = VB->TexCoordPtr[i]->size;
- GLuint emit;
-
- /* r200 doesn't like 4D texcoords (is that true?):
- */
- if (sz != 4) {
- emit = EMIT_1F + (sz - 1);
- }
- else {
- sz = 3;
- emit = EMIT_3F_XYW;
- }
fmt_1 |= sz << (3 * i);
- EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_SZ(sz), 0 );
+ EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_1F + sz - 1, 0 );
}
}
}
- if ( (rmesa->hw.vtx.cmd[VTX_VTXFMT_0] != fmt_0)
- || (rmesa->hw.vtx.cmd[VTX_VTXFMT_1] != fmt_1) ) {
+ if ( rmesa->tnl_index != index ||
+ (rmesa->hw.vtx.cmd[VTX_VTXFMT_0] != fmt_0) ||
+ (rmesa->hw.vtx.cmd[VTX_VTXFMT_1] != fmt_1) ) {
R200_NEWPRIM(rmesa);
R200_STATECHANGE( rmesa, vtx );
rmesa->hw.vtx.cmd[VTX_VTXFMT_0] = fmt_0;
@@ -178,6 +167,7 @@ static void r200SetVertexFormat( GLcontext *ctx )
rmesa->swtcl.vertex_attr_count,
NULL, 0 );
rmesa->swtcl.vertex_size /= 4;
+ rmesa->tnl_index = index;
}
}
@@ -214,13 +204,11 @@ void r200ChooseVertexState( GLcontext *ctx )
|| (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
rmesa->swtcl.needproj = GL_TRUE;
vte |= R200_VTX_XY_FMT | R200_VTX_Z_FMT;
- vte &= ~R200_VTX_W0_FMT;
vap |= R200_VAP_FORCE_W_TO_ONE;
}
else {
rmesa->swtcl.needproj = GL_FALSE;
vte &= ~(R200_VTX_XY_FMT | R200_VTX_Z_FMT);
- vte |= R200_VTX_W0_FMT;
vap &= ~R200_VAP_FORCE_W_TO_ONE;
}
@@ -737,7 +725,6 @@ r200PointsBitmap( GLcontext *ctx, GLint px, GLint py,
GLuint vap = rmesa->hw.vap.cmd[VAP_SE_VAP_CNTL];
vte &= ~(R200_VTX_XY_FMT | R200_VTX_Z_FMT);
- vte |= R200_VTX_W0_FMT;
vap &= ~R200_VAP_FORCE_W_TO_ONE;
rmesa->swtcl.vertex_size = 5;