[Mesa-dev] [PATCH] st_glsl_to_tgsi: only skip over slots of an input array that are present

Marek Olšák maraeo at gmail.com
Wed Jul 27 01:02:00 UTC 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Mon, Jul 25, 2016 at 6:08 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> When an application declares varying arrays but does not actually do any
> indirect indexing, some array indices may end up unused in the consuming
> shader, so the number of input slots that correspond to the array ends
> up less than the array_size.
>
> Cc: mesa-stable at lists.freedesktop.org
> ---
> See also the shader_runner Piglit test that I sent out a moment ago.
>
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 7564119..38e2c4a 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -6058,7 +6058,11 @@ st_translate_program(
>                                inputSemanticName[i], inputSemanticIndex[i],
>                                interpMode[i], 0, interpLocation[i],
>                                array_id, array_size);
> -            i += array_size - 1;
> +
> +            GLuint base_attr = inputSlotToAttr[i];
> +            while (i + 1 < numInputs &&
> +                   inputSlotToAttr[i + 1] < base_attr + array_size)
> +               ++i;
>           }
>           else {
>              t->inputs[i] = ureg_DECL_fs_input_cyl_centroid(ureg,
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list