llvmpipe: fix color masking
authorBrian Paul <brianp@vmware.com>
Fri, 16 Apr 2010 20:08:15 +0000 (14:08 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 16 Apr 2010 20:08:26 +0000 (14:08 -0600)
src/gallium/drivers/llvmpipe/lp_state_fs.c

index eee4f12bc0e6ed4f6242f83e8b2867c6bd92c45d..6aa1e581bb3254ebc23e3e050f6279d563995002 100644 (file)
@@ -1117,14 +1117,16 @@ make_variant_key(struct llvmpipe_context *lp,
       assert(format_desc->layout == UTIL_FORMAT_COLORSPACE_RGB ||
              format_desc->layout == UTIL_FORMAT_COLORSPACE_SRGB);
 
+      key->blend.rt[i].colormask = lp->blend->rt[i].colormask;
+
       /* mask out color channels not present in the color buffer.
        * Should be simple to incorporate per-cbuf writemasks:
        */
       for(chan = 0; chan < 4; ++chan) {
          enum util_format_swizzle swizzle = format_desc->swizzle[chan];
 
-         if(swizzle <= UTIL_FORMAT_SWIZZLE_W)
-            key->blend.rt[0].colormask |= (1 << chan);
+         if(swizzle > UTIL_FORMAT_SWIZZLE_W)
+            key->blend.rt[i].colormask &= ~(1 << chan);
       }
    }