From 7e86b2ddae32fc86fc684a0dcf32a87a0d795267 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 12 Oct 2016 00:00:28 +0200 Subject: 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 --- 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 87951fa165d..4270a8fb7a8 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, -- cgit v1.2.3