Module: Mesa
Branch: main
Commit: 2178a8da51fee6dc266541c468de58e66b7b0e17
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2178a8da51fee6dc266541c468de58e66b7b0e17

Author: Caio Oliveira <[email protected]>
Date:   Sun Feb 26 20:59:05 2023 -0800

gallivm: Fix handling of nir_intrinsic_scoped_barrier

A scoped barrier only has a control barrier behavior if there's
an execution scope.

Fixes: 13d900de0dcf ("llvmpipe: set 
nir_shader_compiler_options::use_scoped_barrier")
Reviewed-by: Faith Ekstrand <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3339>

---

 src/gallium/auxiliary/gallivm/lp_bld_nir.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c 
b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
index 2ef3d4b655b..870c120ff56 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
@@ -2123,9 +2123,12 @@ visit_intrinsic(struct lp_build_nir_context *bld_base,
       visit_shared_atomic(bld_base, instr, result);
       break;
    case nir_intrinsic_control_barrier:
-   case nir_intrinsic_scoped_barrier:
       visit_barrier(bld_base);
       break;
+   case nir_intrinsic_scoped_barrier:
+      if (nir_intrinsic_execution_scope(instr) != NIR_SCOPE_NONE)
+         visit_barrier(bld_base);
+      break;
    case nir_intrinsic_group_memory_barrier:
    case nir_intrinsic_memory_barrier:
    case nir_intrinsic_memory_barrier_shared:

Reply via email to