Fixed a bug that showed up in several multitexturing games (Quake3 and
authorIan Romanick <idr@us.ibm.com>
Wed, 12 May 2004 16:29:55 +0000 (16:29 +0000)
committerIan Romanick <idr@us.ibm.com>
Wed, 12 May 2004 16:29:55 +0000 (16:29 +0000)
ThinkTanks were tested) that was related to the recent 4 TMU changes.
Removed the un-needed TexBlendColorPipeNum field from the hardware
context.

src/mesa/drivers/dri/i830/i830_context.h
src/mesa/drivers/dri/i830/i830_state.c
src/mesa/drivers/dri/i830/i830_texstate.c

index 99d2a39c7879136f846e351398f6ea27ad85d4b3..bb88c97de355cfe2e510e471aa221d1392e3ddfa 100644 (file)
@@ -86,8 +86,6 @@ struct i830_context_t
    GLuint TexBlend[I830_MAX_TEXTURE_UNITS][I830_TEXBLEND_SIZE];
    GLuint Init_TexBlend[I830_MAX_TEXTURE_UNITS][I830_TEXBLEND_SIZE];
    GLuint Init_TexBlendWordsUsed[I830_MAX_TEXTURE_UNITS];
-   GLuint Init_TexBlendColorPipeNum[I830_MAX_TEXTURE_UNITS];
-   GLuint TexBlendColorPipeNum[I830_MAX_TEXTURE_UNITS];
    GLuint Init_BufferSetup[I830_DEST_SETUP_SIZE];
    GLuint LodBias[I830_MAX_TEXTURE_UNITS];
    
index 8bfe392682b788fac12c06341d750064df0903bc..2f7ff9f3a1a0d41ee8fb1ee952caa288c5132602 100644 (file)
@@ -1429,8 +1429,6 @@ void i830DDInitState( GLcontext *ctx )
 
       imesa->TexBlendWordsUsed[i] = 0;
       imesa->Init_TexBlendWordsUsed[i] = 0;
-      imesa->TexBlendColorPipeNum[i] = 0;
-      imesa->Init_TexBlendColorPipeNum[i] = 0;
    }
 
    /* Set default blend state */
@@ -1462,7 +1460,6 @@ void i830DDInitState( GLcontext *ctx )
                            TEXBLENDARG_DIFFUSE);
 
    imesa->TexBlendWordsUsed[0] = 4;
-   imesa->TexBlendColorPipeNum[0] = 0;
 
    imesa->Init_TexBlend[0][0] = (STATE3D_MAP_BLEND_OP_CMD(0) |
                            TEXPIPE_COLOR |
@@ -1491,7 +1488,6 @@ void i830DDInitState( GLcontext *ctx )
                            TEXBLENDARG_MODIFY_PARMS |
                            TEXBLENDARG_CURRENT);
    imesa->Init_TexBlendWordsUsed[0] = 4;
-   imesa->Init_TexBlendColorPipeNum[0] = 0;
 
    memset(imesa->Setup, 0, sizeof(imesa->Setup));
 
index d27ac9166044b606083de3f5c2ae81a075a55858..03407eb7718a4b3bd23743325d42aac5fb218393 100644 (file)
@@ -278,7 +278,6 @@ static void i830UpdateTexEnv( GLcontext *ctx, GLuint unit )
                                  TEXBLEND_ARG1 |
                                  TEXBLENDARG_MODIFY_PARMS |
                                  TEXBLENDARG_CURRENT);
-      imesa->TexBlendColorPipeNum[unit] = 0;
       imesa->TexBlendWordsUsed[unit] = 4;
    }
    else {
@@ -440,15 +439,9 @@ static void i830UpdateTexEnv( GLcontext *ctx, GLuint unit )
       /* 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 |
@@ -659,40 +652,34 @@ static GLboolean i830UpdateTexUnit( GLcontext *ctx, GLuint unit )
       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;
 }