From: Dave Airlie Date: Wed, 21 Aug 2019 06:43:55 +0000 (+1000) Subject: gallivm: add support for fences api on older llvm X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=abfb633968d172c86d6e913d2087406893f4cc71;p=mesa.git gallivm: add support for fences api on older llvm Reviewed-by: Roland Scheidegger --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 5fe697346fe..347381f9b32 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -836,3 +836,14 @@ LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, SingleThread ? llvm::SynchronizationScope::SingleThread : llvm::SynchronizationScope::CrossThread)); } #endif + +#if HAVE_LLVM < 0x305 +LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, + LLVMAtomicOrdering ordering, + LLVMBool singleThread, + const char *Name) +{ + return llvm::wrap(llvm::unwrap(B)->CreateFence(mapFromLLVMOrdering(ordering), + singleThread ? llvm::SynchronizationScope::SingleThread : llvm::SynchronizationScope::CrossThread)); +} +#endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h index 629751502e7..67c2cfd3fc4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h @@ -85,6 +85,11 @@ LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMBool SingleThread); #endif +#if HAVE_LLVM < 0x305 +LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, + LLVMAtomicOrdering ordering, + LLVMBool singleThread, const char *Name); +#endif #ifdef __cplusplus } #endif