ac/nir: use scoped barriers to finish stores before exports

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21624>
This commit is contained in:
Rhys Perry
2023-02-28 17:44:33 +00:00
committed by Marge Bot
parent 417990b19e
commit 62f023f6cf
2 changed files with 7 additions and 5 deletions

View File

@@ -250,10 +250,11 @@ ac_nir_export_position(nir_builder *b,
* the pixel shader starts.
*/
if (gfx_level >= GFX10 && no_param_export && b->shader->info.writes_memory) {
nir_intrinsic_instr *wait_instr =
nir_intrinsic_instr_create(b->shader, nir_intrinsic_memory_barrier_buffer);
nir_instr_insert_before(&final_exp->instr, &wait_instr->instr);
nir_cursor cursor = b->cursor;
b->cursor = nir_before_instr(&final_exp->instr);
nir_scoped_memory_barrier(b, NIR_SCOPE_DEVICE, NIR_MEMORY_RELEASE,
nir_var_mem_ssbo | nir_var_mem_global | nir_var_image);
b->cursor = cursor;
}
}

View File

@@ -2012,6 +2012,7 @@ ngg_build_streamout_vertex(nir_builder *b, nir_xfb_info *info,
vtx_buffer_offsets[out->buffer],
zero, zero,
.base = out->offset,
.memory_modes = nir_var_mem_ssbo,
.access = ACCESS_NON_TEMPORAL);
}
}
@@ -2071,7 +2072,7 @@ ngg_nogs_build_streamout(nir_builder *b, lower_ngg_nogs_state *s)
* TODO: not sure if we need this barrier when late prim export, as I
* can't observe test fail without this barrier.
*/
nir_memory_barrier_buffer(b);
nir_scoped_memory_barrier(b, NIR_SCOPE_DEVICE, NIR_MEMORY_RELEASE, nir_var_mem_ssbo);
}
static unsigned