Mesa (staging/19.0): nir: Fix deref offset calculation for structs.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 22 16:08:12 UTC 2019
Module: Mesa
Branch: staging/19.0
Commit: 229c4abde39f8481d09492eea5b9b4fe98283d78
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=229c4abde39f8481d09492eea5b9b4fe98283d78
Author: Eric Anholt <eric at anholt.net>
Date: Wed Apr 17 10:09:14 2019 -0700
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: e8e159e9df40 ("nir/deref: Add helpers for getting offsets")
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
(cherry picked from commit 9ac5ec2f90f8b6b2c0e67039b1ae7590374be872)
---
src/compiler/nir/nir_deref.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir_deref.c b/src/compiler/nir/nir_deref.c
index 1af45a45deb..1e321a66208 100644
--- a/src/compiler/nir/nir_deref.c
+++ b/src/compiler/nir/nir_deref.c
@@ -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");
}
More information about the mesa-commit
mailing list