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

View File

@ -422,7 +422,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
}
/* 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 |
R200_VTX_STQ1_D3D |
@ -468,6 +468,7 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
{
GLuint unit;
r200ContextPtr rmesa = R200_CONTEXT( ctx );
/* if (R200_DEBUG & DEBUG_VERTS) */
@ -485,9 +486,8 @@ void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
if (newinputs & VERT_BIT_COLOR1)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.spec, __FUNCTION__ );
if (newinputs & VERT_BIT_TEX0)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[0], __FUNCTION__ );
if (newinputs & VERT_BIT_TEX1)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[1], __FUNCTION__ );
for (unit = 0 ; unit < ctx->Const.MaxTextureUnits; unit++) {
if (newinputs & VERT_BIT_TEX(unit))
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.tex[unit], __FUNCTION__ );
}
}

View File

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

View File

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