zink: fix cubemap lowering for array samplers

each sampler is 1 driver location, so use the base variable

Fixes: 2d745904ca ("zink: add a gently mangled version of the d3d12 cubemap -> array compiler pass")

fixes:
dEQP-GL45-ES31.functional.shaders.opaque_type_indexing.sampler.const_expression.*.samplercubearray

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17008>
This commit is contained in:
Mike Blumenkrantz 2022-06-11 10:59:59 -04:00 committed by Marge Bot
parent 876bfb6bc3
commit de6af39534
1 changed files with 3 additions and 1 deletions

View File

@ -391,7 +391,9 @@ rewrite_cube_var_type(nir_builder *b, nir_tex_instr *tex)
nir_foreach_variable_with_modes(var, b->shader, nir_var_uniform) {
if (!glsl_type_is_sampler(glsl_without_array(var->type)))
continue;
if (var->data.driver_location == index) {
unsigned size = glsl_type_is_array(var->type) ? glsl_get_length(var->type) : 1;
if (var->data.driver_location == index ||
(var->data.driver_location < index && var->data.driver_location + size > index)) {
sampler = var;
break;
}