glsl: fix uniform array resizing in the nir linker
authorTimothy Arceri <tarceri@itsqueeze.com>
Mon, 15 Jun 2020 04:03:59 +0000 (14:03 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 17 Jun 2020 01:06:27 +0000 (01:06 +0000)
commita5d3e061af9451758479f97df97afd6351e7d117
treef424fb21ee04b241e02356475e70375e7dd04d0f
parentf63a5781008b3d3c983be43135e1d9d43cd6a3da
glsl: fix uniform array resizing in the nir linker

The initial support tried to match uniform variables from different
shaders based on the variables pointer. This will obviously never
work, instead here we use the variables name whcih also means we
must disable this optimisation for spirv.

Using the base variable name works because when collecting uniform
references we never iterate past the first array dimension, and
only support resizing 1D arrays (we also don't support resizing
arrays inside structs).

We also drop the resized bool as we can't skip processing the var
just because is was resized in another shader, we must resize
the var in all shaders.

Fixes: a34cc97ca3e1 ("glsl: when NIR linker enable use it to resize uniform arrays")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3130
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5487>
src/compiler/glsl/gl_nir_link_uniforms.c