}
static unsigned
-get_io_offset(nir_deref_instr *deref, bool is_vertex_input)
+get_io_offset(nir_deref_instr *deref, bool is_vertex_input, bool per_vertex)
{
unsigned offset = 0;
for (nir_deref_instr *d = deref; d; d = nir_deref_instr_parent(d)) {
if (d->deref_type == nir_deref_type_array) {
+ if (per_vertex && nir_deref_instr_parent(d)->deref_type == nir_deref_type_var)
+ break;
+
if (!nir_src_is_const(d->arr.index))
return -1;
nir_deref_instr *deref, bool is_output_read)
{
const struct glsl_type *type = var->type;
+ bool per_vertex = nir_is_per_vertex_io(var, shader->info.stage);
- if (nir_is_per_vertex_io(var, shader->info.stage)) {
+ if (per_vertex) {
assert(glsl_type_is_array(type));
type = glsl_get_array_element(type);
}
return false;
}
- unsigned offset = get_io_offset(deref, false);
+ unsigned offset = get_io_offset(deref, false, per_vertex);
if (offset == -1)
return false;