summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorDanylo Piliaiev <[email protected]>2020-04-21 18:20:39 +0300
committerMarge Bot <[email protected]>2020-04-22 08:46:12 +0000
commit66229aa16968eb60dd631a8f48f593a4fa8478d5 (patch)
treefcc4c39e2f0ed8b065ca3637a9786e1310b987ce /src/compiler
parentf402b7c57641dd2ab4d39032574294c03d75b595 (diff)
spirv: Expand workaround for OpControlBarrier on old GLSLang
In SPIRV of compute shader in Aztec Ruins benchmark there is: OpControlBarrier %uint_1 %uint_1 %uint_0 // ControlBarrier(Device, Device, rdcspv::MemorySemantics(0)); which is an incorrect translation of glsl barrier(). GLSLang, prior to c3f1cdfa, emitted the OpControlBarrier with Device instead of Workgroup for execution scope. 2365520c covers similar case but isn't applied when execution_scope is SpvScopeDevice. Cc: <[email protected]> Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2742 Signed-off-by: Danylo Piliaiev <[email protected]> Tested-by: Rafael Antognolli <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4660>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 3cac23433f2..6cf43cd2ca7 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3664,11 +3664,15 @@ vtn_handle_barrier(struct vtn_builder *b, SpvOp opcode,
/* GLSLang, prior to commit 8297936dd6eb3, emitted OpControlBarrier with
* memory semantics of None for GLSL barrier().
+ * And before that, prior to c3f1cdfa, emitted the OpControlBarrier with
+ * Device instead of Workgroup for execution scope.
*/
if (b->wa_glslang_cs_barrier &&
b->nb.shader->info.stage == MESA_SHADER_COMPUTE &&
- execution_scope == SpvScopeWorkgroup &&
+ (execution_scope == SpvScopeWorkgroup ||
+ execution_scope == SpvScopeDevice) &&
memory_semantics == SpvMemorySemanticsMaskNone) {
+ execution_scope = SpvScopeWorkgroup;
memory_scope = SpvScopeWorkgroup;
memory_semantics = SpvMemorySemanticsAcquireReleaseMask |
SpvMemorySemanticsWorkgroupMemoryMask;