+ validate_assert(state, glsl_type_is_struct_or_ifc(parent->type));
+ validate_assert(state,
+ instr->strct.index < glsl_get_length(parent->type));
+ validate_assert(state, instr->type ==
+ glsl_get_struct_field(parent->type, instr->strct.index));
+ break;
+
+ case nir_deref_type_array:
+ case nir_deref_type_array_wildcard:
+ if (instr->mode == nir_var_mem_ubo ||
+ instr->mode == nir_var_mem_ssbo ||
+ instr->mode == nir_var_mem_shared ||
+ instr->mode == nir_var_mem_global) {
+ /* Shared variables and UBO/SSBOs have a bit more relaxed rules
+ * because we need to be able to handle array derefs on vectors.
+ * Fortunately, nir_lower_io handles these just fine.
+ */
+ validate_assert(state, glsl_type_is_array(parent->type) ||
+ glsl_type_is_matrix(parent->type) ||
+ glsl_type_is_vector(parent->type));
+ } else {
+ /* Most of NIR cannot handle array derefs on vectors */
+ validate_assert(state, glsl_type_is_array(parent->type) ||
+ glsl_type_is_matrix(parent->type));
+ }
+ validate_assert(state,
+ instr->type == glsl_get_array_element(parent->type));
+
+ if (instr->deref_type == nir_deref_type_array) {
+ validate_src(&instr->arr.index, state,
+ nir_dest_bit_size(instr->dest), 1);
+ }