diff options
author | Patrick Mours <pmours@nvidia.com> | 2020-10-02 18:40:28 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2020-10-05 16:03:30 +0300 |
commit | 3df90de6c2268bef91d3754f71c7404cfbeeac90 (patch) | |
tree | d079ef4862e6db7233114554e478e0ef69303fc8 /build_files/build_environment/patches | |
parent | 72e741ee62b54cbda9a7ad735cc2c6e4957c3af0 (diff) |
Cycles: Add NanoVDB support for rendering volumes
NanoVDB is a platform-independent sparse volume data structure that makes it possible to
use OpenVDB volumes on the GPU. This patch uses it for volume rendering in Cycles,
replacing the previous usage of dense 3D textures.
Since it has a big impact on memory usage and performance and changes the OpenVDB
branch used for the rest of Blender as well, this is not enabled by default yet, which will
happen only after 2.82 was branched off. To enable it, build both dependencies and Blender
itself with the "WITH_NANOVDB" CMake option.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D8794
Diffstat (limited to 'build_files/build_environment/patches')
-rw-r--r-- | build_files/build_environment/patches/openvdb_nanovdb.diff | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/build_files/build_environment/patches/openvdb_nanovdb.diff b/build_files/build_environment/patches/openvdb_nanovdb.diff new file mode 100644 index 00000000000..50984e91f37 --- /dev/null +++ b/build_files/build_environment/patches/openvdb_nanovdb.diff @@ -0,0 +1,135 @@ +diff -Naur orig/cmake/FindIlmBase.cmake openvdb/cmake/FindIlmBase.cmake +--- orig/cmake/FindIlmBase.cmake 2019-12-06 12:11:33 -0700 ++++ openvdb/cmake/FindIlmBase.cmake 2020-08-12 12:48:44 -0600 +@@ -217,6 +217,8 @@ + set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + endif() + list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_IlmBase_Version_Suffix}.lib") ++ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s.lib") ++ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s_d.lib") + else() + if(ILMBASE_USE_STATIC_LIBS) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +diff -Naur orig/cmake/FindOpenEXR.cmake openvdb/cmake/FindOpenEXR.cmake +--- orig/cmake/FindOpenEXR.cmake 2019-12-06 12:11:33 -0700 ++++ openvdb/cmake/FindOpenEXR.cmake 2020-08-12 12:48:44 -0600 +@@ -210,6 +210,8 @@ + set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") + endif() + list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_OpenEXR_Version_Suffix}.lib") ++ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s.lib") ++ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s_d.lib") + else() + if(OPENEXR_USE_STATIC_LIBS) + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +diff -Naur orig/openvdb/openvdb/CMakeLists.txt openvdb/openvdb/openvdb/CMakeLists.txt +--- orig/openvdb/openvdb/CMakeLists.txt 2019-12-06 12:11:33 -0700 ++++ openvdb/openvdb/openvdb/CMakeLists.txt 2020-08-12 14:12:26 -0600 +@@ -105,7 +105,9 @@ + # http://boost.2283326.n4.nabble.com/CMake-config-scripts-broken-in-1-70-td4708957.html + # https://github.com/boostorg/boost_install/commit/160c7cb2b2c720e74463865ef0454d4c4cd9ae7c + set(BUILD_SHARED_LIBS ON) +- set(Boost_USE_STATIC_LIBS OFF) ++ if(NOT WIN32) # blender links boost statically on windows ++ set(Boost_USE_STATIC_LIBS OFF) ++ endif() + endif() + + find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams system) +@@ -193,6 +195,7 @@ + if(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING) + add_definitions(-DBOOST_ALL_NO_LIB) + endif() ++ add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE -DOPENVDB_OPENEXR_STATICLIB) + endif() + + # @todo Should be target definitions +@@ -383,7 +386,12 @@ + # imported targets. + + if(OPENVDB_CORE_SHARED) +- add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES}) ++ if(WIN32) ++ configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY) ++ add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) ++ else() ++ add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES}) ++ endif() + endif() + + if(OPENVDB_CORE_STATIC) +diff -Naur orig/openvdb/openvdb/version.rc.in openvdb/openvdb/openvdb/version.rc.in +--- orig/openvdb/openvdb/version.rc.in 1969-12-31 17:00:00 -0700 ++++ openvdb/openvdb/openvdb/version.rc.in 2020-08-12 14:15:01 -0600 +@@ -0,0 +1,48 @@ ++#include <winver.h> ++ ++#define VER_FILEVERSION @OpenVDB_MAJOR_VERSION@,@OpenVDB_MINOR_VERSION@,@OpenVDB_PATCH_VERSION@,0 ++#define VER_FILEVERSION_STR "@OpenVDB_MAJOR_VERSION@.@OpenVDB_MINOR_VERSION@.@OpenVDB_PATCH_VERSION@.0\0" ++ ++#define VER_PRODUCTVERSION @OpenVDB_MAJOR_VERSION@,@OpenVDB_MINOR_VERSION@,@OpenVDB_PATCH_VERSION@,0 ++#define VER_PRODUCTVERSION_STR "@OpenVDB_MAJOR_VERSION@.@OpenVDB_MINOR_VERSION@\0" ++ ++#ifndef DEBUG ++#define VER_DEBUG 0 ++#else ++#define VER_DEBUG VS_FF_DEBUG ++#endif ++ ++VS_VERSION_INFO VERSIONINFO ++FILEVERSION VER_FILEVERSION ++PRODUCTVERSION VER_PRODUCTVERSION ++FILEFLAGSMASK VS_FFI_FILEFLAGSMASK ++FILEFLAGS (VER_DEBUG) ++FILEOS VOS__WINDOWS32 ++FILETYPE VFT_DLL ++FILESUBTYPE VFT2_UNKNOWN ++BEGIN ++ BLOCK "StringFileInfo" ++ BEGIN ++ BLOCK "040904E4" ++ BEGIN ++ VALUE "FileDescription", "OpenVDB" ++ VALUE "FileVersion", VER_FILEVERSION_STR ++ VALUE "InternalName", "OpenVDB" ++ VALUE "ProductName", "OpenVDB" ++ VALUE "ProductVersion", VER_PRODUCTVERSION_STR ++ END ++ END ++ ++ BLOCK "VarFileInfo" ++ BEGIN ++ /* The following line should only be modified for localized versions. */ ++ /* It consists of any number of WORD,WORD pairs, with each pair */ ++ /* describing a language,codepage combination supported by the file. */ ++ /* */ ++ /* For example, a file might have values "0x409,1252" indicating that it */ ++ /* supports English language (0x409) in the Windows ANSI codepage (1252). */ ++ ++ VALUE "Translation", 0x409, 1252 ++ ++ END ++END +diff -Naur openvdb-original/CMakeLists.txt openvdb/CMakeLists.txt +--- openvdb-original/CMakeLists.txt 2020-08-27 03:34:02.000000000 +0200 ++++ openvdb/CMakeLists.txt 2020-09-02 10:56:21.665735244 +0200 +@@ -68,6 +68,7 @@ + option(OPENVDB_INSTALL_HOUDINI_PYTHONRC [=[Install a Houdini startup script that sets + the visibilty of OpenVDB nodes and their native equivalents.]=] OFF) + option(OPENVDB_BUILD_MAYA_PLUGIN "Build the Maya plugin" OFF) ++option(OPENVDB_BUILD_NANOVDB "Build nanovdb" ON) + option(OPENVDB_ENABLE_RPATH "Build with RPATH information" ON) + option(OPENVDB_CXX_STRICT "Enable or disable pre-defined compiler warnings" OFF) + option(OPENVDB_CODE_COVERAGE "Enable code coverage. This also overrides CMAKE_BUILD_TYPE to Debug" OFF) +@@ -740,6 +741,10 @@ + add_subdirectory(openvdb_maya) + endif() + ++if(OPENVDB_BUILD_NANOVDB) ++ add_subdirectory(nanovdb) ++endif() ++ + ########################################################################## + + add_custom_target(uninstall +
\ No newline at end of file |