summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorDaniel Schürmann <[email protected]>2019-07-18 20:48:14 +0200
committerJuan A. Suarez Romero <[email protected]>2019-07-25 09:41:06 +0000
commit742f348d32557d9d1d3e5c598ff255a38ff89499 (patch)
treebca97ef73de7fa9648b065ab1dc2e95cc64cc01c /src/compiler
parent327a6b3a642aed42abec47197da5dcc493d91a50 (diff)
spirv: Fix order of barriers in SpvOpControlBarrier
Semantically, the memory barrier has to come first to wait for the completion of pending memory requests. Afterwards, the workgroups can be synchronized. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> (cherry picked from commit e352b4d650d37730e5087792b9a74ef31d1974ab)
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/spirv/spirv_to_nir.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 1a5d4c7988d..71957da235b 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3391,13 +3391,13 @@ vtn_handle_barrier(struct vtn_builder *b, SpvOp opcode,
}
case SpvOpControlBarrier: {
- SpvScope execution_scope = vtn_constant_uint(b, w[1]);
- if (execution_scope == SpvScopeWorkgroup)
- vtn_emit_barrier(b, nir_intrinsic_barrier);
-
SpvScope memory_scope = vtn_constant_uint(b, w[2]);
SpvMemorySemanticsMask memory_semantics = vtn_constant_uint(b, w[3]);
vtn_emit_memory_barrier(b, memory_scope, memory_semantics);
+
+ SpvScope execution_scope = vtn_constant_uint(b, w[1]);
+ if (execution_scope == SpvScopeWorkgroup)
+ vtn_emit_barrier(b, nir_intrinsic_barrier);
break;
}