change some explicit references to texture units 0/1 to unit < MaxTextureUnits (Andreas Stenglein, Ronny Vindenes)

This commit is contained in:
Roland Scheidegger 2004-05-27 16:56:47 +00:00
parent d44e9e39da
commit aaaf38d372
4 changed files with 21 additions and 27 deletions

View File

@ -63,7 +63,7 @@ static void r200_emit_state_list( r200ContextPtr rmesa,
{ {
struct r200_state_atom *state, *tmp; struct r200_state_atom *state, *tmp;
char *dest; char *dest;
int i, size; int i, size, mtu;
size = 0; size = 0;
foreach_s( state, tmp, list ) { foreach_s( state, tmp, list ) {
@ -84,6 +84,7 @@ static void r200_emit_state_list( r200ContextPtr rmesa,
return; return;
dest = r200AllocCmdBuf( rmesa, size * 4, __FUNCTION__); dest = r200AllocCmdBuf( rmesa, size * 4, __FUNCTION__);
mtu = rmesa->glCtx->Const.MaxTextureUnits;
#define EMIT_ATOM(ATOM) \ #define EMIT_ATOM(ATOM) \
do { \ do { \
@ -112,13 +113,13 @@ do { \
EMIT_ATOM (fog); EMIT_ATOM (fog);
EMIT_ATOM (tam); EMIT_ATOM (tam);
EMIT_ATOM (tf); EMIT_ATOM (tf);
for (i = 0; i < 2; ++i) { for (i = 0; i < mtu; ++i) {
EMIT_ATOM (tex[i]); EMIT_ATOM (tex[i]);
} }
for (i = 0; i < 2; ++i) { for (i = 0; i < mtu; ++i) {
EMIT_ATOM (cube[i]); EMIT_ATOM (cube[i]);
} }
for (i = 0; i < 5; ++i) for (i = 0; i < 3 + mtu; ++i)
EMIT_ATOM (mat[i]); EMIT_ATOM (mat[i]);
EMIT_ATOM (eye); EMIT_ATOM (eye);
EMIT_ATOM (glt); EMIT_ATOM (glt);

View File

@ -422,7 +422,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
} }
/* vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] & */ /* vtx = (rmesa->hw.tcl.cmd[TCL_OUTPUT_VTXFMT] & */
/* ~(R200_TCL_VTX_Q0|R200_TCL_VTX_Q1)); */ /* ~(R200_TCL_VTX_Q0|R200_TCL_VTX_Q1|R200_TCL_VTX_Q2|R200_TCL_VTX_Q3|R200_TCL_VTX_Q4|R200_TCL_VTX_Q5)); */
re_cntl = rmesa->hw.set.cmd[SET_RE_CNTL] & ~(R200_VTX_STQ0_D3D | re_cntl = rmesa->hw.set.cmd[SET_RE_CNTL] & ~(R200_VTX_STQ0_D3D |
R200_VTX_STQ1_D3D | R200_VTX_STQ1_D3D |
@ -468,6 +468,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs ) void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
{ {
GLuint unit;
r200ContextPtr rmesa = R200_CONTEXT( ctx ); r200ContextPtr rmesa = R200_CONTEXT( ctx );
/* if (R200_DEBUG & DEBUG_VERTS) */ /* if (R200_DEBUG & DEBUG_VERTS) */
@ -485,9 +486,8 @@ void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
if (newinputs & VERT_BIT_COLOR1) if (newinputs & VERT_BIT_COLOR1)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ ); r200ReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
if (newinputs & VERT_BIT_TEX0) for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[0], __FUNCTION__ ); if (newinputs & VERT_BIT_TEX(unit))
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[unit], __FUNCTION__ );
if (newinputs & VERT_BIT_TEX1) }
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[1], __FUNCTION__ );
} }

View File

@ -2120,7 +2120,7 @@ static void update_texturematrix( GLcontext *ctx )
rmesa->TexMatEnabled = 0; rmesa->TexMatEnabled = 0;
rmesa->TexMatCompSel = 0; rmesa->TexMatCompSel = 0;
for (unit = 0 ; unit < 2; unit++) { for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
if (!ctx->Texture.Unit[unit]._ReallyEnabled) if (!ctx->Texture.Unit[unit]._ReallyEnabled)
continue; continue;

View File

@ -302,6 +302,7 @@ static void r200_check_tcl_render( GLcontext *ctx,
{ {
r200ContextPtr rmesa = R200_CONTEXT(ctx); r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint inputs = VERT_BIT_POS; GLuint inputs = VERT_BIT_POS;
GLuint unit;
/* Validate state: /* Validate state:
*/ */
@ -326,24 +327,16 @@ static void r200_check_tcl_render( GLcontext *ctx,
} }
} }
if (ctx->Texture.Unit[0]._ReallyEnabled) { for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
if (ctx->Texture.Unit[0].TexGenEnabled) { if (ctx->Texture.Unit[unit]._ReallyEnabled) {
if (rmesa->TexGenNeedNormals[0]) { if (ctx->Texture.Unit[unit].TexGenEnabled) {
if (rmesa->TexGenNeedNormals[unit]) {
inputs |= VERT_BIT_NORMAL; inputs |= VERT_BIT_NORMAL;
} }
} else { } else {
inputs |= VERT_BIT_TEX0; inputs |= VERT_BIT_TEX(unit);
} }
} }
if (ctx->Texture.Unit[1]._ReallyEnabled) {
if (ctx->Texture.Unit[1].TexGenEnabled) {
if (rmesa->TexGenNeedNormals[1]) {
inputs |= VERT_BIT_NORMAL;
}
} else {
inputs |= VERT_BIT_TEX1;
}
} }
stage->inputs = inputs; stage->inputs = inputs;