Module: Mesa Branch: master Commit: cab995b4630cb6143a3172b44efda06ad2fa6051 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cab995b4630cb6143a3172b44efda06ad2fa6051
Author: Boris Brezillon <[email protected]> Date: Thu May 14 13:18:33 2020 +0200 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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565> --- src/compiler/nir/nir_deref.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c index c32731d156c..a5282ce128f 100644 --- a/src/compiler/nir/nir_deref.c +++ b/src/compiler/nir/nir_deref.c @@ -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)); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
