i965: Handle swizzles in the addition of YUV texture constants.
authorEric Anholt <eric@anholt.net>
Fri, 8 Oct 2010 05:37:36 +0000 (22:37 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 8 Oct 2010 17:24:30 +0000 (10:24 -0700)
If someone happened to land a set in a different swizzle order, we
would have assertion failed.

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

index da3d3486cea2f9b5c5399ee925940bdaeeea8b5a..af1fda86513cc9d4de5ff7786e9db2bd69d1102e 100644 (file)
@@ -549,6 +549,7 @@ static struct prog_src_register search_or_add_const4f( struct brw_wm_compile *c,
    GLfloat values[4];
    GLuint idx;
    GLuint swizzle;
+   struct prog_src_register reg;
 
    values[0] = s0;
    values[1] = s1;
@@ -556,8 +557,10 @@ static struct prog_src_register search_or_add_const4f( struct brw_wm_compile *c,
    values[3] = s3;
 
    idx = _mesa_add_unnamed_constant( paramList, values, 4, &swizzle );
-   assert(swizzle == SWIZZLE_NOOP); /* Need to handle swizzle in reg setup */
-   return src_reg(PROGRAM_STATE_VAR, idx);
+   reg = src_reg(PROGRAM_STATE_VAR, idx);
+   reg.Swizzle = swizzle;
+
+   return reg;
 }