zink: Fix NIR validation error in cubemap-to-array lowering

The cubemap-to-array pass was changing variable types from samplerCubeArray
to sampler2DArray but leaving the corresponding deref instruction types
unchanged. This caused NIR validation to fail with "instr->type ==
instr->var->type" assertion.

Fix by updating both the variable type and the deref instruction type
to maintain consistency required by NIR validation.

Cc: mesa-stable
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35117>
This commit is contained in:
Christian Gmeiner 2025-05-22 19:34:48 +02:00 committed by Marge Bot
parent b0eb715b50
commit 86f7ce06be

View file

@ -388,9 +388,11 @@ lower_cube_coords(nir_builder *b, nir_def *coord, bool is_array)
static void
rewrite_cube_var_type(nir_builder *b, nir_tex_instr *tex)
{
nir_variable *sampler = nir_deref_instr_get_variable(nir_instr_as_deref(tex->src[nir_tex_instr_src_index(tex, nir_tex_src_texture_deref)].src.ssa->parent_instr));
nir_deref_instr *texture_deref = nir_instr_as_deref(tex->src[nir_tex_instr_src_index(tex, nir_tex_src_texture_deref)].src.ssa->parent_instr);
nir_variable *sampler = nir_deref_instr_get_variable(texture_deref);
assert(sampler);
sampler->type = make_2darray_from_cubemap_with_array(sampler->type);
texture_deref->type = sampler->type;
}
/* txb(s, coord, bias) = txl(s, coord, lod(s, coord).y + bias) */