i965: Fix swizzling in vector splitting for the new FS backend.
authorEric Anholt <eric@anholt.net>
Fri, 27 Aug 2010 19:00:29 +0000 (12:00 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 27 Aug 2010 19:02:15 +0000 (12:02 -0700)
We weren't smearing a component of a split RHS out to reach an unsplit
LHS's writemask, so gl_FragColor (always unsplit) would often get
uninitialized values.

Fixes: glsl-algebraic-add-add-1 (and probably many others).
src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp

index d4da86b3b06d2a32d9f29f7ba3a499f101b07c8c..00d5c202485701bf9840843a6a34bca464c9e330 100644 (file)
@@ -281,6 +281,9 @@ ir_vector_splitting_visitor::visit_leave(ir_assignment *ir)
 
         if (rhs) {
            new_rhs = new(mem_ctx) ir_dereference_variable(rhs->components[i]);
+           /* If we're writing into a writemask, smear it out to that channel. */
+           if (!lhs)
+              new_rhs = new(mem_ctx) ir_swizzle(new_rhs, i, i, i, i, i + 1);
         } else {
            new_rhs = new(mem_ctx) ir_swizzle(ir->rhs->clone(mem_ctx, NULL),
                                              i, i, i, i, 1);