Hi, > +static void > +emit_load_store_deref(nir_builder *b, nir_intrinsic_instr *orig_instr, > + nir_deref_instr *parent, > + nir_deref_instr **deref_arr, > + nir_ssa_def **dest, nir_ssa_def *src) > +{ > + for (; *deref_arr; deref_arr++) { > + nir_deref_instr *deref = *deref_arr; > + if (deref->deref_type == nir_deref_type_array && > + nir_src_as_const_value(deref->arr.index) == NULL) { > + int length = glsl_get_length(parent->type); > + > + emit_indirect_load_store_deref(b, orig_instr, parent, deref_arr, > + 0, length, dest, src);
Side note: after reading the existing code (that goes from -base_offset to length - base_offset, and later adds base_offset), I'm kind of glad this goes from 0 to length. > +static bool > +lower_indirect_derefs_block(nir_block *block, nir_builder *b, > + nir_variable_mode modes) > +{ (...) > + nir_deref_instr *deref = > + nir_instr_as_deref(intrin->src[0].ssa->parent_instr); Maybe use the helper 'nir_src_as_deref(intrin->src[0])'? > + > + /* Walk the deref chain back to the base and look for indirects */ > + bool has_indirect = false; > + nir_deref_instr *base = deref; > + while (base->deref_type != nir_deref_type_var) { > + if (base->deref_type == nir_deref_type_array && > + nir_src_as_const_value(base->arr.index) == NULL) > + has_indirect = true; > + > + base = nir_instr_as_deref(base->parent.ssa->parent_instr); Maybe use the helper 'base = nir_deref_instr_parent(base);'? Thanks, Caio _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev