nir: consider more deref types when fixup deref

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 <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29799>
This commit is contained in:
Qiang Yu
2024-06-27 12:12:31 +08:00
committed by Marge Bot
parent f9ed3158b4
commit a071929f8d

View File

@@ -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");
}