nir: st_nir_lower_builtin fails for gl_LightSource[i]
For gl_LightSource
(and a few other system values), the pass does:
tokens[1] = nir_src_as_uint(path->path[idx]->arr.index);
which fails is path->path[idx]->arr.index
isn't a constant.
This can be reproduced using this piglit patch and:
$ shader_runner tests/shaders/glsl-fs-statevar-call.shader_test
shader_runner: ../src/compiler/nir/nir.h:2355: nir_src_comp_as_uint: Assertion `nir_src_is_const(src)' failed.
Using:
NIR_PASS_V(nir, nir_lower_indirect_derefs, nir_var_uniform);
before NIR_PASS_V(nir, nir_lower_system_values);
in st_glsl_to_nir.cpp
fixes it, but I don't know if this is the correct fix.