From d350976ba06d4ef93aa53fc4cd9da57be46ae924 Mon Sep 17 00:00:00 2001 From: Patrick Mours Date: Wed, 23 Mar 2022 16:07:43 +0100 Subject: Cycles: Add Hydra render delegate This patch adds a Hydra render delegate to Cycles, allowing Cycles to be used for rendering in applications that provide a Hydra viewport. The implementation was written from scratch against Cycles X, for integration into the Blender repository to make it possible to continue developing it in step with the rest of Cycles. For this purpose it follows the style of the rest of the Cycles code and can be built with a CMake option (`WITH_CYCLES_HYDRA_RENDER_DELEGATE=1`) similar to the existing standalone version of Cycles. Since Hydra render delegates need to be built against the exact USD version and other dependencies as the target application is using, this is intended to be built separate from Blender (`WITH_BLENDER=0` CMake option) and with support for library versions different from what Blender is using. As such the CMake build scripts for Windows had to be modified slightly, so that the Cycles Hydra render delegate can e.g. be built with MSVC 2017 again even though Blender requires MSVC 2019 now, and it's possible to specify custom paths to the USD SDK etc. The codebase supports building against the latest USD release 22.03 and all the way back to USD 20.08 (with some limitations). Reviewed By: brecht, LazyDodo Differential Revision: https://developer.blender.org/D14398 --- intern/cycles/CMakeLists.txt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'intern/cycles/CMakeLists.txt') diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index ad2b5ab4d7b..1cc3dccf426 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -2,8 +2,12 @@ # Copyright 2011-2022 Blender Foundation # Standalone or with Blender -if(NOT WITH_BLENDER AND WITH_CYCLES_STANDALONE) - set(CYCLES_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) +if(NOT WITH_BLENDER) + if(WITH_CYCLES_STANDALONE OR NOT WITH_CYCLES_HYDRA_RENDER_DELEGATE) + set(CYCLES_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) + else() + set(CYCLES_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/hdCycles/resources) + endif() else() set(WITH_CYCLES_BLENDER ON) # WINDOWS_PYTHON_DEBUG needs to write into the user addons folder since it will @@ -335,6 +339,11 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang") unset(_has_no_error_unused_macros) endif() +if(WITH_CYCLES_HYDRA_RENDER_DELEGATE AND NOT WITH_USD) + message(STATUS "USD not found, disabling WITH_CYCLES_HYDRA_RENDER_DELEGATE") + set(WITH_CYCLES_HYDRA_RENDER_DELEGATE OFF) +endif() + if(WITH_CYCLES_CUDA_BINARIES AND (NOT WITH_CYCLES_CUBIN_COMPILER)) if(MSVC) set(MAX_MSVC 1800) @@ -395,6 +404,10 @@ if(WITH_GTESTS) add_subdirectory(test) endif() -if(NOT WITH_BLENDER AND WITH_CYCLES_STANDALONE) +if(WITH_CYCLES_HYDRA_RENDER_DELEGATE) + add_subdirectory(hydra) +endif() + +if(NOT WITH_BLENDER) delayed_do_install(${CMAKE_BINARY_DIR}/bin) endif() -- cgit v1.2.3