i965: Fix glean/texSwizzle regression in previous commit.
authorEric Anholt <eric@anholt.net>
Sun, 3 Oct 2010 07:24:09 +0000 (00:24 -0700)
committerEric Anholt <eric@anholt.net>
Sun, 3 Oct 2010 07:24:09 +0000 (00:24 -0700)
Easy enough patch, who needs a full test run.  Oh, that's right.  Me.

src/mesa/drivers/dri/i965/brw_wm.c

index 6610640..2ea5967 100644 (file)
@@ -342,6 +342,15 @@ static void brw_wm_populate_key( struct brw_context *brw,
       if (unit->_ReallyEnabled) {
          const struct gl_texture_object *t = unit->_Current;
          const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
+        int swizzles[SWIZZLE_NIL + 1] = {
+           SWIZZLE_X,
+           SWIZZLE_Y,
+           SWIZZLE_Z,
+           SWIZZLE_W,
+           SWIZZLE_ZERO,
+           SWIZZLE_ONE,
+           SWIZZLE_NIL
+        };
 
         key->tex_swizzles[i] = SWIZZLE_NOOP;
 
@@ -352,17 +361,11 @@ static void brw_wm_populate_key( struct brw_context *brw,
          */
         if (t->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) {
            if (t->DepthMode == GL_ALPHA) {
-              key->tex_swizzles[i] =
-                 MAKE_SWIZZLE4(SWIZZLE_ZERO,
-                               SWIZZLE_ZERO,
-                               SWIZZLE_ZERO,
-                               SWIZZLE_X);
+              swizzles[0] = SWIZZLE_ZERO;
+              swizzles[1] = SWIZZLE_ZERO;
+              swizzles[2] = SWIZZLE_ZERO;
            } else if (t->DepthMode == GL_LUMINANCE) {
-              key->tex_swizzles[i] =
-                 MAKE_SWIZZLE4(SWIZZLE_X,
-                               SWIZZLE_X,
-                               SWIZZLE_X,
-                               SWIZZLE_ONE);
+              swizzles[3] = SWIZZLE_ONE;
            }
         }
 
@@ -372,14 +375,11 @@ static void brw_wm_populate_key( struct brw_context *brw,
                key->yuvtex_swap_mask |= 1 << i;
         }
 
-        key->tex_swizzles[i] = MAKE_SWIZZLE4(GET_SWZ(key->tex_swizzles[i],
-                                                     GET_SWZ(t->_Swizzle, 0)),
-                                             GET_SWZ(key->tex_swizzles[i],
-                                                     GET_SWZ(t->_Swizzle, 1)),
-                                             GET_SWZ(key->tex_swizzles[i],
-                                                     GET_SWZ(t->_Swizzle, 2)),
-                                             GET_SWZ(key->tex_swizzles[i],
-                                                     GET_SWZ(t->_Swizzle, 3)));
+        key->tex_swizzles[i] =
+           MAKE_SWIZZLE4(swizzles[GET_SWZ(t->_Swizzle, 0)],
+                         swizzles[GET_SWZ(t->_Swizzle, 1)],
+                         swizzles[GET_SWZ(t->_Swizzle, 2)],
+                         swizzles[GET_SWZ(t->_Swizzle, 3)]);
       }
       else {
          key->tex_swizzles[i] = SWIZZLE_NOOP;