nir/builder: Add nir_scoped_memory_barrier()
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Thu, 9 Jan 2020 18:01:53 +0000 (10:01 -0800)
committerMarge Bot <eric+marge@anholt.net>
Mon, 24 Feb 2020 19:12:11 +0000 (19:12 +0000)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3913>

src/compiler/nir/nir_builder.h

index eabc6a59cfa13e0ab647d0c11f4548af67d97310..69c7d312b841adcc10e18969b5f9562b7fe4d3c0 100644 (file)
@@ -1290,4 +1290,18 @@ nir_compare_func(nir_builder *b, enum compare_func func,
    unreachable("bad compare func");
 }
 
+static inline void
+nir_scoped_memory_barrier(nir_builder *b,
+                          nir_scope scope,
+                          nir_memory_semantics semantics,
+                          nir_variable_mode modes)
+{
+   nir_intrinsic_instr *intrin =
+      nir_intrinsic_instr_create(b->shader, nir_intrinsic_scoped_memory_barrier);
+   nir_intrinsic_set_memory_scope(intrin, scope);
+   nir_intrinsic_set_memory_semantics(intrin, semantics);
+   nir_intrinsic_set_memory_modes(intrin, modes);
+   nir_builder_instr_insert(b, &intrin->instr);
+}
+
 #endif /* NIR_BUILDER_H */