Mesa (master): llvmpipe: check shader outputs are non-null before using

Keith Whitwell keithw at kemper.freedesktop.org
Fri Oct 15 13:49:32 UTC 2010


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

Author: Keith Whitwell <keithw at vmware.com>
Date:   Fri Oct 15 13:23:05 2010 +0100

llvmpipe: check shader outputs are non-null before using

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 8df807c..c4b1b86 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -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]);
       }




More information about the mesa-commit mailing list