imesa->TexBlendWordsUsed[i] = 0;
imesa->Init_TexBlendWordsUsed[i] = 0;
- imesa->TexBlendColorPipeNum[i] = 0;
- imesa->Init_TexBlendColorPipeNum[i] = 0;
}
/* Set default blend state */
TEXBLENDARG_DIFFUSE);
imesa->TexBlendWordsUsed[0] = 4;
- imesa->TexBlendColorPipeNum[0] = 0;
imesa->Init_TexBlend[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
TEXPIPE_COLOR |
TEXBLENDARG_MODIFY_PARMS |
TEXBLENDARG_CURRENT);
imesa->Init_TexBlendWordsUsed[0] = 4;
- imesa->Init_TexBlendColorPipeNum[0] = 0;
memset(imesa->Setup, 0, sizeof(imesa->Setup));
TEXBLEND_ARG1 |
TEXBLENDARG_MODIFY_PARMS |
TEXBLENDARG_CURRENT);
- imesa->TexBlendColorPipeNum[unit] = 0;
imesa->TexBlendWordsUsed[unit] = 4;
}
else {
/* Native Arg2 == Arg1 in GL_EXT_texture_env_combine spec */
/* Native Arg0 == Arg2 in GL_EXT_texture_env_combine spec */
- /* When we render we need to figure out which is the last really enabled
- * tex unit, and put last stage on it
- */
-
- imesa->TexBlendColorPipeNum[unit] = 0;
- used = 0;
-
/* Build color pipeline */
+ used = 0;
imesa->TexBlend[unit][used++] = (STATE3D_MAP_BLEND_OP_CMD(unit) |
TEXPIPE_COLOR |
ENABLE_TEXOUTPUT_WRT_SEL |
return GL_FALSE;
}
else {
- disable_tex( ctx, unit );
- return GL_TRUE;
+ return disable_tex( ctx, unit );
}
}
-/* Only deal with unit 0 and 1 for right now */
void i830UpdateTextureState( GLcontext *ctx )
{
i830ContextPtr imesa = I830_CONTEXT(ctx);
- int pipe_num = 0;
+ int i;
+ int last_stage = 0;
GLboolean ok;
- ok = (i830UpdateTexUnit( ctx, 0 ) &&
- i830UpdateTexUnit( ctx, 1 ) &&
- i830UpdateTexUnit( ctx, 2 ) &&
- i830UpdateTexUnit( ctx, 3 ));
+ for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) {
+ if ( (ctx->Texture.Unit[i]._ReallyEnabled == TEXTURE_2D_BIT)
+ || (ctx->Texture.Unit[i]._ReallyEnabled == TEXTURE_RECT_BIT) ) {
+ last_stage = i;
+ }
+ }
+
+ ok = GL_TRUE;
+ for ( i = 0 ; i <= last_stage ; i++ ) {
+ ok = ok && i830UpdateTexUnit( ctx, i );
+ }
FALLBACK( imesa, I830_FALLBACK_TEXTURE, !ok );
/* Make sure last stage is set correctly */
- if(imesa->TexEnabledMask & I830_TEX_UNIT_ENABLED(3)) {
- pipe_num = imesa->TexBlendColorPipeNum[3];
- imesa->TexBlend[3][pipe_num] |= TEXOP_LAST_STAGE;
- } else if(imesa->TexEnabledMask & I830_TEX_UNIT_ENABLED(2)) {
- pipe_num = imesa->TexBlendColorPipeNum[2];
- imesa->TexBlend[2][pipe_num] |= TEXOP_LAST_STAGE;
- } else if(imesa->TexEnabledMask & I830_TEX_UNIT_ENABLED(1)) {
- pipe_num = imesa->TexBlendColorPipeNum[1];
- imesa->TexBlend[1][pipe_num] |= TEXOP_LAST_STAGE;
- } else {
- pipe_num = imesa->TexBlendColorPipeNum[0];
- imesa->TexBlend[0][pipe_num] |= TEXOP_LAST_STAGE;
- }
+ imesa->TexBlend[last_stage][0] |= TEXOP_LAST_STAGE;
}