diff options
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_opt_find_array_copies.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_opt_find_array_copies.c b/src/compiler/nir/nir_opt_find_array_copies.c index 28f77335d99..63609715c3a 100644 --- a/src/compiler/nir/nir_opt_find_array_copies.c +++ b/src/compiler/nir/nir_opt_find_array_copies.c @@ -100,14 +100,15 @@ node_for_deref(nir_deref_instr *instr, struct match_node *parent, } case nir_deref_type_array_wildcard: - idx = glsl_get_length(instr->type); + idx = parent->num_children - 1; break; case nir_deref_type_array: if (nir_src_is_const(instr->arr.index)) { idx = nir_src_as_uint(instr->arr.index); + assert(idx < parent->num_children - 1); } else { - idx = glsl_get_length(instr->type); + idx = parent->num_children - 1; } break; |