Compare commits
2 Commits
temp-paral
...
nodes-upda
Author | SHA1 | Date | |
---|---|---|---|
9f31b33f8e | |||
0895eef4fb |
@@ -110,10 +110,6 @@ if(POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
|
||||
# Install CODE|SCRIPT allow the use of generator expressions.
|
||||
if(POLICY CMP0087)
|
||||
cmake_policy(SET CMP0087 NEW)
|
||||
endif()
|
||||
#-----------------------------------------------------------------------------
|
||||
# Load some macros.
|
||||
include(build_files/cmake/macros.cmake)
|
||||
@@ -255,16 +251,6 @@ if(WITH_GHOST_X11)
|
||||
option(WITH_X11_ALPHA "Enable X11 transparent background" ON)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" OFF)
|
||||
option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system" ON)
|
||||
else()
|
||||
# not an option for other OS's
|
||||
set(WITH_SYSTEM_GLEW OFF)
|
||||
set(WITH_SYSTEM_GLES OFF)
|
||||
endif()
|
||||
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
option(WITH_SYSTEM_EIGEN3 "Use the systems Eigen3 library" OFF)
|
||||
endif()
|
||||
@@ -428,10 +414,6 @@ mark_as_advanced(WITH_CYCLES_NETWORK)
|
||||
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
|
||||
mark_as_advanced(WITH_CUDA_DYNLOAD)
|
||||
|
||||
# Draw Manager
|
||||
option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF)
|
||||
mark_as_advanced(WITH_DRAW_DEBUG)
|
||||
|
||||
# LLVM
|
||||
option(WITH_LLVM "Use LLVM" OFF)
|
||||
if(APPLE)
|
||||
@@ -493,15 +475,32 @@ endif()
|
||||
|
||||
# OpenGL
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
# GLEW can only built with either GLX or EGL support and most binary
|
||||
# distributions are built with GLX support. So we always compile GLEW
|
||||
# with EGL support manually, and the options are no longer available.
|
||||
set(WITH_SYSTEM_GLEW OFF)
|
||||
set(WITH_SYSTEM_GLES ON)
|
||||
|
||||
# Always use EGL instead of GLX, for X11, Wayland and headless.
|
||||
set(WITH_GL_EGL ON)
|
||||
else()
|
||||
# System GLEW and GLES were never an option on other platforms.
|
||||
set(WITH_SYSTEM_GLEW OFF)
|
||||
set(WITH_SYSTEM_GLES OFF)
|
||||
|
||||
# Experimental EGL option.
|
||||
option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL or WGL)" OFF)
|
||||
mark_as_advanced(WITH_GL_EGL)
|
||||
endif()
|
||||
|
||||
option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON)
|
||||
option(WITH_GLEW_ES "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
|
||||
option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)" OFF)
|
||||
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (through either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
|
||||
|
||||
mark_as_advanced(
|
||||
WITH_OPENGL
|
||||
WITH_GLEW_ES
|
||||
WITH_GL_EGL
|
||||
WITH_GL_PROFILE_ES20
|
||||
)
|
||||
|
||||
@@ -612,6 +611,12 @@ if(WIN32)
|
||||
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
|
||||
mark_as_advanced(WITH_WINDOWS_FIND_MODULES)
|
||||
|
||||
option(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS "Organize the visual studio projects according to source folder structure." ON)
|
||||
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
|
||||
|
||||
option(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS "Organize the source files in filters matching the source folders." ON)
|
||||
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
|
||||
|
||||
option(WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF)
|
||||
mark_as_advanced(WINDOWS_PYTHON_DEBUG)
|
||||
|
||||
@@ -629,18 +634,6 @@ if(WIN32)
|
||||
|
||||
endif()
|
||||
|
||||
if(WIN32 OR XCODE)
|
||||
option(IDE_GROUP_SOURCES_IN_FOLDERS "Organize the source files in filters matching the source folders." ON)
|
||||
mark_as_advanced(IDE_GROUP_SOURCES_IN_FOLDERS)
|
||||
|
||||
option(IDE_GROUP_PROJECTS_IN_FOLDERS "Organize the projects according to source folder structure." ON)
|
||||
mark_as_advanced(IDE_GROUP_PROJECTS_IN_FOLDERS)
|
||||
|
||||
if (IDE_GROUP_PROJECTS_IN_FOLDERS)
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
# See WITH_WINDOWS_SCCACHE for Windows.
|
||||
option(WITH_COMPILER_CCACHE "Use ccache to improve rebuild times (Works with Ninja, Makefiles and Xcode)" OFF)
|
||||
@@ -1598,9 +1591,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
|
||||
|
||||
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_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)
|
||||
|
34
GNUmakefile
34
GNUmakefile
@@ -63,7 +63,7 @@ Package Targets
|
||||
|
||||
* package_debian: Build a debian package.
|
||||
* package_pacman: Build an arch linux pacman package.
|
||||
* package_archive: Build an archive package.
|
||||
* package_archive: Build an archive package.
|
||||
|
||||
Testing Targets
|
||||
Not associated with building Blender.
|
||||
@@ -167,7 +167,7 @@ endef
|
||||
|
||||
# This makefile is not meant for Windows
|
||||
ifeq ($(OS),Windows_NT)
|
||||
$(error On Windows, use "cmd //c make.bat" instead of "make")
|
||||
$(error On Windows, use "cmd //c make.bat" instead of "make")
|
||||
endif
|
||||
|
||||
# System Vars
|
||||
@@ -379,7 +379,7 @@ deps: .FORCE
|
||||
|
||||
@cmake -H"$(DEPS_SOURCE_DIR)" \
|
||||
-B"$(DEPS_BUILD_DIR)" \
|
||||
-DHARVEST_TARGET=$(DEPS_INSTALL_DIR)
|
||||
-DHARVEST_TARGET=$(DEPS_INSTALL_DIR)
|
||||
|
||||
@echo
|
||||
@echo Building dependencies ...
|
||||
@@ -456,8 +456,7 @@ project_eclipse: .FORCE
|
||||
check_cppcheck: .FORCE
|
||||
$(CMAKE_CONFIG)
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
$(PYTHON) \
|
||||
"$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
|
||||
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
|
||||
"$(BLENDER_DIR)/check_cppcheck.txt"
|
||||
@echo "written: check_cppcheck.txt"
|
||||
|
||||
@@ -519,9 +518,8 @@ source_archive: .FORCE
|
||||
python3 ./build_files/utils/make_source_archive.py
|
||||
|
||||
source_archive_complete: .FORCE
|
||||
cmake \
|
||||
-S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
|
||||
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
|
||||
cmake -S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
|
||||
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
|
||||
# This assumes CMake is still using a default `PACKAGE_DIR` variable:
|
||||
python3 ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages"
|
||||
|
||||
@@ -529,11 +527,9 @@ source_archive_complete: .FORCE
|
||||
INKSCAPE_BIN?="inkscape"
|
||||
icons: .FORCE
|
||||
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
|
||||
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
|
||||
INKSCAPE_BIN=$(INKSCAPE_BIN) \
|
||||
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
|
||||
INKSCAPE_BIN=$(INKSCAPE_BIN) \
|
||||
"$(BLENDER_DIR)/release/datafiles/alert_icons_update.py"
|
||||
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
|
||||
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
|
||||
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
|
||||
|
||||
icons_geom: .FORCE
|
||||
BLENDER_BIN=$(BLENDER_BIN) \
|
||||
@@ -547,7 +543,7 @@ update_code: .FORCE
|
||||
|
||||
format: .FORCE
|
||||
PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
|
||||
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
|
||||
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
@@ -557,9 +553,8 @@ format: .FORCE
|
||||
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
|
||||
doc_py: .FORCE
|
||||
ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \
|
||||
$(BLENDER_BIN) \
|
||||
--background -noaudio --factory-startup \
|
||||
--python doc/python_api/sphinx_doc_gen.py
|
||||
$(BLENDER_BIN) --background -noaudio --factory-startup \
|
||||
--python doc/python_api/sphinx_doc_gen.py
|
||||
sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out
|
||||
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'"
|
||||
|
||||
@@ -568,9 +563,8 @@ doc_doxy: .FORCE
|
||||
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
|
||||
|
||||
doc_dna: .FORCE
|
||||
$(BLENDER_BIN) \
|
||||
--background -noaudio --factory-startup \
|
||||
--python doc/blender_file_format/BlendFileDnaExporter_25.py
|
||||
$(BLENDER_BIN) --background -noaudio --factory-startup \
|
||||
--python doc/blender_file_format/BlendFileDnaExporter_25.py
|
||||
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
|
||||
|
||||
doc_man: .FORCE
|
||||
|
@@ -84,7 +84,7 @@ include(cmake/openimageio.cmake)
|
||||
include(cmake/tiff.cmake)
|
||||
if(WIN32)
|
||||
include(cmake/flexbison.cmake)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
else()
|
||||
include(cmake/flex.cmake)
|
||||
endif()
|
||||
include(cmake/osl.cmake)
|
||||
|
@@ -29,13 +29,13 @@ elseif(APPLE)
|
||||
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
|
||||
set(ISPC_EXTRA_ARGS_APPLE
|
||||
-DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison
|
||||
-DFLEX_EXECUTABLE=/opt/homebrew/opt/flex/bin/flex
|
||||
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
|
||||
-DARM_ENABLED=On
|
||||
)
|
||||
else()
|
||||
set(ISPC_EXTRA_ARGS_APPLE
|
||||
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
|
||||
-DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex
|
||||
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
|
||||
-DARM_ENABLED=Off
|
||||
)
|
||||
endif()
|
||||
@@ -84,7 +84,7 @@ if(WIN32)
|
||||
external_ispc
|
||||
external_flexbison
|
||||
)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
else()
|
||||
add_dependencies(
|
||||
external_ispc
|
||||
external_flex
|
||||
|
@@ -16,18 +16,12 @@
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
if(APPLE)
|
||||
set(OPENMP_PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff)
|
||||
else()
|
||||
set(OPENMP_PATCH_COMMAND)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(external_openmp
|
||||
URL file://${PACKAGE_DIR}/${OPENMP_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH}
|
||||
PREFIX ${BUILD_DIR}/openmp
|
||||
PATCH_COMMAND ${OPENMP_PATCH_COMMAND}
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
|
||||
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @rpath/libomp.dylib runtime/src/libomp.dylib && make install
|
||||
INSTALL_DIR ${LIBDIR}/openmp
|
||||
|
@@ -96,7 +96,7 @@ if(WIN32)
|
||||
external_osl
|
||||
external_flexbison
|
||||
)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
else()
|
||||
add_dependencies(
|
||||
external_osl
|
||||
external_flex
|
||||
|
@@ -23,7 +23,7 @@ set(PNG_EXTRA_ARGS
|
||||
)
|
||||
|
||||
if(BLENDER_PLATFORM_ARM)
|
||||
set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=on -DCMAKE_SYSTEM_PROCESSOR="aarch64")
|
||||
set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=ON -DCMAKE_SYSTEM_PROCESSOR="aarch64")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(external_png
|
||||
|
@@ -158,18 +158,10 @@ set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
|
||||
set(LLVM_HASH_TYPE MD5)
|
||||
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
|
||||
|
||||
if(APPLE)
|
||||
# Cloth physics test is crashing due to this bug:
|
||||
# https://bugs.llvm.org/show_bug.cgi?id=50579
|
||||
set(OPENMP_VERSION 9.0.1)
|
||||
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
|
||||
else()
|
||||
set(OPENMP_VERSION ${LLVM_VERSION})
|
||||
set(OPENMP_HASH ac48ce3e4582ccb82f81ab59eb3fc9dc)
|
||||
endif()
|
||||
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz)
|
||||
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
|
||||
set(OPENMP_HASH ac48ce3e4582ccb82f81ab59eb3fc9dc)
|
||||
set(OPENMP_HASH_TYPE MD5)
|
||||
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
|
||||
set(OPENMP_FILE openmp-${LLVM_VERSION}.src.tar.xz)
|
||||
|
||||
set(OPENIMAGEIO_VERSION 2.2.15.1)
|
||||
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
|
||||
|
@@ -603,9 +603,6 @@ MP3LAME_DEV=""
|
||||
OPENJPEG_USE=false
|
||||
OPENJPEG_DEV=""
|
||||
|
||||
# Whether to use system GLEW or not (OpenSubDiv needs recent glew to work).
|
||||
NO_SYSTEM_GLEW=false
|
||||
|
||||
# Switch to english language, else some things (like check_package_DEB()) won't work!
|
||||
LANG_BACK=$LANG
|
||||
LANG=""
|
||||
@@ -1019,7 +1016,7 @@ PRINT ""
|
||||
PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" )
|
||||
|
||||
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
|
||||
BOOST_SOURCE=( "https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" )
|
||||
BOOST_SOURCE=( "https://dl.bintray.com/boostorg/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" )
|
||||
BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options --with-serialization --with-atomic"
|
||||
|
||||
TBB_SOURCE=( "https://github.com/oneapi-src/oneTBB/archive/$TBB_VERSION$TBB_VERSION_UPDATE.tar.gz" )
|
||||
@@ -1447,7 +1444,9 @@ compile_Python() {
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1463,9 +1462,6 @@ compile_Python() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-python option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "python-$PYTHON_VERSION_SHORT"
|
||||
|
||||
# Extra step: install required modules with pip.
|
||||
@@ -1559,7 +1555,9 @@ compile_Boost() {
|
||||
--prefix=$_inst --disable-icu boost.locale.icu=off install
|
||||
./b2 --clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1573,9 +1571,7 @@ compile_Boost() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-boost option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
# Just always run it, much simpler this way!
|
||||
run_ldconfig "boost"
|
||||
}
|
||||
|
||||
@@ -1688,7 +1684,9 @@ compile_TBB() {
|
||||
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "TBB-$TBB_VERSION$TBB_VERSION_UPDATE failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1702,9 +1700,6 @@ compile_TBB() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-tbb option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "tbb"
|
||||
}
|
||||
|
||||
@@ -1824,7 +1819,9 @@ compile_OCIO() {
|
||||
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1838,9 +1835,6 @@ compile_OCIO() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-ocio option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "ocio"
|
||||
}
|
||||
|
||||
@@ -1956,7 +1950,9 @@ compile_OPENEXR() {
|
||||
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -1972,9 +1968,7 @@ compile_OPENEXR() {
|
||||
|
||||
_with_built_openexr=true
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
# Just always run it, much simpler this way!
|
||||
run_ldconfig "openexr"
|
||||
}
|
||||
|
||||
@@ -2115,7 +2109,9 @@ compile_OIIO() {
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -2129,9 +2125,7 @@ compile_OIIO() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-oiio option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
# Just always run it, much simpler this way!
|
||||
run_ldconfig "oiio"
|
||||
}
|
||||
|
||||
@@ -2240,7 +2234,9 @@ compile_LLVM() {
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -2253,10 +2249,6 @@ compile_LLVM() {
|
||||
INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
|
||||
INFO "If you want to force rebuild of this lib, use the --force-llvm option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -2395,7 +2387,9 @@ compile_OSL() {
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -2409,9 +2403,6 @@ compile_OSL() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-osl option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "osl"
|
||||
}
|
||||
|
||||
@@ -2512,7 +2503,9 @@ compile_OSD() {
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -2526,9 +2519,6 @@ compile_OSD() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-osd option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "osd"
|
||||
}
|
||||
|
||||
@@ -2618,7 +2608,9 @@ compile_BLOSC() {
|
||||
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -2631,9 +2623,6 @@ compile_BLOSC() {
|
||||
|
||||
magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "blosc"
|
||||
}
|
||||
|
||||
@@ -2724,7 +2713,9 @@ install_NanoVDB() {
|
||||
#~ mkdir -p $_inst
|
||||
#~ cp -r $_src/include $_inst/include
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "NanoVDB-v$OPENVDB_VERSION failed to install, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -2736,10 +2727,6 @@ install_NanoVDB() {
|
||||
else
|
||||
INFO "Own NanoVDB-v$OPENVDB_VERSION is up to date, nothing to do!"
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -2859,7 +2846,9 @@ compile_OPENVDB() {
|
||||
make -j$THREADS install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -2873,9 +2862,6 @@ compile_OPENVDB() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-openvdb option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "openvdb"
|
||||
|
||||
if [ "$WITH_NANOVDB" = true ]; then
|
||||
@@ -2973,7 +2959,9 @@ compile_ALEMBIC() {
|
||||
make -j$THREADS install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -2987,9 +2975,6 @@ compile_ALEMBIC() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-alembic option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "alembic"
|
||||
}
|
||||
|
||||
@@ -3074,7 +3059,9 @@ compile_USD() {
|
||||
make -j$THREADS install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "USD-$USD_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -3088,9 +3075,6 @@ compile_USD() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-usd option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "usd"
|
||||
}
|
||||
|
||||
@@ -3184,7 +3168,9 @@ compile_OpenCOLLADA() {
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -3197,10 +3183,6 @@ compile_OpenCOLLADA() {
|
||||
INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
|
||||
INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -3301,7 +3283,9 @@ compile_Embree() {
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "Embree-$EMBREE_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -3314,10 +3298,6 @@ compile_Embree() {
|
||||
INFO "Own Embree-$EMBREE_VERSION is up to date, nothing to do!"
|
||||
INFO "If you want to force rebuild of this lib, use the --force-embree option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -3380,7 +3360,9 @@ install_ISPC() {
|
||||
mkdir -p $_inst
|
||||
cp -r $_src/bin $_inst/bin
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "ISPC-v$ISPC_VERSION failed to install, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -3393,10 +3375,6 @@ install_ISPC() {
|
||||
INFO "Own ISPC-v$ISPC_VERSION is up to date, nothing to do!"
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
|
||||
_ispc_path_bin=$_inst/bin
|
||||
run_ldconfig "ispc"
|
||||
}
|
||||
@@ -3496,7 +3474,9 @@ compile_OIDN() {
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "OpenImageDenoise-$OIDN_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -3510,9 +3490,6 @@ compile_OIDN() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-oidn option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "oidn"
|
||||
}
|
||||
|
||||
@@ -3629,7 +3606,9 @@ compile_FFmpeg() {
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -3642,10 +3621,6 @@ compile_FFmpeg() {
|
||||
INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
|
||||
INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -3744,7 +3719,9 @@ compile_XR_OpenXR_SDK() {
|
||||
make -j$THREADS && make install
|
||||
make clean
|
||||
|
||||
if [ ! -d $_inst ]; then
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
else
|
||||
ERROR "XR-OpenXR-SDK-$XR_OPENXR_VERSION failed to compile, exiting"
|
||||
exit 1
|
||||
fi
|
||||
@@ -3758,9 +3735,6 @@ compile_XR_OpenXR_SDK() {
|
||||
INFO "If you want to force rebuild of this lib, use the --force-xr-openxr option."
|
||||
fi
|
||||
|
||||
if [ -d $_inst ]; then
|
||||
_create_inst_shortcut
|
||||
fi
|
||||
run_ldconfig "xr-openxr-sdk"
|
||||
}
|
||||
|
||||
@@ -4008,13 +3982,9 @@ install_DEB() {
|
||||
version_ge $_glew "1.7.0"
|
||||
if [ $? -eq 1 ]; then
|
||||
WARNING "OpenSubdiv disabled because GLEW-$_glew is not enough"
|
||||
WARNING "Blender will not use system GLEW library"
|
||||
OSD_SKIP=true
|
||||
NO_SYSTEM_GLEW=true
|
||||
else
|
||||
WARNING "OpenSubdiv will compile with GLEW-$_glew but with limited capability"
|
||||
WARNING "Blender will not use system GLEW library"
|
||||
NO_SYSTEM_GLEW=true
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -5985,12 +5955,6 @@ print_info() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$NO_SYSTEM_GLEW" = true ]; then
|
||||
_1="-D WITH_SYSTEM_GLEW=OFF"
|
||||
PRINT " $_1"
|
||||
_buildargs="$_buildargs $_1"
|
||||
fi
|
||||
|
||||
if [ "$FFMPEG_SKIP" = false ]; then
|
||||
_1="-D WITH_CODEC_FFMPEG=ON"
|
||||
_2="-D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;swresample;lzma;rt;`print_info_ffmpeglink`'"
|
||||
|
@@ -1,23 +0,0 @@
|
||||
diff --git a/runtime/src/z_Linux_asm.S b/runtime/src/z_Linux_asm.S
|
||||
index 0d8885e..42aa5ad 100644
|
||||
--- a/runtime/src/z_Linux_asm.S
|
||||
+++ b/runtime/src/z_Linux_asm.S
|
||||
@@ -1540,10 +1540,12 @@ __kmp_unnamed_critical_addr:
|
||||
.comm .gomp_critical_user_,32,8
|
||||
.data
|
||||
.align 8
|
||||
- .global __kmp_unnamed_critical_addr
|
||||
-__kmp_unnamed_critical_addr:
|
||||
+ .global ___kmp_unnamed_critical_addr
|
||||
+___kmp_unnamed_critical_addr:
|
||||
.8byte .gomp_critical_user_
|
||||
- .size __kmp_unnamed_critical_addr,8
|
||||
+# if !(KMP_OS_DARWIN)
|
||||
+ .size ___kmp_unnamed_critical_addr,8
|
||||
+# endif
|
||||
#endif /* KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 */
|
||||
|
||||
#if KMP_OS_LINUX
|
||||
|
||||
|
||||
|
@@ -1,66 +0,0 @@
|
||||
# - Find Zstd library
|
||||
# Find the native Zstd includes and library
|
||||
# This module defines
|
||||
# ZSTD_INCLUDE_DIRS, where to find zstd.h, Set when
|
||||
# ZSTD_INCLUDE_DIR is found.
|
||||
# ZSTD_LIBRARIES, libraries to link against to use Zstd.
|
||||
# ZSTD_ROOT_DIR, The base directory to search for Zstd.
|
||||
# This can also be an environment variable.
|
||||
# ZSTD_FOUND, If false, do not try to use Zstd.
|
||||
#
|
||||
# also defined, but not for general use are
|
||||
# ZSTD_LIBRARY, where to find the Zstd library.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2019 Blender Foundation.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
|
||||
# If ZSTD_ROOT_DIR was defined in the environment, use it.
|
||||
IF(NOT ZSTD_ROOT_DIR AND NOT $ENV{ZSTD_ROOT_DIR} STREQUAL "")
|
||||
SET(ZSTD_ROOT_DIR $ENV{ZSTD_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_zstd_SEARCH_DIRS
|
||||
${ZSTD_ROOT_DIR}
|
||||
)
|
||||
|
||||
FIND_PATH(ZSTD_INCLUDE_DIR
|
||||
NAMES
|
||||
zstd.h
|
||||
HINTS
|
||||
${_zstd_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(ZSTD_LIBRARY
|
||||
NAMES
|
||||
zstd
|
||||
HINTS
|
||||
${_zstd_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set ZSTD_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Zstd DEFAULT_MSG
|
||||
ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
|
||||
|
||||
IF(ZSTD_FOUND)
|
||||
SET(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
|
||||
SET(ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ZSTD_INCLUDE_DIR
|
||||
ZSTD_LIBRARY
|
||||
)
|
@@ -208,7 +208,7 @@ function(blender_source_group
|
||||
)
|
||||
|
||||
# if enabled, use the sources directories as filters.
|
||||
if(IDE_GROUP_SOURCES_IN_FOLDERS)
|
||||
if(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
|
||||
foreach(_SRC ${sources})
|
||||
# remove ../'s
|
||||
get_filename_component(_SRC_DIR ${_SRC} REALPATH)
|
||||
@@ -240,8 +240,8 @@ function(blender_source_group
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# if enabled, set the FOLDER property for the projects
|
||||
if(IDE_GROUP_PROJECTS_IN_FOLDERS)
|
||||
# if enabled, set the FOLDER property for visual studio projects
|
||||
if(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
|
||||
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
|
||||
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
|
||||
set_target_properties(${name} PROPERTIES FOLDER ${FolderDir})
|
||||
|
@@ -411,9 +411,25 @@ if(WITH_OPENMP)
|
||||
set(OPENMP_FOUND ON)
|
||||
set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
|
||||
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
|
||||
set(OpenMP_LIBRARY_DIR "${LIBDIR}/openmp/lib/")
|
||||
set(OpenMP_LINKER_FLAGS "-L'${OpenMP_LIBRARY_DIR}' -lomp")
|
||||
set(OpenMP_LIBRARY "${OpenMP_LIBRARY_DIR}/libomp.dylib")
|
||||
set(OpenMP_LINKER_FLAGS "-L'${LIBDIR}/openmp/lib' -lomp")
|
||||
|
||||
# Copy libomp.dylib to allow executables like datatoc and tests to work.
|
||||
# `@executable_path/../Resources/lib/` `LC_ID_DYLIB` is added by the deps builder.
|
||||
# For single config generator datatoc, tests etc.
|
||||
execute_process(
|
||||
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
|
||||
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib
|
||||
)
|
||||
# For multi-config generator datatoc, etc.
|
||||
execute_process(
|
||||
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib
|
||||
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib
|
||||
)
|
||||
# For multi-config generator tests.
|
||||
execute_process(
|
||||
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib
|
||||
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib/libomp.dylib
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -441,9 +457,6 @@ if(WITH_HARU)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(ZSTD_ROOT_DIR ${LIBDIR}/zstd)
|
||||
find_package(Zstd REQUIRED)
|
||||
|
||||
if(EXISTS ${LIBDIR})
|
||||
without_system_libs_end()
|
||||
endif()
|
||||
@@ -498,15 +511,3 @@ if(WITH_COMPILER_CCACHE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# For binaries that are built but not installed (also not distributed) (datatoc,
|
||||
# makesdna, tests, etc.), we add an rpath to the OpenMP library dir through
|
||||
# CMAKE_BUILD_RPATH. This avoids having to make many copies of the dylib next to each binary.
|
||||
#
|
||||
# For the installed Python module and installed Blender executable, CMAKE_INSTALL_RPATH
|
||||
# is modified to find the dylib in an adjacent folder. Install step puts the libraries there.
|
||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}")
|
||||
|
||||
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
|
||||
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../Resources/${BLENDER_VERSION}/lib")
|
||||
|
@@ -99,7 +99,6 @@ endif()
|
||||
find_package_wrapper(JPEG REQUIRED)
|
||||
find_package_wrapper(PNG REQUIRED)
|
||||
find_package_wrapper(ZLIB REQUIRED)
|
||||
find_package_wrapper(Zstd REQUIRED)
|
||||
find_package_wrapper(Freetype REQUIRED)
|
||||
|
||||
if(WITH_PYTHON)
|
||||
@@ -582,8 +581,6 @@ if(WITH_GHOST_WAYLAND)
|
||||
pkg_check_modules(wayland-cursor REQUIRED wayland-cursor)
|
||||
pkg_check_modules(dbus REQUIRED dbus-1)
|
||||
|
||||
set(WITH_GL_EGL ON)
|
||||
|
||||
list(APPEND PLATFORM_LINKLIBS
|
||||
${wayland-client_LINK_LIBRARIES}
|
||||
${wayland-egl_LINK_LIBRARIES}
|
||||
|
@@ -57,6 +57,8 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS})
|
||||
|
||||
if(NOT WITH_PYTHON_MODULE)
|
||||
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT blender)
|
||||
endif()
|
||||
@@ -151,8 +153,8 @@ if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
|
||||
string(APPEND CMAKE_CXX_FLAGS " ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference")
|
||||
else()
|
||||
string(APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj /Zc:inline")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj /Zc:inline")
|
||||
string(APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj")
|
||||
endif()
|
||||
|
||||
# X64 ASAN is available and usable on MSVC 16.9 preview 4 and up)
|
||||
@@ -215,8 +217,8 @@ else()
|
||||
endif()
|
||||
|
||||
if(WITH_WINDOWS_PDB)
|
||||
set(PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}")
|
||||
set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
||||
set(PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}")
|
||||
set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
||||
endif()
|
||||
|
||||
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}")
|
||||
@@ -873,6 +875,3 @@ if(WITH_HARU)
|
||||
set(WITH_HARU OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(ZSTD_INCLUDE_DIRS ${LIBDIR}/zstd/include)
|
||||
set(ZSTD_LIBRARIES ${LIBDIR}/zstd/lib/zstd_static.lib)
|
||||
|
@@ -1,10 +1,11 @@
|
||||
Pipeline Config
|
||||
===============
|
||||
|
||||
The `yaml` configuration file is used by buildbot build pipeline `update-code` step.
|
||||
This configuration file is used by buildbot new build pipeline for the `update-code` step.
|
||||
|
||||
The file allows to set branches or specific commits for both git submodules and svn artifacts. Can also define various build package versions for use by build workers. Especially useful in experimental and release branches.
|
||||
It will also be used by the `../utils/make_update.py` script in the near future.
|
||||
|
||||
NOTE:
|
||||
* The configuration file is ```NOT``` used by the `../utils/make_update.py` script.
|
||||
* That will implemented in the future.
|
||||
NOTES:
|
||||
* Keep both `yaml` and `json` files in sync until deployment of build pipeline updates.
|
||||
* The `json` file be removed once all branches are running with the `yaml` file.
|
||||
* Expected buildbot pipeline update is *Friday, July 30th* or *Monday August, 2nd*.
|
||||
|
87
build_files/config/pipeline_config.json
Normal file
87
build_files/config/pipeline_config.json
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"update-code":
|
||||
{
|
||||
"git" :
|
||||
{
|
||||
"submodules":
|
||||
[
|
||||
{ "path": "release/scripts/addons", "branch": "master", "commit_id": "HEAD" },
|
||||
{ "path": "release/scripts/addons_contrib", "branch": "master", "commit_id": "HEAD" },
|
||||
{ "path": "release/datafiles/locale", "branch": "master", "commit_id": "HEAD" },
|
||||
{ "path": "source/tools", "branch": "master", "commit_id": "HEAD" }
|
||||
]
|
||||
},
|
||||
"svn":
|
||||
{
|
||||
"tests": { "path": "lib/tests", "branch": "trunk", "commit_id": "HEAD" },
|
||||
"libraries":
|
||||
{
|
||||
"darwin-x86_64": { "path": "lib/darwin", "branch": "trunk", "commit_id": "HEAD" },
|
||||
"darwin-arm64": { "path": "lib/darwin_arm64", "branch": "trunk", "commit_id": "HEAD" },
|
||||
"linux-x86_64": { "path": "lib/linux_centos7_x86_64", "branch": "trunk", "commit_id": "HEAD" },
|
||||
"windows-amd64": { "path": "lib/win64_vc15", "branch": "trunk", "commit_id": "HEAD" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"buildbot":
|
||||
{
|
||||
"gcc":
|
||||
{
|
||||
"version": "9.0"
|
||||
},
|
||||
"sdks":
|
||||
{
|
||||
"optix":
|
||||
{
|
||||
"version": "7.1.0"
|
||||
},
|
||||
"cuda10":
|
||||
{
|
||||
"version": "10.1"
|
||||
},
|
||||
"cuda11":
|
||||
{
|
||||
"version": "11.4"
|
||||
}
|
||||
},
|
||||
"cmake":
|
||||
{
|
||||
"default":
|
||||
{
|
||||
"version": "any",
|
||||
"overrides":
|
||||
{
|
||||
|
||||
}
|
||||
},
|
||||
"darwin-x86_64":
|
||||
{
|
||||
"overrides":
|
||||
{
|
||||
|
||||
}
|
||||
},
|
||||
"darwin-arm64":
|
||||
{
|
||||
"overrides":
|
||||
{
|
||||
|
||||
}
|
||||
},
|
||||
"linux-x86_64":
|
||||
{
|
||||
"overrides":
|
||||
{
|
||||
|
||||
}
|
||||
},
|
||||
"windows-amd64":
|
||||
{
|
||||
"overrides":
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -51,9 +51,9 @@ buildbot:
|
||||
gcc:
|
||||
version: '9.0.0'
|
||||
cuda10:
|
||||
version: '10.1.243'
|
||||
version: '10.1.0'
|
||||
cuda11:
|
||||
version: '11.4.1'
|
||||
version: '11.4.0'
|
||||
optix:
|
||||
version: '7.1.0'
|
||||
cmake:
|
||||
|
@@ -31,7 +31,6 @@ def parse_arguments():
|
||||
parser.add_argument("--no-submodules", action="store_true")
|
||||
parser.add_argument("--use-tests", action="store_true")
|
||||
parser.add_argument("--svn-command", default="svn")
|
||||
parser.add_argument("--svn-branch", default=None)
|
||||
parser.add_argument("--git-command", default="git")
|
||||
parser.add_argument("--use-centos-libraries", action="store_true")
|
||||
return parser.parse_args()
|
||||
@@ -47,7 +46,7 @@ def svn_update(args, release_version):
|
||||
svn_non_interactive = [args.svn_command, '--non-interactive']
|
||||
|
||||
lib_dirpath = os.path.join(get_blender_git_root(), '..', 'lib')
|
||||
svn_url = make_utils.svn_libraries_base_url(release_version, args.svn_branch)
|
||||
svn_url = make_utils.svn_libraries_base_url(release_version)
|
||||
|
||||
# Checkout precompiled libraries
|
||||
if sys.platform == 'darwin':
|
||||
@@ -171,28 +170,26 @@ def submodules_update(args, release_version, branch):
|
||||
sys.stderr.write("git not found, can't update code\n")
|
||||
sys.exit(1)
|
||||
|
||||
# Update submodules to appropriate given branch,
|
||||
# falling back to master if none is given and/or found in a sub-repository.
|
||||
branch_fallback = "master"
|
||||
if not branch:
|
||||
branch = branch_fallback
|
||||
# Update submodules to latest master or appropriate release branch.
|
||||
if not release_version:
|
||||
branch = "master"
|
||||
|
||||
submodules = [
|
||||
("release/scripts/addons", branch, branch_fallback),
|
||||
("release/scripts/addons_contrib", branch, branch_fallback),
|
||||
("release/datafiles/locale", branch, branch_fallback),
|
||||
("source/tools", branch, branch_fallback),
|
||||
("release/scripts/addons", branch),
|
||||
("release/scripts/addons_contrib", branch),
|
||||
("release/datafiles/locale", branch),
|
||||
("source/tools", branch),
|
||||
]
|
||||
|
||||
# Initialize submodules only if needed.
|
||||
for submodule_path, submodule_branch, submodule_branch_fallback in submodules:
|
||||
for submodule_path, submodule_branch in submodules:
|
||||
if not os.path.exists(os.path.join(submodule_path, ".git")):
|
||||
call([args.git_command, "submodule", "update", "--init", "--recursive"])
|
||||
break
|
||||
|
||||
# Checkout appropriate branch and pull changes.
|
||||
skip_msg = ""
|
||||
for submodule_path, submodule_branch, submodule_branch_fallback in submodules:
|
||||
for submodule_path, submodule_branch in submodules:
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir(submodule_path)
|
||||
@@ -204,11 +201,6 @@ def submodules_update(args, release_version, branch):
|
||||
call([args.git_command, "fetch", "origin"])
|
||||
call([args.git_command, "checkout", submodule_branch])
|
||||
call([args.git_command, "pull", "--rebase", "origin", submodule_branch])
|
||||
# If we cannot find the specified branch for this submodule, fallback to default one (aka master).
|
||||
if make_utils.git_branch(args.git_command) != submodule_branch:
|
||||
call([args.git_command, "fetch", "origin"])
|
||||
call([args.git_command, "checkout", submodule_branch_fallback])
|
||||
call([args.git_command, "pull", "--rebase", "origin", submodule_branch_fallback])
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
|
@@ -70,11 +70,9 @@ def git_branch_release_version(branch, tag):
|
||||
return release_version
|
||||
|
||||
|
||||
def svn_libraries_base_url(release_version, branch):
|
||||
def svn_libraries_base_url(release_version):
|
||||
if release_version:
|
||||
svn_branch = "tags/blender-" + release_version + "-release"
|
||||
elif branch:
|
||||
svn_branch = "branches/" + branch
|
||||
else:
|
||||
svn_branch = "trunk"
|
||||
return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/"
|
||||
|
@@ -1,34 +0,0 @@
|
||||
set SOURCEDIR=%BLENDER_DIR%/doc/python_api/sphinx-in
|
||||
set BUILDDIR=%BLENDER_DIR%/doc/python_api/sphinx-out
|
||||
if "%BF_LANG%" == "" set BF_LANG=en
|
||||
set SPHINXOPTS=-j auto -D language=%BF_LANG%
|
||||
|
||||
call "%~dp0\find_sphinx.cmd"
|
||||
|
||||
if EXIST "%SPHINX_BIN%" (
|
||||
goto detect_sphinx_done
|
||||
)
|
||||
|
||||
echo unable to locate sphinx-build, run "set sphinx_BIN=full_path_to_sphinx-build.exe"
|
||||
exit /b 1
|
||||
|
||||
:detect_sphinx_done
|
||||
|
||||
call "%~dp0\find_blender.cmd"
|
||||
|
||||
if EXIST "%BLENDER_BIN%" (
|
||||
goto detect_blender_done
|
||||
)
|
||||
|
||||
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
|
||||
exit /b 1
|
||||
|
||||
:detect_blender_done
|
||||
|
||||
%BLENDER_BIN% ^
|
||||
--background -noaudio --factory-startup ^
|
||||
--python %BLENDER_DIR%/doc/python_api/sphinx_doc_gen.py
|
||||
|
||||
"%SPHINX_BIN%" -b html %SPHINXOPTS% %O% %SOURCEDIR% %BUILDDIR%
|
||||
|
||||
:EOF
|
@@ -1,28 +0,0 @@
|
||||
REM First see if there is an environment variable set
|
||||
if EXIST "%BLENDER_BIN%" (
|
||||
goto detect_blender_done
|
||||
)
|
||||
|
||||
REM Check the build folder next, if ninja was used there will be no
|
||||
REM debug/release folder
|
||||
set BLENDER_BIN=%BUILD_DIR%\bin\blender.exe
|
||||
if EXIST "%BLENDER_BIN%" (
|
||||
goto detect_blender_done
|
||||
)
|
||||
|
||||
REM Check the release folder next
|
||||
set BLENDER_BIN=%BUILD_DIR%\bin\release\blender.exe
|
||||
if EXIST "%BLENDER_BIN%" (
|
||||
goto detect_blender_done
|
||||
)
|
||||
|
||||
REM Check the debug folder next
|
||||
set BLENDER_BIN=%BUILD_DIR%\bin\debug\blender.exe
|
||||
if EXIST "%BLENDER_BIN%" (
|
||||
goto detect_blender_done
|
||||
)
|
||||
|
||||
REM at this point, we don't know where blender is, clear the variable
|
||||
set BLENDER_BIN=
|
||||
|
||||
:detect_blender_done
|
@@ -1,21 +0,0 @@
|
||||
REM First see if there is an environment variable set
|
||||
if EXIST "%INKSCAPE_BIN%" (
|
||||
goto detect_inkscape_done
|
||||
)
|
||||
|
||||
REM Then see if inkscape is available in the path
|
||||
for %%X in (inkscape.exe) do (set INKSCAPE_BIN=%%~$PATH:X)
|
||||
if EXIST "%INKSCAPE_BIN%" (
|
||||
goto detect_inkscape_done
|
||||
)
|
||||
|
||||
REM Finally see if it is perhaps installed at the default location
|
||||
set INKSCAPE_BIN=%ProgramFiles%\Inkscape\bin\inkscape.exe
|
||||
if EXIST "%INKSCAPE_BIN%" (
|
||||
goto detect_inkscape_done
|
||||
)
|
||||
|
||||
REM If still not found clear the variable
|
||||
set INKSCAPE_BIN=
|
||||
|
||||
:detect_inkscape_done
|
@@ -1,23 +0,0 @@
|
||||
REM First see if there is an environment variable set
|
||||
if EXIST "%SPHINX_BIN%" (
|
||||
goto detect_sphinx_done
|
||||
)
|
||||
|
||||
REM Then see if inkscape is available in the path
|
||||
for %%X in (sphinx-build.exe) do (set SPHINX_BIN=%%~$PATH:X)
|
||||
if EXIST "%SPHINX_BIN%" (
|
||||
goto detect_sphinx_done
|
||||
)
|
||||
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINX_BIN environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
|
||||
REM If still not found clear the variable
|
||||
set SPHINX_BIN=
|
||||
|
||||
:detect_sphinx_done
|
@@ -1,42 +0,0 @@
|
||||
if EXIST "%PYTHON%" (
|
||||
goto detect_python_done
|
||||
)
|
||||
|
||||
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
|
||||
if EXIST %PYTHON% (
|
||||
goto detect_python_done
|
||||
)
|
||||
|
||||
echo python not found at %PYTHON%
|
||||
exit /b 1
|
||||
|
||||
:detect_python_done
|
||||
echo found python (%PYTHON%)
|
||||
|
||||
call "%~dp0\find_inkscape.cmd"
|
||||
|
||||
if EXIST "%INKSCAPE_BIN%" (
|
||||
goto detect_inkscape_done
|
||||
)
|
||||
|
||||
echo unable to locate inkscape, run "set inkscape_BIN=full_path_to_inkscape.exe"
|
||||
exit /b 1
|
||||
|
||||
:detect_inkscape_done
|
||||
|
||||
call "%~dp0\find_blender.cmd"
|
||||
|
||||
if EXIST "%BLENDER_BIN%" (
|
||||
goto detect_blender_done
|
||||
)
|
||||
|
||||
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
|
||||
exit /b 1
|
||||
|
||||
:detect_blender_done
|
||||
|
||||
%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_update.py
|
||||
%PYTHON% -B %BLENDER_DIR%\release\datafiles\prvicons_update.py
|
||||
%PYTHON% -B %BLENDER_DIR%\release\datafiles\alert_icons_update.py
|
||||
|
||||
:EOF
|
@@ -1,29 +0,0 @@
|
||||
if EXIST %PYTHON% (
|
||||
goto detect_python_done
|
||||
)
|
||||
|
||||
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
|
||||
if EXIST %PYTHON% (
|
||||
goto detect_python_done
|
||||
)
|
||||
|
||||
echo python not found at %PYTHON%
|
||||
exit /b 1
|
||||
|
||||
:detect_python_done
|
||||
echo found python (%PYTHON%)
|
||||
|
||||
call "%~dp0\find_blender.cmd"
|
||||
|
||||
if EXIST "%BLENDER_BIN%" (
|
||||
goto detect_blender_done
|
||||
)
|
||||
|
||||
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
|
||||
exit /b 1
|
||||
|
||||
:detect_blender_done
|
||||
|
||||
%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_geom_update.py
|
||||
|
||||
:EOF
|
@@ -107,15 +107,6 @@ if NOT "%1" == "" (
|
||||
set FORMAT=1
|
||||
set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9
|
||||
goto EOF
|
||||
) else if "%1" == "icons" (
|
||||
set ICONS=1
|
||||
goto EOF
|
||||
) else if "%1" == "icons_geom" (
|
||||
set ICONS_GEOM=1
|
||||
goto EOF
|
||||
) else if "%1" == "doc_py" (
|
||||
set DOC_PY=1
|
||||
goto EOF
|
||||
) else (
|
||||
echo Command "%1" unknown, aborting!
|
||||
goto ERR
|
||||
|
@@ -31,6 +31,3 @@ set PYDEBUG_CMAKE_ARGS=
|
||||
set FORMAT=
|
||||
set TEST=
|
||||
set BUILD_WITH_SCCACHE=
|
||||
set ICONS=
|
||||
set ICONS_GEOM=
|
||||
set DOC_PY=
|
||||
|
@@ -31,10 +31,6 @@ echo - 2019 ^(build with visual studio 2019^)
|
||||
echo - 2019pre ^(build with visual studio 2019 pre-release^)
|
||||
echo - 2019b ^(build with visual studio 2019 Build Tools^)
|
||||
|
||||
echo.
|
||||
echo Documentation Targets ^(Not associated with building^)
|
||||
echo - doc_py ^(Generate sphinx python api docs^)
|
||||
|
||||
echo.
|
||||
echo Experimental options
|
||||
echo - with_opengl_tests ^(enable both the render and draw opengl test suites^)
|
||||
|
@@ -123,7 +123,7 @@ def Align(handle):
|
||||
class BlendFile:
|
||||
'''
|
||||
Reads a blendfile and store the header, all the fileblocks, and catalogue
|
||||
structs found in the DNA fileblock
|
||||
structs foound in the DNA fileblock
|
||||
|
||||
- BlendFile.Header (BlendFileHeader instance)
|
||||
- BlendFile.Blocks (list of BlendFileBlock instances)
|
||||
|
@@ -31,8 +31,7 @@ def draw():
|
||||
context.space_data,
|
||||
context.region,
|
||||
view_matrix,
|
||||
projection_matrix,
|
||||
True)
|
||||
projection_matrix)
|
||||
|
||||
gpu.state.depth_mask_set(False)
|
||||
draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT)
|
||||
|
@@ -1,13 +1,13 @@
|
||||
sphinx==4.1.1
|
||||
sphinx==3.5.4
|
||||
|
||||
# Sphinx dependencies that are important
|
||||
Jinja2==3.0.1
|
||||
Pygments==2.10.0
|
||||
docutils==0.17.1
|
||||
Jinja2==2.11.3
|
||||
Pygments==2.9.0
|
||||
docutils==0.16
|
||||
snowballstemmer==2.1.0
|
||||
babel==2.9.1
|
||||
requests==2.26.0
|
||||
requests==2.25.1
|
||||
|
||||
# Only needed to match the theme used for the official documentation.
|
||||
# Without this theme, the default theme will be used.
|
||||
sphinx_rtd_theme==1.0.0rc1
|
||||
sphinx_rtd_theme==0.5.2
|
||||
|
@@ -254,8 +254,6 @@ else:
|
||||
"gpu.shader",
|
||||
"gpu.state",
|
||||
"gpu.texture",
|
||||
"gpu.platform",
|
||||
"gpu.capabilities",
|
||||
"gpu_extras",
|
||||
"idprop.types",
|
||||
"mathutils",
|
||||
@@ -1039,21 +1037,17 @@ context_type_map = {
|
||||
# context_member: (RNA type, is_collection)
|
||||
"active_annotation_layer": ("GPencilLayer", False),
|
||||
"active_bone": ("EditBone", False),
|
||||
"active_file": ("FileSelectEntry", False),
|
||||
"active_gpencil_frame": ("GreasePencilLayer", True),
|
||||
"active_gpencil_layer": ("GPencilLayer", True),
|
||||
"active_node": ("Node", False),
|
||||
"active_object": ("Object", False),
|
||||
"active_operator": ("Operator", False),
|
||||
"active_pose_bone": ("PoseBone", False),
|
||||
"active_sequence_strip": ("Sequence", False),
|
||||
"active_editable_fcurve": ("FCurve", False),
|
||||
"active_nla_strip": ("NlaStrip", False),
|
||||
"active_nla_track": ("NlaTrack", False),
|
||||
"annotation_data": ("GreasePencil", False),
|
||||
"annotation_data_owner": ("ID", False),
|
||||
"armature": ("Armature", False),
|
||||
"asset_library_ref": ("AssetLibraryReference", False),
|
||||
"asset_library": ("AssetLibraryReference", False),
|
||||
"bone": ("Bone", False),
|
||||
"brush": ("Brush", False),
|
||||
"camera": ("Camera", False),
|
||||
@@ -1078,7 +1072,6 @@ context_type_map = {
|
||||
"gpencil_data": ("GreasePencil", False),
|
||||
"gpencil_data_owner": ("ID", False),
|
||||
"hair": ("Hair", False),
|
||||
"id": ("ID", False),
|
||||
"image_paint_object": ("Object", False),
|
||||
"lattice": ("Lattice", False),
|
||||
"light": ("Light", False),
|
||||
@@ -1107,7 +1100,6 @@ context_type_map = {
|
||||
"selected_editable_keyframes": ("Keyframe", True),
|
||||
"selected_editable_objects": ("Object", True),
|
||||
"selected_editable_sequences": ("Sequence", True),
|
||||
"selected_files": ("FileSelectEntry", True),
|
||||
"selected_nla_strips": ("NlaStrip", True),
|
||||
"selected_nodes": ("Node", True),
|
||||
"selected_objects": ("Object", True),
|
||||
@@ -1204,7 +1196,6 @@ def pycontext2sphinx(basepath):
|
||||
"text_context_dir",
|
||||
"clip_context_dir",
|
||||
"sequencer_context_dir",
|
||||
"file_context_dir",
|
||||
)
|
||||
|
||||
unique = set()
|
||||
@@ -2002,15 +1993,13 @@ def write_rst_importable_modules(basepath):
|
||||
"blf": "Font Drawing",
|
||||
"imbuf": "Image Buffer",
|
||||
"imbuf.types": "Image Buffer Types",
|
||||
"gpu": "GPU Module",
|
||||
"gpu": "GPU Shader Module",
|
||||
"gpu.types": "GPU Types",
|
||||
"gpu.matrix": "GPU Matrix Utilities",
|
||||
"gpu.select": "GPU Select Utilities",
|
||||
"gpu.shader": "GPU Shader Utilities",
|
||||
"gpu.state": "GPU State Utilities",
|
||||
"gpu.texture": "GPU Texture Utilities",
|
||||
"gpu.platform": "GPU Platform Utilities",
|
||||
"gpu.capabilities": "GPU Capabilities Utilities",
|
||||
"bmesh": "BMesh Module",
|
||||
"bmesh.ops": "BMesh Operators",
|
||||
"bmesh.types": "BMesh Types",
|
||||
|
2
extern/CMakeLists.txt
vendored
2
extern/CMakeLists.txt
vendored
@@ -111,5 +111,5 @@ if(WITH_MOD_FLUID)
|
||||
endif()
|
||||
|
||||
if (WITH_COMPOSITOR)
|
||||
add_subdirectory(smaa_areatex)
|
||||
add_subdirectory(smaa_areatex)
|
||||
endif()
|
||||
|
4
extern/audaspace/bindings/C/AUD_Special.cpp
vendored
4
extern/audaspace/bindings/C/AUD_Special.cpp
vendored
@@ -86,7 +86,6 @@ AUD_API AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
|
||||
info.specs.channels = AUD_CHANNELS_INVALID;
|
||||
info.specs.rate = AUD_RATE_INVALID;
|
||||
info.length = 0.0f;
|
||||
info.start_offset = 0.0f;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -96,7 +95,6 @@ AUD_API AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
|
||||
{
|
||||
info.specs = convSpecToC(reader->getSpecs());
|
||||
info.length = reader->getLength() / (float) info.specs.rate;
|
||||
info.start_offset = reader->getStartOffset();
|
||||
}
|
||||
}
|
||||
catch(Exception&)
|
||||
@@ -247,7 +245,7 @@ AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, int sampl
|
||||
|
||||
buffer[i * 3] = min;
|
||||
buffer[i * 3 + 1] = max;
|
||||
buffer[i * 3 + 2] = sqrt(power / len); // RMS
|
||||
buffer[i * 3 + 2] = sqrt(power) / len;
|
||||
|
||||
if(overallmax < max)
|
||||
overallmax = max;
|
||||
|
1
extern/audaspace/bindings/C/AUD_Types.h
vendored
1
extern/audaspace/bindings/C/AUD_Types.h
vendored
@@ -176,5 +176,4 @@ typedef struct
|
||||
{
|
||||
AUD_Specs specs;
|
||||
float length;
|
||||
double start_offset;
|
||||
} AUD_SoundInfo;
|
||||
|
2
extern/audaspace/bindings/python/setup.py.in
vendored
2
extern/audaspace/bindings/python/setup.py.in
vendored
@@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
6
extern/audaspace/include/IReader.h
vendored
6
extern/audaspace/include/IReader.h
vendored
@@ -70,12 +70,6 @@ public:
|
||||
*/
|
||||
virtual int getPosition() const=0;
|
||||
|
||||
/**
|
||||
* Returns the start offset the sound should have to line up with related sources.
|
||||
* \return The required start offset in seconds.
|
||||
*/
|
||||
virtual double getStartOffset() const { return 0.0;}
|
||||
|
||||
/**
|
||||
* Returns the specification of the reader.
|
||||
* \return The Specs structure.
|
||||
|
2
extern/audaspace/include/fx/VolumeReader.h
vendored
2
extern/audaspace/include/fx/VolumeReader.h
vendored
@@ -67,4 +67,4 @@ public:
|
||||
virtual void read(int& length, bool& eos, sample_t* buffer);
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
AUD_NAMESPACE_END
|
80
extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
vendored
80
extern/audaspace/plugins/ffmpeg/FFMPEGReader.cpp
vendored
@@ -68,7 +68,7 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
||||
for(int i = 0; i < m_frame->nb_samples; i++)
|
||||
{
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
|
||||
m_frame->data[channel] + i * single_size, single_size);
|
||||
m_frame->data[channel] + i * single_size, single_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
||||
for(int i = 0; i < m_frame->nb_samples; i++)
|
||||
{
|
||||
std::memcpy(((data_t*)buffer.getBuffer()) + buf_pos + ((m_codecCtx->channels * i) + channel) * single_size,
|
||||
m_frame->data[channel] + i * single_size, single_size);
|
||||
m_frame->data[channel] + i * single_size, single_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,10 +126,7 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
|
||||
void FFMPEGReader::init()
|
||||
{
|
||||
m_position = 0;
|
||||
m_start_offset = 0.0f;
|
||||
m_pkgbuf_left = 0;
|
||||
m_st_time = 0;
|
||||
m_duration = 0;
|
||||
|
||||
if(avformat_find_stream_info(m_formatCtx, nullptr) < 0)
|
||||
AUD_THROW(FileException, "File couldn't be read, ffmpeg couldn't find the stream info.");
|
||||
@@ -137,41 +134,15 @@ void FFMPEGReader::init()
|
||||
// find audio stream and codec
|
||||
m_stream = -1;
|
||||
|
||||
double dur_sec = 0;
|
||||
|
||||
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
|
||||
{
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
if(m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
if((m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
#else
|
||||
if(m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
if((m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
#endif
|
||||
&& (m_stream < 0))
|
||||
{
|
||||
AVStream *audio_stream = m_formatCtx->streams[i];
|
||||
double audio_timebase = av_q2d(audio_stream->time_base);
|
||||
|
||||
if (audio_stream->start_time != AV_NOPTS_VALUE)
|
||||
{
|
||||
m_st_time = audio_stream->start_time;
|
||||
}
|
||||
|
||||
int64_t ctx_start_time = 0;
|
||||
if (m_formatCtx->start_time != AV_NOPTS_VALUE) {
|
||||
ctx_start_time = m_formatCtx->start_time;
|
||||
}
|
||||
|
||||
m_start_offset = m_st_time * audio_timebase - (double)ctx_start_time / AV_TIME_BASE;
|
||||
|
||||
if(audio_stream->duration != AV_NOPTS_VALUE)
|
||||
{
|
||||
dur_sec = audio_stream->duration * audio_timebase;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If the audio starts after the stream start time, subract this from the total duration. */
|
||||
dur_sec = (double)m_formatCtx->duration / AV_TIME_BASE - m_start_offset;
|
||||
}
|
||||
|
||||
m_stream=i;
|
||||
break;
|
||||
}
|
||||
@@ -242,7 +213,6 @@ void FFMPEGReader::init()
|
||||
}
|
||||
|
||||
m_specs.rate = (SampleRate) m_codecCtx->sample_rate;
|
||||
m_duration = lround(dur_sec * m_codecCtx->sample_rate);
|
||||
}
|
||||
|
||||
FFMPEGReader::FFMPEGReader(std::string filename) :
|
||||
@@ -368,17 +338,21 @@ void FFMPEGReader::seek(int position)
|
||||
{
|
||||
if(position >= 0)
|
||||
{
|
||||
double pts_time_base =
|
||||
av_q2d(m_formatCtx->streams[m_stream]->time_base);
|
||||
uint64_t st_time = m_formatCtx->start_time;
|
||||
uint64_t seek_pos = ((uint64_t)position) * ((uint64_t)AV_TIME_BASE) / ((uint64_t)m_specs.rate);
|
||||
|
||||
uint64_t seek_pts = (((uint64_t)position) / ((uint64_t)m_specs.rate)) / pts_time_base;
|
||||
|
||||
if(m_st_time != AV_NOPTS_VALUE) {
|
||||
seek_pts += m_st_time;
|
||||
if(st_time != AV_NOPTS_VALUE) {
|
||||
seek_pos += st_time;
|
||||
}
|
||||
|
||||
double pts_time_base =
|
||||
av_q2d(m_formatCtx->streams[m_stream]->time_base);
|
||||
uint64_t pts_st_time =
|
||||
((st_time != AV_NOPTS_VALUE) ? st_time : 0)
|
||||
/ pts_time_base / (uint64_t) AV_TIME_BASE;
|
||||
|
||||
// a value < 0 tells us that seeking failed
|
||||
if(av_seek_frame(m_formatCtx, m_stream, seek_pts,
|
||||
if(av_seek_frame(m_formatCtx, -1, seek_pos,
|
||||
AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0)
|
||||
{
|
||||
avcodec_flush_buffers(m_codecCtx);
|
||||
@@ -400,7 +374,7 @@ void FFMPEGReader::seek(int position)
|
||||
if(packet.pts != AV_NOPTS_VALUE)
|
||||
{
|
||||
// calculate real position, and read to frame!
|
||||
m_position = (packet.pts - m_st_time) * pts_time_base * m_specs.rate;
|
||||
m_position = (packet.pts - pts_st_time) * pts_time_base * m_specs.rate;
|
||||
|
||||
if(m_position < position)
|
||||
{
|
||||
@@ -431,7 +405,8 @@ void FFMPEGReader::seek(int position)
|
||||
int FFMPEGReader::getLength() const
|
||||
{
|
||||
// return approximated remaning size
|
||||
return m_duration - m_position;
|
||||
return (int)((m_formatCtx->duration * m_codecCtx->sample_rate)
|
||||
/ AV_TIME_BASE)-m_position;
|
||||
}
|
||||
|
||||
int FFMPEGReader::getPosition() const
|
||||
@@ -439,11 +414,6 @@ int FFMPEGReader::getPosition() const
|
||||
return m_position;
|
||||
}
|
||||
|
||||
double FFMPEGReader::getStartOffset() const
|
||||
{
|
||||
return m_start_offset;
|
||||
}
|
||||
|
||||
Specs FFMPEGReader::getSpecs() const
|
||||
{
|
||||
return m_specs.specs;
|
||||
@@ -480,13 +450,11 @@ void FFMPEGReader::read(int& length, bool& eos, sample_t* buffer)
|
||||
// decode the package
|
||||
pkgbuf_pos = decode(packet, m_pkgbuf);
|
||||
|
||||
if (packet.pts >= m_st_time) {
|
||||
// copy to output buffer
|
||||
data_size = std::min(pkgbuf_pos, left * sample_size);
|
||||
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
|
||||
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
|
||||
left -= data_size / sample_size;
|
||||
}
|
||||
// copy to output buffer
|
||||
data_size = std::min(pkgbuf_pos, left * sample_size);
|
||||
m_convert((data_t*) buf, (data_t*) m_pkgbuf.getBuffer(), data_size / AUD_FORMAT_SIZE(m_specs.format));
|
||||
buf += data_size / AUD_FORMAT_SIZE(m_specs.format);
|
||||
left -= data_size / sample_size;
|
||||
}
|
||||
av_packet_unref(&packet);
|
||||
}
|
||||
|
17
extern/audaspace/plugins/ffmpeg/FFMPEGReader.h
vendored
17
extern/audaspace/plugins/ffmpeg/FFMPEGReader.h
vendored
@@ -54,22 +54,6 @@ private:
|
||||
*/
|
||||
int m_position;
|
||||
|
||||
/**
|
||||
* The start offset in seconds relative to the media container start time.
|
||||
* IE how much the sound should be delayed to be kept in sync with the rest of the containter streams.
|
||||
*/
|
||||
double m_start_offset;
|
||||
|
||||
/**
|
||||
* The start time pts of the stream. All packets before this timestamp shouldn't be played back (only decoded).
|
||||
*/
|
||||
int64_t m_st_time;
|
||||
|
||||
/**
|
||||
* The duration of the audio stream in samples.
|
||||
*/
|
||||
int64_t m_duration;
|
||||
|
||||
/**
|
||||
* The specification of the audio data.
|
||||
*/
|
||||
@@ -198,7 +182,6 @@ public:
|
||||
virtual void seek(int position);
|
||||
virtual int getLength() const;
|
||||
virtual int getPosition() const;
|
||||
virtual double getStartOffset() const;
|
||||
virtual Specs getSpecs() const;
|
||||
virtual void read(int& length, bool& eos, sample_t* buffer);
|
||||
};
|
||||
|
@@ -32,24 +32,17 @@ void PulseAudioDevice::PulseAudio_state_callback(pa_context *context, void *data
|
||||
device->m_state = AUD_pa_context_get_state(context);
|
||||
}
|
||||
|
||||
void PulseAudioDevice::PulseAudio_request(pa_stream *stream, size_t total_bytes, void *data)
|
||||
void PulseAudioDevice::PulseAudio_request(pa_stream *stream, size_t num_bytes, void *data)
|
||||
{
|
||||
PulseAudioDevice* device = (PulseAudioDevice*)data;
|
||||
|
||||
void* buffer;
|
||||
|
||||
while(total_bytes > 0)
|
||||
{
|
||||
size_t num_bytes = total_bytes;
|
||||
AUD_pa_stream_begin_write(stream, &buffer, &num_bytes);
|
||||
|
||||
AUD_pa_stream_begin_write(stream, &buffer, &num_bytes);
|
||||
device->mix((data_t*)buffer, num_bytes / AUD_DEVICE_SAMPLE_SIZE(device->m_specs));
|
||||
|
||||
device->mix((data_t*)buffer, num_bytes / AUD_DEVICE_SAMPLE_SIZE(device->m_specs));
|
||||
|
||||
AUD_pa_stream_write(stream, buffer, num_bytes, nullptr, 0, PA_SEEK_RELATIVE);
|
||||
|
||||
total_bytes -= num_bytes;
|
||||
}
|
||||
AUD_pa_stream_write(stream, buffer, num_bytes, nullptr, 0, PA_SEEK_RELATIVE);
|
||||
}
|
||||
|
||||
void PulseAudioDevice::PulseAudio_underflow(pa_stream *stream, void *data)
|
||||
@@ -103,6 +96,7 @@ void PulseAudioDevice::runMixingThread()
|
||||
|
||||
PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buffersize) :
|
||||
m_state(PA_CONTEXT_UNCONNECTED),
|
||||
m_buffersize(buffersize),
|
||||
m_underflows(0)
|
||||
{
|
||||
m_mainloop = AUD_pa_mainloop_new();
|
||||
@@ -193,9 +187,6 @@ PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buff
|
||||
AUD_pa_stream_set_write_callback(m_stream, PulseAudio_request, this);
|
||||
AUD_pa_stream_set_underflow_callback(m_stream, PulseAudio_underflow, this);
|
||||
|
||||
buffersize *= AUD_DEVICE_SAMPLE_SIZE(m_specs);
|
||||
m_buffersize = buffersize;
|
||||
|
||||
pa_buffer_attr buffer_attr;
|
||||
|
||||
buffer_attr.fragsize = -1U;
|
||||
|
@@ -59,7 +59,7 @@ private:
|
||||
* \param num_bytes The length in bytes to be supplied.
|
||||
* \param data The PulseAudio device.
|
||||
*/
|
||||
AUD_LOCAL static void PulseAudio_request(pa_stream* stream, size_t total_bytes, void* data);
|
||||
AUD_LOCAL static void PulseAudio_request(pa_stream* stream, size_t num_bytes, void* data);
|
||||
|
||||
/**
|
||||
* Reports an underflow from the PulseAudio server.
|
||||
|
2
extern/audaspace/src/fx/VolumeReader.cpp
vendored
2
extern/audaspace/src/fx/VolumeReader.cpp
vendored
@@ -57,4 +57,4 @@ void VolumeReader::read(int& length, bool& eos, sample_t* buffer)
|
||||
buffer[i] = buffer[i] * m_volumeStorage->getVolume();
|
||||
}
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
AUD_NAMESPACE_END
|
2
extern/mantaflow/UPDATE.sh
vendored
2
extern/mantaflow/UPDATE.sh
vendored
@@ -8,7 +8,7 @@
|
||||
|
||||
# YOUR INSTALLATION PATHS GO HERE:
|
||||
MANTA_INSTALLATION=/Users/sebbas/Developer/Mantaflow/mantaflowDevelop
|
||||
BLENDER_INSTALLATION=/Users/sebbas/Developer/Blender
|
||||
BLENDER_INSTALLATION=/Users/sebbas/Developer/Blender/fluid-mantaflow
|
||||
|
||||
# Try to check out Mantaflow repository before building?
|
||||
CLEAN_REPOSITORY=0
|
||||
|
@@ -28,13 +28,11 @@ extern PyTypeObject PbVec3Type;
|
||||
extern PyTypeObject PbVec4Type;
|
||||
|
||||
struct PbVec3 {
|
||||
PyObject_HEAD
|
||||
float data[3];
|
||||
PyObject_HEAD float data[3];
|
||||
};
|
||||
|
||||
struct PbVec4 {
|
||||
PyObject_HEAD
|
||||
float data[4];
|
||||
PyObject_HEAD float data[4];
|
||||
};
|
||||
|
||||
PyObject *getPyNone()
|
||||
|
6
extern/mantaflow/helper/pwrapper/pvec3.cpp
vendored
6
extern/mantaflow/helper/pwrapper/pvec3.cpp
vendored
@@ -25,8 +25,7 @@ namespace Manta {
|
||||
extern PyTypeObject PbVec3Type;
|
||||
|
||||
struct PbVec3 {
|
||||
PyObject_HEAD
|
||||
float data[3];
|
||||
PyObject_HEAD float data[3];
|
||||
};
|
||||
|
||||
static void PbVec3Dealloc(PbVec3 *self)
|
||||
@@ -294,8 +293,7 @@ inline PyObject *castPy(PyTypeObject *p)
|
||||
extern PyTypeObject PbVec4Type;
|
||||
|
||||
struct PbVec4 {
|
||||
PyObject_HEAD
|
||||
float data[4];
|
||||
PyObject_HEAD float data[4];
|
||||
};
|
||||
|
||||
static PyMethodDef PbVec4Methods[] = {
|
||||
|
@@ -76,8 +76,7 @@ struct ClassData {
|
||||
};
|
||||
|
||||
struct PbObject {
|
||||
PyObject_HEAD
|
||||
Manta::PbClass *instance;
|
||||
PyObject_HEAD Manta::PbClass *instance;
|
||||
ClassData *classdef;
|
||||
};
|
||||
|
||||
|
202
extern/mantaflow/preprocessed/fastmarch.cpp
vendored
202
extern/mantaflow/preprocessed/fastmarch.cpp
vendored
@@ -874,136 +874,6 @@ static const Vec3i nb[6] = {Vec3i(1, 0, 0),
|
||||
Vec3i(0, 0, 1),
|
||||
Vec3i(0, 0, -1)};
|
||||
|
||||
struct knMarkSkipCells : public KernelBase {
|
||||
knMarkSkipCells(Grid<Real> &phi, Grid<int> &tmp, bool inside)
|
||||
: KernelBase(&phi, 1), phi(phi), tmp(tmp), inside(inside)
|
||||
{
|
||||
runMessage();
|
||||
run();
|
||||
}
|
||||
inline void op(int i, int j, int k, Grid<Real> &phi, Grid<int> &tmp, bool inside) const
|
||||
{
|
||||
if (!inside && phi(i, j, k) < 0.) {
|
||||
tmp(i, j, k) = 1;
|
||||
}
|
||||
if (inside && phi(i, j, k) > 0.) {
|
||||
tmp(i, j, k) = 1;
|
||||
}
|
||||
}
|
||||
inline Grid<Real> &getArg0()
|
||||
{
|
||||
return phi;
|
||||
}
|
||||
typedef Grid<Real> type0;
|
||||
inline Grid<int> &getArg1()
|
||||
{
|
||||
return tmp;
|
||||
}
|
||||
typedef Grid<int> type1;
|
||||
inline bool &getArg2()
|
||||
{
|
||||
return inside;
|
||||
}
|
||||
typedef bool type2;
|
||||
void runMessage()
|
||||
{
|
||||
debMsg("Executing kernel knMarkSkipCells ", 3);
|
||||
debMsg("Kernel range"
|
||||
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
|
||||
4);
|
||||
};
|
||||
void operator()(const tbb::blocked_range<IndexInt> &__r) const
|
||||
{
|
||||
const int _maxX = maxX;
|
||||
const int _maxY = maxY;
|
||||
if (maxZ > 1) {
|
||||
for (int k = __r.begin(); k != (int)__r.end(); k++)
|
||||
for (int j = 1; j < _maxY; j++)
|
||||
for (int i = 1; i < _maxX; i++)
|
||||
op(i, j, k, phi, tmp, inside);
|
||||
}
|
||||
else {
|
||||
const int k = 0;
|
||||
for (int j = __r.begin(); j != (int)__r.end(); j++)
|
||||
for (int i = 1; i < _maxX; i++)
|
||||
op(i, j, k, phi, tmp, inside);
|
||||
}
|
||||
}
|
||||
void run()
|
||||
{
|
||||
if (maxZ > 1)
|
||||
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
|
||||
else
|
||||
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
|
||||
}
|
||||
Grid<Real> φ
|
||||
Grid<int> &tmp;
|
||||
bool inside;
|
||||
};
|
||||
|
||||
struct knSetFirstLayer : public KernelBase {
|
||||
knSetFirstLayer(Grid<int> &tmp, int dim) : KernelBase(&tmp, 1), tmp(tmp), dim(dim)
|
||||
{
|
||||
runMessage();
|
||||
run();
|
||||
}
|
||||
inline void op(int i, int j, int k, Grid<int> &tmp, int dim) const
|
||||
{
|
||||
Vec3i p(i, j, k);
|
||||
if (tmp(p))
|
||||
return;
|
||||
for (int n = 0; n < 2 * dim; ++n) {
|
||||
if (tmp(p + nb[n]) == 1) {
|
||||
tmp(i, j, k) = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
inline Grid<int> &getArg0()
|
||||
{
|
||||
return tmp;
|
||||
}
|
||||
typedef Grid<int> type0;
|
||||
inline int &getArg1()
|
||||
{
|
||||
return dim;
|
||||
}
|
||||
typedef int type1;
|
||||
void runMessage()
|
||||
{
|
||||
debMsg("Executing kernel knSetFirstLayer ", 3);
|
||||
debMsg("Kernel range"
|
||||
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
|
||||
4);
|
||||
};
|
||||
void operator()(const tbb::blocked_range<IndexInt> &__r) const
|
||||
{
|
||||
const int _maxX = maxX;
|
||||
const int _maxY = maxY;
|
||||
if (maxZ > 1) {
|
||||
for (int k = __r.begin(); k != (int)__r.end(); k++)
|
||||
for (int j = 1; j < _maxY; j++)
|
||||
for (int i = 1; i < _maxX; i++)
|
||||
op(i, j, k, tmp, dim);
|
||||
}
|
||||
else {
|
||||
const int k = 0;
|
||||
for (int j = __r.begin(); j != (int)__r.end(); j++)
|
||||
for (int i = 1; i < _maxX; i++)
|
||||
op(i, j, k, tmp, dim);
|
||||
}
|
||||
}
|
||||
void run()
|
||||
{
|
||||
if (maxZ > 1)
|
||||
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
|
||||
else
|
||||
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
|
||||
}
|
||||
Grid<int> &tmp;
|
||||
int dim;
|
||||
};
|
||||
|
||||
template<class S> struct knExtrapolateLsSimple : public KernelBase {
|
||||
knExtrapolateLsSimple(Grid<S> &val, int distance, Grid<int> &tmp, const int d, S direction)
|
||||
: KernelBase(&val, 1), val(val), distance(distance), tmp(tmp), d(d), direction(direction)
|
||||
@@ -1173,12 +1043,39 @@ void extrapolateLsSimple(Grid<Real> &phi, int distance = 4, bool inside = false)
|
||||
tmp.clear();
|
||||
const int dim = (phi.is3D() ? 3 : 2);
|
||||
|
||||
// by default, march outside (ie mark all inside to be skipped)
|
||||
Real direction = (inside) ? -1. : 1.;
|
||||
knMarkSkipCells(phi, tmp, inside);
|
||||
|
||||
// by default, march outside
|
||||
Real direction = 1.;
|
||||
if (!inside) {
|
||||
// mark all inside
|
||||
FOR_IJK_BND(phi, 1)
|
||||
{
|
||||
if (phi(i, j, k) < 0.) {
|
||||
tmp(i, j, k) = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
direction = -1.;
|
||||
FOR_IJK_BND(phi, 1)
|
||||
{
|
||||
if (phi(i, j, k) > 0.) {
|
||||
tmp(i, j, k) = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// + first layer around
|
||||
knSetFirstLayer(tmp, dim);
|
||||
FOR_IJK_BND(phi, 1)
|
||||
{
|
||||
Vec3i p(i, j, k);
|
||||
if (tmp(p))
|
||||
continue;
|
||||
for (int n = 0; n < 2 * dim; ++n) {
|
||||
if (tmp(p + nb[n]) == 1) {
|
||||
tmp(i, j, k) = 2;
|
||||
n = 2 * dim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// extrapolate for distance
|
||||
for (int d = 2; d < 1 + distance; ++d) {
|
||||
@@ -1229,12 +1126,37 @@ void extrapolateVec3Simple(Grid<Vec3> &vel, Grid<Real> &phi, int distance = 4, b
|
||||
tmp.clear();
|
||||
const int dim = (vel.is3D() ? 3 : 2);
|
||||
|
||||
// mark initial cells, by default, march outside (ie mark all inside to be skipped)
|
||||
Real direction = (inside) ? -1. : 1.;
|
||||
knMarkSkipCells(phi, tmp, inside);
|
||||
|
||||
// mark initial cells, by default, march outside
|
||||
if (!inside) {
|
||||
// mark all inside
|
||||
FOR_IJK_BND(phi, 1)
|
||||
{
|
||||
if (phi(i, j, k) < 0.) {
|
||||
tmp(i, j, k) = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
FOR_IJK_BND(phi, 1)
|
||||
{
|
||||
if (phi(i, j, k) > 0.) {
|
||||
tmp(i, j, k) = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// + first layer next to initial cells
|
||||
knSetFirstLayer(tmp, dim);
|
||||
FOR_IJK_BND(vel, 1)
|
||||
{
|
||||
Vec3i p(i, j, k);
|
||||
if (tmp(p))
|
||||
continue;
|
||||
for (int n = 0; n < 2 * dim; ++n) {
|
||||
if (tmp(p + nb[n]) == 1) {
|
||||
tmp(i, j, k) = 2;
|
||||
n = 2 * dim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int d = 2; d < 1 + distance; ++d) {
|
||||
knExtrapolateLsSimple<Vec3>(vel, distance, tmp, d, Vec3(0.));
|
||||
|
2
extern/mantaflow/preprocessed/gitinfo.h
vendored
2
extern/mantaflow/preprocessed/gitinfo.h
vendored
@@ -1,3 +1,3 @@
|
||||
|
||||
|
||||
#define MANTA_GIT_VERSION "commit d5d9a6c28daa8f21426d7a285f48639c0d8fd13f"
|
||||
#define MANTA_GIT_VERSION "commit 8fbebe02459b7f72575872c20961f7cb757db408"
|
||||
|
7
extern/nanosvg/README.blender
vendored
7
extern/nanosvg/README.blender
vendored
@@ -1,7 +0,0 @@
|
||||
Project: NanoSVG
|
||||
URL: https://github.com/memononen/nanosvg
|
||||
License: zlib
|
||||
Upstream version:
|
||||
Local modifications: Added some functionality to manage grease pencil layers
|
||||
|
||||
Added a fix to SVG import arc and float errors (https://developer.blender.org/rB11dc674c78b49fc4e0b7c134c375b6c8b8eacbcc)
|
86
extern/nanosvg/patches/NanoSVG.diff
vendored
86
extern/nanosvg/patches/NanoSVG.diff
vendored
@@ -1,86 +0,0 @@
|
||||
diff --git a/c:/tmp/nanosvg_original.h b/c:/tmp/nanosvg_modif.h
|
||||
index 24a01a86d3d..eca0d07e79d 100644
|
||||
--- a/c:/tmp/nanosvg_original.h
|
||||
+++ b/c:/tmp/nanosvg_modif.h
|
||||
@@ -24,7 +24,8 @@
|
||||
*
|
||||
* Bounding box calculation based on http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
|
||||
*
|
||||
- */
|
||||
+ * This is a modified version for Blender used by importers.
|
||||
+ **/
|
||||
|
||||
#ifndef NANOSVG_H
|
||||
#define NANOSVG_H
|
||||
@@ -148,6 +149,8 @@ extern "C" {
|
||||
typedef struct NSVGshape
|
||||
{
|
||||
char id[64]; // Optional 'id' attr of the shape or its group
|
||||
+ /* Blender: Parent ID used for layer creation. */
|
||||
+ char id_parent[64];
|
||||
NSVGpaint fill; // Fill paint
|
||||
NSVGpaint stroke; // Stroke paint
|
||||
float opacity; // Opacity of the shape.
|
||||
@@ -370,6 +373,7 @@ int nsvg__parseXML(char* input,
|
||||
/* Simple SVG parser. */
|
||||
|
||||
#define NSVG_MAX_ATTR 128
|
||||
+#define NSVG_MAX_BREADCRUMB 5
|
||||
|
||||
enum NSVGgradientUnits
|
||||
{
|
||||
@@ -471,6 +475,10 @@ typedef struct NSVGparser
|
||||
float dpi;
|
||||
char pathFlag;
|
||||
char defsFlag;
|
||||
+ /** Blender breadcrumb for layers. */
|
||||
+ char breadcrumb[NSVG_MAX_BREADCRUMB][64];
|
||||
+ /** Blender number of elements in breadcrumb. */
|
||||
+ int breadcrumb_len;
|
||||
} NSVGparser;
|
||||
|
||||
static void nsvg__xformIdentity(float* t)
|
||||
@@ -980,6 +988,14 @@ static void nsvg__addShape(NSVGparser* p)
|
||||
memset(shape, 0, sizeof(NSVGshape));
|
||||
|
||||
memcpy(shape->id, attr->id, sizeof shape->id);
|
||||
+ /* Copy parent id from breadcrumb. */
|
||||
+ if (p->breadcrumb_len > 0) {
|
||||
+ memcpy(shape->id_parent, p->breadcrumb[0], sizeof shape->id_parent);
|
||||
+ }
|
||||
+ else {
|
||||
+ memcpy(shape->id_parent, attr->id, sizeof shape->id_parent);
|
||||
+ }
|
||||
+
|
||||
scale = nsvg__getAverageScale(attr->xform);
|
||||
shape->strokeWidth = attr->strokeWidth * scale;
|
||||
shape->strokeDashOffset = attr->strokeDashOffset * scale;
|
||||
@@ -2814,6 +2830,14 @@ static void nsvg__startElement(void* ud, const char* el, const char** attr)
|
||||
if (strcmp(el, "g") == 0) {
|
||||
nsvg__pushAttr(p);
|
||||
nsvg__parseAttribs(p, attr);
|
||||
+
|
||||
+ /* Save the breadcrumb of groups. */
|
||||
+ if (p->breadcrumb_len < NSVG_MAX_BREADCRUMB) {
|
||||
+ NSVGattrib *attr_id = nsvg__getAttr(p);
|
||||
+ memcpy(
|
||||
+ p->breadcrumb[p->breadcrumb_len], attr_id->id, sizeof(p->breadcrumb[p->breadcrumb_len]));
|
||||
+ p->breadcrumb_len++;
|
||||
+ }
|
||||
}
|
||||
else if (strcmp(el, "path") == 0) {
|
||||
if (p->pathFlag) // Do not allow nested paths.
|
||||
@@ -2874,7 +2898,12 @@ static void nsvg__endElement(void* ud, const char* el)
|
||||
NSVGparser* p = (NSVGparser*)ud;
|
||||
|
||||
if (strcmp(el, "g") == 0) {
|
||||
- nsvg__popAttr(p);
|
||||
+ /* Remove the breadcrumb level. */
|
||||
+ if (p->breadcrumb_len > 0) {
|
||||
+ p->breadcrumb[p->breadcrumb_len - 1][0] = '\0';
|
||||
+ p->breadcrumb_len--;
|
||||
+ }
|
||||
+ nsvg__popAttr(p);
|
||||
}
|
||||
else if (strcmp(el, "path") == 0) {
|
||||
p->pathFlag = 0;
|
@@ -60,108 +60,9 @@
|
||||
# define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
|
||||
#endif
|
||||
|
||||
/* Define the `ATOMIC_FORCE_USE_FALLBACK` to force lock-based fallback implementation to be used
|
||||
* (even on platforms where there is native implementation available via compiler.
|
||||
* Useful for development purposes. */
|
||||
#undef ATOMIC_FORCE_USE_FALLBACK
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Spin-lock implementation
|
||||
*
|
||||
* Used to implement atomics on unsupported platforms.
|
||||
* The spin implementation is shared for all platforms to make sure it compiles and tested.
|
||||
* \{ */
|
||||
|
||||
typedef struct AtomicSpinLock {
|
||||
volatile int lock;
|
||||
|
||||
/* Pad the structure size to a cache-line, to avoid unwanted sharing with other data. */
|
||||
int pad[32 - sizeof(int)];
|
||||
} __attribute__((aligned(32))) AtomicSpinLock;
|
||||
|
||||
ATOMIC_INLINE void atomic_spin_lock(volatile AtomicSpinLock *lock)
|
||||
{
|
||||
while (__sync_lock_test_and_set(&lock->lock, 1)) {
|
||||
while (lock->lock) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ATOMIC_INLINE void atomic_spin_unlock(volatile AtomicSpinLock *lock)
|
||||
{
|
||||
__sync_lock_release(&lock->lock);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Common part of locking fallback implementation
|
||||
* \{ */
|
||||
|
||||
/* Global lock, shared by all atomic operations implementations.
|
||||
*
|
||||
* Could be split into per-size locks, although added complexity and being more error-proone does
|
||||
* not seem to worth it for a fall-back implementation. */
|
||||
static _ATOMIC_MAYBE_UNUSED AtomicSpinLock _atomic_global_lock = {0};
|
||||
|
||||
#define ATOMIC_LOCKING_OP_AND_FETCH_DEFINE(_type, _op_name, _op) \
|
||||
ATOMIC_INLINE _type##_t atomic_##_op_name##_and_fetch_##_type(_type##_t *p, _type##_t x) \
|
||||
{ \
|
||||
atomic_spin_lock(&_atomic_global_lock); \
|
||||
const _type##_t original_value = *(p); \
|
||||
const _type##_t new_value = original_value _op(x); \
|
||||
*(p) = new_value; \
|
||||
atomic_spin_unlock(&_atomic_global_lock); \
|
||||
return new_value; \
|
||||
}
|
||||
|
||||
#define ATOMIC_LOCKING_FETCH_AND_OP_DEFINE(_type, _op_name, _op) \
|
||||
ATOMIC_INLINE _type##_t atomic_fetch_and_##_op_name##_##_type(_type##_t *p, _type##_t x) \
|
||||
{ \
|
||||
atomic_spin_lock(&_atomic_global_lock); \
|
||||
const _type##_t original_value = *(p); \
|
||||
*(p) = original_value _op(x); \
|
||||
atomic_spin_unlock(&_atomic_global_lock); \
|
||||
return original_value; \
|
||||
}
|
||||
|
||||
#define ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE(_type) \
|
||||
ATOMIC_LOCKING_OP_AND_FETCH_DEFINE(_type, add, +)
|
||||
|
||||
#define ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE(_type) \
|
||||
ATOMIC_LOCKING_OP_AND_FETCH_DEFINE(_type, sub, -)
|
||||
|
||||
#define ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE(_type) \
|
||||
ATOMIC_LOCKING_FETCH_AND_OP_DEFINE(_type, add, +)
|
||||
|
||||
#define ATOMIC_LOCKING_FETCH_AND_SUB_DEFINE(_type) \
|
||||
ATOMIC_LOCKING_FETCH_AND_OP_DEFINE(_type, sub, -)
|
||||
|
||||
#define ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(_type) ATOMIC_LOCKING_FETCH_AND_OP_DEFINE(_type, or, |)
|
||||
|
||||
#define ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(_type) \
|
||||
ATOMIC_LOCKING_FETCH_AND_OP_DEFINE(_type, and, &)
|
||||
|
||||
#define ATOMIC_LOCKING_CAS_DEFINE(_type) \
|
||||
ATOMIC_INLINE _type##_t atomic_cas_##_type(_type##_t *v, _type##_t old, _type##_t _new) \
|
||||
{ \
|
||||
atomic_spin_lock(&_atomic_global_lock); \
|
||||
const _type##_t original_value = *v; \
|
||||
if (*v == old) { \
|
||||
*v = _new; \
|
||||
} \
|
||||
atomic_spin_unlock(&_atomic_global_lock); \
|
||||
return original_value; \
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name 64-bit operations
|
||||
* \{ */
|
||||
|
||||
#if !defined(ATOMIC_FORCE_USE_FALLBACK) && \
|
||||
(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
|
||||
/******************************************************************************/
|
||||
/* 64-bit operations. */
|
||||
#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
|
||||
/* Unsigned */
|
||||
ATOMIC_INLINE uint64_t atomic_add_and_fetch_uint64(uint64_t *p, uint64_t x)
|
||||
{
|
||||
@@ -214,7 +115,7 @@ ATOMIC_INLINE int64_t atomic_cas_int64(int64_t *v, int64_t old, int64_t _new)
|
||||
return __sync_val_compare_and_swap(v, old, _new);
|
||||
}
|
||||
|
||||
#elif !defined(ATOMIC_FORCE_USE_FALLBACK) && (defined(__amd64__) || defined(__x86_64__))
|
||||
#elif (defined(__amd64__) || defined(__x86_64__))
|
||||
/* Unsigned */
|
||||
ATOMIC_INLINE uint64_t atomic_fetch_and_add_uint64(uint64_t *p, uint64_t x)
|
||||
{
|
||||
@@ -289,36 +190,12 @@ ATOMIC_INLINE int64_t atomic_cas_int64(int64_t *v, int64_t old, int64_t _new)
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
|
||||
/* Unsigned */
|
||||
|
||||
ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE(uint64)
|
||||
ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE(uint64)
|
||||
|
||||
ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE(uint64)
|
||||
ATOMIC_LOCKING_FETCH_AND_SUB_DEFINE(uint64)
|
||||
|
||||
ATOMIC_LOCKING_CAS_DEFINE(uint64)
|
||||
|
||||
/* Signed */
|
||||
ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE(int64)
|
||||
ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE(int64)
|
||||
|
||||
ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE(int64)
|
||||
ATOMIC_LOCKING_FETCH_AND_SUB_DEFINE(int64)
|
||||
|
||||
ATOMIC_LOCKING_CAS_DEFINE(int64)
|
||||
|
||||
# error "Missing implementation for 64-bit atomic operations"
|
||||
#endif
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name 32-bit operations
|
||||
* \{ */
|
||||
|
||||
#if !defined(ATOMIC_FORCE_USE_FALLBACK) && \
|
||||
(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
|
||||
/******************************************************************************/
|
||||
/* 32-bit operations. */
|
||||
#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
|
||||
/* Unsigned */
|
||||
ATOMIC_INLINE uint32_t atomic_add_and_fetch_uint32(uint32_t *p, uint32_t x)
|
||||
{
|
||||
@@ -351,8 +228,7 @@ ATOMIC_INLINE int32_t atomic_cas_int32(int32_t *v, int32_t old, int32_t _new)
|
||||
return __sync_val_compare_and_swap(v, old, _new);
|
||||
}
|
||||
|
||||
#elif !defined(ATOMIC_FORCE_USE_FALLBACK) && \
|
||||
(defined(__i386__) || defined(__amd64__) || defined(__x86_64__))
|
||||
#elif (defined(__i386__) || defined(__amd64__) || defined(__x86_64__))
|
||||
/* Unsigned */
|
||||
ATOMIC_INLINE uint32_t atomic_add_and_fetch_uint32(uint32_t *p, uint32_t x)
|
||||
{
|
||||
@@ -410,25 +286,10 @@ ATOMIC_INLINE int32_t atomic_cas_int32(int32_t *v, int32_t old, int32_t _new)
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Unsigned */
|
||||
|
||||
ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE(uint32)
|
||||
ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE(uint32)
|
||||
|
||||
ATOMIC_LOCKING_CAS_DEFINE(uint32)
|
||||
|
||||
/* Signed */
|
||||
|
||||
ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE(int32)
|
||||
ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE(int32)
|
||||
|
||||
ATOMIC_LOCKING_CAS_DEFINE(int32)
|
||||
|
||||
# error "Missing implementation for 32-bit atomic operations"
|
||||
#endif
|
||||
|
||||
#if !defined(ATOMIC_FORCE_USE_FALLBACK) && \
|
||||
(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
|
||||
#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
|
||||
/* Unsigned */
|
||||
ATOMIC_INLINE uint32_t atomic_fetch_and_add_uint32(uint32_t *p, uint32_t x)
|
||||
{
|
||||
@@ -462,27 +323,12 @@ ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t *p, int32_t x)
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Unsigned */
|
||||
ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE(uint32)
|
||||
ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(uint32)
|
||||
ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(uint32)
|
||||
|
||||
/* Signed */
|
||||
ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE(int32)
|
||||
ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(int32)
|
||||
ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(int32)
|
||||
|
||||
# error "Missing implementation for 32-bit atomic operations"
|
||||
#endif
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name 16-bit operations
|
||||
* \{ */
|
||||
|
||||
#if !defined(ATOMIC_FORCE_USE_FALLBACK) && \
|
||||
(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_2))
|
||||
/******************************************************************************/
|
||||
/* 16-bit operations. */
|
||||
#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_2))
|
||||
|
||||
/* Signed */
|
||||
ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b)
|
||||
@@ -495,21 +341,12 @@ ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t b)
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(int16)
|
||||
ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(int16)
|
||||
|
||||
# error "Missing implementation for 16-bit atomic operations"
|
||||
#endif
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name 8-bit operations
|
||||
* \{ */
|
||||
|
||||
#if !defined(ATOMIC_FORCE_USE_FALLBACK) && \
|
||||
(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_1))
|
||||
|
||||
/******************************************************************************/
|
||||
/* 8-bit operations. */
|
||||
#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_1))
|
||||
/* Unsigned */
|
||||
ATOMIC_INLINE uint8_t atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b)
|
||||
{
|
||||
@@ -531,27 +368,7 @@ ATOMIC_INLINE int8_t atomic_fetch_and_or_int8(int8_t *p, int8_t b)
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Unsigned */
|
||||
ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(uint8)
|
||||
ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(uint8)
|
||||
|
||||
/* Signed */
|
||||
ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(int8)
|
||||
ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(int8)
|
||||
|
||||
# error "Missing implementation for 8-bit atomic operations"
|
||||
#endif
|
||||
|
||||
/** \} */
|
||||
|
||||
#undef ATOMIC_LOCKING_OP_AND_FETCH_DEFINE
|
||||
#undef ATOMIC_LOCKING_FETCH_AND_OP_DEFINE
|
||||
#undef ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE
|
||||
#undef ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE
|
||||
#undef ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE
|
||||
#undef ATOMIC_LOCKING_FETCH_AND_SUB_DEFINE
|
||||
#undef ATOMIC_LOCKING_FETCH_AND_OR_DEFINE
|
||||
#undef ATOMIC_LOCKING_FETCH_AND_AND_DEFINE
|
||||
#undef ATOMIC_LOCKING_CAS_DEFINE
|
||||
|
||||
#endif /* __ATOMIC_OPS_UNIX_H__ */
|
||||
|
@@ -64,11 +64,9 @@
|
||||
#ifdef __GNUC__
|
||||
# define _ATOMIC_LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
# define _ATOMIC_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
# define _ATOMIC_MAYBE_UNUSED __attribute__((unused))
|
||||
#else
|
||||
# define _ATOMIC_LIKELY(x) (x)
|
||||
# define _ATOMIC_UNLIKELY(x) (x)
|
||||
# define _ATOMIC_MAYBE_UNUSED
|
||||
#endif
|
||||
|
||||
#if defined(__SIZEOF_POINTER__)
|
||||
|
@@ -115,16 +115,6 @@ if(WITH_OPENVDB)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
add_definitions(-DWITH_ALEMBIC)
|
||||
list(APPEND INC_SYS
|
||||
${ALEMBIC_INCLUDE_DIRS}
|
||||
)
|
||||
list(APPEND LIB
|
||||
${ALEMBIC_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
add_definitions(-DWITH_OPENIMAGEDENOISE)
|
||||
list(APPEND INC_SYS
|
||||
|
@@ -61,7 +61,6 @@ class CyclesRender(bpy.types.RenderEngine):
|
||||
bl_use_save_buffers = True
|
||||
bl_use_spherical_stereo = True
|
||||
bl_use_custom_freestyle = True
|
||||
bl_use_alembic_procedural = True
|
||||
|
||||
def __init__(self):
|
||||
self.session = None
|
||||
|
@@ -227,11 +227,6 @@ def update_render_passes(self, context):
|
||||
view_layer.update_render_passes()
|
||||
|
||||
|
||||
def update_render_engine(self, context):
|
||||
scene = context.scene
|
||||
scene.update_render_engine()
|
||||
|
||||
|
||||
class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
|
||||
device: EnumProperty(
|
||||
@@ -245,7 +240,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
description="Feature set to use for rendering",
|
||||
items=enum_feature_set,
|
||||
default='SUPPORTED',
|
||||
update=update_render_engine,
|
||||
)
|
||||
shading_system: BoolProperty(
|
||||
name="Open Shading Language",
|
||||
@@ -408,7 +402,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
|
||||
adaptive_threshold: FloatProperty(
|
||||
name="Adaptive Sampling Threshold",
|
||||
description="Noise level step to stop sampling at, lower values reduce noise at the cost of render time. Zero for automatic setting based on number of AA samples",
|
||||
description="Noise level step to stop sampling at, lower values reduce noise the cost of render time. Zero for automatic setting based on number of AA samples",
|
||||
min=0.0, max=1.0,
|
||||
default=0.0,
|
||||
precision=4,
|
||||
@@ -1170,6 +1164,12 @@ class CyclesVisibilitySettings(bpy.types.PropertyGroup):
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
bpy.types.Object.cycles_visibility = PointerProperty(
|
||||
name="Cycles Visibility Settings",
|
||||
description="Cycles visibility settings",
|
||||
type=cls,
|
||||
)
|
||||
|
||||
bpy.types.World.cycles_visibility = PointerProperty(
|
||||
name="Cycles Visibility Settings",
|
||||
description="Cycles visibility settings",
|
||||
@@ -1178,6 +1178,7 @@ class CyclesVisibilitySettings(bpy.types.PropertyGroup):
|
||||
|
||||
@classmethod
|
||||
def unregister(cls):
|
||||
del bpy.types.Object.cycles_visibility
|
||||
del bpy.types.World.cycles_visibility
|
||||
|
||||
|
||||
@@ -1267,12 +1268,18 @@ class CyclesObjectSettings(bpy.types.PropertyGroup):
|
||||
default=0.1,
|
||||
)
|
||||
|
||||
ao_distance: FloatProperty(
|
||||
name="AO Distance",
|
||||
description="AO distance used for approximate global illumination (0 means use world setting)",
|
||||
min=0.0,
|
||||
default=0.0,
|
||||
subtype='DISTANCE',
|
||||
is_shadow_catcher: BoolProperty(
|
||||
name="Shadow Catcher",
|
||||
description="Only render shadows on this object, for compositing renders into real footage",
|
||||
default=False,
|
||||
)
|
||||
|
||||
is_holdout: BoolProperty(
|
||||
name="Holdout",
|
||||
description="Render objects as a holdout or matte, creating a "
|
||||
"hole in the image with zero alpha, to fill out in "
|
||||
"compositing with real footage or another render",
|
||||
default=False,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
@@ -1102,7 +1102,7 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
|
||||
|
||||
if ob:
|
||||
is_sortable = len(ob.material_slots) > 1
|
||||
rows = 3
|
||||
rows = 1
|
||||
if (is_sortable):
|
||||
rows = 4
|
||||
|
||||
@@ -1228,26 +1228,6 @@ class CYCLES_OBJECT_PT_shading_shadow_terminator(CyclesButtonsPanel, Panel):
|
||||
flow.prop(cob, "shadow_terminator_offset", text="Shading Offset")
|
||||
|
||||
|
||||
class CYCLES_OBJECT_PT_shading_gi_approximation(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Fast GI Approximation"
|
||||
bl_parent_id = "CYCLES_OBJECT_PT_shading"
|
||||
bl_context = "object"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
scene = context.scene
|
||||
ob = context.object
|
||||
|
||||
cob = ob.cycles
|
||||
cscene = scene.cycles
|
||||
|
||||
col = layout.column()
|
||||
col.active = cscene.use_fast_gi
|
||||
col.prop(cob, "ao_distance")
|
||||
|
||||
|
||||
class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Visibility"
|
||||
bl_context = "object"
|
||||
@@ -1270,9 +1250,10 @@ class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
|
||||
col.prop(ob, "hide_render", text="Renders", invert_checkbox=True, toggle=False)
|
||||
|
||||
if has_geometry_visibility(ob):
|
||||
cob = ob.cycles
|
||||
col = layout.column(heading="Mask")
|
||||
col.prop(ob, "is_shadow_catcher")
|
||||
col.prop(ob, "is_holdout")
|
||||
col.prop(cob, "is_shadow_catcher")
|
||||
col.prop(cob, "is_holdout")
|
||||
|
||||
|
||||
class CYCLES_OBJECT_PT_visibility_ray_visibility(CyclesButtonsPanel, Panel):
|
||||
@@ -1292,17 +1273,19 @@ class CYCLES_OBJECT_PT_visibility_ray_visibility(CyclesButtonsPanel, Panel):
|
||||
|
||||
scene = context.scene
|
||||
ob = context.object
|
||||
cob = ob.cycles
|
||||
visibility = ob.cycles_visibility
|
||||
|
||||
col = layout.column()
|
||||
col.prop(ob, "visible_camera", text="Camera")
|
||||
col.prop(ob, "visible_diffuse", text="Diffuse")
|
||||
col.prop(ob, "visible_glossy", text="Glossy")
|
||||
col.prop(ob, "visible_transmission", text="Transmission")
|
||||
col.prop(ob, "visible_volume_scatter", text="Volume Scatter")
|
||||
col.prop(visibility, "camera")
|
||||
col.prop(visibility, "diffuse")
|
||||
col.prop(visibility, "glossy")
|
||||
col.prop(visibility, "transmission")
|
||||
col.prop(visibility, "scatter")
|
||||
|
||||
if ob.type != 'LIGHT':
|
||||
sub = col.column()
|
||||
sub.prop(ob, "visible_shadow", text="Shadow")
|
||||
sub.prop(visibility, "shadow")
|
||||
|
||||
|
||||
class CYCLES_OBJECT_PT_visibility_culling(CyclesButtonsPanel, Panel):
|
||||
@@ -2322,7 +2305,6 @@ classes = (
|
||||
CYCLES_OBJECT_PT_motion_blur,
|
||||
CYCLES_OBJECT_PT_shading,
|
||||
CYCLES_OBJECT_PT_shading_shadow_terminator,
|
||||
CYCLES_OBJECT_PT_shading_gi_approximation,
|
||||
CYCLES_OBJECT_PT_visibility,
|
||||
CYCLES_OBJECT_PT_visibility_ray_visibility,
|
||||
CYCLES_OBJECT_PT_visibility_culling,
|
||||
|
@@ -526,13 +526,8 @@ bool BlenderSync::object_has_particle_hair(BL::Object b_ob)
|
||||
|
||||
/* Old particle hair. */
|
||||
void BlenderSync::sync_particle_hair(
|
||||
Hair *hair, BL::Mesh &b_mesh, BObjectInfo &b_ob_info, bool motion, int motion_step)
|
||||
Hair *hair, BL::Mesh &b_mesh, BL::Object &b_ob, bool motion, int motion_step)
|
||||
{
|
||||
if (!b_ob_info.is_real_object_data()) {
|
||||
return;
|
||||
}
|
||||
BL::Object b_ob = b_ob_info.real_object;
|
||||
|
||||
/* obtain general settings */
|
||||
if (b_ob.mode() == b_ob.mode_PARTICLE_EDIT || b_ob.mode() == b_ob.mode_EDIT) {
|
||||
return;
|
||||
@@ -793,10 +788,10 @@ static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_st
|
||||
}
|
||||
|
||||
/* Hair object. */
|
||||
void BlenderSync::sync_hair(Hair *hair, BObjectInfo &b_ob_info, bool motion, int motion_step)
|
||||
void BlenderSync::sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motion_step)
|
||||
{
|
||||
/* Convert Blender hair to Cycles curves. */
|
||||
BL::Hair b_hair(b_ob_info.object_data);
|
||||
BL::Hair b_hair(b_ob.data());
|
||||
if (motion) {
|
||||
export_hair_curves_motion(hair, b_hair, motion_step);
|
||||
}
|
||||
@@ -805,16 +800,16 @@ void BlenderSync::sync_hair(Hair *hair, BObjectInfo &b_ob_info, bool motion, int
|
||||
}
|
||||
}
|
||||
#else
|
||||
void BlenderSync::sync_hair(Hair *hair, BObjectInfo &b_ob_info, bool motion, int motion_step)
|
||||
void BlenderSync::sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motion_step)
|
||||
{
|
||||
(void)hair;
|
||||
(void)b_ob_info;
|
||||
(void)b_ob;
|
||||
(void)motion;
|
||||
(void)motion_step;
|
||||
}
|
||||
#endif
|
||||
|
||||
void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, Hair *hair)
|
||||
void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Hair *hair)
|
||||
{
|
||||
/* make a copy of the shaders as the caller in the main thread still need them for syncing the
|
||||
* attributes */
|
||||
@@ -824,19 +819,19 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, H
|
||||
new_hair.set_used_shaders(used_shaders);
|
||||
|
||||
if (view_layer.use_hair) {
|
||||
if (b_ob_info.object_data.is_a(&RNA_Hair)) {
|
||||
if (b_ob.type() == BL::Object::type_HAIR) {
|
||||
/* Hair object. */
|
||||
sync_hair(&new_hair, b_ob_info, false);
|
||||
sync_hair(&new_hair, b_ob, false);
|
||||
}
|
||||
else {
|
||||
/* Particle hair. */
|
||||
bool need_undeformed = new_hair.need_attribute(scene, ATTR_STD_GENERATED);
|
||||
BL::Mesh b_mesh = object_to_mesh(
|
||||
b_data, b_ob_info, b_depsgraph, need_undeformed, Mesh::SUBDIVISION_NONE);
|
||||
b_data, b_ob, b_depsgraph, need_undeformed, Mesh::SUBDIVISION_NONE);
|
||||
|
||||
if (b_mesh) {
|
||||
sync_particle_hair(&new_hair, b_mesh, b_ob_info, false);
|
||||
free_object_to_mesh(b_data, b_ob_info, b_mesh);
|
||||
sync_particle_hair(&new_hair, b_mesh, b_ob, false);
|
||||
free_object_to_mesh(b_data, b_ob, b_mesh);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -864,7 +859,7 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, H
|
||||
}
|
||||
|
||||
void BlenderSync::sync_hair_motion(BL::Depsgraph b_depsgraph,
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object b_ob,
|
||||
Hair *hair,
|
||||
int motion_step)
|
||||
{
|
||||
@@ -874,19 +869,18 @@ void BlenderSync::sync_hair_motion(BL::Depsgraph b_depsgraph,
|
||||
}
|
||||
|
||||
/* Export deformed coordinates. */
|
||||
if (ccl::BKE_object_is_deform_modified(b_ob_info, b_scene, preview)) {
|
||||
if (b_ob_info.object_data.is_a(&RNA_Hair)) {
|
||||
if (ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
|
||||
if (b_ob.type() == BL::Object::type_HAIR) {
|
||||
/* Hair object. */
|
||||
sync_hair(hair, b_ob_info, true, motion_step);
|
||||
sync_hair(hair, b_ob, true, motion_step);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
/* Particle hair. */
|
||||
BL::Mesh b_mesh = object_to_mesh(
|
||||
b_data, b_ob_info, b_depsgraph, false, Mesh::SUBDIVISION_NONE);
|
||||
BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_depsgraph, false, Mesh::SUBDIVISION_NONE);
|
||||
if (b_mesh) {
|
||||
sync_particle_hair(hair, b_mesh, b_ob_info, true, motion_step);
|
||||
free_object_to_mesh(b_data, b_ob_info, b_mesh);
|
||||
sync_particle_hair(hair, b_mesh, b_ob, true, motion_step);
|
||||
free_object_to_mesh(b_data, b_ob, b_mesh);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -29,15 +29,13 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
static Geometry::Type determine_geom_type(BObjectInfo &b_ob_info, bool use_particle_hair)
|
||||
static Geometry::Type determine_geom_type(BL::Object &b_ob, bool use_particle_hair)
|
||||
{
|
||||
if (b_ob_info.object_data.is_a(&RNA_Hair) || use_particle_hair) {
|
||||
if (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) {
|
||||
return Geometry::HAIR;
|
||||
}
|
||||
|
||||
if (b_ob_info.object_data.is_a(&RNA_Volume) ||
|
||||
(b_ob_info.object_data == b_ob_info.real_object.data() &&
|
||||
object_fluid_gas_domain_find(b_ob_info.real_object))) {
|
||||
if (b_ob.type() == BL::Object::type_VOLUME || object_fluid_gas_domain_find(b_ob)) {
|
||||
return Geometry::VOLUME;
|
||||
}
|
||||
|
||||
@@ -73,17 +71,20 @@ array<Node *> BlenderSync::find_used_shaders(BL::Object &b_ob)
|
||||
}
|
||||
|
||||
Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object &b_ob,
|
||||
BL::Object &b_ob_instance,
|
||||
bool object_updated,
|
||||
bool use_particle_hair,
|
||||
TaskPool *task_pool)
|
||||
{
|
||||
/* Test if we can instance or if the object is modified. */
|
||||
Geometry::Type geom_type = determine_geom_type(b_ob_info, use_particle_hair);
|
||||
GeometryKey key(b_ob_info.object_data, geom_type);
|
||||
BL::ID b_ob_data = b_ob.data();
|
||||
BL::ID b_key_id = (BKE_object_is_modified(b_ob)) ? b_ob_instance : b_ob_data;
|
||||
Geometry::Type geom_type = determine_geom_type(b_ob, use_particle_hair);
|
||||
GeometryKey key(b_key_id.ptr.data, geom_type);
|
||||
|
||||
/* Find shader indices. */
|
||||
array<Node *> used_shaders = find_used_shaders(b_ob_info.iter_object);
|
||||
array<Node *> used_shaders = find_used_shaders(b_ob);
|
||||
|
||||
/* Ensure we only sync instanced geometry once. */
|
||||
Geometry *geom = geometry_map.find(key);
|
||||
@@ -110,7 +111,7 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
|
||||
}
|
||||
else {
|
||||
/* Test if we need to update existing geometry. */
|
||||
sync = geometry_map.update(geom, b_ob_info.object_data);
|
||||
sync = geometry_map.update(geom, b_key_id);
|
||||
}
|
||||
|
||||
if (!sync) {
|
||||
@@ -143,7 +144,7 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
|
||||
|
||||
geometry_synced.insert(geom);
|
||||
|
||||
geom->name = ustring(b_ob_info.object_data.name().c_str());
|
||||
geom->name = ustring(b_ob_data.name().c_str());
|
||||
|
||||
/* Store the shaders immediately for the object attribute code. */
|
||||
geom->set_used_shaders(used_shaders);
|
||||
@@ -152,19 +153,19 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
|
||||
if (progress.get_cancel())
|
||||
return;
|
||||
|
||||
progress.set_sync_status("Synchronizing object", b_ob_info.real_object.name());
|
||||
progress.set_sync_status("Synchronizing object", b_ob.name());
|
||||
|
||||
if (geom_type == Geometry::HAIR) {
|
||||
Hair *hair = static_cast<Hair *>(geom);
|
||||
sync_hair(b_depsgraph, b_ob_info, hair);
|
||||
sync_hair(b_depsgraph, b_ob, hair);
|
||||
}
|
||||
else if (geom_type == Geometry::VOLUME) {
|
||||
Volume *volume = static_cast<Volume *>(geom);
|
||||
sync_volume(b_ob_info, volume);
|
||||
sync_volume(b_ob, volume);
|
||||
}
|
||||
else {
|
||||
Mesh *mesh = static_cast<Mesh *>(geom);
|
||||
sync_mesh(b_depsgraph, b_ob_info, mesh);
|
||||
sync_mesh(b_depsgraph, b_ob, mesh);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -180,7 +181,7 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
|
||||
}
|
||||
|
||||
void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object &b_ob,
|
||||
Object *object,
|
||||
float motion_time,
|
||||
bool use_particle_hair,
|
||||
@@ -209,17 +210,16 @@ void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
|
||||
if (progress.get_cancel())
|
||||
return;
|
||||
|
||||
if (b_ob_info.object_data.is_a(&RNA_Hair) || use_particle_hair) {
|
||||
if (b_ob.type() == BL::Object::type_HAIR || use_particle_hair) {
|
||||
Hair *hair = static_cast<Hair *>(geom);
|
||||
sync_hair_motion(b_depsgraph, b_ob_info, hair, motion_step);
|
||||
sync_hair_motion(b_depsgraph, b_ob, hair, motion_step);
|
||||
}
|
||||
else if (b_ob_info.object_data.is_a(&RNA_Volume) ||
|
||||
object_fluid_gas_domain_find(b_ob_info.real_object)) {
|
||||
else if (b_ob.type() == BL::Object::type_VOLUME || object_fluid_gas_domain_find(b_ob)) {
|
||||
/* No volume motion blur support yet. */
|
||||
}
|
||||
else {
|
||||
Mesh *mesh = static_cast<Mesh *>(geom);
|
||||
sync_mesh_motion(b_depsgraph, b_ob_info, mesh, motion_step);
|
||||
sync_mesh_motion(b_depsgraph, b_ob, mesh, motion_step);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -27,14 +27,15 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
void BlenderSync::sync_light(BL::Object &b_parent,
|
||||
int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object &b_ob,
|
||||
BL::Object &b_ob_instance,
|
||||
int random_id,
|
||||
Transform &tfm,
|
||||
bool *use_portal)
|
||||
{
|
||||
/* test if we need to sync */
|
||||
ObjectKey key(b_parent, persistent_id, b_ob_info.real_object, false);
|
||||
BL::Light b_light(b_ob_info.object_data);
|
||||
ObjectKey key(b_parent, persistent_id, b_ob_instance, false);
|
||||
BL::Light b_light(b_ob.data());
|
||||
|
||||
Light *light = light_map.find(key);
|
||||
|
||||
@@ -43,7 +44,7 @@ void BlenderSync::sync_light(BL::Object &b_parent,
|
||||
const bool tfm_updated = (light && light->get_tfm() != tfm);
|
||||
|
||||
/* Update if either object or light data changed. */
|
||||
if (!light_map.add_or_update(&light, b_ob_info.real_object, b_parent, key) && !tfm_updated) {
|
||||
if (!light_map.add_or_update(&light, b_ob, b_parent, key) && !tfm_updated) {
|
||||
Shader *shader;
|
||||
if (!shader_map.add_or_update(&shader, b_light)) {
|
||||
if (light->get_is_portal())
|
||||
@@ -138,11 +139,11 @@ void BlenderSync::sync_light(BL::Object &b_parent,
|
||||
|
||||
light->set_max_bounces(get_int(clight, "max_bounces"));
|
||||
|
||||
if (b_ob_info.real_object != b_ob_info.iter_object) {
|
||||
if (b_ob != b_ob_instance) {
|
||||
light->set_random_id(random_id);
|
||||
}
|
||||
else {
|
||||
light->set_random_id(hash_uint2(hash_string(b_ob_info.real_object.name().c_str()), 0));
|
||||
light->set_random_id(hash_uint2(hash_string(b_ob.name().c_str()), 0));
|
||||
}
|
||||
|
||||
if (light->get_light_type() == LIGHT_AREA)
|
||||
@@ -154,7 +155,7 @@ void BlenderSync::sync_light(BL::Object &b_parent,
|
||||
*use_portal = true;
|
||||
|
||||
/* visibility */
|
||||
uint visibility = object_ray_visibility(b_ob_info.real_object);
|
||||
uint visibility = object_ray_visibility(b_ob);
|
||||
light->set_use_diffuse((visibility & PATH_RAY_DIFFUSE) != 0);
|
||||
light->set_use_glossy((visibility & PATH_RAY_GLOSSY) != 0);
|
||||
light->set_use_transmission((visibility & PATH_RAY_TRANSMIT) != 0);
|
||||
|
@@ -999,14 +999,12 @@ static void create_mesh(Scene *scene,
|
||||
|
||||
static void create_subd_mesh(Scene *scene,
|
||||
Mesh *mesh,
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object &b_ob,
|
||||
BL::Mesh &b_mesh,
|
||||
const array<Node *> &used_shaders,
|
||||
float dicing_rate,
|
||||
int max_subdivisions)
|
||||
{
|
||||
BL::Object b_ob = b_ob_info.real_object;
|
||||
|
||||
BL::SubsurfModifier subsurf_mod(b_ob.modifiers[b_ob.modifiers.length() - 1]);
|
||||
bool subdivide_uvs = subsurf_mod.uv_smooth() != BL::SubsurfModifier::uv_smooth_NONE;
|
||||
|
||||
@@ -1040,12 +1038,29 @@ static void create_subd_mesh(Scene *scene,
|
||||
|
||||
/* Sync */
|
||||
|
||||
static BL::MeshSequenceCacheModifier object_mesh_cache_find(BL::Object &b_ob)
|
||||
{
|
||||
if (b_ob.modifiers.length() > 0) {
|
||||
BL::Modifier b_mod = b_ob.modifiers[b_ob.modifiers.length() - 1];
|
||||
|
||||
if (b_mod.type() == BL::Modifier::type_MESH_SEQUENCE_CACHE) {
|
||||
BL::MeshSequenceCacheModifier mesh_cache = BL::MeshSequenceCacheModifier(b_mod);
|
||||
|
||||
if (MeshSequenceCacheModifier_has_velocity_get(&mesh_cache.ptr)) {
|
||||
return mesh_cache;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BL::MeshSequenceCacheModifier(PointerRNA_NULL);
|
||||
}
|
||||
|
||||
/* Check whether some of "built-in" motion-related attributes are needed to be exported (includes
|
||||
* things like velocity from cache modifier, fluid simulation).
|
||||
*
|
||||
* NOTE: This code is run prior to object motion blur initialization. so can not access properties
|
||||
* set by `sync_object_motion_init()`. */
|
||||
static bool mesh_need_motion_attribute(BObjectInfo &b_ob_info, Scene *scene)
|
||||
static bool mesh_need_motion_attribute(BL::Object &b_ob, Scene *scene)
|
||||
{
|
||||
const Scene::MotionType need_motion = scene->need_motion();
|
||||
if (need_motion == Scene::MOTION_NONE) {
|
||||
@@ -1062,7 +1077,7 @@ static bool mesh_need_motion_attribute(BObjectInfo &b_ob_info, Scene *scene)
|
||||
* - Motion attribute expects non-zero time steps.
|
||||
*
|
||||
* Avoid adding motion attributes if the motion blur will enforce 0 motion steps. */
|
||||
PointerRNA cobject = RNA_pointer_get(&b_ob_info.real_object.ptr, "cycles");
|
||||
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
|
||||
const bool use_motion = get_boolean(cobject, "use_motion_blur");
|
||||
if (!use_motion) {
|
||||
return false;
|
||||
@@ -1074,14 +1089,13 @@ static bool mesh_need_motion_attribute(BObjectInfo &b_ob_info, Scene *scene)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void sync_mesh_cached_velocities(BObjectInfo &b_ob_info, Scene *scene, Mesh *mesh)
|
||||
static void sync_mesh_cached_velocities(BL::Object &b_ob, Scene *scene, Mesh *mesh)
|
||||
{
|
||||
if (!mesh_need_motion_attribute(b_ob_info, scene)) {
|
||||
if (!mesh_need_motion_attribute(b_ob, scene)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BL::Object b_ob = b_ob_info.real_object;
|
||||
BL::MeshSequenceCacheModifier b_mesh_cache = object_mesh_cache_find(b_ob, true, nullptr);
|
||||
BL::MeshSequenceCacheModifier b_mesh_cache = object_mesh_cache_find(b_ob);
|
||||
|
||||
if (!b_mesh_cache) {
|
||||
return;
|
||||
@@ -1121,16 +1135,12 @@ static void sync_mesh_cached_velocities(BObjectInfo &b_ob_info, Scene *scene, Me
|
||||
}
|
||||
}
|
||||
|
||||
static void sync_mesh_fluid_motion(BObjectInfo &b_ob_info, Scene *scene, Mesh *mesh)
|
||||
static void sync_mesh_fluid_motion(BL::Object &b_ob, Scene *scene, Mesh *mesh)
|
||||
{
|
||||
if (!b_ob_info.is_real_object_data()) {
|
||||
return;
|
||||
}
|
||||
if (!mesh_need_motion_attribute(b_ob_info, scene)) {
|
||||
if (!mesh_need_motion_attribute(b_ob, scene)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BL::Object b_ob = b_ob_info.real_object;
|
||||
BL::FluidDomainSettings b_fluid_domain = object_fluid_liquid_domain_find(b_ob);
|
||||
|
||||
if (!b_fluid_domain)
|
||||
@@ -1164,7 +1174,7 @@ static void sync_mesh_fluid_motion(BObjectInfo &b_ob_info, Scene *scene, Mesh *m
|
||||
}
|
||||
}
|
||||
|
||||
void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, Mesh *mesh)
|
||||
void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh)
|
||||
{
|
||||
/* make a copy of the shaders as the caller in the main thread still need them for syncing the
|
||||
* attributes */
|
||||
@@ -1177,21 +1187,20 @@ void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, M
|
||||
/* Adaptive subdivision setup. Not for baking since that requires
|
||||
* exact mapping to the Blender mesh. */
|
||||
if (!scene->bake_manager->get_baking()) {
|
||||
new_mesh.set_subdivision_type(
|
||||
object_subdivision_type(b_ob_info.real_object, preview, experimental));
|
||||
new_mesh.set_subdivision_type(object_subdivision_type(b_ob, preview, experimental));
|
||||
}
|
||||
|
||||
/* For some reason, meshes do not need this... */
|
||||
bool need_undeformed = new_mesh.need_attribute(scene, ATTR_STD_GENERATED);
|
||||
BL::Mesh b_mesh = object_to_mesh(
|
||||
b_data, b_ob_info, b_depsgraph, need_undeformed, new_mesh.get_subdivision_type());
|
||||
b_data, b_ob, b_depsgraph, need_undeformed, new_mesh.get_subdivision_type());
|
||||
|
||||
if (b_mesh) {
|
||||
/* Sync mesh itself. */
|
||||
if (new_mesh.get_subdivision_type() != Mesh::SUBDIVISION_NONE)
|
||||
create_subd_mesh(scene,
|
||||
&new_mesh,
|
||||
b_ob_info,
|
||||
b_ob,
|
||||
b_mesh,
|
||||
new_mesh.get_used_shaders(),
|
||||
dicing_rate,
|
||||
@@ -1199,15 +1208,15 @@ void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, M
|
||||
else
|
||||
create_mesh(scene, &new_mesh, b_mesh, new_mesh.get_used_shaders(), false);
|
||||
|
||||
free_object_to_mesh(b_data, b_ob_info, b_mesh);
|
||||
free_object_to_mesh(b_data, b_ob, b_mesh);
|
||||
}
|
||||
}
|
||||
|
||||
/* cached velocities (e.g. from alembic archive) */
|
||||
sync_mesh_cached_velocities(b_ob_info, scene, &new_mesh);
|
||||
sync_mesh_cached_velocities(b_ob, scene, &new_mesh);
|
||||
|
||||
/* mesh fluid motion mantaflow */
|
||||
sync_mesh_fluid_motion(b_ob_info, scene, &new_mesh);
|
||||
sync_mesh_fluid_motion(b_ob, scene, &new_mesh);
|
||||
|
||||
/* update original sockets */
|
||||
|
||||
@@ -1238,19 +1247,18 @@ void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, M
|
||||
}
|
||||
|
||||
void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object b_ob,
|
||||
Mesh *mesh,
|
||||
int motion_step)
|
||||
{
|
||||
/* Fluid motion blur already exported. */
|
||||
BL::FluidDomainSettings b_fluid_domain = object_fluid_liquid_domain_find(b_ob_info.real_object);
|
||||
BL::FluidDomainSettings b_fluid_domain = object_fluid_liquid_domain_find(b_ob);
|
||||
if (b_fluid_domain) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Cached motion blur already exported. */
|
||||
BL::MeshSequenceCacheModifier mesh_cache = object_mesh_cache_find(
|
||||
b_ob_info.real_object, true, nullptr);
|
||||
BL::MeshSequenceCacheModifier mesh_cache = object_mesh_cache_find(b_ob);
|
||||
if (mesh_cache) {
|
||||
return;
|
||||
}
|
||||
@@ -1264,13 +1272,11 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
|
||||
/* Skip objects without deforming modifiers. this is not totally reliable,
|
||||
* would need a more extensive check to see which objects are animated. */
|
||||
BL::Mesh b_mesh(PointerRNA_NULL);
|
||||
if (ccl::BKE_object_is_deform_modified(b_ob_info, b_scene, preview)) {
|
||||
if (ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) {
|
||||
/* get derived mesh */
|
||||
b_mesh = object_to_mesh(b_data, b_ob_info, b_depsgraph, false, Mesh::SUBDIVISION_NONE);
|
||||
b_mesh = object_to_mesh(b_data, b_ob, b_depsgraph, false, Mesh::SUBDIVISION_NONE);
|
||||
}
|
||||
|
||||
const std::string ob_name = b_ob_info.real_object.name();
|
||||
|
||||
/* TODO(sergey): Perform preliminary check for number of vertices. */
|
||||
if (b_mesh) {
|
||||
/* Export deformed coordinates. */
|
||||
@@ -1306,17 +1312,17 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
|
||||
memcmp(mP, &mesh->get_verts()[0], sizeof(float3) * numverts) == 0) {
|
||||
/* no motion, remove attributes again */
|
||||
if (b_mesh.vertices.length() != numverts) {
|
||||
VLOG(1) << "Topology differs, disabling motion blur for object " << ob_name;
|
||||
VLOG(1) << "Topology differs, disabling motion blur for object " << b_ob.name();
|
||||
}
|
||||
else {
|
||||
VLOG(1) << "No actual deformation motion for object " << ob_name;
|
||||
VLOG(1) << "No actual deformation motion for object " << b_ob.name();
|
||||
}
|
||||
mesh->attributes.remove(ATTR_STD_MOTION_VERTEX_POSITION);
|
||||
if (attr_mN)
|
||||
mesh->attributes.remove(ATTR_STD_MOTION_VERTEX_NORMAL);
|
||||
}
|
||||
else if (motion_step > 0) {
|
||||
VLOG(1) << "Filling deformation motion for object " << ob_name;
|
||||
VLOG(1) << "Filling deformation motion for object " << b_ob.name();
|
||||
/* motion, fill up previous steps that we might have skipped because
|
||||
* they had no motion, but we need them anyway now */
|
||||
float3 *P = &mesh->get_verts()[0];
|
||||
@@ -1330,8 +1336,8 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
|
||||
}
|
||||
else {
|
||||
if (b_mesh.vertices.length() != numverts) {
|
||||
VLOG(1) << "Topology differs, discarding motion blur for object " << ob_name << " at time "
|
||||
<< motion_step;
|
||||
VLOG(1) << "Topology differs, discarding motion blur for object " << b_ob.name()
|
||||
<< " at time " << motion_step;
|
||||
memcpy(mP, &mesh->get_verts()[0], sizeof(float3) * numverts);
|
||||
if (mN != NULL) {
|
||||
memcpy(mN, attr_N->data_float3(), sizeof(float3) * numverts);
|
||||
@@ -1339,7 +1345,7 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
|
||||
}
|
||||
}
|
||||
|
||||
free_object_to_mesh(b_data, b_ob_info, b_mesh);
|
||||
free_object_to_mesh(b_data, b_ob, b_mesh);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "render/alembic.h"
|
||||
#include "render/camera.h"
|
||||
#include "render/graph.h"
|
||||
#include "render/integrator.h"
|
||||
@@ -154,7 +153,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
||||
const bool is_instance = b_instance.is_instance();
|
||||
BL::Object b_ob = b_instance.object();
|
||||
BL::Object b_parent = is_instance ? b_instance.parent() : b_instance.object();
|
||||
BObjectInfo b_ob_info{b_ob, is_instance ? b_instance.instance_object() : b_ob, b_ob.data()};
|
||||
BL::Object b_ob_instance = is_instance ? b_instance.instance_object() : b_ob;
|
||||
const bool motion = motion_time != 0.0f;
|
||||
/*const*/ Transform tfm = get_transform(b_ob.matrix_world());
|
||||
int *persistent_id = NULL;
|
||||
@@ -178,7 +177,8 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
||||
{
|
||||
sync_light(b_parent,
|
||||
persistent_id,
|
||||
b_ob_info,
|
||||
b_ob,
|
||||
b_ob_instance,
|
||||
is_instance ? b_instance.random_id() : 0,
|
||||
tfm,
|
||||
use_portal);
|
||||
@@ -199,7 +199,8 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
||||
|
||||
/* Visibility flags for both parent and child. */
|
||||
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
|
||||
bool use_holdout = b_parent.holdout_get(PointerRNA_NULL, b_view_layer);
|
||||
bool use_holdout = get_boolean(cobject, "is_holdout") ||
|
||||
b_parent.holdout_get(PointerRNA_NULL, b_view_layer);
|
||||
uint visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL_VISIBILITY;
|
||||
|
||||
if (b_parent.ptr.data != b_ob.ptr.data) {
|
||||
@@ -230,7 +231,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
||||
TaskPool *object_geom_task_pool = (is_instance) ? NULL : geom_task_pool;
|
||||
|
||||
/* key to lookup object */
|
||||
ObjectKey key(b_parent, persistent_id, b_ob_info.real_object, use_particle_hair);
|
||||
ObjectKey key(b_parent, persistent_id, b_ob_instance, use_particle_hair);
|
||||
Object *object;
|
||||
|
||||
/* motion vector case */
|
||||
@@ -248,8 +249,12 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
||||
|
||||
/* mesh deformation */
|
||||
if (object->get_geometry())
|
||||
sync_geometry_motion(
|
||||
b_depsgraph, b_ob_info, object, motion_time, use_particle_hair, object_geom_task_pool);
|
||||
sync_geometry_motion(b_depsgraph,
|
||||
b_ob_instance,
|
||||
object,
|
||||
motion_time,
|
||||
use_particle_hair,
|
||||
object_geom_task_pool);
|
||||
}
|
||||
|
||||
return object;
|
||||
@@ -260,8 +265,15 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
||||
(tfm != object->get_tfm());
|
||||
|
||||
/* mesh sync */
|
||||
Geometry *geometry = sync_geometry(
|
||||
b_depsgraph, b_ob_info, object_updated, use_particle_hair, object_geom_task_pool);
|
||||
/* b_ob is owned by the iterator and will go out of scope at the end of the block.
|
||||
* b_ob_instance is the original object and will remain valid for deferred geometry
|
||||
* sync. */
|
||||
Geometry *geometry = sync_geometry(b_depsgraph,
|
||||
b_ob_instance,
|
||||
b_ob_instance,
|
||||
object_updated,
|
||||
use_particle_hair,
|
||||
object_geom_task_pool);
|
||||
object->set_geometry(geometry);
|
||||
|
||||
/* special case not tracked by object update flags */
|
||||
@@ -275,7 +287,8 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
||||
|
||||
object->set_visibility(visibility);
|
||||
|
||||
object->set_is_shadow_catcher(b_ob.is_shadow_catcher());
|
||||
bool is_shadow_catcher = get_boolean(cobject, "is_shadow_catcher");
|
||||
object->set_is_shadow_catcher(is_shadow_catcher);
|
||||
|
||||
float shadow_terminator_shading_offset = get_float(cobject, "shadow_terminator_offset");
|
||||
object->set_shadow_terminator_shading_offset(shadow_terminator_shading_offset);
|
||||
@@ -284,13 +297,6 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
||||
"shadow_terminator_geometry_offset");
|
||||
object->set_shadow_terminator_geometry_offset(shadow_terminator_geometry_offset);
|
||||
|
||||
float ao_distance = get_float(cobject, "ao_distance");
|
||||
if (ao_distance == 0.0f && b_parent.ptr.data != b_ob.ptr.data) {
|
||||
PointerRNA cparent = RNA_pointer_get(&b_parent.ptr, "cycles");
|
||||
ao_distance = get_float(cparent, "ao_distance");
|
||||
}
|
||||
object->set_ao_distance(ao_distance);
|
||||
|
||||
/* sync the asset name for Cryptomatte */
|
||||
BL::Object parent = b_ob.parent();
|
||||
ustring parent_name;
|
||||
@@ -364,7 +370,7 @@ static bool lookup_property(BL::ID b_id, const string &name, float4 *r_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));
|
||||
value = RNA_property_int_get(&ptr, prop);
|
||||
else
|
||||
return false;
|
||||
|
||||
@@ -473,72 +479,6 @@ bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance
|
||||
|
||||
/* Object Loop */
|
||||
|
||||
void BlenderSync::sync_procedural(BL::Object &b_ob,
|
||||
BL::MeshSequenceCacheModifier &b_mesh_cache,
|
||||
bool has_subdivision_modifier)
|
||||
{
|
||||
#ifdef WITH_ALEMBIC
|
||||
BL::CacheFile cache_file = b_mesh_cache.cache_file();
|
||||
void *cache_file_key = cache_file.ptr.data;
|
||||
|
||||
AlembicProcedural *procedural = static_cast<AlembicProcedural *>(
|
||||
procedural_map.find(cache_file_key));
|
||||
|
||||
if (procedural == nullptr) {
|
||||
procedural = scene->create_node<AlembicProcedural>();
|
||||
procedural_map.add(cache_file_key, procedural);
|
||||
}
|
||||
else {
|
||||
procedural_map.used(procedural);
|
||||
}
|
||||
|
||||
float current_frame = static_cast<float>(b_scene.frame_current());
|
||||
if (cache_file.override_frame()) {
|
||||
current_frame = cache_file.frame();
|
||||
}
|
||||
|
||||
if (!cache_file.override_frame()) {
|
||||
procedural->set_start_frame(static_cast<float>(b_scene.frame_start()));
|
||||
procedural->set_end_frame(static_cast<float>(b_scene.frame_end()));
|
||||
}
|
||||
|
||||
procedural->set_frame(current_frame);
|
||||
procedural->set_frame_rate(b_scene.render().fps() / b_scene.render().fps_base());
|
||||
procedural->set_frame_offset(cache_file.frame_offset());
|
||||
|
||||
string absolute_path = blender_absolute_path(b_data, b_ob, b_mesh_cache.cache_file().filepath());
|
||||
procedural->set_filepath(ustring(absolute_path));
|
||||
|
||||
procedural->set_scale(cache_file.scale());
|
||||
|
||||
procedural->set_use_prefetch(cache_file.use_prefetch());
|
||||
procedural->set_prefetch_cache_size(cache_file.prefetch_cache_size());
|
||||
|
||||
/* create or update existing AlembicObjects */
|
||||
ustring object_path = ustring(b_mesh_cache.object_path());
|
||||
|
||||
AlembicObject *abc_object = procedural->get_or_create_object(object_path);
|
||||
|
||||
array<Node *> used_shaders = find_used_shaders(b_ob);
|
||||
abc_object->set_used_shaders(used_shaders);
|
||||
|
||||
PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles");
|
||||
const float subd_dicing_rate = max(0.1f, RNA_float_get(&cobj, "dicing_rate") * dicing_rate);
|
||||
abc_object->set_subd_dicing_rate(subd_dicing_rate);
|
||||
abc_object->set_subd_max_level(max_subdivisions);
|
||||
|
||||
abc_object->set_ignore_subdivision(!has_subdivision_modifier);
|
||||
|
||||
if (abc_object->is_modified() || procedural->is_modified()) {
|
||||
procedural->tag_update(scene);
|
||||
}
|
||||
#else
|
||||
(void)b_ob;
|
||||
(void)b_mesh_cache;
|
||||
(void)has_subdivision_modifier;
|
||||
#endif
|
||||
}
|
||||
|
||||
void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
|
||||
BL::SpaceView3D &b_v3d,
|
||||
float motion_time)
|
||||
@@ -554,7 +494,6 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
|
||||
light_map.pre_sync();
|
||||
geometry_map.pre_sync();
|
||||
object_map.pre_sync();
|
||||
procedural_map.pre_sync();
|
||||
particle_system_map.pre_sync();
|
||||
motion_times.clear();
|
||||
}
|
||||
@@ -595,39 +534,15 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
|
||||
|
||||
/* Object itself. */
|
||||
if (b_instance.show_self()) {
|
||||
#ifdef WITH_ALEMBIC
|
||||
bool use_procedural = false;
|
||||
bool has_subdivision_modifier = false;
|
||||
BL::MeshSequenceCacheModifier b_mesh_cache(PointerRNA_NULL);
|
||||
|
||||
/* Experimental as Blender does not have good support for procedurals at the moment, also
|
||||
* only available in preview renders since currently do not have a good cache policy, the
|
||||
* data being loaded at once for all the frames. */
|
||||
if (experimental && b_v3d) {
|
||||
b_mesh_cache = object_mesh_cache_find(b_ob, false, &has_subdivision_modifier);
|
||||
use_procedural = b_mesh_cache && b_mesh_cache.cache_file().use_render_procedural();
|
||||
}
|
||||
|
||||
if (use_procedural) {
|
||||
/* Skip in the motion case, as generating motion blur data will be handled in the
|
||||
* procedural. */
|
||||
if (!motion) {
|
||||
sync_procedural(b_ob, b_mesh_cache, has_subdivision_modifier);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
sync_object(b_depsgraph,
|
||||
b_view_layer,
|
||||
b_instance,
|
||||
motion_time,
|
||||
false,
|
||||
show_lights,
|
||||
culling,
|
||||
&use_portal,
|
||||
sync_hair ? NULL : &geom_task_pool);
|
||||
}
|
||||
sync_object(b_depsgraph,
|
||||
b_view_layer,
|
||||
b_instance,
|
||||
motion_time,
|
||||
false,
|
||||
show_lights,
|
||||
culling,
|
||||
&use_portal,
|
||||
sync_hair ? NULL : &geom_task_pool);
|
||||
}
|
||||
|
||||
/* Particle hair as separate object. */
|
||||
@@ -660,7 +575,6 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
|
||||
object_map.post_sync();
|
||||
geometry_map.post_sync();
|
||||
particle_system_map.post_sync();
|
||||
procedural_map.post_sync();
|
||||
}
|
||||
|
||||
if (motion)
|
||||
|
@@ -71,7 +71,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object &b_ob,
|
||||
Particle pa;
|
||||
|
||||
pa.index = persistent_id[0];
|
||||
pa.age = b_scene.frame_current_final() - b_pa.birth_time();
|
||||
pa.age = b_scene.frame_current() - b_pa.birth_time();
|
||||
pa.lifetime = b_pa.lifetime();
|
||||
pa.location = get_float3(b_pa.location());
|
||||
pa.rotation = get_float4(b_pa.rotation());
|
||||
|
@@ -487,24 +487,6 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
|
||||
if (param->varlenarray || param->isstruct || param->type.arraylen > 1)
|
||||
continue;
|
||||
|
||||
/* Read metadata. */
|
||||
bool is_bool_param = false;
|
||||
ustring param_label = param->name;
|
||||
|
||||
for (const OSL::OSLQuery::Parameter &metadata : param->metadata) {
|
||||
if (metadata.type == TypeDesc::STRING) {
|
||||
if (metadata.name == "widget") {
|
||||
/* Boolean socket. */
|
||||
if (metadata.sdefault[0] == "boolean" || metadata.sdefault[0] == "checkBox") {
|
||||
is_bool_param = true;
|
||||
}
|
||||
}
|
||||
else if (metadata.name == "label") {
|
||||
/* Socket label. */
|
||||
param_label = metadata.sdefault[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
/* determine socket type */
|
||||
string socket_type;
|
||||
BL::NodeSocket::type_enum data_type = BL::NodeSocket::type_VALUE;
|
||||
@@ -512,7 +494,6 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
|
||||
float default_float = 0.0f;
|
||||
int default_int = 0;
|
||||
string default_string = "";
|
||||
bool default_boolean = false;
|
||||
|
||||
if (param->isclosure) {
|
||||
socket_type = "NodeSocketShader";
|
||||
@@ -542,19 +523,10 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
|
||||
}
|
||||
else if (param->type.aggregate == TypeDesc::SCALAR) {
|
||||
if (param->type.basetype == TypeDesc::INT) {
|
||||
if (is_bool_param) {
|
||||
socket_type = "NodeSocketBool";
|
||||
data_type = BL::NodeSocket::type_BOOLEAN;
|
||||
if (param->validdefault) {
|
||||
default_boolean = (bool)param->idefault[0];
|
||||
}
|
||||
}
|
||||
else {
|
||||
socket_type = "NodeSocketInt";
|
||||
data_type = BL::NodeSocket::type_INT;
|
||||
if (param->validdefault)
|
||||
default_int = param->idefault[0];
|
||||
}
|
||||
socket_type = "NodeSocketInt";
|
||||
data_type = BL::NodeSocket::type_INT;
|
||||
if (param->validdefault)
|
||||
default_int = param->idefault[0];
|
||||
}
|
||||
else if (param->type.basetype == TypeDesc::FLOAT) {
|
||||
socket_type = "NodeSocketFloat";
|
||||
@@ -574,57 +546,33 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
|
||||
else
|
||||
continue;
|
||||
|
||||
/* Update existing socket. */
|
||||
bool found_existing = false;
|
||||
/* find socket socket */
|
||||
BL::NodeSocket b_sock(PointerRNA_NULL);
|
||||
if (param->isoutput) {
|
||||
for (BL::NodeSocket &b_sock : b_node.outputs) {
|
||||
if (b_sock.identifier() == param->name) {
|
||||
if (b_sock.bl_idname() != socket_type) {
|
||||
/* Remove if type no longer matches. */
|
||||
b_node.outputs.remove(b_data, b_sock);
|
||||
}
|
||||
else {
|
||||
/* Reuse and update label. */
|
||||
if (b_sock.name() != param_label) {
|
||||
b_sock.name(param_label.string());
|
||||
}
|
||||
used_sockets.insert(b_sock.ptr.data);
|
||||
found_existing = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
b_sock = b_node.outputs[param->name.string()];
|
||||
/* remove if type no longer matches */
|
||||
if (b_sock && b_sock.bl_idname() != socket_type) {
|
||||
b_node.outputs.remove(b_data, b_sock);
|
||||
b_sock = BL::NodeSocket(PointerRNA_NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (BL::NodeSocket &b_sock : b_node.inputs) {
|
||||
if (b_sock.identifier() == param->name) {
|
||||
if (b_sock.bl_idname() != socket_type) {
|
||||
/* Remove if type no longer matches. */
|
||||
b_node.inputs.remove(b_data, b_sock);
|
||||
}
|
||||
else {
|
||||
/* Reuse and update label. */
|
||||
if (b_sock.name() != param_label) {
|
||||
b_sock.name(param_label.string());
|
||||
}
|
||||
used_sockets.insert(b_sock.ptr.data);
|
||||
found_existing = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
b_sock = b_node.inputs[param->name.string()];
|
||||
/* remove if type no longer matches */
|
||||
if (b_sock && b_sock.bl_idname() != socket_type) {
|
||||
b_node.inputs.remove(b_data, b_sock);
|
||||
b_sock = BL::NodeSocket(PointerRNA_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (!found_existing) {
|
||||
/* Create new socket. */
|
||||
BL::NodeSocket b_sock = (param->isoutput) ? b_node.outputs.create(b_data,
|
||||
socket_type.c_str(),
|
||||
param_label.c_str(),
|
||||
param->name.c_str()) :
|
||||
b_node.inputs.create(b_data,
|
||||
socket_type.c_str(),
|
||||
param_label.c_str(),
|
||||
param->name.c_str());
|
||||
if (!b_sock) {
|
||||
/* create new socket */
|
||||
if (param->isoutput)
|
||||
b_sock = b_node.outputs.create(
|
||||
b_data, socket_type.c_str(), param->name.c_str(), param->name.c_str());
|
||||
else
|
||||
b_sock = b_node.inputs.create(
|
||||
b_data, socket_type.c_str(), param->name.c_str(), param->name.c_str());
|
||||
|
||||
/* set default value */
|
||||
if (data_type == BL::NodeSocket::type_VALUE) {
|
||||
@@ -642,12 +590,9 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args)
|
||||
else if (data_type == BL::NodeSocket::type_STRING) {
|
||||
set_string(b_sock.ptr, "default_value", default_string);
|
||||
}
|
||||
else if (data_type == BL::NodeSocket::type_BOOLEAN) {
|
||||
set_boolean(b_sock.ptr, "default_value", default_boolean);
|
||||
}
|
||||
|
||||
used_sockets.insert(b_sock.ptr.data);
|
||||
}
|
||||
|
||||
used_sockets.insert(b_sock.ptr.data);
|
||||
}
|
||||
|
||||
/* remove unused parameters */
|
||||
|
@@ -149,7 +149,7 @@ BlenderAttributeType blender_attribute_name_split_type(ustring name, string *r_r
|
||||
static BL::NodeSocket get_node_output(BL::Node &b_node, const string &name)
|
||||
{
|
||||
for (BL::NodeSocket &b_out : b_node.outputs) {
|
||||
if (b_out.identifier() == name) {
|
||||
if (b_out.name() == name) {
|
||||
return b_out;
|
||||
}
|
||||
}
|
||||
@@ -215,12 +215,7 @@ static void set_default_value(ShaderInput *input,
|
||||
break;
|
||||
}
|
||||
case SocketType::INT: {
|
||||
if (b_sock.type() == BL::NodeSocket::type_BOOLEAN) {
|
||||
node->set(socket, get_boolean(b_sock.ptr, "default_value"));
|
||||
}
|
||||
else {
|
||||
node->set(socket, get_int(b_sock.ptr, "default_value"));
|
||||
}
|
||||
node->set(socket, get_int(b_sock.ptr, "default_value"));
|
||||
break;
|
||||
}
|
||||
case SocketType::COLOR: {
|
||||
@@ -1007,59 +1002,71 @@ static bool node_use_modified_socket_name(ShaderNode *node)
|
||||
return true;
|
||||
}
|
||||
|
||||
static ShaderInput *node_find_input_by_name(ShaderNode *node, BL::NodeSocket &b_socket)
|
||||
static ShaderInput *node_find_input_by_name(ShaderNode *node,
|
||||
BL::Node &b_node,
|
||||
BL::NodeSocket &b_socket)
|
||||
{
|
||||
string name = b_socket.identifier();
|
||||
ShaderInput *input = node->input(name.c_str());
|
||||
string name = b_socket.name();
|
||||
|
||||
if (!input && node_use_modified_socket_name(node)) {
|
||||
/* Different internal name for shader. */
|
||||
if (string_startswith(name, "Shader")) {
|
||||
string_replace(name, "Shader", "Closure");
|
||||
if (node_use_modified_socket_name(node)) {
|
||||
bool found = false;
|
||||
int counter = 0, total = 0;
|
||||
|
||||
for (BL::NodeSocket &b_input : b_node.inputs) {
|
||||
if (b_input.name() == name) {
|
||||
if (!found) {
|
||||
counter++;
|
||||
}
|
||||
total++;
|
||||
}
|
||||
|
||||
if (b_input.ptr.data == b_socket.ptr.data)
|
||||
found = true;
|
||||
}
|
||||
input = node->input(name.c_str());
|
||||
|
||||
if (!input) {
|
||||
/* Different internal numbering of two sockets with same name.
|
||||
* Note that the Blender convention for unique socket names changed
|
||||
* from . to _ at some point, so we check both to handle old files. */
|
||||
if (string_endswith(name, "_001")) {
|
||||
string_replace(name, "_001", "2");
|
||||
}
|
||||
else if (string_endswith(name, ".001")) {
|
||||
string_replace(name, ".001", "2");
|
||||
}
|
||||
else if (string_endswith(name, "_002")) {
|
||||
string_replace(name, "_002", "3");
|
||||
}
|
||||
else if (string_endswith(name, ".002")) {
|
||||
string_replace(name, ".002", "3");
|
||||
}
|
||||
else {
|
||||
name += "1";
|
||||
}
|
||||
/* rename if needed */
|
||||
if (name == "Shader")
|
||||
name = "Closure";
|
||||
|
||||
input = node->input(name.c_str());
|
||||
}
|
||||
if (total > 1)
|
||||
name = string_printf("%s%d", name.c_str(), counter);
|
||||
}
|
||||
|
||||
return input;
|
||||
return node->input(name.c_str());
|
||||
}
|
||||
|
||||
static ShaderOutput *node_find_output_by_name(ShaderNode *node, BL::NodeSocket &b_socket)
|
||||
static ShaderOutput *node_find_output_by_name(ShaderNode *node,
|
||||
BL::Node &b_node,
|
||||
BL::NodeSocket &b_socket)
|
||||
{
|
||||
string name = b_socket.identifier();
|
||||
ShaderOutput *output = node->output(name.c_str());
|
||||
string name = b_socket.name();
|
||||
|
||||
if (!output && node_use_modified_socket_name(node)) {
|
||||
/* Different internal name for shader. */
|
||||
if (name == "Shader") {
|
||||
name = "Closure";
|
||||
output = node->output(name.c_str());
|
||||
if (node_use_modified_socket_name(node)) {
|
||||
bool found = false;
|
||||
int counter = 0, total = 0;
|
||||
|
||||
for (BL::NodeSocket &b_output : b_node.outputs) {
|
||||
if (b_output.name() == name) {
|
||||
if (!found) {
|
||||
counter++;
|
||||
}
|
||||
total++;
|
||||
}
|
||||
|
||||
if (b_output.ptr.data == b_socket.ptr.data) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* rename if needed */
|
||||
if (name == "Shader")
|
||||
name = "Closure";
|
||||
|
||||
if (total > 1)
|
||||
name = string_printf("%s%d", name.c_str(), counter);
|
||||
}
|
||||
|
||||
return output;
|
||||
return node->output(name.c_str());
|
||||
}
|
||||
|
||||
static void add_nodes(Scene *scene,
|
||||
@@ -1202,7 +1209,7 @@ static void add_nodes(Scene *scene,
|
||||
if (node) {
|
||||
/* map node sockets for linking */
|
||||
for (BL::NodeSocket &b_input : b_node.inputs) {
|
||||
ShaderInput *input = node_find_input_by_name(node, b_input);
|
||||
ShaderInput *input = node_find_input_by_name(node, b_node, b_input);
|
||||
if (!input) {
|
||||
/* XXX should not happen, report error? */
|
||||
continue;
|
||||
@@ -1212,7 +1219,7 @@ static void add_nodes(Scene *scene,
|
||||
set_default_value(input, b_input, b_data, b_ntree);
|
||||
}
|
||||
for (BL::NodeSocket &b_output : b_node.outputs) {
|
||||
ShaderOutput *output = node_find_output_by_name(node, b_output);
|
||||
ShaderOutput *output = node_find_output_by_name(node, b_node, b_output);
|
||||
if (!output) {
|
||||
/* XXX should not happen, report error? */
|
||||
continue;
|
||||
|
@@ -59,7 +59,6 @@ BlenderSync::BlenderSync(BL::RenderEngine &b_engine,
|
||||
b_scene(b_scene),
|
||||
shader_map(scene),
|
||||
object_map(scene),
|
||||
procedural_map(scene),
|
||||
geometry_map(scene),
|
||||
light_map(scene),
|
||||
particle_system_map(scene),
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include "RNA_types.h"
|
||||
|
||||
#include "blender/blender_id_map.h"
|
||||
#include "blender/blender_util.h"
|
||||
#include "blender/blender_viewport.h"
|
||||
|
||||
#include "render/scene.h"
|
||||
@@ -152,31 +151,21 @@ class BlenderSync {
|
||||
TaskPool *geom_task_pool);
|
||||
void sync_object_motion_init(BL::Object &b_parent, BL::Object &b_ob, Object *object);
|
||||
|
||||
void sync_procedural(BL::Object &b_ob,
|
||||
BL::MeshSequenceCacheModifier &b_mesh_cache,
|
||||
bool has_subdivision);
|
||||
|
||||
bool sync_object_attributes(BL::DepsgraphObjectInstance &b_instance, Object *object);
|
||||
|
||||
/* Volume */
|
||||
void sync_volume(BObjectInfo &b_ob_info, Volume *volume);
|
||||
void sync_volume(BL::Object &b_ob, Volume *volume);
|
||||
|
||||
/* Mesh */
|
||||
void sync_mesh(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, Mesh *mesh);
|
||||
void sync_mesh_motion(BL::Depsgraph b_depsgraph,
|
||||
BObjectInfo &b_ob_info,
|
||||
Mesh *mesh,
|
||||
int motion_step);
|
||||
void sync_mesh(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh);
|
||||
void sync_mesh_motion(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh, int motion_step);
|
||||
|
||||
/* Hair */
|
||||
void sync_hair(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, Hair *hair);
|
||||
void sync_hair_motion(BL::Depsgraph b_depsgraph,
|
||||
BObjectInfo &b_ob_info,
|
||||
Hair *hair,
|
||||
int motion_step);
|
||||
void sync_hair(Hair *hair, BObjectInfo &b_ob_info, bool motion, int motion_step = 0);
|
||||
void sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Hair *hair);
|
||||
void sync_hair_motion(BL::Depsgraph b_depsgraph, BL::Object b_ob, Hair *hair, int motion_step);
|
||||
void sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motion_step = 0);
|
||||
void sync_particle_hair(
|
||||
Hair *hair, BL::Mesh &b_mesh, BObjectInfo &b_ob_info, bool motion, int motion_step = 0);
|
||||
Hair *hair, BL::Mesh &b_mesh, BL::Object &b_ob, bool motion, int motion_step = 0);
|
||||
bool object_has_particle_hair(BL::Object b_ob);
|
||||
|
||||
/* Camera */
|
||||
@@ -185,13 +174,14 @@ class BlenderSync {
|
||||
|
||||
/* Geometry */
|
||||
Geometry *sync_geometry(BL::Depsgraph &b_depsgrpah,
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object &b_ob,
|
||||
BL::Object &b_ob_instance,
|
||||
bool object_updated,
|
||||
bool use_particle_hair,
|
||||
TaskPool *task_pool);
|
||||
|
||||
void sync_geometry_motion(BL::Depsgraph &b_depsgraph,
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object &b_ob,
|
||||
Object *object,
|
||||
float motion_time,
|
||||
bool use_particle_hair,
|
||||
@@ -200,7 +190,8 @@ class BlenderSync {
|
||||
/* Light */
|
||||
void sync_light(BL::Object &b_parent,
|
||||
int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object &b_ob,
|
||||
BL::Object &b_ob_instance,
|
||||
int random_id,
|
||||
Transform &tfm,
|
||||
bool *use_portal);
|
||||
@@ -230,7 +221,6 @@ class BlenderSync {
|
||||
|
||||
id_map<void *, Shader> shader_map;
|
||||
id_map<ObjectKey, Object> object_map;
|
||||
id_map<void *, Procedural> procedural_map;
|
||||
id_map<GeometryKey, Geometry> geometry_map;
|
||||
id_map<ObjectKey, Light> light_map;
|
||||
id_map<ParticleSystemKey, ParticleSystem> particle_system_map;
|
||||
|
@@ -40,28 +40,6 @@ float *BKE_image_get_float_pixels_for_frame(void *image, int frame, int tile);
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
struct BObjectInfo {
|
||||
/* Object directly provided by the depsgraph iterator. This object is only valid during one
|
||||
* iteration and must not be accessed afterwards. Transforms and visibility should be checked on
|
||||
* this object. */
|
||||
BL::Object iter_object;
|
||||
|
||||
/* This object remains alive even after the object iterator is done. It corresponds to one
|
||||
* original object. It is the object that owns the object data below. */
|
||||
BL::Object real_object;
|
||||
|
||||
/* The object-data referenced by the iter object. This is still valid after the depsgraph
|
||||
* iterator is done. It might have a different type compared to real_object.data(). */
|
||||
BL::ID object_data;
|
||||
|
||||
/* True when the current geometry is the data of the referenced object. False when it is a
|
||||
* geometry instance that does not have a 1-to-1 relationship with an object. */
|
||||
bool is_real_object_data() const
|
||||
{
|
||||
return const_cast<BL::Object &>(real_object).data() == object_data;
|
||||
}
|
||||
};
|
||||
|
||||
typedef BL::ShaderNodeAttribute::attribute_type_enum BlenderAttributeType;
|
||||
BlenderAttributeType blender_attribute_name_split_type(ustring name, string *r_real_name);
|
||||
|
||||
@@ -69,7 +47,7 @@ void python_thread_state_save(void **python_thread_state);
|
||||
void python_thread_state_restore(void **python_thread_state);
|
||||
|
||||
static inline BL::Mesh object_to_mesh(BL::BlendData & /*data*/,
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object &object,
|
||||
BL::Depsgraph & /*depsgraph*/,
|
||||
bool /*calc_undeformed*/,
|
||||
Mesh::SubdivisionType subdivision_type)
|
||||
@@ -91,9 +69,9 @@ static inline BL::Mesh object_to_mesh(BL::BlendData & /*data*/,
|
||||
#endif
|
||||
|
||||
BL::Mesh mesh(PointerRNA_NULL);
|
||||
if (b_ob_info.object_data.is_a(&RNA_Mesh)) {
|
||||
if (object.type() == BL::Object::type_MESH) {
|
||||
/* TODO: calc_undeformed is not used. */
|
||||
mesh = BL::Mesh(b_ob_info.object_data);
|
||||
mesh = BL::Mesh(object.data());
|
||||
|
||||
/* Make a copy to split faces if we use autosmooth, otherwise not needed.
|
||||
* Also in edit mode do we need to make a copy, to ensure data layers like
|
||||
@@ -101,15 +79,12 @@ static inline BL::Mesh object_to_mesh(BL::BlendData & /*data*/,
|
||||
if (mesh.is_editmode() ||
|
||||
(mesh.use_auto_smooth() && subdivision_type == Mesh::SUBDIVISION_NONE)) {
|
||||
BL::Depsgraph depsgraph(PointerRNA_NULL);
|
||||
assert(b_ob_info.is_real_object_data());
|
||||
mesh = b_ob_info.real_object.to_mesh(false, depsgraph);
|
||||
mesh = object.to_mesh(false, depsgraph);
|
||||
}
|
||||
}
|
||||
else {
|
||||
BL::Depsgraph depsgraph(PointerRNA_NULL);
|
||||
if (b_ob_info.is_real_object_data()) {
|
||||
mesh = b_ob_info.real_object.to_mesh(false, depsgraph);
|
||||
}
|
||||
mesh = object.to_mesh(false, depsgraph);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -133,14 +108,10 @@ static inline BL::Mesh object_to_mesh(BL::BlendData & /*data*/,
|
||||
}
|
||||
|
||||
static inline void free_object_to_mesh(BL::BlendData & /*data*/,
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object &object,
|
||||
BL::Mesh &mesh)
|
||||
{
|
||||
if (!b_ob_info.is_real_object_data()) {
|
||||
return;
|
||||
}
|
||||
/* Free mesh if we didn't just use the existing one. */
|
||||
BL::Object object = b_ob_info.real_object;
|
||||
if (object.data().ptr.data != mesh.ptr.data) {
|
||||
object.to_mesh_clear();
|
||||
}
|
||||
@@ -174,7 +145,7 @@ static inline void curvemapping_minmax(/*const*/ BL::CurveMapping &cumap,
|
||||
float *min_x,
|
||||
float *max_x)
|
||||
{
|
||||
// const int num_curves = cumap.curves.length(); /* Gives linking error so far. */
|
||||
/* const int num_curves = cumap.curves.length(); */ /* Gives linking error so far. */
|
||||
const int num_curves = rgb_curve ? 4 : 3;
|
||||
*min_x = FLT_MAX;
|
||||
*max_x = -FLT_MAX;
|
||||
@@ -248,13 +219,9 @@ static inline bool BKE_object_is_modified(BL::Object &self, BL::Scene &scene, bo
|
||||
return self.is_modified(scene, (preview) ? (1 << 0) : (1 << 1)) ? true : false;
|
||||
}
|
||||
|
||||
static inline bool BKE_object_is_deform_modified(BObjectInfo &self, BL::Scene &scene, bool preview)
|
||||
static inline bool BKE_object_is_deform_modified(BL::Object &self, BL::Scene &scene, bool preview)
|
||||
{
|
||||
if (!self.is_real_object_data()) {
|
||||
return false;
|
||||
}
|
||||
return self.real_object.is_deform_modified(scene, (preview) ? (1 << 0) : (1 << 1)) ? true :
|
||||
false;
|
||||
return self.is_deform_modified(scene, (preview) ? (1 << 0) : (1 << 1)) ? true : false;
|
||||
}
|
||||
|
||||
static inline int render_resolution_x(BL::RenderSettings &b_render)
|
||||
@@ -279,11 +246,7 @@ static inline string image_user_file_path(BL::ImageUser &iuser,
|
||||
|
||||
string filepath_str = string(filepath);
|
||||
if (load_tiled && ima.source() == BL::Image::source_TILED) {
|
||||
string udim;
|
||||
if (ima.tiles.length() > 0) {
|
||||
udim = to_string(ima.tiles[0].number());
|
||||
}
|
||||
string_replace(filepath_str, udim, "<UDIM>");
|
||||
string_replace(filepath_str, "1001", "<UDIM>");
|
||||
}
|
||||
return filepath_str;
|
||||
}
|
||||
@@ -457,7 +420,7 @@ static inline void set_enum(PointerRNA &ptr, const char *name, const string &ide
|
||||
static inline string get_string(PointerRNA &ptr, const char *name)
|
||||
{
|
||||
char cstrbuf[1024];
|
||||
char *cstr = RNA_string_get_alloc(&ptr, name, cstrbuf, sizeof(cstrbuf), NULL);
|
||||
char *cstr = RNA_string_get_alloc(&ptr, name, cstrbuf, sizeof(cstrbuf));
|
||||
string str(cstr);
|
||||
if (cstr != cstrbuf)
|
||||
MEM_freeN(cstr);
|
||||
@@ -605,45 +568,6 @@ static inline BL::FluidDomainSettings object_fluid_gas_domain_find(BL::Object &b
|
||||
return BL::FluidDomainSettings(PointerRNA_NULL);
|
||||
}
|
||||
|
||||
static inline BL::MeshSequenceCacheModifier object_mesh_cache_find(BL::Object &b_ob,
|
||||
bool check_velocity,
|
||||
bool *has_subdivision_modifier)
|
||||
{
|
||||
for (int i = b_ob.modifiers.length() - 1; i >= 0; --i) {
|
||||
BL::Modifier b_mod = b_ob.modifiers[i];
|
||||
|
||||
if (b_mod.type() == BL::Modifier::type_MESH_SEQUENCE_CACHE) {
|
||||
BL::MeshSequenceCacheModifier mesh_cache = BL::MeshSequenceCacheModifier(b_mod);
|
||||
|
||||
if (check_velocity) {
|
||||
if (!MeshSequenceCacheModifier_has_velocity_get(&mesh_cache.ptr)) {
|
||||
return BL::MeshSequenceCacheModifier(PointerRNA_NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return mesh_cache;
|
||||
}
|
||||
|
||||
/* Skip possible particles system modifiers as they do not modify the geometry. */
|
||||
if (b_mod.type() == BL::Modifier::type_PARTICLE_SYSTEM) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Only skip the subsurf modifier if we are not checking for the mesh sequence cache modifier
|
||||
* for motion blur. */
|
||||
if (b_mod.type() == BL::Modifier::type_SUBSURF && !check_velocity) {
|
||||
if (has_subdivision_modifier) {
|
||||
*has_subdivision_modifier = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return BL::MeshSequenceCacheModifier(PointerRNA_NULL);
|
||||
}
|
||||
|
||||
static inline Mesh::SubdivisionType object_subdivision_type(BL::Object &b_ob,
|
||||
bool preview,
|
||||
bool experimental)
|
||||
@@ -672,14 +596,15 @@ static inline Mesh::SubdivisionType object_subdivision_type(BL::Object &b_ob,
|
||||
|
||||
static inline uint object_ray_visibility(BL::Object &b_ob)
|
||||
{
|
||||
PointerRNA cvisibility = RNA_pointer_get(&b_ob.ptr, "cycles_visibility");
|
||||
uint flag = 0;
|
||||
|
||||
flag |= b_ob.visible_camera() ? PATH_RAY_CAMERA : 0;
|
||||
flag |= b_ob.visible_diffuse() ? PATH_RAY_DIFFUSE : 0;
|
||||
flag |= b_ob.visible_glossy() ? PATH_RAY_GLOSSY : 0;
|
||||
flag |= b_ob.visible_transmission() ? PATH_RAY_TRANSMIT : 0;
|
||||
flag |= b_ob.visible_shadow() ? PATH_RAY_SHADOW : 0;
|
||||
flag |= b_ob.visible_volume_scatter() ? PATH_RAY_VOLUME_SCATTER : 0;
|
||||
flag |= get_boolean(cvisibility, "camera") ? PATH_RAY_CAMERA : 0;
|
||||
flag |= get_boolean(cvisibility, "diffuse") ? PATH_RAY_DIFFUSE : 0;
|
||||
flag |= get_boolean(cvisibility, "glossy") ? PATH_RAY_GLOSSY : 0;
|
||||
flag |= get_boolean(cvisibility, "transmission") ? PATH_RAY_TRANSMIT : 0;
|
||||
flag |= get_boolean(cvisibility, "shadow") ? PATH_RAY_SHADOW : 0;
|
||||
flag |= get_boolean(cvisibility, "scatter") ? PATH_RAY_VOLUME_SCATTER : 0;
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
@@ -181,12 +181,9 @@ class BlenderSmokeLoader : public ImageLoader {
|
||||
AttributeStandard attribute;
|
||||
};
|
||||
|
||||
static void sync_smoke_volume(Scene *scene, BObjectInfo &b_ob_info, Volume *volume, float frame)
|
||||
static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Volume *volume, float frame)
|
||||
{
|
||||
if (!b_ob_info.is_real_object_data()) {
|
||||
return;
|
||||
}
|
||||
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob_info.real_object);
|
||||
BL::FluidDomainSettings b_domain = object_fluid_gas_domain_find(b_ob);
|
||||
if (!b_domain) {
|
||||
return;
|
||||
}
|
||||
@@ -209,7 +206,7 @@ static void sync_smoke_volume(Scene *scene, BObjectInfo &b_ob_info, Volume *volu
|
||||
|
||||
Attribute *attr = volume->attributes.add(std);
|
||||
|
||||
ImageLoader *loader = new BlenderSmokeLoader(b_ob_info.real_object, std);
|
||||
ImageLoader *loader = new BlenderSmokeLoader(b_ob, std);
|
||||
ImageParams params;
|
||||
params.frame = frame;
|
||||
|
||||
@@ -247,11 +244,11 @@ class BlenderVolumeLoader : public VDBImageLoader {
|
||||
};
|
||||
|
||||
static void sync_volume_object(BL::BlendData &b_data,
|
||||
BObjectInfo &b_ob_info,
|
||||
BL::Object &b_ob,
|
||||
Scene *scene,
|
||||
Volume *volume)
|
||||
{
|
||||
BL::Volume b_volume(b_ob_info.object_data);
|
||||
BL::Volume b_volume(b_ob.data());
|
||||
b_volume.grids.load(b_data.ptr.data);
|
||||
|
||||
BL::VolumeRender b_render(b_volume.render());
|
||||
@@ -299,19 +296,19 @@ static void sync_volume_object(BL::BlendData &b_data,
|
||||
}
|
||||
}
|
||||
|
||||
void BlenderSync::sync_volume(BObjectInfo &b_ob_info, Volume *volume)
|
||||
void BlenderSync::sync_volume(BL::Object &b_ob, Volume *volume)
|
||||
{
|
||||
volume->clear(true);
|
||||
|
||||
if (view_layer.use_volumes) {
|
||||
if (b_ob_info.object_data.is_a(&RNA_Volume)) {
|
||||
if (b_ob.type() == BL::Object::type_VOLUME) {
|
||||
/* Volume object. Create only attributes, bounding mesh will then
|
||||
* be automatically generated later. */
|
||||
sync_volume_object(b_data, b_ob_info, scene, volume);
|
||||
sync_volume_object(b_data, b_ob, scene, volume);
|
||||
}
|
||||
else {
|
||||
/* Smoke domain. */
|
||||
sync_smoke_volume(scene, b_ob_info, volume, b_scene.frame_current());
|
||||
sync_smoke_volume(scene, b_ob, volume, b_scene.frame_current());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
function(cycles_set_solution_folder target)
|
||||
if(IDE_GROUP_PROJECTS_IN_FOLDERS)
|
||||
if(WINDOWS_USE_VISUAL_STUDIO_FOLDERS)
|
||||
get_filename_component(folderdir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
|
||||
string(REPLACE ${CMAKE_SOURCE_DIR} "" folderdir ${folderdir})
|
||||
set_target_properties(${target} PROPERTIES FOLDER ${folderdir})
|
||||
|
@@ -239,14 +239,4 @@ ccl_device_forceinline int intersection_get_shader(KernelGlobals *ccl_restrict k
|
||||
return shader & SHADER_MASK;
|
||||
}
|
||||
|
||||
ccl_device_forceinline int intersection_get_object(KernelGlobals *ccl_restrict kg,
|
||||
const Intersection *ccl_restrict isect)
|
||||
{
|
||||
if (isect->object != OBJECT_NONE) {
|
||||
return isect->object;
|
||||
}
|
||||
|
||||
return kernel_tex_fetch(__prim_object, isect->prim);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -1050,7 +1050,7 @@ ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals *kg,
|
||||
float D, G1i;
|
||||
|
||||
if (alpha_x == alpha_y) {
|
||||
/* Isotropic distribution. */
|
||||
/* istropic distribution */
|
||||
float cosThetaM2 = cosThetaM * cosThetaM;
|
||||
float cosThetaM4 = cosThetaM2 * cosThetaM2;
|
||||
float tanThetaM2 = 1 / (cosThetaM2)-1;
|
||||
|
@@ -36,10 +36,10 @@ static_assert(sizeof(ShaderClosure) >= sizeof(PrincipledDiffuseBsdf),
|
||||
ccl_device float3 calculate_principled_diffuse_brdf(
|
||||
const PrincipledDiffuseBsdf *bsdf, float3 N, float3 V, float3 L, float3 H, float *pdf)
|
||||
{
|
||||
float NdotL = dot(N, L);
|
||||
float NdotV = dot(N, V);
|
||||
float NdotL = max(dot(N, L), 0.0f);
|
||||
float NdotV = max(dot(N, V), 0.0f);
|
||||
|
||||
if (NdotL <= 0 || NdotV <= 0) {
|
||||
if (NdotL < 0 || NdotV < 0) {
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
@@ -107,27 +107,6 @@ triangle_smooth_normal(KernelGlobals *kg, float3 Ng, int prim, float u, float v)
|
||||
return is_zero(N) ? Ng : N;
|
||||
}
|
||||
|
||||
ccl_device_inline float3 triangle_smooth_normal_unnormalized(
|
||||
KernelGlobals *kg, ShaderData *sd, float3 Ng, int prim, float u, float v)
|
||||
{
|
||||
/* load triangle vertices */
|
||||
const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
|
||||
float3 n0 = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.x));
|
||||
float3 n1 = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.y));
|
||||
float3 n2 = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.z));
|
||||
|
||||
/* ensure that the normals are in object space */
|
||||
if (sd->object_flag & SD_OBJECT_TRANSFORM_APPLIED) {
|
||||
object_inverse_normal_transform(kg, sd, &n0);
|
||||
object_inverse_normal_transform(kg, sd, &n1);
|
||||
object_inverse_normal_transform(kg, sd, &n2);
|
||||
}
|
||||
|
||||
float3 N = (1.0f - u - v) * n2 + u * n0 + v * n1;
|
||||
|
||||
return is_zero(N) ? Ng : N;
|
||||
}
|
||||
|
||||
/* Ray differentials on triangle */
|
||||
|
||||
ccl_device_inline void triangle_dPdudv(KernelGlobals *kg,
|
||||
|
@@ -81,8 +81,7 @@ ccl_device_noinline void compute_light_pass(
|
||||
kg, sd, emission_sd, L, &state, &ray, &throughput, &ss_indirect)) {
|
||||
while (ss_indirect.num_rays) {
|
||||
kernel_path_subsurface_setup_indirect(kg, &ss_indirect, &state, &ray, L, &throughput);
|
||||
kernel_path_indirect(
|
||||
kg, &indirect_sd, emission_sd, &ray, throughput, &state, L, sd->object);
|
||||
kernel_path_indirect(kg, &indirect_sd, emission_sd, &ray, throughput, &state, L);
|
||||
}
|
||||
is_sss_sample = true;
|
||||
}
|
||||
@@ -98,8 +97,7 @@ ccl_device_noinline void compute_light_pass(
|
||||
state.ray_t = 0.0f;
|
||||
# endif
|
||||
/* compute indirect light */
|
||||
kernel_path_indirect(
|
||||
kg, &indirect_sd, emission_sd, &ray, throughput, &state, L, sd->object);
|
||||
kernel_path_indirect(kg, &indirect_sd, emission_sd, &ray, throughput, &state, L);
|
||||
|
||||
/* sum and reset indirect light pass variables for the next samples */
|
||||
path_radiance_sum_indirect(L);
|
||||
|
@@ -58,8 +58,7 @@ ccl_device_forceinline bool kernel_path_scene_intersect(KernelGlobals *kg,
|
||||
ccl_addr_space PathState *state,
|
||||
Ray *ray,
|
||||
Intersection *isect,
|
||||
PathRadiance *L,
|
||||
const int last_object)
|
||||
PathRadiance *L)
|
||||
{
|
||||
PROFILING_INIT(kg, PROFILING_SCENE_INTERSECT);
|
||||
|
||||
@@ -67,12 +66,6 @@ ccl_device_forceinline bool kernel_path_scene_intersect(KernelGlobals *kg,
|
||||
|
||||
if (path_state_ao_bounce(kg, state)) {
|
||||
ray->t = kernel_data.background.ao_distance;
|
||||
if (last_object != OBJECT_NONE) {
|
||||
const float object_ao_distance = kernel_tex_fetch(__objects, last_object).ao_distance;
|
||||
if (object_ao_distance != 0.0f) {
|
||||
ray->t = object_ao_distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool hit = scene_intersect(kg, ray, visibility, isect);
|
||||
@@ -260,7 +253,7 @@ ccl_device_forceinline bool kernel_path_shader_apply(KernelGlobals *kg,
|
||||
PROFILING_INIT(kg, PROFILING_SHADER_APPLY);
|
||||
|
||||
#ifdef __SHADOW_TRICKS__
|
||||
if (sd->object_flag & SD_OBJECT_SHADOW_CATCHER) {
|
||||
if ((sd->object_flag & SD_OBJECT_SHADOW_CATCHER)) {
|
||||
if (state->flag & PATH_RAY_TRANSPARENT_BACKGROUND) {
|
||||
state->flag |= (PATH_RAY_SHADOW_CATCHER | PATH_RAY_STORE_SHADOW_INFO);
|
||||
|
||||
@@ -376,8 +369,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg,
|
||||
Ray *ray,
|
||||
float3 throughput,
|
||||
PathState *state,
|
||||
PathRadiance *L,
|
||||
const int last_object)
|
||||
PathRadiance *L)
|
||||
{
|
||||
# ifdef __SUBSURFACE__
|
||||
SubsurfaceIndirectRays ss_indirect;
|
||||
@@ -390,7 +382,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg,
|
||||
for (;;) {
|
||||
/* Find intersection with objects in scene. */
|
||||
Intersection isect;
|
||||
bool hit = kernel_path_scene_intersect(kg, state, ray, &isect, L, last_object);
|
||||
bool hit = kernel_path_scene_intersect(kg, state, ray, &isect, L);
|
||||
|
||||
/* Find intersection with lamps and compute emission for MIS. */
|
||||
kernel_path_lamp_emission(kg, state, ray, throughput, &isect, sd, L);
|
||||
@@ -534,7 +526,7 @@ ccl_device_forceinline void kernel_path_integrate(KernelGlobals *kg,
|
||||
for (;;) {
|
||||
/* Find intersection with objects in scene. */
|
||||
Intersection isect;
|
||||
bool hit = kernel_path_scene_intersect(kg, state, ray, &isect, L, sd.object);
|
||||
bool hit = kernel_path_scene_intersect(kg, state, ray, &isect, L);
|
||||
|
||||
/* Find intersection with lamps and compute emission for MIS. */
|
||||
kernel_path_lamp_emission(kg, state, ray, throughput, &isect, &sd, L);
|
||||
|
@@ -92,7 +92,6 @@ ccl_device_forceinline void kernel_branched_path_volume(KernelGlobals *kg,
|
||||
volume_ray.t = (hit) ? isect->t : FLT_MAX;
|
||||
|
||||
float step_size = volume_stack_step_size(kg, state->volume_stack);
|
||||
const int object = sd->object;
|
||||
|
||||
# ifdef __VOLUME_DECOUPLED__
|
||||
/* decoupled ray marching only supported on CPU */
|
||||
@@ -135,8 +134,7 @@ ccl_device_forceinline void kernel_branched_path_volume(KernelGlobals *kg,
|
||||
|
||||
if (result == VOLUME_PATH_SCATTERED &&
|
||||
kernel_path_volume_bounce(kg, sd, &tp, &ps, &L->state, &pray)) {
|
||||
kernel_path_indirect(
|
||||
kg, indirect_sd, emission_sd, &pray, tp * num_samples_inv, &ps, L, object);
|
||||
kernel_path_indirect(kg, indirect_sd, emission_sd, &pray, tp * num_samples_inv, &ps, L);
|
||||
|
||||
/* for render passes, sum and reset indirect light pass variables
|
||||
* for the next samples */
|
||||
@@ -182,7 +180,7 @@ ccl_device_forceinline void kernel_branched_path_volume(KernelGlobals *kg,
|
||||
kernel_path_volume_connect_light(kg, sd, emission_sd, tp, state, L);
|
||||
|
||||
if (kernel_path_volume_bounce(kg, sd, &tp, &ps, &L->state, &pray)) {
|
||||
kernel_path_indirect(kg, indirect_sd, emission_sd, &pray, tp, &ps, L, object);
|
||||
kernel_path_indirect(kg, indirect_sd, emission_sd, &pray, tp, &ps, L);
|
||||
|
||||
/* for render passes, sum and reset indirect light pass variables
|
||||
* for the next samples */
|
||||
@@ -268,8 +266,7 @@ ccl_device_noinline_cpu void kernel_branched_path_surface_indirect_light(KernelG
|
||||
|
||||
ps.rng_hash = state->rng_hash;
|
||||
|
||||
kernel_path_indirect(
|
||||
kg, indirect_sd, emission_sd, &bsdf_ray, tp * num_samples_inv, &ps, L, sd->object);
|
||||
kernel_path_indirect(kg, indirect_sd, emission_sd, &bsdf_ray, tp * num_samples_inv, &ps, L);
|
||||
|
||||
/* for render passes, sum and reset indirect light pass variables
|
||||
* for the next samples */
|
||||
@@ -398,7 +395,7 @@ ccl_device void kernel_branched_path_integrate(KernelGlobals *kg,
|
||||
for (;;) {
|
||||
/* Find intersection with objects in scene. */
|
||||
Intersection isect;
|
||||
bool hit = kernel_path_scene_intersect(kg, &state, &ray, &isect, L, sd.object);
|
||||
bool hit = kernel_path_scene_intersect(kg, &state, &ray, &isect, L);
|
||||
|
||||
# ifdef __VOLUME__
|
||||
/* Volume integration. */
|
||||
|
@@ -1447,10 +1447,7 @@ typedef struct KernelObject {
|
||||
|
||||
float shadow_terminator_shading_offset;
|
||||
float shadow_terminator_geometry_offset;
|
||||
|
||||
float ao_distance;
|
||||
|
||||
float pad1, pad2;
|
||||
float pad1, pad2, pad3;
|
||||
} KernelObject;
|
||||
static_assert_align(KernelObject, 16);
|
||||
|
||||
|
@@ -58,9 +58,7 @@ shader node_texture_coordinate(
|
||||
getattribute("geom:uv", UV);
|
||||
}
|
||||
else {
|
||||
if (!getattribute("geom:generated", Generated)) {
|
||||
Generated = transform("object", P);
|
||||
}
|
||||
getattribute("geom:generated", Generated);
|
||||
getattribute("geom:uv", UV);
|
||||
}
|
||||
|
||||
|
@@ -65,10 +65,7 @@ ccl_device void kernel_scene_intersect(KernelGlobals *kg)
|
||||
PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
|
||||
|
||||
Intersection isect;
|
||||
const int last_object = state->bounce > 0 ?
|
||||
intersection_get_object(kg, &kernel_split_state.isect[ray_index]) :
|
||||
OBJECT_NONE;
|
||||
bool hit = kernel_path_scene_intersect(kg, state, &ray, &isect, L, last_object);
|
||||
bool hit = kernel_path_scene_intersect(kg, state, &ray, &isect, L);
|
||||
kernel_split_state.isect[ray_index] = isect;
|
||||
|
||||
if (!hit) {
|
||||
|
@@ -72,22 +72,6 @@ ccl_device void svm_node_attr(KernelGlobals *kg, ShaderData *sd, float *stack, u
|
||||
}
|
||||
#endif
|
||||
|
||||
if (node.y == ATTR_STD_GENERATED && desc.element == ATTR_ELEMENT_NONE) {
|
||||
/* No generated attribute, fall back to object coordinates. */
|
||||
float3 f = sd->P;
|
||||
object_inverse_position_transform(kg, sd, &f);
|
||||
if (type == NODE_ATTR_OUTPUT_FLOAT) {
|
||||
stack_store_float(stack, out_offset, average(f));
|
||||
}
|
||||
else if (type == NODE_ATTR_OUTPUT_FLOAT3) {
|
||||
stack_store_float3(stack, out_offset, f);
|
||||
}
|
||||
else {
|
||||
stack_store_float(stack, out_offset, 1.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Surface. */
|
||||
if (desc.type == NODE_ATTR_FLOAT) {
|
||||
float f = primitive_surface_attribute_float(kg, sd, desc, NULL, NULL);
|
||||
@@ -161,22 +145,6 @@ ccl_device void svm_node_attr_bump_dx(KernelGlobals *kg, ShaderData *sd, float *
|
||||
}
|
||||
#endif
|
||||
|
||||
if (node.y == ATTR_STD_GENERATED && desc.element == ATTR_ELEMENT_NONE) {
|
||||
/* No generated attribute, fall back to object coordinates. */
|
||||
float3 f = sd->P + sd->dP.dx;
|
||||
object_inverse_position_transform(kg, sd, &f);
|
||||
if (type == NODE_ATTR_OUTPUT_FLOAT) {
|
||||
stack_store_float(stack, out_offset, average(f));
|
||||
}
|
||||
else if (type == NODE_ATTR_OUTPUT_FLOAT3) {
|
||||
stack_store_float3(stack, out_offset, f);
|
||||
}
|
||||
else {
|
||||
stack_store_float(stack, out_offset, 1.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Surface */
|
||||
if (desc.type == NODE_ATTR_FLOAT) {
|
||||
float dx;
|
||||
@@ -254,22 +222,6 @@ ccl_device void svm_node_attr_bump_dy(KernelGlobals *kg, ShaderData *sd, float *
|
||||
}
|
||||
#endif
|
||||
|
||||
if (node.y == ATTR_STD_GENERATED && desc.element == ATTR_ELEMENT_NONE) {
|
||||
/* No generated attribute, fall back to object coordinates. */
|
||||
float3 f = sd->P + sd->dP.dy;
|
||||
object_inverse_position_transform(kg, sd, &f);
|
||||
if (type == NODE_ATTR_OUTPUT_FLOAT) {
|
||||
stack_store_float(stack, out_offset, average(f));
|
||||
}
|
||||
else if (type == NODE_ATTR_OUTPUT_FLOAT3) {
|
||||
stack_store_float3(stack, out_offset, f);
|
||||
}
|
||||
else {
|
||||
stack_store_float(stack, out_offset, 1.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* Surface */
|
||||
if (desc.type == NODE_ATTR_FLOAT) {
|
||||
float dy;
|
||||
|
@@ -267,7 +267,7 @@ ccl_device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *st
|
||||
|
||||
if (space == NODE_NORMAL_MAP_TANGENT) {
|
||||
/* tangent space */
|
||||
if (sd->object == OBJECT_NONE || (sd->type & PRIMITIVE_ALL_TRIANGLE) == 0) {
|
||||
if (sd->object == OBJECT_NONE) {
|
||||
/* Fallback to unperturbed normal. */
|
||||
stack_store_float3(stack, normal_offset, sd->N);
|
||||
return;
|
||||
@@ -276,8 +276,10 @@ ccl_device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *st
|
||||
/* first try to get tangent attribute */
|
||||
const AttributeDescriptor attr = find_attribute(kg, sd, node.z);
|
||||
const AttributeDescriptor attr_sign = find_attribute(kg, sd, node.w);
|
||||
const AttributeDescriptor attr_normal = find_attribute(kg, sd, ATTR_STD_VERTEX_NORMAL);
|
||||
|
||||
if (attr.offset == ATTR_STD_NOT_FOUND || attr_sign.offset == ATTR_STD_NOT_FOUND) {
|
||||
if (attr.offset == ATTR_STD_NOT_FOUND || attr_sign.offset == ATTR_STD_NOT_FOUND ||
|
||||
attr_normal.offset == ATTR_STD_NOT_FOUND) {
|
||||
/* Fallback to unperturbed normal. */
|
||||
stack_store_float3(stack, normal_offset, sd->N);
|
||||
return;
|
||||
@@ -289,7 +291,7 @@ ccl_device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *st
|
||||
float3 normal;
|
||||
|
||||
if (sd->shader & SHADER_SMOOTH_NORMAL) {
|
||||
normal = triangle_smooth_normal_unnormalized(kg, sd, sd->Ng, sd->prim, sd->u, sd->v);
|
||||
normal = primitive_surface_attribute_float3(kg, sd, attr_normal, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
normal = sd->Ng;
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include "render/shader.h"
|
||||
|
||||
#include "util/util_foreach.h"
|
||||
#include "util/util_logging.h"
|
||||
#include "util/util_progress.h"
|
||||
#include "util/util_transform.h"
|
||||
#include "util/util_vector.h"
|
||||
@@ -212,35 +211,6 @@ void CachedData::set_time_sampling(TimeSampling time_sampling)
|
||||
}
|
||||
}
|
||||
|
||||
size_t CachedData::memory_used() const
|
||||
{
|
||||
size_t mem_used = 0;
|
||||
|
||||
mem_used += curve_first_key.memory_used();
|
||||
mem_used += curve_keys.memory_used();
|
||||
mem_used += curve_radius.memory_used();
|
||||
mem_used += curve_shader.memory_used();
|
||||
mem_used += num_ngons.memory_used();
|
||||
mem_used += shader.memory_used();
|
||||
mem_used += subd_creases_edge.memory_used();
|
||||
mem_used += subd_creases_weight.memory_used();
|
||||
mem_used += subd_face_corners.memory_used();
|
||||
mem_used += subd_num_corners.memory_used();
|
||||
mem_used += subd_ptex_offset.memory_used();
|
||||
mem_used += subd_smooth.memory_used();
|
||||
mem_used += subd_start_corner.memory_used();
|
||||
mem_used += transforms.memory_used();
|
||||
mem_used += triangles.memory_used();
|
||||
mem_used += uv_loops.memory_used();
|
||||
mem_used += vertices.memory_used();
|
||||
|
||||
for (const CachedAttribute &attr : attributes) {
|
||||
mem_used += attr.data.memory_used();
|
||||
}
|
||||
|
||||
return mem_used;
|
||||
}
|
||||
|
||||
static M44d convert_yup_zup(const M44d &mtx, float scale_mult)
|
||||
{
|
||||
V3d scale, shear, rotation, translation;
|
||||
@@ -415,8 +385,6 @@ NODE_DEFINE(AlembicObject)
|
||||
SOCKET_STRING(path, "Alembic Path", ustring());
|
||||
SOCKET_NODE_ARRAY(used_shaders, "Used Shaders", Shader::get_node_type());
|
||||
|
||||
SOCKET_BOOLEAN(ignore_subdivision, "Ignore Subdivision", true);
|
||||
|
||||
SOCKET_INT(subd_max_level, "Max Subdivision Level", 1);
|
||||
SOCKET_FLOAT(subd_dicing_rate, "Subdivision Dicing Rate", 1.0f);
|
||||
|
||||
@@ -502,33 +470,6 @@ void AlembicObject::load_data_in_cache(CachedData &cached_data,
|
||||
|
||||
cached_data.clear();
|
||||
|
||||
if (this->get_ignore_subdivision()) {
|
||||
PolyMeshSchemaData data;
|
||||
data.topology_variance = schema.getTopologyVariance();
|
||||
data.time_sampling = schema.getTimeSampling();
|
||||
data.positions = schema.getPositionsProperty();
|
||||
data.face_counts = schema.getFaceCountsProperty();
|
||||
data.face_indices = schema.getFaceIndicesProperty();
|
||||
data.num_samples = schema.getNumSamples();
|
||||
data.velocities = schema.getVelocitiesProperty();
|
||||
data.shader_face_sets = parse_face_sets_for_shader_assignment(schema, get_used_shaders());
|
||||
|
||||
read_geometry_data(proc, cached_data, data, progress);
|
||||
|
||||
if (progress.get_cancel()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Use the schema as the base compound property to also be able to look for top level
|
||||
* properties. */
|
||||
read_attributes(
|
||||
proc, cached_data, schema, schema.getUVsParam(), get_requested_attributes(), progress);
|
||||
|
||||
cached_data.invalidate_last_loaded_time(true);
|
||||
data_loaded = true;
|
||||
return;
|
||||
}
|
||||
|
||||
SubDSchemaData data;
|
||||
data.time_sampling = schema.getTimeSampling();
|
||||
data.num_samples = schema.getNumSamples();
|
||||
@@ -736,9 +677,6 @@ NODE_DEFINE(AlembicProcedural)
|
||||
|
||||
SOCKET_NODE_ARRAY(objects, "Objects", AlembicObject::get_node_type());
|
||||
|
||||
SOCKET_BOOLEAN(use_prefetch, "Use Prefetch", true);
|
||||
SOCKET_INT(prefetch_cache_size, "Prefetch Cache Size", 4096);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -843,43 +781,6 @@ void AlembicProcedural::generate(Scene *scene, Progress &progress)
|
||||
|
||||
const chrono_t frame_time = (chrono_t)((frame - frame_offset) / frame_rate);
|
||||
|
||||
/* Clear the subdivision caches as the data is stored differently. */
|
||||
for (Node *node : objects) {
|
||||
AlembicObject *object = static_cast<AlembicObject *>(node);
|
||||
|
||||
if (object->schema_type != AlembicObject::SUBD) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (object->ignore_subdivision_is_modified()) {
|
||||
object->clear_cache();
|
||||
}
|
||||
}
|
||||
|
||||
if (use_prefetch_is_modified()) {
|
||||
if (!use_prefetch) {
|
||||
for (Node *node : objects) {
|
||||
AlembicObject *object = static_cast<AlembicObject *>(node);
|
||||
object->clear_cache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prefetch_cache_size_is_modified()) {
|
||||
/* Check whether the current memory usage fits in the new requested size,
|
||||
* abort the render if it is any higher. */
|
||||
size_t memory_used = 0ul;
|
||||
for (Node *node : objects) {
|
||||
AlembicObject *object = static_cast<AlembicObject *>(node);
|
||||
memory_used += object->get_cached_data().memory_used();
|
||||
}
|
||||
|
||||
if (memory_used > get_prefetch_cache_size_in_bytes()) {
|
||||
progress.set_error("Error: Alembic Procedural memory limit reached");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
build_caches(progress);
|
||||
|
||||
foreach (Node *node, objects) {
|
||||
@@ -1058,6 +959,14 @@ void AlembicProcedural::read_mesh(AlembicObject *abc_object, Abc::chrono_t frame
|
||||
|
||||
update_attributes(mesh->attributes, cached_data, frame_time);
|
||||
|
||||
/* we don't yet support arbitrary attributes, for now add vertex
|
||||
* coordinates as generated coordinates if requested */
|
||||
if (mesh->need_attribute(scene_, ATTR_STD_GENERATED)) {
|
||||
Attribute *attr = mesh->attributes.add(ATTR_STD_GENERATED);
|
||||
memcpy(
|
||||
attr->data_float3(), mesh->get_verts().data(), sizeof(float3) * mesh->get_verts().size());
|
||||
}
|
||||
|
||||
if (mesh->is_modified()) {
|
||||
bool need_rebuild = mesh->triangles_is_modified();
|
||||
mesh->tag_update(scene_, need_rebuild);
|
||||
@@ -1066,13 +975,13 @@ void AlembicProcedural::read_mesh(AlembicObject *abc_object, Abc::chrono_t frame
|
||||
|
||||
void AlembicProcedural::read_subd(AlembicObject *abc_object, Abc::chrono_t frame_time)
|
||||
{
|
||||
if (abc_object->get_ignore_subdivision()) {
|
||||
read_mesh(abc_object, frame_time);
|
||||
return;
|
||||
}
|
||||
|
||||
CachedData &cached_data = abc_object->get_cached_data();
|
||||
|
||||
if (abc_object->subd_max_level_is_modified() || abc_object->subd_dicing_rate_is_modified()) {
|
||||
/* need to reset the current data is something changed */
|
||||
cached_data.invalidate_last_loaded_time();
|
||||
}
|
||||
|
||||
/* Update sockets. */
|
||||
|
||||
Object *object = abc_object->get_object();
|
||||
@@ -1087,11 +996,6 @@ void AlembicProcedural::read_subd(AlembicObject *abc_object, Abc::chrono_t frame
|
||||
return;
|
||||
}
|
||||
|
||||
if (abc_object->subd_max_level_is_modified() || abc_object->subd_dicing_rate_is_modified()) {
|
||||
/* need to reset the current data is something changed */
|
||||
cached_data.invalidate_last_loaded_time();
|
||||
}
|
||||
|
||||
Mesh *mesh = static_cast<Mesh *>(object->get_geometry());
|
||||
|
||||
/* Make sure shader ids are also updated. */
|
||||
@@ -1149,6 +1053,14 @@ void AlembicProcedural::read_subd(AlembicObject *abc_object, Abc::chrono_t frame
|
||||
|
||||
update_attributes(mesh->subd_attributes, cached_data, frame_time);
|
||||
|
||||
/* we don't yet support arbitrary attributes, for now add vertex
|
||||
* coordinates as generated coordinates if requested */
|
||||
if (mesh->need_attribute(scene_, ATTR_STD_GENERATED)) {
|
||||
Attribute *attr = mesh->attributes.add(ATTR_STD_GENERATED);
|
||||
memcpy(
|
||||
attr->data_float3(), mesh->get_verts().data(), sizeof(float3) * mesh->get_verts().size());
|
||||
}
|
||||
|
||||
if (mesh->is_modified()) {
|
||||
bool need_rebuild = (mesh->triangles_is_modified()) ||
|
||||
(mesh->subd_num_corners_is_modified()) ||
|
||||
@@ -1198,6 +1110,17 @@ void AlembicProcedural::read_curves(AlembicObject *abc_object, Abc::chrono_t fra
|
||||
|
||||
update_attributes(hair->attributes, cached_data, frame_time);
|
||||
|
||||
/* we don't yet support arbitrary attributes, for now add first keys as generated coordinates if
|
||||
* requested */
|
||||
if (hair->need_attribute(scene_, ATTR_STD_GENERATED)) {
|
||||
Attribute *attr_generated = hair->attributes.add(ATTR_STD_GENERATED);
|
||||
float3 *generated = attr_generated->data_float3();
|
||||
|
||||
for (size_t i = 0; i < hair->num_curves(); i++) {
|
||||
generated[i] = hair->get_curve_keys()[hair->get_curve(i).first_key];
|
||||
}
|
||||
}
|
||||
|
||||
const bool rebuild = (hair->curve_keys_is_modified() || hair->curve_radius_is_modified());
|
||||
hair->tag_update(scene_, rebuild);
|
||||
}
|
||||
@@ -1357,8 +1280,6 @@ void AlembicProcedural::walk_hierarchy(
|
||||
|
||||
void AlembicProcedural::build_caches(Progress &progress)
|
||||
{
|
||||
size_t memory_used = 0;
|
||||
|
||||
for (Node *node : objects) {
|
||||
AlembicObject *object = static_cast<AlembicObject *>(node);
|
||||
|
||||
@@ -1412,18 +1333,7 @@ void AlembicProcedural::build_caches(Progress &progress)
|
||||
if (scale_is_modified() || object->get_cached_data().transforms.size() == 0) {
|
||||
object->setup_transform_cache(object->get_cached_data(), scale);
|
||||
}
|
||||
|
||||
memory_used += object->get_cached_data().memory_used();
|
||||
|
||||
if (use_prefetch) {
|
||||
if (memory_used > get_prefetch_cache_size_in_bytes()) {
|
||||
progress.set_error("Error: Alembic Procedural memory limit reached");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VLOG(1) << "AlembicProcedural memory usage : " << string_human_readable_size(memory_used);
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -272,21 +272,6 @@ template<typename T> class DataStore {
|
||||
node->set(*socket, value);
|
||||
}
|
||||
|
||||
size_t memory_used() const
|
||||
{
|
||||
if constexpr (is_array<T>::value) {
|
||||
size_t mem_used = 0;
|
||||
|
||||
for (const T &array : data) {
|
||||
mem_used += array.size() * sizeof(array[0]);
|
||||
}
|
||||
|
||||
return mem_used;
|
||||
}
|
||||
|
||||
return data.size() * sizeof(T);
|
||||
}
|
||||
|
||||
private:
|
||||
const TimeIndexPair &get_index_for_time(double time) const
|
||||
{
|
||||
@@ -347,8 +332,6 @@ struct CachedData {
|
||||
void invalidate_last_loaded_time(bool attributes_only = false);
|
||||
|
||||
void set_time_sampling(Alembic::AbcCoreAbstract::TimeSampling time_sampling);
|
||||
|
||||
size_t memory_used() const;
|
||||
};
|
||||
|
||||
/* Representation of an Alembic object for the AlembicProcedural.
|
||||
@@ -370,10 +353,6 @@ class AlembicObject : public Node {
|
||||
/* Shaders used for rendering. */
|
||||
NODE_SOCKET_API_ARRAY(array<Node *>, used_shaders)
|
||||
|
||||
/* Treat this subdivision object as a regular polygon mesh, so no subdivision will be performed.
|
||||
*/
|
||||
NODE_SOCKET_API(bool, ignore_subdivision)
|
||||
|
||||
/* Maximum number of subdivisions for ISubD objects. */
|
||||
NODE_SOCKET_API(int, subd_max_level)
|
||||
|
||||
@@ -437,11 +416,6 @@ class AlembicObject : public Node {
|
||||
return cached_data_.is_constant();
|
||||
}
|
||||
|
||||
void clear_cache()
|
||||
{
|
||||
cached_data_.clear();
|
||||
}
|
||||
|
||||
Object *object = nullptr;
|
||||
|
||||
bool data_loaded = false;
|
||||
@@ -499,13 +473,6 @@ class AlembicProcedural : public Procedural {
|
||||
* software. */
|
||||
NODE_SOCKET_API(float, scale)
|
||||
|
||||
/* Cache controls */
|
||||
NODE_SOCKET_API(bool, use_prefetch)
|
||||
|
||||
/* Memory limit for the cache, if the data does not fit within this limit, rendering is aborted.
|
||||
*/
|
||||
NODE_SOCKET_API(int, prefetch_cache_size)
|
||||
|
||||
AlembicProcedural();
|
||||
~AlembicProcedural();
|
||||
|
||||
@@ -555,12 +522,6 @@ class AlembicProcedural : public Procedural {
|
||||
void read_subd(AlembicObject *abc_object, Alembic::AbcGeom::Abc::chrono_t frame_time);
|
||||
|
||||
void build_caches(Progress &progress);
|
||||
|
||||
size_t get_prefetch_cache_size_in_bytes() const
|
||||
{
|
||||
/* prefetch_cache_size is in megabytes, so convert to bytes. */
|
||||
return static_cast<size_t>(prefetch_cache_size) * 1024 * 1024;
|
||||
}
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -44,19 +44,9 @@ static set<chrono_t> get_relevant_sample_times(AlembicProcedural *proc,
|
||||
return result;
|
||||
}
|
||||
|
||||
double start_frame;
|
||||
double end_frame;
|
||||
|
||||
if (proc->get_use_prefetch()) {
|
||||
// load the data for the entire animation
|
||||
start_frame = static_cast<double>(proc->get_start_frame());
|
||||
end_frame = static_cast<double>(proc->get_end_frame());
|
||||
}
|
||||
else {
|
||||
// load the data for the current frame
|
||||
start_frame = static_cast<double>(proc->get_frame());
|
||||
end_frame = start_frame;
|
||||
}
|
||||
// load the data for the entire animation
|
||||
const double start_frame = static_cast<double>(proc->get_start_frame());
|
||||
const double end_frame = static_cast<double>(proc->get_end_frame());
|
||||
|
||||
const double frame_rate = static_cast<double>(proc->get_frame_rate());
|
||||
const double start_time = start_frame / frame_rate;
|
||||
|
@@ -788,11 +788,6 @@ void GeometryManager::device_update_attributes(Device *device,
|
||||
foreach (AttributeRequest &req, attributes.requests) {
|
||||
Attribute *attr = geom->attributes.find(req);
|
||||
|
||||
/* Vertex normals are stored in DeviceScene.tri_vnormal. */
|
||||
if (attr && attr->std == ATTR_STD_VERTEX_NORMAL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
update_attribute_element_size(geom,
|
||||
attr,
|
||||
ATTR_PRIM_GEOMETRY,
|
||||
@@ -805,11 +800,6 @@ void GeometryManager::device_update_attributes(Device *device,
|
||||
Mesh *mesh = static_cast<Mesh *>(geom);
|
||||
Attribute *subd_attr = mesh->subd_attributes.find(req);
|
||||
|
||||
/* Vertex normals are stored in DeviceScene.tri_vnormal. */
|
||||
if (subd_attr && subd_attr->std == ATTR_STD_VERTEX_NORMAL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
update_attribute_element_size(mesh,
|
||||
subd_attr,
|
||||
ATTR_PRIM_SUBD,
|
||||
@@ -864,11 +854,6 @@ void GeometryManager::device_update_attributes(Device *device,
|
||||
Attribute *attr = geom->attributes.find(req);
|
||||
|
||||
if (attr) {
|
||||
/* Vertex normals are stored in DeviceScene.tri_vnormal. */
|
||||
if (attr->std == ATTR_STD_VERTEX_NORMAL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* force a copy if we need to reallocate all the data */
|
||||
attr->modified |= attributes_need_realloc[Attribute::kernel_type(*attr)];
|
||||
}
|
||||
@@ -892,11 +877,6 @@ void GeometryManager::device_update_attributes(Device *device,
|
||||
Attribute *subd_attr = mesh->subd_attributes.find(req);
|
||||
|
||||
if (subd_attr) {
|
||||
/* Vertex normals are stored in DeviceScene.tri_vnormal. */
|
||||
if (subd_attr->std == ATTR_STD_VERTEX_NORMAL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* force a copy if we need to reallocate all the data */
|
||||
subd_attr->modified |= attributes_need_realloc[Attribute::kernel_type(*subd_attr)];
|
||||
}
|
||||
|
@@ -158,13 +158,13 @@ void ShaderNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
foreach (ShaderInput *input, inputs) {
|
||||
if (!input->link) {
|
||||
if (input->flags() & SocketType::LINK_TEXTURE_GENERATED) {
|
||||
if (shader->has_surface_link())
|
||||
if (shader->has_surface)
|
||||
attributes->add(ATTR_STD_GENERATED);
|
||||
if (shader->has_volume)
|
||||
attributes->add(ATTR_STD_GENERATED_TRANSFORM);
|
||||
}
|
||||
else if (input->flags() & SocketType::LINK_TEXTURE_UV) {
|
||||
if (shader->has_surface_link())
|
||||
if (shader->has_surface)
|
||||
attributes->add(ATTR_STD_UV);
|
||||
}
|
||||
}
|
||||
|
@@ -410,39 +410,38 @@ void LightManager::device_update_distribution(Device *,
|
||||
}
|
||||
|
||||
float trianglearea = totarea;
|
||||
|
||||
/* point lights */
|
||||
float lightarea = (totarea > 0.0f) ? totarea / num_lights : 1.0f;
|
||||
bool use_lamp_mis = false;
|
||||
|
||||
int light_index = 0;
|
||||
|
||||
if (num_lights > 0) {
|
||||
float lightarea = (totarea > 0.0f) ? totarea / num_lights : 1.0f;
|
||||
foreach (Light *light, scene->lights) {
|
||||
if (!light->is_enabled)
|
||||
continue;
|
||||
foreach (Light *light, scene->lights) {
|
||||
if (!light->is_enabled)
|
||||
continue;
|
||||
|
||||
distribution[offset].totarea = totarea;
|
||||
distribution[offset].prim = ~light_index;
|
||||
distribution[offset].lamp.pad = 1.0f;
|
||||
distribution[offset].lamp.size = light->size;
|
||||
totarea += lightarea;
|
||||
distribution[offset].totarea = totarea;
|
||||
distribution[offset].prim = ~light_index;
|
||||
distribution[offset].lamp.pad = 1.0f;
|
||||
distribution[offset].lamp.size = light->size;
|
||||
totarea += lightarea;
|
||||
|
||||
if (light->light_type == LIGHT_DISTANT) {
|
||||
use_lamp_mis |= (light->angle > 0.0f && light->use_mis);
|
||||
}
|
||||
else if (light->light_type == LIGHT_POINT || light->light_type == LIGHT_SPOT) {
|
||||
use_lamp_mis |= (light->size > 0.0f && light->use_mis);
|
||||
}
|
||||
else if (light->light_type == LIGHT_AREA) {
|
||||
use_lamp_mis |= light->use_mis;
|
||||
}
|
||||
else if (light->light_type == LIGHT_BACKGROUND) {
|
||||
num_background_lights++;
|
||||
background_mis |= light->use_mis;
|
||||
}
|
||||
|
||||
light_index++;
|
||||
offset++;
|
||||
if (light->light_type == LIGHT_DISTANT) {
|
||||
use_lamp_mis |= (light->angle > 0.0f && light->use_mis);
|
||||
}
|
||||
else if (light->light_type == LIGHT_POINT || light->light_type == LIGHT_SPOT) {
|
||||
use_lamp_mis |= (light->size > 0.0f && light->use_mis);
|
||||
}
|
||||
else if (light->light_type == LIGHT_AREA) {
|
||||
use_lamp_mis |= light->use_mis;
|
||||
}
|
||||
else if (light->light_type == LIGHT_BACKGROUND) {
|
||||
num_background_lights++;
|
||||
background_mis |= light->use_mis;
|
||||
}
|
||||
|
||||
light_index++;
|
||||
offset++;
|
||||
}
|
||||
|
||||
/* normalize cumulative distribution functions */
|
||||
|
@@ -350,7 +350,7 @@ void ImageTextureNode::attributes(Shader *shader, AttributeRequestSet *attribute
|
||||
#ifdef WITH_PTEX
|
||||
/* todo: avoid loading other texture coordinates when using ptex,
|
||||
* and hide texture coordinate socket in the UI */
|
||||
if (shader->has_surface_link() && string_endswith(filename, ".ptx")) {
|
||||
if (shader->has_surface && string_endswith(filename, ".ptx")) {
|
||||
/* ptex */
|
||||
attributes->add(ATTR_STD_PTEX_FACE_ID);
|
||||
attributes->add(ATTR_STD_PTEX_UV);
|
||||
@@ -552,7 +552,7 @@ ImageParams EnvironmentTextureNode::image_params() const
|
||||
void EnvironmentTextureNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
{
|
||||
#ifdef WITH_PTEX
|
||||
if (shader->has_surface_link() && string_endswith(filename, ".ptx")) {
|
||||
if (shader->has_surface && string_endswith(filename, ".ptx")) {
|
||||
/* ptex */
|
||||
attributes->add(ATTR_STD_PTEX_FACE_ID);
|
||||
attributes->add(ATTR_STD_PTEX_UV);
|
||||
@@ -2319,7 +2319,7 @@ AnisotropicBsdfNode::AnisotropicBsdfNode() : BsdfNode(get_node_type())
|
||||
|
||||
void AnisotropicBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
{
|
||||
if (shader->has_surface_link()) {
|
||||
if (shader->has_surface) {
|
||||
ShaderInput *tangent_in = input("Tangent");
|
||||
|
||||
if (!tangent_in->link)
|
||||
@@ -2843,7 +2843,7 @@ bool PrincipledBsdfNode::has_surface_bssrdf()
|
||||
|
||||
void PrincipledBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
{
|
||||
if (shader->has_surface_link()) {
|
||||
if (shader->has_surface) {
|
||||
ShaderInput *tangent_in = input("Tangent");
|
||||
|
||||
if (!tangent_in->link)
|
||||
@@ -3684,7 +3684,7 @@ GeometryNode::GeometryNode() : ShaderNode(get_node_type())
|
||||
|
||||
void GeometryNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
{
|
||||
if (shader->has_surface_link()) {
|
||||
if (shader->has_surface) {
|
||||
if (!output("Tangent")->links.empty()) {
|
||||
attributes->add(ATTR_STD_GENERATED);
|
||||
}
|
||||
@@ -3830,7 +3830,7 @@ TextureCoordinateNode::TextureCoordinateNode() : ShaderNode(get_node_type())
|
||||
|
||||
void TextureCoordinateNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
{
|
||||
if (shader->has_surface_link()) {
|
||||
if (shader->has_surface) {
|
||||
if (!from_dupli) {
|
||||
if (!output("Generated")->links.empty())
|
||||
attributes->add(ATTR_STD_GENERATED);
|
||||
@@ -4388,7 +4388,7 @@ HairInfoNode::HairInfoNode() : ShaderNode(get_node_type())
|
||||
|
||||
void HairInfoNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
{
|
||||
if (shader->has_surface_link()) {
|
||||
if (shader->has_surface) {
|
||||
ShaderOutput *intercept_out = output("Intercept");
|
||||
|
||||
if (!intercept_out->links.empty())
|
||||
@@ -6744,7 +6744,7 @@ NormalMapNode::NormalMapNode() : ShaderNode(get_node_type())
|
||||
|
||||
void NormalMapNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
{
|
||||
if (shader->has_surface_link() && space == NODE_NORMAL_MAP_TANGENT) {
|
||||
if (shader->has_surface && space == NODE_NORMAL_MAP_TANGENT) {
|
||||
if (attribute.empty()) {
|
||||
attributes->add(ATTR_STD_UV_TANGENT);
|
||||
attributes->add(ATTR_STD_UV_TANGENT_SIGN);
|
||||
@@ -6838,7 +6838,7 @@ TangentNode::TangentNode() : ShaderNode(get_node_type())
|
||||
|
||||
void TangentNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
{
|
||||
if (shader->has_surface_link()) {
|
||||
if (shader->has_surface) {
|
||||
if (direction_type == NODE_TANGENT_UVMAP) {
|
||||
if (attribute.empty())
|
||||
attributes->add(ATTR_STD_UV_TANGENT);
|
||||
@@ -7021,7 +7021,7 @@ void VectorDisplacementNode::constant_fold(const ConstantFolder &folder)
|
||||
|
||||
void VectorDisplacementNode::attributes(Shader *shader, AttributeRequestSet *attributes)
|
||||
{
|
||||
if (shader->has_surface_link() && space == NODE_NORMAL_MAP_TANGENT) {
|
||||
if (shader->has_surface && space == NODE_NORMAL_MAP_TANGENT) {
|
||||
if (attribute.empty()) {
|
||||
attributes->add(ATTR_STD_UV_TANGENT);
|
||||
attributes->add(ATTR_STD_UV_TANGENT_SIGN);
|
||||
|
@@ -102,8 +102,6 @@ NODE_DEFINE(Object)
|
||||
SOCKET_NODE(particle_system, "Particle System", ParticleSystem::get_node_type());
|
||||
SOCKET_INT(particle_index, "Particle Index", 0);
|
||||
|
||||
SOCKET_FLOAT(ao_distance, "AO Distance", 0.0f);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -430,7 +428,6 @@ void ObjectManager::device_update_object_transform(UpdateObjectTransformState *s
|
||||
kobject.random_number = random_number;
|
||||
kobject.particle_index = particle_index;
|
||||
kobject.motion_offset = 0;
|
||||
kobject.ao_distance = ob->ao_distance;
|
||||
|
||||
if (geom->get_use_motion_blur()) {
|
||||
state->have_motion = true;
|
||||
|
@@ -73,8 +73,6 @@ class Object : public Node {
|
||||
NODE_SOCKET_API(ParticleSystem *, particle_system);
|
||||
NODE_SOCKET_API(int, particle_index);
|
||||
|
||||
NODE_SOCKET_API(float, ao_distance)
|
||||
|
||||
Object();
|
||||
~Object();
|
||||
|
||||
|
@@ -57,26 +57,23 @@ Session::Session(const SessionParams ¶ms_)
|
||||
stats(),
|
||||
profiler()
|
||||
{
|
||||
device_use_gl_ = ((params.device.type != DEVICE_CPU) && !params.background);
|
||||
device_use_gl = ((params.device.type != DEVICE_CPU) && !params.background);
|
||||
|
||||
TaskScheduler::init(params.threads);
|
||||
|
||||
session_thread_ = NULL;
|
||||
session_thread = NULL;
|
||||
scene = NULL;
|
||||
|
||||
reset_time_ = 0.0;
|
||||
last_update_time_ = 0.0;
|
||||
reset_time = 0.0;
|
||||
last_update_time = 0.0;
|
||||
|
||||
delayed_reset_.do_reset = false;
|
||||
delayed_reset_.samples = 0;
|
||||
delayed_reset.do_reset = false;
|
||||
delayed_reset.samples = 0;
|
||||
|
||||
display_outdated_ = false;
|
||||
gpu_draw_ready_ = false;
|
||||
gpu_need_display_buffer_update_ = false;
|
||||
|
||||
pause_ = false;
|
||||
cancel_ = false;
|
||||
new_work_added_ = false;
|
||||
display_outdated = false;
|
||||
gpu_draw_ready = false;
|
||||
gpu_need_display_buffer_update = false;
|
||||
pause = false;
|
||||
|
||||
buffers = NULL;
|
||||
display = NULL;
|
||||
@@ -130,26 +127,25 @@ Session::~Session()
|
||||
|
||||
void Session::start()
|
||||
{
|
||||
if (!session_thread_) {
|
||||
session_thread_ = new thread(function_bind(&Session::run, this));
|
||||
if (!session_thread) {
|
||||
session_thread = new thread(function_bind(&Session::run, this));
|
||||
}
|
||||
}
|
||||
|
||||
void Session::cancel()
|
||||
{
|
||||
if (session_thread_) {
|
||||
if (session_thread) {
|
||||
/* wait for session thread to end */
|
||||
progress.set_cancel("Exiting");
|
||||
|
||||
gpu_need_display_buffer_update_ = false;
|
||||
gpu_need_display_buffer_update_cond_.notify_all();
|
||||
gpu_need_display_buffer_update = false;
|
||||
gpu_need_display_buffer_update_cond.notify_all();
|
||||
|
||||
{
|
||||
thread_scoped_lock pause_lock(pause_mutex_);
|
||||
pause_ = false;
|
||||
cancel_ = true;
|
||||
thread_scoped_lock pause_lock(pause_mutex);
|
||||
pause = false;
|
||||
}
|
||||
pause_cond_.notify_all();
|
||||
pause_cond.notify_all();
|
||||
|
||||
wait();
|
||||
}
|
||||
@@ -157,9 +153,9 @@ void Session::cancel()
|
||||
|
||||
bool Session::ready_to_reset()
|
||||
{
|
||||
double dt = time_dt() - reset_time_;
|
||||
double dt = time_dt() - reset_time;
|
||||
|
||||
if (!display_outdated_)
|
||||
if (!display_outdated)
|
||||
return (dt > params.reset_timeout);
|
||||
else
|
||||
return (dt > params.cancel_timeout);
|
||||
@@ -169,50 +165,48 @@ bool Session::ready_to_reset()
|
||||
|
||||
void Session::reset_gpu(BufferParams &buffer_params, int samples)
|
||||
{
|
||||
thread_scoped_lock pause_lock(pause_mutex_);
|
||||
thread_scoped_lock pause_lock(pause_mutex);
|
||||
|
||||
/* block for buffer access and reset immediately. we can't do this
|
||||
* in the thread, because we need to allocate an OpenGL buffer, and
|
||||
* that only works in the main thread */
|
||||
thread_scoped_lock display_lock(display_mutex_);
|
||||
thread_scoped_lock buffers_lock(buffers_mutex_);
|
||||
thread_scoped_lock display_lock(display_mutex);
|
||||
thread_scoped_lock buffers_lock(buffers_mutex);
|
||||
|
||||
display_outdated_ = true;
|
||||
reset_time_ = time_dt();
|
||||
display_outdated = true;
|
||||
reset_time = time_dt();
|
||||
|
||||
reset_(buffer_params, samples);
|
||||
|
||||
gpu_need_display_buffer_update_ = false;
|
||||
gpu_need_display_buffer_update_cond_.notify_all();
|
||||
gpu_need_display_buffer_update = false;
|
||||
gpu_need_display_buffer_update_cond.notify_all();
|
||||
|
||||
new_work_added_ = true;
|
||||
|
||||
pause_cond_.notify_all();
|
||||
pause_cond.notify_all();
|
||||
}
|
||||
|
||||
bool Session::draw_gpu(BufferParams &buffer_params, DeviceDrawParams &draw_params)
|
||||
{
|
||||
/* block for buffer access */
|
||||
thread_scoped_lock display_lock(display_mutex_);
|
||||
thread_scoped_lock display_lock(display_mutex);
|
||||
|
||||
/* first check we already rendered something */
|
||||
if (gpu_draw_ready_) {
|
||||
if (gpu_draw_ready) {
|
||||
/* then verify the buffers have the expected size, so we don't
|
||||
* draw previous results in a resized window */
|
||||
if (buffer_params.width == display->params.width &&
|
||||
buffer_params.height == display->params.height) {
|
||||
/* for CUDA we need to do tone-mapping still, since we can
|
||||
* only access GL buffers from the main thread. */
|
||||
if (gpu_need_display_buffer_update_) {
|
||||
thread_scoped_lock buffers_lock(buffers_mutex_);
|
||||
if (gpu_need_display_buffer_update) {
|
||||
thread_scoped_lock buffers_lock(buffers_mutex);
|
||||
copy_to_display_buffer(tile_manager.state.sample);
|
||||
gpu_need_display_buffer_update_ = false;
|
||||
gpu_need_display_buffer_update_cond_.notify_all();
|
||||
gpu_need_display_buffer_update = false;
|
||||
gpu_need_display_buffer_update_cond.notify_all();
|
||||
}
|
||||
|
||||
display->draw(device, draw_params);
|
||||
|
||||
if (display_outdated_ && (time_dt() - reset_time_) > params.text_timeout)
|
||||
if (display_outdated && (time_dt() - reset_time) > params.text_timeout)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -226,9 +220,9 @@ void Session::run_gpu()
|
||||
{
|
||||
bool tiles_written = false;
|
||||
|
||||
reset_time_ = time_dt();
|
||||
last_update_time_ = time_dt();
|
||||
last_display_time_ = last_update_time_;
|
||||
reset_time = time_dt();
|
||||
last_update_time = time_dt();
|
||||
last_display_time = last_update_time;
|
||||
|
||||
progress.set_render_start_time();
|
||||
|
||||
@@ -261,7 +255,7 @@ void Session::run_gpu()
|
||||
/* buffers mutex is locked entirely while rendering each
|
||||
* sample, and released/reacquired on each iteration to allow
|
||||
* reset and draw in between */
|
||||
thread_scoped_lock buffers_lock(buffers_mutex_);
|
||||
thread_scoped_lock buffers_lock(buffers_mutex);
|
||||
|
||||
/* update status and timing */
|
||||
update_status_time();
|
||||
@@ -279,17 +273,17 @@ void Session::run_gpu()
|
||||
/* update status and timing */
|
||||
update_status_time();
|
||||
|
||||
gpu_need_display_buffer_update_ = !delayed_denoise;
|
||||
gpu_draw_ready_ = true;
|
||||
gpu_need_display_buffer_update = !delayed_denoise;
|
||||
gpu_draw_ready = true;
|
||||
progress.set_update();
|
||||
|
||||
/* wait for until display buffer is updated */
|
||||
if (!params.background) {
|
||||
while (gpu_need_display_buffer_update_) {
|
||||
while (gpu_need_display_buffer_update) {
|
||||
if (progress.get_cancel())
|
||||
break;
|
||||
|
||||
gpu_need_display_buffer_update_cond_.wait(buffers_lock);
|
||||
gpu_need_display_buffer_update_cond.wait(buffers_lock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,23 +305,23 @@ void Session::run_gpu()
|
||||
|
||||
void Session::reset_cpu(BufferParams &buffer_params, int samples)
|
||||
{
|
||||
thread_scoped_lock reset_lock(delayed_reset_.mutex);
|
||||
thread_scoped_lock pause_lock(pause_mutex_);
|
||||
thread_scoped_lock reset_lock(delayed_reset.mutex);
|
||||
thread_scoped_lock pause_lock(pause_mutex);
|
||||
|
||||
display_outdated_ = true;
|
||||
reset_time_ = time_dt();
|
||||
display_outdated = true;
|
||||
reset_time = time_dt();
|
||||
|
||||
delayed_reset_.params = buffer_params;
|
||||
delayed_reset_.samples = samples;
|
||||
delayed_reset_.do_reset = true;
|
||||
delayed_reset.params = buffer_params;
|
||||
delayed_reset.samples = samples;
|
||||
delayed_reset.do_reset = true;
|
||||
device->task_cancel();
|
||||
|
||||
pause_cond_.notify_all();
|
||||
pause_cond.notify_all();
|
||||
}
|
||||
|
||||
bool Session::draw_cpu(BufferParams &buffer_params, DeviceDrawParams &draw_params)
|
||||
{
|
||||
thread_scoped_lock display_lock(display_mutex_);
|
||||
thread_scoped_lock display_lock(display_mutex);
|
||||
|
||||
/* first check we already rendered something */
|
||||
if (display->draw_ready()) {
|
||||
@@ -337,7 +331,7 @@ bool Session::draw_cpu(BufferParams &buffer_params, DeviceDrawParams &draw_param
|
||||
buffer_params.height == display->params.height) {
|
||||
display->draw(device, draw_params);
|
||||
|
||||
if (display_outdated_ && (time_dt() - reset_time_) > params.text_timeout)
|
||||
if (display_outdated && (time_dt() - reset_time) > params.text_timeout)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -351,46 +345,46 @@ bool Session::steal_tile(RenderTile &rtile, Device *tile_device, thread_scoped_l
|
||||
{
|
||||
/* Devices that can get their tiles stolen don't steal tiles themselves.
|
||||
* Additionally, if there are no stealable tiles in flight, give up here. */
|
||||
if (tile_device->info.type == DEVICE_CPU || stealable_tiles_ == 0) {
|
||||
if (tile_device->info.type == DEVICE_CPU || stealable_tiles == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Wait until no other thread is trying to steal a tile. */
|
||||
while (tile_stealing_state_ != NOT_STEALING && stealable_tiles_ > 0) {
|
||||
while (tile_stealing_state != NOT_STEALING && stealable_tiles > 0) {
|
||||
/* Someone else is currently trying to get a tile.
|
||||
* Wait on the condition variable and try later. */
|
||||
tile_steal_cond_.wait(tile_lock);
|
||||
tile_steal_cond.wait(tile_lock);
|
||||
}
|
||||
/* If another thread stole the last stealable tile in the meantime, give up. */
|
||||
if (stealable_tiles_ == 0) {
|
||||
if (stealable_tiles == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* There are stealable tiles in flight, so signal that one should be released. */
|
||||
tile_stealing_state_ = WAITING_FOR_TILE;
|
||||
tile_stealing_state = WAITING_FOR_TILE;
|
||||
|
||||
/* Wait until a device notices the signal and releases its tile. */
|
||||
while (tile_stealing_state_ != GOT_TILE && stealable_tiles_ > 0) {
|
||||
tile_steal_cond_.wait(tile_lock);
|
||||
while (tile_stealing_state != GOT_TILE && stealable_tiles > 0) {
|
||||
tile_steal_cond.wait(tile_lock);
|
||||
}
|
||||
/* If the last stealable tile finished on its own, give up. */
|
||||
if (tile_stealing_state_ != GOT_TILE) {
|
||||
tile_stealing_state_ = NOT_STEALING;
|
||||
if (tile_stealing_state != GOT_TILE) {
|
||||
tile_stealing_state = NOT_STEALING;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Successfully stole a tile, now move it to the new device. */
|
||||
rtile = stolen_tile_;
|
||||
rtile = stolen_tile;
|
||||
rtile.buffers->buffer.move_device(tile_device);
|
||||
rtile.buffer = rtile.buffers->buffer.device_pointer;
|
||||
rtile.stealing_state = RenderTile::NO_STEALING;
|
||||
rtile.num_samples -= (rtile.sample - rtile.start_sample);
|
||||
rtile.start_sample = rtile.sample;
|
||||
|
||||
tile_stealing_state_ = NOT_STEALING;
|
||||
tile_stealing_state = NOT_STEALING;
|
||||
|
||||
/* Poke any threads which might be waiting for NOT_STEALING above. */
|
||||
tile_steal_cond_.notify_one();
|
||||
tile_steal_cond.notify_one();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -400,7 +394,7 @@ bool Session::get_tile_stolen()
|
||||
/* If tile_stealing_state is WAITING_FOR_TILE, atomically set it to RELEASING_TILE
|
||||
* and return true. */
|
||||
TileStealingState expected = WAITING_FOR_TILE;
|
||||
return tile_stealing_state_.compare_exchange_weak(expected, RELEASING_TILE);
|
||||
return tile_stealing_state.compare_exchange_weak(expected, RELEASING_TILE);
|
||||
}
|
||||
|
||||
bool Session::acquire_tile(RenderTile &rtile, Device *tile_device, uint tile_types)
|
||||
@@ -412,7 +406,7 @@ bool Session::acquire_tile(RenderTile &rtile, Device *tile_device, uint tile_typ
|
||||
}
|
||||
}
|
||||
|
||||
thread_scoped_lock tile_lock(tile_mutex_);
|
||||
thread_scoped_lock tile_lock(tile_mutex);
|
||||
|
||||
/* get next tile from manager */
|
||||
Tile *tile;
|
||||
@@ -429,7 +423,7 @@ bool Session::acquire_tile(RenderTile &rtile, Device *tile_device, uint tile_typ
|
||||
|
||||
/* Wait for denoising tiles to become available */
|
||||
if ((tile_types & RenderTile::DENOISE) && !progress.get_cancel() && tile_manager.has_tiles()) {
|
||||
denoising_cond_.wait(tile_lock);
|
||||
denoising_cond.wait(tile_lock);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -452,7 +446,7 @@ bool Session::acquire_tile(RenderTile &rtile, Device *tile_device, uint tile_typ
|
||||
}
|
||||
else {
|
||||
if (tile_device->info.type == DEVICE_CPU) {
|
||||
stealable_tiles_++;
|
||||
stealable_tiles++;
|
||||
rtile.stealing_state = RenderTile::CAN_BE_STOLEN;
|
||||
}
|
||||
|
||||
@@ -521,7 +515,7 @@ bool Session::acquire_tile(RenderTile &rtile, Device *tile_device, uint tile_typ
|
||||
/* This will read any passes needed as input for baking. */
|
||||
if (tile_manager.state.sample == tile_manager.range_start_sample) {
|
||||
{
|
||||
thread_scoped_lock tile_lock(tile_mutex_);
|
||||
thread_scoped_lock tile_lock(tile_mutex);
|
||||
read_bake_tile_cb(rtile);
|
||||
}
|
||||
rtile.buffers->buffer.copy_to_device();
|
||||
@@ -539,7 +533,7 @@ bool Session::acquire_tile(RenderTile &rtile, Device *tile_device, uint tile_typ
|
||||
|
||||
void Session::update_tile_sample(RenderTile &rtile)
|
||||
{
|
||||
thread_scoped_lock tile_lock(tile_mutex_);
|
||||
thread_scoped_lock tile_lock(tile_mutex);
|
||||
|
||||
if (update_render_tile_cb) {
|
||||
if (params.progressive_refine == false) {
|
||||
@@ -554,25 +548,25 @@ void Session::update_tile_sample(RenderTile &rtile)
|
||||
|
||||
void Session::release_tile(RenderTile &rtile, const bool need_denoise)
|
||||
{
|
||||
thread_scoped_lock tile_lock(tile_mutex_);
|
||||
thread_scoped_lock tile_lock(tile_mutex);
|
||||
|
||||
if (rtile.stealing_state != RenderTile::NO_STEALING) {
|
||||
stealable_tiles_--;
|
||||
stealable_tiles--;
|
||||
if (rtile.stealing_state == RenderTile::WAS_STOLEN) {
|
||||
/* If the tile is being stolen, don't release it here - the new device will pick up where
|
||||
* the old one left off. */
|
||||
|
||||
assert(tile_stealing_state_ == RELEASING_TILE);
|
||||
assert(tile_stealing_state == RELEASING_TILE);
|
||||
assert(rtile.sample < rtile.start_sample + rtile.num_samples);
|
||||
|
||||
tile_stealing_state_ = GOT_TILE;
|
||||
stolen_tile_ = rtile;
|
||||
tile_steal_cond_.notify_all();
|
||||
tile_stealing_state = GOT_TILE;
|
||||
stolen_tile = rtile;
|
||||
tile_steal_cond.notify_all();
|
||||
return;
|
||||
}
|
||||
else if (stealable_tiles_ == 0) {
|
||||
else if (stealable_tiles == 0) {
|
||||
/* If this was the last stealable tile, wake up any threads still waiting for one. */
|
||||
tile_steal_cond_.notify_all();
|
||||
tile_steal_cond.notify_all();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,12 +595,12 @@ void Session::release_tile(RenderTile &rtile, const bool need_denoise)
|
||||
update_status_time();
|
||||
|
||||
/* Notify denoising thread that a tile was finished. */
|
||||
denoising_cond_.notify_all();
|
||||
denoising_cond.notify_all();
|
||||
}
|
||||
|
||||
void Session::map_neighbor_tiles(RenderTileNeighbors &neighbors, Device *tile_device)
|
||||
{
|
||||
thread_scoped_lock tile_lock(tile_mutex_);
|
||||
thread_scoped_lock tile_lock(tile_mutex);
|
||||
|
||||
const int4 image_region = make_int4(
|
||||
tile_manager.state.buffer.full_x,
|
||||
@@ -683,7 +677,7 @@ void Session::map_neighbor_tiles(RenderTileNeighbors &neighbors, Device *tile_de
|
||||
|
||||
void Session::unmap_neighbor_tiles(RenderTileNeighbors &neighbors, Device *tile_device)
|
||||
{
|
||||
thread_scoped_lock tile_lock(tile_mutex_);
|
||||
thread_scoped_lock tile_lock(tile_mutex);
|
||||
device->unmap_neighbor_tiles(tile_device, neighbors);
|
||||
}
|
||||
|
||||
@@ -691,8 +685,8 @@ void Session::run_cpu()
|
||||
{
|
||||
bool tiles_written = false;
|
||||
|
||||
last_update_time_ = time_dt();
|
||||
last_display_time_ = last_update_time_;
|
||||
last_update_time = time_dt();
|
||||
last_display_time = last_update_time;
|
||||
|
||||
while (!progress.get_cancel()) {
|
||||
const bool no_tiles = !run_update_for_next_iteration();
|
||||
@@ -724,7 +718,7 @@ void Session::run_cpu()
|
||||
/* buffers mutex is locked entirely while rendering each
|
||||
* sample, and released/reacquired on each iteration to allow
|
||||
* reset and draw in between */
|
||||
thread_scoped_lock buffers_lock(buffers_mutex_);
|
||||
thread_scoped_lock buffers_lock(buffers_mutex);
|
||||
|
||||
/* update status and timing */
|
||||
update_status_time();
|
||||
@@ -747,14 +741,14 @@ void Session::run_cpu()
|
||||
device->task_wait();
|
||||
|
||||
{
|
||||
thread_scoped_lock reset_lock(delayed_reset_.mutex);
|
||||
thread_scoped_lock buffers_lock(buffers_mutex_);
|
||||
thread_scoped_lock display_lock(display_mutex_);
|
||||
thread_scoped_lock reset_lock(delayed_reset.mutex);
|
||||
thread_scoped_lock buffers_lock(buffers_mutex);
|
||||
thread_scoped_lock display_lock(display_mutex);
|
||||
|
||||
if (delayed_reset_.do_reset) {
|
||||
if (delayed_reset.do_reset) {
|
||||
/* reset rendering if request from main thread */
|
||||
delayed_reset_.do_reset = false;
|
||||
reset_(delayed_reset_.params, delayed_reset_.samples);
|
||||
delayed_reset.do_reset = false;
|
||||
reset_(delayed_reset.params, delayed_reset.samples);
|
||||
}
|
||||
else if (need_copy_to_display_buffer) {
|
||||
/* Only copy to display_buffer if we do not reset, we don't
|
||||
@@ -789,7 +783,7 @@ void Session::run()
|
||||
/* reset number of rendered samples */
|
||||
progress.reset_sample();
|
||||
|
||||
if (device_use_gl_)
|
||||
if (device_use_gl)
|
||||
run_gpu();
|
||||
else
|
||||
run_cpu();
|
||||
@@ -807,12 +801,12 @@ void Session::run()
|
||||
bool Session::run_update_for_next_iteration()
|
||||
{
|
||||
thread_scoped_lock scene_lock(scene->mutex);
|
||||
thread_scoped_lock reset_lock(delayed_reset_.mutex);
|
||||
thread_scoped_lock reset_lock(delayed_reset.mutex);
|
||||
|
||||
if (delayed_reset_.do_reset) {
|
||||
thread_scoped_lock buffers_lock(buffers_mutex_);
|
||||
reset_(delayed_reset_.params, delayed_reset_.samples);
|
||||
delayed_reset_.do_reset = false;
|
||||
if (delayed_reset.do_reset) {
|
||||
thread_scoped_lock buffers_lock(buffers_mutex);
|
||||
reset_(delayed_reset.params, delayed_reset.samples);
|
||||
delayed_reset.do_reset = false;
|
||||
}
|
||||
|
||||
const bool have_tiles = tile_manager.next();
|
||||
@@ -835,43 +829,35 @@ bool Session::run_wait_for_work(bool no_tiles)
|
||||
return false;
|
||||
}
|
||||
|
||||
thread_scoped_lock pause_lock(pause_mutex_);
|
||||
thread_scoped_lock pause_lock(pause_mutex);
|
||||
|
||||
if (!pause_ && !no_tiles) {
|
||||
/* Rendering is not paused and there is work to be done. No need to wait for anything. */
|
||||
if (!pause && !no_tiles) {
|
||||
return false;
|
||||
}
|
||||
|
||||
update_status_time(pause_, no_tiles);
|
||||
update_status_time(pause, no_tiles);
|
||||
|
||||
/* Only leave the loop when rendering is not paused. But even if the current render is un-paused
|
||||
* but there is nothing to render keep waiting until new work is added. */
|
||||
while (!cancel_) {
|
||||
while (true) {
|
||||
scoped_timer pause_timer;
|
||||
|
||||
if (!pause_ && (!no_tiles || new_work_added_ || delayed_reset_.do_reset)) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Wait for either pause state changed, or extra samples added to render. */
|
||||
pause_cond_.wait(pause_lock);
|
||||
|
||||
if (pause_) {
|
||||
pause_cond.wait(pause_lock);
|
||||
if (pause) {
|
||||
progress.add_skip_time(pause_timer, params.background);
|
||||
}
|
||||
|
||||
update_status_time(pause_, no_tiles);
|
||||
update_status_time(pause, no_tiles);
|
||||
progress.set_update();
|
||||
}
|
||||
|
||||
new_work_added_ = false;
|
||||
if (!pause) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return no_tiles;
|
||||
}
|
||||
|
||||
bool Session::draw(BufferParams &buffer_params, DeviceDrawParams &draw_params)
|
||||
{
|
||||
if (device_use_gl_)
|
||||
if (device_use_gl)
|
||||
return draw_gpu(buffer_params, draw_params);
|
||||
else
|
||||
return draw_cpu(buffer_params, draw_params);
|
||||
@@ -880,7 +866,7 @@ bool Session::draw(BufferParams &buffer_params, DeviceDrawParams &draw_params)
|
||||
void Session::reset_(BufferParams &buffer_params, int samples)
|
||||
{
|
||||
if (buffers && buffer_params.modified(tile_manager.params)) {
|
||||
gpu_draw_ready_ = false;
|
||||
gpu_draw_ready = false;
|
||||
buffers->reset(buffer_params);
|
||||
if (display) {
|
||||
display->reset(buffer_params);
|
||||
@@ -888,8 +874,8 @@ void Session::reset_(BufferParams &buffer_params, int samples)
|
||||
}
|
||||
|
||||
tile_manager.reset(buffer_params, samples);
|
||||
stealable_tiles_ = 0;
|
||||
tile_stealing_state_ = NOT_STEALING;
|
||||
stealable_tiles = 0;
|
||||
tile_stealing_state = NOT_STEALING;
|
||||
progress.reset_sample();
|
||||
|
||||
bool show_progress = params.background || tile_manager.get_num_effective_samples() != INT_MAX;
|
||||
@@ -902,7 +888,7 @@ void Session::reset_(BufferParams &buffer_params, int samples)
|
||||
|
||||
void Session::reset(BufferParams &buffer_params, int samples)
|
||||
{
|
||||
if (device_use_gl_)
|
||||
if (device_use_gl)
|
||||
reset_gpu(buffer_params, samples);
|
||||
else
|
||||
reset_cpu(buffer_params, samples);
|
||||
@@ -910,37 +896,30 @@ void Session::reset(BufferParams &buffer_params, int samples)
|
||||
|
||||
void Session::set_samples(int samples)
|
||||
{
|
||||
if (samples == params.samples) {
|
||||
return;
|
||||
if (samples != params.samples) {
|
||||
params.samples = samples;
|
||||
tile_manager.set_samples(samples);
|
||||
|
||||
pause_cond.notify_all();
|
||||
}
|
||||
|
||||
params.samples = samples;
|
||||
tile_manager.set_samples(samples);
|
||||
|
||||
{
|
||||
thread_scoped_lock pause_lock(pause_mutex_);
|
||||
new_work_added_ = true;
|
||||
}
|
||||
|
||||
pause_cond_.notify_all();
|
||||
}
|
||||
|
||||
void Session::set_pause(bool pause)
|
||||
void Session::set_pause(bool pause_)
|
||||
{
|
||||
bool notify = false;
|
||||
|
||||
{
|
||||
thread_scoped_lock pause_lock(pause_mutex_);
|
||||
thread_scoped_lock pause_lock(pause_mutex);
|
||||
|
||||
if (pause != pause_) {
|
||||
pause_ = pause;
|
||||
pause = pause_;
|
||||
notify = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (session_thread_) {
|
||||
if (session_thread) {
|
||||
if (notify) {
|
||||
pause_cond_.notify_all();
|
||||
pause_cond.notify_all();
|
||||
}
|
||||
}
|
||||
else if (pause_) {
|
||||
@@ -953,7 +932,7 @@ void Session::set_denoising(const DenoiseParams &denoising)
|
||||
bool need_denoise = denoising.need_denoising_task();
|
||||
|
||||
/* Lock buffers so no denoising operation is triggered while the settings are changed here. */
|
||||
thread_scoped_lock buffers_lock(buffers_mutex_);
|
||||
thread_scoped_lock buffers_lock(buffers_mutex);
|
||||
params.denoising = denoising;
|
||||
|
||||
if (!(params.device.denoisers & denoising.type)) {
|
||||
@@ -978,18 +957,18 @@ void Session::set_denoising_start_sample(int sample)
|
||||
if (sample != params.denoising.start_sample) {
|
||||
params.denoising.start_sample = sample;
|
||||
|
||||
pause_cond_.notify_all();
|
||||
pause_cond.notify_all();
|
||||
}
|
||||
}
|
||||
|
||||
void Session::wait()
|
||||
{
|
||||
if (session_thread_) {
|
||||
session_thread_->join();
|
||||
delete session_thread_;
|
||||
if (session_thread) {
|
||||
session_thread->join();
|
||||
delete session_thread;
|
||||
}
|
||||
|
||||
session_thread_ = NULL;
|
||||
session_thread = NULL;
|
||||
}
|
||||
|
||||
bool Session::update_scene()
|
||||
@@ -1120,7 +1099,7 @@ bool Session::render_need_denoise(bool &delayed)
|
||||
|
||||
/* Avoid excessive denoising in viewport after reaching a certain amount of samples. */
|
||||
delayed = (tile_manager.state.sample >= 20 &&
|
||||
(time_dt() - last_display_time_) < params.progressive_update_timeout);
|
||||
(time_dt() - last_display_time) < params.progressive_update_timeout);
|
||||
return !delayed;
|
||||
}
|
||||
|
||||
@@ -1218,10 +1197,10 @@ void Session::copy_to_display_buffer(int sample)
|
||||
/* set display to new size */
|
||||
display->draw_set(task.w, task.h);
|
||||
|
||||
last_display_time_ = time_dt();
|
||||
last_display_time = time_dt();
|
||||
}
|
||||
|
||||
display_outdated_ = false;
|
||||
display_outdated = false;
|
||||
}
|
||||
|
||||
bool Session::update_progressive_refine(bool cancel)
|
||||
@@ -1231,7 +1210,7 @@ bool Session::update_progressive_refine(bool cancel)
|
||||
|
||||
double current_time = time_dt();
|
||||
|
||||
if (current_time - last_update_time_ < params.progressive_update_timeout) {
|
||||
if (current_time - last_update_time < params.progressive_update_timeout) {
|
||||
/* If last sample was processed, we need to write buffers anyway. */
|
||||
if (!write && sample != 1)
|
||||
return false;
|
||||
@@ -1262,7 +1241,7 @@ bool Session::update_progressive_refine(bool cancel)
|
||||
}
|
||||
}
|
||||
|
||||
last_update_time_ = current_time;
|
||||
last_update_time = current_time;
|
||||
|
||||
return write;
|
||||
}
|
||||
|
@@ -174,7 +174,7 @@ class Session {
|
||||
bool do_reset;
|
||||
BufferParams params;
|
||||
int samples;
|
||||
} delayed_reset_;
|
||||
} delayed_reset;
|
||||
|
||||
void run();
|
||||
|
||||
@@ -207,41 +207,38 @@ class Session {
|
||||
void map_neighbor_tiles(RenderTileNeighbors &neighbors, Device *tile_device);
|
||||
void unmap_neighbor_tiles(RenderTileNeighbors &neighbors, Device *tile_device);
|
||||
|
||||
bool device_use_gl_;
|
||||
bool device_use_gl;
|
||||
|
||||
thread *session_thread_;
|
||||
thread *session_thread;
|
||||
|
||||
volatile bool display_outdated_;
|
||||
volatile bool display_outdated;
|
||||
|
||||
volatile bool gpu_draw_ready_;
|
||||
volatile bool gpu_need_display_buffer_update_;
|
||||
thread_condition_variable gpu_need_display_buffer_update_cond_;
|
||||
volatile bool gpu_draw_ready;
|
||||
volatile bool gpu_need_display_buffer_update;
|
||||
thread_condition_variable gpu_need_display_buffer_update_cond;
|
||||
|
||||
bool pause_;
|
||||
bool cancel_;
|
||||
bool new_work_added_;
|
||||
bool pause;
|
||||
thread_condition_variable pause_cond;
|
||||
thread_mutex pause_mutex;
|
||||
thread_mutex tile_mutex;
|
||||
thread_mutex buffers_mutex;
|
||||
thread_mutex display_mutex;
|
||||
thread_condition_variable denoising_cond;
|
||||
thread_condition_variable tile_steal_cond;
|
||||
|
||||
thread_condition_variable pause_cond_;
|
||||
thread_mutex pause_mutex_;
|
||||
thread_mutex tile_mutex_;
|
||||
thread_mutex buffers_mutex_;
|
||||
thread_mutex display_mutex_;
|
||||
thread_condition_variable denoising_cond_;
|
||||
thread_condition_variable tile_steal_cond_;
|
||||
double reset_time;
|
||||
double last_update_time;
|
||||
double last_display_time;
|
||||
|
||||
double reset_time_;
|
||||
double last_update_time_;
|
||||
double last_display_time_;
|
||||
|
||||
RenderTile stolen_tile_;
|
||||
RenderTile stolen_tile;
|
||||
typedef enum {
|
||||
NOT_STEALING, /* There currently is no tile stealing in progress. */
|
||||
WAITING_FOR_TILE, /* A device is waiting for another device to release a tile. */
|
||||
RELEASING_TILE, /* A device has releasing a stealable tile. */
|
||||
GOT_TILE /* A device has released a stealable tile, which is now stored in stolen_tile. */
|
||||
} TileStealingState;
|
||||
std::atomic<TileStealingState> tile_stealing_state_;
|
||||
int stealable_tiles_;
|
||||
std::atomic<TileStealingState> tile_stealing_state;
|
||||
int stealable_tiles;
|
||||
|
||||
/* progressive refine */
|
||||
bool update_progressive_refine(bool cancel);
|
||||
|
@@ -154,14 +154,6 @@ class Shader : public Node {
|
||||
void tag_update(Scene *scene);
|
||||
void tag_used(Scene *scene);
|
||||
|
||||
/* Return true when either of the surface or displacement socket of the output node is linked.
|
||||
* This should be used to ensure that surface attributes are also requested even when only the
|
||||
* displacement socket is linked. */
|
||||
bool has_surface_link() const
|
||||
{
|
||||
return has_surface || has_displacement;
|
||||
}
|
||||
|
||||
bool need_update_geometry() const;
|
||||
};
|
||||
|
||||
|
@@ -1066,6 +1066,22 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
|
||||
uint32_t count,
|
||||
const char *const *action_names);
|
||||
|
||||
/**
|
||||
* Create spaces for pose-based OpenXR actions.
|
||||
*/
|
||||
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
|
||||
const char *action_set_name,
|
||||
uint32_t count,
|
||||
const GHOST_XrActionSpaceInfo *infos);
|
||||
|
||||
/**
|
||||
* Destroy previously created spaces for OpenXR actions.
|
||||
*/
|
||||
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
|
||||
const char *action_set_name,
|
||||
uint32_t count,
|
||||
const GHOST_XrActionSpaceInfo *infos);
|
||||
|
||||
/**
|
||||
* Create input/output path bindings for OpenXR actions.
|
||||
*/
|
||||
@@ -1080,8 +1096,7 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
|
||||
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_context,
|
||||
const char *action_set_name,
|
||||
uint32_t count,
|
||||
const char *const *action_names,
|
||||
const char *const *profile_paths);
|
||||
const GHOST_XrActionProfileInfo *infos);
|
||||
|
||||
/**
|
||||
* Attach all created action sets to the current OpenXR session.
|
||||
@@ -1102,7 +1117,6 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_context, const char *action_set
|
||||
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
|
||||
const char *action_set_name,
|
||||
const char *action_name,
|
||||
const char *subaction_path,
|
||||
const int64_t *duration,
|
||||
const float *frequency,
|
||||
const float *amplitude);
|
||||
@@ -1112,8 +1126,7 @@ int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
|
||||
*/
|
||||
void GHOST_XrStopHapticAction(GHOST_XrContextHandle xr_context,
|
||||
const char *action_set_name,
|
||||
const char *action_name,
|
||||
const char *subaction_path);
|
||||
const char *action_name);
|
||||
|
||||
/**
|
||||
* Get action set custom data (owned by Blender, not GHOST).
|
||||
@@ -1128,18 +1141,6 @@ void *GHOST_XrGetActionCustomdata(GHOST_XrContextHandle xr_context,
|
||||
const char *action_set_name,
|
||||
const char *action_name);
|
||||
|
||||
/**
|
||||
* Get the number of actions in an action set.
|
||||
*/
|
||||
unsigned int GHOST_XrGetActionCount(GHOST_XrContextHandle xr_context, const char *action_set_name);
|
||||
|
||||
/**
|
||||
* Get custom data for all actions in an action set.
|
||||
*/
|
||||
void GHOST_XrGetActionCustomdataArray(GHOST_XrContextHandle xr_context,
|
||||
const char *action_set_name,
|
||||
void **r_customdata_array);
|
||||
|
||||
#endif /* WITH_XR_OPENXR */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -32,10 +32,10 @@ class GHOST_IWindow;
|
||||
/**
|
||||
* Interface class for events received from GHOST.
|
||||
* You should not need to inherit this class. The system will pass these events
|
||||
* to the #GHOST_IEventConsumer::processEvent() method of event consumers.<br>
|
||||
* Use the #getType() method to retrieve the type of event and the #getData()
|
||||
* to the GHOST_IEventConsumer::processEvent() method of event consumers.<br>
|
||||
* Use the getType() method to retrieve the type of event and the getData()
|
||||
* method to get the event data out. Using the event type you can cast the
|
||||
* event data to the correct event data structure.
|
||||
* event data to the correct event dat structure.
|
||||
* \see GHOST_IEventConsumer#processEvent
|
||||
* \see GHOST_TEventType
|
||||
*/
|
||||
|
@@ -669,14 +669,6 @@ typedef struct {
|
||||
void *exit_customdata;
|
||||
} GHOST_XrSessionBeginInfo;
|
||||
|
||||
/** Texture format for XR swapchain. */
|
||||
typedef enum GHOST_TXrSwapchainFormat {
|
||||
GHOST_kXrSwapchainFormatRGBA8,
|
||||
GHOST_kXrSwapchainFormatRGBA16,
|
||||
GHOST_kXrSwapchainFormatRGBA16F,
|
||||
GHOST_kXrSwapchainFormatRGB10_A2,
|
||||
} GHOST_TXrSwapchainFormat;
|
||||
|
||||
typedef struct GHOST_XrDrawViewInfo {
|
||||
int ofsx, ofsy;
|
||||
int width, height;
|
||||
@@ -689,7 +681,6 @@ typedef struct GHOST_XrDrawViewInfo {
|
||||
float angle_up, angle_down;
|
||||
} fov;
|
||||
|
||||
GHOST_TXrSwapchainFormat swapchain_format;
|
||||
/** Set if the buffer should be submitted with a SRGB transfer applied. */
|
||||
char expects_srgb_buffer;
|
||||
|
||||
@@ -728,27 +719,29 @@ typedef struct GHOST_XrActionInfo {
|
||||
const char **subaction_paths;
|
||||
/** States for each subaction path. */
|
||||
void *states;
|
||||
/** Input thresholds/regions for each subaction path. */
|
||||
float *float_thresholds;
|
||||
int16_t *axis_flags;
|
||||
|
||||
GHOST_XrCustomdataFreeFn customdata_free_fn;
|
||||
void *customdata; /* wmXrAction */
|
||||
} GHOST_XrActionInfo;
|
||||
|
||||
typedef struct GHOST_XrActionSpaceInfo {
|
||||
const char *action_name;
|
||||
uint32_t count_subaction_paths;
|
||||
const char **subaction_paths;
|
||||
/** Poses for each subaction path. */
|
||||
const GHOST_XrPose *poses;
|
||||
} GHOST_XrActionSpaceInfo;
|
||||
|
||||
typedef struct GHOST_XrActionBindingInfo {
|
||||
const char *component_path;
|
||||
float float_threshold;
|
||||
int16_t axis_flag;
|
||||
GHOST_XrPose pose;
|
||||
const char *action_name;
|
||||
uint32_t count_interaction_paths;
|
||||
/** Interaction path: User (sub-action) path + component path. */
|
||||
const char **interaction_paths;
|
||||
} GHOST_XrActionBindingInfo;
|
||||
|
||||
typedef struct GHOST_XrActionProfileInfo {
|
||||
const char *action_name;
|
||||
const char *profile_path;
|
||||
uint32_t count_subaction_paths;
|
||||
const char **subaction_paths;
|
||||
/* Bindings for each subaction path. */
|
||||
uint32_t count_bindings;
|
||||
const GHOST_XrActionBindingInfo *bindings;
|
||||
} GHOST_XrActionProfileInfo;
|
||||
|
||||
|
@@ -961,6 +961,28 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_contexthandle,
|
||||
GHOST_XR_CAPI_CALL(xr_session->destroyActions(action_set_name, count, action_names), xr_context);
|
||||
}
|
||||
|
||||
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_contexthandle,
|
||||
const char *action_set_name,
|
||||
uint32_t count,
|
||||
const GHOST_XrActionSpaceInfo *infos)
|
||||
{
|
||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||
GHOST_XrSession *xr_session = xr_context->getSession();
|
||||
GHOST_XR_CAPI_CALL_RET(xr_session->createActionSpaces(action_set_name, count, infos),
|
||||
xr_context);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_contexthandle,
|
||||
const char *action_set_name,
|
||||
uint32_t count,
|
||||
const GHOST_XrActionSpaceInfo *infos)
|
||||
{
|
||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||
GHOST_XrSession *xr_session = xr_context->getSession();
|
||||
GHOST_XR_CAPI_CALL(xr_session->destroyActionSpaces(action_set_name, count, infos), xr_context);
|
||||
}
|
||||
|
||||
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
|
||||
const char *action_set_name,
|
||||
uint32_t count,
|
||||
@@ -976,14 +998,11 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
|
||||
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_contexthandle,
|
||||
const char *action_set_name,
|
||||
uint32_t count,
|
||||
const char *const *action_names,
|
||||
const char *const *profile_paths)
|
||||
const GHOST_XrActionProfileInfo *infos)
|
||||
{
|
||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||
GHOST_XrSession *xr_session = xr_context->getSession();
|
||||
GHOST_XR_CAPI_CALL(
|
||||
xr_session->destroyActionBindings(action_set_name, count, action_names, profile_paths),
|
||||
xr_context);
|
||||
GHOST_XR_CAPI_CALL(xr_session->destroyActionBindings(action_set_name, count, infos), xr_context);
|
||||
}
|
||||
|
||||
int GHOST_XrAttachActionSets(GHOST_XrContextHandle xr_contexthandle)
|
||||
@@ -1005,29 +1024,25 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_contexthandle, const char *acti
|
||||
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthandle,
|
||||
const char *action_set_name,
|
||||
const char *action_name,
|
||||
const char *subaction_path,
|
||||
const int64_t *duration,
|
||||
const float *frequency,
|
||||
const float *amplitude)
|
||||
{
|
||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||
GHOST_XrSession *xr_session = xr_context->getSession();
|
||||
GHOST_XR_CAPI_CALL_RET(
|
||||
xr_session->applyHapticAction(
|
||||
action_set_name, action_name, subaction_path, *duration, *frequency, *amplitude),
|
||||
xr_context);
|
||||
GHOST_XR_CAPI_CALL_RET(xr_session->applyHapticAction(
|
||||
action_set_name, action_name, *duration, *frequency, *amplitude),
|
||||
xr_context);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GHOST_XrStopHapticAction(GHOST_XrContextHandle xr_contexthandle,
|
||||
const char *action_set_name,
|
||||
const char *action_name,
|
||||
const char *subaction_path)
|
||||
const char *action_name)
|
||||
{
|
||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||
GHOST_XrSession *xr_session = xr_context->getSession();
|
||||
GHOST_XR_CAPI_CALL(xr_session->stopHapticAction(action_set_name, action_name, subaction_path),
|
||||
xr_context);
|
||||
GHOST_XR_CAPI_CALL(xr_session->stopHapticAction(action_set_name, action_name), xr_context);
|
||||
}
|
||||
|
||||
void *GHOST_XrGetActionSetCustomdata(GHOST_XrContextHandle xr_contexthandle,
|
||||
@@ -1050,23 +1065,4 @@ void *GHOST_XrGetActionCustomdata(GHOST_XrContextHandle xr_contexthandle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int GHOST_XrGetActionCount(GHOST_XrContextHandle xr_contexthandle,
|
||||
const char *action_set_name)
|
||||
{
|
||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||
GHOST_XrSession *xr_session = xr_context->getSession();
|
||||
GHOST_XR_CAPI_CALL_RET(xr_session->getActionCount(action_set_name), xr_context);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GHOST_XrGetActionCustomdataArray(GHOST_XrContextHandle xr_contexthandle,
|
||||
const char *action_set_name,
|
||||
void **r_customdata_array)
|
||||
{
|
||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||
GHOST_XrSession *xr_session = xr_context->getSession();
|
||||
GHOST_XR_CAPI_CALL(xr_session->getActionCustomdataArray(action_set_name, r_customdata_array),
|
||||
xr_context);
|
||||
}
|
||||
|
||||
#endif /* WITH_XR_OPENXR */
|
||||
|
@@ -132,7 +132,6 @@ class GHOST_SharedOpenGLResource {
|
||||
ID3D11DeviceContext *device_ctx,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
DXGI_FORMAT format,
|
||||
ID3D11RenderTargetView *render_target = nullptr)
|
||||
: m_device(device), m_device_ctx(device_ctx), m_cur_width(width), m_cur_height(height)
|
||||
{
|
||||
@@ -145,7 +144,7 @@ class GHOST_SharedOpenGLResource {
|
||||
|
||||
texDesc.Width = width;
|
||||
texDesc.Height = height;
|
||||
texDesc.Format = format;
|
||||
texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
texDesc.SampleDesc.Count = 1;
|
||||
texDesc.ArraySize = 1;
|
||||
texDesc.MipLevels = 1;
|
||||
@@ -322,10 +321,7 @@ class GHOST_SharedOpenGLResource {
|
||||
};
|
||||
|
||||
GHOST_SharedOpenGLResource *GHOST_ContextD3D::createSharedOpenGLResource(
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
DXGI_FORMAT format,
|
||||
ID3D11RenderTargetView *render_target)
|
||||
unsigned int width, unsigned int height, ID3D11RenderTargetView *render_target)
|
||||
{
|
||||
if (!(WGL_NV_DX_interop && WGL_NV_DX_interop2)) {
|
||||
fprintf(stderr,
|
||||
@@ -334,15 +330,14 @@ GHOST_SharedOpenGLResource *GHOST_ContextD3D::createSharedOpenGLResource(
|
||||
return nullptr;
|
||||
}
|
||||
GHOST_SharedOpenGLResource *shared_res = new GHOST_SharedOpenGLResource(
|
||||
m_device, m_device_ctx, width, height, format, render_target);
|
||||
m_device, m_device_ctx, width, height, render_target);
|
||||
|
||||
return shared_res;
|
||||
}
|
||||
GHOST_SharedOpenGLResource *GHOST_ContextD3D::createSharedOpenGLResource(unsigned int width,
|
||||
unsigned int height,
|
||||
DXGI_FORMAT format)
|
||||
unsigned int height)
|
||||
{
|
||||
return createSharedOpenGLResource(width, height, format, nullptr);
|
||||
return createSharedOpenGLResource(width, height, nullptr);
|
||||
}
|
||||
|
||||
void GHOST_ContextD3D::disposeSharedOpenGLResource(GHOST_SharedOpenGLResource *shared_res)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user