[Mesa-dev] [PATCH] draw: initialize shader inputs

Brian Paul brianp at vmware.com
Tue Oct 11 22:42:50 UTC 2016


On 10/11/2016 04:04 PM, sroland at vmware.com wrote:
> From: Roland Scheidegger <sroland at vmware.com>
>
> 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.
> ---
>   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,
>

Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the mesa-dev mailing list