nir_deref_path path;
nir_deref_path_init(&path, deref, NULL);
- assert(path.path[0]->deref_type == nir_deref_type_var);
-
unsigned offset = 0;
for (nir_deref_instr **p = &path.path[1]; *p; p++) {
switch ((*p)->deref_type) {
(*p)->strct.index);
break;
}
+ case nir_deref_type_cast:
+ /* A cast doesn't contribute to the offset */
+ break;
default:
unreachable("Unsupported deref type");
}
nir_deref_path path;
nir_deref_path_init(&path, deref, NULL);
- assert(path.path[0]->deref_type == nir_deref_type_var);
-
nir_ssa_def *offset = nir_imm_intN_t(b, 0, deref->dest.ssa.bit_size);
for (nir_deref_instr **p = &path.path[1]; *p; p++) {
switch ((*p)->deref_type) {
offset = nir_iadd_imm(b, offset, field_offset);
break;
}
+ case nir_deref_type_cast:
+ /* A cast doesn't contribute to the offset */
+ break;
default:
unreachable("Unsupported deref type");
}