r600g/Cayman: Fix blending using destination alpha factor but non-alpha dest
authorMichel Dänzer <michel.daenzer@amd.com>
Wed, 20 Feb 2013 12:06:18 +0000 (13:06 +0100)
committerMichel Dänzer <michel@daenzer.net>
Wed, 20 Feb 2013 13:43:17 +0000 (14:43 +0100)
Only compile tested, but should fix at least some piglit fbo-blending tests.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
src/gallium/drivers/r600/evergreen_state.c

index ad0a62e968a40d1e79b73d6606bbb12eaea624dc..fd73613871002df788ad184f3d3258292d931c44 100644 (file)
@@ -1460,10 +1460,15 @@ void evergreen_init_color_surface(struct r600_context *rctx,
                        S_028C74_NON_DISP_TILING_ORDER(non_disp_tiling) |
                        S_028C74_FMASK_BANK_HEIGHT(fmask_bankh);
 
-       if (rctx->chip_class == CAYMAN && rtex->resource.b.b.nr_samples > 1) {
-               unsigned log_samples = util_logbase2(rtex->resource.b.b.nr_samples);
-               color_attrib |= S_028C74_NUM_SAMPLES(log_samples) |
-                               S_028C74_NUM_FRAGMENTS(log_samples);
+       if (rctx->chip_class == CAYMAN) {
+               color_attrib |= S_028C74_FORCE_DST_ALPHA_1(desc->swizzle[3] ==
+                                                          UTIL_FORMAT_SWIZZLE_1);
+
+               if (rtex->resource.b.b.nr_samples > 1) {
+                       unsigned log_samples = util_logbase2(rtex->resource.b.b.nr_samples);
+                       color_attrib |= S_028C74_NUM_SAMPLES(log_samples) |
+                                       S_028C74_NUM_FRAGMENTS(log_samples);
+               }
        }
 
        ntype = V_028C70_NUMBER_UNORM;