llvmpipe: don't try to emit non-existent color outputs
authorKeith Whitwell <keithw@vmware.com>
Thu, 14 Oct 2010 12:15:28 +0000 (13:15 +0100)
committerKeith Whitwell <keithw@vmware.com>
Thu, 14 Oct 2010 13:08:20 +0000 (14:08 +0100)
src/gallium/drivers/llvmpipe/lp_state_fs.c

index c09835635dd0e7907a7d0c87d82b9214a69bc11b..6e3c27e78e95170781fbf4781e86e7255d7d668c 100644 (file)
@@ -406,14 +406,15 @@ generate_fs(struct llvmpipe_context *lp,
       if (shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR)
       {
          unsigned cbuf = shader->info.base.output_semantic_index[attrib];
-         for(chan = 0; chan < NUM_CHANNELS; ++chan)
-         {
-            /* XXX: just initialize outputs to point at colors[] and
-             * skip this.
-             */
-            LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
-            lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]);
-            LLVMBuildStore(builder, out, color[cbuf][chan]);
+         for(chan = 0; chan < NUM_CHANNELS; ++chan) {
+            if(outputs[attrib][chan]) {
+               /* XXX: just initialize outputs to point at colors[] and
+                * skip this.
+                */
+               LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
+               lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]);
+               LLVMBuildStore(builder, out, color[cbuf][chan]);
+            }
          }
       }
    }