Mesa (master): vc4: Fix SRC_ALPHA_SATURATE blending.

Eric Anholt anholt at kemper.freedesktop.org
Tue Oct 21 15:44:29 UTC 2014


Module: Mesa
Branch: master
Commit: ef280c95f2623357452f5ca8e65367b7ac30699f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef280c95f2623357452f5ca8e65367b7ac30699f

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Oct 21 15:46:48 2014 +0100

vc4: Fix SRC_ALPHA_SATURATE blending.

Fixes glean blendFunc.

---

 src/gallium/drivers/vc4/vc4_program.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c
index 7a2a975..c6d9fb3 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -1308,9 +1308,17 @@ vc4_blend_channel(struct vc4_compile *c,
         case PIPE_BLENDFACTOR_DST_COLOR:
                 return qir_FMUL(c, val, dst[channel]);
         case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
-                return qir_FMIN(c, src[3], qir_FSUB(c,
-                                                    qir_uniform_f(c, 1.0),
-                                                    dst[3]));
+                if (channel != 3) {
+                        return qir_FMUL(c,
+                                        val,
+                                        qir_FMIN(c,
+                                                 src[3],
+                                                 qir_FSUB(c,
+                                                          qir_uniform_f(c, 1.0),
+                                                          dst[3])));
+                } else {
+                        return val;
+                }
         case PIPE_BLENDFACTOR_CONST_COLOR:
                 return qir_FMUL(c, val,
                                 get_temp_for_uniform(c,




More information about the mesa-commit mailing list