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@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10074>
This commit is contained in:
Mike Blumenkrantz 2021-04-06 15:19:44 -04:00 committed by Marge Bot
parent a02328395d
commit c8dfed0c12
1 changed files with 18 additions and 0 deletions

View File

@ -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) {