mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 02:20:11 +01:00
nir/glsl: Emit memory barriers as part of barrier()
The GLSL barrier() intrinsic does an implicit shared memory barrier in compute shaders and an implicit TCS patch output barrier in tessellation control shaders. We'd like NIR's barrier intrinsic to just be a control flow barrier and not have memory implications. To satisfy this, we need to add an extra memory barrier in front of each nir_intrinsic_barrier. Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3307>
This commit is contained in:
parent
a4125b4d26
commit
ba43b66dc9
1 changed files with 12 additions and 0 deletions
|
|
@ -2701,6 +2701,18 @@ nir_visitor::visit(ir_dereference_array *ir)
|
|||
void
|
||||
nir_visitor::visit(ir_barrier *)
|
||||
{
|
||||
if (shader->info.stage == MESA_SHADER_COMPUTE) {
|
||||
nir_intrinsic_instr *shared_barrier =
|
||||
nir_intrinsic_instr_create(this->shader,
|
||||
nir_intrinsic_memory_barrier_shared);
|
||||
nir_builder_instr_insert(&b, &shared_barrier->instr);
|
||||
} else if (shader->info.stage == MESA_SHADER_TESS_CTRL) {
|
||||
nir_intrinsic_instr *patch_barrier =
|
||||
nir_intrinsic_instr_create(this->shader,
|
||||
nir_intrinsic_memory_barrier_tcs_patch);
|
||||
nir_builder_instr_insert(&b, &patch_barrier->instr);
|
||||
}
|
||||
|
||||
nir_intrinsic_instr *instr =
|
||||
nir_intrinsic_instr_create(this->shader, nir_intrinsic_barrier);
|
||||
nir_builder_instr_insert(&b, &instr->instr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue