Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > 2e99bca2a84cd7bbab1c24bb855e8713 > files > 2

openshadinglanguage1.11-1.11.17.0-10.mga9.src.rpm

From 5fa25409ab9d0366793b3ef1e25bbb8774a457d0 Mon Sep 17 00:00:00 2001
From: Larry Gritz <lg@larrygritz.com>
Date: Wed, 27 Apr 2022 23:55:08 -0700
Subject: [PATCH] Support for LLVM 14 (#1492)

API changes we had to take into account:
* TargetRegistry.h location
* No more DisableTailCalls field in PassManagerBuilder.

Needed to update the ref image for render-microfacet test, some sparklies changed.
Looks like the new LLVM probably JITs to ever so slightly different math code, tickling
some LSB differences that at 1 sample per pixel, results in some different sampling
directions leading to fireflies. We decided to just commit a new ref image and move on.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
---
 INSTALL.md                                     |   4 ++--
 src/build-scripts/build_llvm.bash              |   2 +-
 src/liboslexec/llvm_util.cpp                   |   4 ++++
 testsuite/render-microfacet/ref/out-llvm14.exr | Bin 0 -> 332117 bytes
 4 files changed, 7 insertions(+), 3 deletions(-)
 create mode 100644 testsuite/render-microfacet/ref/out-llvm14.exr

diff --git a/INSTALL.md b/INSTALL.md
index 4db678aa..9f2ccfbf 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -43,8 +43,8 @@ NEW or CHANGED dependencies since the last major release are **bold**.
     DYLD_LIBRARY_PATH on OS X) and then OSL's build scripts will be able
     to find it.
 
-* **[LLVM](http://www.llvm.org) 7, 8, 9, 10, 11, 12, or 13**, including clang
-  libraries.
+* **[LLVM](http://www.llvm.org) 7, 8, 9, 10, 11, 12, 13, or 14**, including
+  clang libraries.
 
   Note that LLVM 10+ is not compatible with C++11, and requires C++14 or
   later. If you *must* build OSL with C++11, you need to use an LLVM that
diff --git a/src/build-scripts/build_llvm.bash b/src/build-scripts/build_llvm.bash
index 91a8584f..a87bbcc9 100755
--- a/src/build-scripts/build_llvm.bash
+++ b/src/build-scripts/build_llvm.bash
@@ -29,7 +29,7 @@ if [[ `uname` == "Linux" ]] ; then
     fi
     LLVMTAR=clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-${LLVM_DISTRO_NAME}.tar.xz
     echo LLVMTAR = $LLVMTAR
-    if [[ "$LLVM_VERSION" == "10.0.0" ]] || [[ "$LLVM_VERSION" == "11.0.0" ]] || [[ "$LLVM_VERSION" == "11.1.0" ]] || [[ "$LLVM_VERSION" == "12.0.0" ]] ; then
+    if [[ "$LLVM_VERSION" == "10.0.0" ]] || [[ "$LLVM_VERSION" == "11.0.0" ]] || [[ "$LLVM_VERSION" == "11.1.0" ]] || [[ "$LLVM_VERSION" == "12.0.0" ]] || [[ "$LLVM_VERSION" == "13.0.0" ]]  || [[ "$LLVM_VERSION" == "14.0.0" ]]  || [[ "$LLVM_VERSION" == "14.0.1" ]] ; then
         # new
         curl --location https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/${LLVMTAR} -o $LLVMTAR
     else
diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp
index 45e0b3e4..96651f00 100644
--- a/src/liboslexec/llvm_util.cpp
+++ b/src/liboslexec/llvm_util.cpp
@@ -37,7 +37,11 @@
 #include <llvm/Support/raw_os_ostream.h>
 #include <llvm/IR/LegacyPassManager.h>
 #include <llvm/IR/ValueSymbolTable.h>
+#if OSL_LLVM_VERSION < 140
 #include <llvm/Support/TargetRegistry.h>
+#else
+#include <llvm/MC/TargetRegistry.h>
+#endif
 
 #include <llvm/Bitcode/BitcodeReader.h>
 #include <llvm/Bitcode/BitcodeWriter.h>