vc4: Fix SRC_ALPHA_SATURATE blending.
authorEric Anholt <eric@anholt.net>
Tue, 21 Oct 2014 14:46:48 +0000 (15:46 +0100)
committerEric Anholt <eric@anholt.net>
Tue, 21 Oct 2014 14:46:48 +0000 (15:46 +0100)
Fixes glean blendFunc.

src/gallium/drivers/vc4/vc4_program.c

index 7a2a9756a5948e67a6a26476b671b10ed39f77b9..c6d9fb31603e2f5269d2a95a46b95500969f4d8b 100644 (file)
@@ -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,