mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 10:50:10 +01:00
nir: Make nir_build_deref_offset() support ptr_as_array
nir_build_deref_offset() can be extended to support calculating an offset relative to a base pointer. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565>
This commit is contained in:
parent
949f8572ec
commit
cab995b463
1 changed files with 2 additions and 1 deletions
|
|
@ -334,7 +334,8 @@ nir_build_deref_offset(nir_builder *b, nir_deref_instr *deref,
|
|||
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) {
|
||||
case nir_deref_type_array: {
|
||||
case nir_deref_type_array:
|
||||
case nir_deref_type_ptr_as_array: {
|
||||
nir_ssa_def *index = nir_ssa_for_src(b, (*p)->arr.index, 1);
|
||||
int stride = type_get_array_stride((*p)->type, size_align);
|
||||
offset = nir_iadd(b, offset, nir_amul_imm(b, index, stride));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue