swr: only broadcast color0 value, not all color values
authorIlia Mirkin <imirkin@alum.mit.edu>
Mon, 21 Nov 2016 00:08:12 +0000 (19:08 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Wed, 23 Nov 2016 01:27:20 +0000 (20:27 -0500)
The way that dual-source blending is described for GLES2 is very odd,
and we end up with a shader that both has this property set *and* has a
color1 value to be used as the second source. While changing the state
tracker is an option, it seems more reliable to verify that the
broadcast is only done on color0.

Fixes arb_blend_func_extended-fbo-extended-blend-pattern_gles2

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
src/gallium/drivers/swr/swr_shader.cpp

index e4f9796ef19cbd7eacc614806c65c3f3115c4650..2f7223900d3fd28723146e015c3c7e68a7336136 100644 (file)
@@ -645,7 +645,8 @@ BuilderSWR::CompileFS(struct swr_context *ctx, swr_jit_fs_key &key)
 
             LLVMValueRef out =
                LLVMBuildLoad(gallivm->builder, outputs[attrib][channel], "");
-            if (swr_fs->info.base.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS]) {
+            if (swr_fs->info.base.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS] &&
+                swr_fs->info.base.output_semantic_index[attrib] == 0) {
                for (uint32_t rt = 0; rt < key.nr_cbufs; rt++) {
                   STORE(unwrap(out),
                         pPS,