From b66251f76da2e2b0419bc1fbaec4dd0c9f8867b2 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 10 Feb 2005 18:28:44 +0000 Subject: [PATCH] (Andreas Stenglein) fix projected textures with swtcl, they need the w coordinate of the vertex (bugzilla #1648) --- src/mesa/drivers/dri/r200/r200_swtcl.c | 12 ++++++++++-- src/mesa/drivers/dri/r200/r200_tcl.c | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 43f83650781..141bcde1617 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -106,7 +106,7 @@ static void r200SetVertexFormat( GLcontext *ctx ) /* EMIT_ATTR's must be in order as they tell t_vertex.c how to * build up a hardware vertex. */ - if ( !rmesa->swtcl.needproj ) { + if ( !rmesa->swtcl.needproj || (index & _TNL_BITS_TEX_ANY)) { /* need w coord for projected textures */ EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F, R200_VTX_XY | R200_VTX_Z0 | R200_VTX_W0 ); offset = 4; } @@ -230,11 +230,18 @@ 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; - vap |= R200_VAP_FORCE_W_TO_ONE; + vte &= ~R200_VTX_W0_FMT; + if (tnl->render_inputs & _TNL_BITS_TEX_ANY) { + vap &= ~R200_VAP_FORCE_W_TO_ONE; + } + else { + 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; } @@ -751,6 +758,7 @@ 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; diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index 04c40d47c2e..0e7c71054e7 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -560,6 +560,7 @@ static void transition_to_hwtnl( GLcontext *ctx ) R200_STATECHANGE( rmesa, vte ); rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] &= ~(R200_VTX_XY_FMT|R200_VTX_Z_FMT); + rmesa->hw.vte.cmd[VTE_SE_VTE_CNTL] |= R200_VTX_W0_FMT; if (R200_DEBUG & DEBUG_FALLBACKS) fprintf(stderr, "R200 end tcl fallback\n"); -- 2.30.2