diff options
author | Rhys Perry <[email protected]> | 2020-03-02 13:56:50 +0000 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-03 11:49:40 +0000 |
commit | 6d839addf953630afa52200d5e9922646227d84d (patch) | |
tree | 9f48e8ad16ec090c613f3b29183b199da4018556 /src/compiler/spirv | |
parent | 5d713fb66e71bec3d4c9a6324fd0b6b52040ecb2 (diff) |
spirv: improve creation of memory_barrier
It shouldn't check for atomic counters or return in case we also need to
create a TCS output barrier.
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4003>
Diffstat (limited to 'src/compiler/spirv')
-rw-r--r-- | src/compiler/spirv/spirv_to_nir.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index 5ee75877e8b..9403a314b52 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -3605,9 +3605,14 @@ vtn_emit_memory_barrier(struct vtn_builder *b, SpvScope scope, /* There's only two scopes thing left */ vtn_assert(scope == SpvScopeInvocation || scope == SpvScopeDevice); - if ((semantics & all_memory_semantics) == all_memory_semantics) { - vtn_emit_barrier(b, nir_intrinsic_memory_barrier); - return; + /* Map the GLSL memoryBarrier() construct to the corresponding NIR one. */ + static const SpvMemorySemanticsMask glsl_memory_barrier = + SpvMemorySemanticsUniformMemoryMask | + SpvMemorySemanticsWorkgroupMemoryMask | + SpvMemorySemanticsImageMemoryMask; + if ((semantics & glsl_memory_barrier) == glsl_memory_barrier) { + vtn_emit_barrier(b, nir_intrinsic_memory_barrier); + semantics &= ~(glsl_memory_barrier | SpvMemorySemanticsAtomicCounterMemoryMask); } /* Issue a bunch of more specific barriers */ |