From a071929f8d3e0faa18df916b4fce48a40b8356fc Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Thu, 27 Jun 2024 12:12:31 +0800 Subject: [PATCH] nir: consider more deref types when fixup deref MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix ANV and virpipe CI test fail when nir_fixup_deref_types is used in nir_vectorize_tess_levels by later commits. Reviewed-by: Marek Olšák Signed-off-by: Qiang Yu Part-of: --- src/compiler/nir/nir_deref.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c index 488fc2f820e..18d6e1cc556 100644 --- a/src/compiler/nir/nir_deref.c +++ b/src/compiler/nir/nir_deref.c @@ -469,16 +469,17 @@ nir_fixup_deref_types_instr(UNUSED struct nir_builder *b, nir_instr *instr, UNUS if (deref->deref_type == nir_deref_type_var) { parent_derived_type = deref->var->type; } else if (deref->deref_type == nir_deref_type_array || - deref->deref_type == nir_deref_type_struct) { + deref->deref_type == nir_deref_type_array_wildcard) { nir_deref_instr *parent = nir_src_as_deref(deref->parent); - if (deref->deref_type == nir_deref_type_array) { - parent_derived_type = glsl_get_array_element(parent->type); - } else if (deref->deref_type == nir_deref_type_struct) { - parent_derived_type = - glsl_get_struct_field(parent->type, deref->strct.index); - } else { - unreachable("Unsupported deref type"); - } + parent_derived_type = glsl_get_array_element(parent->type); + } else if (deref->deref_type == nir_deref_type_struct) { + nir_deref_instr *parent = nir_src_as_deref(deref->parent); + parent_derived_type = glsl_get_struct_field(parent->type, deref->strct.index); + } else if (deref->deref_type == nir_deref_type_ptr_as_array) { + nir_deref_instr *parent = nir_src_as_deref(deref->parent); + parent_derived_type = parent->type; + } else if (deref->deref_type == nir_deref_type_cast) { + return false; } else { unreachable("Unsupported deref type"); }