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

Author: Roland Scheidegger <srol...@vmware.com>
Date:   Wed Oct 12 00:00:28 2016 +0200

draw: initialize shader inputs

This should make the code more robust if a shader tries to use inputs which
aren't defined by the vertex element layout (which usually shouldn't happen).

No piglit change.

Reviewed-by: Brian Paul <bri...@vmware.com>

---

 src/gallium/auxiliary/draw/draw_llvm.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c 
b/src/gallium/auxiliary/draw/draw_llvm.c
index 87951fa..4270a8f 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1705,6 +1705,13 @@ draw_llvm_generate(struct draw_llvm *llvm, struct 
draw_llvm_variant *variant,
       lp_build_printf(gallivm, " --- io %d = %p, loop counter %d\n",
                       io_itr, io, lp_loop.counter);
 #endif
+
+      for (j = draw->pt.nr_vertex_elements; j < PIPE_MAX_SHADER_INPUTS; j++) {
+         for (i = 0; i < TGSI_NUM_CHANNELS; i++) {
+            inputs[j][i] = lp_build_zero(gallivm, vs_type);
+         }
+      }
+
       for (i = 0; i < vector_length; ++i) {
          LLVMValueRef vert_index =
             LLVMBuildAdd(builder,

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to