diff --git a/src/compiler/nir/nir_lower_task_shader.c b/src/compiler/nir/nir_lower_task_shader.c index e242c0d1171..6d7040828fe 100644 --- a/src/compiler/nir/nir_lower_task_shader.c +++ b/src/compiler/nir/nir_lower_task_shader.c @@ -88,10 +88,23 @@ append_launch_mesh_workgroups_to_nv_task(nir_builder *b, nir_ssa_def *zero = nir_imm_int(b, 0); nir_store_shared(b, zero, zero, .base = s->task_count_shared_addr); + nir_scoped_barrier(b, + .execution_scope = NIR_SCOPE_WORKGROUP, + .memory_scope = NIR_SCOPE_WORKGROUP, + .memory_semantics = NIR_MEMORY_RELEASE, + .memory_modes = nir_var_mem_shared); + /* At the end of the shader, read the task count from shared memory * and emit launch_mesh_workgroups. */ b->cursor = nir_after_cf_list(&b->impl->body); + + nir_scoped_barrier(b, + .execution_scope = NIR_SCOPE_WORKGROUP, + .memory_scope = NIR_SCOPE_WORKGROUP, + .memory_semantics = NIR_MEMORY_ACQUIRE, + .memory_modes = nir_var_mem_shared); + nir_ssa_def *task_count = nir_load_shared(b, 1, 32, zero, .base = s->task_count_shared_addr);