llvmpipe: check shader outputs are non-null before using
authorKeith Whitwell <keithw@vmware.com>
Fri, 15 Oct 2010 12:23:05 +0000 (13:23 +0100)
committerKeith Whitwell <keithw@vmware.com>
Fri, 15 Oct 2010 13:49:13 +0000 (14:49 +0100)
src/gallium/drivers/llvmpipe/lp_state_fs.c

index 8df807cec883e189b226e110602874c60bcbdc54..c4b1b868b65fcdc7a248af6f483b13717ffa2804 100644 (file)
@@ -345,7 +345,7 @@ generate_fs(struct llvmpipe_context *lp,
                                            TGSI_SEMANTIC_COLOR,
                                            0);
 
-      if (color0 != -1) {
+      if (color0 != -1 && outputs[color0][3]) {
          LLVMValueRef alpha = LLVMBuildLoad(builder, outputs[color0][3], "alpha");
          LLVMValueRef alpha_ref_value;
 
@@ -364,7 +364,7 @@ generate_fs(struct llvmpipe_context *lp,
                                          TGSI_SEMANTIC_POSITION,
                                          0);
          
-      if (pos0 != -1) {
+      if (pos0 != -1 && outputs[pos0][2]) {
          z = LLVMBuildLoad(builder, outputs[pos0][2], "z");
          lp_build_name(z, "output%u.%u.%c", i, pos0, "xyzw"[chan]);
       }