From 1ef9ba9166a7eae62b564b4ce264069a9f1ddebf Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Thu, 19 Jan 2023 13:23:35 -0800 Subject: [PATCH] microsoft/compiler: Don't emit threadgroup barriers for graphics shaders Part-of: --- src/microsoft/compiler/nir_to_dxil.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/microsoft/compiler/nir_to_dxil.c b/src/microsoft/compiler/nir_to_dxil.c index a7f1905..ef631cb 100644 --- a/src/microsoft/compiler/nir_to_dxil.c +++ b/src/microsoft/compiler/nir_to_dxil.c @@ -2740,14 +2740,16 @@ emit_barrier_impl(struct ntd_context *ctx, nir_variable_mode modes, nir_scope ex if (execution_scope == NIR_SCOPE_WORKGROUP) flags |= DXIL_BARRIER_MODE_SYNC_THREAD_GROUP; + bool is_compute = ctx->mod.shader_kind == DXIL_COMPUTE_SHADER; + if (modes & (nir_var_mem_ssbo | nir_var_mem_global | nir_var_image)) { - if (mem_scope > NIR_SCOPE_WORKGROUP) + if (mem_scope > NIR_SCOPE_WORKGROUP || !is_compute) flags |= DXIL_BARRIER_MODE_UAV_FENCE_GLOBAL; else flags |= DXIL_BARRIER_MODE_UAV_FENCE_THREAD_GROUP; } - if (modes & nir_var_mem_shared) + if ((modes & nir_var_mem_shared) && is_compute) flags |= DXIL_BARRIER_MODE_GROUPSHARED_MEM_FENCE; func = dxil_get_function(&ctx->mod, "dx.op.barrier", DXIL_NONE); -- 2.7.4