From c8dfed0c12d42a16a53d328139013c802262a0a2 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 6 Apr 2021 15:19:44 -0400 Subject: [PATCH] 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 Part-of: --- 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) {