Mesa (9.0): r300: Don' t disable destination read if the src blend factor needs it

Marek Olšák mareko at kemper.freedesktop.org
Sat Dec 22 01:48:22 UTC 2012


Module: Mesa
Branch: 9.0
Commit: 9311e55c8ad97329bb2d06a0680f5165de9b21f5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9311e55c8ad97329bb2d06a0680f5165de9b21f5

Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date:   Fri Dec  7 17:38:35 2012 +0100

r300: Don't disable destination read if the src blend factor needs it

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 at gmail.com>
(cherry picked from commit ff5a9868c8d5041a3d944ce300c857934f4e8251)

---

 src/gallium/drivers/r300/r300_state.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 624847b..0467e91 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -287,7 +287,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;
                     }
 
@@ -296,7 +300,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;
                     }
                 }




More information about the mesa-commit mailing list