On Wed, Oct 12, 2016 at 12:04 AM,  <srol...@vmware.com> wrote:
> From: Roland Scheidegger <srol...@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);
> +         }
> +      }

It's better to use LLVMGetUndef for uninitialized inputs and temps.
That can eliminate more code than initializing everything to 0.
(radeonsi uses undef)

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

Reply via email to