nir: Fix deref offset calculation for structs.

We were calcuating the offset for the field within the struct, and just
dropping it on the floor.  Fixes a regression in
KHR-GLES3.shaders.struct.local.nested_struct_array_dynamic_index_fragment
and a few of its friends since the scratch lowering commit.

Fixes: e8e159e9df ("nir/deref: Add helpers for getting offsets")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Eric Anholt 2019-04-17 10:09:14 -07:00
parent 2288b59ddc
commit 9ac5ec2f90
1 changed files with 1 additions and 1 deletions

View File

@ -215,7 +215,7 @@ nir_build_deref_offset(nir_builder *b, nir_deref_instr *deref,
unsigned field_offset =
struct_type_get_field_offset(parent->type, size_align,
(*p)->strct.index);
nir_iadd(b, offset, nir_imm_int(b, field_offset));
offset = nir_iadd(b, offset, nir_imm_int(b, field_offset));
} else {
unreachable("Unsupported deref type");
}