r300: Don't disable destination read if the src blend factor needs it
authorStefan Dösinger <stefandoesinger@gmx.at>
Fri, 7 Dec 2012 16:38:35 +0000 (17:38 +0100)
committerMarek Olšák <maraeo@gmail.com>
Fri, 7 Dec 2012 16:48:16 +0000 (17:48 +0100)
The read can remain disabled if the src alpha factor needs it because
the result would still be zero.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57984

NOTE: This is a candidate for stable release branches.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
src/gallium/drivers/r300/r300_state.c

index fba2d35b8f9669cab48976f5d7f18d3fd7b67d58..050c8f44550c971b3d03f369c80c2325f82996bc 100644 (file)
@@ -288,7 +288,11 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
                          dstRGB == PIPE_BLENDFACTOR_ZERO) &&
                         (dstA == PIPE_BLENDFACTOR_SRC_COLOR ||
                          dstA == PIPE_BLENDFACTOR_SRC_ALPHA ||
-                         dstA == PIPE_BLENDFACTOR_ZERO)) {
+                         dstA == PIPE_BLENDFACTOR_ZERO) &&
+                        (srcRGB != PIPE_BLENDFACTOR_DST_COLOR &&
+                         srcRGB != PIPE_BLENDFACTOR_DST_ALPHA &&
+                         srcRGB != PIPE_BLENDFACTOR_INV_DST_COLOR &&
+                         srcRGB != PIPE_BLENDFACTOR_INV_DST_ALPHA)) {
                          blend_control |= R500_SRC_ALPHA_0_NO_READ;
                     }
 
@@ -297,7 +301,11 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
                          dstRGB == PIPE_BLENDFACTOR_ZERO) &&
                         (dstA == PIPE_BLENDFACTOR_INV_SRC_COLOR ||
                          dstA == PIPE_BLENDFACTOR_INV_SRC_ALPHA ||
-                         dstA == PIPE_BLENDFACTOR_ZERO)) {
+                         dstA == PIPE_BLENDFACTOR_ZERO) &&
+                        (srcRGB != PIPE_BLENDFACTOR_DST_COLOR &&
+                         srcRGB != PIPE_BLENDFACTOR_DST_ALPHA &&
+                         srcRGB != PIPE_BLENDFACTOR_INV_DST_COLOR &&
+                         srcRGB != PIPE_BLENDFACTOR_INV_DST_ALPHA)) {
                          blend_control |= R500_SRC_ALPHA_1_NO_READ;
                     }
                 }