(Andreas Stenglein) fix projected textures with swtcl, they need the w coordinate of the vertex (bugzilla #1648)

This commit is contained in:
Roland Scheidegger 2005-02-10 18:28:44 +00:00
parent d9468c9405
commit b66251f76d
2 changed files with 11 additions and 2 deletions

View File

@ -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;

View File

@ -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");