From 86f7ce06be003a0cc682b80a0c7574259db83be4 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Thu, 22 May 2025 19:34:48 +0200 Subject: [PATCH] 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 Part-of: --- src/gallium/drivers/zink/zink_lower_cubemap_to_array.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c b/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c index cfadb6e9ba8..8557c114d5b 100644 --- a/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c +++ b/src/gallium/drivers/zink/zink_lower_cubemap_to_array.c @@ -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) */