OSDN Git Service

st/glsl_to_nir: fix incorrect arrary access
authorTimothy Arceri <tarceri@itsqueeze.com>
Fri, 1 Mar 2019 10:35:41 +0000 (21:35 +1100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 25 Mar 2019 16:48:24 +0000 (16:48 +0000)
commitd29dca6d1589336cd33e6fbfec01e765859036f1
tree5fb264eb5183d8d74314603c04239ccb30c6d1f9
parent643754ce678a16643e7d60ffe967a8000abc15d2
st/glsl_to_nir: fix incorrect arrary access

This fixes a segfault when we try to access the array using a
-1 when the array wasn't allocated in the first place.

Before 7536af670b75 we would just access a pre-allocated array
that was also load/stored to/from the shader cache. But now the
cache will no longer allocate these arrays if they are empty.
The change resulted in tests such as the following segfaulting
when run with a warm shader cache.

tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index.shader_test

(cherry picked from commit cb2898f4786f9e80e0a2dd061d620fc7ced6f1ea)
src/mesa/state_tracker/st_glsl_to_nir.cpp