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 <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4003>
This commit is contained in:
Rhys Perry
2020-03-02 13:56:50 +00:00
committed by Marge Bot
parent 5d713fb66e
commit 6d839addf9
+8 -3
View File
@@ -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 */