Mesa (master): nir/gl_lower_buffers: set access for ssbo load/store instrs
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 26 21:54:18 UTC 2021
Module: Mesa
Branch: master
Commit: c8dfed0c12d42a16a53d328139013c802262a0a2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c8dfed0c12d42a16a53d328139013c802262a0a2
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Tue Apr 6 15:19:44 2021 -0400
nir/gl_lower_buffers: set access for ssbo load/store instrs
this is the last place where the information is available, so set the info before
it gets lost
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10074>
---
src/compiler/glsl/gl_nir_lower_buffers.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/compiler/glsl/gl_nir_lower_buffers.c b/src/compiler/glsl/gl_nir_lower_buffers.c
index ec1b7a00cef..d427d4a98be 100644
--- a/src/compiler/glsl/gl_nir_lower_buffers.c
+++ b/src/compiler/glsl/gl_nir_lower_buffers.c
@@ -165,6 +165,24 @@ lower_buffer_interface_derefs_impl(nir_function_impl *impl,
nir_builder b;
nir_builder_init(&b, impl);
+ /* this must be a separate loop before the main pass in order to ensure that
+ * access info is fully propagated prior to the info being lost during rewrites
+ */
+ nir_foreach_block(block, impl) {
+ nir_foreach_instr(instr, block) {
+ if (instr->type != nir_instr_type_intrinsic)
+ continue;
+
+ nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);
+ if (intrin->intrinsic == nir_intrinsic_load_deref ||
+ intrin->intrinsic == nir_intrinsic_store_deref) {
+ nir_variable *var = nir_intrinsic_get_var(intrin, 0);
+ assert(var);
+ nir_intrinsic_set_access(intrin, nir_intrinsic_access(intrin) | var->data.access);
+ }
+ }
+ }
+
nir_foreach_block(block, impl) {
nir_foreach_instr_safe(instr, block) {
switch (instr->type) {
More information about the mesa-commit
mailing list