Compare commits
19 Commits
node-add-a
...
temp-chunk
Author | SHA1 | Date | |
---|---|---|---|
3da0b9e1b9 | |||
d696514283 | |||
06d85ad64b | |||
453b664b07 | |||
8b8bfb29bc | |||
4ef140d7a3 | |||
0c3cd68f63 | |||
3a3673dc69 | |||
aa76699393 | |||
d64acada22 | |||
052b039a51 | |||
6f44f03ad2 | |||
eac00ae370 | |||
f7da4141c4 | |||
dc91186a0b | |||
324d4f7a88 | |||
bc8f37a21d | |||
ff42240ea2 | |||
1060f4a6ad |
366
CMakeLists.txt
366
CMakeLists.txt
@@ -111,25 +111,6 @@ blender_project_hack_post()
|
||||
enable_testing()
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Test Compiler Support
|
||||
#
|
||||
# Keep in sync with: https://wiki.blender.org/wiki/Building_Blender
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "9.3.1")
|
||||
message(FATAL_ERROR "The minimum supported version of GCC is 9.3.1")
|
||||
endif()
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
if(CMAKE_COMPILER_IS_GNUCC AND ("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "8.0"))
|
||||
message(FATAL_ERROR "The minimum supported version of CLANG is 8.0")
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
if(MSVC_VERSION VERSION_LESS "1928")
|
||||
message(FATAL_ERROR "The minimum supported version of MSVC is 2019 (16.9.16)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Test Compiler/Library Features
|
||||
|
||||
@@ -242,17 +223,17 @@ if(UNIX AND NOT (APPLE OR HAIKU))
|
||||
option(WITH_GHOST_X11 "Enable building Blender against X11 for windowing" ON)
|
||||
mark_as_advanced(WITH_GHOST_X11)
|
||||
|
||||
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing" ON)
|
||||
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing (under development)" OFF)
|
||||
mark_as_advanced(WITH_GHOST_WAYLAND)
|
||||
|
||||
if(WITH_GHOST_WAYLAND)
|
||||
option(WITH_GHOST_WAYLAND_LIBDECOR "Optionally build with LibDecor window decorations" ON)
|
||||
option(WITH_GHOST_WAYLAND_LIBDECOR "Optionally build with LibDecor window decorations" OFF)
|
||||
mark_as_advanced(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||
|
||||
option(WITH_GHOST_WAYLAND_DBUS "Optionally build with DBUS support (used for Cursor themes). May hang on startup systems where DBUS is not used." OFF)
|
||||
mark_as_advanced(WITH_GHOST_WAYLAND_DBUS)
|
||||
|
||||
option(WITH_GHOST_WAYLAND_DYNLOAD "Enable runtime dynamic WAYLAND libraries loading" ON)
|
||||
option(WITH_GHOST_WAYLAND_DYNLOAD "Enable runtime dynamic WAYLAND libraries loading" OFF)
|
||||
mark_as_advanced(WITH_GHOST_WAYLAND_DYNLOAD)
|
||||
endif()
|
||||
endif()
|
||||
@@ -429,7 +410,6 @@ mark_as_advanced(WITH_CPU_SIMD)
|
||||
# Cycles
|
||||
option(WITH_CYCLES "Enable Cycles Render Engine" ON)
|
||||
option(WITH_CYCLES_OSL "Build Cycles with OpenShadingLanguage support" ON)
|
||||
option(WITH_CYCLES_PATH_GUIDING "Build Cycles with path guiding support" ON)
|
||||
option(WITH_CYCLES_EMBREE "Build Cycles with Embree support" ON)
|
||||
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
|
||||
option(WITH_CYCLES_DEBUG "Build Cycles with options useful for debugging (e.g., MIS)" OFF)
|
||||
@@ -648,8 +628,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
unset(_asan_defaults)
|
||||
|
||||
if(MSVC)
|
||||
find_library(
|
||||
COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
|
||||
find_library(
|
||||
COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
|
||||
@@ -828,7 +808,7 @@ endif()
|
||||
set_and_warn_dependency(WITH_PUGIXML WITH_OPENIMAGEIO OFF)
|
||||
|
||||
if(WITH_BOOST AND NOT (WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
|
||||
WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_USD OR WITH_ALEMBIC))
|
||||
WITH_OPENVDB OR WITH_OPENCOLORIO OR WITH_USD OR WITH_ALEMBIC))
|
||||
message(STATUS "No dependencies need 'WITH_BOOST' forcing WITH_BOOST=OFF")
|
||||
set(WITH_BOOST OFF)
|
||||
endif()
|
||||
@@ -1042,9 +1022,9 @@ if(WITH_CPU_SIMD)
|
||||
set(COMPILER_SSE2_FLAG)
|
||||
|
||||
# Test Neon first since macOS Arm can compile and run x86-64 SSE binaries.
|
||||
test_neon_support()
|
||||
TEST_NEON_SUPPORT()
|
||||
if(NOT SUPPORT_NEON_BUILD)
|
||||
test_sse_support(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
|
||||
TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1109,7 +1089,7 @@ if(WITH_INTERNATIONAL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Enable SIMD support if detected by `test_sse_support()` or `test_neon_support()`.
|
||||
# Enable SIMD support if detected by TEST_SSE_SUPPORT() or TEST_NEON_SUPPORT().
|
||||
#
|
||||
# This is done globally, so that all modules can use it if available, and
|
||||
# because these are used in headers used by many modules.
|
||||
@@ -1117,7 +1097,7 @@ if(WITH_CPU_SIMD)
|
||||
if(SUPPORT_NEON_BUILD)
|
||||
# Neon
|
||||
if(SSE2NEON_FOUND)
|
||||
include_directories(SYSTEM "${SSE2NEON_INCLUDE_DIRS}")
|
||||
blender_include_dirs_sys("${SSE2NEON_INCLUDE_DIRS}")
|
||||
add_definitions(-DWITH_SSE2NEON)
|
||||
endif()
|
||||
else()
|
||||
@@ -1291,11 +1271,7 @@ endif()
|
||||
# Configure Python
|
||||
|
||||
if(WITH_PYTHON_MODULE)
|
||||
# Not currently supported due to different required Python link flags.
|
||||
if(WITH_GTESTS)
|
||||
message(STATUS "GTests not compatible with Python module, disabling WITH_GTESTS")
|
||||
set(WITH_GTESTS OFF)
|
||||
endif()
|
||||
add_definitions(-DPy_ENABLE_SHARED)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1423,75 +1399,91 @@ endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_ALL -Wall)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_ERROR_VLA -Werror=vla)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_VLA -Werror=vla)
|
||||
# system headers sometimes do this, disable for now, was: -Werror=strict-prototypes
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_LOGICAL_OP -Wlogical-op)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_UNDEF -Wundef)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_INIT_SELF -Winit-self) # needs -Wuninitialized
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_TYPE_LIMITS -Wtype-limits)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_FORMAT_SIGN -Wformat-signedness)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_RESTRICT -Wrestrict)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_LOGICAL_OP -Wlogical-op)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEF -Wundef)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_INIT_SELF -Winit-self) # needs -Wuninitialized
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_TYPE_LIMITS -Wtype-limits)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_FORMAT_SIGN -Wformat-signedness)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_RESTRICT -Wrestrict)
|
||||
|
||||
# C-only.
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_NULL -Wnonnull)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_ABSOLUTE_VALUE -Wabsolute-value)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_NULL -Wnonnull)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ABSOLUTE_VALUE -Wabsolute-value)
|
||||
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
|
||||
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_REDUNDANT_DECLS -Wredundant-decls)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_REDUNDANT_DECLS -Wredundant-decls)
|
||||
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_SHADOW -Wshadow)
|
||||
|
||||
# disable because it gives warnings for printf() & friends.
|
||||
# add_check_c_compiler_flag(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
|
||||
|
||||
if(NOT APPLE)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
|
||||
# gcc 4.2 gives annoying warnings on every file with this
|
||||
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNINITIALIZED -Wuninitialized)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
|
||||
endif()
|
||||
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_ALL -Wall)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_LOGICAL_OP -Wlogical-op)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_INIT_SELF -Winit-self) # needs -Wuninitialized
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_ERROR_RETURN_TYPE -Werror=return-type)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_POINTER_ARITH -Wpointer-arith)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNUSED_PARAMETER -Wunused-parameter)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_WRITE_STRINGS -Wwrite-strings)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_FORMAT_SIGN -Wformat-signedness)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_RESTRICT -Wrestrict)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_SUGGEST_OVERRIDE -Wno-suggest-override)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
|
||||
# versions before gcc4.6 give many BLI_math warnings
|
||||
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.6")
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_REDUNDANT_DECLS -Wredundant-decls)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_REDUNDANT_DECLS -Wredundant-decls)
|
||||
endif()
|
||||
|
||||
# versions before gcc4.8 include global name-space.
|
||||
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.8")
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_SHADOW -Wshadow)
|
||||
endif()
|
||||
|
||||
# disable because it gives warnings for printf() & friends.
|
||||
# ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
|
||||
|
||||
if(NOT APPLE)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
|
||||
endif()
|
||||
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_LOGICAL_OP -Wlogical-op)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_INIT_SELF -Winit-self) # needs -Wuninitialized
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ERROR_RETURN_TYPE -Werror=return-type)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_POINTER_ARITH -Wpointer-arith)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_PARAMETER -Wunused-parameter)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_WRITE_STRINGS -Wwrite-strings)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_FORMAT_SIGN -Wformat-signedness)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_RESTRICT -Wrestrict)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SUGGEST_OVERRIDE -Wno-suggest-override)
|
||||
|
||||
# gcc 4.2 gives annoying warnings on every file with this
|
||||
if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNINITIALIZED -Wuninitialized)
|
||||
endif()
|
||||
|
||||
# causes too many warnings
|
||||
if(NOT APPLE)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations)
|
||||
endif()
|
||||
|
||||
# Use 'ATTR_FALLTHROUGH' macro to suppress.
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5)
|
||||
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_IMPLICIT_FALLTHROUGH -Wimplicit-fallthrough=5)
|
||||
endif()
|
||||
|
||||
|
||||
# ---------------------
|
||||
# Suppress Strict Flags
|
||||
@@ -1505,100 +1497,102 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
# If code in `./extern/` needs to suppress these flags that can be done on a case-by-case basis.
|
||||
|
||||
# flags to undo strict flags
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_TYPE_LIMITS -Wno-type-limits)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_IN_BOOL_CONTEXT -Wno-int-in-bool-context)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_FORMAT -Wno-format)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_SWITCH -Wno-switch)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-uninitialized)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_TYPE_LIMITS -Wno-type-limits)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_IN_BOOL_CONTEXT -Wno-int-in-bool-context)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_FORMAT -Wno-format)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_SWITCH -Wno-switch)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-uninitialized)
|
||||
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CLASS_MEMACCESS -Wno-class-memaccess)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_COMMENT -Wno-comment)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_VARIABLE -Wno-uninitialized)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CLASS_MEMACCESS -Wno-class-memaccess)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_COMMENT -Wno-comment)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_VARIABLE -Wno-uninitialized)
|
||||
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
|
||||
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
|
||||
endif()
|
||||
|
||||
if(NOT APPLE)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
|
||||
endif()
|
||||
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
# strange, clang complains these are not supported, but then uses them.
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_ALL -Wall)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_IMPLICIT_FUNCTION_DECLARATION -Werror=implicit-function-declaration)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ERROR_RETURN_TYPE -Werror=return-type)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_STRICT_PROTOTYPES -Wstrict-prototypes)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_PROTOTYPES -Wmissing-prototypes)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
|
||||
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_ALL -Wall)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
|
||||
# Using C++20 features while having C++17 as the project language isn't allowed by MSVC.
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_CXX20_DESIGNATOR -Wc++20-designator)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_CXX20_DESIGNATOR -Wc++20-designator)
|
||||
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_OVERLOADED_VIRTUAL -Wno-overloaded-virtual) # we get a lot of these, if its a problem a dev needs to look into it.
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_OVERLOADED_VIRTUAL -Wno-overloaded-virtual) # we get a lot of these, if its a problem a dev needs to look into it.
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
|
||||
# Apple Clang (tested on version 12) doesn't support this flag while LLVM Clang 11 does.
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_SUGGEST_OVERRIDE -Wno-suggest-override)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SUGGEST_OVERRIDE -Wno-suggest-override)
|
||||
|
||||
# gives too many unfixable warnings
|
||||
# add_check_c_compiler_flag(C_WARNINGS C_WARN_UNUSED_MACROS -Wunused-macros)
|
||||
# add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros)
|
||||
# ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_MACROS -Wunused-macros)
|
||||
# ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros)
|
||||
|
||||
# ---------------------
|
||||
# Suppress Strict Flags
|
||||
|
||||
# flags to undo strict flags
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
|
||||
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_BUT_SET_VARIABLE -Wno-unused-but-set-variable)
|
||||
add_check_c_compiler_flag(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_BUT_SET_VARIABLE -Wno-unused-but-set-variable)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
|
||||
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_COMMENT -Wno-comment)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNDEFINED_VAR_TEMPLATE -Wno-undefined-var-template)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_INSTANTIATION_AFTER_SPECIALIZATION -Wno-instantiation-after-specialization)
|
||||
add_check_cxx_compiler_flag(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_COMMENT -Wno-comment)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNDEFINED_VAR_TEMPLATE -Wno-undefined-var-template)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_INSTANTIATION_AFTER_SPECIALIZATION -Wno-instantiation-after-specialization)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation)
|
||||
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_ALL -Wall)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
|
||||
add_check_c_compiler_flag(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
|
||||
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_ALL -Wall)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
|
||||
add_check_cxx_compiler_flag(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
|
||||
|
||||
# disable numbered, false positives
|
||||
string(APPEND C_WARNINGS " -wd188,186,144,913,556,858,597,177,1292,167,279,592,94,2722,3199")
|
||||
@@ -1611,8 +1605,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
||||
"/w34062" # switch statement contains 'default' but no 'case' labels
|
||||
"/w34115" # 'type' : named type definition in parentheses
|
||||
"/w34189" # local variable is initialized but not referenced
|
||||
# see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038?view=vs-2017
|
||||
"/w35038" # order of initialization in c++ constructors
|
||||
# disable:
|
||||
"/wd4018" # signed/unsigned mismatch
|
||||
"/wd4146" # unary minus operator applied to unsigned type, result still unsigned
|
||||
@@ -1632,9 +1624,13 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
||||
"/we4013" # 'function' undefined; assuming extern returning int
|
||||
"/we4133" # incompatible pointer types
|
||||
"/we4431" # missing type specifier - int assumed
|
||||
"/we4033" # 'function' must return a value
|
||||
)
|
||||
|
||||
if(MSVC_VERSION GREATER_EQUAL 1911)
|
||||
# see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038?view=vs-2017
|
||||
string(APPEND _WARNINGS " /w35038") # order of initialization in c++ constructors
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " _WARNINGS "${_WARNINGS}")
|
||||
set(C_WARNINGS "${_WARNINGS}")
|
||||
set(CXX_WARNINGS "${_WARNINGS}")
|
||||
@@ -1686,7 +1682,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
# Make MSVC properly report the value of the __cplusplus preprocessor macro
|
||||
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
|
||||
# of the C++ standard chosen above.
|
||||
if(MSVC)
|
||||
if(MSVC AND MSVC_VERSION GREATER 1913)
|
||||
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
|
||||
endif()
|
||||
|
||||
@@ -1709,8 +1705,8 @@ endif()
|
||||
|
||||
if(WITH_COMPILER_SHORT_FILE_MACRO)
|
||||
# Use '-fmacro-prefix-map' for Clang and GCC (MSVC doesn't support this).
|
||||
add_check_c_compiler_flag(C_PREFIX_MAP_FLAGS C_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
|
||||
add_check_cxx_compiler_flag(CXX_PREFIX_MAP_FLAGS CXX_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_PREFIX_MAP_FLAGS C_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CXX_PREFIX_MAP_FLAGS CXX_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
|
||||
if(C_MACRO_PREFIX_MAP AND CXX_MACRO_PREFIX_MAP)
|
||||
if(APPLE)
|
||||
if(XCODE AND ${XCODE_VERSION} VERSION_LESS 12.0)
|
||||
@@ -1913,25 +1909,9 @@ if(FIRST_RUN)
|
||||
info_cfg_option(WITH_INSTALL_PORTABLE)
|
||||
info_cfg_option(WITH_MEM_JEMALLOC)
|
||||
info_cfg_option(WITH_MEM_VALGRIND)
|
||||
|
||||
info_cfg_text("GHOST Options:")
|
||||
info_cfg_option(WITH_GHOST_DEBUG)
|
||||
info_cfg_option(WITH_GHOST_SDL)
|
||||
if(UNIX AND NOT APPLE)
|
||||
info_cfg_option(WITH_GHOST_X11)
|
||||
info_cfg_option(WITH_GHOST_WAYLAND)
|
||||
if(WITH_GHOST_X11)
|
||||
info_cfg_option(WITH_GHOST_XDND)
|
||||
info_cfg_option(WITH_X11_XF86VMODE)
|
||||
info_cfg_option(WITH_X11_XFIXES)
|
||||
info_cfg_option(WITH_X11_XINPUT)
|
||||
endif()
|
||||
if(WITH_GHOST_WAYLAND)
|
||||
info_cfg_option(WITH_GHOST_WAYLAND_DYNLOAD)
|
||||
info_cfg_option(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||
info_cfg_option(WITH_GHOST_WAYLAND_DBUS)
|
||||
endif()
|
||||
endif()
|
||||
info_cfg_option(WITH_X11_XF86VMODE)
|
||||
info_cfg_option(WITH_X11_XFIXES)
|
||||
info_cfg_option(WITH_X11_XINPUT)
|
||||
|
||||
info_cfg_text("Image Formats:")
|
||||
info_cfg_option(WITH_IMAGE_CINEON)
|
||||
@@ -1972,22 +1952,6 @@ if(FIRST_RUN)
|
||||
info_cfg_option(WITH_MOD_OCEANSIM)
|
||||
info_cfg_option(WITH_MOD_REMESH)
|
||||
|
||||
if(WITH_CYCLES)
|
||||
info_cfg_text("Cycles:")
|
||||
info_cfg_option(WITH_CYCLES_OSL)
|
||||
info_cfg_option(WITH_CYCLES_EMBREE)
|
||||
info_cfg_option(WITH_CYCLES_PATH_GUIDING)
|
||||
if(NOT APPLE)
|
||||
info_cfg_option(WITH_CYCLES_DEVICE_OPTIX)
|
||||
info_cfg_option(WITH_CYCLES_DEVICE_CUDA)
|
||||
info_cfg_option(WITH_CYCLES_CUDA_BINARIES)
|
||||
info_cfg_option(WITH_CYCLES_DEVICE_HIP)
|
||||
info_cfg_option(WITH_CYCLES_HIP_BINARIES)
|
||||
info_cfg_option(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
info_cfg_option(WITH_CYCLES_ONEAPI_BINARIES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
info_cfg_text("")
|
||||
|
||||
message("${_config_msg}")
|
||||
|
@@ -364,7 +364,7 @@ all: .FORCE
|
||||
$(BUILD_COMMAND) -C "$(BUILD_DIR)" -j $(NPROCS) install
|
||||
@echo
|
||||
@echo Edit build configuration with: \"$(BUILD_DIR)/CMakeCache.txt\" run make again to rebuild.
|
||||
@if test -z "$(BLENDER_IS_PYTHON_MODULE)"; then \
|
||||
@if test "$(BLENDER_IS_PYTHON_MODULE)" == ""; then \
|
||||
echo Blender successfully built, run from: $(BLENDER_BIN); \
|
||||
else \
|
||||
echo Blender successfully built as a Python module, \"bpy\" can be imported from: $(BLENDER_BIN_DIR); \
|
||||
|
@@ -94,7 +94,6 @@ include(cmake/pugixml.cmake)
|
||||
include(cmake/ispc.cmake)
|
||||
include(cmake/openimagedenoise.cmake)
|
||||
include(cmake/embree.cmake)
|
||||
include(cmake/openpgl.cmake)
|
||||
include(cmake/fmt.cmake)
|
||||
include(cmake/robinmap.cmake)
|
||||
if(NOT APPLE)
|
||||
@@ -170,10 +169,6 @@ if(UNIX AND NOT APPLE)
|
||||
include(cmake/libglu.cmake)
|
||||
include(cmake/mesa.cmake)
|
||||
include(cmake/wayland_protocols.cmake)
|
||||
# Can be removed when the build-bot upgrades to v1.20.x or newer.
|
||||
include(cmake/wayland.cmake)
|
||||
include(cmake/wayland_libdecor.cmake)
|
||||
endif()
|
||||
|
||||
include(cmake/harvest.cmake)
|
||||
include(cmake/cve_check.cmake)
|
||||
|
@@ -46,7 +46,7 @@ if(UNIX)
|
||||
" ${_software_missing}\n"
|
||||
"\n"
|
||||
"On Debian and Ubuntu:\n"
|
||||
" apt install autoconf automake bison libtool yasm tcl ninja-build meson python3-mako\n"
|
||||
" apt install autoconf automake libtool yasm tcl ninja-build meson python3-mako\n"
|
||||
"\n"
|
||||
"On macOS (with homebrew):\n"
|
||||
" brew install autoconf automake bison flex libtool meson ninja pkg-config yasm\n"
|
||||
|
@@ -1,73 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# CVE Check requirements
|
||||
#
|
||||
# - A working installation of intels cve-bin-tool [1] has to be available in
|
||||
# your path
|
||||
#
|
||||
# - Not strictly required, but highly recommended is obtaining a NVD key from
|
||||
# nist since it significantly speeds up downloading/updating the required
|
||||
# databases one can request a key on the following website:
|
||||
# https://nvd.nist.gov/developers/request-an-api-key
|
||||
|
||||
# Bill of Materials construction
|
||||
#
|
||||
# This constructs a CSV cve-bin-tool [1] can read and process. Sadly
|
||||
# cve-bin-tool at this point does not take a list of CPE's and output a check
|
||||
# based on that list. so we need to pick apart the CPE retrieve the vendor,
|
||||
# product and version tokens and generate a CSV.
|
||||
#
|
||||
# [1] https://github.com/intel/cve-bin-tool
|
||||
|
||||
# Because not all deps are downloaded (ie python packages) but can still have a
|
||||
# xxx_CPE declared loop over all variables and look for variables ending in CPE.
|
||||
|
||||
set(SBOMCONTENTS)
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
foreach (_variableName ${_variableNames})
|
||||
if(_variableName MATCHES "CPE$")
|
||||
string(REPLACE ":" ";" CPE_LIST ${${_variableName}})
|
||||
list(GET CPE_LIST 3 CPE_VENDOR)
|
||||
list(GET CPE_LIST 4 CPE_NAME)
|
||||
list(GET CPE_LIST 5 CPE_VERSION)
|
||||
set(SBOMCONTENTS "${SBOMCONTENTS}${CPE_VENDOR},${CPE_NAME},${CPE_VERSION}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/cve_check.csv.in ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv @ONLY)
|
||||
|
||||
# Custom Targets
|
||||
#
|
||||
# This defines two new custom targets one could run in the build folder
|
||||
# `cve_check` which will output the report to the console, and `cve_check_html`
|
||||
# which will write out blender_dependencies.html in the build folder that one
|
||||
# could share with other people or be used to get more information on the
|
||||
# reported CVE's.
|
||||
#
|
||||
# cve-bin-tool takes data from the nist nvd database which rate limits
|
||||
# unauthenticated requests to 1 requests per 6 seconds making the database
|
||||
# download take "quite a bit" of time.
|
||||
#
|
||||
# When adding -DCVE_CHECK_NVD_KEY=your_api_key_here to your cmake invocation
|
||||
# this key will be passed on to cve-bin-tool speeding up the process.
|
||||
#
|
||||
if(DEFINED CVE_CHECK_NVD_KEY)
|
||||
set(NVD_ARGS --nvd-api-key ${CVE_CHECK_NVD_KEY})
|
||||
endif()
|
||||
|
||||
# This will just report to the console
|
||||
add_custom_target(cve_check
|
||||
COMMAND cve-bin-tool
|
||||
${NVD_ARGS}
|
||||
-i ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
|
||||
--affected-versions
|
||||
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
|
||||
)
|
||||
|
||||
# This will write out blender_dependencies.html
|
||||
add_custom_target(cve_check_html
|
||||
COMMAND cve-bin-tool
|
||||
${NVD_ARGS}
|
||||
-i ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
|
||||
-f html
|
||||
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cve_check.csv
|
||||
)
|
@@ -1,2 +0,0 @@
|
||||
vendor,product,version
|
||||
@SBOMCONTENTS@
|
@@ -14,20 +14,6 @@ function(download_source dep)
|
||||
else()
|
||||
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
|
||||
endif()
|
||||
# Validate all required variables are set and give an explicit error message
|
||||
# rather than CMake erroring out later on with a more ambigious error.
|
||||
if (NOT DEFINED TARGET_FILE)
|
||||
message(FATAL_ERROR "${dep}_FILE variable not set")
|
||||
endif()
|
||||
if (NOT DEFINED TARGET_HASH)
|
||||
message(FATAL_ERROR "${dep}_HASH variable not set")
|
||||
endif()
|
||||
if (NOT DEFINED TARGET_HASH_TYPE)
|
||||
message(FATAL_ERROR "${dep}_HASH_TYPE variable not set")
|
||||
endif()
|
||||
if (NOT DEFINED TARGET_URI)
|
||||
message(FATAL_ERROR "${dep}_URI variable not set")
|
||||
endif()
|
||||
set(TARGET_FILE ${PACKAGE_DIR}/${TARGET_FILE})
|
||||
message("Checking source : ${dep} (${TARGET_FILE})")
|
||||
if(NOT EXISTS ${TARGET_FILE})
|
||||
@@ -39,36 +25,6 @@ function(download_source dep)
|
||||
SHOW_PROGRESS
|
||||
)
|
||||
endif()
|
||||
if(EXISTS ${TARGET_FILE})
|
||||
# Sometimes the download fails, but that is not a
|
||||
# fail condition for "file(DOWNLOAD" it will warn about
|
||||
# a crc mismatch and just carry on, we need to explicitly
|
||||
# catch this and remove the bogus 0 byte file so we can
|
||||
# retry without having to go find the file and manually
|
||||
# delete it.
|
||||
file (SIZE ${TARGET_FILE} TARGET_SIZE)
|
||||
if(${TARGET_SIZE} EQUAL 0)
|
||||
file(REMOVE ${TARGET_FILE})
|
||||
message(FATAL_ERROR "for ${TARGET_FILE} file size 0, download likely failed, deleted...")
|
||||
endif()
|
||||
|
||||
# If we are using sources from the blender repo also
|
||||
# validate that the hashes match, this takes a
|
||||
# little more time, but protects us when we are
|
||||
# building a release package and one of the packages
|
||||
# is missing or incorrect.
|
||||
#
|
||||
# For regular platform maintenaince this is not needed
|
||||
# since the actual build of the dep will notify the
|
||||
# platform maintainer if there is a problem with the
|
||||
# source package and refuse to build.
|
||||
if(NOT PACKAGE_USE_UPSTREAM_SOURCES)
|
||||
file(${TARGET_HASH_TYPE} ${TARGET_FILE} LOCAL_HASH)
|
||||
if(NOT ${TARGET_HASH} STREQUAL ${LOCAL_HASH})
|
||||
message(FATAL_ERROR "${TARGET_FILE} ${TARGET_HASH_TYPE} mismatch\nExpected\t: ${TARGET_HASH}\nActual\t: ${LOCAL_HASH}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction(download_source)
|
||||
|
||||
download_source(ZLIB)
|
||||
@@ -95,6 +51,7 @@ download_source(OSL)
|
||||
download_source(PYTHON)
|
||||
download_source(TBB)
|
||||
download_source(OPENVDB)
|
||||
download_source(NANOVDB)
|
||||
download_source(NUMPY)
|
||||
download_source(LAME)
|
||||
download_source(OGG)
|
||||
@@ -132,8 +89,6 @@ download_source(MESA)
|
||||
download_source(NASM)
|
||||
download_source(XR_OPENXR_SDK)
|
||||
download_source(WL_PROTOCOLS)
|
||||
download_source(WAYLAND)
|
||||
download_source(WAYLAND_LIBDECOR)
|
||||
download_source(ISPC)
|
||||
download_source(GMP)
|
||||
download_source(POTRACE)
|
||||
@@ -146,7 +101,6 @@ download_source(FMT)
|
||||
download_source(ROBINMAP)
|
||||
download_source(IMATH)
|
||||
download_source(PYSTRING)
|
||||
download_source(OPENPGL)
|
||||
download_source(LEVEL_ZERO)
|
||||
download_source(DPCPP)
|
||||
download_source(VCINTRINSICS)
|
||||
|
@@ -68,7 +68,7 @@ set(DPCPP_EXTRA_ARGS
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND DPCPP_EXTRA_ARGS -DPython3_FIND_REGISTRY=NEVER)
|
||||
list(APPEND DPCPP_EXTRA_ARGS -DPython3_FIND_REGISTRY=NEVER)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(external_dpcpp
|
||||
|
@@ -11,194 +11,188 @@ message("HARVEST_TARGET = ${HARVEST_TARGET}")
|
||||
|
||||
if(WIN32)
|
||||
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
add_custom_target(Harvest_Release_Results
|
||||
COMMAND # jpeg rename libfile + copy include
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
|
||||
# png
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
|
||||
# freeglut-> opengl
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
|
||||
DEPENDS
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
add_custom_target(Harvest_Release_Results
|
||||
COMMAND # jpeg rename libfile + copy include
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
|
||||
# png
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
|
||||
# freeglut-> opengl
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
|
||||
DEPENDS
|
||||
)
|
||||
endif()
|
||||
|
||||
else(WIN32)
|
||||
|
||||
function(harvest from to)
|
||||
set(pattern "")
|
||||
foreach(f ${ARGN})
|
||||
set(pattern ${f})
|
||||
endforeach()
|
||||
|
||||
if(pattern STREQUAL "")
|
||||
get_filename_component(dirpath ${to} DIRECTORY)
|
||||
get_filename_component(filename ${to} NAME)
|
||||
install(
|
||||
FILES ${LIBDIR}/${from}
|
||||
DESTINATION ${HARVEST_TARGET}/${dirpath}
|
||||
RENAME ${filename}
|
||||
)
|
||||
else()
|
||||
install(
|
||||
DIRECTORY ${LIBDIR}/${from}/
|
||||
DESTINATION ${HARVEST_TARGET}/${to}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
FILES_MATCHING PATTERN ${pattern}
|
||||
PATTERN "pkgconfig" EXCLUDE
|
||||
PATTERN "cmake" EXCLUDE
|
||||
PATTERN "__pycache__" EXCLUDE
|
||||
PATTERN "tests" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
harvest(alembic/include alembic/include "*.h")
|
||||
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
|
||||
harvest(alembic/bin alembic/bin "*")
|
||||
harvest(brotli/include brotli/include "*.h")
|
||||
harvest(brotli/lib brotli/lib "*.a")
|
||||
harvest(boost/include boost/include "*")
|
||||
harvest(boost/lib boost/lib "*.a")
|
||||
harvest(imath/include imath/include "*.h")
|
||||
harvest(imath/lib imath/lib "*.a")
|
||||
harvest(ffmpeg/include ffmpeg/include "*.h")
|
||||
harvest(ffmpeg/lib ffmpeg/lib "*.a")
|
||||
harvest(fftw3/include fftw3/include "*.h")
|
||||
harvest(fftw3/lib fftw3/lib "*.a")
|
||||
harvest(flac/lib sndfile/lib "libFLAC.a")
|
||||
harvest(freetype/include freetype/include "*.h")
|
||||
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
|
||||
harvest(epoxy/include epoxy/include "*.h")
|
||||
harvest(epoxy/lib epoxy/lib "*.a")
|
||||
harvest(gmp/include gmp/include "*.h")
|
||||
harvest(gmp/lib gmp/lib "*.a")
|
||||
harvest(jemalloc/include jemalloc/include "*.h")
|
||||
harvest(jemalloc/lib jemalloc/lib "*.a")
|
||||
harvest(jpeg/include jpeg/include "*.h")
|
||||
harvest(jpeg/lib jpeg/lib "libjpeg.a")
|
||||
harvest(lame/lib ffmpeg/lib "*.a")
|
||||
if(NOT APPLE)
|
||||
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
|
||||
harvest(level-zero/lib level-zero/lib "*.so*")
|
||||
endif()
|
||||
harvest(llvm/bin llvm/bin "clang-format")
|
||||
if(BUILD_CLANG_TOOLS)
|
||||
harvest(llvm/bin llvm/bin "clang-tidy")
|
||||
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
|
||||
endif()
|
||||
harvest(llvm/include llvm/include "*")
|
||||
harvest(llvm/bin llvm/bin "llvm-config")
|
||||
harvest(llvm/lib llvm/lib "libLLVM*.a")
|
||||
harvest(llvm/lib llvm/lib "libclang*.a")
|
||||
harvest(llvm/lib/clang llvm/lib/clang "*.h")
|
||||
if(APPLE)
|
||||
harvest(openmp/lib openmp/lib "*")
|
||||
harvest(openmp/include openmp/include "*.h")
|
||||
endif()
|
||||
if(BLENDER_PLATFORM_ARM)
|
||||
harvest(sse2neon sse2neon "*.h")
|
||||
endif()
|
||||
harvest(ogg/lib ffmpeg/lib "*.a")
|
||||
harvest(openal/include openal/include "*.h")
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(openal/lib openal/lib "*.a")
|
||||
|
||||
harvest(blosc/include blosc/include "*.h")
|
||||
harvest(blosc/lib blosc/lib "*.a")
|
||||
|
||||
harvest(zlib/include zlib/include "*.h")
|
||||
harvest(zlib/lib zlib/lib "*.a")
|
||||
|
||||
harvest(xml2/include xml2/include "*.h")
|
||||
harvest(xml2/lib xml2/lib "*.a")
|
||||
|
||||
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
|
||||
else()
|
||||
harvest(blosc/lib openvdb/lib "*.a")
|
||||
harvest(xml2/lib opencollada/lib "*.a")
|
||||
endif()
|
||||
harvest(opencollada/include/opencollada opencollada/include "*.h")
|
||||
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
|
||||
harvest(opencolorio/include opencolorio/include "*.h")
|
||||
harvest(opencolorio/lib opencolorio/lib "*.a")
|
||||
harvest(opencolorio/lib/static opencolorio/lib "*.a")
|
||||
harvest(openexr/include openexr/include "*.h")
|
||||
harvest(openexr/lib openexr/lib "*.a")
|
||||
harvest(openimageio/bin openimageio/bin "idiff")
|
||||
harvest(openimageio/bin openimageio/bin "maketx")
|
||||
harvest(openimageio/bin openimageio/bin "oiiotool")
|
||||
harvest(openimageio/include openimageio/include "*")
|
||||
harvest(openimageio/lib openimageio/lib "*.a")
|
||||
harvest(openimagedenoise/include openimagedenoise/include "*")
|
||||
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
|
||||
harvest(embree/include embree/include "*.h")
|
||||
harvest(embree/lib embree/lib "*.a")
|
||||
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
|
||||
harvest(openjpeg/lib openjpeg/lib "*.a")
|
||||
harvest(opensubdiv/include opensubdiv/include "*.h")
|
||||
harvest(opensubdiv/lib opensubdiv/lib "*.a")
|
||||
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
|
||||
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
|
||||
harvest(openvdb/lib openvdb/lib "*.a")
|
||||
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
|
||||
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
|
||||
harvest(osl/bin osl/bin "oslc")
|
||||
harvest(osl/include osl/include "*.h")
|
||||
harvest(osl/lib osl/lib "*.a")
|
||||
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
|
||||
harvest(png/include png/include "*.h")
|
||||
harvest(png/lib png/lib "*.a")
|
||||
harvest(pugixml/include pugixml/include "*.hpp")
|
||||
harvest(pugixml/lib pugixml/lib "*.a")
|
||||
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
|
||||
harvest(python/include python/include "*h")
|
||||
harvest(python/lib python/lib "*")
|
||||
harvest(sdl/include/SDL2 sdl/include "*.h")
|
||||
harvest(sdl/lib sdl/lib "libSDL2.a")
|
||||
harvest(sndfile/include sndfile/include "*.h")
|
||||
harvest(sndfile/lib sndfile/lib "*.a")
|
||||
harvest(spnav/include spnav/include "*.h")
|
||||
harvest(spnav/lib spnav/lib "*.a")
|
||||
harvest(tbb/include tbb/include "*.h")
|
||||
harvest(tbb/lib/libtbb_static.a tbb/lib/libtbb.a)
|
||||
harvest(theora/lib ffmpeg/lib "*.a")
|
||||
harvest(tiff/include tiff/include "*.h")
|
||||
harvest(tiff/lib tiff/lib "*.a")
|
||||
harvest(vorbis/lib ffmpeg/lib "*.a")
|
||||
harvest(opus/lib ffmpeg/lib "*.a")
|
||||
harvest(vpx/lib ffmpeg/lib "*.a")
|
||||
harvest(x264/lib ffmpeg/lib "*.a")
|
||||
harvest(xvidcore/lib ffmpeg/lib "*.a")
|
||||
harvest(aom/lib ffmpeg/lib "*.a")
|
||||
harvest(webp/lib webp/lib "*.a")
|
||||
harvest(webp/include webp/include "*.h")
|
||||
harvest(usd/include usd/include "*.h")
|
||||
harvest(usd/lib/usd usd/lib/usd "*")
|
||||
harvest(usd/plugin usd/plugin "*")
|
||||
harvest(potrace/include potrace/include "*.h")
|
||||
harvest(potrace/lib potrace/lib "*.a")
|
||||
harvest(haru/include haru/include "*.h")
|
||||
harvest(haru/lib haru/lib "*.a")
|
||||
harvest(zstd/include zstd/include "*.h")
|
||||
harvest(zstd/lib zstd/lib "*.a")
|
||||
|
||||
function(harvest from to)
|
||||
set(pattern "")
|
||||
foreach(f ${ARGN})
|
||||
set(pattern ${f})
|
||||
endforeach()
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(libglu/lib mesa/lib "*.so*")
|
||||
harvest(mesa/lib64 mesa/lib "*.so*")
|
||||
|
||||
if(pattern STREQUAL "")
|
||||
get_filename_component(dirpath ${to} DIRECTORY)
|
||||
get_filename_component(filename ${to} NAME)
|
||||
install(
|
||||
FILES ${LIBDIR}/${from}
|
||||
DESTINATION ${HARVEST_TARGET}/${dirpath}
|
||||
RENAME ${filename}
|
||||
)
|
||||
else()
|
||||
install(
|
||||
DIRECTORY ${LIBDIR}/${from}/
|
||||
DESTINATION ${HARVEST_TARGET}/${to}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
FILES_MATCHING PATTERN ${pattern}
|
||||
PATTERN "pkgconfig" EXCLUDE
|
||||
PATTERN "cmake" EXCLUDE
|
||||
PATTERN "__pycache__" EXCLUDE
|
||||
PATTERN "tests" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
harvest(alembic/include alembic/include "*.h")
|
||||
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
|
||||
harvest(alembic/bin alembic/bin "*")
|
||||
harvest(brotli/include brotli/include "*.h")
|
||||
harvest(brotli/lib brotli/lib "*.a")
|
||||
harvest(boost/include boost/include "*")
|
||||
harvest(boost/lib boost/lib "*.a")
|
||||
harvest(imath/include imath/include "*.h")
|
||||
harvest(imath/lib imath/lib "*.a")
|
||||
harvest(ffmpeg/include ffmpeg/include "*.h")
|
||||
harvest(ffmpeg/lib ffmpeg/lib "*.a")
|
||||
harvest(fftw3/include fftw3/include "*.h")
|
||||
harvest(fftw3/lib fftw3/lib "*.a")
|
||||
harvest(flac/lib sndfile/lib "libFLAC.a")
|
||||
harvest(freetype/include freetype/include "*.h")
|
||||
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
|
||||
harvest(epoxy/include epoxy/include "*.h")
|
||||
harvest(epoxy/lib epoxy/lib "*.a")
|
||||
harvest(gmp/include gmp/include "*.h")
|
||||
harvest(gmp/lib gmp/lib "*.a")
|
||||
harvest(jemalloc/include jemalloc/include "*.h")
|
||||
harvest(jemalloc/lib jemalloc/lib "*.a")
|
||||
harvest(jpeg/include jpeg/include "*.h")
|
||||
harvest(jpeg/lib jpeg/lib "libjpeg.a")
|
||||
harvest(lame/lib ffmpeg/lib "*.a")
|
||||
if(NOT APPLE)
|
||||
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
|
||||
harvest(level-zero/lib level-zero/lib "*.so*")
|
||||
endif()
|
||||
harvest(llvm/bin llvm/bin "clang-format")
|
||||
if(BUILD_CLANG_TOOLS)
|
||||
harvest(llvm/bin llvm/bin "clang-tidy")
|
||||
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
|
||||
endif()
|
||||
harvest(llvm/include llvm/include "*")
|
||||
harvest(llvm/bin llvm/bin "llvm-config")
|
||||
harvest(llvm/lib llvm/lib "libLLVM*.a")
|
||||
harvest(llvm/lib llvm/lib "libclang*.a")
|
||||
harvest(llvm/lib/clang llvm/lib/clang "*.h")
|
||||
if(APPLE)
|
||||
harvest(openmp/lib openmp/lib "*")
|
||||
harvest(openmp/include openmp/include "*.h")
|
||||
endif()
|
||||
if(BLENDER_PLATFORM_ARM)
|
||||
harvest(sse2neon sse2neon "*.h")
|
||||
endif()
|
||||
harvest(ogg/lib ffmpeg/lib "*.a")
|
||||
harvest(openal/include openal/include "*.h")
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(openal/lib openal/lib "*.a")
|
||||
|
||||
harvest(blosc/include blosc/include "*.h")
|
||||
harvest(blosc/lib blosc/lib "*.a")
|
||||
|
||||
harvest(zlib/include zlib/include "*.h")
|
||||
harvest(zlib/lib zlib/lib "*.a")
|
||||
|
||||
harvest(xml2/include xml2/include "*.h")
|
||||
harvest(xml2/lib xml2/lib "*.a")
|
||||
|
||||
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
|
||||
harvest(wayland/bin wayland/bin "wayland-scanner")
|
||||
harvest(wayland/include wayland/include "*.h")
|
||||
harvest(wayland_libdecor/include wayland_libdecor/include "*.h")
|
||||
else()
|
||||
harvest(blosc/lib openvdb/lib "*.a")
|
||||
harvest(xml2/lib opencollada/lib "*.a")
|
||||
endif()
|
||||
harvest(opencollada/include/opencollada opencollada/include "*.h")
|
||||
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
|
||||
harvest(opencolorio/include opencolorio/include "*.h")
|
||||
harvest(opencolorio/lib opencolorio/lib "*.a")
|
||||
harvest(opencolorio/lib/static opencolorio/lib "*.a")
|
||||
harvest(openexr/include openexr/include "*.h")
|
||||
harvest(openexr/lib openexr/lib "*.a")
|
||||
harvest(openimageio/bin openimageio/bin "idiff")
|
||||
harvest(openimageio/bin openimageio/bin "maketx")
|
||||
harvest(openimageio/bin openimageio/bin "oiiotool")
|
||||
harvest(openimageio/include openimageio/include "*")
|
||||
harvest(openimageio/lib openimageio/lib "*.a")
|
||||
harvest(openimagedenoise/include openimagedenoise/include "*")
|
||||
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
|
||||
harvest(embree/include embree/include "*.h")
|
||||
harvest(embree/lib embree/lib "*.a")
|
||||
harvest(openpgl/include openpgl/include "*.h")
|
||||
harvest(openpgl/lib openpgl/lib "*.a")
|
||||
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
|
||||
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
|
||||
harvest(openjpeg/lib openjpeg/lib "*.a")
|
||||
harvest(opensubdiv/include opensubdiv/include "*.h")
|
||||
harvest(opensubdiv/lib opensubdiv/lib "*.a")
|
||||
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
|
||||
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
|
||||
harvest(openvdb/lib openvdb/lib "*.a")
|
||||
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
|
||||
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
|
||||
harvest(osl/bin osl/bin "oslc")
|
||||
harvest(osl/include osl/include "*.h")
|
||||
harvest(osl/lib osl/lib "*.a")
|
||||
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
|
||||
harvest(png/include png/include "*.h")
|
||||
harvest(png/lib png/lib "*.a")
|
||||
harvest(pugixml/include pugixml/include "*.hpp")
|
||||
harvest(pugixml/lib pugixml/lib "*.a")
|
||||
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
|
||||
harvest(python/include python/include "*h")
|
||||
harvest(python/lib python/lib "*")
|
||||
harvest(sdl/include/SDL2 sdl/include "*.h")
|
||||
harvest(sdl/lib sdl/lib "libSDL2.a")
|
||||
harvest(sndfile/include sndfile/include "*.h")
|
||||
harvest(sndfile/lib sndfile/lib "*.a")
|
||||
harvest(spnav/include spnav/include "*.h")
|
||||
harvest(spnav/lib spnav/lib "*.a")
|
||||
harvest(tbb/include tbb/include "*.h")
|
||||
harvest(tbb/lib/libtbb_static.a tbb/lib/libtbb.a)
|
||||
harvest(theora/lib ffmpeg/lib "*.a")
|
||||
harvest(tiff/include tiff/include "*.h")
|
||||
harvest(tiff/lib tiff/lib "*.a")
|
||||
harvest(vorbis/lib ffmpeg/lib "*.a")
|
||||
harvest(opus/lib ffmpeg/lib "*.a")
|
||||
harvest(vpx/lib ffmpeg/lib "*.a")
|
||||
harvest(x264/lib ffmpeg/lib "*.a")
|
||||
harvest(xvidcore/lib ffmpeg/lib "*.a")
|
||||
harvest(aom/lib ffmpeg/lib "*.a")
|
||||
harvest(webp/lib webp/lib "*.a")
|
||||
harvest(webp/include webp/include "*.h")
|
||||
harvest(usd/include usd/include "*.h")
|
||||
harvest(usd/lib/usd usd/lib/usd "*")
|
||||
harvest(usd/plugin usd/plugin "*")
|
||||
harvest(potrace/include potrace/include "*.h")
|
||||
harvest(potrace/lib potrace/lib "*.a")
|
||||
harvest(haru/include haru/include "*.h")
|
||||
harvest(haru/lib haru/lib "*.a")
|
||||
harvest(zstd/include zstd/include "*.h")
|
||||
harvest(zstd/lib zstd/lib "*.a")
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(libglu/lib mesa/lib "*.so*")
|
||||
harvest(mesa/lib64 mesa/lib "*.so*")
|
||||
|
||||
harvest(dpcpp dpcpp "*")
|
||||
harvest(igc dpcpp/lib/igc "*")
|
||||
harvest(ocloc dpcpp/lib/ocloc "*")
|
||||
endif()
|
||||
harvest(dpcpp dpcpp "*")
|
||||
harvest(igc dpcpp/lib/igc "*")
|
||||
harvest(ocloc dpcpp/lib/ocloc "*")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
if(WIN32)
|
||||
# CMAKE for MS-Windows.
|
||||
# cmake for windows
|
||||
set(JPEG_EXTRA_ARGS
|
||||
-DNASM=${NASM_PATH}
|
||||
-DWITH_JPEG8=ON
|
||||
@@ -33,8 +33,8 @@ if(WIN32)
|
||||
)
|
||||
endif()
|
||||
|
||||
else()
|
||||
# CMAKE for UNIX.
|
||||
else(WIN32)
|
||||
# cmake for unix
|
||||
set(JPEG_EXTRA_ARGS
|
||||
-DWITH_JPEG8=ON
|
||||
-DENABLE_STATIC=ON
|
||||
|
@@ -1,47 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Note the utility apps may use png/tiff/gif system libraries, but the
|
||||
# library itself does not depend on them, so should give no problems.
|
||||
|
||||
set(OPENPGL_EXTRA_ARGS
|
||||
-DOPENPGL_BUILD_STATIC=ON
|
||||
-DOPENPGL_TBB_ROOT=${LIBDIR}/tbb
|
||||
-DTBB_ROOT=${LIBDIR}/tbb
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
)
|
||||
|
||||
if(TBB_STATIC_LIBRARY)
|
||||
set(OPENPGL_EXTRA_ARGS
|
||||
${OPENPGL_EXTRA_ARGS}
|
||||
-DOPENPGL_TBB_COMPONENT=tbb_static
|
||||
)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(external_openpgl
|
||||
URL file://${PACKAGE_DIR}/${OPENPGL_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${OPENPGL_HASH_TYPE}=${OPENPGL_HASH}
|
||||
PREFIX ${BUILD_DIR}/openpgl
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openpgl ${DEFAULT_CMAKE_FLAGS} ${OPENPGL_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/openpgl
|
||||
)
|
||||
|
||||
add_dependencies(
|
||||
external_openpgl
|
||||
external_tbb
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
ExternalProject_Add_Step(external_openpgl after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openpgl ${HARVEST_TARGET}/openpgl
|
||||
DEPENDEES install
|
||||
)
|
||||
else()
|
||||
ExternalProject_Add_Step(external_openpgl after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openpgl/lib/openpgl_d.lib ${HARVEST_TARGET}/openpgl/lib/openpgl_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION}/openpgl_Exports-debug.cmake ${HARVEST_TARGET}/openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION}/openpgl_Exports-debug.cmake
|
||||
DEPENDEES install
|
||||
)
|
||||
endif()
|
||||
endif()
|
@@ -15,7 +15,7 @@ message("BuildMode = ${BUILD_MODE}")
|
||||
|
||||
if(BUILD_MODE STREQUAL "Debug")
|
||||
set(LIBDIR ${CMAKE_CURRENT_BINARY_DIR}/Debug)
|
||||
else()
|
||||
else(BUILD_MODE STREQUAL "Debug")
|
||||
set(LIBDIR ${CMAKE_CURRENT_BINARY_DIR}/Release)
|
||||
endif()
|
||||
|
||||
|
@@ -1,19 +1,10 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# CPE's are used to identify dependencies, for more information on what they
|
||||
# are please see https://nvd.nist.gov/products/cpe
|
||||
#
|
||||
# We use them in combination with cve-bin-tool to scan for known security issues.
|
||||
#
|
||||
# Not all of our dependencies are currently in the nvd database so not all
|
||||
# dependencies have one assigned.
|
||||
|
||||
set(ZLIB_VERSION 1.2.12)
|
||||
set(ZLIB_URI https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz)
|
||||
set(ZLIB_HASH 5fc414a9726be31427b440b434d05f78)
|
||||
set(ZLIB_HASH_TYPE MD5)
|
||||
set(ZLIB_FILE zlib-${ZLIB_VERSION}.tar.gz)
|
||||
set(ZLIB_CPE "cpe:2.3:a:zlib:zlib:${ZLIB_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(OPENAL_VERSION 1.21.1)
|
||||
set(OPENAL_URI http://openal-soft.org/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2)
|
||||
@@ -26,14 +17,12 @@ set(PNG_URI http://prdownloads.sourceforge.net/libpng/libpng-${PNG_VERSION}.tar.
|
||||
set(PNG_HASH 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca)
|
||||
set(PNG_HASH_TYPE SHA256)
|
||||
set(PNG_FILE libpng-${PNG_VERSION}.tar.xz)
|
||||
set(PNG_CPE "cpe:2.3:a:libpng:libpng:${PNG_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(JPEG_VERSION 2.1.3)
|
||||
set(JPEG_URI https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_VERSION}.tar.gz)
|
||||
set(JPEG_HASH 627b980fad0573e08e4c3b80b290fc91)
|
||||
set(JPEG_HASH_TYPE MD5)
|
||||
set(JPEG_FILE libjpeg-turbo-${JPEG_VERSION}.tar.gz)
|
||||
set(JPEG_CPE "cpe:2.3:a:d.r.commander:libjpeg-turbo:${JPEG_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(BOOST_VERSION 1.78.0)
|
||||
set(BOOST_VERSION_SHORT 1.78)
|
||||
@@ -43,14 +32,12 @@ set(BOOST_URI https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION
|
||||
set(BOOST_HASH c2f6428ac52b0e5a3c9b2e1d8cc832b5)
|
||||
set(BOOST_HASH_TYPE MD5)
|
||||
set(BOOST_FILE boost_${BOOST_VERSION_NODOTS}.tar.gz)
|
||||
set(BOOST_CPE "cpe:2.3:a:boost:boost:${BOOST_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(BLOSC_VERSION 1.21.1)
|
||||
set(BLOSC_URI https://github.com/Blosc/c-blosc/archive/v${BLOSC_VERSION}.tar.gz)
|
||||
set(BLOSC_HASH 134b55813b1dca57019d2a2dc1f7a923)
|
||||
set(BLOSC_HASH_TYPE MD5)
|
||||
set(BLOSC_FILE blosc-${BLOSC_VERSION}.tar.gz)
|
||||
set(BLOSC_CPE "cpe:2.3:a:c-blosc2_project:c-blosc2:${BLOSC_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(PTHREADS_VERSION 3.0.0)
|
||||
set(PTHREADS_URI http://prdownloads.sourceforge.net/pthreads4w/pthreads4w-code-v${PTHREADS_VERSION}.zip)
|
||||
@@ -63,7 +50,6 @@ set(OPENEXR_URI https://github.com/AcademySoftwareFoundation/openexr/archive/v${
|
||||
set(OPENEXR_HASH a92f38eedd43e56c0af56d4852506886)
|
||||
set(OPENEXR_HASH_TYPE MD5)
|
||||
set(OPENEXR_FILE openexr-${OPENEXR_VERSION}.tar.gz)
|
||||
set(OPENEXR_CPE "cpe:2.3:a:openexr:openexr:${OPENEXR_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(IMATH_VERSION 3.1.5)
|
||||
set(IMATH_URI https://github.com/AcademySoftwareFoundation/Imath/archive/v${OPENEXR_VERSION}.tar.gz)
|
||||
@@ -93,7 +79,6 @@ set(FREETYPE_URI http://prdownloads.sourceforge.net/freetype/freetype-${FREETYPE
|
||||
set(FREETYPE_HASH bd4e3b007474319909a6b79d50908e85)
|
||||
set(FREETYPE_HASH_TYPE MD5)
|
||||
set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
|
||||
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(EPOXY_VERSION 1.5.10)
|
||||
set(EPOXY_URI https://github.com/anholt/libepoxy/archive/refs/tags/${EPOXY_VERSION}.tar.gz)
|
||||
@@ -112,7 +97,6 @@ set(ALEMBIC_URI https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.ta
|
||||
set(ALEMBIC_HASH 2cd8d6e5a3ac4a014e24a4b04f4fadf9)
|
||||
set(ALEMBIC_HASH_TYPE MD5)
|
||||
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
|
||||
SET(FREETYPE_CPE "cpe:2.3:a:freetype:freetype:${FREETYPE_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(OPENSUBDIV_VERSION v3_4_4)
|
||||
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
|
||||
@@ -125,7 +109,6 @@ set(SDL_URI https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz)
|
||||
set(SDL_HASH a53acc02e1cca98c4123229069b67c9e)
|
||||
set(SDL_HASH_TYPE MD5)
|
||||
set(SDL_FILE SDL2-${SDL_VERSION}.tar.gz)
|
||||
set(SDL_CPE "cpe:2.3:a:libsdl:sdl:${SDL_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(OPENCOLLADA_VERSION v1.6.68)
|
||||
set(OPENCOLLADA_URI https://github.com/KhronosGroup/OpenCOLLADA/archive/${OPENCOLLADA_VERSION}.tar.gz)
|
||||
@@ -144,7 +127,6 @@ set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LL
|
||||
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
|
||||
set(LLVM_HASH_TYPE MD5)
|
||||
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
|
||||
set(LLVM_CPE "cpe:2.3:a:llvm:compiler:${LLVM_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
if(APPLE)
|
||||
# Cloth physics test is crashing due to this bug:
|
||||
@@ -172,7 +154,6 @@ set(FMT_URI https://github.com/fmtlib/fmt/archive/refs/tags/${FMT_VERSION}.tar.g
|
||||
set(FMT_HASH 7bce0e9e022e586b178b150002e7c2339994e3c2bbe44027e9abb0d60f9cce83)
|
||||
set(FMT_HASH_TYPE SHA256)
|
||||
set(FMT_FILE fmt-${FMT_VERSION}.tar.gz)
|
||||
set(FMT_CPE "cpe:2.3:a:fmt:fmt:${FMT_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
# 0.6.2 is currently oiio's preferred version although never versions may be available.
|
||||
# the preferred version can be found in oiio's externalpackages.cmake
|
||||
@@ -187,7 +168,6 @@ set(TIFF_URI http://download.osgeo.org/libtiff/tiff-${TIFF_VERSION}.tar.gz)
|
||||
set(TIFF_HASH 376f17f189e9d02280dfe709b2b2bbea)
|
||||
set(TIFF_HASH_TYPE MD5)
|
||||
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
|
||||
set(TIFF_CPE "cpe:2.3:a:libtiff:libtiff:${TIFF_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(OSL_VERSION 1.11.17.0)
|
||||
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
|
||||
@@ -202,15 +182,12 @@ set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTH
|
||||
set(PYTHON_HASH 14e8c22458ed7779a1957b26cde01db9)
|
||||
set(PYTHON_HASH_TYPE MD5)
|
||||
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
|
||||
set(PYTHON_CPE "cpe:2.3:a:python:python:${PYTHON_VERSION}:-:*:*:*:*:*:*")
|
||||
|
||||
set(TBB_YEAR 2020)
|
||||
set(TBB_VERSION ${TBB_YEAR}_U3)
|
||||
set(TBB_VERSION 2020_U3)
|
||||
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
|
||||
set(TBB_HASH 55ec8df6eae5ed6364a47f0e671e460c)
|
||||
set(TBB_HASH_TYPE MD5)
|
||||
set(TBB_FILE oneTBB-${TBB_VERSION}.tar.gz)
|
||||
set(TBB_CPE "cpe:2.3:a:intel:threading_building_blocks:${TBB_YEAR}:*:*:*:*:*:*:*")
|
||||
|
||||
set(OPENVDB_VERSION 9.0.0)
|
||||
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
|
||||
@@ -221,7 +198,6 @@ set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
|
||||
set(IDNA_VERSION 3.3)
|
||||
set(CHARSET_NORMALIZER_VERSION 2.0.10)
|
||||
set(URLLIB3_VERSION 1.26.8)
|
||||
set(URLLIB3_CPE "cpe:2.3:a:urllib3:urllib3:${URLLIB3_VERSION}:*:*:*:*:*:*:*")
|
||||
set(CERTIFI_VERSION 2021.10.8)
|
||||
set(REQUESTS_VERSION 2.27.1)
|
||||
set(CYTHON_VERSION 0.29.26)
|
||||
@@ -238,14 +214,12 @@ set(NUMPY_URI https://github.com/numpy/numpy/releases/download/v${NUMPY_VERSION}
|
||||
set(NUMPY_HASH 252de134862a27bd66705d29622edbfe)
|
||||
set(NUMPY_HASH_TYPE MD5)
|
||||
set(NUMPY_FILE numpy-${NUMPY_VERSION}.zip)
|
||||
set(NUMPY_CPE "cpe:2.3:a:numpy:numpy:${NUMPY_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(LAME_VERSION 3.100)
|
||||
set(LAME_URI http://downloads.sourceforge.net/project/lame/lame/3.100/lame-${LAME_VERSION}.tar.gz)
|
||||
set(LAME_HASH 83e260acbe4389b54fe08e0bdbf7cddb)
|
||||
set(LAME_HASH_TYPE MD5)
|
||||
set(LAME_FILE lame-${LAME_VERSION}.tar.gz)
|
||||
set(LAME_CPE "cpe:2.3:a:lame_project:lame:${LAME_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(OGG_VERSION 1.3.5)
|
||||
set(OGG_URI http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz)
|
||||
@@ -258,7 +232,6 @@ set(VORBIS_URI http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERS
|
||||
set(VORBIS_HASH 0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab)
|
||||
set(VORBIS_HASH_TYPE SHA256)
|
||||
set(VORBIS_FILE libvorbis-${VORBIS_VERSION}.tar.gz)
|
||||
set(VORBIS_CPE "cpe:2.3:a:xiph.org:libvorbis:${VORBIS_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(THEORA_VERSION 1.1.1)
|
||||
set(THEORA_URI http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.bz2)
|
||||
@@ -271,14 +244,12 @@ set(FLAC_URI http://downloads.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz
|
||||
set(FLAC_HASH 8ff0607e75a322dd7cd6ec48f4f225471404ae2730d0ea945127b1355155e737 )
|
||||
set(FLAC_HASH_TYPE SHA256)
|
||||
set(FLAC_FILE flac-${FLAC_VERSION}.tar.xz)
|
||||
set(FLAC_CPE "cpe:2.3:a:flac_project:flac:${FLAC_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(VPX_VERSION 1.11.0)
|
||||
set(VPX_URI https://github.com/webmproject/libvpx/archive/v${VPX_VERSION}/libvpx-v${VPX_VERSION}.tar.gz)
|
||||
set(VPX_HASH 965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83)
|
||||
set(VPX_HASH_TYPE SHA256)
|
||||
set(VPX_FILE libvpx-v${VPX_VERSION}.tar.gz)
|
||||
set(VPX_CPE "cpe:2.3:a:webmproject:libvpx:${VPX_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(OPUS_VERSION 1.3.1)
|
||||
set(OPUS_URI https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz)
|
||||
@@ -304,14 +275,12 @@ set(OPENJPEG_URI https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSI
|
||||
set(OPENJPEG_HASH 8702ba68b442657f11aaeb2b338443ca8d5fb95b0d845757968a7be31ef7f16d)
|
||||
set(OPENJPEG_HASH_TYPE SHA256)
|
||||
set(OPENJPEG_FILE openjpeg-v${OPENJPEG_VERSION}.tar.gz)
|
||||
set(OPENJPEG_CPE "cpe:2.3:a:uclouvain:openjpeg:${OPENJPEG_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(FFMPEG_VERSION 5.0)
|
||||
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
|
||||
set(FFMPEG_HASH c0130b8db2c763430fd1c6905288d61bc44ee0548ad5fcd2dfd650b88432bed9)
|
||||
set(FFMPEG_HASH_TYPE SHA256)
|
||||
set(FFMPEG_FILE ffmpeg-${FFMPEG_VERSION}.tar.bz2)
|
||||
set(FFMPEG_CPE "cpe:2.3:a:ffmpeg:ffmpeg:${FFMPEG_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(FFTW_VERSION 3.3.10)
|
||||
set(FFTW_URI http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz)
|
||||
@@ -330,14 +299,12 @@ set(SNDFILE_URI http://www.mega-nerd.com/libsndfile/files/libsndfile-${SNDFILE_V
|
||||
set(SNDFILE_HASH 646b5f98ce89ac60cdb060fcd398247c)
|
||||
set(SNDFILE_HASH_TYPE MD5)
|
||||
set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.gz)
|
||||
set(SNDFILE_CPE "cpe:2.3:a:libsndfile_project:libsndfile:${SNDFILE_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(WEBP_VERSION 1.2.2)
|
||||
set(WEBP_URI https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz)
|
||||
set(WEBP_HASH b5e2e414a8adee4c25fe56b18dd9c549)
|
||||
set(WEBP_HASH_TYPE MD5)
|
||||
set(WEBP_FILE libwebp-${WEBP_VERSION}.tar.gz)
|
||||
set(WEBP_CPE "cpe:2.3:a:webmproject:libwebp:${WEBP_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(SPNAV_VERSION 0.2.3)
|
||||
set(SPNAV_URI http://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%20${SPNAV_VERSION}/libspnav-${SPNAV_VERSION}.tar.gz)
|
||||
@@ -356,7 +323,6 @@ set(XML2_URI http://xmlsoft.org/sources/libxml2-${XML2_VERSION}.tar.gz)
|
||||
set(XML2_HASH 10942a1dc23137a8aa07f0639cbfece5)
|
||||
set(XML2_HASH_TYPE MD5)
|
||||
set(XML2_FILE libxml2-${XML2_VERSION}.tar.gz)
|
||||
set(XML2_CPE "cpe:2.3:a:xmlsoft:libxml2:${XML2_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(TINYXML_VERSION 2_6_2)
|
||||
set(TINYXML_VERSION_DOTS 2.6.2)
|
||||
@@ -364,14 +330,12 @@ set(TINYXML_URI https://nchc.dl.sourceforge.net/project/tinyxml/tinyxml/${TINYXM
|
||||
set(TINYXML_HASH c1b864c96804a10526540c664ade67f0)
|
||||
set(TINYXML_HASH_TYPE MD5)
|
||||
set(TINYXML_FILE tinyxml_${TINYXML_VERSION}.tar.gz)
|
||||
set(TINYXML_CPE "cpe:2.3:a:tinyxml_project:tinyxml:${TINYXML_VERSION_DOTS}:*:*:*:*:*:*:*")
|
||||
|
||||
set(YAMLCPP_VERSION 0.6.3)
|
||||
set(YAMLCPP_URI https://codeload.github.com/jbeder/yaml-cpp/tar.gz/yaml-cpp-${YAMLCPP_VERSION})
|
||||
set(YAMLCPP_HASH b45bf1089a382e81f6b661062c10d0c2)
|
||||
set(YAMLCPP_HASH_TYPE MD5)
|
||||
set(YAMLCPP_FILE yaml-cpp-${YAMLCPP_VERSION}.tar.gz)
|
||||
set(YAMLCPP "cpe:2.3:a:yaml-cpp_project:yaml-cpp:${YAMLCPP_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(PYSTRING_VERSION v1.1.3)
|
||||
set(PYSTRING_URI https://codeload.github.com/imageworks/pystring/tar.gz/refs/tags/${PYSTRING_VERSION})
|
||||
@@ -380,19 +344,16 @@ set(PYSTRING_HASH_TYPE MD5)
|
||||
set(PYSTRING_FILE pystring-${PYSTRING_VERSION}.tar.gz)
|
||||
|
||||
set(EXPAT_VERSION 2_4_4)
|
||||
set(EXPAT_VERSION_DOTS 2.4.4)
|
||||
set(EXPAT_URI https://github.com/libexpat/libexpat/archive/R_${EXPAT_VERSION}.tar.gz)
|
||||
set(EXPAT_HASH 2d3e81dee94b452369dc6394ff0f8f98)
|
||||
set(EXPAT_HASH_TYPE MD5)
|
||||
set(EXPAT_FILE libexpat-${EXPAT_VERSION}.tar.gz)
|
||||
set(EXPAT_CPE "cpe:2.3:a:libexpat_project:libexpat:${EXPAT_VERSION_DOTS}:*:*:*:*:*:*:*")
|
||||
|
||||
set(PUGIXML_VERSION 1.10)
|
||||
set(PUGIXML_URI https://github.com/zeux/pugixml/archive/v${PUGIXML_VERSION}.tar.gz)
|
||||
set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
|
||||
set(PUGIXML_HASH_TYPE MD5)
|
||||
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
|
||||
set(PUGIXML_CPE "cpe:2.3:a:pugixml_project:pugixml:${PUGIXML_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(FLEXBISON_VERSION 2.5.24)
|
||||
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
|
||||
@@ -415,14 +376,12 @@ set(BZIP2_URI http://http.debian.net/debian/pool/main/b/bzip2/bzip2_${BZIP2_VERS
|
||||
set(BZIP2_HASH ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269)
|
||||
set(BZIP2_HASH_TYPE SHA256)
|
||||
set(BZIP2_FILE bzip2_${BZIP2_VERSION}.orig.tar.gz)
|
||||
set(BZIP2_CPE "cpe:2.3:a:bzip:bzip2:${BZIP2_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(FFI_VERSION 3.3)
|
||||
set(FFI_URI https://sourceware.org/pub/libffi/libffi-${FFI_VERSION}.tar.gz)
|
||||
set(FFI_HASH 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056)
|
||||
set(FFI_HASH_TYPE SHA256)
|
||||
set(FFI_FILE libffi-${FFI_VERSION}.tar.gz)
|
||||
set(FFI_CPE "cpe:2.3:a:libffi_project:libffi:${FFI_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(LZMA_VERSION 5.2.5)
|
||||
set(LZMA_URI https://tukaani.org/xz/xz-${LZMA_VERSION}.tar.bz2)
|
||||
@@ -444,14 +403,12 @@ else()
|
||||
set(SSL_HASH_TYPE SHA256)
|
||||
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
|
||||
endif()
|
||||
set(SSL_CPE "cpe:2.3:a:openssl:openssl:${SSL_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(SQLITE_VERSION 3.31.1)
|
||||
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
|
||||
set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
|
||||
set(SQLITE_HASH_TYPE SHA1)
|
||||
set(SQLITE_FILE sqlite-src-3240000.zip)
|
||||
set(SQLITE_CPE "cpe:2.3:a:sqlite:sqlite:${SQLITE_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(EMBREE_VERSION 3.13.4)
|
||||
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
|
||||
@@ -482,14 +439,12 @@ set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
|
||||
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
|
||||
set(MESA_HASH_TYPE SHA256)
|
||||
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
|
||||
set(MESA_CPE "cpe:2.3:a:mesa3d:mesa:${MESA_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(NASM_VERSION 2.15.02)
|
||||
set(NASM_URI https://github.com/netwide-assembler/nasm/archive/nasm-${NASM_VERSION}.tar.gz)
|
||||
set(NASM_HASH aded8b796c996a486a56e0515c83e414116decc3b184d88043480b32eb0a8589)
|
||||
set(NASM_HASH_TYPE SHA256)
|
||||
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
|
||||
set(NASM_PCE "cpe:2.3:a:nasm:nasm:${NASM_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(XR_OPENXR_SDK_VERSION 1.0.22)
|
||||
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
|
||||
@@ -503,18 +458,6 @@ set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/
|
||||
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
|
||||
set(WL_PROTOCOLS_HASH_TYPE MD5)
|
||||
|
||||
set(WAYLAND_VERSION 1.21.0)
|
||||
set(WAYLAND_FILE wayland-${WAYLAND_VERSION}.tar.xz)
|
||||
set(WAYLAND_URI https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.21.0/downloads/wayland-${WAYLAND_VERSION}.tar.xz)
|
||||
set(WAYLAND_HASH f2653a2293bcd882d756c6a83d278903)
|
||||
set(WAYLAND_HASH_TYPE MD5)
|
||||
|
||||
set(WAYLAND_LIBDECOR_VERSION 0.1.0)
|
||||
set(WAYLAND_LIBDECOR_FILE libdecor-${WAYLAND_LIBDECOR_VERSION}.tar.xz)
|
||||
set(WAYLAND_LIBDECOR_URI https://gitlab.gnome.org/jadahl/libdecor/uploads/81adf91d27620e20bcc5f6b9b312d768/libdecor-${WAYLAND_LIBDECOR_VERSION}.tar.xz )
|
||||
set(WAYLAND_LIBDECOR_HASH 47b59eba76faa3787f0878bf8700e912)
|
||||
set(WAYLAND_LIBDECOR_HASH_TYPE MD5)
|
||||
|
||||
set(ISPC_VERSION v1.17.0)
|
||||
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
|
||||
set(ISPC_HASH 4f476a3109332a77fe839a9014c60ca9)
|
||||
@@ -526,14 +469,12 @@ set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)
|
||||
set(GMP_HASH 0b82665c4a92fd2ade7440c13fcaa42b)
|
||||
set(GMP_HASH_TYPE MD5)
|
||||
set(GMP_FILE gmp-${GMP_VERSION}.tar.xz)
|
||||
set(GMP_CPE "cpe:2.3:a:gmplib:gmp:${GMP_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(POTRACE_VERSION 1.16)
|
||||
set(POTRACE_URI http://potrace.sourceforge.net/download/${POTRACE_VERSION}/potrace-${POTRACE_VERSION}.tar.gz)
|
||||
set(POTRACE_HASH 5f0bd87ddd9a620b0c4e65652ef93d69)
|
||||
set(POTRACE_HASH_TYPE MD5)
|
||||
set(POTRACE_FILE potrace-${POTRACE_VERSION}.tar.gz)
|
||||
set(POTRACE_CPE "cpe:2.3:a:icoasoft:potrace:${POTRACE_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(HARU_VERSION 2_3_0)
|
||||
set(HARU_URI https://github.com/libharu/libharu/archive/RELEASE_${HARU_VERSION}.tar.gz)
|
||||
@@ -546,7 +487,6 @@ set(ZSTD_URI https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}
|
||||
set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
|
||||
set(ZSTD_HASH_TYPE SHA256)
|
||||
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
|
||||
set(ZSTD_CPE "cpe:2.3:a:facebook:zstandard:${ZSTD_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(SSE2NEON_VERSION fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
|
||||
set(SSE2NEON_URI https://github.com/DLTcollab/sse2neon/archive/${SSE2NEON_VERSION}.tar.gz)
|
||||
@@ -554,19 +494,11 @@ set(SSE2NEON_HASH 0780253525d299c31775ef95853698d03db9c7739942af8570000f4a25a5d6
|
||||
set(SSE2NEON_HASH_TYPE SHA256)
|
||||
set(SSE2NEON_FILE sse2neon-${SSE2NEON_VERSION}.tar.gz)
|
||||
|
||||
set(BROTLI_VERSION 1.0.9)
|
||||
set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/v${BROTLI_VERSION}.tar.gz)
|
||||
set(BROTLI_VERSION v1.0.9)
|
||||
set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/${BROTLI_VERSION}.tar.gz)
|
||||
set(BROTLI_HASH f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46)
|
||||
set(BROTLI_HASH_TYPE SHA256)
|
||||
set(BROTLI_FILE brotli-v${BROTLI_VERSION}.tar.gz)
|
||||
set(BROTLI_CPE "cpe:2.3:a:google:brotli:${BROTLI_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(OPENPGL_VERSION v0.4.0-beta)
|
||||
set(OPENPGL_SHORT_VERSION 0.4.0)
|
||||
set(OPENPGL_URI https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/${OPENPGL_VERSION}.tar.gz)
|
||||
set(OPENPGL_HASH 58d5b65c533ce6cac3f7e1d51cf169a5411adf356abcd85f04049bbcaecc2e77)
|
||||
set(OPENPGL_HASH_TYPE SHA256)
|
||||
set(OPENPGL_FILE openpgl-${OPENPGL_VERSION}.tar.gz)
|
||||
set(BROTLI_FILE brotli-${BROTLI_VERSION}.tar.gz)
|
||||
|
||||
set(LEVEL_ZERO_VERSION v1.7.15)
|
||||
set(LEVEL_ZERO_URI https://github.com/oneapi-src/level-zero/archive/refs/tags/${LEVEL_ZERO_VERSION}.tar.gz)
|
||||
|
@@ -1,23 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
ExternalProject_Add(external_wayland
|
||||
URL file://${PACKAGE_DIR}/${WAYLAND_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${WAYLAND_HASH_TYPE}=${WAYLAND_HASH}
|
||||
PREFIX ${BUILD_DIR}/wayland
|
||||
PATCH_COMMAND ${PATCH_CMD} -d ${BUILD_DIR}/wayland/src/external_wayland < ${PATCH_DIR}/wayland.diff
|
||||
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own LIBEXPAT & LIBXML2.
|
||||
# Note that passing link args "ffi/lib" should not be needed, but
|
||||
# `pkgconfig` would incorrectly look in "ffi/lib/../lib64" otherwise.
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/expat/lib/pkgconfig:${LIBDIR}/xml2/lib/pkgconfig:${LIBDIR}/ffi/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||
meson --prefix ${LIBDIR}/wayland -Ddocumentation=false -Dtests=false -Dc_link_args=-L${LIBDIR}/ffi/lib . ../external_wayland
|
||||
BUILD_COMMAND ninja
|
||||
INSTALL_COMMAND ninja install
|
||||
)
|
||||
|
||||
add_dependencies(
|
||||
external_wayland
|
||||
external_expat
|
||||
external_xml2
|
||||
external_ffi
|
||||
)
|
@@ -1,15 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# NOTE: currently only the header file is extracted, no compilation is needed
|
||||
# as the library is dynamically loaded when found on the system.
|
||||
|
||||
ExternalProject_Add(external_wayland_libdecor
|
||||
URL file://${PACKAGE_DIR}/${WAYLAND_LIBDECOR_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${WAYLAND_LIBDECOR_HASH_TYPE}=${WAYLAND_LIBDECOR_HASH}
|
||||
PREFIX ${BUILD_DIR}/wayland_libdecor
|
||||
BUILD_COMMAND echo .
|
||||
CONFIGURE_COMMAND echo .
|
||||
INSTALL_COMMAND cp ../external_wayland_libdecor/src/libdecor.h ${LIBDIR}/wayland_libdecor/include/libdecor-0/libdecor.h
|
||||
INSTALL_DIR ${LIBDIR}/wayland_libdecor/include/libdecor-0
|
||||
)
|
@@ -5,14 +5,7 @@ ExternalProject_Add(external_wayland_protocols
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${WL_PROTOCOLS_HASH_TYPE}=${WL_PROTOCOLS_HASH}
|
||||
PREFIX ${BUILD_DIR}/wayland-protocols
|
||||
# Use `-E` so the `PKG_CONFIG_PATH` can be defined to link against our own WAYLAND.
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env PKG_CONFIG_PATH=${LIBDIR}/wayland/lib64/pkgconfig:$PKG_CONFIG_PATH
|
||||
meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
|
||||
CONFIGURE_COMMAND meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
|
||||
BUILD_COMMAND ninja
|
||||
INSTALL_COMMAND ninja install
|
||||
)
|
||||
|
||||
add_dependencies(
|
||||
external_wayland_protocols
|
||||
external_wayland
|
||||
)
|
||||
|
@@ -40,15 +40,15 @@ ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,ver-xr-openxr:,ver-
|
||||
force-all,force-python,force-boost,force-tbb,\
|
||||
force-ocio,force-imath,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\
|
||||
force-ffmpeg,force-opencollada,force-alembic,force-embree,force-oidn,force-usd,\
|
||||
force-xr-openxr,force-level-zero, force-openpgl,\
|
||||
force-xr-openxr,force-level-zero,\
|
||||
build-all,build-python,build-boost,build-tbb,\
|
||||
build-ocio,build-imath,build-openexr,build-oiio,build-llvm,build-osl,build-osd,build-openvdb,\
|
||||
build-ffmpeg,build-opencollada,build-alembic,build-embree,build-oidn,build-usd,\
|
||||
build-xr-openxr,build-level-zero, build-openpgl,\
|
||||
build-xr-openxr,build-level-zero,\
|
||||
skip-python,skip-boost,skip-tbb,\
|
||||
skip-ocio,skip-imath,skip-openexr,skip-oiio,skip-llvm,skip-osl,skip-osd,skip-openvdb,\
|
||||
skip-ffmpeg,skip-opencollada,skip-alembic,skip-embree,skip-oidn,skip-usd,\
|
||||
skip-xr-openxr,skip-level-zero, skip-openpgl \
|
||||
skip-xr-openxr,skip-level-zero \
|
||||
-- "$@" \
|
||||
)
|
||||
|
||||
@@ -136,7 +136,7 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
||||
Build and install the OpenImageDenoise libraries.
|
||||
|
||||
--with-nanovdb
|
||||
Build and install the NanoVDB branch of OpenVDB (instead of official release of OpenVDB).
|
||||
Build and install NanoVDB together with OpenVDB.
|
||||
|
||||
--with-jack
|
||||
Install the jack libraries.
|
||||
@@ -232,9 +232,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
||||
--build-level-zero=<ver>
|
||||
Force the build of OneAPI Level Zero library.
|
||||
|
||||
--build-openpgl
|
||||
Force the build of OpenPGL library.
|
||||
|
||||
Note about the --build-foo options:
|
||||
* They force the script to prefer building dependencies rather than using available packages.
|
||||
This may make things simpler and allow working around some distribution bugs, but on the other hand it will
|
||||
@@ -305,9 +302,6 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
||||
--force-level-zero=<ver>
|
||||
Force the rebuild of OneAPI Level Zero library.
|
||||
|
||||
--force-openpgl
|
||||
Force the rebuild of OpenPGL library.
|
||||
|
||||
Note about the --force-foo options:
|
||||
* They obviously only have an effect if those libraries are built by this script
|
||||
(i.e. if there is no available and satisfactory package)!
|
||||
@@ -369,10 +363,7 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
|
||||
Unconditionally skip OpenXR-SDK installation/building.
|
||||
|
||||
--skip-level-zero=<ver>
|
||||
Unconditionally skip OneAPI Level Zero installation/building.
|
||||
|
||||
--skip-openpgl
|
||||
Unconditionally skip OpenPGL installation/building.\""
|
||||
Unconditionally skip OneAPI Level Zero installation/building.\""
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Main Vars
|
||||
@@ -394,7 +385,7 @@ CLANG_FORMAT_VERSION="10.0"
|
||||
CLANG_FORMAT_VERSION_MIN="6.0"
|
||||
CLANG_FORMAT_VERSION_MEX="14.0"
|
||||
|
||||
PYTHON_VERSION="3.10.2"
|
||||
PYTHON_VERSION="3.10.6"
|
||||
PYTHON_VERSION_SHORT="3.10"
|
||||
PYTHON_VERSION_MIN="3.10"
|
||||
PYTHON_VERSION_MEX="3.12"
|
||||
@@ -434,7 +425,7 @@ PYTHON_ZSTANDARD_VERSION_MIN="0.15.2"
|
||||
PYTHON_ZSTANDARD_VERSION_MEX="0.20.0"
|
||||
PYTHON_ZSTANDARD_NAME="zstandard"
|
||||
|
||||
PYTHON_NUMPY_VERSION="1.22.0"
|
||||
PYTHON_NUMPY_VERSION="1.23.2"
|
||||
PYTHON_NUMPY_VERSION_MIN="1.14"
|
||||
PYTHON_NUMPY_VERSION_MEX="2.0"
|
||||
PYTHON_NUMPY_NAME="numpy"
|
||||
@@ -462,8 +453,8 @@ PYTHON_MODULES_PIP=(
|
||||
)
|
||||
|
||||
|
||||
BOOST_VERSION="1.78.0"
|
||||
BOOST_VERSION_SHORT="1.78"
|
||||
BOOST_VERSION="1.80.0"
|
||||
BOOST_VERSION_SHORT="1.80"
|
||||
BOOST_VERSION_MIN="1.49"
|
||||
BOOST_VERSION_MEX="2.0"
|
||||
BOOST_FORCE_BUILD=false
|
||||
@@ -505,7 +496,7 @@ OPENEXR_FORCE_REBUILD=false
|
||||
OPENEXR_SKIP=false
|
||||
_with_built_openexr=false
|
||||
|
||||
OIIO_VERSION="2.3.13.0"
|
||||
OIIO_VERSION="2.3.18.0"
|
||||
OIIO_VERSION_SHORT="2.3"
|
||||
OIIO_VERSION_MIN="2.1.12"
|
||||
OIIO_VERSION_MEX="2.4.0"
|
||||
@@ -543,10 +534,10 @@ OSD_SKIP=false
|
||||
# OpenVDB needs to be compiled for now
|
||||
OPENVDB_BLOSC_VERSION="1.21.1"
|
||||
|
||||
OPENVDB_VERSION="9.0.0"
|
||||
OPENVDB_VERSION_SHORT="9.0"
|
||||
OPENVDB_VERSION="9.1.0"
|
||||
OPENVDB_VERSION_SHORT="9.1"
|
||||
OPENVDB_VERSION_MIN="9.0"
|
||||
OPENVDB_VERSION_MEX="9.1"
|
||||
OPENVDB_VERSION_MEX="9.2"
|
||||
OPENVDB_FORCE_BUILD=false
|
||||
OPENVDB_FORCE_REBUILD=false
|
||||
OPENVDB_SKIP=false
|
||||
@@ -602,14 +593,6 @@ LEVEL_ZERO_FORCE_BUILD=false
|
||||
LEVEL_ZERO_FORCE_REBUILD=false
|
||||
LEVEL_ZERO_SKIP=false
|
||||
|
||||
OPENPGL_VERSION="0.3.1"
|
||||
OPENPGL_VERSION_SHORT="0.3"
|
||||
OPENPGL_VERSION_MIN="0.3.1"
|
||||
OPENPGL_VERSION_MEX="0.3.2"
|
||||
OPENPGL_FORCE_BUILD=false
|
||||
OPENPGL_FORCE_REBUILD=false
|
||||
OPENPGL_SKIP=false
|
||||
|
||||
XR_OPENXR_VERSION="1.0.22"
|
||||
XR_OPENXR_VERSION_SHORT="1.0"
|
||||
XR_OPENXR_VERSION_MIN="1.0.8"
|
||||
@@ -844,7 +827,6 @@ while true; do
|
||||
USD_FORCE_BUILD=true
|
||||
XR_OPENXR_FORCE_BUILD=true
|
||||
LEVEL_ZERO_FORCE_BUILD=true
|
||||
OPENPGL_FORCE_BUILD=true
|
||||
shift; continue
|
||||
;;
|
||||
--build-python)
|
||||
@@ -905,9 +887,6 @@ while true; do
|
||||
--build-level-zero)
|
||||
LEVEL_ZERO_FORCE_BUILD=true; shift; continue
|
||||
;;
|
||||
--build-openpgl)
|
||||
OPENPGL_FORCE_BUILD=true; shift; continue
|
||||
;;
|
||||
--force-all)
|
||||
PYTHON_FORCE_REBUILD=true
|
||||
BOOST_FORCE_REBUILD=true
|
||||
@@ -928,7 +907,6 @@ while true; do
|
||||
USD_FORCE_REBUILD=true
|
||||
XR_OPENXR_FORCE_REBUILD=true
|
||||
LEVEL_ZERO_FORCE_REBUILD=true
|
||||
OPENPGL_FORCE_REBUILD=true
|
||||
shift; continue
|
||||
;;
|
||||
--force-python)
|
||||
@@ -989,9 +967,6 @@ while true; do
|
||||
--force-level-zero)
|
||||
LEVEL_ZERO_FORCE_REBUILD=true; shift; continue
|
||||
;;
|
||||
--force-openpgl)
|
||||
OPENPGL_FORCE_REBUILD=true; shift; continue
|
||||
;;
|
||||
--skip-python)
|
||||
PYTHON_SKIP=true; shift; continue
|
||||
;;
|
||||
@@ -1049,9 +1024,6 @@ while true; do
|
||||
--skip-level-zero)
|
||||
LEVEL_ZERO_SKIP=true; shift; continue
|
||||
;;
|
||||
--skip-openpgl)
|
||||
OPENPGL_SKIP=true; shift; continue
|
||||
;;
|
||||
--)
|
||||
# no more arguments to parse
|
||||
break
|
||||
@@ -1201,9 +1173,6 @@ XR_OPENXR_REPO_BRANCH="master"
|
||||
|
||||
LEVEL_ZERO_SOURCE=("https://github.com/oneapi-src/level-zero/archive/refs/tags/v${LEVEL_ZERO_VERSION}.tar.gz")
|
||||
|
||||
OPENPGL_USE_REPO=false
|
||||
OPENPGL_SOURCE=( "https://github.com/OpenPathGuidingLibrary/openpgl/archive/refs/tags/v${OPENPGL_VERSION}-beta.tar.gz" )
|
||||
|
||||
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
|
||||
|
||||
# C++11 is required now
|
||||
@@ -1222,7 +1191,7 @@ Those libraries should be available as packages in all recent distributions (opt
|
||||
* Basics of dev environment (cmake, gcc, svn , git, ...).
|
||||
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
|
||||
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
|
||||
* libwayland-client0, libdecor, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
|
||||
* libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
|
||||
* libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex.
|
||||
* libsdl2, libepoxy, libpugixml, libpotrace, [libgmp], fontconfig, [libharu/libhpdf].\""
|
||||
|
||||
@@ -1258,8 +1227,7 @@ You may also want to build them yourself (optional ones are [between brackets]):
|
||||
* [Alembic $ALEMBIC_VERSION] (from $ALEMBIC_SOURCE).
|
||||
* [Universal Scene Description $USD_VERSION] (from $USD_SOURCE).
|
||||
* [OpenXR-SDK $XR_OPENXR_VERSION] (from $XR_OPENXR_SOURCE).
|
||||
* [OneAPI Level Zero $LEVEL_ZERO_VERSION] (from $LEVEL_ZERO_SOURCE).
|
||||
* [OpenPGL $OPENPGL_VERSION] (from $OPENPGL_SOURCE).\""
|
||||
* [OneAPI Level Zero $LEVEL_ZERO_VERSION] (from $LEVEL_ZERO_SOURCE).\""
|
||||
|
||||
if [ "$DO_SHOW_DEPS" = true ]; then
|
||||
PRINT ""
|
||||
@@ -1693,7 +1661,6 @@ _update_deps_tbb() {
|
||||
USD_FORCE_BUILD=true
|
||||
EMBREE_FORCE_BUILD=true
|
||||
OIDN_FORCE_BUILD=true
|
||||
OPENPGL_FORCE_BUILD=true
|
||||
fi
|
||||
if [ "$2" = true ]; then
|
||||
OSD_FORCE_REBUILD=true
|
||||
@@ -1701,7 +1668,6 @@ _update_deps_tbb() {
|
||||
USD_FORCE_REBUILD=true
|
||||
EMBREE_FORCE_REBUILD=true
|
||||
OIDN_FORCE_REBUILD=true
|
||||
OPENPGL_FORCE_REBUILD=true
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -2953,6 +2919,10 @@ compile_OPENVDB() {
|
||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
||||
cmake_d="$cmake_d -D USE_STATIC_DEPENDENCIES=OFF"
|
||||
cmake_d="$cmake_d -D OPENVDB_BUILD_BINARIES=OFF"
|
||||
# Unfortunately OpenVDB currently forces using recent oneTBB over older versions when it finds it,
|
||||
# even when TBB_ROOT is specified. So have to prevent any check for system library -
|
||||
# in the hope it will not break in some other cases.
|
||||
cmake_d="$cmake_d -D DISABLE_CMAKE_SEARCH_PATHS=ON"
|
||||
|
||||
if [ "$WITH_NANOVDB" = true ]; then
|
||||
cmake_d="$cmake_d -D USE_NANOVDB=ON"
|
||||
@@ -2965,7 +2935,6 @@ compile_OPENVDB() {
|
||||
cmake_d="$cmake_d -D Boost_USE_MULTITHREADED=ON"
|
||||
cmake_d="$cmake_d -D Boost_NO_SYSTEM_PATHS=ON"
|
||||
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
|
||||
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
|
||||
fi
|
||||
if [ -d $INST/tbb ]; then
|
||||
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
|
||||
@@ -3229,7 +3198,7 @@ _init_opencollada() {
|
||||
_inst_shortcut=$INST/opencollada
|
||||
}
|
||||
|
||||
_update_deps_collada() {
|
||||
_update_deps_opencollada() {
|
||||
:
|
||||
}
|
||||
|
||||
@@ -3340,12 +3309,7 @@ _init_embree() {
|
||||
}
|
||||
|
||||
_update_deps_embree() {
|
||||
if [ "$1" = true ]; then
|
||||
OPENPGL_FORCE_BUILD=true
|
||||
fi
|
||||
if [ "$2" = true ]; then
|
||||
OPENPGL_FORCE_REBUILD=true
|
||||
fi
|
||||
:
|
||||
}
|
||||
|
||||
clean_Embree() {
|
||||
@@ -3364,7 +3328,7 @@ compile_Embree() {
|
||||
fi
|
||||
|
||||
# To be changed each time we make edits that would modify the compiled results!
|
||||
embree_magic=12
|
||||
embree_magic=11
|
||||
_init_embree
|
||||
|
||||
# Force having own builds for the dependencies.
|
||||
@@ -4001,112 +3965,6 @@ compile_Level_Zero() {
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Build OpenPGL
|
||||
|
||||
_init_openpgl() {
|
||||
_src=$SRC/openpgl-$OPENPGL_VERSION
|
||||
_git=false
|
||||
_inst=$INST/openpgl-$OPENPGL_VERSION_SHORT
|
||||
_inst_shortcut=$INST/openpgl
|
||||
}
|
||||
|
||||
_update_deps_openpgl() {
|
||||
:
|
||||
}
|
||||
|
||||
clean_OpenPGL() {
|
||||
_init_openpgl
|
||||
if [ -d $_inst ]; then
|
||||
# Force rebuilding the dependencies if needed.
|
||||
_update_deps_openpgl false true
|
||||
fi
|
||||
_clean
|
||||
}
|
||||
|
||||
compile_OpenPGL() {
|
||||
if [ "$NO_BUILD" = true ]; then
|
||||
WARNING "--no-build enabled, OpenPGL will not be compiled!"
|
||||
return
|
||||
fi
|
||||
|
||||
# To be changed each time we make edits that would modify the compiled results!
|
||||
openpgl_magic=1
|
||||
_init_openpgl
|
||||
|
||||
# Force having own builds for the dependencies.
|
||||
_update_deps_openpgl true false
|
||||
|
||||
# Clean install if needed!
|
||||
magic_compile_check openpgl-$OPENPGL_VERSION $openpgl_magic
|
||||
if [ $? -eq 1 -o "$OPENPGL_FORCE_REBUILD" = true ]; then
|
||||
clean_OpenPGL
|
||||
fi
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
INFO "Building OpenPGL-$OPENPGL_VERSION"
|
||||
|
||||
# Force rebuilding the dependencies.
|
||||
_update_deps_openpgl true true
|
||||
|
||||
prepare_inst
|
||||
|
||||
if [ ! -d $_src ]; then
|
||||
mkdir -p $SRC
|
||||
download OPENPGL_SOURCE[@] "$_src.tar.gz"
|
||||
INFO "Unpacking OpenPGL-$OPENPGL_VERSION"
|
||||
tar -C $SRC --transform "s,(.*/?)openpgl-$OPENPGL_VERSION-beta[^/]*(.*),\1openpgl-$OPENPGL_VERSION\2,x" \
|
||||
-xf $_src.tar.gz
|
||||
fi
|
||||
|
||||
cd $_src
|
||||
|
||||
INFO "$_src"
|
||||
|
||||
# Always refresh the whole build!
|
||||
if [ -d build ]; then
|
||||
rm -rf build
|
||||
fi
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cmake_d="-D CMAKE_BUILD_TYPE=Release"
|
||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
||||
cmake_d="$cmake_d -D OPENPGL_BUILD_STATIC=OFF"
|
||||
cmake_d="$cmake_d -D OPENPGL_BUILD_PYTHON=OFF"
|
||||
cmake_d="$cmake_d -D EMBREE_ISPC_SUPPORT=OFF"
|
||||
if [ -d $INST/tbb ]; then
|
||||
cmake_d="$cmake_d -D OPENPGL_TBB_ROOT=$INST/tbb"
|
||||
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
|
||||
fi
|
||||
|
||||
cmake $cmake_d ../
|
||||
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
ERROR "OpenPGL-$OPENPGL_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
magic_compile_set openpgl-$OPENPGL_VERSION $openpgl_magic
|
||||
|
||||
cd $CWD
|
||||
INFO "Done compiling OpenPGL-$OPENPGL_VERSION!"
|
||||
else
|
||||
INFO "Own OpenPGL-$OPENPGL_VERSION is up to date, nothing to do!"
|
||||
INFO "If you want to force rebuild of this lib, use the --force-openpgl option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
|
||||
run_ldconfig "openpgl"
|
||||
}
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Install on DEB-like
|
||||
|
||||
@@ -4205,12 +4063,11 @@ install_DEB() {
|
||||
_packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
|
||||
git libfreetype6-dev libfontconfig-dev libx11-dev flex bison libxxf86vm-dev \
|
||||
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
|
||||
libwayland-dev libdecor-0-dev wayland-protocols libegl-dev libxkbcommon-dev libdbus-1-dev linux-libc-dev \
|
||||
libwayland-dev wayland-protocols libegl-dev libxkbcommon-dev libdbus-1-dev linux-libc-dev \
|
||||
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
|
||||
libopenal-dev libepoxy-dev yasm \
|
||||
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
|
||||
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev libpystring-dev \
|
||||
libglfw3-dev"
|
||||
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev libpystring-dev"
|
||||
|
||||
VORBIS_USE=true
|
||||
OGG_USE=true
|
||||
@@ -4740,18 +4597,6 @@ install_DEB() {
|
||||
PRINT ""
|
||||
compile_Level_Zero
|
||||
fi
|
||||
|
||||
PRINT ""
|
||||
if [ "$OPENPGL_SKIP" = true ]; then
|
||||
WARNING "Skipping OpenPGL installation, as requested..."
|
||||
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
|
||||
INFO "Forced OpenPGL building, as requested..."
|
||||
compile_OpenPGL
|
||||
else
|
||||
# No package currently!
|
||||
PRINT ""
|
||||
compile_OpenPGL
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -4928,7 +4773,7 @@ install_RPM() {
|
||||
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison fontconfig-devel \
|
||||
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
|
||||
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
|
||||
wayland-devel libdecor-devel wayland-protocols-devel mesa-libEGL-devel libxkbcommon-devel dbus-devel kernel-headers \
|
||||
wayland-devel wayland-protocols-devel mesa-libEGL-devel libxkbcommon-devel dbus-devel kernel-headers \
|
||||
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
|
||||
libepoxy-devel yasm patch \
|
||||
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
|
||||
@@ -5459,18 +5304,6 @@ install_RPM() {
|
||||
PRINT ""
|
||||
compile_Level_Zero
|
||||
fi
|
||||
|
||||
PRINT ""
|
||||
if [ "$OPENPGL_SKIP" = true ]; then
|
||||
WARNING "Skipping OpenPGL installation, as requested..."
|
||||
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
|
||||
INFO "Forced OpenPGL building, as requested..."
|
||||
compile_OpenPGL
|
||||
else
|
||||
# No package currently!
|
||||
PRINT ""
|
||||
compile_OpenPGL
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -5582,7 +5415,7 @@ install_ARCH() {
|
||||
fi
|
||||
|
||||
_packages="$BASE_DEVEL git cmake fontconfig flex \
|
||||
libxi libxcursor libxrandr libxinerama libepoxy libdecor libpng libtiff wget openal \
|
||||
libxi libxcursor libxrandr libxinerama libepoxy libpng libtiff wget openal \
|
||||
$OPENJPEG_DEV yasm sdl2 fftw \
|
||||
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu \
|
||||
zstd pystring"
|
||||
@@ -6067,18 +5900,6 @@ install_ARCH() {
|
||||
PRINT ""
|
||||
compile_Level_Zero
|
||||
fi
|
||||
|
||||
PRINT ""
|
||||
if [ "$OPENPGL_SKIP" = true ]; then
|
||||
WARNING "Skipping OpenPGL installation, as requested..."
|
||||
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
|
||||
INFO "Forced OpenPGL building, as requested..."
|
||||
compile_OpenPGL
|
||||
else
|
||||
# No package currently!
|
||||
PRINT ""
|
||||
compile_OpenPGL
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -6261,14 +6082,6 @@ install_OTHER() {
|
||||
INFO "Forced Level Zero building, as requested..."
|
||||
compile_Level_Zero
|
||||
fi
|
||||
|
||||
PRINT ""
|
||||
if [ "$OPENPGL_SKIP" = true ]; then
|
||||
WARNING "Skipping OpenPGL installation, as requested..."
|
||||
elif [ "$OPENPGL_FORCE_BUILD" = true ]; then
|
||||
INFO "Forced OpenPGL building, as requested..."
|
||||
compile_OpenPGL
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -6286,7 +6099,7 @@ print_info() {
|
||||
_buildargs="-U *SNDFILE* -U PYTHON* -U *BOOST* -U *Boost* -U *TBB*"
|
||||
_buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CLANG* -U *CYCLES*"
|
||||
_buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *BLOSC* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC* -U *USD*"
|
||||
_buildargs="$_buildargs -U *EMBREE* -U *OPENIMAGEDENOISE* -U *OPENXR* -U *OPENPGL*"
|
||||
_buildargs="$_buildargs -U *EMBREE* -U *OPENIMAGEDENOISE* -U *OPENXR*"
|
||||
|
||||
_1="-D WITH_CODEC_SNDFILE=ON"
|
||||
PRINT " $_1"
|
||||
@@ -6405,7 +6218,7 @@ print_info() {
|
||||
fi
|
||||
if [ -d $INST/nanovdb ]; then
|
||||
_1="-D WITH_NANOVDB=ON"
|
||||
_2="-D NANOVDB_ROOT_DIR=$INST/nanovdb"
|
||||
_2="-D NANOVDB_ROOT_DIR=$INST/openvdb"
|
||||
PRINT " $_1"
|
||||
PRINT " $_2"
|
||||
_buildargs="$_buildargs $_1 $_2"
|
||||
@@ -6517,16 +6330,6 @@ print_info() {
|
||||
#~ fi
|
||||
#~ fi
|
||||
|
||||
if [ "$OPENPGL_SKIP" = false ]; then
|
||||
if [ -d $INST/openpgl ]; then
|
||||
_1="-D openpgl_DIR=$INST/openpgl/lib/cmake/openpgl-$OPENPGL_VERSION"
|
||||
_2="-D WITH_CYCLES_PATH_GUIDING=ON"
|
||||
PRINT " $_1"
|
||||
PRINT " $_2"
|
||||
_buildargs="$_buildargs $_1 $_2"
|
||||
fi
|
||||
fi
|
||||
|
||||
PRINT ""
|
||||
PRINT "Or even simpler, just run (in your blender-source dir):"
|
||||
PRINT " make -j$THREADS BUILD_CMAKE_ARGS=\"$_buildargs\""
|
||||
|
@@ -1,130 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# This script is part of the official build environment, see WIKI page for details.
|
||||
# https://wiki.blender.org/wiki/Building_Blender/Other/CentOS7ReleaseEnvironment
|
||||
|
||||
set -e
|
||||
|
||||
if [ `id -u` -ne 0 ]; then
|
||||
echo "This script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# yum-config-manager does not come in the default minimal install,
|
||||
# so make sure it is installed and available.
|
||||
yum -y update
|
||||
yum -y install yum-utils
|
||||
|
||||
# Install all the packages needed for a new toolchain.
|
||||
#
|
||||
# NOTE: Keep this separate from the packages install, since otherwise
|
||||
# older toolchain will be installed.
|
||||
yum -y update
|
||||
yum -y install epel-release
|
||||
yum -y install centos-release-scl
|
||||
yum -y install devtoolset-9
|
||||
|
||||
# Install packages needed for Blender's dependencies.
|
||||
PACKAGES_FOR_LIBS=(
|
||||
# Used to checkout Blender's code.
|
||||
git
|
||||
# Used to checkout Blender's `../lib/` directory.
|
||||
subversion
|
||||
# Used to extract packages.
|
||||
bzip2
|
||||
# Used to extract packages.
|
||||
tar
|
||||
# Blender and some dependencies use `cmake`.
|
||||
cmake3
|
||||
# Apply patches from Blender's: `./build_files/build_environment/patches`
|
||||
patch
|
||||
# Use by `cmake` and `autoconf`.
|
||||
make
|
||||
|
||||
# Required by: `external_nasm` which uses an `autoconf` build-system.
|
||||
autoconf
|
||||
automake
|
||||
libtool
|
||||
|
||||
# Meta-build system used by various packages.
|
||||
meson
|
||||
# Builds generated by meson use Ninja for the actual build.
|
||||
ninja-build
|
||||
|
||||
# Required by Blender build option: `WITH_GHOST_X11`.
|
||||
libXrandr-devel
|
||||
libXinerama-devel
|
||||
libXcursor-devel
|
||||
libXi-devel
|
||||
libX11-devel
|
||||
libXt-devel
|
||||
|
||||
# Required by Blender build option: `WITH_GHOST_WAYLAND`.
|
||||
mesa-libEGL-devel
|
||||
# Required by: Blender & `external_opensubdiv` (probably others).
|
||||
mesa-libGL-devel
|
||||
mesa-libGLU-devel
|
||||
|
||||
# Required by: `external_ispc`.
|
||||
zlib-devel
|
||||
# TODO: dependencies build without this, consider removal.
|
||||
rubygem-asciidoctor
|
||||
# TODO: dependencies build without this, consider removal.
|
||||
wget
|
||||
# Required by: `external_sqlite` as a build-time dependency (needed for the `tclsh` command).
|
||||
tcl
|
||||
# Required by: `external_aom`.
|
||||
# TODO: Blender is already building `external_nasm` which is listed as an alternative to `yasm`.
|
||||
# Why are both needed?
|
||||
yasm
|
||||
|
||||
# Required by: `meson` (Python based build system).
|
||||
python36
|
||||
# Required by: `mako` (Python module used for building `external_mesa`)
|
||||
python-setuptools
|
||||
|
||||
# Required by: `external_igc` & `external_osl` as a build-time dependency.
|
||||
bison
|
||||
# Required by: `external_osl` as a build-time dependency.
|
||||
flex
|
||||
# TODO: dependencies build without this, consider removal.
|
||||
ncurses-devel
|
||||
)
|
||||
|
||||
# Additional packages needed for building Blender.
|
||||
PACKAGES_FOR_BLENDER=(
|
||||
# Required by Blender build option: `WITH_GHOST_WAYLAND`.
|
||||
libxkbcommon-devel
|
||||
)
|
||||
|
||||
yum -y install -y ${PACKAGES_FOR_LIBS[@]} ${PACKAGES_FOR_BLENDER[@]}
|
||||
|
||||
# Dependencies for Mesa
|
||||
yum -y install expat-devel
|
||||
python3 -m pip install mako
|
||||
|
||||
# Dependencies for pip (needed for buildbot-worker).
|
||||
yum -y install python36-pip python36-devel
|
||||
|
||||
# Dependencies for asound.
|
||||
yum -y install -y \
|
||||
alsa-lib-devel pulseaudio-libs-devel
|
||||
|
||||
alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake 10 \
|
||||
--slave /usr/local/bin/ctest ctest /usr/bin/ctest \
|
||||
--slave /usr/local/bin/cpack cpack /usr/bin/cpack \
|
||||
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake \
|
||||
--family cmake
|
||||
|
||||
alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
|
||||
--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
|
||||
--slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \
|
||||
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \
|
||||
--family cmake
|
||||
|
||||
alternatives --install /usr/local/bin/cmake cmake /usr/bin/cmake3 20 \
|
||||
--slave /usr/local/bin/ctest ctest /usr/bin/ctest3 \
|
||||
--slave /usr/local/bin/cpack cpack /usr/bin/cpack3 \
|
||||
--slave /usr/local/bin/ccmake ccmake /usr/bin/ccmake3 \
|
||||
--family cmake
|
@@ -14,15 +14,3 @@ index 7b894a45..92618215 100644
|
||||
)
|
||||
if(CMAKE_TOOLCHAIN_FILE)
|
||||
set(pystring_CMAKE_ARGS
|
||||
--- a/src/OpenColorIO/FileRules.cpp
|
||||
+++ b/src/OpenColorIO/FileRules.cpp
|
||||
@@ -7,6 +7,9 @@
|
||||
#include <regex>
|
||||
#include <sstream>
|
||||
|
||||
+/* NOTE: this has been applied up-stream, this edit can be removed after upgrading OpenColorIO. */
|
||||
+#include <cstring>
|
||||
+
|
||||
#include <OpenColorIO/OpenColorIO.h>
|
||||
|
||||
#include "CustomKeys.h"
|
||||
|
@@ -1,11 +0,0 @@
|
||||
--- meson.build.orig 2022-06-30 22:59:11.000000000 +0100
|
||||
+++ meson.build 2022-09-27 13:21:26.428517668 +0100
|
||||
@@ -2,7 +2,7 @@
|
||||
'wayland', 'c',
|
||||
version: '1.21.0',
|
||||
license: 'MIT',
|
||||
- meson_version: '>= 0.56.0',
|
||||
+ meson_version: '>= 0.55.1',
|
||||
default_options: [
|
||||
'warning_level=2',
|
||||
'buildtype=debugoptimized',
|
@@ -44,7 +44,7 @@ FIND_PROGRAM(SYCL_COMPILER
|
||||
# compiler.
|
||||
if(NOT SYCL_COMPILER)
|
||||
FIND_PROGRAM(SYCL_COMPILER
|
||||
NAMES
|
||||
NAMES
|
||||
dpcpp
|
||||
HINTS
|
||||
${_sycl_search_dirs}
|
||||
@@ -62,13 +62,6 @@ FIND_LIBRARY(SYCL_LIBRARY
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
string(REPLACE ".lib" "d.lib" SYCL_LIBRARY_DEBUG ${SYCL_LIBRARY})
|
||||
set(SYCL_LIBRARY_DEBUG ${SYCL_LIBRARY_DEBUG} CACHE FILEPATH "Path to SYCL debug library")
|
||||
else()
|
||||
set(SYCL_LIBRARY_DEBUG ${SYCL_LIBRARY} CACHE FILEPATH "Path to SYCL debug library")
|
||||
endif()
|
||||
|
||||
FIND_PATH(SYCL_INCLUDE_DIR
|
||||
NAMES
|
||||
CL/sycl.hpp
|
||||
@@ -92,5 +85,4 @@ ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
_SYCL_INCLUDE_PARENT_DIR
|
||||
SYCL_LIBRARY_DEBUG
|
||||
)
|
||||
|
@@ -40,10 +40,12 @@ macro(BLENDER_SRC_GTEST_EX)
|
||||
set(MANIFEST "${CMAKE_BINARY_DIR}/tests.exe.manifest")
|
||||
endif()
|
||||
|
||||
add_definitions(-DBLENDER_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
|
||||
add_definitions(${GFLAGS_DEFINES})
|
||||
add_definitions(${GLOG_DEFINES})
|
||||
|
||||
add_executable(${TARGET_NAME} ${ARG_SRC} ${MANIFEST})
|
||||
setup_platform_linker_flags(${TARGET_NAME})
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE ${GFLAGS_DEFINES})
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE ${GLOG_DEFINES})
|
||||
target_include_directories(${TARGET_NAME} PUBLIC "${TEST_INC}")
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC "${TEST_INC_SYS}")
|
||||
target_link_libraries(${TARGET_NAME} ${ARG_EXTRA_LIBS} ${PLATFORM_LINKLIBS})
|
||||
|
@@ -150,10 +150,10 @@ endif()
|
||||
# BUILD_PLATFORM is taken from CMake
|
||||
# but BUILD_DATE and BUILD_TIME are platform dependent
|
||||
if(NOT BUILD_DATE)
|
||||
string(TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
|
||||
STRING(TIMESTAMP BUILD_DATE "%Y-%m-%d" UTC)
|
||||
endif()
|
||||
if(NOT BUILD_TIME)
|
||||
string(TIMESTAMP BUILD_TIME "%H:%M:%S" UTC)
|
||||
STRING(TIMESTAMP BUILD_TIME "%H:%M:%S" UTC)
|
||||
endif()
|
||||
|
||||
# Write a file with the BUILD_HASH define
|
||||
|
@@ -17,7 +17,6 @@ set(WITH_COMPOSITOR_CPU ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_EMBREE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_PATH_GUIDING ON CACHE BOOL "" FORCE)
|
||||
set(WITH_DRACO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
|
||||
|
@@ -18,7 +18,6 @@ set(WITH_COMPOSITOR_CPU ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_EMBREE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_PATH_GUIDING ON CACHE BOOL "" FORCE)
|
||||
set(WITH_DRACO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
|
||||
|
@@ -134,11 +134,12 @@ endfunction()
|
||||
|
||||
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
|
||||
# use it instead of include_directories()
|
||||
function(absolute_include_dirs
|
||||
includes_absolute)
|
||||
function(blender_include_dirs
|
||||
includes
|
||||
)
|
||||
|
||||
set(_ALL_INCS "")
|
||||
foreach(_INC ${ARGN})
|
||||
foreach(_INC ${ARGV})
|
||||
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
||||
list(APPEND _ALL_INCS ${_ABS_INC})
|
||||
# for checking for invalid includes, disable for regular use
|
||||
@@ -146,24 +147,22 @@ function(absolute_include_dirs
|
||||
# message(FATAL_ERROR "Include not found: ${_ABS_INC}/")
|
||||
# endif()
|
||||
endforeach()
|
||||
|
||||
set(${includes_absolute} ${_ALL_INCS} PARENT_SCOPE)
|
||||
include_directories(${_ALL_INCS})
|
||||
endfunction()
|
||||
|
||||
function(blender_target_include_dirs
|
||||
name
|
||||
function(blender_include_dirs_sys
|
||||
includes
|
||||
)
|
||||
|
||||
absolute_include_dirs(_ALL_INCS ${ARGN})
|
||||
target_include_directories(${name} PRIVATE ${_ALL_INCS})
|
||||
endfunction()
|
||||
|
||||
function(blender_target_include_dirs_sys
|
||||
name
|
||||
)
|
||||
|
||||
absolute_include_dirs(_ALL_INCS ${ARGN})
|
||||
target_include_directories(${name} SYSTEM PRIVATE ${_ALL_INCS})
|
||||
set(_ALL_INCS "")
|
||||
foreach(_INC ${ARGV})
|
||||
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
||||
list(APPEND _ALL_INCS ${_ABS_INC})
|
||||
# if(NOT EXISTS "${_ABS_INC}/")
|
||||
# message(FATAL_ERROR "Include not found: ${_ABS_INC}/")
|
||||
# endif()
|
||||
endforeach()
|
||||
include_directories(SYSTEM ${_ALL_INCS})
|
||||
endfunction()
|
||||
|
||||
# Set include paths for header files included with "*.h" syntax.
|
||||
@@ -269,10 +268,12 @@ function(blender_add_lib__impl
|
||||
|
||||
# message(STATUS "Configuring library ${name}")
|
||||
|
||||
add_library(${name} ${sources})
|
||||
# include_directories(${includes})
|
||||
# include_directories(SYSTEM ${includes_sys})
|
||||
blender_include_dirs("${includes}")
|
||||
blender_include_dirs_sys("${includes_sys}")
|
||||
|
||||
blender_target_include_dirs(${name} ${includes})
|
||||
blender_target_include_dirs_sys(${name} ${includes_sys})
|
||||
add_library(${name} ${sources})
|
||||
|
||||
# On Windows certain libraries have two sets of binaries: one for debug builds and one for
|
||||
# release builds. The root of this requirement goes into ABI, I believe, but that's outside
|
||||
@@ -381,7 +382,7 @@ function(blender_add_test_suite)
|
||||
cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
# Figure out the release dir, as some tests need files from there.
|
||||
get_blender_test_install_dir(TEST_INSTALL_DIR)
|
||||
GET_BLENDER_TEST_INSTALL_DIR(TEST_INSTALL_DIR)
|
||||
if(APPLE)
|
||||
set(_test_release_dir ${TEST_INSTALL_DIR}/Blender.app/Contents/Resources/${BLENDER_VERSION})
|
||||
else()
|
||||
@@ -417,6 +418,13 @@ function(blender_add_test_lib
|
||||
library_deps
|
||||
)
|
||||
|
||||
# Not currently supported for Python module due to different required
|
||||
# Python link flags.
|
||||
if(WITH_PYTHON_MODULE)
|
||||
add_custom_target(${name})
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_cc_flags_custom_test(${name} PARENT_SCOPE)
|
||||
|
||||
# Otherwise external projects will produce warnings that we cannot fix.
|
||||
@@ -424,21 +432,21 @@ function(blender_add_test_lib
|
||||
|
||||
# This duplicates logic that's also in GTestTesting.cmake, macro BLENDER_SRC_GTEST_EX.
|
||||
# TODO(Sybren): deduplicate after the general approach in D7649 has been approved.
|
||||
list(APPEND includes
|
||||
LIST(APPEND includes
|
||||
${CMAKE_SOURCE_DIR}/tests/gtests
|
||||
)
|
||||
list(APPEND includes_sys
|
||||
LIST(APPEND includes_sys
|
||||
${GLOG_INCLUDE_DIRS}
|
||||
${GFLAGS_INCLUDE_DIRS}
|
||||
${CMAKE_SOURCE_DIR}/extern/gtest/include
|
||||
${CMAKE_SOURCE_DIR}/extern/gmock/include
|
||||
)
|
||||
add_definitions(-DBLENDER_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
|
||||
add_definitions(${GFLAGS_DEFINES})
|
||||
add_definitions(${GLOG_DEFINES})
|
||||
|
||||
blender_add_lib__impl(${name} "${sources}" "${includes}" "${includes_sys}" "${library_deps}")
|
||||
|
||||
target_compile_definitions(${name} PRIVATE ${GFLAGS_DEFINES})
|
||||
target_compile_definitions(${name} PRIVATE ${GLOG_DEFINES})
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY BLENDER_TEST_LIBS ${name})
|
||||
|
||||
blender_add_test_suite(
|
||||
@@ -463,21 +471,28 @@ function(blender_add_test_executable
|
||||
library_deps
|
||||
)
|
||||
|
||||
# Not currently supported for Python module due to different required
|
||||
# Python link flags.
|
||||
if(WITH_PYTHON_MODULE)
|
||||
add_custom_target(${name})
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_cc_flags_custom_test(${name} PARENT_SCOPE)
|
||||
|
||||
## Otherwise external projects will produce warnings that we cannot fix.
|
||||
remove_strict_flags()
|
||||
|
||||
blender_src_gtest_ex(
|
||||
include_directories(${includes})
|
||||
include_directories(${includes_sys})
|
||||
|
||||
BLENDER_SRC_GTEST_EX(
|
||||
NAME ${name}
|
||||
SRC "${sources}"
|
||||
EXTRA_LIBS "${library_deps}"
|
||||
SKIP_ADD_TEST
|
||||
)
|
||||
|
||||
blender_target_include_dirs(${name}_test ${includes})
|
||||
blender_target_include_dirs_sys(${name}_test ${includes_sys})
|
||||
|
||||
blender_add_test_suite(
|
||||
TARGET ${name}_test
|
||||
SUITE_NAME ${name}
|
||||
@@ -512,11 +527,6 @@ function(setup_platform_linker_flags
|
||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${PLATFORM_LINKFLAGS}")
|
||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " ${PLATFORM_LINKFLAGS_RELEASE}")
|
||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " ${PLATFORM_LINKFLAGS_DEBUG}")
|
||||
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if (target_type STREQUAL "EXECUTABLE")
|
||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${PLATFORM_LINKFLAGS_EXECUTABLE}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Platform specific libraries for targets.
|
||||
@@ -764,7 +774,7 @@ function(ADD_CHECK_C_COMPILER_FLAG
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
|
||||
check_c_compiler_flag("${_FLAG}" "${_CACHE_VAR}")
|
||||
CHECK_C_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
|
||||
if(${_CACHE_VAR})
|
||||
# message(STATUS "Using CFLAG: ${_FLAG}")
|
||||
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}" PARENT_SCOPE)
|
||||
@@ -781,7 +791,7 @@ function(ADD_CHECK_CXX_COMPILER_FLAG
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
check_cxx_compiler_flag("${_FLAG}" "${_CACHE_VAR}")
|
||||
CHECK_CXX_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
|
||||
if(${_CACHE_VAR})
|
||||
# message(STATUS "Using CXXFLAG: ${_FLAG}")
|
||||
set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}" PARENT_SCOPE)
|
||||
@@ -799,11 +809,9 @@ function(get_blender_version)
|
||||
# - BLENDER_VERSION_PATCH
|
||||
# - BLENDER_VERSION_CYCLE (alpha, beta, rc, release)
|
||||
|
||||
# So CMAKE depends on `BKE_blender.h`, beware of infinite-loops!
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h
|
||||
${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender_version.h.done
|
||||
)
|
||||
# So cmake depends on BKE_blender.h, beware of inf-loops!
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h
|
||||
${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender_version.h.done)
|
||||
|
||||
file(STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h _contents REGEX "^#define[ \t]+BLENDER_.*$")
|
||||
|
||||
@@ -1190,6 +1198,8 @@ macro(openmp_delayload
|
||||
if(WITH_OPENMP)
|
||||
if(MSVC_CLANG)
|
||||
set(OPENMP_DLL_NAME "libomp")
|
||||
elseif(MSVC_VERSION EQUAL 1800)
|
||||
set(OPENMP_DLL_NAME "vcomp120")
|
||||
else()
|
||||
set(OPENMP_DLL_NAME "vcomp140")
|
||||
endif()
|
||||
|
@@ -17,9 +17,9 @@ set(CPACK_PACKAGE_VENDOR ${PROJECT_VENDOR})
|
||||
set(CPACK_PACKAGE_CONTACT ${PROJECT_CONTACT})
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}")
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}")
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}")
|
||||
|
||||
|
||||
# Get the build revision, note that this can get out-of-sync, so for packaging run cmake first.
|
||||
@@ -48,7 +48,7 @@ if(MSVC)
|
||||
else()
|
||||
set(PACKAGE_ARCH windows32)
|
||||
endif()
|
||||
else()
|
||||
else(MSVC)
|
||||
set(PACKAGE_ARCH ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
|
@@ -30,12 +30,16 @@ macro(add_bundled_libraries library)
|
||||
list(APPEND PLATFORM_BUNDLED_LIBRARY_DIRS ${_library_dir})
|
||||
unset(_all_library_versions)
|
||||
unset(_library_dir)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
# Find system provided libraries.
|
||||
|
||||
# Avoid searching for headers since this would otherwise override our lib
|
||||
# directory as well as PYTHON_ROOT_DIR.
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
|
||||
# Find system ZLIB, not the pre-compiled one supplied with OpenCollada.
|
||||
set(ZLIB_ROOT /usr)
|
||||
find_package(ZLIB REQUIRED)
|
||||
@@ -75,10 +79,6 @@ if(NOT EXISTS "${LIBDIR}/")
|
||||
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
|
||||
endif()
|
||||
|
||||
# Avoid searching for headers since this would otherwise override our lib
|
||||
# directory as well as PYTHON_ROOT_DIR.
|
||||
set(CMAKE_FIND_FRAMEWORK NEVER)
|
||||
|
||||
# Optionally use system Python if PYTHON_ROOT_DIR is specified.
|
||||
if(WITH_PYTHON AND (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
|
||||
find_package(PythonLibsUnix REQUIRED)
|
||||
@@ -324,7 +324,7 @@ if(WITH_LLVM)
|
||||
if(WITH_CLANG)
|
||||
find_package(Clang)
|
||||
if(NOT CLANG_FOUND)
|
||||
message(FATAL_ERROR "Clang not found.")
|
||||
message(FATAL_ERROR "Clang not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -352,6 +352,10 @@ endif()
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_EMBREE)
|
||||
find_package(Embree 3.8.0 REQUIRED)
|
||||
# Increase stack size for Embree, only works for executables.
|
||||
if(NOT WITH_PYTHON_MODULE)
|
||||
string(APPEND PLATFORM_LINKFLAGS " -Wl,-stack_size,0x100000")
|
||||
endif()
|
||||
|
||||
# Embree static library linking can mix up SSE and AVX symbols, causing
|
||||
# crashes on macOS systems with older CPUs that don't have AVX. Using
|
||||
@@ -429,18 +433,6 @@ if(WITH_HARU)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_PATH_GUIDING)
|
||||
find_package(openpgl QUIET)
|
||||
if(openpgl_FOUND)
|
||||
get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION)
|
||||
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
|
||||
message(STATUS "Found OpenPGL: ${OPENPGL_LIBRARIES}")
|
||||
else()
|
||||
set(WITH_CYCLES_PATH_GUIDING OFF)
|
||||
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(ZSTD_ROOT_DIR ${LIBDIR}/zstd)
|
||||
find_package(Zstd REQUIRED)
|
||||
|
||||
@@ -483,9 +475,6 @@ string(APPEND PLATFORM_LINKFLAGS
|
||||
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++")
|
||||
string(APPEND PLATFORM_LINKFLAGS " -stdlib=libc++")
|
||||
|
||||
# Make stack size more similar to Embree, required for Embree.
|
||||
string(APPEND PLATFORM_LINKFLAGS_EXECUTABLE " -Wl,-stack_size,0x100000")
|
||||
|
||||
# Suppress ranlib "has no symbols" warnings (workaround for T48250)
|
||||
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
|
@@ -26,6 +26,11 @@ if(NOT DEFINED LIBDIR)
|
||||
else()
|
||||
set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC AND
|
||||
CMAKE_C_COMPILER_VERSION VERSION_LESS 9.3)
|
||||
message(FATAL_ERROR "GCC version must be at least 9.3 for precompiled libraries, found ${CMAKE_C_COMPILER_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Avoid namespace pollustion.
|
||||
@@ -89,7 +94,7 @@ macro(add_bundled_libraries library)
|
||||
file(GLOB _all_library_versions ${LIBDIR}/${library}/lib/*\.so*)
|
||||
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_all_library_versions})
|
||||
unset(_all_library_versions)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -329,24 +334,16 @@ if(WITH_CYCLES AND WITH_CYCLES_OSL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
|
||||
if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
set(CYCLES_LEVEL_ZERO ${LIBDIR}/level-zero CACHE PATH "Path to Level Zero installation")
|
||||
if(EXISTS ${CYCLES_LEVEL_ZERO} AND NOT LEVEL_ZERO_ROOT_DIR)
|
||||
set(LEVEL_ZERO_ROOT_DIR ${CYCLES_LEVEL_ZERO})
|
||||
endif()
|
||||
|
||||
set(CYCLES_SYCL ${LIBDIR}/dpcpp CACHE PATH "Path to oneAPI DPC++ compiler")
|
||||
set(CYCLES_SYCL ${LIBDIR}/dpcpp CACHE PATH "Path to DPC++ and SYCL installation")
|
||||
if(EXISTS ${CYCLES_SYCL} AND NOT SYCL_ROOT_DIR)
|
||||
set(SYCL_ROOT_DIR ${CYCLES_SYCL})
|
||||
endif()
|
||||
file(GLOB _sycl_runtime_libraries
|
||||
${SYCL_ROOT_DIR}/lib/libsycl.so
|
||||
${SYCL_ROOT_DIR}/lib/libsycl.so.[0-9]
|
||||
${SYCL_ROOT_DIR}/lib/libsycl.so.[0-9].[0-9].[0-9]-[0-9]
|
||||
${SYCL_ROOT_DIR}/lib/libpi_level_zero.so
|
||||
)
|
||||
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries})
|
||||
unset(_sycl_runtime_libraries)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENVDB)
|
||||
@@ -592,18 +589,6 @@ if(WITH_HARU)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_PATH_GUIDING)
|
||||
find_package_wrapper(openpgl)
|
||||
if(openpgl_FOUND)
|
||||
get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION)
|
||||
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
|
||||
message(STATUS "Found OpenPGL: ${OPENPGL_LIBRARIES}")
|
||||
else()
|
||||
set(WITH_CYCLES_PATH_GUIDING OFF)
|
||||
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EXISTS ${LIBDIR})
|
||||
without_system_libs_end()
|
||||
endif()
|
||||
@@ -699,23 +684,14 @@ endif()
|
||||
|
||||
if(WITH_GHOST_WAYLAND)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(wayland-client wayland-client>=1.12)
|
||||
pkg_check_modules(wayland-egl wayland-egl)
|
||||
pkg_check_modules(wayland-scanner wayland-scanner)
|
||||
pkg_check_modules(xkbcommon xkbcommon)
|
||||
pkg_check_modules(wayland-cursor wayland-cursor)
|
||||
pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
|
||||
|
||||
# When dynamically linked WAYLAND is used and `${LIBDIR}/wayland` is present,
|
||||
# there is no need to search for the libraries as they are not needed for building.
|
||||
# Only the headers are needed which can reference the known paths.
|
||||
if(EXISTS "${LIBDIR}/wayland" AND WITH_GHOST_WAYLAND_DYNLOAD)
|
||||
set(_use_system_wayland OFF)
|
||||
else()
|
||||
set(_use_system_wayland ON)
|
||||
endif()
|
||||
|
||||
if(_use_system_wayland)
|
||||
pkg_check_modules(wayland-client wayland-client>=1.12)
|
||||
pkg_check_modules(wayland-egl wayland-egl)
|
||||
pkg_check_modules(wayland-scanner wayland-scanner)
|
||||
pkg_check_modules(wayland-cursor wayland-cursor)
|
||||
pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
|
||||
if(${wayland-protocols_FOUND})
|
||||
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
|
||||
else()
|
||||
# CentOS 7 packages have too old a version, a newer version exist in the
|
||||
@@ -729,38 +705,29 @@ if(WITH_GHOST_WAYLAND)
|
||||
if(EXISTS ${WAYLAND_PROTOCOLS_DIR})
|
||||
set(wayland-protocols_FOUND ON)
|
||||
endif()
|
||||
|
||||
set(wayland-client_INCLUDE_DIRS "${LIBDIR}/wayland/include")
|
||||
set(wayland-egl_INCLUDE_DIRS "${LIBDIR}/wayland/include")
|
||||
set(wayland-cursor_INCLUDE_DIRS "${LIBDIR}/wayland/include")
|
||||
|
||||
set(wayland-client_FOUND ON)
|
||||
set(wayland-egl_FOUND ON)
|
||||
set(wayland-scanner_FOUND ON)
|
||||
set(wayland-cursor_FOUND ON)
|
||||
endif()
|
||||
|
||||
if (NOT wayland-client_FOUND)
|
||||
if (NOT ${wayland-client_FOUND})
|
||||
message(STATUS "wayland-client not found, disabling WITH_GHOST_WAYLAND")
|
||||
set(WITH_GHOST_WAYLAND OFF)
|
||||
endif()
|
||||
if (NOT wayland-egl_FOUND)
|
||||
if (NOT ${wayland-egl_FOUND})
|
||||
message(STATUS "wayland-egl not found, disabling WITH_GHOST_WAYLAND")
|
||||
set(WITH_GHOST_WAYLAND OFF)
|
||||
endif()
|
||||
if (NOT wayland-scanner_FOUND)
|
||||
if (NOT ${wayland-scanner_FOUND})
|
||||
message(STATUS "wayland-scanner not found, disabling WITH_GHOST_WAYLAND")
|
||||
set(WITH_GHOST_WAYLAND OFF)
|
||||
endif()
|
||||
if (NOT wayland-cursor_FOUND)
|
||||
if (NOT ${wayland-cursor_FOUND})
|
||||
message(STATUS "wayland-cursor not found, disabling WITH_GHOST_WAYLAND")
|
||||
set(WITH_GHOST_WAYLAND OFF)
|
||||
endif()
|
||||
if (NOT wayland-protocols_FOUND)
|
||||
if (NOT ${wayland-protocols_FOUND})
|
||||
message(STATUS "wayland-protocols not found, disabling WITH_GHOST_WAYLAND")
|
||||
set(WITH_GHOST_WAYLAND OFF)
|
||||
endif()
|
||||
if (NOT xkbcommon_FOUND)
|
||||
if (NOT ${xkbcommon_FOUND})
|
||||
message(STATUS "xkbcommon not found, disabling WITH_GHOST_WAYLAND")
|
||||
set(WITH_GHOST_WAYLAND OFF)
|
||||
endif()
|
||||
@@ -771,62 +738,39 @@ if(WITH_GHOST_WAYLAND)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||
if(_use_system_wayland)
|
||||
pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1)
|
||||
else()
|
||||
set(libdecor_INCLUDE_DIRS "${LIBDIR}/wayland_libdecor/include/libdecor-0")
|
||||
endif()
|
||||
pkg_check_modules(libdecor REQUIRED libdecor-0>=0.1)
|
||||
endif()
|
||||
|
||||
list(APPEND PLATFORM_LINKLIBS
|
||||
${xkbcommon_LINK_LIBRARIES}
|
||||
)
|
||||
|
||||
if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
|
||||
list(APPEND PLATFORM_LINKLIBS
|
||||
${wayland-client_LINK_LIBRARIES}
|
||||
${wayland-egl_LINK_LIBRARIES}
|
||||
${wayland-cursor_LINK_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_WAYLAND_DBUS)
|
||||
list(APPEND PLATFORM_LINKLIBS
|
||||
${dbus_LINK_LIBRARIES}
|
||||
)
|
||||
add_definitions(-DWITH_GHOST_WAYLAND_DBUS)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_WAYLAND_LIBDECOR)
|
||||
if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
|
||||
list(APPEND PLATFORM_LINKLIBS
|
||||
${libdecor_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${LIBDIR}/wayland/bin/wayland-scanner")
|
||||
set(WAYLAND_SCANNER "${LIBDIR}/wayland/bin/wayland-scanner")
|
||||
else()
|
||||
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
|
||||
endif()
|
||||
|
||||
# When using dynamic loading, headers generated
|
||||
# from older versions of `wayland-scanner` aren't compatible.
|
||||
if(WITH_GHOST_WAYLAND_DYNLOAD)
|
||||
execute_process(
|
||||
COMMAND ${WAYLAND_SCANNER} --version
|
||||
# The version is written to the `stderr`.
|
||||
ERROR_VARIABLE _wayland_scanner_out
|
||||
ERROR_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT "${_wayland_scanner_out}" STREQUAL "")
|
||||
string(
|
||||
REGEX REPLACE
|
||||
"^wayland-scanner[ \t]+([0-9]+)\.([0-9]+).*"
|
||||
"\\1.\\2"
|
||||
_wayland_scanner_ver
|
||||
"${_wayland_scanner_out}"
|
||||
)
|
||||
if("${_wayland_scanner_ver}" VERSION_LESS "1.20")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Found ${WAYLAND_SCANNER} version \"${_wayland_scanner_ver}\", "
|
||||
"the minimum version is 1.20!"
|
||||
)
|
||||
endif()
|
||||
unset(_wayland_scanner_ver)
|
||||
else()
|
||||
message(WARNING "Unable to access the version from ${WAYLAND_SCANNER}, continuing.")
|
||||
endif()
|
||||
unset(_wayland_scanner_out)
|
||||
endif()
|
||||
# End wayland-scanner version check.
|
||||
|
||||
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
|
||||
endif()
|
||||
|
||||
unset(_use_system_wayland)
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_X11)
|
||||
@@ -835,8 +779,12 @@ if(WITH_GHOST_X11)
|
||||
find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
|
||||
mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
|
||||
|
||||
list(APPEND PLATFORM_LINKLIBS ${X11_X11_LIB})
|
||||
|
||||
if(WITH_X11_XINPUT)
|
||||
if(NOT X11_Xinput_LIB)
|
||||
if(X11_Xinput_LIB)
|
||||
list(APPEND PLATFORM_LINKLIBS ${X11_Xinput_LIB})
|
||||
else()
|
||||
message(FATAL_ERROR "LibXi not found. Disable WITH_X11_XINPUT if you
|
||||
want to build without tablet support")
|
||||
endif()
|
||||
@@ -846,14 +794,18 @@ if(WITH_GHOST_X11)
|
||||
# XXX, why doesn't cmake make this available?
|
||||
find_library(X11_Xxf86vmode_LIB Xxf86vm ${X11_LIB_SEARCH_PATH})
|
||||
mark_as_advanced(X11_Xxf86vmode_LIB)
|
||||
if(NOT X11_Xxf86vmode_LIB)
|
||||
if(X11_Xxf86vmode_LIB)
|
||||
list(APPEND PLATFORM_LINKLIBS ${X11_Xxf86vmode_LIB})
|
||||
else()
|
||||
message(FATAL_ERROR "libXxf86vm not found. Disable WITH_X11_XF86VMODE if you
|
||||
want to build without")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_X11_XFIXES)
|
||||
if(NOT X11_Xfixes_LIB)
|
||||
if(X11_Xfixes_LIB)
|
||||
list(APPEND PLATFORM_LINKLIBS ${X11_Xfixes_LIB})
|
||||
else()
|
||||
message(FATAL_ERROR "libXfixes not found. Disable WITH_X11_XFIXES if you
|
||||
want to build without")
|
||||
endif()
|
||||
@@ -862,7 +814,9 @@ if(WITH_GHOST_X11)
|
||||
if(WITH_X11_ALPHA)
|
||||
find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
|
||||
mark_as_advanced(X11_Xrender_LIB)
|
||||
if(NOT X11_Xrender_LIB)
|
||||
if(X11_Xrender_LIB)
|
||||
list(APPEND PLATFORM_LINKLIBS ${X11_Xrender_LIB})
|
||||
else()
|
||||
message(FATAL_ERROR "libXrender not found. Disable WITH_X11_ALPHA if you
|
||||
want to build without")
|
||||
endif()
|
||||
@@ -1102,7 +1056,7 @@ function(CONFIGURE_ATOMIC_LIB_IF_NEEDED)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
configure_atomic_lib_if_needed()
|
||||
CONFIGURE_ATOMIC_LIB_IF_NEEDED()
|
||||
|
||||
if(PLATFORM_BUNDLED_LIBRARIES)
|
||||
# For the installed Python module and installed Blender executable, we set the
|
||||
|
@@ -26,7 +26,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(OPENMP_FOUND ON)
|
||||
set(OpenMP_C_FLAGS "/clang:-fopenmp")
|
||||
set(OpenMP_CXX_FLAGS "/clang:-fopenmp")
|
||||
get_filename_component(LLVMROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\LLVM\\LLVM;]" ABSOLUTE CACHE)
|
||||
GET_FILENAME_COMPONENT(LLVMROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\LLVM\\LLVM;]" ABSOLUTE CACHE)
|
||||
set(CLANG_OPENMP_DLL "${LLVMROOT}/bin/libomp.dll")
|
||||
set(CLANG_OPENMP_LIB "${LLVMROOT}/lib/libomp.lib")
|
||||
if(NOT EXISTS "${CLANG_OPENMP_DLL}")
|
||||
@@ -74,6 +74,27 @@ add_definitions(-DWIN32)
|
||||
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
|
||||
# Minimum MSVC Version
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
if(MSVC_VERSION EQUAL 1800)
|
||||
set(_min_ver "18.0.31101")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver})
|
||||
message(FATAL_ERROR
|
||||
"Visual Studio 2013 (Update 4, ${_min_ver}) required, "
|
||||
"found (${CMAKE_CXX_COMPILER_VERSION})")
|
||||
endif()
|
||||
endif()
|
||||
if(MSVC_VERSION EQUAL 1900)
|
||||
set(_min_ver "19.0.24210")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${_min_ver})
|
||||
message(FATAL_ERROR
|
||||
"Visual Studio 2015 (Update 3, ${_min_ver}) required, "
|
||||
"found (${CMAKE_CXX_COMPILER_VERSION})")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
unset(_min_ver)
|
||||
|
||||
# needed for some MSVC installations
|
||||
# 4099 : PDB 'filename' was not found with 'object/library'
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099")
|
||||
@@ -137,7 +158,7 @@ endif()
|
||||
|
||||
|
||||
# C++ standards conformace (/permissive-) is available on msvc 15.5 (1912) and up
|
||||
if(NOT MSVC_CLANG)
|
||||
if(MSVC_VERSION GREATER 1911 AND NOT MSVC_CLANG)
|
||||
string(APPEND CMAKE_CXX_FLAGS " /permissive-")
|
||||
# Two-phase name lookup does not place nicely with OpenMP yet, so disable for now
|
||||
string(APPEND CMAKE_CXX_FLAGS " /Zc:twoPhase-")
|
||||
@@ -197,7 +218,7 @@ unset(SYMBOL_FORMAT)
|
||||
unset(SYMBOL_FORMAT_RELEASE)
|
||||
|
||||
# JMC is available on msvc 15.8 (1915) and up
|
||||
if(NOT MSVC_CLANG)
|
||||
if(MSVC_VERSION GREATER 1914 AND NOT MSVC_CLANG)
|
||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /JMC")
|
||||
endif()
|
||||
|
||||
@@ -230,6 +251,9 @@ if(NOT DEFINED LIBDIR)
|
||||
elseif(MSVC_VERSION GREATER 1919)
|
||||
message(STATUS "Visual Studio 2019 detected.")
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
|
||||
elseif(MSVC_VERSION GREATER 1909)
|
||||
message(STATUS "Visual Studio 2017 detected.")
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
|
||||
@@ -240,8 +264,10 @@ endif()
|
||||
|
||||
include(platform_old_libs_update)
|
||||
|
||||
# Only supported in the VS IDE & Clang Tidy needs to be on.
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND WITH_CLANG_TIDY)
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual Studio.+" AND # Only supported in the VS IDE
|
||||
MSVC_VERSION GREATER_EQUAL 1924 AND # Supported for 16.4+
|
||||
WITH_CLANG_TIDY # And Clang Tidy needs to be on
|
||||
)
|
||||
set(CMAKE_VS_GLOBALS
|
||||
"RunCodeAnalysis=false"
|
||||
"EnableMicrosoftCodeAnalysis=false"
|
||||
@@ -252,7 +278,8 @@ endif()
|
||||
|
||||
# Mark libdir as system headers with a lower warn level, to resolve some warnings
|
||||
# that we have very little control over
|
||||
if(NOT MSVC_CLANG AND # Available with MSVC 15.7+ but not for CLANG.
|
||||
if(MSVC_VERSION GREATER_EQUAL 1914 AND # Available with 15.7+
|
||||
NOT MSVC_CLANG AND # But not for clang
|
||||
NOT WITH_WINDOWS_SCCACHE AND # And not when sccache is enabled
|
||||
NOT VS_CLANG_TIDY) # Clang-tidy does not like these options
|
||||
add_compile_options(/experimental:external /external:templates- /external:I "${LIBDIR}" /external:W0)
|
||||
@@ -740,7 +767,7 @@ if(WITH_TBB)
|
||||
endif()
|
||||
|
||||
# used in many places so include globally, like OpenGL
|
||||
include_directories(SYSTEM "${PTHREADS_INCLUDE_DIRS}")
|
||||
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
|
||||
|
||||
set(WINTAB_INC ${LIBDIR}/wintab/include)
|
||||
|
||||
@@ -847,8 +874,8 @@ endif()
|
||||
|
||||
if(WINDOWS_PYTHON_DEBUG)
|
||||
# Include the system scripts in the blender_python_system_scripts project.
|
||||
file(GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/release/scripts/*.*" )
|
||||
add_custom_target(blender_python_system_scripts SOURCES ${inFiles})
|
||||
FILE(GLOB_RECURSE inFiles "${CMAKE_SOURCE_DIR}/release/scripts/*.*" )
|
||||
ADD_CUSTOM_TARGET(blender_python_system_scripts SOURCES ${inFiles})
|
||||
foreach(_source IN ITEMS ${inFiles})
|
||||
get_filename_component(_source_path "${_source}" PATH)
|
||||
string(REPLACE "${CMAKE_SOURCE_DIR}/release/scripts/" "" _source_path "${_source_path}")
|
||||
@@ -868,8 +895,8 @@ if(WINDOWS_PYTHON_DEBUG)
|
||||
endif()
|
||||
|
||||
file(TO_CMAKE_PATH ${USER_SCRIPTS_ROOT} USER_SCRIPTS_ROOT)
|
||||
file(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/*.*" )
|
||||
add_custom_target(blender_python_user_scripts SOURCES ${inFiles})
|
||||
FILE(GLOB_RECURSE inFiles "${USER_SCRIPTS_ROOT}/*.*" )
|
||||
ADD_CUSTOM_TARGET(blender_python_user_scripts SOURCES ${inFiles})
|
||||
foreach(_source IN ITEMS ${inFiles})
|
||||
get_filename_component(_source_path "${_source}" PATH)
|
||||
string(REPLACE "${USER_SCRIPTS_ROOT}" "" _source_path "${_source_path}")
|
||||
@@ -936,39 +963,8 @@ if(WITH_HARU)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_PATH_GUIDING)
|
||||
find_package(openpgl QUIET)
|
||||
if(openpgl_FOUND)
|
||||
get_target_property(OPENPGL_LIBRARIES_RELEASE openpgl::openpgl LOCATION_RELEASE)
|
||||
get_target_property(OPENPGL_LIBRARIES_DEBUG openpgl::openpgl LOCATION_DEBUG)
|
||||
set(OPENPGL_LIBRARIES optimized ${OPENPGL_LIBRARIES_RELEASE} debug ${OPENPGL_LIBRARIES_DEBUG})
|
||||
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
|
||||
else()
|
||||
set(WITH_CYCLES_PATH_GUIDING OFF)
|
||||
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(ZSTD_INCLUDE_DIRS ${LIBDIR}/zstd/include)
|
||||
set(ZSTD_LIBRARIES ${LIBDIR}/zstd/lib/zstd_static.lib)
|
||||
|
||||
if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
|
||||
set(LEVEL_ZERO_ROOT_DIR ${LIBDIR}/level_zero)
|
||||
set(CYCLES_SYCL ${LIBDIR}/dpcpp CACHE PATH "Path to oneAPI DPC++ compiler")
|
||||
if(EXISTS ${CYCLES_SYCL} AND NOT SYCL_ROOT_DIR)
|
||||
set(SYCL_ROOT_DIR ${CYCLES_SYCL})
|
||||
endif()
|
||||
file(GLOB _sycl_runtime_libraries_glob
|
||||
${SYCL_ROOT_DIR}/bin/sycl.dll
|
||||
${SYCL_ROOT_DIR}/bin/sycl[0-9].dll
|
||||
)
|
||||
foreach(sycl_runtime_library IN LISTS _sycl_runtime_libraries_glob)
|
||||
string(REPLACE ".dll" "$<$<CONFIG:Debug>:d>.dll" sycl_runtime_library ${sycl_runtime_library})
|
||||
list(APPEND _sycl_runtime_libraries ${sycl_runtime_library})
|
||||
endforeach()
|
||||
unset(_sycl_runtime_libraries_glob)
|
||||
|
||||
list(APPEND _sycl_runtime_libraries ${SYCL_ROOT_DIR}/bin/pi_level_zero.dll)
|
||||
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries})
|
||||
unset(_sycl_runtime_libraries)
|
||||
endif()
|
||||
set(LEVEL_ZERO_ROOT_DIR ${LIBDIR}/level_zero)
|
||||
set(SYCL_ROOT_DIR ${LIBDIR}/dpcpp)
|
||||
|
@@ -134,6 +134,7 @@ batch = batch_for_shader(shader, 'LINES', {"pos": coords})
|
||||
|
||||
|
||||
def draw():
|
||||
shader.bind()
|
||||
shader.uniform_float("color", (1, 1, 0, 1))
|
||||
batch.draw(shader)
|
||||
|
||||
|
@@ -58,6 +58,7 @@ batch = batch_for_shader(
|
||||
|
||||
|
||||
def draw():
|
||||
shader.bind()
|
||||
matrix = bpy.context.region_data.perspective_matrix
|
||||
shader.uniform_float("u_ViewProjectionMatrix", matrix)
|
||||
shader.uniform_float("u_Scale", 10)
|
||||
|
@@ -41,6 +41,7 @@ batch = batch_for_shader(shader, 'TRIS', {"position": coords})
|
||||
|
||||
|
||||
def draw():
|
||||
shader.bind()
|
||||
matrix = bpy.context.region_data.perspective_matrix
|
||||
shader.uniform_float("viewProjectionMatrix", matrix)
|
||||
shader.uniform_float("brightness", 0.5)
|
||||
|
@@ -22,6 +22,7 @@ batch = batch_for_shader(shader, 'LINES', {"pos": coords}, indices=indices)
|
||||
|
||||
|
||||
def draw():
|
||||
shader.bind()
|
||||
shader.uniform_float("color", (1, 0, 0, 1))
|
||||
batch.draw(shader)
|
||||
|
||||
|
@@ -18,6 +18,7 @@ batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)
|
||||
|
||||
|
||||
def draw():
|
||||
shader.bind()
|
||||
shader.uniform_float("color", (0, 0.5, 0.5, 1.0))
|
||||
batch.draw(shader)
|
||||
|
||||
|
@@ -56,6 +56,7 @@ batch = batch_for_shader(
|
||||
|
||||
|
||||
def draw():
|
||||
shader.bind()
|
||||
shader.uniform_sampler("image", texture)
|
||||
batch.draw(shader)
|
||||
|
||||
|
@@ -76,6 +76,7 @@ batch = batch_for_shader(
|
||||
|
||||
|
||||
def draw():
|
||||
shader.bind()
|
||||
shader.uniform_float("modelMatrix", Matrix.Translation((1, 2, 3)) @ Matrix.Scale(3, 4))
|
||||
shader.uniform_float("viewProjectionMatrix", bpy.context.region_data.perspective_matrix)
|
||||
shader.uniform_sampler("image", offscreen.texture_color)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
sphinx==5.2.3
|
||||
sphinx==5.1.1
|
||||
|
||||
# Sphinx dependencies that are important
|
||||
Jinja2==3.1.2
|
||||
@@ -6,7 +6,7 @@ Pygments==2.13.0
|
||||
docutils==0.17.1
|
||||
snowballstemmer==2.2.0
|
||||
babel==2.10.3
|
||||
requests==2.28.1
|
||||
requests==2.27.1
|
||||
|
||||
# Only needed to match the theme used for the official documentation.
|
||||
# Without this theme, the default theme will be used.
|
||||
|
@@ -78,10 +78,9 @@ Signal Handlers
|
||||
to cancel a render and a crash log is not written in the event of a crash.
|
||||
|
||||
Startup and Preferences
|
||||
When the ``bpy`` module loads it contains the default startup scene
|
||||
(instead of an "empty" blend-file as you might expect), so there is a default cube, camera and light.
|
||||
|
||||
If you wish to start from an empty file use: ``bpy.ops.wm.read_factory_settings(use_empty=True)``.
|
||||
When the ``bpy`` module loads, the file is not empty as you might expect,
|
||||
there is a default cube, camera and light. If you wish to start from a blank file use:
|
||||
``bpy.ops.wm.read_factory_settings(use_empty=True)``.
|
||||
|
||||
The users startup and preferences are ignored to prevent your local configuration from impacting scripts behavior.
|
||||
The Python module behaves as if ``--factory-startup`` was passed as a command line argument.
|
||||
@@ -102,10 +101,9 @@ Limitations
|
||||
Most constraints of Blender as an application still apply:
|
||||
|
||||
Reloading Unsupported
|
||||
Reloading the ``bpy`` module via ``importlib.reload`` will raise an exception
|
||||
instead of reloading and resetting the module.
|
||||
Reloading via ``importlib.reload`` will raise an exception instead of reloading and resetting the module.
|
||||
|
||||
Instead, the operator ``bpy.ops.wm.read_factory_settings()`` can be used to reset the internal state.
|
||||
The operator ``bpy.ops.wm.read_factory_settings()`` can be used to reset the internal state.
|
||||
|
||||
Single Blend File Restriction
|
||||
Only a single ``.blend`` file can be edited at a time.
|
||||
|
4
extern/gflags/CMakeLists.txt
vendored
4
extern/gflags/CMakeLists.txt
vendored
@@ -3,7 +3,9 @@
|
||||
|
||||
# Too noisy for code we don't maintain.
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
add_cxx_flag("-Wno-cast-function-type")
|
||||
if(NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "8.0")
|
||||
add_cxx_flag("-Wno-cast-function-type")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(INC
|
||||
|
@@ -106,7 +106,8 @@
|
||||
/* Copied from BLI_utils... */
|
||||
/* C++ can't use _Static_assert, expects static_assert() but c++0x only,
|
||||
* Coverity also errors out. */
|
||||
#if (!defined(__cplusplus)) && (!defined(__COVERITY__)) && (defined(__GNUC__)) /* GCC only. */
|
||||
#if (!defined(__cplusplus)) && (!defined(__COVERITY__)) && \
|
||||
(defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 406)) /* gcc4.6+ only */
|
||||
# define ATOMIC_STATIC_ASSERT(a, msg) __extension__ _Static_assert(a, msg);
|
||||
#else
|
||||
/* Code adapted from http://www.pixelbeat.org/programming/gcc/static_assert.html */
|
||||
|
@@ -6,8 +6,12 @@
|
||||
#include "testing/testing.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic error "-Wsign-compare"
|
||||
# pragma GCC diagnostic error "-Wsign-conversion"
|
||||
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 /* gcc4.6+ only */
|
||||
# pragma GCC diagnostic error "-Wsign-compare"
|
||||
# endif
|
||||
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408
|
||||
# pragma GCC diagnostic error "-Wsign-conversion"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@@ -36,7 +36,7 @@ if(WITH_CYCLES_NATIVE_ONLY)
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
add_check_cxx_compiler_flag(CMAKE_CXX_FLAGS _has_march_native "-march=native")
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_march_native "-march=native")
|
||||
if(_has_march_native)
|
||||
set(CYCLES_KERNEL_FLAGS "-march=native")
|
||||
else()
|
||||
@@ -45,18 +45,18 @@ if(WITH_CYCLES_NATIVE_ONLY)
|
||||
unset(_has_march_native)
|
||||
else()
|
||||
if(NOT MSVC_NATIVE_ARCH_FLAGS)
|
||||
try_run(
|
||||
arch_run_result
|
||||
arch_compile_result
|
||||
${CMAKE_CURRENT_BINARY_DIR}/
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/msvc_arch_flags.c
|
||||
COMPILE_OUTPUT_VARIABLE arch_compile_output
|
||||
RUN_OUTPUT_VARIABLE arch_run_output
|
||||
)
|
||||
if(arch_compile_result AND "${arch_run_result}" EQUAL "0")
|
||||
string(STRIP ${arch_run_output} arch_run_output)
|
||||
set(MSVC_NATIVE_ARCH_FLAGS ${arch_run_output} CACHE STRING "MSVC Native architecture flags")
|
||||
endif()
|
||||
TRY_RUN(
|
||||
arch_run_result
|
||||
arch_compile_result
|
||||
${CMAKE_CURRENT_BINARY_DIR}/
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/msvc_arch_flags.c
|
||||
COMPILE_OUTPUT_VARIABLE arch_compile_output
|
||||
RUN_OUTPUT_VARIABLE arch_run_output
|
||||
)
|
||||
if(arch_compile_result AND "${arch_run_result}" EQUAL "0")
|
||||
string(STRIP ${arch_run_output} arch_run_output)
|
||||
set(MSVC_NATIVE_ARCH_FLAGS ${arch_run_output} CACHE STRING "MSVC Native architecture flags")
|
||||
endif()
|
||||
endif()
|
||||
set(CYCLES_KERNEL_FLAGS "${MSVC_NATIVE_ARCH_FLAGS}")
|
||||
endif()
|
||||
@@ -347,24 +347,6 @@ if(WITH_OPENCOLORIO)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES_PATH_GUIDING)
|
||||
add_definitions(-DWITH_PATH_GUIDING)
|
||||
|
||||
# The level of the guiding integration.
|
||||
# Different levels can be selected to measure the overhead of different stages.
|
||||
# 1 = recording the path segments
|
||||
# 2 = 1 + generating (not storing) sample data from the segments
|
||||
# 3 = 2 + storing the generates sample data
|
||||
# 4 = 3 + training the guiding fields
|
||||
# 5 = 4 + querying the trained guiding for sampling (full path guiding)
|
||||
add_definitions(-DPATH_GUIDING_LEVEL=5)
|
||||
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${OPENPGL_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
# NaN debugging
|
||||
if(WITH_CYCLES_DEBUG_NAN)
|
||||
add_definitions(-DWITH_CYCLES_DEBUG_NAN)
|
||||
@@ -382,7 +364,7 @@ endif()
|
||||
|
||||
# Warnings
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
add_check_cxx_compiler_flag(CMAKE_CXX_FLAGS _has_no_error_unused_macros "-Wno-error=unused-macros")
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_no_error_unused_macros "-Wno-error=unused-macros")
|
||||
unset(_has_no_error_unused_macros)
|
||||
endif()
|
||||
|
||||
|
@@ -7,7 +7,6 @@ set(INC
|
||||
../../mikktspace
|
||||
../../../source/blender/makesdna
|
||||
../../../source/blender/makesrna
|
||||
../../../source/blender/blenkernel
|
||||
../../../source/blender/blenlib
|
||||
../../../source/blender/gpu
|
||||
../../../source/blender/render
|
||||
|
@@ -13,7 +13,7 @@ def _configure_argument_parser():
|
||||
action='store_true')
|
||||
parser.add_argument("--cycles-device",
|
||||
help="Set the device to use for Cycles, overriding user preferences and the scene setting."
|
||||
"Valid options are 'CPU', 'CUDA', 'OPTIX', 'HIP', 'ONEAPI', or 'METAL'."
|
||||
"Valid options are 'CPU', 'CUDA', 'OPTIX', 'HIP' or 'METAL'."
|
||||
"Additionally, you can append '+CPU' to any GPU type for hybrid rendering.",
|
||||
default=None)
|
||||
return parser
|
||||
@@ -156,11 +156,6 @@ def with_osl():
|
||||
return _cycles.with_osl
|
||||
|
||||
|
||||
def with_path_guiding():
|
||||
import _cycles
|
||||
return _cycles.with_path_guiding
|
||||
|
||||
|
||||
def system_info():
|
||||
import _cycles
|
||||
return _cycles.system_info()
|
||||
|
@@ -179,12 +179,6 @@ enum_view3d_shading_render_pass = (
|
||||
('SAMPLE_COUNT', "Sample Count", "Per-pixel number of samples"),
|
||||
)
|
||||
|
||||
enum_guiding_distribution = (
|
||||
('PARALLAX_AWARE_VMM', "Parallax-Aware VMM", "Use Parallax-aware von Mises-Fisher models as directional distribution", 0),
|
||||
('DIRECTIONAL_QUAD_TREE', "Directional Quad Tree", "Use Directional Quad Trees as directional distribution", 1),
|
||||
('VMM', "VMM", "Use von Mises-Fisher models as directional distribution", 2),
|
||||
)
|
||||
|
||||
|
||||
def enum_openimagedenoise_denoiser(self, context):
|
||||
import _cycles
|
||||
@@ -364,9 +358,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
preview_samples: IntProperty(
|
||||
name="Viewport Samples",
|
||||
description="Number of samples to render in the viewport, unlimited if 0",
|
||||
min=0,
|
||||
soft_min=1,
|
||||
max=(1 << 24),
|
||||
min=0, max=(1 << 24),
|
||||
default=1024,
|
||||
)
|
||||
|
||||
@@ -515,78 +507,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
default=1.0,
|
||||
)
|
||||
|
||||
use_guiding: BoolProperty(
|
||||
name="Guiding",
|
||||
description="Use path guiding for sampling paths. Path guiding incrementally "
|
||||
"learns the light distribution of the scene and guides path into directions "
|
||||
"with high direct and indirect light contributions",
|
||||
default=False,
|
||||
)
|
||||
|
||||
use_deterministic_guiding: BoolProperty(
|
||||
name="Deterministic",
|
||||
description="Makes path guiding deterministic which means renderings will be "
|
||||
"reproducible with the same pixel values every time. This feature slows down "
|
||||
"training",
|
||||
default=True,
|
||||
)
|
||||
|
||||
guiding_distribution_type: EnumProperty(
|
||||
name="Guiding Distribution Type",
|
||||
description="Type of representation for the guiding distribution",
|
||||
items=enum_guiding_distribution,
|
||||
default='PARALLAX_AWARE_VMM',
|
||||
)
|
||||
|
||||
use_surface_guiding: BoolProperty(
|
||||
name="Surface Guiding",
|
||||
description="Use guiding when sampling directions on a surface",
|
||||
default=True,
|
||||
)
|
||||
|
||||
surface_guiding_probability: FloatProperty(
|
||||
name="Surface Guiding Probability",
|
||||
description="The probability of guiding a direction on a surface",
|
||||
min=0.0, max=1.0,
|
||||
default=0.5,
|
||||
)
|
||||
|
||||
use_volume_guiding: BoolProperty(
|
||||
name="Volume Guiding",
|
||||
description="Use guiding when sampling directions inside a volume",
|
||||
default=True,
|
||||
)
|
||||
|
||||
guiding_training_samples: IntProperty(
|
||||
name="Training Samples",
|
||||
description="The maximum number of samples used for training path guiding. "
|
||||
"Higher samples lead to more accurate guiding, however may also unnecessarily slow "
|
||||
"down rendering once guiding is accurate enough. "
|
||||
"A value of 0 will continue training until the last sample",
|
||||
min=0,
|
||||
soft_min=1,
|
||||
default=128,
|
||||
)
|
||||
|
||||
volume_guiding_probability: FloatProperty(
|
||||
name="Volume Guiding Probability",
|
||||
description="The probability of guiding a direction inside a volume",
|
||||
min=0.0, max=1.0,
|
||||
default=0.5,
|
||||
)
|
||||
|
||||
use_guiding_direct_light: BoolProperty(
|
||||
name="Guide Direct Light",
|
||||
description="Consider the contribution of directly visible light sources during guiding",
|
||||
default=True,
|
||||
)
|
||||
|
||||
use_guiding_mis_weights: BoolProperty(
|
||||
name="Use MIS Weights",
|
||||
description="Use the MIS weight to weight the contribution of directly visible light sources during guiding",
|
||||
default=True,
|
||||
)
|
||||
|
||||
max_bounces: IntProperty(
|
||||
name="Max Bounces",
|
||||
description="Total maximum number of bounces",
|
||||
@@ -1638,9 +1558,9 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
||||
import sys
|
||||
col.label(text="Requires Intel GPU with Xe-HPG architecture", icon='BLANK1')
|
||||
if sys.platform.startswith("win"):
|
||||
col.label(text="and Windows driver version 101.3430 or newer", icon='BLANK1')
|
||||
col.label(text="and Windows driver version 101.3268 or newer", icon='BLANK1')
|
||||
elif sys.platform.startswith("linux"):
|
||||
col.label(text="and Linux driver version xx.xx.23904 or newer", icon='BLANK1')
|
||||
col.label(text="and Linux driver version xx.xx.23570 or newer", icon='BLANK1')
|
||||
elif device_type == 'METAL':
|
||||
col.label(text="Requires Apple Silicon with macOS 12.2 or newer", icon='BLANK1')
|
||||
col.label(text="or AMD with macOS 12.3 or newer", icon='BLANK1')
|
||||
|
@@ -278,63 +278,6 @@ class CYCLES_RENDER_PT_sampling_render_denoise(CyclesButtonsPanel, Panel):
|
||||
col.prop(cscene, "denoising_prefilter", text="Prefilter")
|
||||
|
||||
|
||||
class CYCLES_RENDER_PT_sampling_path_guiding(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Path Guiding"
|
||||
bl_parent_id = "CYCLES_RENDER_PT_sampling"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
from . import engine
|
||||
return use_cpu(context) and engine.with_path_guiding()
|
||||
|
||||
def draw_header(self, context):
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
|
||||
self.layout.prop(cscene, "use_guiding", text="")
|
||||
|
||||
def draw(self, context):
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
layout.active = cscene.use_guiding
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.prop(cscene, "use_surface_guiding")
|
||||
col.prop(cscene, "use_volume_guiding")
|
||||
col.prop(cscene, "guiding_training_samples")
|
||||
|
||||
|
||||
class CYCLES_RENDER_PT_sampling_path_guiding_debug(CyclesDebugButtonsPanel, Panel):
|
||||
bl_label = "Debug"
|
||||
bl_parent_id = "CYCLES_RENDER_PT_sampling_path_guiding"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw(self, context):
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
layout.active = cscene.use_guiding
|
||||
|
||||
layout.prop(cscene, "guiding_distribution_type", text="Distribution Type")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.prop(cscene, "surface_guiding_probability")
|
||||
col.prop(cscene, "volume_guiding_probability")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.prop(cscene, "use_deterministic_guiding")
|
||||
col.prop(cscene, "use_guiding_direct_light")
|
||||
col.prop(cscene, "use_guiding_mis_weights")
|
||||
|
||||
|
||||
class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Advanced"
|
||||
bl_parent_id = "CYCLES_RENDER_PT_sampling"
|
||||
@@ -1880,12 +1823,6 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
|
||||
layout.prop(rd, "use_bake_multires")
|
||||
layout.prop(cscene, "bake_type")
|
||||
|
||||
if not rd.use_bake_multires and cscene.bake_type not in {
|
||||
"AO", "POSITION", "NORMAL", "UV", "ROUGHNESS", "ENVIRONMENT"}:
|
||||
row = layout.row()
|
||||
row.prop(cbk, "view_from")
|
||||
row.active = scene.camera is not None
|
||||
|
||||
|
||||
class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Influence"
|
||||
@@ -2349,8 +2286,6 @@ classes = (
|
||||
CYCLES_RENDER_PT_sampling_viewport_denoise,
|
||||
CYCLES_RENDER_PT_sampling_render,
|
||||
CYCLES_RENDER_PT_sampling_render_denoise,
|
||||
CYCLES_RENDER_PT_sampling_path_guiding,
|
||||
CYCLES_RENDER_PT_sampling_path_guiding_debug,
|
||||
CYCLES_RENDER_PT_sampling_advanced,
|
||||
CYCLES_RENDER_PT_light_paths,
|
||||
CYCLES_RENDER_PT_light_paths_max_bounces,
|
||||
|
@@ -2,7 +2,6 @@
|
||||
* Copyright 2011-2022 Blender Foundation */
|
||||
|
||||
#include "scene/camera.h"
|
||||
#include "scene/bake.h"
|
||||
#include "scene/scene.h"
|
||||
|
||||
#include "blender/sync.h"
|
||||
@@ -593,11 +592,6 @@ void BlenderSync::sync_camera(BL::RenderSettings &b_render,
|
||||
blender_camera_from_object(&bcam, b_engine, b_ob);
|
||||
b_engine.camera_model_matrix(b_ob, bcam.use_spherical_stereo, b_ob_matrix);
|
||||
bcam.matrix = get_transform(b_ob_matrix);
|
||||
scene->bake_manager->set_use_camera(b_render.bake().view_from() ==
|
||||
BL::BakeSettings::view_from_ACTIVE_CAMERA);
|
||||
}
|
||||
else {
|
||||
scene->bake_manager->set_use_camera(false);
|
||||
}
|
||||
|
||||
/* sync */
|
||||
|
@@ -20,7 +20,7 @@ CCL_NAMESPACE_BEGIN
|
||||
* Utility class to map between Blender datablocks and Cycles data structures,
|
||||
* and keep track of recalc tags from the dependency graph. */
|
||||
|
||||
template<typename K, typename T, typename Flags = uint> class id_map {
|
||||
template<typename K, typename T> class id_map {
|
||||
public:
|
||||
id_map(Scene *scene_) : scene(scene_)
|
||||
{
|
||||
@@ -63,11 +63,6 @@ template<typename K, typename T, typename Flags = uint> class id_map {
|
||||
b_recalc.insert(id_ptr);
|
||||
}
|
||||
|
||||
bool check_recalc(const BL::ID &id)
|
||||
{
|
||||
return id.ptr.data && b_recalc.find(id.ptr.data) != b_recalc.end();
|
||||
}
|
||||
|
||||
bool has_recalc()
|
||||
{
|
||||
return !(b_recalc.empty());
|
||||
@@ -159,7 +154,6 @@ template<typename K, typename T, typename Flags = uint> class id_map {
|
||||
TMapPair &pair = *jt;
|
||||
|
||||
if (do_delete && used_set.find(pair.second) == used_set.end()) {
|
||||
flags.erase(pair.second);
|
||||
scene->delete_node(pair.second);
|
||||
}
|
||||
else {
|
||||
@@ -177,33 +171,9 @@ template<typename K, typename T, typename Flags = uint> class id_map {
|
||||
return b_map;
|
||||
}
|
||||
|
||||
bool test_flag(T *data, Flags val)
|
||||
{
|
||||
typename map<T *, uint>::iterator it = flags.find(data);
|
||||
return it != flags.end() && (it->second & (1 << val)) != 0;
|
||||
}
|
||||
|
||||
void set_flag(T *data, Flags val)
|
||||
{
|
||||
flags[data] |= (1 << val);
|
||||
}
|
||||
|
||||
void clear_flag(T *data, Flags val)
|
||||
{
|
||||
typename map<T *, uint>::iterator it = flags.find(data);
|
||||
if (it != flags.end()) {
|
||||
it->second &= ~(1 << val);
|
||||
|
||||
if (it->second == 0) {
|
||||
flags.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
map<K, T *> b_map;
|
||||
set<T *> used_set;
|
||||
map<T *, uint> flags;
|
||||
set<void *> b_recalc;
|
||||
Scene *scene;
|
||||
};
|
||||
|
@@ -1084,23 +1084,23 @@ static void create_subd_mesh(Scene *scene,
|
||||
|
||||
const int edges_num = b_mesh.edges.length();
|
||||
|
||||
if (edges_num != 0 && b_mesh.edge_creases.length() > 0) {
|
||||
if (edges_num != 0) {
|
||||
size_t num_creases = 0;
|
||||
const float *creases = static_cast<float *>(b_mesh.edge_creases[0].ptr.data);
|
||||
const MEdge *edges = static_cast<MEdge *>(b_mesh.edges[0].ptr.data);
|
||||
|
||||
for (int i = 0; i < edges_num; i++) {
|
||||
if (creases[i] != 0.0f) {
|
||||
const MEdge &b_edge = edges[i];
|
||||
if (b_edge.crease != 0) {
|
||||
num_creases++;
|
||||
}
|
||||
}
|
||||
|
||||
mesh->reserve_subd_creases(num_creases);
|
||||
|
||||
const MEdge *edges = static_cast<MEdge *>(b_mesh.edges[0].ptr.data);
|
||||
for (int i = 0; i < edges_num; i++) {
|
||||
if (creases[i] != 0.0f) {
|
||||
const MEdge &b_edge = edges[i];
|
||||
mesh->add_edge_crease(b_edge.v1, b_edge.v2, creases[i]);
|
||||
const MEdge &b_edge = edges[i];
|
||||
if (b_edge.crease != 0) {
|
||||
mesh->add_edge_crease(b_edge.v1, b_edge.v2, float(b_edge.crease) / 255.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -23,8 +23,6 @@
|
||||
#include "util/log.h"
|
||||
#include "util/task.h"
|
||||
|
||||
#include "BKE_duplilist.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Utilities */
|
||||
@@ -96,13 +94,6 @@ bool BlenderSync::object_is_light(BL::Object &b_ob)
|
||||
return (b_ob_data && b_ob_data.is_a(&RNA_Light));
|
||||
}
|
||||
|
||||
bool BlenderSync::object_is_camera(BL::Object &b_ob)
|
||||
{
|
||||
BL::ID b_ob_data = b_ob.data();
|
||||
|
||||
return (b_ob_data && b_ob_data.is_a(&RNA_Camera));
|
||||
}
|
||||
|
||||
void BlenderSync::sync_object_motion_init(BL::Object &b_parent, BL::Object &b_ob, Object *object)
|
||||
{
|
||||
/* Initialize motion blur for object, detecting if it's enabled and creating motion
|
||||
@@ -362,26 +353,79 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
||||
return object;
|
||||
}
|
||||
|
||||
extern "C" DupliObject *rna_hack_DepsgraphObjectInstance_dupli_object_get(PointerRNA *ptr);
|
||||
/* This function mirrors drw_uniform_property_lookup in draw_instance_data.cpp */
|
||||
static bool lookup_property(BL::ID b_id, const string &name, float4 *r_value)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop;
|
||||
|
||||
if (!RNA_path_resolve(&b_id.ptr, name.c_str(), &ptr, &prop)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (prop == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PropertyType type = RNA_property_type(prop);
|
||||
int arraylen = RNA_property_array_length(&ptr, prop);
|
||||
|
||||
if (arraylen == 0) {
|
||||
float value;
|
||||
|
||||
if (type == PROP_FLOAT)
|
||||
value = RNA_property_float_get(&ptr, prop);
|
||||
else if (type == PROP_INT)
|
||||
value = static_cast<float>(RNA_property_int_get(&ptr, prop));
|
||||
else
|
||||
return false;
|
||||
|
||||
*r_value = make_float4(value, value, value, 1.0f);
|
||||
return true;
|
||||
}
|
||||
else if (type == PROP_FLOAT && arraylen <= 4) {
|
||||
*r_value = make_float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
RNA_property_float_get_array(&ptr, prop, &r_value->x);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* This function mirrors drw_uniform_attribute_lookup in draw_instance_data.cpp */
|
||||
static float4 lookup_instance_property(BL::DepsgraphObjectInstance &b_instance,
|
||||
const string &name,
|
||||
bool use_instancer)
|
||||
{
|
||||
::Object *ob = (::Object *)b_instance.object().ptr.data;
|
||||
::DupliObject *dupli = nullptr;
|
||||
::Object *dupli_parent = nullptr;
|
||||
string idprop_name = string_printf("[\"%s\"]", name.c_str());
|
||||
float4 value;
|
||||
|
||||
/* If requesting instance data, check the parent particle system and object. */
|
||||
if (use_instancer && b_instance.is_instance()) {
|
||||
dupli = rna_hack_DepsgraphObjectInstance_dupli_object_get(&b_instance.ptr);
|
||||
dupli_parent = (::Object *)b_instance.parent().ptr.data;
|
||||
BL::ParticleSystem b_psys = b_instance.particle_system();
|
||||
|
||||
if (b_psys) {
|
||||
if (lookup_property(b_psys.settings(), idprop_name, &value) ||
|
||||
lookup_property(b_psys.settings(), name, &value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
if (lookup_property(b_instance.parent(), idprop_name, &value) ||
|
||||
lookup_property(b_instance.parent(), name, &value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
float4 value;
|
||||
BKE_object_dupli_find_rgba_attribute(ob, dupli, dupli_parent, name.c_str(), &value.x);
|
||||
/* Check the object and mesh. */
|
||||
BL::Object b_ob = b_instance.object();
|
||||
BL::ID b_data = b_ob.data();
|
||||
|
||||
return value;
|
||||
if (lookup_property(b_ob, idprop_name, &value) || lookup_property(b_ob, name, &value) ||
|
||||
lookup_property(b_data, idprop_name, &value) || lookup_property(b_data, name, &value)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
return zero_float4();
|
||||
}
|
||||
|
||||
bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance, Object *object)
|
||||
@@ -407,8 +451,7 @@ bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance
|
||||
std::string real_name;
|
||||
BlenderAttributeType type = blender_attribute_name_split_type(name, &real_name);
|
||||
|
||||
if (type == BL::ShaderNodeAttribute::attribute_type_OBJECT ||
|
||||
type == BL::ShaderNodeAttribute::attribute_type_INSTANCER) {
|
||||
if (type != BL::ShaderNodeAttribute::attribute_type_GEOMETRY) {
|
||||
bool use_instancer = (type == BL::ShaderNodeAttribute::attribute_type_INSTANCER);
|
||||
float4 value = lookup_instance_property(b_instance, real_name, use_instancer);
|
||||
|
||||
|
@@ -194,7 +194,7 @@ static void export_pointcloud(Scene *scene,
|
||||
/* Export points. */
|
||||
for (int i = 0; i < num_points; i++) {
|
||||
const float3 co = get_float3(b_attr_position.data[i].vector());
|
||||
const float radius = b_attr_radius ? b_attr_radius->data[i].value() : 0.01f;
|
||||
const float radius = b_attr_radius ? b_attr_radius->data[i].value() : 0.0f;
|
||||
pointcloud->add_point(co, radius);
|
||||
|
||||
/* Random number per point. */
|
||||
@@ -232,7 +232,7 @@ static void export_pointcloud_motion(PointCloud *pointcloud,
|
||||
|
||||
for (int i = 0; i < std::min(num_points, b_points_num); i++) {
|
||||
const float3 co = get_float3(b_attr_position.data[i].vector());
|
||||
const float radius = b_attr_radius ? b_attr_radius->data[i].value() : 0.01f;
|
||||
const float radius = b_attr_radius ? b_attr_radius->data[i].value() : 0.0f;
|
||||
float3 P = co;
|
||||
P.w = radius;
|
||||
mP[i] = P;
|
||||
|
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "util/debug.h"
|
||||
#include "util/foreach.h"
|
||||
#include "util/guiding.h"
|
||||
#include "util/log.h"
|
||||
#include "util/md5.h"
|
||||
#include "util/opengl.h"
|
||||
@@ -535,7 +534,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
|
||||
socket_type = "NodeSocketBool";
|
||||
data_type = BL::NodeSocket::type_BOOLEAN;
|
||||
if (param->validdefault) {
|
||||
default_boolean = bool(param->idefault[0]);
|
||||
default_boolean = (bool)param->idefault[0];
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1009,15 +1008,6 @@ void *CCL_python_module_init()
|
||||
PyModule_AddStringConstant(mod, "osl_version_string", "unknown");
|
||||
#endif
|
||||
|
||||
if (ccl::guiding_supported()) {
|
||||
PyModule_AddObject(mod, "with_path_guiding", Py_True);
|
||||
Py_INCREF(Py_True);
|
||||
}
|
||||
else {
|
||||
PyModule_AddObject(mod, "with_path_guiding", Py_False);
|
||||
Py_INCREF(Py_False);
|
||||
}
|
||||
|
||||
#ifdef WITH_EMBREE
|
||||
PyModule_AddObject(mod, "with_embree", Py_True);
|
||||
Py_INCREF(Py_True);
|
||||
|
@@ -60,8 +60,7 @@ BlenderSession::BlenderSession(BL::RenderEngine &b_engine,
|
||||
height(0),
|
||||
preview_osl(preview_osl),
|
||||
python_thread_state(NULL),
|
||||
use_developer_ui(b_userpref.experimental().use_cycles_debug() &&
|
||||
b_userpref.view().show_developer_ui())
|
||||
use_developer_ui(false)
|
||||
{
|
||||
/* offline render */
|
||||
background = true;
|
||||
|
@@ -22,8 +22,6 @@
|
||||
#include "util/string.h"
|
||||
#include "util/task.h"
|
||||
|
||||
#include "BKE_duplilist.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
typedef map<void *, ShaderInput *> PtrInputMap;
|
||||
@@ -105,7 +103,6 @@ static ImageAlphaType get_image_alpha_type(BL::Image &b_image)
|
||||
|
||||
static const string_view object_attr_prefix("\x01object:");
|
||||
static const string_view instancer_attr_prefix("\x01instancer:");
|
||||
static const string_view view_layer_attr_prefix("\x01layer:");
|
||||
|
||||
static ustring blender_attribute_name_add_type(const string &name, BlenderAttributeType type)
|
||||
{
|
||||
@@ -114,8 +111,6 @@ static ustring blender_attribute_name_add_type(const string &name, BlenderAttrib
|
||||
return ustring::concat(object_attr_prefix, name);
|
||||
case BL::ShaderNodeAttribute::attribute_type_INSTANCER:
|
||||
return ustring::concat(instancer_attr_prefix, name);
|
||||
case BL::ShaderNodeAttribute::attribute_type_VIEW_LAYER:
|
||||
return ustring::concat(view_layer_attr_prefix, name);
|
||||
default:
|
||||
return ustring(name);
|
||||
}
|
||||
@@ -135,11 +130,6 @@ BlenderAttributeType blender_attribute_name_split_type(ustring name, string *r_r
|
||||
return BL::ShaderNodeAttribute::attribute_type_INSTANCER;
|
||||
}
|
||||
|
||||
if (sname.substr(0, view_layer_attr_prefix.size()) == view_layer_attr_prefix) {
|
||||
*r_real_name = sname.substr(view_layer_attr_prefix.size());
|
||||
return BL::ShaderNodeAttribute::attribute_type_VIEW_LAYER;
|
||||
}
|
||||
|
||||
return BL::ShaderNodeAttribute::attribute_type_GEOMETRY;
|
||||
}
|
||||
|
||||
@@ -215,9 +205,7 @@ static void set_default_value(ShaderInput *input,
|
||||
}
|
||||
case SocketType::INT: {
|
||||
if (b_sock.type() == BL::NodeSocket::type_BOOLEAN) {
|
||||
/* Make sure to call the int overload of set() since this is an integer socket as far as
|
||||
* Cycles is concerned. */
|
||||
node->set(socket, get_boolean(b_sock.ptr, "default_value") ? 1 : 0);
|
||||
node->set(socket, get_boolean(b_sock.ptr, "default_value"));
|
||||
}
|
||||
else {
|
||||
node->set(socket, get_int(b_sock.ptr, "default_value"));
|
||||
@@ -1432,89 +1420,6 @@ static void add_nodes(Scene *scene,
|
||||
empty_proxy_map);
|
||||
}
|
||||
|
||||
/* Look up and constant fold all references to View Layer attributes. */
|
||||
void BlenderSync::resolve_view_layer_attributes(Shader *shader,
|
||||
ShaderGraph *graph,
|
||||
BL::Depsgraph &b_depsgraph)
|
||||
{
|
||||
bool updated = false;
|
||||
|
||||
foreach (ShaderNode *node, graph->nodes) {
|
||||
if (node->is_a(AttributeNode::node_type)) {
|
||||
AttributeNode *attr_node = static_cast<AttributeNode *>(node);
|
||||
|
||||
std::string real_name;
|
||||
BlenderAttributeType type = blender_attribute_name_split_type(attr_node->get_attribute(),
|
||||
&real_name);
|
||||
|
||||
if (type == BL::ShaderNodeAttribute::attribute_type_VIEW_LAYER) {
|
||||
/* Look up the value. */
|
||||
BL::ViewLayer b_layer = b_depsgraph.view_layer_eval();
|
||||
BL::Scene b_scene = b_depsgraph.scene_eval();
|
||||
float4 value;
|
||||
|
||||
BKE_view_layer_find_rgba_attribute((::Scene *)b_scene.ptr.data,
|
||||
(::ViewLayer *)b_layer.ptr.data,
|
||||
real_name.c_str(),
|
||||
&value.x);
|
||||
|
||||
/* Replace all outgoing links, using appropriate output types. */
|
||||
float val_avg = (value.x + value.y + value.z) / 3.0f;
|
||||
|
||||
foreach (ShaderOutput *output, node->outputs) {
|
||||
float val_float;
|
||||
float3 val_float3;
|
||||
|
||||
if (output->type() == SocketType::FLOAT) {
|
||||
val_float = (output->name() == "Alpha") ? value.w : val_avg;
|
||||
val_float3 = make_float3(val_float);
|
||||
}
|
||||
else {
|
||||
val_float = val_avg;
|
||||
val_float3 = float4_to_float3(value);
|
||||
}
|
||||
|
||||
foreach (ShaderInput *sock, output->links) {
|
||||
if (sock->type() == SocketType::FLOAT) {
|
||||
sock->set(val_float);
|
||||
}
|
||||
else if (SocketType::is_float3(sock->type())) {
|
||||
sock->set(val_float3);
|
||||
}
|
||||
|
||||
sock->constant_folded_in = true;
|
||||
}
|
||||
|
||||
graph->disconnect(output);
|
||||
}
|
||||
|
||||
/* Clear the attribute name to avoid further attempts to look up. */
|
||||
attr_node->set_attribute(ustring());
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (updated) {
|
||||
shader_map.set_flag(shader, SHADER_WITH_LAYER_ATTRS);
|
||||
}
|
||||
else {
|
||||
shader_map.clear_flag(shader, SHADER_WITH_LAYER_ATTRS);
|
||||
}
|
||||
}
|
||||
|
||||
bool BlenderSync::scene_attr_needs_recalc(Shader *shader, BL::Depsgraph &b_depsgraph)
|
||||
{
|
||||
if (shader && shader_map.test_flag(shader, SHADER_WITH_LAYER_ATTRS)) {
|
||||
BL::Scene scene = b_depsgraph.scene_eval();
|
||||
|
||||
return shader_map.check_recalc(scene) || shader_map.check_recalc(scene.world()) ||
|
||||
shader_map.check_recalc(scene.camera());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Sync Materials */
|
||||
|
||||
void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
|
||||
@@ -1533,8 +1438,7 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
|
||||
Shader *shader;
|
||||
|
||||
/* test if we need to sync */
|
||||
if (shader_map.add_or_update(&shader, b_mat) || update_all ||
|
||||
scene_attr_needs_recalc(shader, b_depsgraph)) {
|
||||
if (shader_map.add_or_update(&shader, b_mat) || update_all) {
|
||||
ShaderGraph *graph = new ShaderGraph();
|
||||
|
||||
shader->name = b_mat.name().c_str();
|
||||
@@ -1555,8 +1459,6 @@ void BlenderSync::sync_materials(BL::Depsgraph &b_depsgraph, bool update_all)
|
||||
graph->connect(diffuse->output("BSDF"), out->input("Surface"));
|
||||
}
|
||||
|
||||
resolve_view_layer_attributes(shader, graph, b_depsgraph);
|
||||
|
||||
/* settings */
|
||||
PointerRNA cmat = RNA_pointer_get(&b_mat.ptr, "cycles");
|
||||
shader->set_use_mis(get_boolean(cmat, "sample_as_light"));
|
||||
@@ -1613,11 +1515,9 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
|
||||
|
||||
BlenderViewportParameters new_viewport_parameters(b_v3d, use_developer_ui);
|
||||
|
||||
Shader *shader = scene->default_background;
|
||||
|
||||
if (world_recalc || update_all || b_world.ptr.data != world_map ||
|
||||
viewport_parameters.shader_modified(new_viewport_parameters) ||
|
||||
scene_attr_needs_recalc(shader, b_depsgraph)) {
|
||||
viewport_parameters.shader_modified(new_viewport_parameters)) {
|
||||
Shader *shader = scene->default_background;
|
||||
ShaderGraph *graph = new ShaderGraph();
|
||||
|
||||
/* create nodes */
|
||||
@@ -1715,8 +1615,6 @@ void BlenderSync::sync_world(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d,
|
||||
background->set_visibility(visibility);
|
||||
}
|
||||
|
||||
resolve_view_layer_attributes(shader, graph, b_depsgraph);
|
||||
|
||||
shader->set_graph(graph);
|
||||
shader->tag_update(scene);
|
||||
}
|
||||
@@ -1783,8 +1681,7 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all)
|
||||
Shader *shader;
|
||||
|
||||
/* test if we need to sync */
|
||||
if (shader_map.add_or_update(&shader, b_light) || update_all ||
|
||||
scene_attr_needs_recalc(shader, b_depsgraph)) {
|
||||
if (shader_map.add_or_update(&shader, b_light) || update_all) {
|
||||
ShaderGraph *graph = new ShaderGraph();
|
||||
|
||||
/* create nodes */
|
||||
@@ -1805,8 +1702,6 @@ void BlenderSync::sync_lights(BL::Depsgraph &b_depsgraph, bool update_all)
|
||||
graph->connect(emission->output("Emission"), out->input("Surface"));
|
||||
}
|
||||
|
||||
resolve_view_layer_attributes(shader, graph, b_depsgraph);
|
||||
|
||||
shader->set_graph(graph);
|
||||
shader->tag_update(scene);
|
||||
}
|
||||
|
@@ -206,9 +206,6 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (object_is_camera(b_ob)) {
|
||||
shader_map.set_recalc(b_ob);
|
||||
}
|
||||
}
|
||||
/* Mesh */
|
||||
else if (b_id.is_a(&RNA_Mesh)) {
|
||||
@@ -221,11 +218,6 @@ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d
|
||||
if (world_map == b_world.ptr.data) {
|
||||
world_recalc = true;
|
||||
}
|
||||
shader_map.set_recalc(b_world);
|
||||
}
|
||||
/* World */
|
||||
else if (b_id.is_a(&RNA_Scene)) {
|
||||
shader_map.set_recalc(b_id);
|
||||
}
|
||||
/* Volume */
|
||||
else if (b_id.is_a(&RNA_Volume)) {
|
||||
@@ -421,22 +413,6 @@ void BlenderSync::sync_integrator(BL::ViewLayer &b_view_layer, bool background)
|
||||
integrator->set_direct_light_sampling_type(direct_light_sampling_type);
|
||||
#endif
|
||||
|
||||
integrator->set_use_guiding(get_boolean(cscene, "use_guiding"));
|
||||
integrator->set_use_surface_guiding(get_boolean(cscene, "use_surface_guiding"));
|
||||
integrator->set_use_volume_guiding(get_boolean(cscene, "use_volume_guiding"));
|
||||
integrator->set_guiding_training_samples(get_int(cscene, "guiding_training_samples"));
|
||||
|
||||
if (use_developer_ui) {
|
||||
integrator->set_deterministic_guiding(get_boolean(cscene, "use_deterministic_guiding"));
|
||||
integrator->set_surface_guiding_probability(get_float(cscene, "surface_guiding_probability"));
|
||||
integrator->set_volume_guiding_probability(get_float(cscene, "volume_guiding_probability"));
|
||||
integrator->set_use_guiding_direct_light(get_boolean(cscene, "use_guiding_direct_light"));
|
||||
integrator->set_use_guiding_mis_weights(get_boolean(cscene, "use_guiding_mis_weights"));
|
||||
GuidingDistributionType guiding_distribution_type = (GuidingDistributionType)get_enum(
|
||||
cscene, "guiding_distribution_type", GUIDING_NUM_TYPES, GUIDING_TYPE_PARALLAX_AWARE_VMM);
|
||||
integrator->set_guiding_distribution_type(guiding_distribution_type);
|
||||
}
|
||||
|
||||
DenoiseParams denoise_params = get_denoise_params(b_scene, b_view_layer, background);
|
||||
|
||||
/* No denoising support for vertex color baking, vertices packed into image
|
||||
@@ -761,17 +737,6 @@ void BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLayer &b_v
|
||||
pass_add(scene, PASS_DENOISING_DEPTH, "Denoising Depth", PassMode::NOISY);
|
||||
}
|
||||
|
||||
#ifdef WITH_CYCLES_DEBUG
|
||||
b_engine.add_pass("Guiding Color", 3, "RGB", b_view_layer.name().c_str());
|
||||
pass_add(scene, PASS_GUIDING_COLOR, "Guiding Color", PassMode::NOISY);
|
||||
|
||||
b_engine.add_pass("Guiding Probability", 1, "X", b_view_layer.name().c_str());
|
||||
pass_add(scene, PASS_GUIDING_PROBABILITY, "Guiding Probability", PassMode::NOISY);
|
||||
|
||||
b_engine.add_pass("Guiding Average Roughness", 1, "X", b_view_layer.name().c_str());
|
||||
pass_add(scene, PASS_GUIDING_AVG_ROUGHNESS, "Guiding Average Roughness", PassMode::NOISY);
|
||||
#endif
|
||||
|
||||
/* Custom AOV passes. */
|
||||
BL::ViewLayer::aovs_iterator b_aov_iter;
|
||||
for (b_view_layer.aovs.begin(b_aov_iter); b_aov_iter != b_view_layer.aovs.end(); ++b_aov_iter) {
|
||||
|
@@ -120,11 +120,6 @@ class BlenderSync {
|
||||
void sync_shaders(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d, bool update_all);
|
||||
void sync_nodes(Shader *shader, BL::ShaderNodeTree &b_ntree);
|
||||
|
||||
bool scene_attr_needs_recalc(Shader *shader, BL::Depsgraph &b_depsgraph);
|
||||
void resolve_view_layer_attributes(Shader *shader,
|
||||
ShaderGraph *graph,
|
||||
BL::Depsgraph &b_depsgraph);
|
||||
|
||||
/* Object */
|
||||
Object *sync_object(BL::Depsgraph &b_depsgraph,
|
||||
BL::ViewLayer &b_view_layer,
|
||||
@@ -212,16 +207,13 @@ class BlenderSync {
|
||||
bool object_is_geometry(BObjectInfo &b_ob_info);
|
||||
bool object_can_have_geometry(BL::Object &b_ob);
|
||||
bool object_is_light(BL::Object &b_ob);
|
||||
bool object_is_camera(BL::Object &b_ob);
|
||||
|
||||
/* variables */
|
||||
BL::RenderEngine b_engine;
|
||||
BL::BlendData b_data;
|
||||
BL::Scene b_scene;
|
||||
|
||||
enum ShaderFlags { SHADER_WITH_LAYER_ATTRS };
|
||||
|
||||
id_map<void *, Shader, ShaderFlags> shader_map;
|
||||
id_map<void *, Shader> shader_map;
|
||||
id_map<ObjectKey, Object> object_map;
|
||||
id_map<void *, Procedural> procedural_map;
|
||||
id_map<GeometryKey, Geometry> geometry_map;
|
||||
|
@@ -69,7 +69,6 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
||||
_set_default(BOOST_ROOT "${_cycles_lib_dir}/boost")
|
||||
_set_default(BLOSC_ROOT_DIR "${_cycles_lib_dir}/blosc")
|
||||
_set_default(EMBREE_ROOT_DIR "${_cycles_lib_dir}/embree")
|
||||
_set_default(EPOXY_ROOT_DIR "${_cycles_lib_dir}/epoxy")
|
||||
_set_default(IMATH_ROOT_DIR "${_cycles_lib_dir}/imath")
|
||||
_set_default(GLEW_ROOT_DIR "${_cycles_lib_dir}/glew")
|
||||
_set_default(JPEG_ROOT "${_cycles_lib_dir}/jpeg")
|
||||
@@ -92,11 +91,7 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
||||
_set_default(USD_ROOT_DIR "${_cycles_lib_dir}/usd")
|
||||
_set_default(WEBP_ROOT_DIR "${_cycles_lib_dir}/webp")
|
||||
_set_default(ZLIB_ROOT "${_cycles_lib_dir}/zlib")
|
||||
if(WIN32)
|
||||
set(LEVEL_ZERO_ROOT_DIR ${_cycles_lib_dir}/level_zero)
|
||||
else()
|
||||
set(LEVEL_ZERO_ROOT_DIR ${_cycles_lib_dir}/level-zero)
|
||||
endif()
|
||||
_set_default(LEVEL_ZERO_ROOT_DIR "${_cycles_lib_dir}/level-zero")
|
||||
_set_default(SYCL_ROOT_DIR "${_cycles_lib_dir}/dpcpp")
|
||||
|
||||
# Ignore system libraries
|
||||
@@ -202,17 +197,17 @@ endif()
|
||||
if(CYCLES_STANDALONE_REPOSITORY)
|
||||
if(MSVC AND EXISTS ${_cycles_lib_dir})
|
||||
set(OPENEXR_INCLUDE_DIR ${OPENEXR_ROOT_DIR}/include)
|
||||
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR_ROOT_DIR}/include/OpenEXR ${IMATH_ROOT_DIR}/include ${IMATH_ROOT_DIR}/include/Imath)
|
||||
set(OPENEXR_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ${OPENEXR_ROOT_DIR}/include/OpenEXR)
|
||||
set(OPENEXR_LIBRARIES
|
||||
optimized ${OPENEXR_ROOT_DIR}/lib/OpenEXR_s.lib
|
||||
optimized ${OPENEXR_ROOT_DIR}/lib/OpenEXRCore_s.lib
|
||||
optimized ${OPENEXR_ROOT_DIR}/lib/Iex_s.lib
|
||||
optimized ${IMATH_ROOT_DIR}/lib/Imath_s.lib
|
||||
optimized ${OPENEXR_ROOT_DIR}/lib/Half_s.lib
|
||||
optimized ${OPENEXR_ROOT_DIR}/lib/IlmImf_s.lib
|
||||
optimized ${OPENEXR_ROOT_DIR}/lib/Imath_s.lib
|
||||
optimized ${OPENEXR_ROOT_DIR}/lib/IlmThread_s.lib
|
||||
debug ${OPENEXR_ROOT_DIR}/lib/OpenEXR_s_d.lib
|
||||
debug ${OPENEXR_ROOT_DIR}/lib/OpenEXRCore_s_d.lib
|
||||
debug ${OPENEXR_ROOT_DIR}/lib/Iex_s_d.lib
|
||||
debug ${IMATH_ROOT_DIR}/lib/Imath_s_d.lib
|
||||
debug ${OPENEXR_ROOT_DIR}/lib/Half_s_d.lib
|
||||
debug ${OPENEXR_ROOT_DIR}/lib/IlmImf_s_d.lib
|
||||
debug ${OPENEXR_ROOT_DIR}/lib/Imath_s_d.lib
|
||||
debug ${OPENEXR_ROOT_DIR}/lib/IlmThread_s_d.lib
|
||||
)
|
||||
else()
|
||||
@@ -269,31 +264,6 @@ if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_OSL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
###########################################################################
|
||||
# OpenPGL
|
||||
###########################################################################
|
||||
|
||||
if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_PATH_GUIDING)
|
||||
if(NOT openpgl_DIR AND EXISTS ${_cycles_lib_dir})
|
||||
set(openpgl_DIR ${_cycles_lib_dir}/openpgl/lib/cmake/openpgl)
|
||||
endif()
|
||||
|
||||
find_package(openpgl QUIET)
|
||||
if(openpgl_FOUND)
|
||||
if(WIN32)
|
||||
get_target_property(OPENPGL_LIBRARIES_RELEASE openpgl::openpgl LOCATION_RELEASE)
|
||||
get_target_property(OPENPGL_LIBRARIES_DEBUG openpgl::openpgl LOCATION_DEBUG)
|
||||
set(OPENPGL_LIBRARIES optimized ${OPENPGL_LIBRARIES_RELEASE} debug ${OPENPGL_LIBRARIES_DEBUG})
|
||||
else()
|
||||
get_target_property(OPENPGL_LIBRARIES openpgl::openpgl LOCATION)
|
||||
endif()
|
||||
get_target_property(OPENPGL_INCLUDE_DIR openpgl::openpgl INTERFACE_INCLUDE_DIRECTORIES)
|
||||
else()
|
||||
set(WITH_CYCLES_PATH_GUIDING OFF)
|
||||
message(STATUS "OpenPGL not found, disabling WITH_CYCLES_PATH_GUIDING")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
###########################################################################
|
||||
# OpenColorIO
|
||||
###########################################################################
|
||||
@@ -349,8 +319,8 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
||||
if(NOT BOOST_VERSION)
|
||||
message(FATAL_ERROR "Unable to determine Boost version")
|
||||
endif()
|
||||
set(BOOST_POSTFIX "vc142-mt-x64-${BOOST_VERSION}.lib")
|
||||
set(BOOST_DEBUG_POSTFIX "vc142-mt-gd-x64-${BOOST_VERSION}.lib")
|
||||
set(BOOST_POSTFIX "vc141-mt-x64-${BOOST_VERSION}.lib")
|
||||
set(BOOST_DEBUG_POSTFIX "vc141-mt-gd-x64-${BOOST_VERSION}.lib")
|
||||
set(BOOST_LIBRARIES
|
||||
optimized ${BOOST_ROOT}/lib/libboost_date_time-${BOOST_POSTFIX}
|
||||
optimized ${BOOST_ROOT}/lib/libboost_iostreams-${BOOST_POSTFIX}
|
||||
@@ -489,7 +459,6 @@ if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_NANOVDB)
|
||||
|
||||
if(MSVC AND EXISTS ${_cycles_lib_dir})
|
||||
set(NANOVDB_INCLUDE_DIR ${NANOVDB_ROOT_DIR}/include)
|
||||
set(NANOVDB_INCLUDE_DIRS ${NANOVDB_INCLUDE_DIR})
|
||||
else()
|
||||
find_package(NanoVDB REQUIRED)
|
||||
endif()
|
||||
|
@@ -118,9 +118,6 @@ macro(cycles_external_libraries_append libraries)
|
||||
if(WITH_ALEMBIC)
|
||||
list(APPEND ${libraries} ${ALEMBIC_LIBRARIES})
|
||||
endif()
|
||||
if(WITH_PATH_GUIDING)
|
||||
target_link_libraries(${target} ${OPENPGL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
list(APPEND ${libraries}
|
||||
${OPENIMAGEIO_LIBRARIES}
|
||||
@@ -172,13 +169,13 @@ macro(cycles_install_libraries target)
|
||||
FILES
|
||||
${TBB_ROOT_DIR}/bin/tbb_debug${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${OPENVDB_ROOT_DIR}/bin/openvdb_d${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
DESTINATION $<TARGET_FILE_DIR:${target}>)
|
||||
else()
|
||||
install(
|
||||
FILES
|
||||
${TBB_ROOT_DIR}/bin/tbb${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
${OPENVDB_ROOT_DIR}/bin/openvdb${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
DESTINATION $<TARGET_FILE_DIR:${target}>)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
@@ -142,6 +142,7 @@ set(SRC
|
||||
${SRC_DUMMY}
|
||||
${SRC_MULTI}
|
||||
${SRC_OPTIX}
|
||||
${SRC_ONEAPI}
|
||||
${SRC_HEADERS}
|
||||
)
|
||||
|
||||
@@ -187,25 +188,7 @@ if(WITH_CYCLES_DEVICE_METAL)
|
||||
)
|
||||
endif()
|
||||
if (WITH_CYCLES_DEVICE_ONEAPI)
|
||||
if(WIN32)
|
||||
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/../kernel/cycles_kernel_oneapi.lib)
|
||||
else()
|
||||
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/../kernel/libcycles_kernel_oneapi.so)
|
||||
endif()
|
||||
list(APPEND LIB
|
||||
${cycles_kernel_oneapi_lib}
|
||||
"$<$<CONFIG:Debug>:${SYCL_LIBRARY_DEBUG}>"
|
||||
"$<$<CONFIG:Release>:${SYCL_LIBRARY}>"
|
||||
"$<$<CONFIG:RelWithDebInfo>:${SYCL_LIBRARY}>"
|
||||
"$<$<CONFIG:MinSizeRel>:${SYCL_LIBRARY}>"
|
||||
)
|
||||
add_definitions(-DWITH_ONEAPI)
|
||||
list(APPEND SRC
|
||||
${SRC_ONEAPI}
|
||||
)
|
||||
list(APPEND INC_SYS
|
||||
${SYCL_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
|
@@ -7,7 +7,6 @@
|
||||
/* Used for `info.denoisers`. */
|
||||
/* TODO(sergey): The denoisers are probably to be moved completely out of the device into their
|
||||
* own class. But until then keep API consistent with how it used to work before. */
|
||||
#include "util/guiding.h"
|
||||
#include "util/openimagedenoise.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
@@ -28,12 +27,6 @@ void device_cpu_info(vector<DeviceInfo> &devices)
|
||||
info.has_osl = true;
|
||||
info.has_nanovdb = true;
|
||||
info.has_profiling = true;
|
||||
if (guiding_supported()) {
|
||||
info.has_guiding = true;
|
||||
}
|
||||
else {
|
||||
info.has_guiding = false;
|
||||
}
|
||||
if (openimagedenoise_supported()) {
|
||||
info.denoisers |= DENOISER_OPENIMAGEDENOISE;
|
||||
}
|
||||
|
@@ -38,7 +38,6 @@
|
||||
#include "util/debug.h"
|
||||
#include "util/foreach.h"
|
||||
#include "util/function.h"
|
||||
#include "util/guiding.h"
|
||||
#include "util/log.h"
|
||||
#include "util/map.h"
|
||||
#include "util/openimagedenoise.h"
|
||||
@@ -279,23 +278,6 @@ void CPUDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
|
||||
Device::build_bvh(bvh, progress, refit);
|
||||
}
|
||||
|
||||
void *CPUDevice::get_guiding_device() const
|
||||
{
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
if (!guiding_device) {
|
||||
if (guiding_device_type() == 8) {
|
||||
guiding_device = make_unique<openpgl::cpp::Device>(PGL_DEVICE_TYPE_CPU_8);
|
||||
}
|
||||
else if (guiding_device_type() == 4) {
|
||||
guiding_device = make_unique<openpgl::cpp::Device>(PGL_DEVICE_TYPE_CPU_4);
|
||||
}
|
||||
}
|
||||
return guiding_device.get();
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CPUDevice::get_cpu_kernel_thread_globals(
|
||||
vector<CPUKernelThreadGlobals> &kernel_thread_globals)
|
||||
{
|
||||
|
@@ -26,9 +26,6 @@
|
||||
#include "kernel/osl/globals.h"
|
||||
// clang-format on
|
||||
|
||||
#include "util/guiding.h"
|
||||
#include "util/unique_ptr.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
class CPUDevice : public Device {
|
||||
@@ -45,9 +42,6 @@ class CPUDevice : public Device {
|
||||
RTCScene embree_scene = NULL;
|
||||
RTCDevice embree_device;
|
||||
#endif
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
mutable unique_ptr<openpgl::cpp::Device> guiding_device;
|
||||
#endif
|
||||
|
||||
CPUDevice(const DeviceInfo &info_, Stats &stats_, Profiler &profiler_);
|
||||
~CPUDevice();
|
||||
@@ -78,8 +72,6 @@ class CPUDevice : public Device {
|
||||
|
||||
void build_bvh(BVH *bvh, Progress &progress, bool refit) override;
|
||||
|
||||
void *get_guiding_device() const override;
|
||||
|
||||
virtual void get_cpu_kernel_thread_globals(
|
||||
vector<CPUKernelThreadGlobals> &kernel_thread_globals) override;
|
||||
virtual void *get_cpu_osl_memory() override;
|
||||
|
@@ -14,23 +14,19 @@ CPUKernelThreadGlobals::CPUKernelThreadGlobals(const KernelGlobalsCPU &kernel_gl
|
||||
Profiler &cpu_profiler)
|
||||
: KernelGlobalsCPU(kernel_globals), cpu_profiler_(cpu_profiler)
|
||||
{
|
||||
clear_runtime_pointers();
|
||||
reset_runtime_memory();
|
||||
|
||||
#ifdef WITH_OSL
|
||||
OSLGlobals::thread_init(this, static_cast<OSLGlobals *>(osl_globals_memory));
|
||||
#else
|
||||
(void)osl_globals_memory;
|
||||
#endif
|
||||
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
opgl_path_segment_storage = new openpgl::cpp::PathSegmentStorage();
|
||||
#endif
|
||||
}
|
||||
|
||||
CPUKernelThreadGlobals::CPUKernelThreadGlobals(CPUKernelThreadGlobals &&other) noexcept
|
||||
: KernelGlobalsCPU(std::move(other)), cpu_profiler_(other.cpu_profiler_)
|
||||
{
|
||||
other.clear_runtime_pointers();
|
||||
other.reset_runtime_memory();
|
||||
}
|
||||
|
||||
CPUKernelThreadGlobals::~CPUKernelThreadGlobals()
|
||||
@@ -38,12 +34,6 @@ CPUKernelThreadGlobals::~CPUKernelThreadGlobals()
|
||||
#ifdef WITH_OSL
|
||||
OSLGlobals::thread_free(this);
|
||||
#endif
|
||||
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
delete opgl_path_segment_storage;
|
||||
delete opgl_surface_sampling_distribution;
|
||||
delete opgl_volume_sampling_distribution;
|
||||
#endif
|
||||
}
|
||||
|
||||
CPUKernelThreadGlobals &CPUKernelThreadGlobals::operator=(CPUKernelThreadGlobals &&other)
|
||||
@@ -54,25 +44,16 @@ CPUKernelThreadGlobals &CPUKernelThreadGlobals::operator=(CPUKernelThreadGlobals
|
||||
|
||||
*static_cast<KernelGlobalsCPU *>(this) = *static_cast<KernelGlobalsCPU *>(&other);
|
||||
|
||||
other.clear_runtime_pointers();
|
||||
other.reset_runtime_memory();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void CPUKernelThreadGlobals::clear_runtime_pointers()
|
||||
void CPUKernelThreadGlobals::reset_runtime_memory()
|
||||
{
|
||||
#ifdef WITH_OSL
|
||||
osl = nullptr;
|
||||
#endif
|
||||
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
opgl_sample_data_storage = nullptr;
|
||||
opgl_guiding_field = nullptr;
|
||||
|
||||
opgl_path_segment_storage = nullptr;
|
||||
opgl_surface_sampling_distribution = nullptr;
|
||||
opgl_volume_sampling_distribution = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CPUKernelThreadGlobals::start_profiling()
|
||||
|
@@ -36,7 +36,7 @@ class CPUKernelThreadGlobals : public KernelGlobalsCPU {
|
||||
void stop_profiling();
|
||||
|
||||
protected:
|
||||
void clear_runtime_pointers();
|
||||
void reset_runtime_memory();
|
||||
|
||||
Profiler &cpu_profiler_;
|
||||
};
|
||||
|
@@ -79,7 +79,7 @@ bool CUDADeviceQueue::enqueue(DeviceKernel kernel,
|
||||
return false;
|
||||
}
|
||||
|
||||
debug_enqueue_begin(kernel, work_size);
|
||||
debug_enqueue(kernel, work_size);
|
||||
|
||||
const CUDAContextScope scope(cuda_device_);
|
||||
const CUDADeviceKernel &cuda_kernel = cuda_device_->kernels.get(kernel);
|
||||
@@ -121,8 +121,6 @@ bool CUDADeviceQueue::enqueue(DeviceKernel kernel,
|
||||
0),
|
||||
"enqueue");
|
||||
|
||||
debug_enqueue_end();
|
||||
|
||||
return !(cuda_device_->have_error());
|
||||
}
|
||||
|
||||
|
@@ -352,7 +352,6 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
|
||||
|
||||
info.has_nanovdb = true;
|
||||
info.has_osl = true;
|
||||
info.has_guiding = true;
|
||||
info.has_profiling = true;
|
||||
info.has_peer_memory = false;
|
||||
info.use_metalrt = false;
|
||||
@@ -400,7 +399,6 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
|
||||
/* Accumulate device info. */
|
||||
info.has_nanovdb &= device.has_nanovdb;
|
||||
info.has_osl &= device.has_osl;
|
||||
info.has_guiding &= device.has_guiding;
|
||||
info.has_profiling &= device.has_profiling;
|
||||
info.has_peer_memory |= device.has_peer_memory;
|
||||
info.use_metalrt |= device.use_metalrt;
|
||||
|
@@ -66,7 +66,6 @@ class DeviceInfo {
|
||||
bool display_device; /* GPU is used as a display device. */
|
||||
bool has_nanovdb; /* Support NanoVDB volumes. */
|
||||
bool has_osl; /* Support Open Shading Language. */
|
||||
bool has_guiding; /* Support path guiding. */
|
||||
bool has_profiling; /* Supports runtime collection of profiling info. */
|
||||
bool has_peer_memory; /* GPU has P2P access to memory of another GPU. */
|
||||
bool has_gpu_queue; /* Device supports GPU queue. */
|
||||
@@ -85,7 +84,6 @@ class DeviceInfo {
|
||||
display_device = false;
|
||||
has_nanovdb = false;
|
||||
has_osl = false;
|
||||
has_guiding = false;
|
||||
has_profiling = false;
|
||||
has_peer_memory = false;
|
||||
has_gpu_queue = false;
|
||||
@@ -219,15 +217,6 @@ class Device {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Guiding */
|
||||
|
||||
/* Returns path guiding device handle. */
|
||||
virtual void *get_guiding_device() const
|
||||
{
|
||||
LOG(ERROR) << "Request guiding field from a device which does not support it.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Buffer denoising. */
|
||||
|
||||
/* Returns true if task is fully handled. */
|
||||
|
@@ -79,7 +79,7 @@ bool HIPDeviceQueue::enqueue(DeviceKernel kernel,
|
||||
return false;
|
||||
}
|
||||
|
||||
debug_enqueue_begin(kernel, work_size);
|
||||
debug_enqueue(kernel, work_size);
|
||||
|
||||
const HIPContextScope scope(hip_device_);
|
||||
const HIPDeviceKernel &hip_kernel = hip_device_->kernels.get(kernel);
|
||||
@@ -120,8 +120,6 @@ bool HIPDeviceQueue::enqueue(DeviceKernel kernel,
|
||||
0),
|
||||
"enqueue");
|
||||
|
||||
debug_enqueue_end();
|
||||
|
||||
return !(hip_device_->have_error());
|
||||
}
|
||||
|
||||
|
@@ -254,10 +254,6 @@ void MetalDevice::make_source(MetalPipelineType pso_type, const uint kernel_feat
|
||||
break;
|
||||
}
|
||||
|
||||
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
|
||||
NSOperatingSystemVersion macos_ver = [processInfo operatingSystemVersion];
|
||||
global_defines += "#define __KERNEL_METAL_MACOS__ " + to_string(macos_ver.majorVersion) + "\n";
|
||||
|
||||
string &source = this->source[pso_type];
|
||||
source = "\n#include \"kernel/device/metal/kernel.metal\"\n";
|
||||
source = path_source_replace_includes(source, path_get("source"));
|
||||
|
@@ -308,29 +308,26 @@ MetalKernelPipeline *ShaderCache::get_best_pipeline(DeviceKernel kernel, const M
|
||||
|
||||
bool MetalKernelPipeline::should_use_binary_archive() const
|
||||
{
|
||||
/* Issues with binary archives in older macOS versions. */
|
||||
if (@available(macOS 13.0, *)) {
|
||||
if (auto str = getenv("CYCLES_METAL_DISABLE_BINARY_ARCHIVES")) {
|
||||
if (atoi(str) != 0) {
|
||||
/* Don't archive if we have opted out by env var. */
|
||||
return false;
|
||||
}
|
||||
if (auto str = getenv("CYCLES_METAL_DISABLE_BINARY_ARCHIVES")) {
|
||||
if (atoi(str) != 0) {
|
||||
/* Don't archive if we have opted out by env var. */
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pso_type == PSO_GENERIC) {
|
||||
/* Archive the generic kernels. */
|
||||
return true;
|
||||
}
|
||||
|
||||
if (device_kernel >= DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND &&
|
||||
device_kernel <= DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW) {
|
||||
/* Archive all shade kernels - they take a long time to compile. */
|
||||
return true;
|
||||
}
|
||||
|
||||
/* The remaining kernels are all fast to compile. They may get cached by the system shader
|
||||
* cache, but will be quick to regenerate if not. */
|
||||
}
|
||||
|
||||
if (pso_type == PSO_GENERIC) {
|
||||
/* Archive the generic kernels. */
|
||||
return true;
|
||||
}
|
||||
|
||||
if (device_kernel >= DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND &&
|
||||
device_kernel <= DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW) {
|
||||
/* Archive all shade kernels - they take a long time to compile. */
|
||||
return true;
|
||||
}
|
||||
|
||||
/* The remaining kernels are all fast to compile. They may get cached by the system shader cache,
|
||||
* but will be quick to regenerate if not. */
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -19,12 +19,62 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifdef WITH_ONEAPI
|
||||
static OneAPIDLLInterface oneapi_dll;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# define LOAD_ONEAPI_SHARED_LIBRARY(path) (void *)(LoadLibrary(path))
|
||||
# define LOAD_ONEAPI_SHARED_LIBRARY_ERROR() GetLastError()
|
||||
# define FREE_SHARED_LIBRARY(handle) FreeLibrary((HMODULE)handle)
|
||||
# define GET_SHARED_LIBRARY_SYMBOL(handle, name) GetProcAddress((HMODULE)handle, name)
|
||||
#elif __linux__
|
||||
# define LOAD_ONEAPI_SHARED_LIBRARY(path) dlopen(path, RTLD_NOW)
|
||||
# define LOAD_ONEAPI_SHARED_LIBRARY_ERROR() dlerror()
|
||||
# define FREE_SHARED_LIBRARY(handle) dlclose(handle)
|
||||
# define GET_SHARED_LIBRARY_SYMBOL(handle, name) dlsym(handle, name)
|
||||
#endif
|
||||
|
||||
bool device_oneapi_init()
|
||||
{
|
||||
#if !defined(WITH_ONEAPI)
|
||||
return false;
|
||||
#else
|
||||
|
||||
string lib_path = path_get("lib");
|
||||
# ifdef _WIN32
|
||||
lib_path = path_join(lib_path, "cycles_kernel_oneapi.dll");
|
||||
# else
|
||||
lib_path = path_join(lib_path, "cycles_kernel_oneapi.so");
|
||||
# endif
|
||||
void *lib_handle = LOAD_ONEAPI_SHARED_LIBRARY(lib_path.c_str());
|
||||
|
||||
/* This shouldn't happen, but it still makes sense to have a branch for this. */
|
||||
if (lib_handle == NULL) {
|
||||
LOG(ERROR) << "oneAPI kernel shared library cannot be loaded: "
|
||||
<< LOAD_ONEAPI_SHARED_LIBRARY_ERROR();
|
||||
return false;
|
||||
}
|
||||
|
||||
# define DLL_INTERFACE_CALL(function, return_type, ...) \
|
||||
(oneapi_dll.function) = reinterpret_cast<decltype(oneapi_dll.function)>( \
|
||||
GET_SHARED_LIBRARY_SYMBOL(lib_handle, #function)); \
|
||||
if (oneapi_dll.function == NULL) { \
|
||||
LOG(ERROR) << "oneAPI shared library function \"" << #function \
|
||||
<< "\" has not been loaded from kernel shared - disable oneAPI " \
|
||||
"library disable oneAPI implementation due to this"; \
|
||||
FREE_SHARED_LIBRARY(lib_handle); \
|
||||
return false; \
|
||||
}
|
||||
# include "kernel/device/oneapi/dll_interface_template.h"
|
||||
# undef DLL_INTERFACE_CALL
|
||||
|
||||
VLOG_INFO << "oneAPI kernel shared library has been loaded successfully";
|
||||
|
||||
/* We need to have this oneapi kernel shared library during all life-span of the Blender.
|
||||
* So it is not unloaded because of this.
|
||||
* FREE_SHARED_LIBRARY(lib_handle); */
|
||||
|
||||
/* NOTE(@nsirgien): we need to enable JIT cache from here and
|
||||
* right now this cache policy is controlled by env. variables. */
|
||||
/* NOTE(hallade) we also disable use of copy engine as it
|
||||
@@ -59,10 +109,17 @@ bool device_oneapi_init()
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(__linux__)
|
||||
# undef LOAD_SYCL_SHARED_LIBRARY
|
||||
# undef LOAD_ONEAPI_SHARED_LIBRARY
|
||||
# undef FREE_SHARED_LIBRARY
|
||||
# undef GET_SHARED_LIBRARY_SYMBOL
|
||||
#endif
|
||||
|
||||
Device *device_oneapi_create(const DeviceInfo &info, Stats &stats, Profiler &profiler)
|
||||
{
|
||||
#ifdef WITH_ONEAPI
|
||||
return new OneapiDevice(info, stats, profiler);
|
||||
return new OneapiDevice(info, oneapi_dll, stats, profiler);
|
||||
#else
|
||||
(void)info;
|
||||
(void)stats;
|
||||
@@ -108,7 +165,7 @@ static void device_iterator_cb(const char *id, const char *name, int num, void *
|
||||
void device_oneapi_info(vector<DeviceInfo> &devices)
|
||||
{
|
||||
#ifdef WITH_ONEAPI
|
||||
OneapiDevice::iterate_devices(device_iterator_cb, &devices);
|
||||
(oneapi_dll.oneapi_iterate_devices)(device_iterator_cb, &devices);
|
||||
#else /* WITH_ONEAPI */
|
||||
(void)devices;
|
||||
#endif /* WITH_ONEAPI */
|
||||
@@ -118,10 +175,10 @@ string device_oneapi_capabilities()
|
||||
{
|
||||
string capabilities;
|
||||
#ifdef WITH_ONEAPI
|
||||
char *c_capabilities = OneapiDevice::device_capabilities();
|
||||
char *c_capabilities = (oneapi_dll.oneapi_device_capabilities)();
|
||||
if (c_capabilities) {
|
||||
capabilities = c_capabilities;
|
||||
free(c_capabilities);
|
||||
(oneapi_dll.oneapi_free)(c_capabilities);
|
||||
}
|
||||
#endif
|
||||
return capabilities;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# include "util/debug.h"
|
||||
# include "util/log.h"
|
||||
|
||||
# include "kernel/device/oneapi/globals.h"
|
||||
# include "kernel/device/oneapi/kernel.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
@@ -19,19 +19,26 @@ static void queue_error_cb(const char *message, void *user_ptr)
|
||||
}
|
||||
}
|
||||
|
||||
OneapiDevice::OneapiDevice(const DeviceInfo &info, Stats &stats, Profiler &profiler)
|
||||
OneapiDevice::OneapiDevice(const DeviceInfo &info,
|
||||
OneAPIDLLInterface &oneapi_dll_object,
|
||||
Stats &stats,
|
||||
Profiler &profiler)
|
||||
: Device(info, stats, profiler),
|
||||
device_queue_(nullptr),
|
||||
texture_info_(this, "texture_info", MEM_GLOBAL),
|
||||
kg_memory_(nullptr),
|
||||
kg_memory_device_(nullptr),
|
||||
kg_memory_size_(0)
|
||||
kg_memory_size_(0),
|
||||
oneapi_dll_(oneapi_dll_object)
|
||||
{
|
||||
need_texture_info_ = false;
|
||||
|
||||
oneapi_set_error_cb(queue_error_cb, &oneapi_error_string_);
|
||||
oneapi_dll_.oneapi_set_error_cb(queue_error_cb, &oneapi_error_string_);
|
||||
|
||||
bool is_finished_ok = create_queue(device_queue_, info.num);
|
||||
/* OneAPI calls should be initialized on this moment. */
|
||||
assert(oneapi_dll_.oneapi_create_queue != nullptr);
|
||||
|
||||
bool is_finished_ok = oneapi_dll_.oneapi_create_queue(device_queue_, info.num);
|
||||
if (is_finished_ok == false) {
|
||||
set_error("oneAPI queue initialization error: got runtime exception \"" +
|
||||
oneapi_error_string_ + "\"");
|
||||
@@ -43,7 +50,7 @@ OneapiDevice::OneapiDevice(const DeviceInfo &info, Stats &stats, Profiler &profi
|
||||
}
|
||||
|
||||
size_t globals_segment_size;
|
||||
is_finished_ok = kernel_globals_size(globals_segment_size);
|
||||
is_finished_ok = oneapi_dll_.oneapi_kernel_globals_size(device_queue_, globals_segment_size);
|
||||
if (is_finished_ok == false) {
|
||||
set_error("oneAPI constant memory initialization got runtime exception \"" +
|
||||
oneapi_error_string_ + "\"");
|
||||
@@ -52,27 +59,27 @@ OneapiDevice::OneapiDevice(const DeviceInfo &info, Stats &stats, Profiler &profi
|
||||
VLOG_DEBUG << "Successfully created global/constant memory segment (kernel globals object)";
|
||||
}
|
||||
|
||||
kg_memory_ = usm_aligned_alloc_host(device_queue_, globals_segment_size, 16);
|
||||
usm_memset(device_queue_, kg_memory_, 0, globals_segment_size);
|
||||
kg_memory_ = oneapi_dll_.oneapi_usm_aligned_alloc_host(device_queue_, globals_segment_size, 16);
|
||||
oneapi_dll_.oneapi_usm_memset(device_queue_, kg_memory_, 0, globals_segment_size);
|
||||
|
||||
kg_memory_device_ = usm_alloc_device(device_queue_, globals_segment_size);
|
||||
kg_memory_device_ = oneapi_dll_.oneapi_usm_alloc_device(device_queue_, globals_segment_size);
|
||||
|
||||
kg_memory_size_ = globals_segment_size;
|
||||
|
||||
max_memory_on_device_ = get_memcapacity();
|
||||
max_memory_on_device_ = oneapi_dll_.oneapi_get_memcapacity(device_queue_);
|
||||
}
|
||||
|
||||
OneapiDevice::~OneapiDevice()
|
||||
{
|
||||
texture_info_.free();
|
||||
usm_free(device_queue_, kg_memory_);
|
||||
usm_free(device_queue_, kg_memory_device_);
|
||||
oneapi_dll_.oneapi_usm_free(device_queue_, kg_memory_);
|
||||
oneapi_dll_.oneapi_usm_free(device_queue_, kg_memory_device_);
|
||||
|
||||
for (ConstMemMap::iterator mt = const_mem_map_.begin(); mt != const_mem_map_.end(); mt++)
|
||||
delete mt->second;
|
||||
|
||||
if (device_queue_)
|
||||
free_queue(device_queue_);
|
||||
oneapi_dll_.oneapi_free_queue(device_queue_);
|
||||
}
|
||||
|
||||
bool OneapiDevice::check_peer_access(Device * /*peer_device*/)
|
||||
@@ -88,26 +95,18 @@ BVHLayoutMask OneapiDevice::get_bvh_layout_mask() const
|
||||
bool OneapiDevice::load_kernels(const uint requested_features)
|
||||
{
|
||||
assert(device_queue_);
|
||||
/* NOTE(@nsirgien): oneAPI can support compilation of kernel code with certain feature set
|
||||
* with specialization constants, but it hasn't been implemented yet. */
|
||||
(void)requested_features;
|
||||
|
||||
bool is_finished_ok = oneapi_run_test_kernel(device_queue_);
|
||||
bool is_finished_ok = oneapi_dll_.oneapi_run_test_kernel(device_queue_);
|
||||
if (is_finished_ok == false) {
|
||||
set_error("oneAPI test kernel execution: got a runtime exception \"" + oneapi_error_string_ +
|
||||
"\"");
|
||||
return false;
|
||||
set_error("oneAPI kernel load: got runtime exception \"" + oneapi_error_string_ + "\"");
|
||||
}
|
||||
else {
|
||||
VLOG_INFO << "Test kernel has been executed successfully for \"" << info.description << "\"";
|
||||
VLOG_INFO << "Runtime compilation done for \"" << info.description << "\"";
|
||||
assert(device_queue_);
|
||||
}
|
||||
|
||||
is_finished_ok = oneapi_load_kernels(device_queue_, (const unsigned int)requested_features);
|
||||
if (is_finished_ok == false) {
|
||||
set_error("oneAPI kernels loading: got a runtime exception \"" + oneapi_error_string_ + "\"");
|
||||
}
|
||||
else {
|
||||
VLOG_INFO << "Kernels loading (compilation) has been done for \"" << info.description << "\"";
|
||||
}
|
||||
|
||||
return is_finished_ok;
|
||||
}
|
||||
|
||||
@@ -139,7 +138,7 @@ void OneapiDevice::generic_alloc(device_memory &mem)
|
||||
* type has been used for oneAPI device in order to better fit in Cycles architecture. */
|
||||
void *device_pointer = nullptr;
|
||||
if (mem.memory_size() + stats.mem_used < max_memory_on_device_)
|
||||
device_pointer = usm_alloc_device(device_queue_, memory_size);
|
||||
device_pointer = oneapi_dll_.oneapi_usm_alloc_device(device_queue_, memory_size);
|
||||
if (device_pointer == nullptr) {
|
||||
set_error("oneAPI kernel - device memory allocation error for " +
|
||||
string_human_readable_size(mem.memory_size()) +
|
||||
@@ -164,7 +163,8 @@ void OneapiDevice::generic_copy_to(device_memory &mem)
|
||||
/* Copy operation from host shouldn't be requested if there is no memory allocated on host. */
|
||||
assert(mem.host_pointer);
|
||||
assert(device_queue_);
|
||||
usm_memcpy(device_queue_, (void *)mem.device_pointer, (void *)mem.host_pointer, memory_size);
|
||||
oneapi_dll_.oneapi_usm_memcpy(
|
||||
device_queue_, (void *)mem.device_pointer, (void *)mem.host_pointer, memory_size);
|
||||
}
|
||||
|
||||
/* TODO: Make sycl::queue part of OneapiQueue and avoid using pointers to sycl::queue. */
|
||||
@@ -178,6 +178,11 @@ string OneapiDevice::oneapi_error_message()
|
||||
return string(oneapi_error_string_);
|
||||
}
|
||||
|
||||
OneAPIDLLInterface OneapiDevice::oneapi_dll_object()
|
||||
{
|
||||
return oneapi_dll_;
|
||||
}
|
||||
|
||||
void *OneapiDevice::kernel_globals_device_pointer()
|
||||
{
|
||||
return kg_memory_device_;
|
||||
@@ -193,7 +198,7 @@ void OneapiDevice::generic_free(device_memory &mem)
|
||||
mem.device_size = 0;
|
||||
|
||||
assert(device_queue_);
|
||||
usm_free(device_queue_, (void *)mem.device_pointer);
|
||||
oneapi_dll_.oneapi_usm_free(device_queue_, (void *)mem.device_pointer);
|
||||
mem.device_pointer = 0;
|
||||
}
|
||||
|
||||
@@ -261,7 +266,8 @@ void OneapiDevice::mem_copy_from(device_memory &mem, size_t y, size_t w, size_t
|
||||
if (mem.device_pointer) {
|
||||
char *shifted_host = reinterpret_cast<char *>(mem.host_pointer) + offset;
|
||||
char *shifted_device = reinterpret_cast<char *>(mem.device_pointer) + offset;
|
||||
bool is_finished_ok = usm_memcpy(device_queue_, shifted_host, shifted_device, size);
|
||||
bool is_finished_ok = oneapi_dll_.oneapi_usm_memcpy(
|
||||
device_queue_, shifted_host, shifted_device, size);
|
||||
if (is_finished_ok == false) {
|
||||
set_error("oneAPI memory operation error: got runtime exception \"" +
|
||||
oneapi_error_string_ + "\"");
|
||||
@@ -286,7 +292,7 @@ void OneapiDevice::mem_zero(device_memory &mem)
|
||||
}
|
||||
|
||||
assert(device_queue_);
|
||||
bool is_finished_ok = usm_memset(
|
||||
bool is_finished_ok = oneapi_dll_.oneapi_usm_memset(
|
||||
device_queue_, (void *)mem.device_pointer, 0, mem.memory_size());
|
||||
if (is_finished_ok == false) {
|
||||
set_error("oneAPI memory operation error: got runtime exception \"" + oneapi_error_string_ +
|
||||
@@ -343,9 +349,10 @@ void OneapiDevice::const_copy_to(const char *name, void *host, size_t size)
|
||||
memcpy(data->data(), host, size);
|
||||
data->copy_to_device();
|
||||
|
||||
set_global_memory(device_queue_, kg_memory_, name, (void *)data->device_pointer);
|
||||
oneapi_dll_.oneapi_set_global_memory(
|
||||
device_queue_, kg_memory_, name, (void *)data->device_pointer);
|
||||
|
||||
usm_memcpy(device_queue_, kg_memory_device_, kg_memory_, kg_memory_size_);
|
||||
oneapi_dll_.oneapi_usm_memcpy(device_queue_, kg_memory_device_, kg_memory_, kg_memory_size_);
|
||||
}
|
||||
|
||||
void OneapiDevice::global_alloc(device_memory &mem)
|
||||
@@ -360,9 +367,10 @@ void OneapiDevice::global_alloc(device_memory &mem)
|
||||
generic_alloc(mem);
|
||||
generic_copy_to(mem);
|
||||
|
||||
set_global_memory(device_queue_, kg_memory_, mem.name, (void *)mem.device_pointer);
|
||||
oneapi_dll_.oneapi_set_global_memory(
|
||||
device_queue_, kg_memory_, mem.name, (void *)mem.device_pointer);
|
||||
|
||||
usm_memcpy(device_queue_, kg_memory_device_, kg_memory_, kg_memory_size_);
|
||||
oneapi_dll_.oneapi_usm_memcpy(device_queue_, kg_memory_device_, kg_memory_, kg_memory_size_);
|
||||
}
|
||||
|
||||
void OneapiDevice::global_free(device_memory &mem)
|
||||
@@ -402,6 +410,18 @@ unique_ptr<DeviceQueue> OneapiDevice::gpu_queue_create()
|
||||
return make_unique<OneapiDeviceQueue>(this);
|
||||
}
|
||||
|
||||
int OneapiDevice::get_num_multiprocessors()
|
||||
{
|
||||
assert(device_queue_);
|
||||
return oneapi_dll_.oneapi_get_num_multiprocessors(device_queue_);
|
||||
}
|
||||
|
||||
int OneapiDevice::get_max_num_threads_per_multiprocessor()
|
||||
{
|
||||
assert(device_queue_);
|
||||
return oneapi_dll_.oneapi_get_max_num_threads_per_multiprocessor(device_queue_);
|
||||
}
|
||||
|
||||
bool OneapiDevice::should_use_graphics_interop()
|
||||
{
|
||||
/* NOTE(@nsirgien): oneAPI doesn't yet support direct writing into graphics API objects, so
|
||||
@@ -412,465 +432,13 @@ bool OneapiDevice::should_use_graphics_interop()
|
||||
void *OneapiDevice::usm_aligned_alloc_host(size_t memory_size, size_t alignment)
|
||||
{
|
||||
assert(device_queue_);
|
||||
return usm_aligned_alloc_host(device_queue_, memory_size, alignment);
|
||||
return oneapi_dll_.oneapi_usm_aligned_alloc_host(device_queue_, memory_size, alignment);
|
||||
}
|
||||
|
||||
void OneapiDevice::usm_free(void *usm_ptr)
|
||||
{
|
||||
assert(device_queue_);
|
||||
return usm_free(device_queue_, usm_ptr);
|
||||
}
|
||||
|
||||
void OneapiDevice::check_usm(SyclQueue *queue_, const void *usm_ptr, bool allow_host = false)
|
||||
{
|
||||
# ifdef _DEBUG
|
||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||
sycl::info::device_type device_type =
|
||||
queue->get_device().get_info<sycl::info::device::device_type>();
|
||||
sycl::usm::alloc usm_type = get_pointer_type(usm_ptr, queue->get_context());
|
||||
(void)usm_type;
|
||||
assert(usm_type == sycl::usm::alloc::device ||
|
||||
((device_type == sycl::info::device_type::host ||
|
||||
device_type == sycl::info::device_type::cpu || allow_host) &&
|
||||
usm_type == sycl::usm::alloc::host));
|
||||
# else
|
||||
/* Silence warning about unused arguments. */
|
||||
(void)queue_;
|
||||
(void)usm_ptr;
|
||||
(void)allow_host;
|
||||
# endif
|
||||
}
|
||||
|
||||
bool OneapiDevice::create_queue(SyclQueue *&external_queue, int device_index)
|
||||
{
|
||||
bool finished_correct = true;
|
||||
try {
|
||||
std::vector<sycl::device> devices = OneapiDevice::available_devices();
|
||||
if (device_index < 0 || device_index >= devices.size()) {
|
||||
return false;
|
||||
}
|
||||
sycl::queue *created_queue = new sycl::queue(devices[device_index],
|
||||
sycl::property::queue::in_order());
|
||||
external_queue = reinterpret_cast<SyclQueue *>(created_queue);
|
||||
}
|
||||
catch (sycl::exception const &e) {
|
||||
finished_correct = false;
|
||||
oneapi_error_string_ = e.what();
|
||||
}
|
||||
return finished_correct;
|
||||
}
|
||||
|
||||
void OneapiDevice::free_queue(SyclQueue *queue_)
|
||||
{
|
||||
assert(queue_);
|
||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||
delete queue;
|
||||
}
|
||||
|
||||
void *OneapiDevice::usm_aligned_alloc_host(SyclQueue *queue_, size_t memory_size, size_t alignment)
|
||||
{
|
||||
assert(queue_);
|
||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||
return sycl::aligned_alloc_host(alignment, memory_size, *queue);
|
||||
}
|
||||
|
||||
void *OneapiDevice::usm_alloc_device(SyclQueue *queue_, size_t memory_size)
|
||||
{
|
||||
assert(queue_);
|
||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||
return sycl::malloc_device(memory_size, *queue);
|
||||
}
|
||||
|
||||
void OneapiDevice::usm_free(SyclQueue *queue_, void *usm_ptr)
|
||||
{
|
||||
assert(queue_);
|
||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||
OneapiDevice::check_usm(queue_, usm_ptr, true);
|
||||
sycl::free(usm_ptr, *queue);
|
||||
}
|
||||
|
||||
bool OneapiDevice::usm_memcpy(SyclQueue *queue_, void *dest, void *src, size_t num_bytes)
|
||||
{
|
||||
assert(queue_);
|
||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||
OneapiDevice::check_usm(queue_, dest, true);
|
||||
OneapiDevice::check_usm(queue_, src, true);
|
||||
sycl::event mem_event = queue->memcpy(dest, src, num_bytes);
|
||||
# ifdef WITH_CYCLES_DEBUG
|
||||
try {
|
||||
/* NOTE(@nsirgien) Waiting on memory operation may give more precise error
|
||||
* messages. Due to impact on occupancy, it makes sense to enable it only during Cycles debug.
|
||||
*/
|
||||
mem_event.wait_and_throw();
|
||||
return true;
|
||||
}
|
||||
catch (sycl::exception const &e) {
|
||||
oneapi_error_string_ = e.what();
|
||||
return false;
|
||||
}
|
||||
# else
|
||||
sycl::usm::alloc dest_type = get_pointer_type(dest, queue->get_context());
|
||||
sycl::usm::alloc src_type = get_pointer_type(src, queue->get_context());
|
||||
bool from_device_to_host = dest_type == sycl::usm::alloc::host &&
|
||||
src_type == sycl::usm::alloc::device;
|
||||
bool host_or_device_memop_with_offset = dest_type == sycl::usm::alloc::unknown ||
|
||||
src_type == sycl::usm::alloc::unknown;
|
||||
/* NOTE(@sirgienko) Host-side blocking wait on this operation is mandatory, otherwise the host
|
||||
* may not wait until the end of the transfer before using the memory.
|
||||
*/
|
||||
if (from_device_to_host || host_or_device_memop_with_offset)
|
||||
mem_event.wait();
|
||||
return true;
|
||||
# endif
|
||||
}
|
||||
|
||||
bool OneapiDevice::usm_memset(SyclQueue *queue_,
|
||||
void *usm_ptr,
|
||||
unsigned char value,
|
||||
size_t num_bytes)
|
||||
{
|
||||
assert(queue_);
|
||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||
OneapiDevice::check_usm(queue_, usm_ptr, true);
|
||||
sycl::event mem_event = queue->memset(usm_ptr, value, num_bytes);
|
||||
# ifdef WITH_CYCLES_DEBUG
|
||||
try {
|
||||
/* NOTE(@nsirgien) Waiting on memory operation may give more precise error
|
||||
* messages. Due to impact on occupancy, it makes sense to enable it only during Cycles debug.
|
||||
*/
|
||||
mem_event.wait_and_throw();
|
||||
return true;
|
||||
}
|
||||
catch (sycl::exception const &e) {
|
||||
oneapi_error_string_ = e.what();
|
||||
return false;
|
||||
}
|
||||
# else
|
||||
(void)mem_event;
|
||||
return true;
|
||||
# endif
|
||||
}
|
||||
|
||||
bool OneapiDevice::queue_synchronize(SyclQueue *queue_)
|
||||
{
|
||||
assert(queue_);
|
||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(queue_);
|
||||
try {
|
||||
queue->wait_and_throw();
|
||||
return true;
|
||||
}
|
||||
catch (sycl::exception const &e) {
|
||||
oneapi_error_string_ = e.what();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool OneapiDevice::kernel_globals_size(size_t &kernel_global_size)
|
||||
{
|
||||
kernel_global_size = sizeof(KernelGlobalsGPU);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OneapiDevice::set_global_memory(SyclQueue *queue_,
|
||||
void *kernel_globals,
|
||||
const char *memory_name,
|
||||
void *memory_device_pointer)
|
||||
{
|
||||
assert(queue_);
|
||||
assert(kernel_globals);
|
||||
assert(memory_name);
|
||||
assert(memory_device_pointer);
|
||||
KernelGlobalsGPU *globals = (KernelGlobalsGPU *)kernel_globals;
|
||||
OneapiDevice::check_usm(queue_, memory_device_pointer);
|
||||
OneapiDevice::check_usm(queue_, kernel_globals, true);
|
||||
|
||||
std::string matched_name(memory_name);
|
||||
|
||||
/* This macro will change global ptr of KernelGlobals via name matching. */
|
||||
# define KERNEL_DATA_ARRAY(type, name) \
|
||||
else if (#name == matched_name) \
|
||||
{ \
|
||||
globals->__##name = (type *)memory_device_pointer; \
|
||||
return; \
|
||||
}
|
||||
if (false) {
|
||||
}
|
||||
else if ("integrator_state" == matched_name) {
|
||||
globals->integrator_state = (IntegratorStateGPU *)memory_device_pointer;
|
||||
return;
|
||||
}
|
||||
KERNEL_DATA_ARRAY(KernelData, data)
|
||||
# include "kernel/data_arrays.h"
|
||||
else
|
||||
{
|
||||
std::cerr << "Can't found global/constant memory with name \"" << matched_name << "\"!"
|
||||
<< std::endl;
|
||||
assert(false);
|
||||
}
|
||||
# undef KERNEL_DATA_ARRAY
|
||||
}
|
||||
|
||||
bool OneapiDevice::enqueue_kernel(KernelContext *kernel_context,
|
||||
int kernel,
|
||||
size_t global_size,
|
||||
void **args)
|
||||
{
|
||||
return oneapi_enqueue_kernel(kernel_context, kernel, global_size, args);
|
||||
}
|
||||
|
||||
/* Compute-runtime (ie. NEO) version is what gets returned by sycl/L0 on Windows
|
||||
* since Windows driver 101.3268. */
|
||||
/* The same min compute-runtime version is currently required across Windows and Linux.
|
||||
* For Windows driver 101.3430, compute-runtime version is 23904. */
|
||||
static const int lowest_supported_driver_version_win = 1013430;
|
||||
static const int lowest_supported_driver_version_neo = 23904;
|
||||
|
||||
int OneapiDevice::parse_driver_build_version(const sycl::device &device)
|
||||
{
|
||||
const std::string &driver_version = device.get_info<sycl::info::device::driver_version>();
|
||||
int driver_build_version = 0;
|
||||
|
||||
size_t second_dot_position = driver_version.find('.', driver_version.find('.') + 1);
|
||||
if (second_dot_position == std::string::npos) {
|
||||
std::cerr << "Unable to parse unknown Intel GPU driver version \"" << driver_version
|
||||
<< "\" does not match xx.xx.xxxxx (Linux), x.x.xxxx (L0),"
|
||||
<< " xx.xx.xxx.xxxx (Windows) for device \""
|
||||
<< device.get_info<sycl::info::device::name>() << "\"." << std::endl;
|
||||
}
|
||||
else {
|
||||
try {
|
||||
size_t third_dot_position = driver_version.find('.', second_dot_position + 1);
|
||||
if (third_dot_position != std::string::npos) {
|
||||
const std::string &third_number_substr = driver_version.substr(
|
||||
second_dot_position + 1, third_dot_position - second_dot_position - 1);
|
||||
const std::string &forth_number_substr = driver_version.substr(third_dot_position + 1);
|
||||
if (third_number_substr.length() == 3 && forth_number_substr.length() == 4)
|
||||
driver_build_version = std::stoi(third_number_substr) * 10000 +
|
||||
std::stoi(forth_number_substr);
|
||||
}
|
||||
else {
|
||||
const std::string &third_number_substr = driver_version.substr(second_dot_position + 1);
|
||||
driver_build_version = std::stoi(third_number_substr);
|
||||
}
|
||||
}
|
||||
catch (std::invalid_argument &) {
|
||||
std::cerr << "Unable to parse unknown Intel GPU driver version \"" << driver_version
|
||||
<< "\" does not match xx.xx.xxxxx (Linux), x.x.xxxx (L0),"
|
||||
<< " xx.xx.xxx.xxxx (Windows) for device \""
|
||||
<< device.get_info<sycl::info::device::name>() << "\"." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return driver_build_version;
|
||||
}
|
||||
|
||||
std::vector<sycl::device> OneapiDevice::available_devices()
|
||||
{
|
||||
bool allow_all_devices = false;
|
||||
if (getenv("CYCLES_ONEAPI_ALL_DEVICES") != nullptr)
|
||||
allow_all_devices = true;
|
||||
|
||||
/* Host device is useful only for debugging at the moment
|
||||
* so we hide this device with default build settings. */
|
||||
# ifdef WITH_ONEAPI_SYCL_HOST_ENABLED
|
||||
bool allow_host = true;
|
||||
# else
|
||||
bool allow_host = false;
|
||||
# endif
|
||||
|
||||
const std::vector<sycl::platform> &oneapi_platforms = sycl::platform::get_platforms();
|
||||
|
||||
std::vector<sycl::device> available_devices;
|
||||
for (const sycl::platform &platform : oneapi_platforms) {
|
||||
/* ignore OpenCL platforms to avoid using the same devices through both Level-Zero and OpenCL.
|
||||
*/
|
||||
if (platform.get_backend() == sycl::backend::opencl) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const std::vector<sycl::device> &oneapi_devices =
|
||||
(allow_all_devices || allow_host) ? platform.get_devices(sycl::info::device_type::all) :
|
||||
platform.get_devices(sycl::info::device_type::gpu);
|
||||
|
||||
for (const sycl::device &device : oneapi_devices) {
|
||||
if (allow_all_devices) {
|
||||
/* still filter out host device if build doesn't support it. */
|
||||
if (allow_host || !device.is_host()) {
|
||||
available_devices.push_back(device);
|
||||
}
|
||||
}
|
||||
else {
|
||||
bool filter_out = false;
|
||||
|
||||
/* For now we support all Intel(R) Arc(TM) devices and likely any future GPU,
|
||||
* assuming they have either more than 96 Execution Units or not 7 threads per EU.
|
||||
* Official support can be broaden to older and smaller GPUs once ready. */
|
||||
if (device.is_gpu() && platform.get_backend() == sycl::backend::ext_oneapi_level_zero) {
|
||||
/* Filtered-out defaults in-case these values aren't available through too old L0
|
||||
* runtime. */
|
||||
int number_of_eus = 96;
|
||||
int threads_per_eu = 7;
|
||||
if (device.has(sycl::aspect::ext_intel_gpu_eu_count)) {
|
||||
number_of_eus = device.get_info<sycl::info::device::ext_intel_gpu_eu_count>();
|
||||
}
|
||||
if (device.has(sycl::aspect::ext_intel_gpu_hw_threads_per_eu)) {
|
||||
threads_per_eu =
|
||||
device.get_info<sycl::info::device::ext_intel_gpu_hw_threads_per_eu>();
|
||||
}
|
||||
/* This filters out all Level-Zero supported GPUs from older generation than Arc. */
|
||||
if (number_of_eus <= 96 && threads_per_eu == 7) {
|
||||
filter_out = true;
|
||||
}
|
||||
/* if not already filtered out, check driver version. */
|
||||
if (!filter_out) {
|
||||
int driver_build_version = parse_driver_build_version(device);
|
||||
if ((driver_build_version > 100000 &&
|
||||
driver_build_version < lowest_supported_driver_version_win) ||
|
||||
driver_build_version < lowest_supported_driver_version_neo) {
|
||||
filter_out = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!allow_host && device.is_host()) {
|
||||
filter_out = true;
|
||||
}
|
||||
else if (!allow_all_devices) {
|
||||
filter_out = true;
|
||||
}
|
||||
|
||||
if (!filter_out) {
|
||||
available_devices.push_back(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return available_devices;
|
||||
}
|
||||
|
||||
char *OneapiDevice::device_capabilities()
|
||||
{
|
||||
std::stringstream capabilities;
|
||||
|
||||
const std::vector<sycl::device> &oneapi_devices = available_devices();
|
||||
for (const sycl::device &device : oneapi_devices) {
|
||||
const std::string &name = device.get_info<sycl::info::device::name>();
|
||||
|
||||
capabilities << std::string("\t") << name << "\n";
|
||||
# define WRITE_ATTR(attribute_name, attribute_variable) \
|
||||
capabilities << "\t\tsycl::info::device::" #attribute_name "\t\t\t" << attribute_variable \
|
||||
<< "\n";
|
||||
# define GET_NUM_ATTR(attribute) \
|
||||
{ \
|
||||
size_t attribute = (size_t)device.get_info<sycl::info::device ::attribute>(); \
|
||||
capabilities << "\t\tsycl::info::device::" #attribute "\t\t\t" << attribute << "\n"; \
|
||||
}
|
||||
|
||||
GET_NUM_ATTR(vendor_id)
|
||||
GET_NUM_ATTR(max_compute_units)
|
||||
GET_NUM_ATTR(max_work_item_dimensions)
|
||||
|
||||
sycl::id<3> max_work_item_sizes =
|
||||
device.get_info<sycl::info::device::max_work_item_sizes<3>>();
|
||||
WRITE_ATTR("max_work_item_sizes_dim0", ((size_t)max_work_item_sizes.get(0)))
|
||||
WRITE_ATTR("max_work_item_sizes_dim1", ((size_t)max_work_item_sizes.get(1)))
|
||||
WRITE_ATTR("max_work_item_sizes_dim2", ((size_t)max_work_item_sizes.get(2)))
|
||||
|
||||
GET_NUM_ATTR(max_work_group_size)
|
||||
GET_NUM_ATTR(max_num_sub_groups)
|
||||
GET_NUM_ATTR(sub_group_independent_forward_progress)
|
||||
|
||||
GET_NUM_ATTR(preferred_vector_width_char)
|
||||
GET_NUM_ATTR(preferred_vector_width_short)
|
||||
GET_NUM_ATTR(preferred_vector_width_int)
|
||||
GET_NUM_ATTR(preferred_vector_width_long)
|
||||
GET_NUM_ATTR(preferred_vector_width_float)
|
||||
GET_NUM_ATTR(preferred_vector_width_double)
|
||||
GET_NUM_ATTR(preferred_vector_width_half)
|
||||
|
||||
GET_NUM_ATTR(native_vector_width_char)
|
||||
GET_NUM_ATTR(native_vector_width_short)
|
||||
GET_NUM_ATTR(native_vector_width_int)
|
||||
GET_NUM_ATTR(native_vector_width_long)
|
||||
GET_NUM_ATTR(native_vector_width_float)
|
||||
GET_NUM_ATTR(native_vector_width_double)
|
||||
GET_NUM_ATTR(native_vector_width_half)
|
||||
|
||||
size_t max_clock_frequency =
|
||||
(size_t)(device.is_host() ? (size_t)0 :
|
||||
device.get_info<sycl::info::device::max_clock_frequency>());
|
||||
WRITE_ATTR("max_clock_frequency", max_clock_frequency)
|
||||
|
||||
GET_NUM_ATTR(address_bits)
|
||||
GET_NUM_ATTR(max_mem_alloc_size)
|
||||
|
||||
/* NOTE(@nsirgien): Implementation doesn't use image support as bindless images aren't
|
||||
* supported so we always return false, even if device supports HW texture usage acceleration.
|
||||
*/
|
||||
bool image_support = false;
|
||||
WRITE_ATTR("image_support", (size_t)image_support)
|
||||
|
||||
GET_NUM_ATTR(max_parameter_size)
|
||||
GET_NUM_ATTR(mem_base_addr_align)
|
||||
GET_NUM_ATTR(global_mem_size)
|
||||
GET_NUM_ATTR(local_mem_size)
|
||||
GET_NUM_ATTR(error_correction_support)
|
||||
GET_NUM_ATTR(profiling_timer_resolution)
|
||||
GET_NUM_ATTR(is_available)
|
||||
|
||||
# undef GET_NUM_ATTR
|
||||
# undef WRITE_ATTR
|
||||
capabilities << "\n";
|
||||
}
|
||||
|
||||
return ::strdup(capabilities.str().c_str());
|
||||
}
|
||||
|
||||
void OneapiDevice::iterate_devices(OneAPIDeviceIteratorCallback cb, void *user_ptr)
|
||||
{
|
||||
int num = 0;
|
||||
std::vector<sycl::device> devices = OneapiDevice::available_devices();
|
||||
for (sycl::device &device : devices) {
|
||||
const std::string &platform_name =
|
||||
device.get_platform().get_info<sycl::info::platform::name>();
|
||||
std::string name = device.get_info<sycl::info::device::name>();
|
||||
std::string id = "ONEAPI_" + platform_name + "_" + name;
|
||||
if (device.has(sycl::aspect::ext_intel_pci_address)) {
|
||||
id.append("_" + device.get_info<sycl::info::device::ext_intel_pci_address>());
|
||||
}
|
||||
(cb)(id.c_str(), name.c_str(), num, user_ptr);
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
size_t OneapiDevice::get_memcapacity()
|
||||
{
|
||||
return reinterpret_cast<sycl::queue *>(device_queue_)
|
||||
->get_device()
|
||||
.get_info<sycl::info::device::global_mem_size>();
|
||||
}
|
||||
|
||||
int OneapiDevice::get_num_multiprocessors()
|
||||
{
|
||||
const sycl::device &device = reinterpret_cast<sycl::queue *>(device_queue_)->get_device();
|
||||
if (device.has(sycl::aspect::ext_intel_gpu_eu_count)) {
|
||||
return device.get_info<sycl::info::device::ext_intel_gpu_eu_count>();
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int OneapiDevice::get_max_num_threads_per_multiprocessor()
|
||||
{
|
||||
const sycl::device &device = reinterpret_cast<sycl::queue *>(device_queue_)->get_device();
|
||||
if (device.has(sycl::aspect::ext_intel_gpu_eu_simd_width) &&
|
||||
device.has(sycl::aspect::ext_intel_gpu_hw_threads_per_eu)) {
|
||||
return device.get_info<sycl::info::device::ext_intel_gpu_eu_simd_width>() *
|
||||
device.get_info<sycl::info::device::ext_intel_gpu_hw_threads_per_eu>();
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
return oneapi_dll_.oneapi_usm_free(device_queue_, usm_ptr);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -3,12 +3,9 @@
|
||||
|
||||
#ifdef WITH_ONEAPI
|
||||
|
||||
# include <CL/sycl.hpp>
|
||||
|
||||
# include "device/device.h"
|
||||
# include "device/oneapi/device.h"
|
||||
# include "device/oneapi/queue.h"
|
||||
# include "kernel/device/oneapi/kernel.h"
|
||||
|
||||
# include "util/map.h"
|
||||
|
||||
@@ -16,11 +13,6 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
class DeviceQueue;
|
||||
|
||||
typedef void (*OneAPIDeviceIteratorCallback)(const char *id,
|
||||
const char *name,
|
||||
int num,
|
||||
void *user_ptr);
|
||||
|
||||
class OneapiDevice : public Device {
|
||||
private:
|
||||
SyclQueue *device_queue_;
|
||||
@@ -33,12 +25,16 @@ class OneapiDevice : public Device {
|
||||
void *kg_memory_device_;
|
||||
size_t kg_memory_size_ = (size_t)0;
|
||||
size_t max_memory_on_device_ = (size_t)0;
|
||||
OneAPIDLLInterface oneapi_dll_;
|
||||
std::string oneapi_error_string_;
|
||||
|
||||
public:
|
||||
virtual BVHLayoutMask get_bvh_layout_mask() const override;
|
||||
|
||||
OneapiDevice(const DeviceInfo &info, Stats &stats, Profiler &profiler);
|
||||
OneapiDevice(const DeviceInfo &info,
|
||||
OneAPIDLLInterface &oneapi_dll_object,
|
||||
Stats &stats,
|
||||
Profiler &profiler);
|
||||
|
||||
virtual ~OneapiDevice();
|
||||
|
||||
@@ -54,8 +50,12 @@ class OneapiDevice : public Device {
|
||||
|
||||
void generic_free(device_memory &mem);
|
||||
|
||||
SyclQueue *sycl_queue();
|
||||
|
||||
string oneapi_error_message();
|
||||
|
||||
OneAPIDLLInterface oneapi_dll_object();
|
||||
|
||||
void *kernel_globals_device_pointer();
|
||||
|
||||
void mem_alloc(device_memory &mem) override;
|
||||
@@ -90,37 +90,13 @@ class OneapiDevice : public Device {
|
||||
|
||||
virtual unique_ptr<DeviceQueue> gpu_queue_create() override;
|
||||
|
||||
int get_num_multiprocessors();
|
||||
int get_max_num_threads_per_multiprocessor();
|
||||
|
||||
/* NOTE(@nsirgien): Create this methods to avoid some compilation problems on Windows with host
|
||||
* side compilation (MSVC). */
|
||||
void *usm_aligned_alloc_host(size_t memory_size, size_t alignment);
|
||||
void usm_free(void *usm_ptr);
|
||||
|
||||
static std::vector<sycl::device> available_devices();
|
||||
static char *device_capabilities();
|
||||
static int parse_driver_build_version(const sycl::device &device);
|
||||
static void iterate_devices(OneAPIDeviceIteratorCallback cb, void *user_ptr);
|
||||
|
||||
size_t get_memcapacity();
|
||||
int get_num_multiprocessors();
|
||||
int get_max_num_threads_per_multiprocessor();
|
||||
bool queue_synchronize(SyclQueue *queue);
|
||||
bool kernel_globals_size(size_t &kernel_global_size);
|
||||
void set_global_memory(SyclQueue *queue,
|
||||
void *kernel_globals,
|
||||
const char *memory_name,
|
||||
void *memory_device_pointer);
|
||||
bool enqueue_kernel(KernelContext *kernel_context, int kernel, size_t global_size, void **args);
|
||||
SyclQueue *sycl_queue();
|
||||
|
||||
protected:
|
||||
void check_usm(SyclQueue *queue, const void *usm_ptr, bool allow_host);
|
||||
bool create_queue(SyclQueue *&external_queue, int device_index);
|
||||
void free_queue(SyclQueue *queue);
|
||||
void *usm_aligned_alloc_host(SyclQueue *queue, size_t memory_size, size_t alignment);
|
||||
void *usm_alloc_device(SyclQueue *queue, size_t memory_size);
|
||||
void usm_free(SyclQueue *queue, void *usm_ptr);
|
||||
bool usm_memcpy(SyclQueue *queue, void *dest, void *src, size_t num_bytes);
|
||||
bool usm_memset(SyclQueue *queue, void *usm_ptr, unsigned char value, size_t num_bytes);
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
17
intern/cycles/device/oneapi/dll_interface.h
Normal file
17
intern/cycles/device/oneapi/dll_interface.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/* SPDX-License-Identifier: Apache-2.0
|
||||
* Copyright 2011-2022 Blender Foundation */
|
||||
|
||||
#pragma once
|
||||
|
||||
/* Include kernel header to get access to SYCL-specific types, like SyclQueue and
|
||||
* OneAPIDeviceIteratorCallback. */
|
||||
#include "kernel/device/oneapi/kernel.h"
|
||||
|
||||
#ifdef WITH_ONEAPI
|
||||
struct OneAPIDLLInterface {
|
||||
# define DLL_INTERFACE_CALL(function, return_type, ...) \
|
||||
return_type (*function)(__VA_ARGS__) = nullptr;
|
||||
# include "kernel/device/oneapi/dll_interface_template.h"
|
||||
# undef DLL_INTERFACE_CALL
|
||||
};
|
||||
#endif
|
@@ -22,7 +22,10 @@ struct KernelExecutionInfo {
|
||||
/* OneapiDeviceQueue */
|
||||
|
||||
OneapiDeviceQueue::OneapiDeviceQueue(OneapiDevice *device)
|
||||
: DeviceQueue(device), oneapi_device_(device), kernel_context_(nullptr)
|
||||
: DeviceQueue(device),
|
||||
oneapi_device_(device),
|
||||
oneapi_dll_(device->oneapi_dll_object()),
|
||||
kernel_context_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -74,18 +77,18 @@ bool OneapiDeviceQueue::enqueue(DeviceKernel kernel,
|
||||
|
||||
void **args = const_cast<void **>(_args.values);
|
||||
|
||||
debug_enqueue_begin(kernel, signed_kernel_work_size);
|
||||
debug_enqueue(kernel, signed_kernel_work_size);
|
||||
assert(signed_kernel_work_size >= 0);
|
||||
size_t kernel_work_size = (size_t)signed_kernel_work_size;
|
||||
|
||||
size_t kernel_local_size = oneapi_kernel_preferred_local_size(
|
||||
size_t kernel_local_size = oneapi_dll_.oneapi_kernel_preferred_local_size(
|
||||
kernel_context_->queue, (::DeviceKernel)kernel, kernel_work_size);
|
||||
size_t uniformed_kernel_work_size = round_up(kernel_work_size, kernel_local_size);
|
||||
|
||||
assert(kernel_context_);
|
||||
|
||||
/* Call the oneAPI kernel DLL to launch the requested kernel. */
|
||||
bool is_finished_ok = oneapi_device_->enqueue_kernel(
|
||||
bool is_finished_ok = oneapi_dll_.oneapi_enqueue_kernel(
|
||||
kernel_context_, kernel, uniformed_kernel_work_size, args);
|
||||
|
||||
if (is_finished_ok == false) {
|
||||
@@ -94,8 +97,6 @@ bool OneapiDeviceQueue::enqueue(DeviceKernel kernel,
|
||||
oneapi_device_->oneapi_error_message() + "\"");
|
||||
}
|
||||
|
||||
debug_enqueue_end();
|
||||
|
||||
return is_finished_ok;
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ bool OneapiDeviceQueue::synchronize()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_finished_ok = oneapi_device_->queue_synchronize(oneapi_device_->sycl_queue());
|
||||
bool is_finished_ok = oneapi_dll_.oneapi_queue_synchronize(oneapi_device_->sycl_queue());
|
||||
if (is_finished_ok == false)
|
||||
oneapi_device_->set_error("oneAPI unknown kernel execution error: got runtime exception \"" +
|
||||
oneapi_device_->oneapi_error_message() + "\"");
|
||||
|
@@ -10,7 +10,7 @@
|
||||
# include "device/queue.h"
|
||||
|
||||
# include "device/oneapi/device.h"
|
||||
# include "kernel/device/oneapi/kernel.h"
|
||||
# include "device/oneapi/dll_interface.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
@@ -41,7 +41,9 @@ class OneapiDeviceQueue : public DeviceQueue {
|
||||
|
||||
protected:
|
||||
OneapiDevice *oneapi_device_;
|
||||
OneAPIDLLInterface oneapi_dll_;
|
||||
KernelContext *kernel_context_;
|
||||
bool with_kernel_statistics_;
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -46,7 +46,7 @@ bool OptiXDeviceQueue::enqueue(DeviceKernel kernel,
|
||||
return false;
|
||||
}
|
||||
|
||||
debug_enqueue_begin(kernel, work_size);
|
||||
debug_enqueue(kernel, work_size);
|
||||
|
||||
const CUDAContextScope scope(cuda_device_);
|
||||
|
||||
@@ -131,8 +131,6 @@ bool OptiXDeviceQueue::enqueue(DeviceKernel kernel,
|
||||
1,
|
||||
1));
|
||||
|
||||
debug_enqueue_end();
|
||||
|
||||
return !(optix_device->have_error());
|
||||
}
|
||||
|
||||
|
@@ -12,13 +12,9 @@
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
DeviceQueue::DeviceQueue(Device *device)
|
||||
: device(device),
|
||||
last_kernels_enqueued_(0),
|
||||
last_sync_time_(0.0),
|
||||
is_per_kernel_performance_(false)
|
||||
: device(device), last_kernels_enqueued_(0), last_sync_time_(0.0)
|
||||
{
|
||||
DCHECK_NE(device, nullptr);
|
||||
is_per_kernel_performance_ = getenv("CYCLES_DEBUG_PER_KERNEL_PERFORMANCE");
|
||||
}
|
||||
|
||||
DeviceQueue::~DeviceQueue()
|
||||
@@ -37,17 +33,11 @@ DeviceQueue::~DeviceQueue()
|
||||
});
|
||||
|
||||
VLOG_DEVICE_STATS << "GPU queue stats:";
|
||||
double total_time = 0.0;
|
||||
for (const auto &[mask, time] : stats_sorted) {
|
||||
total_time += time;
|
||||
VLOG_DEVICE_STATS << " " << std::setfill(' ') << std::setw(10) << std::fixed
|
||||
<< std::setprecision(5) << std::right << time
|
||||
<< "s: " << device_kernel_mask_as_string(mask);
|
||||
}
|
||||
|
||||
if (is_per_kernel_performance_)
|
||||
VLOG_DEVICE_STATS << "GPU queue total time: " << std::fixed << std::setprecision(5)
|
||||
<< total_time;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +50,7 @@ void DeviceQueue::debug_init_execution()
|
||||
last_kernels_enqueued_ = 0;
|
||||
}
|
||||
|
||||
void DeviceQueue::debug_enqueue_begin(DeviceKernel kernel, const int work_size)
|
||||
void DeviceQueue::debug_enqueue(DeviceKernel kernel, const int work_size)
|
||||
{
|
||||
if (VLOG_DEVICE_STATS_IS_ON) {
|
||||
VLOG_DEVICE_STATS << "GPU queue launch " << device_kernel_as_string(kernel) << ", work_size "
|
||||
@@ -70,13 +60,6 @@ void DeviceQueue::debug_enqueue_begin(DeviceKernel kernel, const int work_size)
|
||||
last_kernels_enqueued_ |= (uint64_t(1) << (uint64_t)kernel);
|
||||
}
|
||||
|
||||
void DeviceQueue::debug_enqueue_end()
|
||||
{
|
||||
if (VLOG_DEVICE_STATS_IS_ON && is_per_kernel_performance_) {
|
||||
synchronize();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceQueue::debug_synchronize()
|
||||
{
|
||||
if (VLOG_DEVICE_STATS_IS_ON) {
|
||||
@@ -84,11 +67,7 @@ void DeviceQueue::debug_synchronize()
|
||||
const double elapsed_time = new_time - last_sync_time_;
|
||||
VLOG_DEVICE_STATS << "GPU queue synchronize, elapsed " << std::setw(10) << elapsed_time << "s";
|
||||
|
||||
/* There is no sense to have an entries in the performance data
|
||||
* container without related kernel information. */
|
||||
if (last_kernels_enqueued_ != 0) {
|
||||
stats_kernel_time_[last_kernels_enqueued_] += elapsed_time;
|
||||
}
|
||||
stats_kernel_time_[last_kernels_enqueued_] += elapsed_time;
|
||||
|
||||
last_sync_time_ = new_time;
|
||||
}
|
||||
|
@@ -162,8 +162,7 @@ class DeviceQueue {
|
||||
|
||||
/* Implementations call these from the corresponding methods to generate debugging logs. */
|
||||
void debug_init_execution();
|
||||
void debug_enqueue_begin(DeviceKernel kernel, const int work_size);
|
||||
void debug_enqueue_end();
|
||||
void debug_enqueue(DeviceKernel kernel, const int work_size);
|
||||
void debug_synchronize();
|
||||
string debug_active_kernels();
|
||||
|
||||
@@ -173,9 +172,6 @@ class DeviceQueue {
|
||||
double last_sync_time_;
|
||||
/* Accumulated execution time for combinations of kernels launched together. */
|
||||
map<DeviceKernelMask, double> stats_kernel_time_;
|
||||
/* If it is true, then a performance statistics in the debugging logs will have focus on kernels
|
||||
* and an explicit queue synchronization will be added after each kernel execution. */
|
||||
bool is_per_kernel_performance_;
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -65,12 +65,6 @@ if(WITH_OPENIMAGEDENOISE)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES_PATH_GUIDING)
|
||||
list(APPEND LIB
|
||||
${OPENPGL_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
include_directories(${INC})
|
||||
include_directories(SYSTEM ${INC_SYS})
|
||||
|
||||
|
@@ -1,32 +0,0 @@
|
||||
/* SPDX-License-Identifier: Apache-2.0
|
||||
* Copyright 2011-2022 Blender Foundation */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "kernel/types.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
struct GuidingParams {
|
||||
/* The subset of path guiding parameters that can trigger a creation/rebuild
|
||||
* of the guiding field. */
|
||||
bool use = false;
|
||||
bool use_surface_guiding = false;
|
||||
bool use_volume_guiding = false;
|
||||
|
||||
GuidingDistributionType type = GUIDING_TYPE_PARALLAX_AWARE_VMM;
|
||||
int training_samples = 128;
|
||||
bool deterministic = false;
|
||||
|
||||
GuidingParams() = default;
|
||||
|
||||
bool modified(const GuidingParams &other) const
|
||||
{
|
||||
return !((use == other.use) && (use_surface_guiding == other.use_surface_guiding) &&
|
||||
(use_volume_guiding == other.use_volume_guiding) && (type == other.type) &&
|
||||
(training_samples == other.training_samples) &&
|
||||
(deterministic == other.deterministic));
|
||||
}
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
@@ -43,11 +43,8 @@ PathTrace::PathTrace(Device *device,
|
||||
/* Create path tracing work in advance, so that it can be reused by incremental sampling as much
|
||||
* as possible. */
|
||||
device_->foreach_device([&](Device *path_trace_device) {
|
||||
unique_ptr<PathTraceWork> work = PathTraceWork::create(
|
||||
path_trace_device, film, device_scene, &render_cancel_.is_requested);
|
||||
if (work) {
|
||||
path_trace_works_.emplace_back(std::move(work));
|
||||
}
|
||||
path_trace_works_.emplace_back(PathTraceWork::create(
|
||||
path_trace_device, film, device_scene, &render_cancel_.is_requested));
|
||||
});
|
||||
|
||||
work_balance_infos_.resize(path_trace_works_.size());
|
||||
@@ -188,25 +185,11 @@ void PathTrace::render_pipeline(RenderWork render_work)
|
||||
|
||||
rebalance(render_work);
|
||||
|
||||
/* Prepare all per-thread guiding structures before we start with the next rendering
|
||||
* iteration/progression. */
|
||||
const bool use_guiding = device_scene_->data.integrator.use_guiding;
|
||||
if (use_guiding) {
|
||||
guiding_prepare_structures();
|
||||
}
|
||||
|
||||
path_trace(render_work);
|
||||
if (render_cancel_.is_requested) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Update the guiding field using the training data/samples collected during the rendering
|
||||
* iteration/progression. */
|
||||
const bool train_guiding = device_scene_->data.integrator.train_guiding;
|
||||
if (use_guiding && train_guiding) {
|
||||
guiding_update_structures();
|
||||
}
|
||||
|
||||
adaptive_sample(render_work);
|
||||
if (render_cancel_.is_requested) {
|
||||
return;
|
||||
@@ -1258,122 +1241,4 @@ string PathTrace::full_report() const
|
||||
return result;
|
||||
}
|
||||
|
||||
void PathTrace::set_guiding_params(const GuidingParams &guiding_params, const bool reset)
|
||||
{
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
if (guiding_params_.modified(guiding_params)) {
|
||||
guiding_params_ = guiding_params;
|
||||
|
||||
if (guiding_params_.use) {
|
||||
PGLFieldArguments field_args;
|
||||
switch (guiding_params_.type) {
|
||||
default:
|
||||
/* Parallax-aware von Mises-Fisher mixture models. */
|
||||
case GUIDING_TYPE_PARALLAX_AWARE_VMM: {
|
||||
pglFieldArgumentsSetDefaults(
|
||||
field_args,
|
||||
PGL_SPATIAL_STRUCTURE_TYPE::PGL_SPATIAL_STRUCTURE_KDTREE,
|
||||
PGL_DIRECTIONAL_DISTRIBUTION_TYPE::PGL_DIRECTIONAL_DISTRIBUTION_PARALLAX_AWARE_VMM);
|
||||
break;
|
||||
}
|
||||
/* Directional quad-trees. */
|
||||
case GUIDING_TYPE_DIRECTIONAL_QUAD_TREE: {
|
||||
pglFieldArgumentsSetDefaults(
|
||||
field_args,
|
||||
PGL_SPATIAL_STRUCTURE_TYPE::PGL_SPATIAL_STRUCTURE_KDTREE,
|
||||
PGL_DIRECTIONAL_DISTRIBUTION_TYPE::PGL_DIRECTIONAL_DISTRIBUTION_QUADTREE);
|
||||
break;
|
||||
}
|
||||
/* von Mises-Fisher mixture models. */
|
||||
case GUIDING_TYPE_VMM: {
|
||||
pglFieldArgumentsSetDefaults(
|
||||
field_args,
|
||||
PGL_SPATIAL_STRUCTURE_TYPE::PGL_SPATIAL_STRUCTURE_KDTREE,
|
||||
PGL_DIRECTIONAL_DISTRIBUTION_TYPE::PGL_DIRECTIONAL_DISTRIBUTION_VMM);
|
||||
break;
|
||||
}
|
||||
}
|
||||
# if OPENPGL_VERSION_MINOR >= 4
|
||||
field_args.deterministic = guiding_params.deterministic;
|
||||
# endif
|
||||
openpgl::cpp::Device *guiding_device = static_cast<openpgl::cpp::Device *>(
|
||||
device_->get_guiding_device());
|
||||
if (guiding_device) {
|
||||
guiding_sample_data_storage_ = make_unique<openpgl::cpp::SampleStorage>();
|
||||
guiding_field_ = make_unique<openpgl::cpp::Field>(guiding_device, field_args);
|
||||
}
|
||||
else {
|
||||
guiding_sample_data_storage_ = nullptr;
|
||||
guiding_field_ = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
guiding_sample_data_storage_ = nullptr;
|
||||
guiding_field_ = nullptr;
|
||||
}
|
||||
}
|
||||
else if (reset) {
|
||||
if (guiding_field_) {
|
||||
guiding_field_->Reset();
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void)guiding_params;
|
||||
(void)reset;
|
||||
#endif
|
||||
}
|
||||
|
||||
void PathTrace::guiding_prepare_structures()
|
||||
{
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
const bool train = (guiding_params_.training_samples == 0) ||
|
||||
(guiding_field_->GetIteration() < guiding_params_.training_samples);
|
||||
|
||||
for (auto &&path_trace_work : path_trace_works_) {
|
||||
path_trace_work->guiding_init_kernel_globals(
|
||||
guiding_field_.get(), guiding_sample_data_storage_.get(), train);
|
||||
}
|
||||
|
||||
if (train) {
|
||||
/* For training the guiding distribution we need to force the number of samples
|
||||
* per update to be limited, for reproducible results and reasonable training size.
|
||||
*
|
||||
* Idea: we could stochastically discard samples with a probability of 1/num_samples_per_update
|
||||
* we can then update only after the num_samples_per_update iterations are rendered. */
|
||||
render_scheduler_.set_limit_samples_per_update(4);
|
||||
}
|
||||
else {
|
||||
render_scheduler_.set_limit_samples_per_update(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void PathTrace::guiding_update_structures()
|
||||
{
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
VLOG_WORK << "Update path guiding structures";
|
||||
|
||||
VLOG_DEBUG << "Number of surface samples: " << guiding_sample_data_storage_->GetSizeSurface();
|
||||
VLOG_DEBUG << "Number of volume samples: " << guiding_sample_data_storage_->GetSizeVolume();
|
||||
|
||||
const size_t num_valid_samples = guiding_sample_data_storage_->GetSizeSurface() +
|
||||
guiding_sample_data_storage_->GetSizeVolume();
|
||||
|
||||
/* we wait until we have at least 1024 samples */
|
||||
if (num_valid_samples >= 1024) {
|
||||
# if OPENPGL_VERSION_MINOR < 4
|
||||
const size_t num_samples = 1;
|
||||
guiding_field_->Update(*guiding_sample_data_storage_, num_samples);
|
||||
# else
|
||||
guiding_field_->Update(*guiding_sample_data_storage_);
|
||||
# endif
|
||||
guiding_update_count++;
|
||||
|
||||
VLOG_DEBUG << "Path guiding field valid: " << guiding_field_->Validate();
|
||||
|
||||
guiding_sample_data_storage_->Clear();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -4,15 +4,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "integrator/denoiser.h"
|
||||
#include "integrator/guiding.h"
|
||||
#include "integrator/pass_accessor.h"
|
||||
#include "integrator/path_trace_work.h"
|
||||
#include "integrator/work_balancer.h"
|
||||
|
||||
#include "session/buffers.h"
|
||||
|
||||
#include "util/function.h"
|
||||
#include "util/guiding.h"
|
||||
#include "util/thread.h"
|
||||
#include "util/unique_ptr.h"
|
||||
#include "util/vector.h"
|
||||
@@ -93,10 +89,6 @@ class PathTrace {
|
||||
* Use this to configure the adaptive sampler before rendering any samples. */
|
||||
void set_adaptive_sampling(const AdaptiveSampling &adaptive_sampling);
|
||||
|
||||
/* Set the parameters for guiding.
|
||||
* Use to setup the guiding structures before each rendering iteration.*/
|
||||
void set_guiding_params(const GuidingParams ¶ms, const bool reset);
|
||||
|
||||
/* Sets output driver for render buffer output. */
|
||||
void set_output_driver(unique_ptr<OutputDriver> driver);
|
||||
|
||||
@@ -213,15 +205,6 @@ class PathTrace {
|
||||
void write_tile_buffer(const RenderWork &render_work);
|
||||
void finalize_full_buffer_on_disk(const RenderWork &render_work);
|
||||
|
||||
/* Updates/initializes the guiding structures after a rendering iteration.
|
||||
* The structures are updated using the training data/samples generated during the previous
|
||||
* rendering iteration */
|
||||
void guiding_update_structures();
|
||||
|
||||
/* Prepares the per-kernel thread related guiding structures (e.g., PathSegmentStorage,
|
||||
* pointers to the global Field and SegmentStorage)*/
|
||||
void guiding_prepare_structures();
|
||||
|
||||
/* Get number of samples in the current state of the render buffers. */
|
||||
int get_num_samples_in_buffer();
|
||||
|
||||
@@ -282,22 +265,6 @@ class PathTrace {
|
||||
/* Denoiser device descriptor which holds the denoised big tile for multi-device workloads. */
|
||||
unique_ptr<PathTraceWork> big_tile_denoise_work_;
|
||||
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
/* Guiding related attributes */
|
||||
GuidingParams guiding_params_;
|
||||
|
||||
/* The guiding field which holds the representation of the incident radiance field for the
|
||||
* complete scene. */
|
||||
unique_ptr<openpgl::cpp::Field> guiding_field_;
|
||||
|
||||
/* The storage container which holds the training data/samples generated during the last
|
||||
* rendering iteration. */
|
||||
unique_ptr<openpgl::cpp::SampleStorage> guiding_sample_data_storage_;
|
||||
|
||||
/* The number of already performed training iterations for the guiding field.*/
|
||||
int guiding_update_count = 0;
|
||||
#endif
|
||||
|
||||
/* State which is common for all the steps of the render work.
|
||||
* Is brought up to date in the `render()` call and is accessed from all the steps involved into
|
||||
* rendering the work. */
|
||||
|
@@ -23,10 +23,6 @@ unique_ptr<PathTraceWork> PathTraceWork::create(Device *device,
|
||||
if (device->info.type == DEVICE_CPU) {
|
||||
return make_unique<PathTraceWorkCPU>(device, film, device_scene, cancel_requested_flag);
|
||||
}
|
||||
if (device->info.type == DEVICE_DUMMY) {
|
||||
/* Dummy devices can't perform any work. */
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return make_unique<PathTraceWorkGPU>(device, film, device_scene, cancel_requested_flag);
|
||||
}
|
||||
|
@@ -140,13 +140,6 @@ class PathTraceWork {
|
||||
return device_;
|
||||
}
|
||||
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
/* Initializes the per-thread guiding kernel data. */
|
||||
virtual void guiding_init_kernel_globals(void *, void *, const bool)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
PathTraceWork(Device *device,
|
||||
Film *film,
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include "device/cpu/kernel.h"
|
||||
#include "device/device.h"
|
||||
|
||||
#include "kernel/film/write.h"
|
||||
#include "kernel/integrator/path_state.h"
|
||||
|
||||
#include "integrator/pass_accessor_cpu.h"
|
||||
@@ -146,13 +145,6 @@ void PathTraceWorkCPU::render_samples_full_pipeline(KernelGlobalsCPU *kernel_glo
|
||||
|
||||
kernels_.integrator_megakernel(kernel_globals, state, render_buffer);
|
||||
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
if (kernel_globals->data.integrator.train_guiding) {
|
||||
/* Push the generated sample data to the global sample data storage. */
|
||||
guiding_push_sample_data_to_global_storage(kernel_globals, state, render_buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (shadow_catcher_state) {
|
||||
kernels_.integrator_megakernel(kernel_globals, shadow_catcher_state, render_buffer);
|
||||
}
|
||||
@@ -284,106 +276,4 @@ void PathTraceWorkCPU::cryptomatte_postproces()
|
||||
});
|
||||
}
|
||||
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
/* NOTE: It seems that this is called before every rendering iteration/progression and not once per
|
||||
* rendering. May be we find a way to call it only once per rendering. */
|
||||
void PathTraceWorkCPU::guiding_init_kernel_globals(void *guiding_field,
|
||||
void *sample_data_storage,
|
||||
const bool train)
|
||||
{
|
||||
/* Linking the global guiding structures (e.g., Field and SampleStorage) to the per-thread
|
||||
* kernel globals. */
|
||||
for (int thread_index = 0; thread_index < kernel_thread_globals_.size(); thread_index++) {
|
||||
CPUKernelThreadGlobals &kg = kernel_thread_globals_[thread_index];
|
||||
openpgl::cpp::Field *field = (openpgl::cpp::Field *)guiding_field;
|
||||
|
||||
/* Allocate sampling distributions. */
|
||||
kg.opgl_guiding_field = field;
|
||||
|
||||
# if PATH_GUIDING_LEVEL >= 4
|
||||
if (kg.opgl_surface_sampling_distribution) {
|
||||
delete kg.opgl_surface_sampling_distribution;
|
||||
kg.opgl_surface_sampling_distribution = nullptr;
|
||||
}
|
||||
if (kg.opgl_volume_sampling_distribution) {
|
||||
delete kg.opgl_volume_sampling_distribution;
|
||||
kg.opgl_volume_sampling_distribution = nullptr;
|
||||
}
|
||||
|
||||
if (field) {
|
||||
kg.opgl_surface_sampling_distribution = new openpgl::cpp::SurfaceSamplingDistribution(field);
|
||||
kg.opgl_volume_sampling_distribution = new openpgl::cpp::VolumeSamplingDistribution(field);
|
||||
}
|
||||
# endif
|
||||
|
||||
/* Reserve storage for training. */
|
||||
kg.data.integrator.train_guiding = train;
|
||||
kg.opgl_sample_data_storage = (openpgl::cpp::SampleStorage *)sample_data_storage;
|
||||
|
||||
if (train) {
|
||||
kg.opgl_path_segment_storage->Reserve(kg.data.integrator.transparent_max_bounce +
|
||||
kg.data.integrator.max_bounce + 3);
|
||||
kg.opgl_path_segment_storage->Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PathTraceWorkCPU::guiding_push_sample_data_to_global_storage(
|
||||
KernelGlobalsCPU *kg, IntegratorStateCPU *state, ccl_global float *ccl_restrict render_buffer)
|
||||
{
|
||||
# ifdef WITH_CYCLES_DEBUG
|
||||
if (VLOG_WORK_IS_ON) {
|
||||
/* Check if the generated path segments contain valid values. */
|
||||
const bool validSegments = kg->opgl_path_segment_storage->ValidateSegments();
|
||||
if (!validSegments) {
|
||||
VLOG_WORK << "Guiding: invalid path segments!";
|
||||
}
|
||||
}
|
||||
|
||||
/* Write debug render pass to validate it matches combined pass. */
|
||||
pgl_vec3f pgl_final_color = kg->opgl_path_segment_storage->CalculatePixelEstimate(false);
|
||||
const uint32_t render_pixel_index = INTEGRATOR_STATE(state, path, render_pixel_index);
|
||||
const uint64_t render_buffer_offset = (uint64_t)render_pixel_index *
|
||||
kernel_data.film.pass_stride;
|
||||
ccl_global float *buffer = render_buffer + render_buffer_offset;
|
||||
float3 final_color = make_float3(pgl_final_color.x, pgl_final_color.y, pgl_final_color.z);
|
||||
if (kernel_data.film.pass_guiding_color != PASS_UNUSED) {
|
||||
film_write_pass_float3(buffer + kernel_data.film.pass_guiding_color, final_color);
|
||||
}
|
||||
# else
|
||||
(void)state;
|
||||
(void)render_buffer;
|
||||
# endif
|
||||
|
||||
/* Convert the path segment representation of the random walk into radiance samples. */
|
||||
# if PATH_GUIDING_LEVEL >= 2
|
||||
const bool use_direct_light = kernel_data.integrator.use_guiding_direct_light;
|
||||
const bool use_mis_weights = kernel_data.integrator.use_guiding_mis_weights;
|
||||
kg->opgl_path_segment_storage->PrepareSamples(
|
||||
false, nullptr, use_mis_weights, use_direct_light, false);
|
||||
# endif
|
||||
|
||||
# ifdef WITH_CYCLES_DEBUG
|
||||
/* Check if the training/radiance samples generated py the path segment storage are valid.*/
|
||||
if (VLOG_WORK_IS_ON) {
|
||||
const bool validSamples = kg->opgl_path_segment_storage->ValidateSamples();
|
||||
if (!validSamples) {
|
||||
VLOG_WORK
|
||||
<< "Guiding: path segment storage generated/contains invalid radiance/training samples!";
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
# if PATH_GUIDING_LEVEL >= 3
|
||||
/* Push radiance samples from current random walk/path to the global sample storage. */
|
||||
size_t num_samples = 0;
|
||||
const openpgl::cpp::SampleData *samples = kg->opgl_path_segment_storage->GetSamples(num_samples);
|
||||
kg->opgl_sample_data_storage->AddSamples(samples, num_samples);
|
||||
# endif
|
||||
|
||||
/* Clear storage for the current path, to be ready for the next path. */
|
||||
kg->opgl_path_segment_storage->Clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -16,7 +16,6 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
struct KernelWorkTile;
|
||||
struct KernelGlobalsCPU;
|
||||
struct IntegratorStateCPU;
|
||||
|
||||
class CPUKernels;
|
||||
|
||||
@@ -51,22 +50,6 @@ class PathTraceWorkCPU : public PathTraceWork {
|
||||
virtual int adaptive_sampling_converge_filter_count_active(float threshold, bool reset) override;
|
||||
virtual void cryptomatte_postproces() override;
|
||||
|
||||
#ifdef WITH_PATH_GUIDING
|
||||
/* Initializes the per-thread guiding kernel data. The function sets the pointers to the
|
||||
* global guiding field and the sample data storage as well es initializes the per-thread
|
||||
* guided sampling distributions (e.g., SurfaceSamplingDistribution and
|
||||
* VolumeSamplingDistribution). */
|
||||
void guiding_init_kernel_globals(void *guiding_field,
|
||||
void *sample_data_storage,
|
||||
const bool train) override;
|
||||
|
||||
/* Pushes the collected training data/samples of a path to the global sample storage.
|
||||
* This function is called at the end of a random walk/path generation. */
|
||||
void guiding_push_sample_data_to_global_storage(KernelGlobalsCPU *kernel_globals,
|
||||
IntegratorStateCPU *state,
|
||||
ccl_global float *ccl_restrict render_buffer);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
/* Core path tracing routine. Renders given work time on the given queue. */
|
||||
void render_samples_full_pipeline(KernelGlobalsCPU *kernel_globals,
|
||||
|
@@ -45,11 +45,6 @@ void RenderScheduler::set_denoiser_params(const DenoiseParams ¶ms)
|
||||
denoiser_params_ = params;
|
||||
}
|
||||
|
||||
void RenderScheduler::set_limit_samples_per_update(const int limit_samples)
|
||||
{
|
||||
limit_samples_per_update_ = limit_samples;
|
||||
}
|
||||
|
||||
void RenderScheduler::set_adaptive_sampling(const AdaptiveSampling &adaptive_sampling)
|
||||
{
|
||||
adaptive_sampling_ = adaptive_sampling;
|
||||
@@ -765,13 +760,7 @@ int RenderScheduler::calculate_num_samples_per_update() const
|
||||
|
||||
const double update_interval_in_seconds = guess_display_update_interval_in_seconds();
|
||||
|
||||
int num_samples_per_update = max(int(num_samples_in_second * update_interval_in_seconds), 1);
|
||||
|
||||
if (limit_samples_per_update_) {
|
||||
num_samples_per_update = min(limit_samples_per_update_, num_samples_per_update);
|
||||
}
|
||||
|
||||
return num_samples_per_update;
|
||||
return max(int(num_samples_in_second * update_interval_in_seconds), 1);
|
||||
}
|
||||
|
||||
int RenderScheduler::get_start_sample_to_path_trace() const
|
||||
@@ -819,7 +808,7 @@ int RenderScheduler::get_num_samples_to_path_trace() const
|
||||
return 1;
|
||||
}
|
||||
|
||||
int num_samples_per_update = calculate_num_samples_per_update();
|
||||
const int num_samples_per_update = calculate_num_samples_per_update();
|
||||
const int path_trace_start_sample = get_start_sample_to_path_trace();
|
||||
|
||||
/* Round number of samples to a power of two, so that division of path states into tiles goes in
|
||||
|
@@ -187,8 +187,6 @@ class RenderScheduler {
|
||||
* times, and so on. */
|
||||
string full_report() const;
|
||||
|
||||
void set_limit_samples_per_update(const int limit_samples);
|
||||
|
||||
protected:
|
||||
/* Check whether all work has been scheduled and time limit was not exceeded.
|
||||
*
|
||||
@@ -452,10 +450,6 @@ class RenderScheduler {
|
||||
* (quadratic dependency from the resolution divider): resolution divider of 2 brings render time
|
||||
* down by a factor of 4. */
|
||||
int calculate_resolution_divider_for_time(double desired_time, double actual_time);
|
||||
|
||||
/* If the number of samples per rendering progression should be limited because of path guiding
|
||||
* being activated or is still inside its training phase */
|
||||
int limit_samples_per_update_ = 0;
|
||||
};
|
||||
|
||||
int calculate_resolution_divider_for_resolution(int width, int height, int resolution);
|
||||
|
@@ -17,9 +17,6 @@ void work_balance_do_initial(vector<WorkBalanceInfo> &work_balance_infos)
|
||||
work_balance_infos[0].weight = 1.0;
|
||||
return;
|
||||
}
|
||||
else if (num_infos == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* There is no statistics available, so start with an equal distribution. */
|
||||
const double weight = 1.0 / num_infos;
|
||||
|
@@ -243,7 +243,6 @@ set(SRC_KERNEL_INTEGRATOR_HEADERS
|
||||
integrator/intersect_shadow.h
|
||||
integrator/intersect_subsurface.h
|
||||
integrator/intersect_volume_stack.h
|
||||
integrator/guiding.h
|
||||
integrator/megakernel.h
|
||||
integrator/mnee.h
|
||||
integrator/path_state.h
|
||||
@@ -530,7 +529,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
|
||||
endif()
|
||||
if(DEFINED cuda_nvcc_executable AND DEFINED cuda_toolkit_root_dir)
|
||||
# Compile regular kernel
|
||||
cycles_cuda_kernel_add(${arch} ${prev_arch} kernel "" "${cuda_sources}" FALSE)
|
||||
CYCLES_CUDA_KERNEL_ADD(${arch} ${prev_arch} kernel "" "${cuda_sources}" FALSE)
|
||||
|
||||
if(WITH_CYCLES_CUDA_BUILD_SERIAL)
|
||||
set(prev_arch ${arch})
|
||||
@@ -612,7 +611,7 @@ if(WITH_CYCLES_HIP_BINARIES AND WITH_CYCLES_DEVICE_HIP)
|
||||
|
||||
foreach(arch ${CYCLES_HIP_BINARIES_ARCH})
|
||||
# Compile regular kernel
|
||||
cycles_hip_kernel_add(${arch} kernel "" "${hip_sources}" FALSE)
|
||||
CYCLES_HIP_KERNEL_ADD(${arch} kernel "" "${hip_sources}" FALSE)
|
||||
endforeach()
|
||||
|
||||
add_custom_target(cycles_kernel_hip ALL DEPENDS ${hip_fatbins})
|
||||
@@ -697,11 +696,11 @@ if(WITH_CYCLES_DEVICE_OPTIX AND WITH_CYCLES_CUDA_BINARIES)
|
||||
delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${output}" ${CYCLES_INSTALL_PATH}/lib)
|
||||
endmacro()
|
||||
|
||||
cycles_optix_kernel_add(
|
||||
CYCLES_OPTIX_KERNEL_ADD(
|
||||
kernel_optix
|
||||
"device/optix/kernel.cu"
|
||||
"")
|
||||
cycles_optix_kernel_add(
|
||||
CYCLES_OPTIX_KERNEL_ADD(
|
||||
kernel_optix_shader_raytrace
|
||||
"device/optix/kernel_shader_raytrace.cu"
|
||||
"--keep-device-functions")
|
||||
@@ -716,7 +715,7 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
if(WIN32)
|
||||
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/cycles_kernel_oneapi.dll)
|
||||
else()
|
||||
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/libcycles_kernel_oneapi.so)
|
||||
set(cycles_kernel_oneapi_lib ${CMAKE_CURRENT_BINARY_DIR}/cycles_kernel_oneapi.so)
|
||||
endif()
|
||||
|
||||
set(cycles_oneapi_kernel_sources
|
||||
@@ -727,20 +726,14 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
${SRC_UTIL_HEADERS}
|
||||
)
|
||||
|
||||
set (SYCL_OFFLINE_COMPILER_PARALLEL_JOBS 1 CACHE STRING "Number of parallel compiler instances to use for device binaries compilation (expect ~8GB peak memory usage per instance).")
|
||||
if (WITH_CYCLES_ONEAPI_BINARIES)
|
||||
message(STATUS "${SYCL_OFFLINE_COMPILER_PARALLEL_JOBS} instance(s) of oneAPI offline compiler will be used.")
|
||||
endif()
|
||||
# SYCL_CPP_FLAGS is a variable that the user can set to pass extra compiler options
|
||||
set(sycl_compiler_flags
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${SRC_KERNEL_DEVICE_ONEAPI}
|
||||
-fsycl
|
||||
-fsycl-unnamed-lambda
|
||||
-fdelayed-template-parsing
|
||||
-mllvm -inlinedefault-threshold=250
|
||||
-mllvm -inlinehint-threshold=350
|
||||
-fsycl-device-code-split=per_kernel
|
||||
-fsycl-max-parallel-link-jobs=${SYCL_OFFLINE_COMPILER_PARALLEL_JOBS}
|
||||
-mllvm -inlinedefault-threshold=300
|
||||
-mllvm -inlinehint-threshold=400
|
||||
-shared
|
||||
-DWITH_ONEAPI
|
||||
-ffast-math
|
||||
@@ -751,6 +744,7 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
${SYCL_CPP_FLAGS}
|
||||
)
|
||||
|
||||
|
||||
if (WITH_CYCLES_ONEAPI_SYCL_HOST_ENABLED)
|
||||
list(APPEND sycl_compiler_flags -DWITH_ONEAPI_SYCL_HOST_ENABLED)
|
||||
endif()
|
||||
@@ -807,7 +801,6 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND sycl_compiler_flags
|
||||
-fuse-ld=link
|
||||
-fms-extensions
|
||||
-fms-compatibility
|
||||
-D_WINDLL
|
||||
@@ -818,43 +811,36 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
-D_CRT_SECURE_NO_DEPRECATE
|
||||
-DONEAPI_EXPORT)
|
||||
|
||||
string(REPLACE /Redist/ /Tools/ MSVC_TOOLS_DIR ${MSVC_REDIST_DIR})
|
||||
if(NOT CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) # case for Ninja on Windows
|
||||
get_filename_component(cmake_mt_dir ${CMAKE_MT} DIRECTORY)
|
||||
string(REPLACE /bin/ /Lib/ WINDOWS_KIT_DIR ${cmake_mt_dir})
|
||||
get_filename_component(WINDOWS_KIT_DIR "${WINDOWS_KIT_DIR}/../" ABSOLUTE)
|
||||
if(sycl_compiler_compiler_name MATCHES "dpcpp")
|
||||
# The oneAPI distribution calls the compiler "dpcpp" and comes with a script that sets environment variables.
|
||||
add_custom_command(
|
||||
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||
COMMAND "${sycl_compiler_root}/../../env/vars.bat"
|
||||
COMMAND ${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}
|
||||
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||
else()
|
||||
set(WINDOWS_KIT_DIR ${WINDOWS_KITS_DIR}/Lib/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})
|
||||
# The open source SYCL compiler just goes by clang++ and does not have such a script.
|
||||
# Set the variables manually.
|
||||
string(REPLACE /Redist/ /Tools/ MSVC_TOOLS_DIR ${MSVC_REDIST_DIR})
|
||||
if(NOT CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) # case for Ninja on Windows
|
||||
get_filename_component(cmake_mt_dir ${CMAKE_MT} DIRECTORY)
|
||||
string(REPLACE /bin/ /Lib/ WINDOWS_KIT_DIR ${cmake_mt_dir})
|
||||
get_filename_component(WINDOWS_KIT_DIR "${WINDOWS_KIT_DIR}/../" ABSOLUTE)
|
||||
else()
|
||||
set(WINDOWS_KIT_DIR ${WINDOWS_KITS_DIR}/Lib/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})
|
||||
endif()
|
||||
list(APPEND sycl_compiler_flags
|
||||
-L "${MSVC_TOOLS_DIR}/lib/x64"
|
||||
-L "${WINDOWS_KIT_DIR}/um/x64"
|
||||
-L "${WINDOWS_KIT_DIR}/ucrt/x64")
|
||||
add_custom_command(
|
||||
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
"LIB=${sycl_compiler_root}/../lib" # for compiler to find sycl.lib
|
||||
"PATH=${OCLOC_INSTALL_DIR};${sycl_compiler_root}"
|
||||
${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}
|
||||
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||
endif()
|
||||
list(APPEND sycl_compiler_flags
|
||||
-L "${MSVC_TOOLS_DIR}/lib/x64"
|
||||
-L "${WINDOWS_KIT_DIR}/um/x64"
|
||||
-L "${WINDOWS_KIT_DIR}/ucrt/x64")
|
||||
|
||||
set(sycl_compiler_flags_Release ${sycl_compiler_flags})
|
||||
set(sycl_compiler_flags_Debug ${sycl_compiler_flags})
|
||||
set(sycl_compiler_flags_RelWithDebInfo ${sycl_compiler_flags})
|
||||
set(sycl_compiler_flags_MinSizeRel ${sycl_compiler_flags})
|
||||
list(APPEND sycl_compiler_flags_RelWithDebInfo -g)
|
||||
get_filename_component(sycl_library_debug_name ${SYCL_LIBRARY_DEBUG} NAME_WE)
|
||||
list(APPEND sycl_compiler_flags_Debug
|
||||
-g
|
||||
-D_DEBUG
|
||||
-nostdlib -Xclang --dependent-lib=msvcrtd
|
||||
-Xclang --dependent-lib=${sycl_library_debug_name})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
"LIB=${sycl_compiler_root}/../lib" # for compiler to find sycl.lib
|
||||
"PATH=${OCLOC_INSTALL_DIR}\;${sycl_compiler_root}"
|
||||
${SYCL_COMPILER}
|
||||
"$<$<CONFIG:Release>:${sycl_compiler_flags_Release}>"
|
||||
"$<$<CONFIG:RelWithDebInfo>:${sycl_compiler_flags_RelWithDebInfo}>"
|
||||
"$<$<CONFIG:Debug>:${sycl_compiler_flags_Debug}>"
|
||||
"$<$<CONFIG:MinSizeRel>:${sycl_compiler_flags_Release}>"
|
||||
COMMAND_EXPAND_LISTS
|
||||
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||
else()
|
||||
list(APPEND sycl_compiler_flags -fPIC)
|
||||
|
||||
@@ -866,36 +852,55 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
# libpi_level_zero.so can be placed next to it and get found.
|
||||
list(APPEND sycl_compiler_flags -Wl,-rpath,'$$ORIGIN')
|
||||
|
||||
if(NOT IGC_INSTALL_DIR)
|
||||
get_filename_component(IGC_INSTALL_DIR "${sycl_compiler_root}/../lib/igc" ABSOLUTE)
|
||||
# The oneAPI distribution calls the compiler "dpcpp" and comes with a script that sets environment variables.
|
||||
if(sycl_compiler_compiler_name MATCHES "dpcpp")
|
||||
add_custom_command(
|
||||
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||
COMMAND bash -c \"source ${sycl_compiler_root}/../../env/vars.sh&&${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}\"
|
||||
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||
else()
|
||||
# The open source SYCL compiler just goes by clang++ and does not have such a script.
|
||||
# Set the variables manually.
|
||||
if(NOT IGC_INSTALL_DIR)
|
||||
get_filename_component(IGC_INSTALL_DIR "${sycl_compiler_root}/../lib/igc" ABSOLUTE)
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
"LD_LIBRARY_PATH=${sycl_compiler_root}/../lib:${OCLOC_INSTALL_DIR}/lib:${IGC_INSTALL_DIR}/lib"
|
||||
"PATH=${OCLOC_INSTALL_DIR}/bin:${sycl_compiler_root}:$ENV{PATH}" # env PATH is for compiler to find ld
|
||||
${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}
|
||||
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT ${cycles_kernel_oneapi_lib}
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
"LD_LIBRARY_PATH=${sycl_compiler_root}/../lib:${OCLOC_INSTALL_DIR}/lib:${IGC_INSTALL_DIR}/lib"
|
||||
"PATH=${OCLOC_INSTALL_DIR}/bin:${sycl_compiler_root}:$ENV{PATH}" # env PATH is for compiler to find ld
|
||||
${SYCL_COMPILER} $<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g> ${sycl_compiler_flags}
|
||||
DEPENDS ${cycles_oneapi_kernel_sources})
|
||||
endif()
|
||||
|
||||
if(NOT WITH_BLENDER)
|
||||
# For the Cycles standalone put libraries next to the Cycles application.
|
||||
set(cycles_oneapi_target_path ${CYCLES_INSTALL_PATH})
|
||||
else()
|
||||
# For Blender put the libraries next to the Blender executable.
|
||||
#
|
||||
# Note that the installation path in the delayed_install is relative to the versioned folder,
|
||||
# which means we need to go one level up.
|
||||
set(cycles_oneapi_target_path "../")
|
||||
endif()
|
||||
|
||||
# install dynamic libraries required at runtime
|
||||
if(WIN32)
|
||||
delayed_install("" "${cycles_kernel_oneapi_lib}" ${cycles_oneapi_target_path})
|
||||
set(SYCL_RUNTIME_DEPENDENCIES
|
||||
sycl.dll
|
||||
pi_level_zero.dll
|
||||
)
|
||||
if(NOT WITH_BLENDER)
|
||||
# For the Cycles standalone put libraries next to the Cycles application.
|
||||
delayed_install("${sycl_compiler_root}" "${SYCL_RUNTIME_DEPENDENCIES}" ${CYCLES_INSTALL_PATH})
|
||||
else()
|
||||
# For Blender put the libraries next to the Blender executable.
|
||||
#
|
||||
# Note that the installation path in the delayed_install is relative to the versioned folder,
|
||||
# which means we need to go one level up.
|
||||
delayed_install("${sycl_compiler_root}" "${SYCL_RUNTIME_DEPENDENCIES}" "../")
|
||||
endif()
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
delayed_install("" "${cycles_kernel_oneapi_lib}" ${cycles_oneapi_target_path}/lib)
|
||||
file(GLOB SYCL_RUNTIME_DEPENDENCIES
|
||||
${sycl_compiler_root}/../lib/libsycl.so
|
||||
${sycl_compiler_root}/../lib/libsycl.so.[0-9]
|
||||
${sycl_compiler_root}/../lib/libsycl.so.[0-9].[0-9].[0-9]-[0-9]
|
||||
)
|
||||
list(APPEND SYCL_RUNTIME_DEPENDENCIES ${sycl_compiler_root}/../lib/libpi_level_zero.so)
|
||||
delayed_install("" "${SYCL_RUNTIME_DEPENDENCIES}" ${CYCLES_INSTALL_PATH}/lib)
|
||||
endif()
|
||||
|
||||
delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cycles_kernel_oneapi_lib}" ${CYCLES_INSTALL_PATH}/lib)
|
||||
add_custom_target(cycles_kernel_oneapi ALL DEPENDS ${cycles_kernel_oneapi_lib})
|
||||
endif()
|
||||
|
||||
@@ -945,8 +950,8 @@ endif()
|
||||
|
||||
# Warnings to avoid using doubles in the kernel.
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
add_check_cxx_compiler_flag(CMAKE_CXX_FLAGS _has_cxxflag_float_conversion "-Werror=float-conversion")
|
||||
add_check_cxx_compiler_flag(CMAKE_CXX_FLAGS _has_cxxflag_double_promotion "-Werror=double-promotion")
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_float_conversion "-Werror=float-conversion")
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_double_promotion "-Werror=double-promotion")
|
||||
unset(_has_cxxflag_float_conversion)
|
||||
unset(_has_cxxflag_double_promotion)
|
||||
endif()
|
||||
|
@@ -53,9 +53,6 @@ ccl_device_inline ccl_private ShaderClosure *bsdf_alloc(ccl_private ShaderData *
|
||||
{
|
||||
kernel_assert(isfinite_safe(weight));
|
||||
|
||||
/* No negative weights allowed. */
|
||||
weight = max(weight, zero_float3());
|
||||
|
||||
const float sample_weight = fabsf(average(weight));
|
||||
|
||||
/* Use comparison this way to help dealing with non-finite weight: if the average is not finite
|
||||
|
@@ -69,11 +69,7 @@ ccl_device_inline float bsdf_get_roughness_squared(ccl_private const ShaderClosu
|
||||
* Yining Karl Li and Brent Burley. */
|
||||
ccl_device_inline float bump_shadowing_term(float3 Ng, float3 N, float3 I)
|
||||
{
|
||||
const float cosNI = dot(N, I);
|
||||
if (cosNI < 0.0f) {
|
||||
Ng = -Ng;
|
||||
}
|
||||
float g = safe_divide(dot(Ng, I), cosNI * dot(Ng, N));
|
||||
float g = safe_divide(dot(Ng, I), dot(N, I) * dot(Ng, N));
|
||||
|
||||
/* If the incoming light is on the unshadowed side, return full brightness. */
|
||||
if (g >= 1.0f) {
|
||||
@@ -102,12 +98,6 @@ ccl_device_inline float shift_cos_in(float cos_in, const float frequency_multipl
|
||||
return val;
|
||||
}
|
||||
|
||||
ccl_device_inline bool bsdf_is_transmission(ccl_private const ShaderClosure *sc,
|
||||
const float3 omega_in)
|
||||
{
|
||||
return dot(sc->N, omega_in) < 0.0f;
|
||||
}
|
||||
|
||||
ccl_device_inline int bsdf_sample(KernelGlobals kg,
|
||||
ccl_private ShaderData *sd,
|
||||
ccl_private const ShaderClosure *sc,
|
||||
@@ -115,9 +105,7 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
|
||||
float randv,
|
||||
ccl_private Spectrum *eval,
|
||||
ccl_private float3 *omega_in,
|
||||
ccl_private float *pdf,
|
||||
ccl_private float2 *sampled_roughness,
|
||||
ccl_private float *eta)
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
/* For curves use the smooth normal, particularly for ribbons the geometric
|
||||
* normal gives too much darkening otherwise. */
|
||||
@@ -127,131 +115,78 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
|
||||
switch (sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
label = bsdf_diffuse_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
*sampled_roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
#if defined(__SVM__) || defined(__OSL__)
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
label = bsdf_oren_nayar_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
*sampled_roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
# ifdef __OSL__
|
||||
case CLOSURE_BSDF_PHONG_RAMP_ID:
|
||||
label = bsdf_phong_ramp_sample(
|
||||
sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, sampled_roughness);
|
||||
*eta = 1.0f;
|
||||
label = bsdf_phong_ramp_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_RAMP_ID:
|
||||
label = bsdf_diffuse_ramp_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
*sampled_roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
# endif
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
label = bsdf_translucent_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
*sampled_roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
label = bsdf_reflection_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, eta);
|
||||
*sampled_roughness = zero_float2();
|
||||
label = bsdf_reflection_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
label = bsdf_refraction_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, eta);
|
||||
*sampled_roughness = zero_float2();
|
||||
label = bsdf_refraction_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
label = bsdf_transparent_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
*sampled_roughness = zero_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
label = bsdf_microfacet_ggx_sample(
|
||||
kg, sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, sampled_roughness, eta);
|
||||
label = bsdf_microfacet_ggx_sample(kg, sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID:
|
||||
label = bsdf_microfacet_multi_ggx_sample(kg,
|
||||
sc,
|
||||
Ng,
|
||||
sd->I,
|
||||
randu,
|
||||
randv,
|
||||
eval,
|
||||
omega_in,
|
||||
pdf,
|
||||
&sd->lcg_state,
|
||||
sampled_roughness,
|
||||
eta);
|
||||
label = bsdf_microfacet_multi_ggx_sample(
|
||||
kg, sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, &sd->lcg_state);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID:
|
||||
label = bsdf_microfacet_multi_ggx_glass_sample(kg,
|
||||
sc,
|
||||
Ng,
|
||||
sd->I,
|
||||
randu,
|
||||
randv,
|
||||
eval,
|
||||
omega_in,
|
||||
pdf,
|
||||
&sd->lcg_state,
|
||||
sampled_roughness,
|
||||
eta);
|
||||
label = bsdf_microfacet_multi_ggx_glass_sample(
|
||||
kg, sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, &sd->lcg_state);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
label = bsdf_microfacet_beckmann_sample(
|
||||
kg, sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, sampled_roughness, eta);
|
||||
kg, sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
|
||||
label = bsdf_ashikhmin_shirley_sample(
|
||||
sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, sampled_roughness);
|
||||
*eta = 1.0f;
|
||||
label = bsdf_ashikhmin_shirley_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
label = bsdf_ashikhmin_velvet_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
*sampled_roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_TOON_ID:
|
||||
label = bsdf_diffuse_toon_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
*sampled_roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_GLOSSY_TOON_ID:
|
||||
label = bsdf_glossy_toon_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
// double check if this is valid
|
||||
*sampled_roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
|
||||
label = bsdf_hair_reflection_sample(
|
||||
sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, sampled_roughness);
|
||||
*eta = 1.0f;
|
||||
label = bsdf_hair_reflection_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
label = bsdf_hair_transmission_sample(
|
||||
sc, Ng, sd->I, randu, randv, eval, omega_in, pdf, sampled_roughness);
|
||||
*eta = 1.0f;
|
||||
label = bsdf_hair_transmission_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_PRINCIPLED_ID:
|
||||
label = bsdf_principled_hair_sample(
|
||||
kg, sc, sd, randu, randv, eval, omega_in, pdf, sampled_roughness, eta);
|
||||
label = bsdf_principled_hair_sample(kg, sc, sd, randu, randv, eval, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
|
||||
label = bsdf_principled_diffuse_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
*sampled_roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID:
|
||||
label = bsdf_principled_sheen_sample(sc, Ng, sd->I, randu, randv, eval, omega_in, pdf);
|
||||
*sampled_roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -274,12 +209,11 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
|
||||
const float frequency_multiplier =
|
||||
kernel_data_fetch(objects, sd->object).shadow_terminator_shading_offset;
|
||||
if (frequency_multiplier > 1.0f) {
|
||||
const float cosNI = dot(*omega_in, sc->N);
|
||||
*eval *= shift_cos_in(cosNI, frequency_multiplier);
|
||||
*eval *= shift_cos_in(dot(*omega_in, sc->N), frequency_multiplier);
|
||||
}
|
||||
if (label & LABEL_DIFFUSE) {
|
||||
if (!isequal(sc->N, sd->N)) {
|
||||
*eval *= bump_shadowing_term(sd->N, sc->N, *omega_in);
|
||||
*eval *= bump_shadowing_term((label & LABEL_TRANSMIT) ? -sd->N : sd->N, sc->N, *omega_in);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,246 +226,6 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
|
||||
return label;
|
||||
}
|
||||
|
||||
ccl_device_inline void bsdf_roughness_eta(const KernelGlobals kg,
|
||||
ccl_private const ShaderClosure *sc,
|
||||
ccl_private float2 *roughness,
|
||||
ccl_private float *eta)
|
||||
{
|
||||
bool refractive = false;
|
||||
float alpha = 1.0f;
|
||||
switch (sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
*roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
#ifdef __SVM__
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
*roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
# ifdef __OSL__
|
||||
case CLOSURE_BSDF_PHONG_RAMP_ID:
|
||||
alpha = phong_ramp_exponent_to_roughness(((ccl_private const PhongRampBsdf *)sc)->exponent);
|
||||
*roughness = make_float2(alpha, alpha);
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_RAMP_ID:
|
||||
*roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
# endif
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
*roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID: {
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
*roughness = zero_float2();
|
||||
*eta = bsdf->ior;
|
||||
break;
|
||||
}
|
||||
case CLOSURE_BSDF_REFRACTION_ID: {
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
*roughness = zero_float2();
|
||||
// do we need to inverse eta??
|
||||
*eta = bsdf->ior;
|
||||
break;
|
||||
}
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
*roughness = zero_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID: {
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
*roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
|
||||
refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
|
||||
*eta = refractive ? 1.0f / bsdf->ior : bsdf->ior;
|
||||
break;
|
||||
}
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID: {
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
*roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
|
||||
*eta = bsdf->ior;
|
||||
break;
|
||||
}
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID: {
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
*roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
|
||||
*eta = bsdf->ior;
|
||||
break;
|
||||
}
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID: {
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
*roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
|
||||
refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
|
||||
*eta = refractive ? 1.0f / bsdf->ior : bsdf->ior;
|
||||
} break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID: {
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
*roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
}
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
*roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_TOON_ID:
|
||||
*roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_GLOSSY_TOON_ID:
|
||||
// double check if this is valid
|
||||
*roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
|
||||
*roughness = make_float2(((ccl_private HairBsdf *)sc)->roughness1,
|
||||
((ccl_private HairBsdf *)sc)->roughness2);
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
*roughness = make_float2(((ccl_private HairBsdf *)sc)->roughness1,
|
||||
((ccl_private HairBsdf *)sc)->roughness2);
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_PRINCIPLED_ID:
|
||||
alpha = ((ccl_private PrincipledHairBSDF *)sc)->m0_roughness;
|
||||
*roughness = make_float2(alpha, alpha);
|
||||
*eta = ((ccl_private PrincipledHairBSDF *)sc)->eta;
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
|
||||
*roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID:
|
||||
*roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
*roughness = one_float2();
|
||||
*eta = 1.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ccl_device_inline int bsdf_label(const KernelGlobals kg,
|
||||
ccl_private const ShaderClosure *sc,
|
||||
const float3 omega_in)
|
||||
{
|
||||
/* For curves use the smooth normal, particularly for ribbons the geometric
|
||||
* normal gives too much darkening otherwise. */
|
||||
int label;
|
||||
switch (sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
case CLOSURE_BSSRDF_BURLEY_ID:
|
||||
case CLOSURE_BSSRDF_RANDOM_WALK_ID:
|
||||
case CLOSURE_BSSRDF_RANDOM_WALK_FIXED_RADIUS_ID:
|
||||
label = LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
break;
|
||||
#ifdef __SVM__
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
label = LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
break;
|
||||
# ifdef __OSL__
|
||||
case CLOSURE_BSDF_PHONG_RAMP_ID:
|
||||
label = LABEL_REFLECT | LABEL_GLOSSY;
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_RAMP_ID:
|
||||
label = LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
break;
|
||||
# endif
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
label = LABEL_TRANSMIT | LABEL_DIFFUSE;
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
label = LABEL_REFLECT | LABEL_SINGULAR;
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
label = LABEL_TRANSMIT | LABEL_SINGULAR;
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
label = LABEL_TRANSMIT | LABEL_TRANSPARENT;
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID: {
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
label = (bsdf->alpha_x * bsdf->alpha_y <= 1e-7f) ? LABEL_REFLECT | LABEL_SINGULAR :
|
||||
LABEL_REFLECT | LABEL_GLOSSY;
|
||||
break;
|
||||
}
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID: {
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
label = (bsdf->alpha_x * bsdf->alpha_y <= 1e-7f) ? LABEL_TRANSMIT | LABEL_SINGULAR :
|
||||
LABEL_TRANSMIT | LABEL_GLOSSY;
|
||||
break;
|
||||
}
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID:
|
||||
label = (bsdf_is_transmission(sc, omega_in)) ? LABEL_TRANSMIT | LABEL_GLOSSY :
|
||||
LABEL_REFLECT | LABEL_GLOSSY;
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
|
||||
label = LABEL_REFLECT | LABEL_GLOSSY;
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
label = LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_TOON_ID:
|
||||
label = LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
break;
|
||||
case CLOSURE_BSDF_GLOSSY_TOON_ID:
|
||||
label = LABEL_REFLECT | LABEL_GLOSSY;
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
|
||||
label = LABEL_REFLECT | LABEL_GLOSSY;
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
label = LABEL_TRANSMIT | LABEL_GLOSSY;
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_PRINCIPLED_ID:
|
||||
if (bsdf_is_transmission(sc, omega_in))
|
||||
label = LABEL_TRANSMIT | LABEL_GLOSSY;
|
||||
else
|
||||
label = LABEL_REFLECT | LABEL_GLOSSY;
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
|
||||
label = LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID:
|
||||
label = LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
label = LABEL_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Test if BSDF sample should be treated as transparent for background. */
|
||||
if (label & LABEL_TRANSMIT) {
|
||||
float threshold_squared = kernel_data.background.transparent_roughness_squared_threshold;
|
||||
|
||||
if (threshold_squared >= 0.0f) {
|
||||
if (bsdf_get_specular_roughness_squared(sc) <= threshold_squared) {
|
||||
label |= LABEL_TRANSMIT_TRANSPARENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
return label;
|
||||
}
|
||||
|
||||
#ifndef __KERNEL_CUDA__
|
||||
ccl_device
|
||||
#else
|
||||
@@ -542,104 +236,179 @@ ccl_device_inline
|
||||
ccl_private ShaderData *sd,
|
||||
ccl_private const ShaderClosure *sc,
|
||||
const float3 omega_in,
|
||||
const bool is_transmission,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
Spectrum eval = zero_spectrum();
|
||||
|
||||
switch (sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
eval = bsdf_diffuse_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
if (!is_transmission) {
|
||||
switch (sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
eval = bsdf_diffuse_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#if defined(__SVM__) || defined(__OSL__)
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
eval = bsdf_oren_nayar_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
eval = bsdf_oren_nayar_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
# ifdef __OSL__
|
||||
case CLOSURE_BSDF_PHONG_RAMP_ID:
|
||||
eval = bsdf_phong_ramp_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_RAMP_ID:
|
||||
eval = bsdf_diffuse_ramp_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_PHONG_RAMP_ID:
|
||||
eval = bsdf_phong_ramp_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_RAMP_ID:
|
||||
eval = bsdf_diffuse_ramp_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
# endif
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
eval = bsdf_translucent_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
eval = bsdf_reflection_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
eval = bsdf_refraction_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
eval = bsdf_transparent_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_ggx_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID:
|
||||
eval = bsdf_microfacet_multi_ggx_eval(sc, sd->I, omega_in, pdf, &sd->lcg_state);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID:
|
||||
eval = bsdf_microfacet_multi_ggx_glass_eval(sc, sd->I, omega_in, pdf, &sd->lcg_state);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_beckmann_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
|
||||
eval = bsdf_ashikhmin_shirley_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
eval = bsdf_ashikhmin_velvet_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_TOON_ID:
|
||||
eval = bsdf_diffuse_toon_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_GLOSSY_TOON_ID:
|
||||
eval = bsdf_glossy_toon_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_PRINCIPLED_ID:
|
||||
eval = bsdf_principled_hair_eval(kg, sd, sc, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
|
||||
eval = bsdf_hair_reflection_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
eval = bsdf_hair_transmission_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
|
||||
eval = bsdf_principled_diffuse_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID:
|
||||
eval = bsdf_principled_sheen_eval(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
eval = bsdf_translucent_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
eval = bsdf_reflection_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
eval = bsdf_refraction_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
eval = bsdf_transparent_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_ggx_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID:
|
||||
eval = bsdf_microfacet_multi_ggx_eval_reflect(sc, sd->I, omega_in, pdf, &sd->lcg_state);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID:
|
||||
eval = bsdf_microfacet_multi_ggx_glass_eval_reflect(
|
||||
sc, sd->I, omega_in, pdf, &sd->lcg_state);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_beckmann_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
|
||||
eval = bsdf_ashikhmin_shirley_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
eval = bsdf_ashikhmin_velvet_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_TOON_ID:
|
||||
eval = bsdf_diffuse_toon_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_GLOSSY_TOON_ID:
|
||||
eval = bsdf_glossy_toon_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_PRINCIPLED_ID:
|
||||
eval = bsdf_principled_hair_eval(kg, sd, sc, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
|
||||
eval = bsdf_hair_reflection_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
eval = bsdf_hair_transmission_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
|
||||
eval = bsdf_principled_diffuse_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID:
|
||||
eval = bsdf_principled_sheen_eval_reflect(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
|
||||
if (!isequal(sc->N, sd->N)) {
|
||||
eval *= bump_shadowing_term(sd->N, sc->N, omega_in);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
|
||||
if (!isequal(sc->N, sd->N)) {
|
||||
eval *= bump_shadowing_term(sd->N, sc->N, omega_in);
|
||||
}
|
||||
}
|
||||
/* Shadow terminator offset. */
|
||||
const float frequency_multiplier =
|
||||
kernel_data_fetch(objects, sd->object).shadow_terminator_shading_offset;
|
||||
if (frequency_multiplier > 1.0f) {
|
||||
eval *= shift_cos_in(dot(omega_in, sc->N), frequency_multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
/* Shadow terminator offset. */
|
||||
const float frequency_multiplier =
|
||||
kernel_data_fetch(objects, sd->object).shadow_terminator_shading_offset;
|
||||
if (frequency_multiplier > 1.0f) {
|
||||
const float cosNI = dot(omega_in, sc->N);
|
||||
if (cosNI >= 0.0f) {
|
||||
eval *= shift_cos_in(cosNI, frequency_multiplier);
|
||||
else {
|
||||
switch (sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
eval = bsdf_diffuse_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#if defined(__SVM__) || defined(__OSL__)
|
||||
case CLOSURE_BSDF_OREN_NAYAR_ID:
|
||||
eval = bsdf_oren_nayar_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSLUCENT_ID:
|
||||
eval = bsdf_translucent_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFLECTION_ID:
|
||||
eval = bsdf_reflection_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_REFRACTION_ID:
|
||||
eval = bsdf_refraction_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_TRANSPARENT_ID:
|
||||
eval = bsdf_transparent_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_FRESNEL_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_CLEARCOAT_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_ggx_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID:
|
||||
eval = bsdf_microfacet_multi_ggx_eval_transmit(sc, sd->I, omega_in, pdf, &sd->lcg_state);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_FRESNEL_ID:
|
||||
eval = bsdf_microfacet_multi_ggx_glass_eval_transmit(
|
||||
sc, sd->I, omega_in, pdf, &sd->lcg_state);
|
||||
break;
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_ID:
|
||||
case CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID:
|
||||
eval = bsdf_microfacet_beckmann_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID:
|
||||
eval = bsdf_ashikhmin_shirley_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_ASHIKHMIN_VELVET_ID:
|
||||
eval = bsdf_ashikhmin_velvet_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_DIFFUSE_TOON_ID:
|
||||
eval = bsdf_diffuse_toon_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_GLOSSY_TOON_ID:
|
||||
eval = bsdf_glossy_toon_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_PRINCIPLED_ID:
|
||||
eval = bsdf_principled_hair_eval(kg, sd, sc, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
|
||||
eval = bsdf_hair_reflection_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID:
|
||||
eval = bsdf_hair_transmission_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID:
|
||||
eval = bsdf_principled_diffuse_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
case CLOSURE_BSDF_PRINCIPLED_SHEEN_ID:
|
||||
eval = bsdf_principled_sheen_eval_transmit(sc, sd->I, omega_in, pdf);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
|
||||
if (!isequal(sc->N, sd->N)) {
|
||||
eval *= bump_shadowing_term(-sd->N, sc->N, omega_in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_CYCLES_DEBUG
|
||||
kernel_assert(*pdf >= 0.0f);
|
||||
kernel_assert(eval.x >= 0.0f && eval.y >= 0.0f && eval.z >= 0.0f);
|
||||
|
@@ -39,10 +39,11 @@ ccl_device_inline float bsdf_ashikhmin_shirley_roughness_to_exponent(float rough
|
||||
return 2.0f / (roughness * roughness) - 2.0f;
|
||||
}
|
||||
|
||||
ccl_device_forceinline Spectrum bsdf_ashikhmin_shirley_eval(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
ccl_device_forceinline Spectrum
|
||||
bsdf_ashikhmin_shirley_eval_reflect(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
float3 N = bsdf->N;
|
||||
@@ -52,60 +53,70 @@ ccl_device_forceinline Spectrum bsdf_ashikhmin_shirley_eval(ccl_private const Sh
|
||||
|
||||
float out = 0.0f;
|
||||
|
||||
if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f || !(NdotI > 0.0f && NdotO > 0.0f)) {
|
||||
if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f) {
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
if (NdotI > 0.0f && NdotO > 0.0f) {
|
||||
NdotI = fmaxf(NdotI, 1e-6f);
|
||||
NdotO = fmaxf(NdotO, 1e-6f);
|
||||
float3 H = normalize(omega_in + I);
|
||||
float HdotI = fmaxf(fabsf(dot(H, I)), 1e-6f);
|
||||
float HdotN = fmaxf(dot(H, N), 1e-6f);
|
||||
|
||||
NdotI = fmaxf(NdotI, 1e-6f);
|
||||
NdotO = fmaxf(NdotO, 1e-6f);
|
||||
float3 H = normalize(omega_in + I);
|
||||
float HdotI = fmaxf(fabsf(dot(H, I)), 1e-6f);
|
||||
float HdotN = fmaxf(dot(H, N), 1e-6f);
|
||||
/* pump from original paper
|
||||
* (first derivative disc., but cancels the HdotI in the pdf nicely) */
|
||||
float pump = 1.0f / fmaxf(1e-6f, (HdotI * fmaxf(NdotO, NdotI)));
|
||||
/* pump from d-brdf paper */
|
||||
/*float pump = 1.0f / fmaxf(1e-4f, ((NdotO + NdotI) * (NdotO*NdotI))); */
|
||||
|
||||
/* pump from original paper
|
||||
* (first derivative disc., but cancels the HdotI in the pdf nicely) */
|
||||
float pump = 1.0f / fmaxf(1e-6f, (HdotI * fmaxf(NdotO, NdotI)));
|
||||
/* pump from d-brdf paper */
|
||||
/*float pump = 1.0f / fmaxf(1e-4f, ((NdotO + NdotI) * (NdotO*NdotI))); */
|
||||
float n_x = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_x);
|
||||
float n_y = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_y);
|
||||
|
||||
float n_x = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_x);
|
||||
float n_y = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_y);
|
||||
if (n_x == n_y) {
|
||||
/* isotropic */
|
||||
float e = n_x;
|
||||
float lobe = powf(HdotN, e);
|
||||
float norm = (n_x + 1.0f) / (8.0f * M_PI_F);
|
||||
|
||||
if (n_x == n_y) {
|
||||
/* isotropic */
|
||||
float e = n_x;
|
||||
float lobe = powf(HdotN, e);
|
||||
float norm = (n_x + 1.0f) / (8.0f * M_PI_F);
|
||||
|
||||
out = NdotO * norm * lobe * pump;
|
||||
/* this is p_h / 4(H.I) (conversion from 'wh measure' to 'wi measure', eq. 8 in paper). */
|
||||
*pdf = norm * lobe / HdotI;
|
||||
}
|
||||
else {
|
||||
/* anisotropic */
|
||||
float3 X, Y;
|
||||
make_orthonormals_tangent(N, bsdf->T, &X, &Y);
|
||||
|
||||
float HdotX = dot(H, X);
|
||||
float HdotY = dot(H, Y);
|
||||
float lobe;
|
||||
if (HdotN < 1.0f) {
|
||||
float e = (n_x * HdotX * HdotX + n_y * HdotY * HdotY) / (1.0f - HdotN * HdotN);
|
||||
lobe = powf(HdotN, e);
|
||||
out = NdotO * norm * lobe * pump;
|
||||
/* this is p_h / 4(H.I) (conversion from 'wh measure' to 'wi measure', eq. 8 in paper). */
|
||||
*pdf = norm * lobe / HdotI;
|
||||
}
|
||||
else {
|
||||
lobe = 1.0f;
|
||||
}
|
||||
float norm = sqrtf((n_x + 1.0f) * (n_y + 1.0f)) / (8.0f * M_PI_F);
|
||||
/* anisotropic */
|
||||
float3 X, Y;
|
||||
make_orthonormals_tangent(N, bsdf->T, &X, &Y);
|
||||
|
||||
out = NdotO * norm * lobe * pump;
|
||||
*pdf = norm * lobe / HdotI;
|
||||
float HdotX = dot(H, X);
|
||||
float HdotY = dot(H, Y);
|
||||
float lobe;
|
||||
if (HdotN < 1.0f) {
|
||||
float e = (n_x * HdotX * HdotX + n_y * HdotY * HdotY) / (1.0f - HdotN * HdotN);
|
||||
lobe = powf(HdotN, e);
|
||||
}
|
||||
else {
|
||||
lobe = 1.0f;
|
||||
}
|
||||
float norm = sqrtf((n_x + 1.0f) * (n_y + 1.0f)) / (8.0f * M_PI_F);
|
||||
|
||||
out = NdotO * norm * lobe * pump;
|
||||
*pdf = norm * lobe / HdotI;
|
||||
}
|
||||
}
|
||||
|
||||
return make_spectrum(out);
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_ashikhmin_shirley_eval_transmit(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
ccl_device_inline void bsdf_ashikhmin_shirley_sample_first_quadrant(float n_x,
|
||||
float n_y,
|
||||
float randu,
|
||||
@@ -126,93 +137,88 @@ ccl_device int bsdf_ashikhmin_shirley_sample(ccl_private const ShaderClosure *sc
|
||||
float randv,
|
||||
ccl_private Spectrum *eval,
|
||||
ccl_private float3 *omega_in,
|
||||
ccl_private float *pdf,
|
||||
ccl_private float2 *sampled_roughness)
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
*sampled_roughness = make_float2(bsdf->alpha_x, bsdf->alpha_y);
|
||||
float3 N = bsdf->N;
|
||||
int label = LABEL_REFLECT | LABEL_GLOSSY;
|
||||
|
||||
float NdotI = dot(N, I);
|
||||
if (!(NdotI > 0.0f)) {
|
||||
*pdf = 0.0f;
|
||||
*eval = zero_spectrum();
|
||||
return LABEL_NONE;
|
||||
}
|
||||
if (NdotI > 0.0f) {
|
||||
|
||||
float n_x = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_x);
|
||||
float n_y = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_y);
|
||||
float n_x = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_x);
|
||||
float n_y = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_y);
|
||||
|
||||
/* get x,y basis on the surface for anisotropy */
|
||||
float3 X, Y;
|
||||
/* get x,y basis on the surface for anisotropy */
|
||||
float3 X, Y;
|
||||
|
||||
if (n_x == n_y)
|
||||
make_orthonormals(N, &X, &Y);
|
||||
else
|
||||
make_orthonormals_tangent(N, bsdf->T, &X, &Y);
|
||||
if (n_x == n_y)
|
||||
make_orthonormals(N, &X, &Y);
|
||||
else
|
||||
make_orthonormals_tangent(N, bsdf->T, &X, &Y);
|
||||
|
||||
/* sample spherical coords for h in tangent space */
|
||||
float phi;
|
||||
float cos_theta;
|
||||
if (n_x == n_y) {
|
||||
/* isotropic sampling */
|
||||
phi = M_2PI_F * randu;
|
||||
cos_theta = powf(randv, 1.0f / (n_x + 1.0f));
|
||||
}
|
||||
else {
|
||||
/* anisotropic sampling */
|
||||
if (randu < 0.25f) { /* first quadrant */
|
||||
float remapped_randu = 4.0f * randu;
|
||||
bsdf_ashikhmin_shirley_sample_first_quadrant(
|
||||
n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
|
||||
/* sample spherical coords for h in tangent space */
|
||||
float phi;
|
||||
float cos_theta;
|
||||
if (n_x == n_y) {
|
||||
/* isotropic sampling */
|
||||
phi = M_2PI_F * randu;
|
||||
cos_theta = powf(randv, 1.0f / (n_x + 1.0f));
|
||||
}
|
||||
else if (randu < 0.5f) { /* second quadrant */
|
||||
float remapped_randu = 4.0f * (.5f - randu);
|
||||
bsdf_ashikhmin_shirley_sample_first_quadrant(
|
||||
n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
|
||||
phi = M_PI_F - phi;
|
||||
else {
|
||||
/* anisotropic sampling */
|
||||
if (randu < 0.25f) { /* first quadrant */
|
||||
float remapped_randu = 4.0f * randu;
|
||||
bsdf_ashikhmin_shirley_sample_first_quadrant(
|
||||
n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
|
||||
}
|
||||
else if (randu < 0.5f) { /* second quadrant */
|
||||
float remapped_randu = 4.0f * (.5f - randu);
|
||||
bsdf_ashikhmin_shirley_sample_first_quadrant(
|
||||
n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
|
||||
phi = M_PI_F - phi;
|
||||
}
|
||||
else if (randu < 0.75f) { /* third quadrant */
|
||||
float remapped_randu = 4.0f * (randu - 0.5f);
|
||||
bsdf_ashikhmin_shirley_sample_first_quadrant(
|
||||
n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
|
||||
phi = M_PI_F + phi;
|
||||
}
|
||||
else { /* fourth quadrant */
|
||||
float remapped_randu = 4.0f * (1.0f - randu);
|
||||
bsdf_ashikhmin_shirley_sample_first_quadrant(
|
||||
n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
|
||||
phi = 2.0f * M_PI_F - phi;
|
||||
}
|
||||
}
|
||||
else if (randu < 0.75f) { /* third quadrant */
|
||||
float remapped_randu = 4.0f * (randu - 0.5f);
|
||||
bsdf_ashikhmin_shirley_sample_first_quadrant(
|
||||
n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
|
||||
phi = M_PI_F + phi;
|
||||
|
||||
/* get half vector in tangent space */
|
||||
float sin_theta = sqrtf(fmaxf(0.0f, 1.0f - cos_theta * cos_theta));
|
||||
float cos_phi = cosf(phi);
|
||||
float sin_phi = sinf(phi); /* no sqrt(1-cos^2) here b/c it causes artifacts */
|
||||
float3 h = make_float3(sin_theta * cos_phi, sin_theta * sin_phi, cos_theta);
|
||||
|
||||
/* half vector to world space */
|
||||
float3 H = h.x * X + h.y * Y + h.z * N;
|
||||
float HdotI = dot(H, I);
|
||||
if (HdotI < 0.0f)
|
||||
H = -H;
|
||||
|
||||
/* reflect I on H to get omega_in */
|
||||
*omega_in = -I + (2.0f * HdotI) * H;
|
||||
|
||||
if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f) {
|
||||
/* Some high number for MIS. */
|
||||
*pdf = 1e6f;
|
||||
*eval = make_spectrum(1e6f);
|
||||
label = LABEL_REFLECT | LABEL_SINGULAR;
|
||||
}
|
||||
else { /* fourth quadrant */
|
||||
float remapped_randu = 4.0f * (1.0f - randu);
|
||||
bsdf_ashikhmin_shirley_sample_first_quadrant(
|
||||
n_x, n_y, remapped_randu, randv, &phi, &cos_theta);
|
||||
phi = 2.0f * M_PI_F - phi;
|
||||
else {
|
||||
/* leave the rest to eval_reflect */
|
||||
*eval = bsdf_ashikhmin_shirley_eval_reflect(sc, I, *omega_in, pdf);
|
||||
}
|
||||
}
|
||||
|
||||
/* get half vector in tangent space */
|
||||
float sin_theta = sqrtf(fmaxf(0.0f, 1.0f - cos_theta * cos_theta));
|
||||
float cos_phi = cosf(phi);
|
||||
float sin_phi = sinf(phi); /* no sqrt(1-cos^2) here b/c it causes artifacts */
|
||||
float3 h = make_float3(sin_theta * cos_phi, sin_theta * sin_phi, cos_theta);
|
||||
|
||||
/* half vector to world space */
|
||||
float3 H = h.x * X + h.y * Y + h.z * N;
|
||||
float HdotI = dot(H, I);
|
||||
if (HdotI < 0.0f)
|
||||
H = -H;
|
||||
|
||||
/* reflect I on H to get omega_in */
|
||||
*omega_in = -I + (2.0f * HdotI) * H;
|
||||
|
||||
if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f) {
|
||||
/* Some high number for MIS. */
|
||||
*pdf = 1e6f;
|
||||
*eval = make_spectrum(1e6f);
|
||||
label = LABEL_REFLECT | LABEL_SINGULAR;
|
||||
}
|
||||
else {
|
||||
/* leave the rest to eval */
|
||||
*eval = bsdf_ashikhmin_shirley_eval(sc, I, *omega_in, pdf);
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
|
@@ -31,10 +31,10 @@ ccl_device int bsdf_ashikhmin_velvet_setup(ccl_private VelvetBsdf *bsdf)
|
||||
return SD_BSDF | SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_ashikhmin_velvet_eval(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
ccl_device Spectrum bsdf_ashikhmin_velvet_eval_reflect(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
ccl_private const VelvetBsdf *bsdf = (ccl_private const VelvetBsdf *)sc;
|
||||
float m_invsigma2 = bsdf->invsigma2;
|
||||
@@ -42,37 +42,46 @@ ccl_device Spectrum bsdf_ashikhmin_velvet_eval(ccl_private const ShaderClosure *
|
||||
|
||||
float cosNO = dot(N, I);
|
||||
float cosNI = dot(N, omega_in);
|
||||
if (!(cosNO > 0 && cosNI > 0)) {
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
if (cosNO > 0 && cosNI > 0) {
|
||||
float3 H = normalize(omega_in + I);
|
||||
|
||||
float cosNH = dot(N, H);
|
||||
float cosHO = fabsf(dot(I, H));
|
||||
|
||||
if (!(fabsf(cosNH) < 1.0f - 1e-5f && cosHO > 1e-5f)) {
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
float cosNHdivHO = cosNH / cosHO;
|
||||
cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
|
||||
|
||||
float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
|
||||
float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
|
||||
|
||||
float sinNH2 = 1 - cosNH * cosNH;
|
||||
float sinNH4 = sinNH2 * sinNH2;
|
||||
float cotangent2 = (cosNH * cosNH) / sinNH2;
|
||||
|
||||
float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
|
||||
float G = fminf(1.0f, fminf(fac1, fac2)); // TODO: derive G from D analytically
|
||||
|
||||
float out = 0.25f * (D * G) / cosNO;
|
||||
|
||||
*pdf = 0.5f * M_1_PI_F;
|
||||
return make_spectrum(out);
|
||||
}
|
||||
|
||||
float3 H = normalize(omega_in + I);
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
float cosNH = dot(N, H);
|
||||
float cosHO = fabsf(dot(I, H));
|
||||
|
||||
if (!(fabsf(cosNH) < 1.0f - 1e-5f && cosHO > 1e-5f)) {
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
float cosNHdivHO = cosNH / cosHO;
|
||||
cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
|
||||
|
||||
float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
|
||||
float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
|
||||
|
||||
float sinNH2 = 1 - cosNH * cosNH;
|
||||
float sinNH4 = sinNH2 * sinNH2;
|
||||
float cotangent2 = (cosNH * cosNH) / sinNH2;
|
||||
|
||||
float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
|
||||
float G = fminf(1.0f, fminf(fac1, fac2)); // TODO: derive G from D analytically
|
||||
|
||||
float out = 0.25f * (D * G) / cosNO;
|
||||
|
||||
*pdf = 0.5f * M_1_PI_F;
|
||||
return make_spectrum(out);
|
||||
ccl_device Spectrum bsdf_ashikhmin_velvet_eval_transmit(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
ccl_device int bsdf_ashikhmin_velvet_sample(ccl_private const ShaderClosure *sc,
|
||||
@@ -92,42 +101,41 @@ ccl_device int bsdf_ashikhmin_velvet_sample(ccl_private const ShaderClosure *sc,
|
||||
// distribution over the hemisphere
|
||||
sample_uniform_hemisphere(N, randu, randv, omega_in, pdf);
|
||||
|
||||
if (!(dot(Ng, *omega_in) > 0)) {
|
||||
if (dot(Ng, *omega_in) > 0) {
|
||||
float3 H = normalize(*omega_in + I);
|
||||
|
||||
float cosNI = dot(N, *omega_in);
|
||||
float cosNO = dot(N, I);
|
||||
float cosNH = dot(N, H);
|
||||
float cosHO = fabsf(dot(I, H));
|
||||
|
||||
if (fabsf(cosNO) > 1e-5f && fabsf(cosNH) < 1.0f - 1e-5f && cosHO > 1e-5f) {
|
||||
float cosNHdivHO = cosNH / cosHO;
|
||||
cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
|
||||
|
||||
float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
|
||||
float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
|
||||
|
||||
float sinNH2 = 1 - cosNH * cosNH;
|
||||
float sinNH4 = sinNH2 * sinNH2;
|
||||
float cotangent2 = (cosNH * cosNH) / sinNH2;
|
||||
|
||||
float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
|
||||
float G = fminf(1.0f, fminf(fac1, fac2)); // TODO: derive G from D analytically
|
||||
|
||||
float power = 0.25f * (D * G) / cosNO;
|
||||
|
||||
*eval = make_spectrum(power);
|
||||
}
|
||||
else {
|
||||
*pdf = 0.0f;
|
||||
*eval = zero_spectrum();
|
||||
}
|
||||
}
|
||||
else {
|
||||
*pdf = 0.0f;
|
||||
*eval = zero_spectrum();
|
||||
return LABEL_NONE;
|
||||
}
|
||||
|
||||
float3 H = normalize(*omega_in + I);
|
||||
|
||||
float cosNI = dot(N, *omega_in);
|
||||
float cosNO = dot(N, I);
|
||||
float cosNH = dot(N, H);
|
||||
float cosHO = fabsf(dot(I, H));
|
||||
|
||||
if (!(fabsf(cosNO) > 1e-5f && fabsf(cosNH) < 1.0f - 1e-5f && cosHO > 1e-5f)) {
|
||||
*pdf = 0.0f;
|
||||
*eval = zero_spectrum();
|
||||
return LABEL_NONE;
|
||||
}
|
||||
|
||||
float cosNHdivHO = cosNH / cosHO;
|
||||
cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
|
||||
|
||||
float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
|
||||
float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
|
||||
|
||||
float sinNH2 = 1 - cosNH * cosNH;
|
||||
float sinNH4 = sinNH2 * sinNH2;
|
||||
float cotangent2 = (cosNH * cosNH) / sinNH2;
|
||||
|
||||
float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
|
||||
float G = fminf(1.0f, fminf(fac1, fac2)); // TODO: derive G from D analytically
|
||||
|
||||
float power = 0.25f * (D * G) / cosNO;
|
||||
|
||||
*eval = make_spectrum(power);
|
||||
|
||||
return LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
}
|
||||
|
||||
|
@@ -26,10 +26,10 @@ ccl_device int bsdf_diffuse_setup(ccl_private DiffuseBsdf *bsdf)
|
||||
return SD_BSDF | SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_diffuse_eval(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
ccl_device Spectrum bsdf_diffuse_eval_reflect(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
ccl_private const DiffuseBsdf *bsdf = (ccl_private const DiffuseBsdf *)sc;
|
||||
float3 N = bsdf->N;
|
||||
@@ -39,6 +39,15 @@ ccl_device Spectrum bsdf_diffuse_eval(ccl_private const ShaderClosure *sc,
|
||||
return make_spectrum(cos_pi);
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_diffuse_eval_transmit(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
ccl_device int bsdf_diffuse_sample(ccl_private const ShaderClosure *sc,
|
||||
float3 Ng,
|
||||
float3 I,
|
||||
@@ -72,10 +81,19 @@ ccl_device int bsdf_translucent_setup(ccl_private DiffuseBsdf *bsdf)
|
||||
return SD_BSDF | SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_translucent_eval(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
ccl_device Spectrum bsdf_translucent_eval_reflect(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_translucent_eval_transmit(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
ccl_private const DiffuseBsdf *bsdf = (ccl_private const DiffuseBsdf *)sc;
|
||||
float3 N = bsdf->N;
|
||||
|
@@ -47,23 +47,25 @@ ccl_device void bsdf_diffuse_ramp_blur(ccl_private ShaderClosure *sc, float roug
|
||||
{
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_diffuse_ramp_eval(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
ccl_device Spectrum bsdf_diffuse_ramp_eval_reflect(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
const DiffuseRampBsdf *bsdf = (const DiffuseRampBsdf *)sc;
|
||||
float3 N = bsdf->N;
|
||||
|
||||
float cos_pi = fmaxf(dot(N, omega_in), 0.0f);
|
||||
if (cos_pi >= 0.0f) {
|
||||
*pdf = cos_pi * M_1_PI_F;
|
||||
return rgb_to_spectrum(bsdf_diffuse_ramp_get_color(bsdf->colors, cos_pi) * M_1_PI_F);
|
||||
}
|
||||
else {
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
*pdf = cos_pi * M_1_PI_F;
|
||||
return rgb_to_spectrum(bsdf_diffuse_ramp_get_color(bsdf->colors, cos_pi) * M_1_PI_F);
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_diffuse_ramp_eval_transmit(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
ccl_device int bsdf_diffuse_ramp_sample(ccl_private const ShaderClosure *sc,
|
||||
|
@@ -37,17 +37,12 @@ ccl_device int bsdf_hair_transmission_setup(ccl_private HairBsdf *bsdf)
|
||||
return SD_BSDF | SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_hair_reflection_eval(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
ccl_device Spectrum bsdf_hair_reflection_eval_reflect(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
ccl_private const HairBsdf *bsdf = (ccl_private const HairBsdf *)sc;
|
||||
if (dot(bsdf->N, omega_in) < 0.0f) {
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
float offset = bsdf->offset;
|
||||
float3 Tg = bsdf->T;
|
||||
float roughness1 = bsdf->roughness1;
|
||||
@@ -89,17 +84,30 @@ ccl_device Spectrum bsdf_hair_reflection_eval(ccl_private const ShaderClosure *s
|
||||
return make_spectrum(*pdf);
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_hair_transmission_eval(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
ccl_device Spectrum bsdf_hair_transmission_eval_reflect(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_hair_reflection_eval_transmit(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
ccl_device Spectrum bsdf_hair_transmission_eval_transmit(ccl_private const ShaderClosure *sc,
|
||||
const float3 I,
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
ccl_private const HairBsdf *bsdf = (ccl_private const HairBsdf *)sc;
|
||||
if (dot(bsdf->N, omega_in) >= 0.0f) {
|
||||
*pdf = 0.0f;
|
||||
return zero_spectrum();
|
||||
}
|
||||
|
||||
float offset = bsdf->offset;
|
||||
float3 Tg = bsdf->T;
|
||||
float roughness1 = bsdf->roughness1;
|
||||
@@ -147,15 +155,13 @@ ccl_device int bsdf_hair_reflection_sample(ccl_private const ShaderClosure *sc,
|
||||
float randv,
|
||||
ccl_private Spectrum *eval,
|
||||
ccl_private float3 *omega_in,
|
||||
ccl_private float *pdf,
|
||||
ccl_private float2 *sampled_roughness)
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
ccl_private const HairBsdf *bsdf = (ccl_private const HairBsdf *)sc;
|
||||
float offset = bsdf->offset;
|
||||
float3 Tg = bsdf->T;
|
||||
float roughness1 = bsdf->roughness1;
|
||||
float roughness2 = bsdf->roughness2;
|
||||
*sampled_roughness = make_float2(roughness1, roughness2);
|
||||
float Iz = dot(Tg, I);
|
||||
float3 locy = normalize(I - Tg * Iz);
|
||||
float3 locx = cross(locy, Tg);
|
||||
@@ -200,15 +206,13 @@ ccl_device int bsdf_hair_transmission_sample(ccl_private const ShaderClosure *sc
|
||||
float randv,
|
||||
ccl_private Spectrum *eval,
|
||||
ccl_private float3 *omega_in,
|
||||
ccl_private float *pdf,
|
||||
ccl_private float2 *sampled_roughness)
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
ccl_private const HairBsdf *bsdf = (ccl_private const HairBsdf *)sc;
|
||||
float offset = bsdf->offset;
|
||||
float3 Tg = bsdf->T;
|
||||
float roughness1 = bsdf->roughness1;
|
||||
float roughness2 = bsdf->roughness2;
|
||||
*sampled_roughness = make_float2(roughness1, roughness2);
|
||||
float Iz = dot(Tg, I);
|
||||
float3 locy = normalize(I - Tg * Iz);
|
||||
float3 locx = cross(locy, Tg);
|
||||
|
@@ -56,7 +56,13 @@ ccl_device_inline float delta_phi(int p, float gamma_o, float gamma_t)
|
||||
/* Remaps the given angle to [-pi, pi]. */
|
||||
ccl_device_inline float wrap_angle(float a)
|
||||
{
|
||||
return (a + M_PI_F) - M_2PI_F * floorf((a + M_PI_F) / M_2PI_F) - M_PI_F;
|
||||
while (a > M_PI_F) {
|
||||
a -= M_2PI_F;
|
||||
}
|
||||
while (a < -M_PI_F) {
|
||||
a += M_2PI_F;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
/* Logistic distribution function. */
|
||||
@@ -265,72 +271,76 @@ ccl_device Spectrum bsdf_principled_hair_eval(KernelGlobals kg,
|
||||
kernel_assert(isfinite_safe(sd->P) && isfinite_safe(sd->ray_length));
|
||||
|
||||
ccl_private const PrincipledHairBSDF *bsdf = (ccl_private const PrincipledHairBSDF *)sc;
|
||||
const float3 Y = float4_to_float3(bsdf->extra->geom);
|
||||
float3 Y = float4_to_float3(bsdf->extra->geom);
|
||||
|
||||
const float3 X = safe_normalize(sd->dPdu);
|
||||
float3 X = safe_normalize(sd->dPdu);
|
||||
kernel_assert(fabsf(dot(X, Y)) < 1e-3f);
|
||||
const float3 Z = safe_normalize(cross(X, Y));
|
||||
float3 Z = safe_normalize(cross(X, Y));
|
||||
|
||||
const float3 wo = make_float3(dot(sd->I, X), dot(sd->I, Y), dot(sd->I, Z));
|
||||
const float3 wi = make_float3(dot(omega_in, X), dot(omega_in, Y), dot(omega_in, Z));
|
||||
float3 wo = make_float3(dot(sd->I, X), dot(sd->I, Y), dot(sd->I, Z));
|
||||
float3 wi = make_float3(dot(omega_in, X), dot(omega_in, Y), dot(omega_in, Z));
|
||||
|
||||
const float sin_theta_o = wo.x;
|
||||
const float cos_theta_o = cos_from_sin(sin_theta_o);
|
||||
const float phi_o = atan2f(wo.z, wo.y);
|
||||
float sin_theta_o = wo.x;
|
||||
float cos_theta_o = cos_from_sin(sin_theta_o);
|
||||
float phi_o = atan2f(wo.z, wo.y);
|
||||
|
||||
const float sin_theta_t = sin_theta_o / bsdf->eta;
|
||||
const float cos_theta_t = cos_from_sin(sin_theta_t);
|
||||
float sin_theta_t = sin_theta_o / bsdf->eta;
|
||||
float cos_theta_t = cos_from_sin(sin_theta_t);
|
||||
|
||||
const float sin_gamma_o = bsdf->extra->geom.w;
|
||||
const float cos_gamma_o = cos_from_sin(sin_gamma_o);
|
||||
const float gamma_o = safe_asinf(sin_gamma_o);
|
||||
float sin_gamma_o = bsdf->extra->geom.w;
|
||||
float cos_gamma_o = cos_from_sin(sin_gamma_o);
|
||||
float gamma_o = safe_asinf(sin_gamma_o);
|
||||
|
||||
const float sin_gamma_t = sin_gamma_o * cos_theta_o / sqrtf(sqr(bsdf->eta) - sqr(sin_theta_o));
|
||||
const float cos_gamma_t = cos_from_sin(sin_gamma_t);
|
||||
const float gamma_t = safe_asinf(sin_gamma_t);
|
||||
float sin_gamma_t = sin_gamma_o * cos_theta_o / sqrtf(sqr(bsdf->eta) - sqr(sin_theta_o));
|
||||
float cos_gamma_t = cos_from_sin(sin_gamma_t);
|
||||
float gamma_t = safe_asinf(sin_gamma_t);
|
||||
|
||||
const Spectrum T = exp(-bsdf->sigma * (2.0f * cos_gamma_t / cos_theta_t));
|
||||
Spectrum T = exp(-bsdf->sigma * (2.0f * cos_gamma_t / cos_theta_t));
|
||||
Spectrum Ap[4];
|
||||
float Ap_energy[4];
|
||||
hair_attenuation(
|
||||
kg, fresnel_dielectric_cos(cos_theta_o * cos_gamma_o, bsdf->eta), T, Ap, Ap_energy);
|
||||
|
||||
const float sin_theta_i = wi.x;
|
||||
const float cos_theta_i = cos_from_sin(sin_theta_i);
|
||||
const float phi_i = atan2f(wi.z, wi.y);
|
||||
float sin_theta_i = wi.x;
|
||||
float cos_theta_i = cos_from_sin(sin_theta_i);
|
||||
float phi_i = atan2f(wi.z, wi.y);
|
||||
|
||||
const float phi = phi_i - phi_o;
|
||||
float phi = phi_i - phi_o;
|
||||
|
||||
float angles[6];
|
||||
hair_alpha_angles(sin_theta_i, cos_theta_i, bsdf->alpha, angles);
|
||||
|
||||
Spectrum F = zero_spectrum();
|
||||
float F_energy = 0.0f;
|
||||
Spectrum F;
|
||||
float F_energy;
|
||||
float Mp, Np;
|
||||
|
||||
/* Primary specular (R), Transmission (TT) and Secondary Specular (TRT). */
|
||||
for (int i = 0; i < 3; i++) {
|
||||
const float Mp = longitudinal_scattering(angles[2 * i],
|
||||
angles[2 * i + 1],
|
||||
sin_theta_o,
|
||||
cos_theta_o,
|
||||
(i == 0) ? bsdf->m0_roughness :
|
||||
(i == 1) ? 0.25f * bsdf->v :
|
||||
4.0f * bsdf->v);
|
||||
const float Np = azimuthal_scattering(phi, i, bsdf->s, gamma_o, gamma_t);
|
||||
F += Ap[i] * Mp * Np;
|
||||
F_energy += Ap_energy[i] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
}
|
||||
/* Primary specular (R). */
|
||||
Mp = longitudinal_scattering(angles[0], angles[1], sin_theta_o, cos_theta_o, bsdf->m0_roughness);
|
||||
Np = azimuthal_scattering(phi, 0, bsdf->s, gamma_o, gamma_t);
|
||||
F = Ap[0] * Mp * Np;
|
||||
F_energy = Ap_energy[0] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
|
||||
/* Transmission (TT). */
|
||||
Mp = longitudinal_scattering(angles[2], angles[3], sin_theta_o, cos_theta_o, 0.25f * bsdf->v);
|
||||
Np = azimuthal_scattering(phi, 1, bsdf->s, gamma_o, gamma_t);
|
||||
F += Ap[1] * Mp * Np;
|
||||
F_energy += Ap_energy[1] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
|
||||
/* Secondary specular (TRT). */
|
||||
Mp = longitudinal_scattering(angles[4], angles[5], sin_theta_o, cos_theta_o, 4.0f * bsdf->v);
|
||||
Np = azimuthal_scattering(phi, 2, bsdf->s, gamma_o, gamma_t);
|
||||
F += Ap[2] * Mp * Np;
|
||||
F_energy += Ap_energy[2] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
|
||||
/* Residual component (TRRT+). */
|
||||
{
|
||||
const float Mp = longitudinal_scattering(
|
||||
sin_theta_i, cos_theta_i, sin_theta_o, cos_theta_o, 4.0f * bsdf->v);
|
||||
const float Np = M_1_2PI_F;
|
||||
F += Ap[3] * Mp * Np;
|
||||
F_energy += Ap_energy[3] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
}
|
||||
Mp = longitudinal_scattering(sin_theta_i, cos_theta_i, sin_theta_o, cos_theta_o, 4.0f * bsdf->v);
|
||||
Np = M_1_2PI_F;
|
||||
F += Ap[3] * Mp * Np;
|
||||
F_energy += Ap_energy[3] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
|
||||
*pdf = F_energy;
|
||||
return F;
|
||||
@@ -344,44 +354,39 @@ ccl_device int bsdf_principled_hair_sample(KernelGlobals kg,
|
||||
float randv,
|
||||
ccl_private Spectrum *eval,
|
||||
ccl_private float3 *omega_in,
|
||||
ccl_private float *pdf,
|
||||
ccl_private float2 *sampled_roughness,
|
||||
ccl_private float *eta)
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
ccl_private PrincipledHairBSDF *bsdf = (ccl_private PrincipledHairBSDF *)sc;
|
||||
|
||||
*sampled_roughness = make_float2(bsdf->m0_roughness, bsdf->m0_roughness);
|
||||
*eta = bsdf->eta;
|
||||
float3 Y = float4_to_float3(bsdf->extra->geom);
|
||||
|
||||
const float3 Y = float4_to_float3(bsdf->extra->geom);
|
||||
|
||||
const float3 X = safe_normalize(sd->dPdu);
|
||||
float3 X = safe_normalize(sd->dPdu);
|
||||
kernel_assert(fabsf(dot(X, Y)) < 1e-3f);
|
||||
const float3 Z = safe_normalize(cross(X, Y));
|
||||
float3 Z = safe_normalize(cross(X, Y));
|
||||
|
||||
const float3 wo = make_float3(dot(sd->I, X), dot(sd->I, Y), dot(sd->I, Z));
|
||||
float3 wo = make_float3(dot(sd->I, X), dot(sd->I, Y), dot(sd->I, Z));
|
||||
|
||||
float2 u[2];
|
||||
u[0] = make_float2(randu, randv);
|
||||
u[1].x = lcg_step_float(&sd->lcg_state);
|
||||
u[1].y = lcg_step_float(&sd->lcg_state);
|
||||
|
||||
const float sin_theta_o = wo.x;
|
||||
const float cos_theta_o = cos_from_sin(sin_theta_o);
|
||||
const float phi_o = atan2f(wo.z, wo.y);
|
||||
float sin_theta_o = wo.x;
|
||||
float cos_theta_o = cos_from_sin(sin_theta_o);
|
||||
float phi_o = atan2f(wo.z, wo.y);
|
||||
|
||||
const float sin_theta_t = sin_theta_o / bsdf->eta;
|
||||
const float cos_theta_t = cos_from_sin(sin_theta_t);
|
||||
float sin_theta_t = sin_theta_o / bsdf->eta;
|
||||
float cos_theta_t = cos_from_sin(sin_theta_t);
|
||||
|
||||
const float sin_gamma_o = bsdf->extra->geom.w;
|
||||
const float cos_gamma_o = cos_from_sin(sin_gamma_o);
|
||||
const float gamma_o = safe_asinf(sin_gamma_o);
|
||||
float sin_gamma_o = bsdf->extra->geom.w;
|
||||
float cos_gamma_o = cos_from_sin(sin_gamma_o);
|
||||
float gamma_o = safe_asinf(sin_gamma_o);
|
||||
|
||||
const float sin_gamma_t = sin_gamma_o * cos_theta_o / sqrtf(sqr(bsdf->eta) - sqr(sin_theta_o));
|
||||
const float cos_gamma_t = cos_from_sin(sin_gamma_t);
|
||||
const float gamma_t = safe_asinf(sin_gamma_t);
|
||||
float sin_gamma_t = sin_gamma_o * cos_theta_o / sqrtf(sqr(bsdf->eta) - sqr(sin_theta_o));
|
||||
float cos_gamma_t = cos_from_sin(sin_gamma_t);
|
||||
float gamma_t = safe_asinf(sin_gamma_t);
|
||||
|
||||
const Spectrum T = exp(-bsdf->sigma * (2.0f * cos_gamma_t / cos_theta_t));
|
||||
Spectrum T = exp(-bsdf->sigma * (2.0f * cos_gamma_t / cos_theta_t));
|
||||
Spectrum Ap[4];
|
||||
float Ap_energy[4];
|
||||
hair_attenuation(
|
||||
@@ -404,7 +409,7 @@ ccl_device int bsdf_principled_hair_sample(KernelGlobals kg,
|
||||
}
|
||||
|
||||
u[1].x = max(u[1].x, 1e-5f);
|
||||
const float fac = 1.0f + v * logf(u[1].x + (1.0f - u[1].x) * expf(-2.0f / v));
|
||||
float fac = 1.0f + v * logf(u[1].x + (1.0f - u[1].x) * expf(-2.0f / v));
|
||||
float sin_theta_i = -fac * sin_theta_o +
|
||||
cos_from_sin(fac) * cosf(M_2PI_F * u[1].y) * cos_theta_o;
|
||||
float cos_theta_i = cos_from_sin(sin_theta_i);
|
||||
@@ -423,37 +428,41 @@ ccl_device int bsdf_principled_hair_sample(KernelGlobals kg,
|
||||
else {
|
||||
phi = M_2PI_F * u[0].y;
|
||||
}
|
||||
const float phi_i = phi_o + phi;
|
||||
float phi_i = phi_o + phi;
|
||||
|
||||
hair_alpha_angles(sin_theta_i, cos_theta_i, bsdf->alpha, angles);
|
||||
|
||||
Spectrum F = zero_spectrum();
|
||||
float F_energy = 0.0f;
|
||||
Spectrum F;
|
||||
float F_energy;
|
||||
float Mp, Np;
|
||||
|
||||
/* Primary specular (R), Transmission (TT) and Secondary Specular (TRT). */
|
||||
for (int i = 0; i < 3; i++) {
|
||||
const float Mp = longitudinal_scattering(angles[2 * i],
|
||||
angles[2 * i + 1],
|
||||
sin_theta_o,
|
||||
cos_theta_o,
|
||||
(i == 0) ? bsdf->m0_roughness :
|
||||
(i == 1) ? 0.25f * bsdf->v :
|
||||
4.0f * bsdf->v);
|
||||
const float Np = azimuthal_scattering(phi, i, bsdf->s, gamma_o, gamma_t);
|
||||
F += Ap[i] * Mp * Np;
|
||||
F_energy += Ap_energy[i] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
}
|
||||
/* Primary specular (R). */
|
||||
Mp = longitudinal_scattering(angles[0], angles[1], sin_theta_o, cos_theta_o, bsdf->m0_roughness);
|
||||
Np = azimuthal_scattering(phi, 0, bsdf->s, gamma_o, gamma_t);
|
||||
F = Ap[0] * Mp * Np;
|
||||
F_energy = Ap_energy[0] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
|
||||
/* Transmission (TT). */
|
||||
Mp = longitudinal_scattering(angles[2], angles[3], sin_theta_o, cos_theta_o, 0.25f * bsdf->v);
|
||||
Np = azimuthal_scattering(phi, 1, bsdf->s, gamma_o, gamma_t);
|
||||
F += Ap[1] * Mp * Np;
|
||||
F_energy += Ap_energy[1] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
|
||||
/* Secondary specular (TRT). */
|
||||
Mp = longitudinal_scattering(angles[4], angles[5], sin_theta_o, cos_theta_o, 4.0f * bsdf->v);
|
||||
Np = azimuthal_scattering(phi, 2, bsdf->s, gamma_o, gamma_t);
|
||||
F += Ap[2] * Mp * Np;
|
||||
F_energy += Ap_energy[2] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
|
||||
/* Residual component (TRRT+). */
|
||||
{
|
||||
const float Mp = longitudinal_scattering(
|
||||
sin_theta_i, cos_theta_i, sin_theta_o, cos_theta_o, 4.0f * bsdf->v);
|
||||
const float Np = M_1_2PI_F;
|
||||
F += Ap[3] * Mp * Np;
|
||||
F_energy += Ap_energy[3] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
}
|
||||
Mp = longitudinal_scattering(sin_theta_i, cos_theta_i, sin_theta_o, cos_theta_o, 4.0f * bsdf->v);
|
||||
Np = M_1_2PI_F;
|
||||
F += Ap[3] * Mp * Np;
|
||||
F_energy += Ap_energy[3] * Mp * Np;
|
||||
kernel_assert(isfinite_safe(F) && isfinite_safe(F_energy));
|
||||
|
||||
*eval = F;
|
||||
*pdf = F_energy;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user