gallivm: add memory barrier support
authorDave Airlie <airlied@redhat.com>
Wed, 21 Aug 2019 00:19:16 +0000 (10:19 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 27 Aug 2019 02:30:13 +0000 (12:30 +1000)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c

index d6625c422765cd9d811e988e32ffd27d0c127f38..ef27b547b7920cb6060e1d75af8d7ea07b77e54a 100644 (file)
@@ -3858,6 +3858,16 @@ atomic_emit(
    }
 }
 
+static void
+membar_emit(
+   const struct lp_build_tgsi_action * action,
+   struct lp_build_tgsi_context * bld_base,
+   struct lp_build_emit_data * emit_data)
+{
+   LLVMBuilderRef builder = bld_base->base.gallivm->builder;
+   LLVMBuildFence(builder, LLVMAtomicOrderingSequentiallyConsistent, false, "");
+}
+
 static void
 increment_vec_ptr_by_mask(struct lp_build_tgsi_context * bld_base,
                           LLVMValueRef ptr,
@@ -4464,6 +4474,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
    bld.bld_base.op_actions[TGSI_OPCODE_ATOMIMIN].emit = atomic_emit;
    bld.bld_base.op_actions[TGSI_OPCODE_ATOMIMAX].emit = atomic_emit;
 
+   bld.bld_base.op_actions[TGSI_OPCODE_MEMBAR].emit = membar_emit;
    if (params->gs_iface) {
       /* There's no specific value for this because it should always
        * be set, but apps using ext_geometry_shader4 quite often