From dd382be067149afec07459ce60a37c442af447d9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 14 Feb 2024 03:40:01 +0100 Subject: [PATCH] Fix #118020: Cycles OptiX OSL crashes Turns out we were not building OSL with OptiX enabled anymore. Also check now if the OSL builds has OptiX support and if not disable it in Cycles. Building OSL with support for this (still) does not require either the OptiX SDK or CUDA, it only needs LLVM. Pull Request: https://projects.blender.org/blender/blender/pulls/118234 --- build_files/build_environment/cmake/osl.cmake | 4 ++++ intern/cycles/device/optix/device.cpp | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build_files/build_environment/cmake/osl.cmake b/build_files/build_environment/cmake/osl.cmake index d6121bb3146..07be3eb0913 100644 --- a/build_files/build_environment/cmake/osl.cmake +++ b/build_files/build_environment/cmake/osl.cmake @@ -43,6 +43,10 @@ set(OSL_EXTRA_ARGS -DPython_EXECUTABLE=${PYTHON_BINARY} ) +if(NOT APPLE) + list(APPEND OSL_EXTRA_ARGS -DOSL_USE_OPTIX=ON) +endif() + ExternalProject_Add(external_osl URL file://${PACKAGE_DIR}/${OSL_FILE} DOWNLOAD_DIR ${DOWNLOAD_DIR} diff --git a/intern/cycles/device/optix/device.cpp b/intern/cycles/device/optix/device.cpp index 1d73cd7cef5..5431ea79da4 100644 --- a/intern/cycles/device/optix/device.cpp +++ b/intern/cycles/device/optix/device.cpp @@ -13,6 +13,7 @@ #include "util/log.h" #ifdef WITH_OSL +# include # include #endif @@ -72,7 +73,8 @@ void device_optix_info(const vector &cuda_devices, vector= 13 || OSL_VERSION_MAJOR > 1) +# if defined(WITH_OSL) && defined(OSL_USE_OPTIX) && \ + (OSL_VERSION_MINOR >= 13 || OSL_VERSION_MAJOR > 1) info.has_osl = true; # endif info.denoisers |= DENOISER_OPTIX;