Compare commits
1 Commits
blender-v3
...
tmp-eevee-
Author | SHA1 | Date | |
---|---|---|---|
a60215f058 |
@@ -34,15 +34,6 @@ indent_style = space
|
||||
indent_size = 2
|
||||
max_line_length = 99
|
||||
|
||||
# Tom's Obvious Minimal Language
|
||||
[*.toml]
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
max_line_length = 120
|
||||
|
||||
# reStructuredText
|
||||
[*.rst]
|
||||
charset = utf-8
|
||||
|
@@ -439,9 +439,14 @@ endif()
|
||||
|
||||
# AMD HIP
|
||||
if(NOT APPLE)
|
||||
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" ON)
|
||||
if(WIN32)
|
||||
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" ON)
|
||||
else()
|
||||
option(WITH_CYCLES_DEVICE_HIP "Enable Cycles AMD HIP support" OFF)
|
||||
endif()
|
||||
|
||||
option(WITH_CYCLES_HIP_BINARIES "Build Cycles AMD HIP binaries" OFF)
|
||||
set(CYCLES_HIP_BINARIES_ARCH gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 gfx1035 CACHE STRING "AMD HIP architectures to build binaries for")
|
||||
set(CYCLES_HIP_BINARIES_ARCH gfx1010 gfx1011 gfx1012 gfx1030 gfx1031 gfx1032 gfx1034 CACHE STRING "AMD HIP architectures to build binaries for")
|
||||
mark_as_advanced(WITH_CYCLES_DEVICE_HIP)
|
||||
mark_as_advanced(CYCLES_HIP_BINARIES_ARCH)
|
||||
endif()
|
||||
@@ -486,7 +491,7 @@ if((UNIX AND NOT APPLE) OR (CMAKE_GENERATOR MATCHES "^Visual Studio.+"))
|
||||
endif()
|
||||
|
||||
option(WITH_BOOST "Enable features depending on boost" ON)
|
||||
option(WITH_TBB "Enable multithreading. TBB is also required for features such as Cycles, OpenVDB and USD" ON)
|
||||
option(WITH_TBB "Enable features depending on TBB (OpenVDB, OpenImageDenoise, sculpt multithreading)" ON)
|
||||
|
||||
# TBB malloc is only supported on for windows currently
|
||||
if(WIN32)
|
||||
@@ -806,9 +811,6 @@ set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENCOLORIO OFF)
|
||||
# Haru needs `TIFFFaxBlackCodes` & `TIFFFaxWhiteCodes` symbols from TIFF.
|
||||
set_and_warn_dependency(WITH_IMAGE_TIFF WITH_HARU OFF)
|
||||
|
||||
# USD needs OpenSubDiv, since that is used by the Cycles Hydra render delegate.
|
||||
set_and_warn_dependency(WITH_OPENSUBDIV WITH_USD OFF)
|
||||
|
||||
# auto enable openimageio for cycles
|
||||
if(WITH_CYCLES)
|
||||
set(WITH_OPENIMAGEIO ON)
|
||||
|
28
GNUmakefile
28
GNUmakefile
@@ -120,7 +120,7 @@ Utilities
|
||||
Updates git and all submodules but not svn.
|
||||
|
||||
* format:
|
||||
Format source code using clang-format & autopep8 (uses PATHS if passed in). For example::
|
||||
Format source code using clang (uses PATHS if passed in). For example::
|
||||
|
||||
make format PATHS="source/blender/blenlib source/blender/blenkernel"
|
||||
|
||||
@@ -130,7 +130,6 @@ Environment Variables
|
||||
* BUILD_DIR: Override default build path.
|
||||
* PYTHON: Use this for the Python command (used for checking tools).
|
||||
* NPROCS: Number of processes to use building (auto-detect when omitted).
|
||||
* AUTOPEP8: Command used for Python code-formatting (used for the format target).
|
||||
|
||||
Documentation Targets
|
||||
Not associated with building Blender.
|
||||
@@ -207,27 +206,6 @@ ifeq ($(OS_NCASE),darwin)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Set the LIBDIR, an empty string when not found.
|
||||
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU})
|
||||
ifeq (, $(LIBDIR))
|
||||
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_centos7_${CPU})
|
||||
endif
|
||||
ifeq (, $(LIBDIR))
|
||||
LIBDIR:=$(wildcard ../lib/${OS_NCASE})
|
||||
endif
|
||||
|
||||
# Use the autopep8 module in ../lib/ (which can be executed via Python directly).
|
||||
# Otherwise the "autopep8" command can be used.
|
||||
ifndef AUTOPEP8
|
||||
ifneq (, $(LIBDIR))
|
||||
AUTOPEP8:=$(wildcard $(LIBDIR)/python/lib/python3.10/site-packages/autopep8.py)
|
||||
endif
|
||||
ifeq (, $(AUTOPEP8))
|
||||
AUTOPEP8:=autopep8
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# additional targets for the build configuration
|
||||
|
||||
@@ -549,8 +527,8 @@ update_code: .FORCE
|
||||
@$(PYTHON) ./build_files/utils/make_update.py --no-libraries
|
||||
|
||||
format: .FORCE
|
||||
@PATH="${LIBDIR}/llvm/bin/:$(PATH)" $(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
|
||||
@$(PYTHON) source/tools/utils_maintenance/autopep8_format_paths.py --autopep8-command="$(AUTOPEP8)" $(PATHS)
|
||||
@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)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@@ -54,6 +54,9 @@ include(cmake/freetype.cmake)
|
||||
include(cmake/freeglut.cmake)
|
||||
include(cmake/glew.cmake)
|
||||
include(cmake/alembic.cmake)
|
||||
include(cmake/glfw.cmake)
|
||||
include(cmake/clew.cmake)
|
||||
include(cmake/cuew.cmake)
|
||||
include(cmake/opensubdiv.cmake)
|
||||
include(cmake/sdl.cmake)
|
||||
include(cmake/opencollada.cmake)
|
||||
|
12
build_files/build_environment/cmake/clew.cmake
Normal file
12
build_files/build_environment/cmake/clew.cmake
Normal file
@@ -0,0 +1,12 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
set(CLEW_EXTRA_ARGS)
|
||||
|
||||
ExternalProject_Add(external_clew
|
||||
URL file://${PACKAGE_DIR}/${CLEW_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${CLEW_HASH_TYPE}=${CLEW_HASH}
|
||||
PREFIX ${BUILD_DIR}/clew
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/clew -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${CLEW_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/clew
|
||||
)
|
13
build_files/build_environment/cmake/cuew.cmake
Normal file
13
build_files/build_environment/cmake/cuew.cmake
Normal file
@@ -0,0 +1,13 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
set(CUEW_EXTRA_ARGS)
|
||||
|
||||
ExternalProject_Add(external_cuew
|
||||
URL file://${PACKAGE_DIR}/${CUEW_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${CUEW_HASH_TYPE}=${CUEW_HASH}
|
||||
PREFIX ${BUILD_DIR}/cuew
|
||||
PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/cuew/src/external_cuew < ${PATCH_DIR}/cuew.diff
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/cuew -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${CUEW_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/cuew
|
||||
)
|
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
## Update and uncomment this in the release branch
|
||||
set(BLENDER_VERSION 3.2)
|
||||
# set(BLENDER_VERSION 3.1)
|
||||
|
||||
function(download_source dep)
|
||||
set(TARGET_FILE ${${dep}_FILE})
|
||||
@@ -39,6 +39,10 @@ download_source(FREETYPE)
|
||||
download_source(GLEW)
|
||||
download_source(FREEGLUT)
|
||||
download_source(ALEMBIC)
|
||||
download_source(GLFW)
|
||||
download_source(CLEW)
|
||||
download_source(GLFW)
|
||||
download_source(CUEW)
|
||||
download_source(OPENSUBDIV)
|
||||
download_source(SDL)
|
||||
download_source(OPENCOLLADA)
|
||||
|
12
build_files/build_environment/cmake/glfw.cmake
Normal file
12
build_files/build_environment/cmake/glfw.cmake
Normal file
@@ -0,0 +1,12 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
set(GLFW_EXTRA_ARGS)
|
||||
|
||||
ExternalProject_Add(external_glfw
|
||||
URL file://${PACKAGE_DIR}/${GLFW_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${GLFW_HASH_TYPE}=${GLFW_HASH}
|
||||
PREFIX ${BUILD_DIR}/glfw
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/glfw -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${GLFW_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/glfw
|
||||
)
|
@@ -87,7 +87,7 @@ harvest(jpeg/lib jpeg/lib "libjpeg.a")
|
||||
harvest(lame/lib ffmpeg/lib "*.a")
|
||||
if(NOT APPLE)
|
||||
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
|
||||
harvest(level-zero/lib level-zero/lib "*.so*")
|
||||
harvest(level-zero/lib level-zero/lib "*.a")
|
||||
endif()
|
||||
harvest(llvm/bin llvm/bin "clang-format")
|
||||
if(BUILD_CLANG_TOOLS)
|
||||
@@ -146,8 +146,8 @@ harvest(openjpeg/lib openjpeg/lib "*.a")
|
||||
harvest(opensubdiv/include opensubdiv/include "*.h")
|
||||
harvest(opensubdiv/lib opensubdiv/lib "*.a")
|
||||
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
|
||||
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
|
||||
harvest(openvdb/lib openvdb/lib "*.a")
|
||||
harvest(nanovdb/nanovdb nanovdb/include/nanovdb "*.h")
|
||||
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
|
||||
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
|
||||
harvest(osl/bin osl/bin "oslc")
|
||||
|
@@ -53,8 +53,7 @@ add_dependencies(
|
||||
external_opencolorio
|
||||
external_yamlcpp
|
||||
external_expat
|
||||
external_imath
|
||||
external_pystring
|
||||
external_openexr
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
|
@@ -10,16 +10,20 @@ set(OPENSUBDIV_EXTRA_ARGS
|
||||
-DNO_OMP=ON
|
||||
-DNO_TBB=OFF
|
||||
-DNO_CUDA=ON
|
||||
-DNO_OPENCL=ON
|
||||
-DNO_CLEW=ON
|
||||
-DNO_OPENCL=OFF
|
||||
-DNO_CLEW=OFF
|
||||
-DNO_OPENGL=OFF
|
||||
-DNO_METAL=OFF
|
||||
-DNO_DX=ON
|
||||
-DNO_TESTS=ON
|
||||
-DNO_GLTESTS=ON
|
||||
-DNO_GLEW=ON
|
||||
-DNO_GLFW=ON
|
||||
-DNO_GLEW=OFF
|
||||
-DNO_GLFW=OFF
|
||||
-DNO_GLFW_X11=ON
|
||||
-DGLEW_INCLUDE_DIR=${LIBDIR}/glew/include
|
||||
-DGLEW_LIBRARY=${LIBDIR}/glew/lib/libGLEW${LIBEXT}
|
||||
-DGLFW_INCLUDE_DIR=${LIBDIR}/glfw/include
|
||||
-DGLFW_LIBRARIES=${LIBDIR}/glfw/lib/glfw3${LIBEXT}
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
@@ -27,12 +31,19 @@ if(WIN32)
|
||||
${OPENSUBDIV_EXTRA_ARGS}
|
||||
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
|
||||
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/tbb.lib
|
||||
-DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/CL
|
||||
-DCLEW_LIBRARY=${LIBDIR}/clew/lib/clew${LIBEXT}
|
||||
-DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include
|
||||
-DCUEW_LIBRARY=${LIBDIR}/cuew/lib/cuew${LIBEXT}
|
||||
)
|
||||
else()
|
||||
set(OPENSUBDIV_EXTRA_ARGS
|
||||
${OPENSUBDIV_EXTRA_ARGS}
|
||||
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
|
||||
-DTBB_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
|
||||
-DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include
|
||||
-DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/CL
|
||||
-DCLEW_LIBRARY=${LIBDIR}/clew/lib/static/${LIBPREFIX}clew${LIBEXT}
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -64,5 +75,9 @@ endif()
|
||||
|
||||
add_dependencies(
|
||||
external_opensubdiv
|
||||
external_glew
|
||||
external_glfw
|
||||
external_clew
|
||||
external_cuew
|
||||
external_tbb
|
||||
)
|
||||
|
@@ -15,7 +15,7 @@ ExternalProject_Add(external_python_site_packages
|
||||
CONFIGURE_COMMAND ${PIP_CONFIGURE_COMMAND}
|
||||
BUILD_COMMAND ""
|
||||
PREFIX ${BUILD_DIR}/site_packages
|
||||
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} autopep8==${AUTOPEP8_VERSION} pycodestyle==${PYCODESTYLE_VERSION} toml==${TOML_VERSION} --no-binary :all:
|
||||
INSTALL_COMMAND ${PYTHON_BINARY} -m pip install --no-cache-dir ${SITE_PACKAGES_EXTRA} cython==${CYTHON_VERSION} idna==${IDNA_VERSION} charset-normalizer==${CHARSET_NORMALIZER_VERSION} urllib3==${URLLIB3_VERSION} certifi==${CERTIFI_VERSION} requests==${REQUESTS_VERSION} zstandard==${ZSTANDARD_VERSION} --no-binary :all:
|
||||
)
|
||||
|
||||
if(USE_PIP_NUMPY)
|
||||
|
@@ -11,3 +11,12 @@ ExternalProject_Add(external_robinmap
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/robinmap ${DEFAULT_CMAKE_FLAGS} ${ROBINMAP_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/robinmap
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
ExternalProject_Add_Step(external_robinmap after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/zstd/include/ ${HARVEST_TARGET}/zstd/include/
|
||||
DEPENDEES install
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -25,6 +25,7 @@ set(USD_EXTRA_ARGS
|
||||
-DOpenImageIO_ROOT=${LIBDIR}/openimageio
|
||||
-DOPENEXR_LIBRARIES=${LIBDIR}/imath/lib/imath${OPENEXR_VERSION_POSTFIX}${LIBEXT}
|
||||
-DOPENEXR_INCLUDE_DIR=${LIBDIR}/imath/include
|
||||
-DOSL_ROOT=${LIBDIR}/osl
|
||||
-DPXR_ENABLE_PYTHON_SUPPORT=OFF
|
||||
-DPXR_BUILD_IMAGING=ON
|
||||
-DPXR_BUILD_TESTS=OFF
|
||||
@@ -35,22 +36,8 @@ set(USD_EXTRA_ARGS
|
||||
-DPXR_ENABLE_OPENVDB_SUPPORT=OFF
|
||||
-DPYTHON_EXECUTABLE=${PYTHON_BINARY}
|
||||
-DPXR_BUILD_MONOLITHIC=ON
|
||||
# OSL is an optional dependency of the Imaging module. However, since that
|
||||
# module was included for its support for converting primitive shapes (sphere,
|
||||
# cube, etc.) to geometry, it's not necessary. Disabling it will make it
|
||||
# simpler to build Blender; currently only Cycles uses OSL.
|
||||
-DPXR_ENABLE_OSL_SUPPORT=OFF
|
||||
# GL support on Linux also links to X11 libraries. Enabling it would break
|
||||
# headless or Wayland-only builds. OpenGL support would be useful if someone
|
||||
# wants to work on a Hydra viewport in Blender; when that's actually being
|
||||
# worked on, we could patch in a new PXR_ENABLE_X11_SUPPORT option (to
|
||||
# separate OpenGL from X11) and contribute it upstream.
|
||||
-DPXR_ENABLE_GL_SUPPORT=OFF
|
||||
# Disable Metal since USD fails to build this when OpenGL is disabled.
|
||||
-DPXR_ENABLE_METAL_SUPPORT=OFF
|
||||
# OIIO is used for loading image textures in Hydra Storm / Embree renderers,
|
||||
# which we don't use.
|
||||
-DPXR_BUILD_OPENIMAGEIO_PLUGIN=OFF
|
||||
-DPXR_ENABLE_OSL_SUPPORT=ON
|
||||
-DPXR_BUILD_OPENIMAGEIO_PLUGIN=ON
|
||||
# USD 22.03 does not support OCIO 2.x
|
||||
# Tracking ticket https://github.com/PixarAnimationStudios/USD/issues/1386
|
||||
-DPXR_BUILD_OPENCOLORIO_PLUGIN=OFF
|
||||
@@ -83,7 +70,9 @@ add_dependencies(
|
||||
external_usd
|
||||
external_tbb
|
||||
external_boost
|
||||
external_openimageio
|
||||
external_opensubdiv
|
||||
external_osl
|
||||
)
|
||||
|
||||
# Since USD 21.11 the libraries are prefixed with "usd_", i.e. "libusd_m.a" became "libusd_usd_m.a".
|
||||
|
@@ -98,6 +98,27 @@ set(ALEMBIC_HASH 2cd8d6e5a3ac4a014e24a4b04f4fadf9)
|
||||
set(ALEMBIC_HASH_TYPE MD5)
|
||||
set(ALEMBIC_FILE alembic-${ALEMBIC_VERSION}.tar.gz)
|
||||
|
||||
# hash is for 3.1.2
|
||||
set(GLFW_GIT_UID 30306e54705c3adae9fe082c816a3be71963485c)
|
||||
set(GLFW_URI https://github.com/glfw/glfw/archive/${GLFW_GIT_UID}.zip)
|
||||
set(GLFW_HASH 20cacb1613da7eeb092f3ac4f6b2b3d0)
|
||||
set(GLFW_HASH_TYPE MD5)
|
||||
set(GLFW_FILE glfw-${GLFW_GIT_UID}.zip)
|
||||
|
||||
# latest uid in git as of 2016-04-01
|
||||
set(CLEW_GIT_UID 277db43f6cafe8b27c6f1055f69dc67da4aeb299)
|
||||
set(CLEW_URI https://github.com/OpenCLWrangler/clew/archive/${CLEW_GIT_UID}.zip)
|
||||
set(CLEW_HASH 2c699d10ed78362e71f56fae2a4c5f98)
|
||||
set(CLEW_HASH_TYPE MD5)
|
||||
set(CLEW_FILE clew-${CLEW_GIT_UID}.zip)
|
||||
|
||||
# latest uid in git as of 2016-04-01
|
||||
set(CUEW_GIT_UID 1744972026de9cf27c8a7dc39cf39cd83d5f922f)
|
||||
set(CUEW_URI https://github.com/CudaWrangler/cuew/archive/${CUEW_GIT_UID}.zip)
|
||||
set(CUEW_HASH 86760d62978ebfd96cd93f5aa1abaf4a)
|
||||
set(CUEW_HASH_TYPE MD5)
|
||||
set(CUEW_FILE cuew-${CUEW_GIT_UID}.zip)
|
||||
|
||||
set(OPENSUBDIV_VERSION v3_4_4)
|
||||
set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.tar.gz)
|
||||
set(OPENSUBDIV_HASH 39ecc5caf0abebc943d1ce131855e76e)
|
||||
@@ -204,9 +225,6 @@ set(CYTHON_VERSION 0.29.26)
|
||||
# The version of the zstd library used to build the Python package should match ZSTD_VERSION defined below.
|
||||
# At this time of writing, 0.17.0 was already released, but built against zstd 1.5.1, while we use 1.5.0.
|
||||
set(ZSTANDARD_VERSION 0.16.0)
|
||||
set(AUTOPEP8_VERSION 1.6.0)
|
||||
set(PYCODESTYLE_VERSION 2.8.0)
|
||||
set(TOML_VERSION 0.10.2)
|
||||
|
||||
set(NUMPY_VERSION 1.22.0)
|
||||
set(NUMPY_SHORT_VERSION 1.22)
|
||||
|
@@ -37,6 +37,10 @@ graph[autosize = false, size = "25.7,8.3!", resolution = 300, overlap = false, s
|
||||
external_openimageio -- external_webp;
|
||||
external_openimageio -- external_opencolorio_extra;
|
||||
external_openmp -- external_clang;
|
||||
external_opensubdiv -- external_glew;
|
||||
external_opensubdiv -- external_glfw;
|
||||
external_opensubdiv -- external_clew;
|
||||
external_opensubdiv -- external_cuew;
|
||||
external_opensubdiv -- external_tbb;
|
||||
openvdb -- external_tbb;
|
||||
openvdb -- external_boost;
|
||||
|
@@ -453,7 +453,7 @@ TBB_VERSION="2020"
|
||||
TBB_VERSION_SHORT="2020"
|
||||
TBB_VERSION_UPDATE="_U3" # Used for source packages...
|
||||
TBB_VERSION_MIN="2018"
|
||||
TBB_VERSION_MEX="2021" # 2021 introduces 'oneTBB', which has lots of compatibility breakage with previous versions
|
||||
TBB_VERSION_MEX="2022"
|
||||
TBB_FORCE_BUILD=false
|
||||
TBB_FORCE_REBUILD=false
|
||||
TBB_SKIP=false
|
||||
@@ -539,10 +539,10 @@ ALEMBIC_FORCE_BUILD=false
|
||||
ALEMBIC_FORCE_REBUILD=false
|
||||
ALEMBIC_SKIP=false
|
||||
|
||||
USD_VERSION="22.03"
|
||||
USD_VERSION_SHORT="22.03"
|
||||
USD_VERSION="21.02"
|
||||
USD_VERSION_SHORT="21.02"
|
||||
USD_VERSION_MIN="20.05"
|
||||
USD_VERSION_MEX="23.00"
|
||||
USD_VERSION_MEX="22.00"
|
||||
USD_FORCE_BUILD=false
|
||||
USD_FORCE_REBUILD=false
|
||||
USD_SKIP=false
|
||||
@@ -1647,7 +1647,7 @@ compile_TBB() {
|
||||
fi
|
||||
|
||||
# To be changed each time we make edits that would modify the compiled result!
|
||||
tbb_magic=1
|
||||
tbb_magic=0
|
||||
_init_tbb
|
||||
|
||||
# Force having own builds for the dependencies.
|
||||
@@ -2656,10 +2656,10 @@ compile_OSD() {
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cmake_d="-D CMAKE_BUILD_TYPE=Release"
|
||||
if [ -d $INST/tbb ]; then
|
||||
cmake_d="$cmake_d -D TBB_LOCATION=$INST/tbb"
|
||||
cmake_d="$cmake_d $cmake_d -D TBB_LOCATION=$INST/tbb"
|
||||
fi
|
||||
cmake_d="-D CMAKE_BUILD_TYPE=Release"
|
||||
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
|
||||
# ptex is only needed when nicholas bishop is ready
|
||||
cmake_d="$cmake_d -D NO_PTEX=1"
|
||||
@@ -3286,7 +3286,7 @@ compile_Embree() {
|
||||
fi
|
||||
|
||||
# To be changed each time we make edits that would modify the compiled results!
|
||||
embree_magic=11
|
||||
embree_magic=10
|
||||
_init_embree
|
||||
|
||||
# Force having own builds for the dependencies.
|
||||
@@ -3346,7 +3346,7 @@ compile_Embree() {
|
||||
|
||||
cmake_d="$cmake_d -D EMBREE_TASKING_SYSTEM=TBB"
|
||||
if [ -d $INST/tbb ]; then
|
||||
cmake_d="$cmake_d -D EMBREE_TBB_ROOT=$INST/tbb"
|
||||
make_d="$make_d EMBREE_TBB_ROOT=$INST/tbb"
|
||||
fi
|
||||
|
||||
cmake $cmake_d ../
|
||||
@@ -3485,7 +3485,7 @@ compile_OIDN() {
|
||||
install_ISPC
|
||||
|
||||
# To be changed each time we make edits that would modify the compiled results!
|
||||
oidn_magic=10
|
||||
oidn_magic=9
|
||||
_init_oidn
|
||||
|
||||
# Force having own builds for the dependencies.
|
||||
@@ -3541,7 +3541,7 @@ compile_OIDN() {
|
||||
cmake_d="$cmake_d -D ISPC_DIR_HINT=$_ispc_path_bin"
|
||||
|
||||
if [ -d $INST/tbb ]; then
|
||||
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
|
||||
make_d="$make_d TBB_ROOT=$INST/tbb"
|
||||
fi
|
||||
|
||||
cmake $cmake_d ../
|
||||
|
26
build_files/build_environment/patches/cuew.diff
Normal file
26
build_files/build_environment/patches/cuew.diff
Normal file
@@ -0,0 +1,26 @@
|
||||
--- CmakeLists.txt.orig 2015-12-31 03:46:41 -0700
|
||||
+++ CMakeLists.txt 2016-04-01 13:28:33 -0600
|
||||
@@ -22,3 +22,10 @@
|
||||
|
||||
add_executable(testcuew cuewTest/cuewTest.c include/cuew.h)
|
||||
target_link_libraries(testcuew cuew ${CMAKE_DL_LIBS})
|
||||
+
|
||||
+install(TARGETS cuew
|
||||
+ LIBRARY DESTINATION lib COMPONENT libraries
|
||||
+ ARCHIVE DESTINATION lib/static COMPONENT libraries)
|
||||
+
|
||||
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/cuew.h
|
||||
+ DESTINATION include/)
|
||||
\ No newline at end of file
|
||||
--- src/cuew.c 2016-04-01 13:41:43 -0600
|
||||
+++ src/cuew.c 2016-04-01 13:41:11 -0600
|
||||
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
+#if _MSC_VER < 1900
|
||||
# define snprintf _snprintf
|
||||
+#endif
|
||||
# define popen _popen
|
||||
# define pclose _pclose
|
||||
# define _CRT_SECURE_NO_WARNINGS
|
374
build_files/build_environment/patches/nanovdb.diff
Normal file
374
build_files/build_environment/patches/nanovdb.diff
Normal file
@@ -0,0 +1,374 @@
|
||||
Index: nanovdb/nanovdb/NanoVDB.h
|
||||
===================================================================
|
||||
--- a/nanovdb/nanovdb/NanoVDB.h (revision 62751)
|
||||
+++ b/nanovdb/nanovdb/NanoVDB.h (working copy)
|
||||
@@ -152,8 +152,8 @@
|
||||
|
||||
#endif // __CUDACC_RTC__
|
||||
|
||||
-#ifdef __CUDACC__
|
||||
-// Only define __hostdev__ when using NVIDIA CUDA compiler
|
||||
+#if defined(__CUDACC__) || defined(__HIP__)
|
||||
+// Only define __hostdev__ when using NVIDIA CUDA or HIP compiler
|
||||
#define __hostdev__ __host__ __device__
|
||||
#else
|
||||
#define __hostdev__
|
||||
@@ -461,7 +461,7 @@
|
||||
/// Maximum floating-point values
|
||||
template<typename T>
|
||||
struct Maximum;
|
||||
-#ifdef __CUDA_ARCH__
|
||||
+#if defined(__CUDA_ARCH__) || defined(__HIP__)
|
||||
template<>
|
||||
struct Maximum<int>
|
||||
{
|
||||
@@ -1006,10 +1006,10 @@
|
||||
using Vec3i = Vec3<int>;
|
||||
|
||||
/// @brief Return a single precision floating-point vector of this coordinate
|
||||
-Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
|
||||
+inline __hostdev__ Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
|
||||
|
||||
/// @brief Return a double precision floating-point vector of this coordinate
|
||||
-Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
|
||||
+inline __hostdev__ Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
|
||||
|
||||
// ----------------------------> Vec4 <--------------------------------------
|
||||
|
||||
@@ -1820,7 +1820,7 @@
|
||||
}; // Map
|
||||
|
||||
template<typename Mat4T>
|
||||
-void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
|
||||
+__hostdev__ void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
|
||||
{
|
||||
float * mf = mMatF, *vf = mVecF;
|
||||
float* mif = mInvMatF;
|
||||
@@ -2170,7 +2170,7 @@
|
||||
}; // Class Grid
|
||||
|
||||
template<typename TreeT>
|
||||
-int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
|
||||
+__hostdev__ int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
|
||||
{
|
||||
for (uint32_t i = 0, n = blindDataCount(); i < n; ++i)
|
||||
if (blindMetaData(i).mSemantic == semantic)
|
||||
@@ -2328,7 +2328,7 @@
|
||||
}; // Tree class
|
||||
|
||||
template<typename RootT>
|
||||
-void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
|
||||
+__hostdev__ void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
|
||||
{
|
||||
min = this->root().valueMin();
|
||||
max = this->root().valueMax();
|
||||
@@ -2336,7 +2336,7 @@
|
||||
|
||||
template<typename RootT>
|
||||
template<typename NodeT>
|
||||
-const NodeT* Tree<RootT>::getNode(uint32_t i) const
|
||||
+__hostdev__ const NodeT* Tree<RootT>::getNode(uint32_t i) const
|
||||
{
|
||||
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNode: unvalid node type");
|
||||
NANOVDB_ASSERT(i < DataType::mCount[NodeT::LEVEL]);
|
||||
@@ -2345,7 +2345,7 @@
|
||||
|
||||
template<typename RootT>
|
||||
template<int LEVEL>
|
||||
-const typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i) const
|
||||
+__hostdev__ const typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i) const
|
||||
{
|
||||
NANOVDB_ASSERT(i < DataType::mCount[LEVEL]);
|
||||
return reinterpret_cast<const TreeNodeT<LEVEL>*>(reinterpret_cast<const uint8_t*>(this) + DataType::mBytes[LEVEL]) + i;
|
||||
@@ -2353,7 +2353,7 @@
|
||||
|
||||
template<typename RootT>
|
||||
template<typename NodeT>
|
||||
-NodeT* Tree<RootT>::getNode(uint32_t i)
|
||||
+__hostdev__ NodeT* Tree<RootT>::getNode(uint32_t i)
|
||||
{
|
||||
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNode: invalid node type");
|
||||
NANOVDB_ASSERT(i < DataType::mCount[NodeT::LEVEL]);
|
||||
@@ -2362,7 +2362,7 @@
|
||||
|
||||
template<typename RootT>
|
||||
template<int LEVEL>
|
||||
-typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i)
|
||||
+__hostdev__ typename TreeNode<Tree<RootT>, LEVEL>::type* Tree<RootT>::getNode(uint32_t i)
|
||||
{
|
||||
NANOVDB_ASSERT(i < DataType::mCount[LEVEL]);
|
||||
return reinterpret_cast<TreeNodeT<LEVEL>*>(reinterpret_cast<uint8_t*>(this) + DataType::mBytes[LEVEL]) + i;
|
||||
@@ -2370,7 +2370,7 @@
|
||||
|
||||
template<typename RootT>
|
||||
template<typename NodeT>
|
||||
-uint32_t Tree<RootT>::getNodeID(const NodeT& node) const
|
||||
+__hostdev__ uint32_t Tree<RootT>::getNodeID(const NodeT& node) const
|
||||
{
|
||||
static_assert(is_same<TreeNodeT<NodeT::LEVEL>, NodeT>::value, "Tree::getNodeID: invalid node type");
|
||||
const NodeT* first = reinterpret_cast<const NodeT*>(reinterpret_cast<const uint8_t*>(this) + DataType::mBytes[NodeT::LEVEL]);
|
||||
@@ -2380,7 +2380,7 @@
|
||||
|
||||
template<typename RootT>
|
||||
template<typename NodeT>
|
||||
-uint32_t Tree<RootT>::getLinearOffset(const NodeT& node) const
|
||||
+__hostdev__ uint32_t Tree<RootT>::getLinearOffset(const NodeT& node) const
|
||||
{
|
||||
return this->getNodeID(node) + DataType::mPFSum[NodeT::LEVEL];
|
||||
}
|
||||
@@ -3366,7 +3366,7 @@
|
||||
}; // LeafNode class
|
||||
|
||||
template<typename ValueT, typename CoordT, template<uint32_t> class MaskT, uint32_t LOG2DIM>
|
||||
-inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
|
||||
+inline __hostdev__ void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
|
||||
{
|
||||
static_assert(LOG2DIM == 3, "LeafNode::updateBBox: only supports LOGDIM = 3!");
|
||||
if (!this->isActive()) return;
|
||||
Index: nanovdb/nanovdb/util/SampleFromVoxels.h
|
||||
===================================================================
|
||||
--- a/nanovdb/nanovdb/util/SampleFromVoxels.h (revision 62751)
|
||||
+++ b/nanovdb/nanovdb/util/SampleFromVoxels.h (working copy)
|
||||
@@ -22,7 +22,7 @@
|
||||
#define NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED
|
||||
|
||||
// Only define __hostdev__ when compiling as NVIDIA CUDA
|
||||
-#ifdef __CUDACC__
|
||||
+#if defined(__CUDACC__) || defined(__HIP__)
|
||||
#define __hostdev__ __host__ __device__
|
||||
#else
|
||||
#include <cmath> // for floor
|
||||
@@ -136,7 +136,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
|
||||
{
|
||||
const CoordT ijk = Round<CoordT>(xyz);
|
||||
if (ijk != mPos) {
|
||||
@@ -147,7 +147,7 @@
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
|
||||
{
|
||||
if (ijk != mPos) {
|
||||
mPos = ijk;
|
||||
@@ -158,7 +158,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
|
||||
{
|
||||
return mAcc.getValue(Round<CoordT>(xyz));
|
||||
}
|
||||
@@ -195,7 +195,7 @@
|
||||
}; // TrilinearSamplerBase
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
|
||||
+__hostdev__ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
|
||||
{
|
||||
v[0][0][0] = mAcc.getValue(ijk); // i, j, k
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
|
||||
+__hostdev__ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
|
||||
{
|
||||
#if 0
|
||||
auto lerp = [](ValueT a, ValueT b, ValueT w){ return fma(w, b-a, a); };// = w*(b-a) + a
|
||||
@@ -239,7 +239,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
|
||||
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
|
||||
{
|
||||
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::gradient requires a floating-point type");
|
||||
#if 0
|
||||
@@ -270,7 +270,7 @@
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
|
||||
+__hostdev__ bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
|
||||
{
|
||||
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
|
||||
const bool less = v[0][0][0] < ValueT(0);
|
||||
@@ -363,7 +363,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
this->cache(xyz);
|
||||
return BaseT::sample(xyz, mVal);
|
||||
@@ -370,7 +370,7 @@
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
|
||||
{
|
||||
return ijk == mPos ? mVal[0][0][0] : BaseT::mAcc.getValue(ijk);
|
||||
}
|
||||
@@ -377,7 +377,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
|
||||
{
|
||||
this->cache(xyz);
|
||||
return BaseT::gradient(xyz, mVal);
|
||||
@@ -393,7 +393,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
|
||||
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
|
||||
{
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
if (ijk != mPos) {
|
||||
@@ -406,7 +406,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
ValueT val[2][2][2];
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
@@ -418,7 +418,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
auto lerp = [](ValueT a, ValueT b, RealT w) { return a + ValueT(w) * (b - a); };
|
||||
|
||||
@@ -463,7 +463,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
|
||||
+inline __hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
|
||||
{
|
||||
ValueT val[2][2][2];
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
@@ -473,7 +473,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
|
||||
{
|
||||
ValueT val[2][2][2];
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
@@ -510,7 +510,7 @@
|
||||
}; // TriquadraticSamplerBase
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
|
||||
+__hostdev__ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
|
||||
{
|
||||
CoordT p(ijk[0] - 1, 0, 0);
|
||||
for (int dx = 0; dx < 3; ++dx, ++p[0]) {
|
||||
@@ -526,7 +526,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
|
||||
+__hostdev__ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
|
||||
{
|
||||
auto kernel = [](const ValueT* value, double weight)->ValueT {
|
||||
return weight * (weight * (0.5f * (value[0] + value[2]) - value[1]) +
|
||||
@@ -545,7 +545,7 @@
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
|
||||
+__hostdev__ bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
|
||||
{
|
||||
static_assert(std::is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
|
||||
const bool less = v[0][0][0] < ValueT(0);
|
||||
@@ -624,7 +624,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
this->cache(xyz);
|
||||
return BaseT::sample(xyz, mVal);
|
||||
@@ -631,7 +631,7 @@
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
|
||||
{
|
||||
return ijk == mPos ? mVal[1][1][1] : BaseT::mAcc.getValue(ijk);
|
||||
}
|
||||
@@ -646,7 +646,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
|
||||
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
|
||||
{
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
if (ijk != mPos) {
|
||||
@@ -657,7 +657,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
ValueT val[3][3][3];
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
@@ -667,7 +667,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
|
||||
{
|
||||
ValueT val[3][3][3];
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
@@ -710,7 +710,7 @@
|
||||
}; // TricubicSampler
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
|
||||
+__hostdev__ void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
|
||||
{
|
||||
auto fetch = [&](int i, int j, int k) -> ValueT& { return C[((i + 1) << 4) + ((j + 1) << 2) + k + 1]; };
|
||||
|
||||
@@ -929,7 +929,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
this->cache(xyz);
|
||||
return BaseT::sample(xyz, mC);
|
||||
@@ -937,7 +937,7 @@
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
|
||||
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
|
||||
{
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
if (ijk != mPos) {
|
@@ -99,321 +99,3 @@ diff -Naur openvdb-8.0.0/openvdb/openvdb/version.rc.in openvdb/openvdb/openvdb/v
|
||||
+
|
||||
+ END
|
||||
+END
|
||||
diff --git a/nanovdb/nanovdb/NanoVDB.h b/nanovdb/nanovdb/NanoVDB.h
|
||||
index cc2e54b77..703d2eabc 100644
|
||||
--- a/nanovdb/nanovdb/NanoVDB.h
|
||||
+++ b/nanovdb/nanovdb/NanoVDB.h
|
||||
@@ -161,8 +161,8 @@ typedef unsigned long long uint64_t;
|
||||
|
||||
#endif // __CUDACC_RTC__
|
||||
|
||||
-#ifdef __CUDACC__
|
||||
-// Only define __hostdev__ when using NVIDIA CUDA compiler
|
||||
+#if defined(__CUDACC__) || defined(__HIP__)
|
||||
+// Only define __hostdev__ when using NVIDIA CUDA or HIP compiler
|
||||
#define __hostdev__ __host__ __device__
|
||||
#else
|
||||
#define __hostdev__
|
||||
@@ -611,7 +611,7 @@ struct Delta<double>
|
||||
/// Maximum floating-point values
|
||||
template<typename T>
|
||||
struct Maximum;
|
||||
-#ifdef __CUDA_ARCH__
|
||||
+#if defined(__CUDA_ARCH__) || defined(__HIP__)
|
||||
template<>
|
||||
struct Maximum<int>
|
||||
{
|
||||
@@ -1176,10 +1176,10 @@ using Vec3f = Vec3<float>;
|
||||
using Vec3i = Vec3<int>;
|
||||
|
||||
/// @brief Return a single precision floating-point vector of this coordinate
|
||||
-Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
|
||||
+__hostdev__ inline Vec3f Coord::asVec3s() const { return Vec3f(float(mVec[0]), float(mVec[1]), float(mVec[2])); }
|
||||
|
||||
/// @brief Return a double precision floating-point vector of this coordinate
|
||||
-Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
|
||||
+__hostdev__ inline Vec3d Coord::asVec3d() const { return Vec3d(double(mVec[0]), double(mVec[1]), double(mVec[2])); }
|
||||
|
||||
// ----------------------------> Vec4 <--------------------------------------
|
||||
|
||||
@@ -2042,7 +2042,7 @@ struct Map
|
||||
}; // Map
|
||||
|
||||
template<typename Mat4T>
|
||||
-void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
|
||||
+__hostdev__ void Map::set(const Mat4T& mat, const Mat4T& invMat, double taper)
|
||||
{
|
||||
float * mf = mMatF, *vf = mVecF;
|
||||
float* mif = mInvMatF;
|
||||
@@ -2486,7 +2486,7 @@ class Grid : private GridData
|
||||
}; // Class Grid
|
||||
|
||||
template<typename TreeT>
|
||||
-int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
|
||||
+__hostdev__ int Grid<TreeT>::findBlindDataForSemantic(GridBlindDataSemantic semantic) const
|
||||
{
|
||||
for (uint32_t i = 0, n = this->blindDataCount(); i < n; ++i)
|
||||
if (this->blindMetaData(i).mSemantic == semantic)
|
||||
@@ -2671,7 +2671,7 @@ class Tree : private TreeData<RootT::LEVEL>
|
||||
}; // Tree class
|
||||
|
||||
template<typename RootT>
|
||||
-void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
|
||||
+__hostdev__ void Tree<RootT>::extrema(ValueType& min, ValueType& max) const
|
||||
{
|
||||
min = this->root().minimum();
|
||||
max = this->root().maximum();
|
||||
@@ -3880,7 +3880,7 @@ class LeafNode : private LeafData<BuildT, CoordT, MaskT, Log2Dim>
|
||||
}; // LeafNode class
|
||||
|
||||
template<typename ValueT, typename CoordT, template<uint32_t> class MaskT, uint32_t LOG2DIM>
|
||||
-inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
|
||||
+__hostdev__ inline void LeafNode<ValueT, CoordT, MaskT, LOG2DIM>::updateBBox()
|
||||
{
|
||||
static_assert(LOG2DIM == 3, "LeafNode::updateBBox: only supports LOGDIM = 3!");
|
||||
if (!this->isActive()) return;
|
||||
diff --git a/nanovdb/nanovdb/util/SampleFromVoxels.h b/nanovdb/nanovdb/util/SampleFromVoxels.h
|
||||
index 852123dac..e779d66cf 100644
|
||||
--- a/nanovdb/nanovdb/util/SampleFromVoxels.h
|
||||
+++ b/nanovdb/nanovdb/util/SampleFromVoxels.h
|
||||
@@ -22,7 +22,7 @@
|
||||
#define NANOVDB_SAMPLE_FROM_VOXELS_H_HAS_BEEN_INCLUDED
|
||||
|
||||
// Only define __hostdev__ when compiling as NVIDIA CUDA
|
||||
-#ifdef __CUDACC__
|
||||
+#if defined(__CUDACC__) || defined(__HIP__)
|
||||
#define __hostdev__ __host__ __device__
|
||||
#else
|
||||
#include <cmath> // for floor
|
||||
@@ -136,7 +136,7 @@ class SampleFromVoxels<TreeOrAccT, 0, false>
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const Vec3T& xyz) const
|
||||
{
|
||||
const CoordT ijk = Round<CoordT>(xyz);
|
||||
if (ijk != mPos) {
|
||||
@@ -147,7 +147,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()(const CoordT& ijk) const
|
||||
{
|
||||
if (ijk != mPos) {
|
||||
mPos = ijk;
|
||||
@@ -158,7 +158,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, true>::operator()
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 0, false>::operator()(const Vec3T& xyz) const
|
||||
{
|
||||
return mAcc.getValue(Round<CoordT>(xyz));
|
||||
}
|
||||
@@ -195,7 +195,7 @@ class TrilinearSampler
|
||||
}; // TrilinearSamplerBase
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
|
||||
+__hostdev__ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) const
|
||||
{
|
||||
v[0][0][0] = mAcc.getValue(ijk); // i, j, k
|
||||
|
||||
@@ -224,7 +224,7 @@ void TrilinearSampler<TreeOrAccT>::stencil(CoordT& ijk, ValueT (&v)[2][2][2]) co
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
|
||||
+__hostdev__ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
|
||||
{
|
||||
#if 0
|
||||
auto lerp = [](ValueT a, ValueT b, ValueT w){ return fma(w, b-a, a); };// = w*(b-a) + a
|
||||
@@ -239,7 +239,7 @@ typename TreeOrAccT::ValueType TrilinearSampler<TreeOrAccT>::sample(const Vec3T<
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
|
||||
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(const Vec3T<RealT> &uvw, const ValueT (&v)[2][2][2])
|
||||
{
|
||||
static_assert(is_floating_point<ValueT>::value, "TrilinearSampler::gradient requires a floating-point type");
|
||||
#if 0
|
||||
@@ -270,7 +270,7 @@ Vec3T<typename TreeOrAccT::ValueType> TrilinearSampler<TreeOrAccT>::gradient(con
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
|
||||
+__hostdev__ bool TrilinearSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[2][2][2])
|
||||
{
|
||||
static_assert(is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
|
||||
const bool less = v[0][0][0] < ValueT(0);
|
||||
@@ -363,21 +363,21 @@ class SampleFromVoxels<TreeOrAccT, 1, true> : public TrilinearSampler<TreeOrAccT
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
this->cache(xyz);
|
||||
return BaseT::sample(xyz, mVal);
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, true>::operator()(const CoordT &ijk) const
|
||||
{
|
||||
return ijk == mPos ? mVal[0][0][0] : BaseT::mAcc.getValue(ijk);
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, true>::gradient(Vec3T<RealT> xyz) const
|
||||
{
|
||||
this->cache(xyz);
|
||||
return BaseT::gradient(xyz, mVal);
|
||||
@@ -393,7 +393,7 @@ __hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, true>::zeroCrossing(Vec3T<RealT
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
|
||||
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
|
||||
{
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
if (ijk != mPos) {
|
||||
@@ -406,7 +406,7 @@ void SampleFromVoxels<TreeOrAccT, 1, true>::cache(Vec3T<RealT>& xyz) const
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
ValueT val[2][2][2];
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
@@ -418,7 +418,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator(
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
auto lerp = [](ValueT a, ValueT b, RealT w) { return a + ValueT(w) * (b - a); };
|
||||
|
||||
@@ -463,7 +463,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 1, false>::operator(
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, false>::gradient(Vec3T<RealT> xyz) const
|
||||
{
|
||||
ValueT val[2][2][2];
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
@@ -473,7 +473,7 @@ inline Vec3T<typename TreeOrAccT::ValueType> SampleFromVoxels<TreeOrAccT, 1, fal
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 1, false>::zeroCrossing(Vec3T<RealT> xyz) const
|
||||
{
|
||||
ValueT val[2][2][2];
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
@@ -510,7 +510,7 @@ class TriquadraticSampler
|
||||
}; // TriquadraticSamplerBase
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
|
||||
+__hostdev__ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][3][3]) const
|
||||
{
|
||||
CoordT p(ijk[0] - 1, 0, 0);
|
||||
for (int dx = 0; dx < 3; ++dx, ++p[0]) {
|
||||
@@ -526,7 +526,7 @@ void TriquadraticSampler<TreeOrAccT>::stencil(const CoordT &ijk, ValueT (&v)[3][
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
|
||||
+__hostdev__ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec3T<RealT> &uvw, const ValueT (&v)[3][3][3])
|
||||
{
|
||||
auto kernel = [](const ValueT* value, double weight)->ValueT {
|
||||
return weight * (weight * (0.5f * (value[0] + value[2]) - value[1]) +
|
||||
@@ -545,7 +545,7 @@ typename TreeOrAccT::ValueType TriquadraticSampler<TreeOrAccT>::sample(const Vec
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
|
||||
+__hostdev__ bool TriquadraticSampler<TreeOrAccT>::zeroCrossing(const ValueT (&v)[3][3][3])
|
||||
{
|
||||
static_assert(is_floating_point<ValueT>::value, "TrilinearSampler::zeroCrossing requires a floating-point type");
|
||||
const bool less = v[0][0][0] < ValueT(0);
|
||||
@@ -624,14 +624,14 @@ class SampleFromVoxels<TreeOrAccT, 2, true> : public TriquadraticSampler<TreeOrA
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
this->cache(xyz);
|
||||
return BaseT::sample(xyz, mVal);
|
||||
}
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, true>::operator()(const CoordT &ijk) const
|
||||
{
|
||||
return ijk == mPos ? mVal[1][1][1] : BaseT::mAcc.getValue(ijk);
|
||||
}
|
||||
@@ -646,7 +646,7 @@ __hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, true>::zeroCrossing(Vec3T<RealT
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
|
||||
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
|
||||
{
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
if (ijk != mPos) {
|
||||
@@ -657,7 +657,7 @@ void SampleFromVoxels<TreeOrAccT, 2, true>::cache(Vec3T<RealT>& xyz) const
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
ValueT val[3][3][3];
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
@@ -667,7 +667,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 2, false>::operator(
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ bool SampleFromVoxels<TreeOrAccT, 2, false>::zeroCrossing(Vec3T<RealT> xyz) const
|
||||
{
|
||||
ValueT val[3][3][3];
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
@@ -710,7 +710,7 @@ class TricubicSampler
|
||||
}; // TricubicSampler
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
-void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
|
||||
+__hostdev__ void TricubicSampler<TreeOrAccT>::stencil(const CoordT& ijk, ValueT (&C)[64]) const
|
||||
{
|
||||
auto fetch = [&](int i, int j, int k) -> ValueT& { return C[((i + 1) << 4) + ((j + 1) << 2) + k + 1]; };
|
||||
|
||||
@@ -929,7 +929,7 @@ class SampleFromVoxels<TreeOrAccT, 3, true> : public TricubicSampler<TreeOrAccT>
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
|
||||
+__hostdev__ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()(Vec3T<RealT> xyz) const
|
||||
{
|
||||
this->cache(xyz);
|
||||
return BaseT::sample(xyz, mC);
|
||||
@@ -937,7 +937,7 @@ typename TreeOrAccT::ValueType SampleFromVoxels<TreeOrAccT, 3, true>::operator()
|
||||
|
||||
template<typename TreeOrAccT>
|
||||
template<typename RealT, template<typename...> class Vec3T>
|
||||
-void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
|
||||
+__hostdev__ void SampleFromVoxels<TreeOrAccT, 3, true>::cache(Vec3T<RealT>& xyz) const
|
||||
{
|
||||
CoordT ijk = Floor<CoordT>(xyz);
|
||||
if (ijk != mPos) {
|
||||
|
||||
|
@@ -25,78 +25,3 @@ diff -Naur usd_orig/cmake/defaults/msvcdefaults.cmake external_usd/cmake/default
|
||||
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /MP")
|
||||
set(_PXR_CXX_FLAGS "${_PXR_CXX_FLAGS} /Gm-")
|
||||
|
||||
diff --git a/pxr/base/work/singularTask.h b/pxr/base/work/singularTask.h
|
||||
--- a/pxr/base/work/singularTask.h
|
||||
+++ b/pxr/base/work/singularTask.h
|
||||
@@ -120,7 +120,7 @@
|
||||
// case we go again to ensure the task can do whatever it
|
||||
// was awakened to do. Once we successfully take the count
|
||||
// to zero, we stop.
|
||||
- size_t old = count;
|
||||
+ std::size_t old = count;
|
||||
do { _fn(); } while (
|
||||
!count.compare_exchange_strong(old, 0));
|
||||
});
|
||||
|
||||
diff --git a/pxr/usd/sdr/shaderMetadataHelpers.h b/pxr/usd/sdr/shaderMetadataHelpers.h
|
||||
--- a/pxr/usd/sdr/shaderMetadataHelpers.h
|
||||
+++ b/pxr/usd/sdr/shaderMetadataHelpers.h
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "pxr/base/tf/token.h"
|
||||
#include "pxr/usd/sdr/declare.h"
|
||||
|
||||
+#include <limits>
|
||||
+
|
||||
PXR_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
/// \namespace ShaderMetadataHelpers
|
||||
|
||||
diff --git a/pxr/base/arch/timing.h b/pxr/base/arch/timing.h
|
||||
index 517561f..fda5a1f 100644
|
||||
--- a/pxr/base/arch/timing.h
|
||||
+++ b/pxr/base/arch/timing.h
|
||||
@@ -91,6 +91,10 @@ ArchGetTickTime()
|
||||
inline uint64_t
|
||||
ArchGetStartTickTime()
|
||||
{
|
||||
+ // BLENDER: avoid using rdtsc instruction that is not supported on older CPUs.
|
||||
+ return ArchGetTickTime();
|
||||
+
|
||||
+#if 0
|
||||
uint64_t t;
|
||||
#if defined (ARCH_OS_DARWIN)
|
||||
return ArchGetTickTime();
|
||||
@@ -123,6 +127,7 @@ ArchGetStartTickTime()
|
||||
#error "Unsupported architecture."
|
||||
#endif
|
||||
return t;
|
||||
+#endif
|
||||
}
|
||||
|
||||
/// Get a "stop" tick time for measuring an interval of time. See
|
||||
@@ -132,6 +137,10 @@ ArchGetStartTickTime()
|
||||
inline uint64_t
|
||||
ArchGetStopTickTime()
|
||||
{
|
||||
+ // BLENDER: avoid using rdtsc instruction that is not supported on older CPUs.
|
||||
+ return ArchGetTickTime();
|
||||
+
|
||||
+#if 0
|
||||
uint64_t t;
|
||||
#if defined (ARCH_OS_DARWIN)
|
||||
return ArchGetTickTime();
|
||||
@@ -162,11 +171,11 @@ ArchGetStopTickTime()
|
||||
#error "Unsupported architecture."
|
||||
#endif
|
||||
return t;
|
||||
+#endif
|
||||
}
|
||||
|
||||
-#if defined (doxygen) || \
|
||||
- (!defined(ARCH_OS_DARWIN) && defined(ARCH_CPU_INTEL) && \
|
||||
- (defined(ARCH_COMPILER_CLANG) || defined(ARCH_COMPILER_GCC)))
|
||||
+// BLENDER: avoid using rdtsc instruction that is not supported on older CPUs.
|
||||
+#if 0
|
||||
|
||||
/// A simple timer class for measuring an interval of time using the
|
||||
/// ArchTickTimer facilities.
|
||||
|
@@ -107,8 +107,8 @@ echo %DATE% %TIME% : Start > %StatusFile%
|
||||
cmake -G "%CMAKE_BUILDER%" %CMAKE_BUILD_ARCH% -Thost=x64 %SOURCE_DIR% -DPACKAGE_DIR=%BUILD_DIR%/packages -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DBUILD_MODE=Release -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/
|
||||
echo %DATE% %TIME% : Release Configuration done >> %StatusFile%
|
||||
if "%dobuild%" == "1" (
|
||||
msbuild /m:1 "ll.vcxproj" /p:Configuration=Release /fl /flp:logfile=BlenderDeps_llvm.log;Verbosity=normal
|
||||
msbuild /m:1 "BlenderDependencies.sln" /p:Configuration=Release /fl /flp:logfile=BlenderDeps.log;Verbosity=minimal /verbosity:minimal
|
||||
msbuild /m "ll.vcxproj" /p:Configuration=Release /fl /flp:logfile=BlenderDeps_llvm.log;Verbosity=normal
|
||||
msbuild /maxcpucount:1 /m "BlenderDependencies.sln" /p:Configuration=Release /fl /flp:logfile=BlenderDeps.log;Verbosity=minimal /verbosity:minimal
|
||||
echo %DATE% %TIME% : Release Build done >> %StatusFile%
|
||||
cmake --build . --target Harvest_Release_Results > Harvest_Release.txt
|
||||
)
|
||||
@@ -120,8 +120,8 @@ cd %Staging%\%BuildDir%%ARCH%D
|
||||
cmake -G "%CMAKE_BUILDER%" %CMAKE_BUILD_ARCH% -Thost=x64 %SOURCE_DIR% -DPACKAGE_DIR=%BUILD_DIR%/packages -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DCMAKE_BUILD_TYPE=Debug -DBUILD_MODE=Debug -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/ %CMAKE_DEBUG_OPTIONS%
|
||||
echo %DATE% %TIME% : Debug Configuration done >> %StatusFile%
|
||||
if "%dobuild%" == "1" (
|
||||
msbuild /m:1 "ll.vcxproj" /p:Configuration=Debug /fl /flp:logfile=BlenderDeps_llvm.log;;Verbosity=normal
|
||||
msbuild /m:1 "BlenderDependencies.sln" /p:Configuration=Debug /verbosity:n /fl /flp:logfile=BlenderDeps.log;;Verbosity=normal
|
||||
msbuild /m "ll.vcxproj" /p:Configuration=Debug /fl /flp:logfile=BlenderDeps_llvm.log;;Verbosity=normal
|
||||
msbuild /maxcpucount:1 /m "BlenderDependencies.sln" /p:Configuration=Debug /verbosity:n /fl /flp:logfile=BlenderDeps.log;;Verbosity=normal
|
||||
echo %DATE% %TIME% : Debug Build done >> %StatusFile%
|
||||
cmake --build . --target Harvest_Debug_Results> Harvest_Debug.txt
|
||||
)
|
||||
|
@@ -215,12 +215,7 @@ if(WITH_SDL)
|
||||
find_package(SDL2)
|
||||
set(SDL_INCLUDE_DIR ${SDL2_INCLUDE_DIRS})
|
||||
set(SDL_LIBRARY ${SDL2_LIBRARIES})
|
||||
string(APPEND PLATFORM_LINKFLAGS " -framework ForceFeedback -framework GameController")
|
||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||
# The minimum macOS version of the libraries makes it so this is included in SDL on arm64
|
||||
# but not x86_64.
|
||||
string(APPEND PLATFORM_LINKFLAGS " -framework CoreHaptics")
|
||||
endif()
|
||||
string(APPEND PLATFORM_LINKFLAGS " -framework ForceFeedback -framework GameController -framework CoreHaptics")
|
||||
endif()
|
||||
|
||||
set(PNG_ROOT ${LIBDIR}/png)
|
||||
|
@@ -25,7 +25,6 @@ if(UNIX AND
|
||||
unset_cache_variables("^PNG")
|
||||
unset_cache_variables("^USD")
|
||||
unset_cache_variables("^WEBP")
|
||||
unset_cache_variables("^NANOVDB")
|
||||
endif()
|
||||
|
||||
# Automatically set WebP on/off depending if libraries are available.
|
||||
@@ -36,11 +35,3 @@ if(EXISTS ${LIBDIR}/webp)
|
||||
else()
|
||||
set(WITH_IMAGE_WEBP OFF)
|
||||
endif()
|
||||
|
||||
# NanoVDB moved into openvdb.
|
||||
if(UNIX AND DEFINED NANOVDB_INCLUDE_DIR)
|
||||
if(NOT EXISTS ${NANOVDB_INCLUDE_DIR} AND
|
||||
EXISTS ${LIBDIR}/openvdb/include/nanovdb)
|
||||
unset_cache_variables("^NANOVDB")
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -5,38 +5,38 @@
|
||||
update-code:
|
||||
git:
|
||||
submodules:
|
||||
- branch: blender-v3.2-release
|
||||
- branch: master
|
||||
commit_id: HEAD
|
||||
path: release/scripts/addons
|
||||
- branch: blender-v3.2-release
|
||||
- branch: master
|
||||
commit_id: HEAD
|
||||
path: release/scripts/addons_contrib
|
||||
- branch: blender-v3.2-release
|
||||
- branch: master
|
||||
commit_id: HEAD
|
||||
path: release/datafiles/locale
|
||||
- branch: blender-v3.2-release
|
||||
- branch: master
|
||||
commit_id: HEAD
|
||||
path: source/tools
|
||||
svn:
|
||||
libraries:
|
||||
darwin-arm64:
|
||||
branch: tags/blender-3.2-release
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/darwin_arm64
|
||||
darwin-x86_64:
|
||||
branch: tags/blender-3.2-release
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/darwin
|
||||
linux-x86_64:
|
||||
branch: tags/blender-3.2-release
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/linux_centos7_x86_64
|
||||
windows-amd64:
|
||||
branch: tags/blender-3.2-release
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/win64_vc15
|
||||
tests:
|
||||
branch: tags/blender-3.2-release
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/tests
|
||||
benchmarks:
|
||||
@@ -54,8 +54,6 @@ buildbot:
|
||||
version: '10.1.243'
|
||||
cuda11:
|
||||
version: '11.4.1'
|
||||
hip:
|
||||
version: '5.0.20451'
|
||||
optix:
|
||||
version: '7.3.0'
|
||||
cmake:
|
||||
|
@@ -3,10 +3,13 @@ for %%X in (svn.exe) do (set SVN=%%~$PATH:X)
|
||||
for %%X in (cmake.exe) do (set CMAKE=%%~$PATH:X)
|
||||
for %%X in (ctest.exe) do (set CTEST=%%~$PATH:X)
|
||||
for %%X in (git.exe) do (set GIT=%%~$PATH:X)
|
||||
REM For python, default on 310 but if that does not exist also check
|
||||
REM the 311, 312 and finally 39 folders to see if those are there, it checks
|
||||
REM this far ahead to ensure good lib folder compatibility in the future
|
||||
REM it falls back to 3.9 just incase it is a very old lib folder.
|
||||
REM For python, default on 39 but if that does not exist also check
|
||||
REM the 310,311 and 312 folders to see if those are there, it checks
|
||||
REM this far ahead to ensure good lib folder compatibility in the future.
|
||||
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
|
||||
if EXIST %PYTHON% (
|
||||
goto detect_python_done
|
||||
)
|
||||
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\310\bin\python.exe
|
||||
if EXIST %PYTHON% (
|
||||
goto detect_python_done
|
||||
@@ -19,10 +22,6 @@ set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\312\bin\python.exe
|
||||
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
|
||||
)
|
||||
|
||||
if NOT EXIST %PYTHON% (
|
||||
echo Warning: Python not found, there is likely an issue with the library folder
|
||||
|
@@ -411,7 +411,7 @@ def main():
|
||||
# read blend header from blend file
|
||||
log.info("2: read file:")
|
||||
|
||||
if dir not in sys.path:
|
||||
if not dir in sys.path:
|
||||
sys.path.append(dir)
|
||||
import BlendFileReader
|
||||
|
||||
|
@@ -10,7 +10,7 @@ Notes:
|
||||
|
||||
- Temporary context overrides may be nested, when this is done, members will be added to the existing overrides.
|
||||
|
||||
- Context members are restored outside the scope of the context-manager.
|
||||
- Context members are restored outside the scope of the context.
|
||||
The only exception to this is when the data is no longer available.
|
||||
|
||||
In the event windowing data was removed (for example), the state of the context is left as-is.
|
||||
|
@@ -1,46 +0,0 @@
|
||||
"""
|
||||
Image Data
|
||||
++++++++++
|
||||
|
||||
The Image data-block is a shallow wrapper around image or video file(s)
|
||||
(on disk, as packed data, or generated).
|
||||
|
||||
All actual data like the pixel buffer, size, resolution etc. is
|
||||
cached in an :class:`imbuf.types.ImBuf` image buffer (or several buffers
|
||||
in some cases, like UDIM textures, multi-views, animations...).
|
||||
|
||||
Several properties and functions of the Image data-block are then actually
|
||||
using/modifying its image buffer, and not the Image data-block itself.
|
||||
|
||||
.. warning::
|
||||
|
||||
One key limitation is that image buffers are not shared between different
|
||||
Image data-blocks, and they are not duplicated when copying an image.
|
||||
|
||||
So until a modified image buffer is saved on disk, duplicating its Image
|
||||
data-block will not propagate the underlying buffer changes to the new Image.
|
||||
|
||||
|
||||
This example script generates an Image data-block with a given size,
|
||||
change its first pixel, rescale it, and duplicates the image.
|
||||
|
||||
The duplicated image still has the same size and colors as the original image
|
||||
at its creation, all editing in the original image's buffer is 'lost' in its copy.
|
||||
"""
|
||||
|
||||
import bpy
|
||||
|
||||
image_src = bpy.data.images.new('src', 1024, 102)
|
||||
print(image_src.size)
|
||||
print(image_src.pixels[0:4])
|
||||
|
||||
image_src.scale(1024, 720)
|
||||
image_src.pixels[0:4] = (0.5, 0.5, 0.5, 0.5)
|
||||
image_src.update()
|
||||
print(image_src.size)
|
||||
print(image_src.pixels[0:4])
|
||||
|
||||
image_dest = image_src.copy()
|
||||
image_dest.update()
|
||||
print(image_dest.size)
|
||||
print(image_dest.pixels[0:4])
|
@@ -43,7 +43,7 @@ with offscreen.bind():
|
||||
offscreen.free()
|
||||
|
||||
|
||||
if IMAGE_NAME not in bpy.data.images:
|
||||
if not IMAGE_NAME in bpy.data.images:
|
||||
bpy.data.images.new(IMAGE_NAME, WIDTH, HEIGHT)
|
||||
image = bpy.data.images[IMAGE_NAME]
|
||||
image.scale(WIDTH, HEIGHT)
|
||||
|
@@ -4,12 +4,6 @@ OpenGL Wrapper (bgl)
|
||||
|
||||
.. module:: bgl
|
||||
|
||||
.. warning::
|
||||
|
||||
This module is deprecated and will be removed in a future release,
|
||||
when OpenGL is replaced by Metal and Vulkan.
|
||||
Use the graphics API independent :mod:`gpu` module instead.
|
||||
|
||||
This module wraps OpenGL constants and functions, making them available from
|
||||
within Blender Python.
|
||||
|
||||
|
@@ -3,111 +3,59 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
"""
|
||||
---------------
|
||||
Dump the python API into a text file so we can generate changelogs.
|
||||
|
||||
Dump the python API into a JSON file, or generate changelogs from those JSON API dumps.
|
||||
output from this tool should be added into "doc/python_api/rst/change_log.rst"
|
||||
|
||||
Typically, changelog output from this tool should be added into "doc/python_api/rst/change_log.rst"
|
||||
# dump api blender_version.py in CWD
|
||||
blender --background --python doc/python_api/sphinx_changelog_gen.py -- --dump
|
||||
|
||||
API dump files are saved together with the generated API doc on the server, with a general index file.
|
||||
This way the changelog generation simply needs to re-download the previous version's dump for the diffing process.
|
||||
|
||||
---------------
|
||||
|
||||
# Dump api blender_version.json in CWD:
|
||||
blender --background --factory-startup --python doc/python_api/sphinx_changelog_gen.py -- \
|
||||
--indexpath="path/to/api/docs/api_dump_index.json" \
|
||||
dump --filepath-out="path/to/api/docs/<version>/api_dump.json"
|
||||
|
||||
# Create changelog:
|
||||
# create changelog
|
||||
blender --background --factory-startup --python doc/python_api/sphinx_changelog_gen.py -- \
|
||||
--indexpath="path/to/api/docs/api_dump_index.json" \
|
||||
changelog --filepath-out doc/python_api/rst/change_log.rst
|
||||
--api_from blender_2_63_0.py \
|
||||
--api_to blender_2_64_0.py \
|
||||
--api_out changes.rst
|
||||
|
||||
# Api comparison can also run without blender,
|
||||
# will by default generate changeloig between the last two available versions listed in the index,
|
||||
# unless input files are provided explicitely:
|
||||
|
||||
# Api comparison can also run without blender
|
||||
python doc/python_api/sphinx_changelog_gen.py -- \
|
||||
--indexpath="path/to/api/docs/api_dump_index.json" \
|
||||
changelog --filepath-in-from blender_api_2_63_0.json \
|
||||
--filepath-in-to blender_api_2_64_0.json \
|
||||
--filepath-out changes.rst
|
||||
--api_from blender_api_2_63_0.py \
|
||||
--api_to blender_api_2_64_0.py \
|
||||
--api_out changes.rst
|
||||
|
||||
--------------
|
||||
|
||||
API dump index format:
|
||||
|
||||
{[version_main, version_sub]: "<version>/api_dump.json", ...
|
||||
}
|
||||
|
||||
API dump format:
|
||||
|
||||
[
|
||||
[version_main, vserion_sub, version_path],
|
||||
{"module.name":
|
||||
{"parent.class":
|
||||
{"basic_type", "member_name":
|
||||
["Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types]}, ...
|
||||
}, ...
|
||||
}
|
||||
]
|
||||
# Save the latest API dump in this folder, renaming it with its revision.
|
||||
# This way the next person updating it doesn't need to build an old Blender only for that
|
||||
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
# format
|
||||
'''
|
||||
{"module.name":
|
||||
{"parent.class":
|
||||
{"basic_type", "member_name":
|
||||
("Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types)}, ...
|
||||
}, ...
|
||||
}
|
||||
'''
|
||||
|
||||
api_names = "basic_type" "name", "type", "range", "length", "default", "descr", "f_args", "f_arg_types", "f_ret_types"
|
||||
|
||||
API_BASIC_TYPE = 0
|
||||
API_F_ARGS = 7
|
||||
|
||||
|
||||
def api_version():
|
||||
try:
|
||||
import bpy
|
||||
except:
|
||||
return None, None
|
||||
version = tuple(bpy.app.version[:2])
|
||||
version_key = "%d.%d" % (version[0], version[1])
|
||||
return version, version_key
|
||||
def api_dunp_fname():
|
||||
import bpy
|
||||
return "blender_api_%s.py" % "_".join([str(i) for i in bpy.app.version])
|
||||
|
||||
|
||||
def api_version_previous_in_index(index, version):
|
||||
print("Searching for previous version to %s in %r" % (version, index))
|
||||
version_prev = (version[0], version[1])
|
||||
while True:
|
||||
version_prev = (version_prev[0], version_prev[1] - 1)
|
||||
if version_prev[1] < 0:
|
||||
version_prev = (version_prev[0] - 1, 99)
|
||||
if version_prev[0] < 0:
|
||||
return None, None
|
||||
version_prev_key = "%d.%d" % (version_prev[0], version_prev[1])
|
||||
if version_prev_key in index:
|
||||
print("Found previous version %s: %r" % (version_prev, index[version_prev_key]))
|
||||
return version_prev, version_prev_key
|
||||
|
||||
|
||||
class JSONEncoderAPIDump(json.JSONEncoder):
|
||||
def default(self, o):
|
||||
if o is ...:
|
||||
return "..."
|
||||
if isinstance(o, set):
|
||||
return tuple(o)
|
||||
return json.JSONEncoder.default(self, o)
|
||||
|
||||
|
||||
def api_dump(args):
|
||||
import rna_info
|
||||
import inspect
|
||||
|
||||
version, version_key = api_version()
|
||||
if version is None:
|
||||
raise(ValueError("API dumps can only be generated from within Blender."))
|
||||
|
||||
def api_dump():
|
||||
dump = {}
|
||||
dump_module = dump["bpy.types"] = {}
|
||||
|
||||
import rna_info
|
||||
import inspect
|
||||
|
||||
struct = rna_info.BuildRNAInfo()[0]
|
||||
for struct_id, struct_info in sorted(struct.items()):
|
||||
|
||||
@@ -209,25 +157,17 @@ def api_dump(args):
|
||||
)
|
||||
del funcs
|
||||
|
||||
filepath_out = args.filepath_out
|
||||
with open(filepath_out, 'w', encoding='utf-8') as file_handle:
|
||||
json.dump((version, dump), file_handle, cls=JSONEncoderAPIDump)
|
||||
import pprint
|
||||
|
||||
indexpath = args.indexpath
|
||||
rootpath = os.path.dirname(indexpath)
|
||||
if os.path.exists(indexpath):
|
||||
with open(indexpath, 'r', encoding='utf-8') as file_handle:
|
||||
index = json.load(file_handle)
|
||||
else:
|
||||
index = {}
|
||||
index[version_key] = os.path.relpath(filepath_out, rootpath)
|
||||
with open(indexpath, 'w', encoding='utf-8') as file_handle:
|
||||
json.dump(index, file_handle)
|
||||
|
||||
print("API version %s dumped into %r, and index %r has been updated" % (version_key, filepath_out, indexpath))
|
||||
filename = api_dunp_fname()
|
||||
filehandle = open(filename, 'w', encoding='utf-8')
|
||||
tot = filehandle.write(pprint.pformat(dump, width=1))
|
||||
filehandle.close()
|
||||
print("%s, %d bytes written" % (filename, tot))
|
||||
|
||||
|
||||
def compare_props(a, b, fuzz=0.75):
|
||||
|
||||
# must be same basic_type, function != property
|
||||
if a[0] != b[0]:
|
||||
return False
|
||||
@@ -242,44 +182,15 @@ def compare_props(a, b, fuzz=0.75):
|
||||
return ((tot / totlen) >= fuzz)
|
||||
|
||||
|
||||
def api_changelog(args):
|
||||
indexpath = args.indexpath
|
||||
filepath_in_from = args.filepath_in_from
|
||||
filepath_in_to = args.filepath_in_to
|
||||
filepath_out = args.filepath_out
|
||||
def api_changelog(api_from, api_to, api_out):
|
||||
|
||||
rootpath = os.path.dirname(indexpath)
|
||||
file_handle = open(api_from, 'r', encoding='utf-8')
|
||||
dict_from = eval(file_handle.read())
|
||||
file_handle.close()
|
||||
|
||||
version, version_key = api_version()
|
||||
if version is None and (filepath_in_from is None or filepath_in_to is None):
|
||||
raise(ValueError("API dumps files must be given when ran outside of Blender."))
|
||||
|
||||
with open(indexpath, 'r', encoding='utf-8') as file_handle:
|
||||
index = json.load(file_handle)
|
||||
|
||||
if filepath_in_to == None:
|
||||
filepath_in_to = index.get(version_key, None)
|
||||
if filepath_in_to == None:
|
||||
raise(ValueError("Cannot find API dump file for Blender version " + str(version) + " in index file."))
|
||||
|
||||
print("Found to file: %r" % filepath_in_to)
|
||||
|
||||
if filepath_in_from == None:
|
||||
version_from, version_from_key = api_version_previous_in_index(index, version)
|
||||
if version_from is None:
|
||||
raise(ValueError("No previous version of Blender could be found in the index."))
|
||||
filepath_in_from = index.get(version_from_key, None)
|
||||
if filepath_in_from is None:
|
||||
raise(ValueError("Cannot find API dump file for previous Blender version " + str(version_from) + " in index file."))
|
||||
|
||||
print("Found from file: %r" % filepath_in_from)
|
||||
|
||||
with open(os.path.join(rootpath, filepath_in_from), 'r', encoding='utf-8') as file_handle:
|
||||
_, dict_from = json.load(file_handle)
|
||||
|
||||
with open(os.path.join(rootpath, filepath_in_to), 'r', encoding='utf-8') as file_handle:
|
||||
dump_version, dict_to = json.load(file_handle)
|
||||
assert(tuple(dump_version) == version)
|
||||
file_handle = open(api_to, 'r', encoding='utf-8')
|
||||
dict_to = eval(file_handle.read())
|
||||
file_handle.close()
|
||||
|
||||
api_changes = []
|
||||
|
||||
@@ -340,66 +251,63 @@ def api_changelog(args):
|
||||
|
||||
# also document function argument changes
|
||||
|
||||
with open(filepath_out, 'w', encoding='utf-8') as fout:
|
||||
fw = fout.write
|
||||
fout = open(api_out, 'w', encoding='utf-8')
|
||||
fw = fout.write
|
||||
# print(api_changes)
|
||||
|
||||
# Write header.
|
||||
fw(""
|
||||
":tocdepth: 2\n"
|
||||
"\n"
|
||||
"Blender API Change Log\n"
|
||||
"**********************\n"
|
||||
"\n"
|
||||
".. note, this document is auto generated by sphinx_changelog_gen.py\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"%s to %s\n"
|
||||
"============\n"
|
||||
"\n" % (version_from_key, version_key))
|
||||
# :class:`bpy_struct.id_data`
|
||||
|
||||
def write_title(title, title_char):
|
||||
fw("%s\n%s\n\n" % (title, title_char * len(title)))
|
||||
def write_title(title, title_char):
|
||||
fw("%s\n%s\n\n" % (title, title_char * len(title)))
|
||||
|
||||
for mod_id, class_id, props_moved, props_new, props_old, func_args in api_changes:
|
||||
class_name = class_id.split(".")[-1]
|
||||
title = mod_id + "." + class_name
|
||||
write_title(title, "-")
|
||||
for mod_id, class_id, props_moved, props_new, props_old, func_args in api_changes:
|
||||
class_name = class_id.split(".")[-1]
|
||||
title = mod_id + "." + class_name
|
||||
write_title(title, "-")
|
||||
|
||||
if props_new:
|
||||
write_title("Added", "^")
|
||||
for prop_id in props_new:
|
||||
fw("* :class:`%s.%s.%s`\n" % (mod_id, class_name, prop_id))
|
||||
fw("\n")
|
||||
if props_new:
|
||||
write_title("Added", "^")
|
||||
for prop_id in props_new:
|
||||
fw("* :class:`%s.%s.%s`\n" % (mod_id, class_name, prop_id))
|
||||
fw("\n")
|
||||
|
||||
if props_old:
|
||||
write_title("Removed", "^")
|
||||
for prop_id in props_old:
|
||||
fw("* **%s**\n" % prop_id) # can't link to removed docs
|
||||
fw("\n")
|
||||
if props_old:
|
||||
write_title("Removed", "^")
|
||||
for prop_id in props_old:
|
||||
fw("* **%s**\n" % prop_id) # can't link to removed docs
|
||||
fw("\n")
|
||||
|
||||
if props_moved:
|
||||
write_title("Renamed", "^")
|
||||
for prop_id_old, prop_id in props_moved:
|
||||
fw("* **%s** -> :class:`%s.%s.%s`\n" % (prop_id_old, mod_id, class_name, prop_id))
|
||||
fw("\n")
|
||||
if props_moved:
|
||||
write_title("Renamed", "^")
|
||||
for prop_id_old, prop_id in props_moved:
|
||||
fw("* **%s** -> :class:`%s.%s.%s`\n" % (prop_id_old, mod_id, class_name, prop_id))
|
||||
fw("\n")
|
||||
|
||||
if func_args:
|
||||
write_title("Function Arguments", "^")
|
||||
for func_id, args_old, args_new in func_args:
|
||||
args_new = ", ".join(args_new)
|
||||
args_old = ", ".join(args_old)
|
||||
fw("* :class:`%s.%s.%s` (%s), *was (%s)*\n" % (mod_id, class_name, func_id, args_new, args_old))
|
||||
fw("\n")
|
||||
if func_args:
|
||||
write_title("Function Arguments", "^")
|
||||
for func_id, args_old, args_new in func_args:
|
||||
args_new = ", ".join(args_new)
|
||||
args_old = ", ".join(args_old)
|
||||
fw("* :class:`%s.%s.%s` (%s), *was (%s)*\n" % (mod_id, class_name, func_id, args_new, args_old))
|
||||
fw("\n")
|
||||
|
||||
print("Written: %r" % filepath_out)
|
||||
fout.close()
|
||||
|
||||
print("Written: %r" % api_out)
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
def main():
|
||||
import sys
|
||||
import argparse
|
||||
import os
|
||||
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
try:
|
||||
import argparse
|
||||
except ImportError:
|
||||
print("Old Blender, just dumping")
|
||||
api_dump()
|
||||
return
|
||||
|
||||
argv = sys.argv
|
||||
|
||||
if "--" not in argv:
|
||||
argv = [] # as if no args are passed
|
||||
@@ -410,39 +318,42 @@ def main(argv=None):
|
||||
usage_text = "Run blender in background mode with this script: "
|
||||
"blender --background --factory-startup --python %s -- [options]" % os.path.basename(__file__)
|
||||
|
||||
parser = argparse.ArgumentParser(description=usage_text,
|
||||
epilog=__doc__,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
epilog = "Run this before releases"
|
||||
|
||||
parser = argparse.ArgumentParser(description=usage_text, epilog=epilog)
|
||||
|
||||
parser.add_argument(
|
||||
"--indexpath", dest="indexpath", metavar='FILE', required=True,
|
||||
help="Path of the JSON file containing the index of all available API dumps.")
|
||||
"--dump", dest="dump", action='store_true',
|
||||
help="When set the api will be dumped into blender_version.py")
|
||||
|
||||
parser_commands = parser.add_subparsers(required=True)
|
||||
parser.add_argument(
|
||||
"--api_from", dest="api_from", metavar='FILE',
|
||||
help="File to compare from (previous version)")
|
||||
parser.add_argument(
|
||||
"--api_to", dest="api_to", metavar='FILE',
|
||||
help="File to compare from (current)")
|
||||
parser.add_argument(
|
||||
"--api_out", dest="api_out", metavar='FILE',
|
||||
help="Output sphinx changelog")
|
||||
|
||||
parser_dump = parser_commands.add_parser('dump', help="Dump the current Blender Python API into a JSON file.")
|
||||
parser_dump.add_argument(
|
||||
"--filepath-out", dest="filepath_out", metavar='FILE', required=True,
|
||||
help="Path of the JSON file containing the dump of the API.")
|
||||
parser_dump.set_defaults(func=api_dump)
|
||||
args = parser.parse_args(argv) # In this example we won't use the args
|
||||
|
||||
parser_changelog = parser_commands.add_parser('changelog', help="Generate the RST changelog page based on two Blender Python API JSON dumps.")
|
||||
if not argv:
|
||||
print("No args given!")
|
||||
parser.print_help()
|
||||
return
|
||||
|
||||
parser_changelog.add_argument(
|
||||
"--filepath-in-from", dest="filepath_in_from", metavar='FILE', default=None,
|
||||
help="JSON dump file to compare from (typically, previous version). "
|
||||
"If not given, will be automatically determined from current Blender version and index file.")
|
||||
parser_changelog.add_argument(
|
||||
"--filepath-in-to", dest="filepath_in_to", metavar='FILE', default=None,
|
||||
help="JSON dump file to compare to (typically, current version). "
|
||||
"If not given, will be automatically determined from current Blender version and index file.")
|
||||
parser_changelog.add_argument(
|
||||
"--filepath-out", dest="filepath_out", metavar='FILE', required=True,
|
||||
help="Output sphinx changelog RST file.")
|
||||
parser_changelog.set_defaults(func=api_changelog)
|
||||
if args.dump:
|
||||
api_dump()
|
||||
else:
|
||||
if args.api_from and args.api_to and args.api_out:
|
||||
api_changelog(args.api_from, args.api_to, args.api_out)
|
||||
else:
|
||||
print("Error: --api_from/api_to/api_out args needed")
|
||||
parser.print_help()
|
||||
return
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
args.func(args)
|
||||
print("batch job finished, exiting")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@@ -121,26 +121,6 @@ def handle_args():
|
||||
"(default=False)",
|
||||
required=False)
|
||||
|
||||
parser.add_argument(
|
||||
"--api-changelog-generate",
|
||||
dest="changelog",
|
||||
default=False,
|
||||
action='store_true',
|
||||
help="Generate the API changelog RST file "
|
||||
"(default=False, requires `--api-dump-index-path` parameter)",
|
||||
required=False,
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--api-dump-index-path",
|
||||
dest="api_dump_index_path",
|
||||
metavar='FILE',
|
||||
default=None,
|
||||
help="Path to the API dump index JSON file "
|
||||
"(required when `--api-changelog-generate` is True)",
|
||||
required=False,
|
||||
)
|
||||
|
||||
parser.add_argument("-o", "--output",
|
||||
dest="output_dir",
|
||||
type=str,
|
||||
@@ -488,26 +468,6 @@ if ARGS.sphinx_build_pdf:
|
||||
sphinx_make_pdf_log = os.path.join(ARGS.output_dir, ".latex_make.log")
|
||||
SPHINX_MAKE_PDF_STDOUT = open(sphinx_make_pdf_log, "w", encoding="utf-8")
|
||||
|
||||
|
||||
# --------------------------------CHANGELOG GENERATION--------------------------------------
|
||||
|
||||
def generate_changelog():
|
||||
import importlib.util
|
||||
spec = importlib.util.spec_from_file_location("sphinx_changelog_gen",
|
||||
os.path.abspath(os.path.join(SCRIPT_DIR, "sphinx_changelog_gen.py")))
|
||||
sphinx_changelog_gen = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(sphinx_changelog_gen)
|
||||
|
||||
API_DUMP_INDEX_FILEPATH = ARGS.api_dump_index_path
|
||||
API_DUMP_ROOT = os.path.dirname(API_DUMP_INDEX_FILEPATH)
|
||||
API_DUMP_FILEPATH = os.path.abspath(os.path.join(API_DUMP_ROOT, BLENDER_VERSION_DOTS, "api_dump.json"))
|
||||
API_CHANGELOG_FILEPATH = os.path.abspath(os.path.join(SPHINX_IN_TMP, "change_log.rst"))
|
||||
|
||||
sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, "dump", "--filepath-out", API_DUMP_FILEPATH))
|
||||
|
||||
sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, "changelog", "--filepath-out", API_CHANGELOG_FILEPATH))
|
||||
|
||||
|
||||
# --------------------------------API DUMP--------------------------------------
|
||||
|
||||
# lame, python won't give some access
|
||||
@@ -1514,12 +1474,6 @@ def pyrna2sphinx(basepath):
|
||||
pyprop2sphinx(" ", fw, identifier, py_prop)
|
||||
del py_properties, py_prop
|
||||
|
||||
# C/Python attributes: `GetSetDescriptorType`.
|
||||
key = descr = None
|
||||
for key, descr in sorted(struct.get_py_c_properties_getset()):
|
||||
py_descr2sphinx(" ", fw, descr, "bpy.types", struct_id, key)
|
||||
del key, descr
|
||||
|
||||
for func in struct.functions:
|
||||
args_str = ", ".join(prop.get_arg_default(force=False) for prop in func.args)
|
||||
|
||||
@@ -2365,9 +2319,6 @@ def main():
|
||||
|
||||
rna2sphinx(SPHINX_IN_TMP)
|
||||
|
||||
if ARGS.changelog:
|
||||
generate_changelog()
|
||||
|
||||
if ARGS.full_rebuild:
|
||||
# only for full updates
|
||||
shutil.rmtree(SPHINX_IN, True)
|
||||
|
10
extern/audaspace/include/util/Buffer.h
vendored
10
extern/audaspace/include/util/Buffer.h
vendored
@@ -34,7 +34,7 @@ class AUD_API Buffer
|
||||
{
|
||||
private:
|
||||
/// The size of the buffer in bytes.
|
||||
long long m_size;
|
||||
int m_size;
|
||||
|
||||
/// The pointer to the buffer memory.
|
||||
data_t* m_buffer;
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
* Creates a new buffer.
|
||||
* \param size The size of the buffer in bytes.
|
||||
*/
|
||||
Buffer(long long size = 0);
|
||||
Buffer(int size = 0);
|
||||
|
||||
/**
|
||||
* Destroys the buffer.
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
/**
|
||||
* Returns the size of the buffer in bytes.
|
||||
*/
|
||||
long long getSize() const;
|
||||
int getSize() const;
|
||||
|
||||
/**
|
||||
* Resizes the buffer.
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
* \param keep Whether to keep the old data. If the new buffer is smaller,
|
||||
* the data at the end will be lost.
|
||||
*/
|
||||
void resize(long long size, bool keep = false);
|
||||
void resize(int size, bool keep = false);
|
||||
|
||||
/**
|
||||
* Makes sure the buffer has a minimum size.
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
* \param keep Whether to keep the old data. If the new buffer is smaller,
|
||||
* the data at the end will be lost.
|
||||
*/
|
||||
void assureSize(long long size, bool keep = false);
|
||||
void assureSize(int size, bool keep = false);
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
|
@@ -361,7 +361,7 @@ int FFMPEGReader::read_packet(void* opaque, uint8_t* buf, int buf_size)
|
||||
{
|
||||
FFMPEGReader* reader = reinterpret_cast<FFMPEGReader*>(opaque);
|
||||
|
||||
long long size = std::min(static_cast<long long>(buf_size), reader->m_membuffer->getSize() - reader->m_membufferpos);
|
||||
int size = std::min(buf_size, reader->m_membuffer->getSize() - reader->m_membufferpos);
|
||||
|
||||
if(size < 0)
|
||||
return -1;
|
||||
|
@@ -114,7 +114,7 @@ private:
|
||||
/**
|
||||
* Reading position of the buffer.
|
||||
*/
|
||||
long long m_membufferpos;
|
||||
int m_membufferpos;
|
||||
|
||||
/**
|
||||
* Whether the audio data has to be interleaved after reading.
|
||||
|
@@ -23,9 +23,7 @@
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avio.h>
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 59
|
||||
#include <libavutil/channel_layout.h>
|
||||
#endif
|
||||
}
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
@@ -400,7 +398,7 @@ FFMPEGWriter::FFMPEGWriter(std::string filename, DeviceSpecs specs, Container fo
|
||||
m_specs.rate = m_codecCtx->sample_rate;
|
||||
|
||||
#ifdef FFMPEG_OLD_CODE
|
||||
m_codecCtx->codec_id = audio_codec;
|
||||
m_codecCtx->codec_id = outputFmt->audio_codec;
|
||||
#endif
|
||||
|
||||
m_codecCtx->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
|
8
extern/audaspace/src/util/Buffer.cpp
vendored
8
extern/audaspace/src/util/Buffer.cpp
vendored
@@ -25,7 +25,7 @@
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
Buffer::Buffer(long long size)
|
||||
Buffer::Buffer(int size)
|
||||
{
|
||||
m_size = size;
|
||||
m_buffer = (data_t*) std::malloc(size + ALIGNMENT);
|
||||
@@ -41,12 +41,12 @@ sample_t* Buffer::getBuffer() const
|
||||
return (sample_t*) ALIGN(m_buffer);
|
||||
}
|
||||
|
||||
long long Buffer::getSize() const
|
||||
int Buffer::getSize() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
void Buffer::resize(long long size, bool keep)
|
||||
void Buffer::resize(int size, bool keep)
|
||||
{
|
||||
if(keep)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ void Buffer::resize(long long size, bool keep)
|
||||
m_size = size;
|
||||
}
|
||||
|
||||
void Buffer::assureSize(long long size, bool keep)
|
||||
void Buffer::assureSize(int size, bool keep)
|
||||
{
|
||||
if(m_size < size)
|
||||
resize(size, keep);
|
||||
|
18
extern/audaspace/src/util/StreamBuffer.cpp
vendored
18
extern/audaspace/src/util/StreamBuffer.cpp
vendored
@@ -18,12 +18,8 @@
|
||||
#include "util/BufferReader.h"
|
||||
#include "util/Buffer.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// 5 sec * 48000 samples/sec * 4 bytes/sample * 6 channels
|
||||
#define BUFFER_RESIZE_BYTES 5760000
|
||||
// 90 min * 60 sec/min * 48000 samples/sec * 4 bytes/sample * 2 channels
|
||||
#define MAXIMUM_INITIAL_BUFFER_SIZE_BYTES 2073600000
|
||||
|
||||
AUD_NAMESPACE_BEGIN
|
||||
|
||||
@@ -36,15 +32,14 @@ StreamBuffer::StreamBuffer(std::shared_ptr<ISound> sound) :
|
||||
|
||||
int sample_size = AUD_SAMPLE_SIZE(m_specs);
|
||||
int length;
|
||||
long long index = 0;
|
||||
int index = 0;
|
||||
bool eos = false;
|
||||
|
||||
// get an approximated size if possible
|
||||
long long size = std::min(reader->getLength(), MAXIMUM_INITIAL_BUFFER_SIZE_BYTES / sample_size);
|
||||
long long size_increase = BUFFER_RESIZE_BYTES / sample_size;
|
||||
int size = reader->getLength();
|
||||
|
||||
if(size <= 0)
|
||||
size = size_increase;
|
||||
size = BUFFER_RESIZE_BYTES / sample_size;
|
||||
else
|
||||
size += m_specs.rate;
|
||||
|
||||
@@ -52,16 +47,13 @@ StreamBuffer::StreamBuffer(std::shared_ptr<ISound> sound) :
|
||||
while(!eos)
|
||||
{
|
||||
// increase
|
||||
m_buffer->resize(static_cast<long long>(size) * sample_size, true);
|
||||
m_buffer->resize(size*sample_size, true);
|
||||
|
||||
// read more
|
||||
length = size-index;
|
||||
reader->read(length, eos, m_buffer->getBuffer() + index * m_specs.channels);
|
||||
if(index == m_buffer->getSize() / sample_size)
|
||||
{
|
||||
size += size_increase;
|
||||
size_increase <<= 1;
|
||||
}
|
||||
size += BUFFER_RESIZE_BYTES / sample_size;
|
||||
index += length;
|
||||
}
|
||||
|
||||
|
@@ -18,10 +18,8 @@ endif()
|
||||
|
||||
# External Libraries
|
||||
|
||||
if(NOT CYCLES_STANDALONE_REPOSITORY)
|
||||
include(cmake/external_libs.cmake)
|
||||
include(cmake/macros.cmake)
|
||||
endif()
|
||||
include(cmake/external_libs.cmake)
|
||||
include(cmake/macros.cmake)
|
||||
|
||||
# Build Flags
|
||||
# todo: this code could be refactored a bit to avoid duplication
|
||||
@@ -223,6 +221,7 @@ include_directories(
|
||||
${OPENIMAGEIO_INCLUDE_DIRS}
|
||||
${OPENEXR_INCLUDE_DIRS}
|
||||
${PUGIXML_INCLUDE_DIR}
|
||||
${TBB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(WITH_CYCLES_DEBUG)
|
||||
@@ -271,6 +270,22 @@ if(WITH_CYCLES_EMBREE)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_NANOVDB)
|
||||
add_definitions(-DWITH_NANOVDB)
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${NANOVDB_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENSUBDIV)
|
||||
add_definitions(-DWITH_OPENSUBDIV)
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${OPENSUBDIV_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
add_definitions(-DWITH_OPENIMAGEDENOISE)
|
||||
include_directories(
|
||||
@@ -291,53 +306,6 @@ if(WITH_CYCLES_LOGGING)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
add_definitions(-DWITH_ALEMBIC)
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${ALEMBIC_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Includes that might be overrides by USD last, to avoid compiling
|
||||
# against the wrong versions of other libraries.
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${TBB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(WITH_OPENVDB)
|
||||
add_definitions(-DWITH_OPENVDB ${OPENVDB_DEFINITIONS})
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${OPENVDB_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_NANOVDB)
|
||||
add_definitions(-DWITH_NANOVDB)
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${NANOVDB_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENSUBDIV)
|
||||
add_definitions(-DWITH_OPENSUBDIV)
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${OPENSUBDIV_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCOLORIO)
|
||||
add_definitions(-DWITH_OCIO)
|
||||
include_directories(
|
||||
SYSTEM
|
||||
${OPENCOLORIO_INCLUDE_DIRS}
|
||||
)
|
||||
endif()
|
||||
|
||||
# NaN debugging
|
||||
if(WITH_CYCLES_DEBUG_NAN)
|
||||
add_definitions(-DWITH_CYCLES_DEBUG_NAN)
|
||||
@@ -355,7 +323,11 @@ endif()
|
||||
|
||||
# Warnings
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_float_conversion "-Werror=float-conversion")
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_double_promotion "-Werror=double-promotion")
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_no_error_unused_macros "-Wno-error=unused-macros")
|
||||
unset(_has_cxxflag_float_conversion)
|
||||
unset(_has_cxxflag_double_promotion)
|
||||
unset(_has_no_error_unused_macros)
|
||||
endif()
|
||||
|
||||
@@ -427,7 +399,7 @@ if(WITH_GTESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
if(WITH_CYCLES_HYDRA_RENDER_DELEGATE OR (WITH_CYCLES_STANDALONE AND WITH_USD))
|
||||
if(WITH_CYCLES_HYDRA_RENDER_DELEGATE)
|
||||
add_subdirectory(hydra)
|
||||
endif()
|
||||
|
||||
|
@@ -83,6 +83,13 @@ if(WITH_CYCLES_STANDALONE)
|
||||
target_link_libraries(cycles PRIVATE ${LIB})
|
||||
|
||||
if(APPLE)
|
||||
if(WITH_OPENCOLORIO)
|
||||
set_property(TARGET cycles APPEND_STRING PROPERTY LINK_FLAGS " -framework IOKit -framework Carbon")
|
||||
endif()
|
||||
if(WITH_OPENIMAGEDENOISE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||
# OpenImageDenoise uses BNNS from the Accelerate framework.
|
||||
set_property(TARGET cycles APPEND_STRING PROPERTY LINK_FLAGS " -framework Accelerate")
|
||||
endif()
|
||||
if(WITH_CYCLES_STANDALONE_GUI)
|
||||
set_property(TARGET cycles APPEND_STRING PROPERTY LINK_FLAGS
|
||||
" -framework Cocoa -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework ForceFeedback -framework CoreVideo")
|
||||
@@ -96,10 +103,6 @@ if(WITH_CYCLES_STANDALONE)
|
||||
if(CYCLES_STANDALONE_REPOSITORY)
|
||||
cycles_install_libraries(cycles)
|
||||
endif()
|
||||
|
||||
install(PROGRAMS
|
||||
$<TARGET_FILE:cycles>
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
endif()
|
||||
|
||||
#####################################################################
|
||||
|
109
intern/cycles/app/cycles_server.cpp
Normal file
109
intern/cycles/app/cycles_server.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/* SPDX-License-Identifier: Apache-2.0
|
||||
* Copyright 2011-2022 Blender Foundation */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "device/device.h"
|
||||
|
||||
#include "util/args.h"
|
||||
#include "util/foreach.h"
|
||||
#include "util/log.h"
|
||||
#include "util/path.h"
|
||||
#include "util/stats.h"
|
||||
#include "util/string.h"
|
||||
#include "util/task.h"
|
||||
|
||||
using namespace ccl;
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
util_logging_init(argv[0]);
|
||||
path_init();
|
||||
|
||||
/* device types */
|
||||
string devicelist = "";
|
||||
string devicename = "cpu";
|
||||
bool list = false, debug = false;
|
||||
int threads = 0, verbosity = 1;
|
||||
|
||||
vector<DeviceType> &types = Device::available_types();
|
||||
|
||||
foreach (DeviceType type, types) {
|
||||
if (devicelist != "")
|
||||
devicelist += ", ";
|
||||
|
||||
devicelist += Device::string_from_type(type);
|
||||
}
|
||||
|
||||
/* parse options */
|
||||
ArgParse ap;
|
||||
|
||||
ap.options("Usage: cycles_server [options]",
|
||||
"--device %s",
|
||||
&devicename,
|
||||
("Devices to use: " + devicelist).c_str(),
|
||||
"--list-devices",
|
||||
&list,
|
||||
"List information about all available devices",
|
||||
"--threads %d",
|
||||
&threads,
|
||||
"Number of threads to use for CPU device",
|
||||
#ifdef WITH_CYCLES_LOGGING
|
||||
"--debug",
|
||||
&debug,
|
||||
"Enable debug logging",
|
||||
"--verbose %d",
|
||||
&verbosity,
|
||||
"Set verbosity of the logger",
|
||||
#endif
|
||||
NULL);
|
||||
|
||||
if (ap.parse(argc, argv) < 0) {
|
||||
fprintf(stderr, "%s\n", ap.geterror().c_str());
|
||||
ap.usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
util_logging_start();
|
||||
util_logging_verbosity_set(verbosity);
|
||||
}
|
||||
|
||||
if (list) {
|
||||
vector<DeviceInfo> &devices = Device::available_devices();
|
||||
|
||||
printf("Devices:\n");
|
||||
|
||||
foreach (DeviceInfo &info, devices) {
|
||||
printf(" %s%s\n", info.description.c_str(), (info.display_device) ? " (display)" : "");
|
||||
}
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* find matching device */
|
||||
DeviceType device_type = Device::type_from_string(devicename.c_str());
|
||||
vector<DeviceInfo> &devices = Device::available_devices();
|
||||
DeviceInfo device_info;
|
||||
|
||||
foreach (DeviceInfo &device, devices) {
|
||||
if (device_type == device.type) {
|
||||
device_info = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TaskScheduler::init(threads);
|
||||
|
||||
while (1) {
|
||||
Stats stats;
|
||||
Device *device = Device::create(device_info, stats, true);
|
||||
printf("Cycles Server with device: %s\n", device->info.description.c_str());
|
||||
device->server_run();
|
||||
delete device;
|
||||
}
|
||||
|
||||
TaskScheduler::exit();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -23,10 +23,6 @@
|
||||
#include "util/unique_ptr.h"
|
||||
#include "util/version.h"
|
||||
|
||||
#ifdef WITH_USD
|
||||
# include "hydra/file_reader.h"
|
||||
#endif
|
||||
|
||||
#include "app/cycles_xml.h"
|
||||
#include "app/oiio_output_driver.h"
|
||||
|
||||
@@ -98,16 +94,8 @@ static void scene_init()
|
||||
{
|
||||
options.scene = options.session->scene;
|
||||
|
||||
/* Read XML or USD */
|
||||
#ifdef WITH_USD
|
||||
if (!string_endswith(string_to_lower(options.filepath), ".xml")) {
|
||||
HD_CYCLES_NS::HdCyclesFileReader::read(options.session, options.filepath.c_str());
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
xml_read_file(options.scene, options.filepath.c_str());
|
||||
}
|
||||
/* Read XML */
|
||||
xml_read_file(options.scene, options.filepath.c_str());
|
||||
|
||||
/* Camera width/height override? */
|
||||
if (!(options.width == 0 || options.height == 0)) {
|
||||
@@ -381,7 +369,7 @@ static void options_parse(int argc, const char **argv)
|
||||
|
||||
/* parse options */
|
||||
ArgParse ap;
|
||||
bool help = false, profile = false, debug = false, version = false;
|
||||
bool help = false, debug = false, version = false;
|
||||
int verbosity = 1;
|
||||
|
||||
ap.options("Usage: cycles [options] file.xml",
|
||||
@@ -423,9 +411,6 @@ static void options_parse(int argc, const char **argv)
|
||||
"--list-devices",
|
||||
&list,
|
||||
"List information about all available devices",
|
||||
"--profile",
|
||||
&profile,
|
||||
"Enable profile logging",
|
||||
#ifdef WITH_CYCLES_LOGGING
|
||||
"--debug",
|
||||
&debug,
|
||||
@@ -475,8 +460,6 @@ static void options_parse(int argc, const char **argv)
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
options.session_params.use_profiling = profile;
|
||||
|
||||
if (ssname == "osl")
|
||||
options.scene_params.shadingsystem = SHADINGSYSTEM_OSL;
|
||||
else if (ssname == "svm")
|
||||
|
@@ -589,6 +589,17 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
default=0.1,
|
||||
)
|
||||
|
||||
# Really annoyingly, we have to keep it around for a few releases,
|
||||
# otherwise forward compatibility breaks in really bad manner: CRASH!
|
||||
#
|
||||
# TODO(sergey): Remove this during 2.8x series of Blender.
|
||||
filter_type: EnumProperty(
|
||||
name="Filter Type",
|
||||
description="Pixel filter type",
|
||||
items=enum_filter_types,
|
||||
default='BLACKMAN_HARRIS',
|
||||
)
|
||||
|
||||
pixel_filter_type: EnumProperty(
|
||||
name="Filter Type",
|
||||
description="Pixel filter type",
|
||||
@@ -1505,12 +1516,9 @@ class CyclesPreferences(bpy.types.AddonPreferences):
|
||||
col.label(text="and NVIDIA driver version 470 or newer", icon='BLANK1')
|
||||
elif device_type == 'HIP':
|
||||
import sys
|
||||
col.label(text="Requires discrete AMD GPU with RDNA architecture", icon='BLANK1')
|
||||
if sys.platform[:3] == "win":
|
||||
col.label(text="Requires discrete AMD GPU with RDNA architecture", icon='BLANK1')
|
||||
col.label(text="and AMD Radeon Pro 21.Q4 driver or newer", icon='BLANK1')
|
||||
elif sys.platform.startswith("linux"):
|
||||
col.label(text="Requires discrete AMD GPU with RDNA architecture", icon='BLANK1')
|
||||
col.label(text="and AMD driver version 22.10 or newer", icon='BLANK1')
|
||||
elif device_type == 'METAL':
|
||||
col.label(text="Requires Apple Silicon with macOS 12.2 or newer", icon='BLANK1')
|
||||
col.label(text="or AMD with macOS 12.3 or newer", icon='BLANK1')
|
||||
|
@@ -1446,10 +1446,28 @@ class CYCLES_WORLD_PT_surface(CyclesButtonsPanel, Panel):
|
||||
layout.use_property_split = True
|
||||
|
||||
world = context.world
|
||||
view_layer = context.view_layer
|
||||
|
||||
if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
|
||||
layout.prop(world, "color")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.use_property_decorate = False
|
||||
|
||||
sub = row.column(align=True)
|
||||
sub.prop_search(
|
||||
world,
|
||||
"lightgroup",
|
||||
view_layer,
|
||||
"lightgroups",
|
||||
text="Light Group",
|
||||
results_are_suggestions=True,
|
||||
)
|
||||
|
||||
sub = row.column(align=True)
|
||||
sub.active = bool(world.lightgroup) and not any(lg.name == world.lightgroup for lg in view_layer.lightgroups)
|
||||
sub.operator("scene.view_layer_add_lightgroup", icon='ADD', text="").name = world.lightgroup
|
||||
|
||||
|
||||
class CYCLES_WORLD_PT_volume(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Volume"
|
||||
@@ -1598,40 +1616,6 @@ class CYCLES_WORLD_PT_settings_volume(CyclesButtonsPanel, Panel):
|
||||
sub.prop(cworld, "volume_step_size")
|
||||
|
||||
|
||||
class CYCLES_WORLD_PT_settings_light_group(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Light Group"
|
||||
bl_parent_id = "CYCLES_WORLD_PT_settings"
|
||||
bl_context = "world"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.world and CyclesButtonsPanel.poll(context)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
world = context.world
|
||||
view_layer = context.view_layer
|
||||
|
||||
row = layout.row(align=True)
|
||||
|
||||
sub = row.column(align=True)
|
||||
sub.prop_search(
|
||||
world,
|
||||
"lightgroup",
|
||||
view_layer,
|
||||
"lightgroups",
|
||||
text="Light Group",
|
||||
results_are_suggestions=True,
|
||||
)
|
||||
|
||||
sub = row.column(align=True)
|
||||
sub.active = bool(world.lightgroup) and not any(lg.name == world.lightgroup for lg in view_layer.lightgroups)
|
||||
sub.operator("scene.view_layer_add_lightgroup", icon='ADD', text="").name = world.lightgroup
|
||||
|
||||
|
||||
class CYCLES_MATERIAL_PT_preview(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Preview"
|
||||
bl_context = "material"
|
||||
@@ -2324,7 +2308,6 @@ classes = (
|
||||
CYCLES_WORLD_PT_settings,
|
||||
CYCLES_WORLD_PT_settings_surface,
|
||||
CYCLES_WORLD_PT_settings_volume,
|
||||
CYCLES_WORLD_PT_settings_light_group,
|
||||
CYCLES_MATERIAL_PT_preview,
|
||||
CYCLES_MATERIAL_PT_surface,
|
||||
CYCLES_MATERIAL_PT_volume,
|
||||
|
@@ -155,17 +155,16 @@ def do_versions(self):
|
||||
cscene.preview_samples = 10
|
||||
|
||||
# Filter
|
||||
if cscene.get("filter_type", -1) == -1:
|
||||
if not cscene.is_property_set("filter_type"):
|
||||
cscene.pixel_filter_type = 'GAUSSIAN'
|
||||
|
||||
if version <= (2, 76, 10):
|
||||
cscene = scene.cycles
|
||||
if not cscene.is_property_set("pixel_filter_type"):
|
||||
filter_type_int = cscene.get("filter_type", -1)
|
||||
if filter_type_int == 0:
|
||||
cscene.pixel_filter_type = 'BOX'
|
||||
elif filter_type_int == 1:
|
||||
cscene.pixel_filter_type = 'GAUSSIAN'
|
||||
if cscene.is_property_set("filter_type"):
|
||||
if not cscene.is_property_set("pixel_filter_type"):
|
||||
cscene.pixel_filter_type = cscene.filter_type
|
||||
if cscene.filter_type == 'BLACKMAN_HARRIS':
|
||||
cscene.filter_type = 'GAUSSIAN'
|
||||
|
||||
if version <= (2, 78, 2):
|
||||
cscene = scene.cycles
|
||||
|
@@ -267,82 +267,64 @@ static void mikk_compute_tangents(
|
||||
genTangSpaceDefault(&context);
|
||||
}
|
||||
|
||||
/* Create sculpt vertex color attributes. */
|
||||
static void attr_create_sculpt_vertex_color(Scene *scene,
|
||||
Mesh *mesh,
|
||||
BL::Mesh &b_mesh,
|
||||
bool subdivision)
|
||||
{
|
||||
for (BL::MeshVertColorLayer &l : b_mesh.sculpt_vertex_colors) {
|
||||
const bool active_render = l.active_render();
|
||||
AttributeStandard vcol_std = (active_render) ? ATTR_STD_VERTEX_COLOR : ATTR_STD_NONE;
|
||||
ustring vcol_name = ustring(l.name().c_str());
|
||||
|
||||
const bool need_vcol = mesh->need_attribute(scene, vcol_name) ||
|
||||
mesh->need_attribute(scene, vcol_std);
|
||||
|
||||
if (!need_vcol) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AttributeSet &attributes = (subdivision) ? mesh->subd_attributes : mesh->attributes;
|
||||
Attribute *vcol_attr = attributes.add(vcol_name, TypeRGBA, ATTR_ELEMENT_VERTEX);
|
||||
vcol_attr->std = vcol_std;
|
||||
|
||||
float4 *cdata = vcol_attr->data_float4();
|
||||
int numverts = b_mesh.vertices.length();
|
||||
|
||||
for (int i = 0; i < numverts; i++) {
|
||||
*(cdata++) = get_float4(l.data[i].color());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename TypeInCycles, typename GetValueAtIndex>
|
||||
static void fill_generic_attribute(BL::Mesh &b_mesh,
|
||||
TypeInCycles *data,
|
||||
const BL::Attribute::domain_enum b_domain,
|
||||
const bool subdivision,
|
||||
const AttributeElement element,
|
||||
const GetValueAtIndex &get_value_at_index)
|
||||
{
|
||||
switch (b_domain) {
|
||||
case BL::Attribute::domain_CORNER: {
|
||||
if (subdivision) {
|
||||
for (BL::MeshPolygon &p : b_mesh.polygons) {
|
||||
int n = p.loop_total();
|
||||
for (int i = 0; i < n; i++) {
|
||||
*data = get_value_at_index(p.loop_start() + i);
|
||||
data++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (BL::MeshLoopTriangle &t : b_mesh.loop_triangles) {
|
||||
const int index = t.index() * 3;
|
||||
BL::Array<int, 3> loops = t.loops();
|
||||
data[index] = get_value_at_index(loops[0]);
|
||||
data[index + 1] = get_value_at_index(loops[1]);
|
||||
data[index + 2] = get_value_at_index(loops[2]);
|
||||
}
|
||||
switch (element) {
|
||||
case ATTR_ELEMENT_CORNER: {
|
||||
for (BL::MeshLoopTriangle &t : b_mesh.loop_triangles) {
|
||||
const int index = t.index() * 3;
|
||||
BL::Array<int, 3> loops = t.loops();
|
||||
data[index] = get_value_at_index(loops[0]);
|
||||
data[index + 1] = get_value_at_index(loops[1]);
|
||||
data[index + 2] = get_value_at_index(loops[2]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BL::Attribute::domain_EDGE: {
|
||||
if constexpr (std::is_same_v<TypeInCycles, uchar4>) {
|
||||
/* uchar4 edge attributes do not exist, and averaging in place
|
||||
* would not work. */
|
||||
assert(0);
|
||||
}
|
||||
else {
|
||||
/* Averge edge attributes at vertices. */
|
||||
const size_t num_verts = b_mesh.vertices.length();
|
||||
vector<int> count(num_verts, 0);
|
||||
|
||||
for (BL::MeshEdge &e : b_mesh.edges) {
|
||||
BL::Array<int, 2> vertices = e.vertices();
|
||||
TypeInCycles value = get_value_at_index(e.index());
|
||||
|
||||
data[vertices[0]] += value;
|
||||
data[vertices[1]] += value;
|
||||
count[vertices[0]]++;
|
||||
count[vertices[1]]++;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < num_verts; i++) {
|
||||
if (count[i] > 1) {
|
||||
data[i] /= (float)count[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BL::Attribute::domain_POINT: {
|
||||
case ATTR_ELEMENT_VERTEX: {
|
||||
const int num_verts = b_mesh.vertices.length();
|
||||
for (int i = 0; i < num_verts; i++) {
|
||||
data[i] = get_value_at_index(i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BL::Attribute::domain_FACE: {
|
||||
if (subdivision) {
|
||||
const int num_polygons = b_mesh.polygons.length();
|
||||
for (int i = 0; i < num_polygons; i++) {
|
||||
data[i] = get_value_at_index(i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (BL::MeshLoopTriangle &t : b_mesh.loop_triangles) {
|
||||
data[t.index()] = get_value_at_index(t.polygon_index());
|
||||
}
|
||||
case ATTR_ELEMENT_FACE: {
|
||||
for (BL::MeshLoopTriangle &t : b_mesh.loop_triangles) {
|
||||
data[t.index()] = get_value_at_index(t.polygon_index());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -390,22 +372,21 @@ static void attr_create_generic(Scene *scene,
|
||||
const bool need_motion,
|
||||
const float motion_scale)
|
||||
{
|
||||
AttributeSet &attributes = (subdivision) ? mesh->subd_attributes : mesh->attributes;
|
||||
if (subdivision) {
|
||||
/* TODO: Handle subdivision correctly. */
|
||||
return;
|
||||
}
|
||||
AttributeSet &attributes = mesh->attributes;
|
||||
static const ustring u_velocity("velocity");
|
||||
|
||||
int attribute_index = 0;
|
||||
int render_color_index = b_mesh.attributes.render_color_index();
|
||||
|
||||
for (BL::Attribute &b_attribute : b_mesh.attributes) {
|
||||
const ustring name{b_attribute.name().c_str()};
|
||||
const bool is_render_color = (attribute_index++ == render_color_index);
|
||||
|
||||
if (need_motion && name == u_velocity) {
|
||||
attr_create_motion(mesh, b_attribute, motion_scale);
|
||||
}
|
||||
|
||||
if (!(mesh->need_attribute(scene, name) ||
|
||||
(is_render_color && mesh->need_attribute(scene, ATTR_STD_VERTEX_COLOR)))) {
|
||||
if (!mesh->need_attribute(scene, name)) {
|
||||
continue;
|
||||
}
|
||||
if (attributes.find(name)) {
|
||||
@@ -423,9 +404,6 @@ static void attr_create_generic(Scene *scene,
|
||||
case BL::Attribute::domain_POINT:
|
||||
element = ATTR_ELEMENT_VERTEX;
|
||||
break;
|
||||
case BL::Attribute::domain_EDGE:
|
||||
element = ATTR_ELEMENT_VERTEX;
|
||||
break;
|
||||
case BL::Attribute::domain_FACE:
|
||||
element = ATTR_ELEMENT_FACE;
|
||||
break;
|
||||
@@ -441,77 +419,41 @@ static void attr_create_generic(Scene *scene,
|
||||
BL::FloatAttribute b_float_attribute{b_attribute};
|
||||
Attribute *attr = attributes.add(name, TypeFloat, element);
|
||||
float *data = attr->data_float();
|
||||
fill_generic_attribute(b_mesh, data, b_domain, subdivision, [&](int i) {
|
||||
return b_float_attribute.data[i].value();
|
||||
});
|
||||
fill_generic_attribute(
|
||||
b_mesh, data, element, [&](int i) { return b_float_attribute.data[i].value(); });
|
||||
break;
|
||||
}
|
||||
case BL::Attribute::data_type_BOOLEAN: {
|
||||
BL::BoolAttribute b_bool_attribute{b_attribute};
|
||||
Attribute *attr = attributes.add(name, TypeFloat, element);
|
||||
float *data = attr->data_float();
|
||||
fill_generic_attribute(b_mesh, data, b_domain, subdivision, [&](int i) {
|
||||
return (float)b_bool_attribute.data[i].value();
|
||||
});
|
||||
fill_generic_attribute(
|
||||
b_mesh, data, element, [&](int i) { return (float)b_bool_attribute.data[i].value(); });
|
||||
break;
|
||||
}
|
||||
case BL::Attribute::data_type_INT: {
|
||||
BL::IntAttribute b_int_attribute{b_attribute};
|
||||
Attribute *attr = attributes.add(name, TypeFloat, element);
|
||||
float *data = attr->data_float();
|
||||
fill_generic_attribute(b_mesh, data, b_domain, subdivision, [&](int i) {
|
||||
return (float)b_int_attribute.data[i].value();
|
||||
});
|
||||
fill_generic_attribute(
|
||||
b_mesh, data, element, [&](int i) { return (float)b_int_attribute.data[i].value(); });
|
||||
break;
|
||||
}
|
||||
case BL::Attribute::data_type_FLOAT_VECTOR: {
|
||||
BL::FloatVectorAttribute b_vector_attribute{b_attribute};
|
||||
Attribute *attr = attributes.add(name, TypeVector, element);
|
||||
float3 *data = attr->data_float3();
|
||||
fill_generic_attribute(b_mesh, data, b_domain, subdivision, [&](int i) {
|
||||
fill_generic_attribute(b_mesh, data, element, [&](int i) {
|
||||
BL::Array<float, 3> v = b_vector_attribute.data[i].vector();
|
||||
return make_float3(v[0], v[1], v[2]);
|
||||
});
|
||||
break;
|
||||
}
|
||||
case BL::Attribute::data_type_BYTE_COLOR: {
|
||||
BL::ByteColorAttribute b_color_attribute{b_attribute};
|
||||
|
||||
if (element == ATTR_ELEMENT_CORNER) {
|
||||
element = ATTR_ELEMENT_CORNER_BYTE;
|
||||
}
|
||||
Attribute *attr = attributes.add(name, TypeRGBA, element);
|
||||
if (is_render_color) {
|
||||
attr->std = ATTR_STD_VERTEX_COLOR;
|
||||
}
|
||||
|
||||
if (element == ATTR_ELEMENT_CORNER_BYTE) {
|
||||
uchar4 *data = attr->data_uchar4();
|
||||
fill_generic_attribute(b_mesh, data, b_domain, subdivision, [&](int i) {
|
||||
/* Compress/encode vertex color using the sRGB curve. */
|
||||
const float4 c = get_float4(b_color_attribute.data[i].color());
|
||||
return color_float4_to_uchar4(color_linear_to_srgb_v4(c));
|
||||
});
|
||||
}
|
||||
else {
|
||||
float4 *data = attr->data_float4();
|
||||
fill_generic_attribute(b_mesh, data, b_domain, subdivision, [&](int i) {
|
||||
BL::Array<float, 4> v = b_color_attribute.data[i].color();
|
||||
return make_float4(v[0], v[1], v[2], v[3]);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BL::Attribute::data_type_FLOAT_COLOR: {
|
||||
BL::FloatColorAttribute b_color_attribute{b_attribute};
|
||||
|
||||
Attribute *attr = attributes.add(name, TypeRGBA, element);
|
||||
if (is_render_color) {
|
||||
attr->std = ATTR_STD_VERTEX_COLOR;
|
||||
}
|
||||
|
||||
float4 *data = attr->data_float4();
|
||||
fill_generic_attribute(b_mesh, data, b_domain, subdivision, [&](int i) {
|
||||
fill_generic_attribute(b_mesh, data, element, [&](int i) {
|
||||
BL::Array<float, 4> v = b_color_attribute.data[i].color();
|
||||
return make_float4(v[0], v[1], v[2], v[3]);
|
||||
});
|
||||
@@ -521,7 +463,7 @@ static void attr_create_generic(Scene *scene,
|
||||
BL::Float2Attribute b_float2_attribute{b_attribute};
|
||||
Attribute *attr = attributes.add(name, TypeFloat2, element);
|
||||
float2 *data = attr->data_float2();
|
||||
fill_generic_attribute(b_mesh, data, b_domain, subdivision, [&](int i) {
|
||||
fill_generic_attribute(b_mesh, data, element, [&](int i) {
|
||||
BL::Array<float, 2> v = b_float2_attribute.data[i].vector();
|
||||
return make_float2(v[0], v[1]);
|
||||
});
|
||||
@@ -534,6 +476,69 @@ static void attr_create_generic(Scene *scene,
|
||||
}
|
||||
}
|
||||
|
||||
/* Create vertex color attributes. */
|
||||
static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh, bool subdivision)
|
||||
{
|
||||
for (BL::MeshLoopColorLayer &l : b_mesh.vertex_colors) {
|
||||
const bool active_render = l.active_render();
|
||||
AttributeStandard vcol_std = (active_render) ? ATTR_STD_VERTEX_COLOR : ATTR_STD_NONE;
|
||||
ustring vcol_name = ustring(l.name().c_str());
|
||||
|
||||
const bool need_vcol = mesh->need_attribute(scene, vcol_name) ||
|
||||
mesh->need_attribute(scene, vcol_std);
|
||||
|
||||
if (!need_vcol) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Attribute *vcol_attr = NULL;
|
||||
|
||||
if (subdivision) {
|
||||
if (active_render) {
|
||||
vcol_attr = mesh->subd_attributes.add(vcol_std, vcol_name);
|
||||
}
|
||||
else {
|
||||
vcol_attr = mesh->subd_attributes.add(vcol_name, TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
|
||||
}
|
||||
|
||||
uchar4 *cdata = vcol_attr->data_uchar4();
|
||||
|
||||
for (BL::MeshPolygon &p : b_mesh.polygons) {
|
||||
int n = p.loop_total();
|
||||
for (int i = 0; i < n; i++) {
|
||||
float4 color = get_float4(l.data[p.loop_start() + i].color());
|
||||
/* Compress/encode vertex color using the sRGB curve. */
|
||||
*(cdata++) = color_float4_to_uchar4(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (active_render) {
|
||||
vcol_attr = mesh->attributes.add(vcol_std, vcol_name);
|
||||
}
|
||||
else {
|
||||
vcol_attr = mesh->attributes.add(vcol_name, TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
|
||||
}
|
||||
|
||||
uchar4 *cdata = vcol_attr->data_uchar4();
|
||||
|
||||
for (BL::MeshLoopTriangle &t : b_mesh.loop_triangles) {
|
||||
int3 li = get_int3(t.loops());
|
||||
float4 c1 = get_float4(l.data[li[0]].color());
|
||||
float4 c2 = get_float4(l.data[li[1]].color());
|
||||
float4 c3 = get_float4(l.data[li[2]].color());
|
||||
|
||||
/* Compress/encode vertex color using the sRGB curve. */
|
||||
cdata[0] = color_float4_to_uchar4(c1);
|
||||
cdata[1] = color_float4_to_uchar4(c2);
|
||||
cdata[2] = color_float4_to_uchar4(c3);
|
||||
|
||||
cdata += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Create uv map attributes. */
|
||||
static void attr_create_uv_map(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh)
|
||||
{
|
||||
@@ -997,6 +1002,8 @@ static void create_mesh(Scene *scene,
|
||||
* The calculate functions will check whether they're needed or not.
|
||||
*/
|
||||
attr_create_pointiness(scene, mesh, b_mesh, subdivision);
|
||||
attr_create_vertex_color(scene, mesh, b_mesh, subdivision);
|
||||
attr_create_sculpt_vertex_color(scene, mesh, b_mesh, subdivision);
|
||||
attr_create_random_per_island(scene, mesh, b_mesh, subdivision);
|
||||
attr_create_generic(scene, mesh, b_mesh, subdivision, need_motion, motion_scale);
|
||||
|
||||
|
@@ -508,139 +508,87 @@ void BlenderSession::render_frame_finish()
|
||||
full_buffer_files_.clear();
|
||||
}
|
||||
|
||||
static bool bake_setup_pass(Scene *scene, const string &bake_type_str, const int bake_filter)
|
||||
static PassType bake_type_to_pass(const string &bake_type_str, const int bake_filter)
|
||||
{
|
||||
Integrator *integrator = scene->integrator;
|
||||
const char *bake_type = bake_type_str.c_str();
|
||||
|
||||
PassType type = PASS_NONE;
|
||||
bool use_direct_light = false;
|
||||
bool use_indirect_light = false;
|
||||
bool include_albedo = false;
|
||||
|
||||
/* Data passes. */
|
||||
/* data passes */
|
||||
if (strcmp(bake_type, "POSITION") == 0) {
|
||||
type = PASS_POSITION;
|
||||
return PASS_POSITION;
|
||||
}
|
||||
else if (strcmp(bake_type, "NORMAL") == 0) {
|
||||
type = PASS_NORMAL;
|
||||
return PASS_NORMAL;
|
||||
}
|
||||
else if (strcmp(bake_type, "UV") == 0) {
|
||||
type = PASS_UV;
|
||||
return PASS_UV;
|
||||
}
|
||||
else if (strcmp(bake_type, "ROUGHNESS") == 0) {
|
||||
type = PASS_ROUGHNESS;
|
||||
return PASS_ROUGHNESS;
|
||||
}
|
||||
else if (strcmp(bake_type, "EMIT") == 0) {
|
||||
type = PASS_EMISSION;
|
||||
return PASS_EMISSION;
|
||||
}
|
||||
/* Environment pass. */
|
||||
else if (strcmp(bake_type, "ENVIRONMENT") == 0) {
|
||||
type = PASS_BACKGROUND;
|
||||
}
|
||||
/* AO passes. */
|
||||
/* light passes */
|
||||
else if (strcmp(bake_type, "AO") == 0) {
|
||||
type = PASS_AO;
|
||||
return PASS_AO;
|
||||
}
|
||||
/* Combined pass. */
|
||||
else if (strcmp(bake_type, "COMBINED") == 0) {
|
||||
type = PASS_COMBINED;
|
||||
|
||||
use_direct_light = (bake_filter & BL::BakeSettings::pass_filter_DIRECT) != 0;
|
||||
use_indirect_light = (bake_filter & BL::BakeSettings::pass_filter_INDIRECT) != 0;
|
||||
include_albedo = (bake_filter & BL::BakeSettings::pass_filter_COLOR);
|
||||
|
||||
integrator->set_use_diffuse((bake_filter & BL::BakeSettings::pass_filter_DIFFUSE) != 0);
|
||||
integrator->set_use_glossy((bake_filter & BL::BakeSettings::pass_filter_GLOSSY) != 0);
|
||||
integrator->set_use_transmission((bake_filter & BL::BakeSettings::pass_filter_TRANSMISSION) !=
|
||||
0);
|
||||
integrator->set_use_emission((bake_filter & BL::BakeSettings::pass_filter_EMIT) != 0);
|
||||
return PASS_COMBINED;
|
||||
}
|
||||
/* Shadow pass. */
|
||||
else if (strcmp(bake_type, "SHADOW") == 0) {
|
||||
type = PASS_SHADOW;
|
||||
use_direct_light = true;
|
||||
return PASS_SHADOW;
|
||||
}
|
||||
/* Light component passes. */
|
||||
else if (strcmp(bake_type, "DIFFUSE") == 0) {
|
||||
if ((bake_filter & BL::BakeSettings::pass_filter_DIRECT) &&
|
||||
bake_filter & BL::BakeSettings::pass_filter_INDIRECT) {
|
||||
type = PASS_DIFFUSE;
|
||||
use_direct_light = true;
|
||||
use_indirect_light = true;
|
||||
return PASS_DIFFUSE;
|
||||
}
|
||||
else if (bake_filter & BL::BakeSettings::pass_filter_DIRECT) {
|
||||
type = PASS_DIFFUSE_DIRECT;
|
||||
use_direct_light = true;
|
||||
return PASS_DIFFUSE_DIRECT;
|
||||
}
|
||||
else if (bake_filter & BL::BakeSettings::pass_filter_INDIRECT) {
|
||||
type = PASS_DIFFUSE_INDIRECT;
|
||||
use_indirect_light = true;
|
||||
return PASS_DIFFUSE_INDIRECT;
|
||||
}
|
||||
else {
|
||||
type = PASS_DIFFUSE_COLOR;
|
||||
return PASS_DIFFUSE_COLOR;
|
||||
}
|
||||
|
||||
include_albedo = (bake_filter & BL::BakeSettings::pass_filter_COLOR);
|
||||
}
|
||||
else if (strcmp(bake_type, "GLOSSY") == 0) {
|
||||
if ((bake_filter & BL::BakeSettings::pass_filter_DIRECT) &&
|
||||
bake_filter & BL::BakeSettings::pass_filter_INDIRECT) {
|
||||
type = PASS_GLOSSY;
|
||||
use_direct_light = true;
|
||||
use_indirect_light = true;
|
||||
return PASS_GLOSSY;
|
||||
}
|
||||
else if (bake_filter & BL::BakeSettings::pass_filter_DIRECT) {
|
||||
type = PASS_GLOSSY_DIRECT;
|
||||
use_direct_light = true;
|
||||
return PASS_GLOSSY_DIRECT;
|
||||
}
|
||||
else if (bake_filter & BL::BakeSettings::pass_filter_INDIRECT) {
|
||||
type = PASS_GLOSSY_INDIRECT;
|
||||
use_indirect_light = true;
|
||||
return PASS_GLOSSY_INDIRECT;
|
||||
}
|
||||
else {
|
||||
type = PASS_GLOSSY_COLOR;
|
||||
return PASS_GLOSSY_COLOR;
|
||||
}
|
||||
|
||||
include_albedo = (bake_filter & BL::BakeSettings::pass_filter_COLOR);
|
||||
}
|
||||
else if (strcmp(bake_type, "TRANSMISSION") == 0) {
|
||||
if ((bake_filter & BL::BakeSettings::pass_filter_DIRECT) &&
|
||||
bake_filter & BL::BakeSettings::pass_filter_INDIRECT) {
|
||||
type = PASS_TRANSMISSION;
|
||||
use_direct_light = true;
|
||||
use_indirect_light = true;
|
||||
return PASS_TRANSMISSION;
|
||||
}
|
||||
else if (bake_filter & BL::BakeSettings::pass_filter_DIRECT) {
|
||||
type = PASS_TRANSMISSION_DIRECT;
|
||||
use_direct_light = true;
|
||||
return PASS_TRANSMISSION_DIRECT;
|
||||
}
|
||||
else if (bake_filter & BL::BakeSettings::pass_filter_INDIRECT) {
|
||||
type = PASS_TRANSMISSION_INDIRECT;
|
||||
use_indirect_light = true;
|
||||
return PASS_TRANSMISSION_INDIRECT;
|
||||
}
|
||||
else {
|
||||
type = PASS_TRANSMISSION_COLOR;
|
||||
return PASS_TRANSMISSION_COLOR;
|
||||
}
|
||||
|
||||
include_albedo = (bake_filter & BL::BakeSettings::pass_filter_COLOR);
|
||||
}
|
||||
/* extra */
|
||||
else if (strcmp(bake_type, "ENVIRONMENT") == 0) {
|
||||
return PASS_BACKGROUND;
|
||||
}
|
||||
|
||||
if (type == PASS_NONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Create pass. */
|
||||
Pass *pass = scene->create_node<Pass>();
|
||||
pass->set_name(ustring("Combined"));
|
||||
pass->set_type(type);
|
||||
pass->set_include_albedo(include_albedo);
|
||||
|
||||
/* Disable direct indirect light for performance when not needed. */
|
||||
integrator->set_use_direct_light(use_direct_light);
|
||||
integrator->set_use_indirect_light(use_indirect_light);
|
||||
|
||||
return true;
|
||||
return PASS_COMBINED;
|
||||
}
|
||||
|
||||
void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
|
||||
@@ -655,25 +603,39 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
|
||||
/* Initialize bake manager, before we load the baking kernels. */
|
||||
scene->bake_manager->set(scene, b_object.name());
|
||||
|
||||
/* Add render pass that we want to bake, and name it Combined so that it is
|
||||
* used as that on the Blender side. */
|
||||
Pass *pass = scene->create_node<Pass>();
|
||||
pass->set_name(ustring("Combined"));
|
||||
pass->set_type(bake_type_to_pass(bake_type, bake_filter));
|
||||
pass->set_include_albedo((bake_filter & BL::BakeSettings::pass_filter_COLOR));
|
||||
|
||||
session->set_display_driver(nullptr);
|
||||
session->set_output_driver(make_unique<BlenderOutputDriver>(b_engine));
|
||||
|
||||
/* Sync scene. */
|
||||
BL::Object b_camera_override(b_engine.camera_override());
|
||||
sync->sync_camera(b_render, b_camera_override, width, height, "");
|
||||
sync->sync_data(
|
||||
b_render, b_depsgraph, b_v3d, b_camera_override, width, height, &python_thread_state);
|
||||
|
||||
/* Add render pass that we want to bake, and name it Combined so that it is
|
||||
* used as that on the Blender side. */
|
||||
if (!bake_setup_pass(scene, bake_type, bake_filter)) {
|
||||
session->cancel(true);
|
||||
}
|
||||
|
||||
/* Always use transparent background for baking. */
|
||||
scene->background->set_transparent(true);
|
||||
|
||||
if (!session->progress.get_cancel()) {
|
||||
/* Sync scene. */
|
||||
BL::Object b_camera_override(b_engine.camera_override());
|
||||
sync->sync_camera(b_render, b_camera_override, width, height, "");
|
||||
sync->sync_data(
|
||||
b_render, b_depsgraph, b_v3d, b_camera_override, width, height, &python_thread_state);
|
||||
|
||||
/* Filtering settings for combined pass. */
|
||||
if (pass->get_type() == PASS_COMBINED) {
|
||||
Integrator *integrator = scene->integrator;
|
||||
integrator->set_use_direct_light((bake_filter & BL::BakeSettings::pass_filter_DIRECT) != 0);
|
||||
integrator->set_use_indirect_light((bake_filter & BL::BakeSettings::pass_filter_INDIRECT) !=
|
||||
0);
|
||||
integrator->set_use_diffuse((bake_filter & BL::BakeSettings::pass_filter_DIFFUSE) != 0);
|
||||
integrator->set_use_glossy((bake_filter & BL::BakeSettings::pass_filter_GLOSSY) != 0);
|
||||
integrator->set_use_transmission(
|
||||
(bake_filter & BL::BakeSettings::pass_filter_TRANSMISSION) != 0);
|
||||
integrator->set_use_emission((bake_filter & BL::BakeSettings::pass_filter_EMIT) != 0);
|
||||
}
|
||||
|
||||
/* Always use transparent background for baking. */
|
||||
scene->background->set_transparent(true);
|
||||
|
||||
/* Load built-in images from Blender. */
|
||||
builtin_images_load();
|
||||
}
|
||||
@@ -681,12 +643,10 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
|
||||
/* Object might have been disabled for rendering or excluded in some
|
||||
* other way, in that case Blender will report a warning afterwards. */
|
||||
bool object_found = false;
|
||||
if (!session->progress.get_cancel()) {
|
||||
foreach (Object *ob, scene->objects) {
|
||||
if (ob->name == b_object.name()) {
|
||||
object_found = true;
|
||||
break;
|
||||
}
|
||||
foreach (Object *ob, scene->objects) {
|
||||
if (ob->name == b_object.name()) {
|
||||
object_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -262,11 +262,8 @@ static inline bool BKE_object_is_modified(BL::Object &self, BL::Scene &scene, bo
|
||||
static inline bool BKE_object_is_deform_modified(BObjectInfo &self, BL::Scene &scene, bool preview)
|
||||
{
|
||||
if (!self.is_real_object_data()) {
|
||||
/* Comes from geometry nodes, can't use heuristic to guess if it's animated. */
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Use heuristic to quickly check if object is potentially animated. */
|
||||
return self.real_object.is_deform_modified(scene, (preview) ? (1 << 0) : (1 << 1)) ? true :
|
||||
false;
|
||||
}
|
||||
|
@@ -24,9 +24,6 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
||||
else()
|
||||
set(_cycles_lib_dir "${CMAKE_SOURCE_DIR}/../lib/darwin_arm64")
|
||||
endif()
|
||||
|
||||
# Always use system zlib
|
||||
find_package(ZLIB REQUIRED)
|
||||
elseif(WIN32)
|
||||
if(CMAKE_CL_64)
|
||||
set(_cycles_lib_dir "${CMAKE_SOURCE_DIR}/../lib/win64_vc15")
|
||||
@@ -69,12 +66,10 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
||||
_set_default(BOOST_ROOT "${_cycles_lib_dir}/boost")
|
||||
_set_default(BLOSC_ROOT_DIR "${_cycles_lib_dir}/blosc")
|
||||
_set_default(EMBREE_ROOT_DIR "${_cycles_lib_dir}/embree")
|
||||
_set_default(IMATH_ROOT_DIR "${_cycles_lib_dir}/imath")
|
||||
_set_default(GLEW_ROOT_DIR "${_cycles_lib_dir}/glew")
|
||||
_set_default(JPEG_ROOT "${_cycles_lib_dir}/jpeg")
|
||||
_set_default(LLVM_ROOT_DIR "${_cycles_lib_dir}/llvm")
|
||||
_set_default(CLANG_ROOT_DIR "${_cycles_lib_dir}/llvm")
|
||||
_set_default(NANOVDB_ROOT_DIR "${_cycles_lib_dir}/openvdb")
|
||||
_set_default(OPENCOLORIO_ROOT_DIR "${_cycles_lib_dir}/opencolorio")
|
||||
_set_default(OPENEXR_ROOT_DIR "${_cycles_lib_dir}/openexr")
|
||||
_set_default(OPENIMAGEDENOISE_ROOT_DIR "${_cycles_lib_dir}/openimagedenoise")
|
||||
@@ -85,11 +80,8 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
||||
_set_default(OSL_ROOT_DIR "${_cycles_lib_dir}/osl")
|
||||
_set_default(PNG_ROOT "${_cycles_lib_dir}/png")
|
||||
_set_default(PUGIXML_ROOT_DIR "${_cycles_lib_dir}/pugixml")
|
||||
_set_default(SDL2_ROOT_DIR "${_cycles_lib_dir}/sdl")
|
||||
_set_default(TBB_ROOT_DIR "${_cycles_lib_dir}/tbb")
|
||||
_set_default(TIFF_ROOT "${_cycles_lib_dir}/tiff")
|
||||
_set_default(USD_ROOT_DIR "${_cycles_lib_dir}/usd")
|
||||
_set_default(WEBP_ROOT_DIR "${_cycles_lib_dir}/webp")
|
||||
_set_default(ZLIB_ROOT "${_cycles_lib_dir}/zlib")
|
||||
|
||||
# Ignore system libraries
|
||||
@@ -99,6 +91,23 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
###########################################################################
|
||||
# USD
|
||||
###########################################################################
|
||||
|
||||
if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_HYDRA_RENDER_DELEGATE)
|
||||
set(WITH_USD ON)
|
||||
endif()
|
||||
if(WITH_CYCLES_HYDRA_RENDER_DELEGATE)
|
||||
find_package(pxr CONFIG REQUIRED PATHS ${PXR_ROOT} ${USD_ROOT} NO_DEFAULT_PATH)
|
||||
if(pxr_FOUND)
|
||||
set(PXR_LIBRARY_DIR ${PXR_CMAKE_DIR}/lib)
|
||||
set(USD_INCLUDE_DIRS ${PXR_INCLUDE_DIRS})
|
||||
else()
|
||||
set(WITH_USD OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
###########################################################################
|
||||
# Zlib
|
||||
###########################################################################
|
||||
@@ -180,7 +189,6 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
||||
|
||||
find_package(JPEG REQUIRED)
|
||||
find_package(TIFF REQUIRED)
|
||||
find_package(WebP)
|
||||
|
||||
if(EXISTS ${_cycles_lib_dir})
|
||||
set(PNG_NAMES png16 libpng16 png libpng)
|
||||
@@ -269,22 +277,20 @@ endif()
|
||||
if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_OPENCOLORIO)
|
||||
set(WITH_OPENCOLORIO ON)
|
||||
|
||||
if(NOT USD_OVERRIDE_OPENCOLORIO)
|
||||
if(MSVC AND EXISTS ${_cycles_lib_dir})
|
||||
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO_ROOT_DIR}/include)
|
||||
set(OPENCOLORIO_LIBRARIES
|
||||
optimized ${OPENCOLORIO_ROOT_DIR}/lib/OpenColorIO.lib
|
||||
optimized ${OPENCOLORIO_ROOT_DIR}/lib/libyaml-cpp.lib
|
||||
optimized ${OPENCOLORIO_ROOT_DIR}/lib/libexpatMD.lib
|
||||
optimized ${OPENCOLORIO_ROOT_DIR}/lib/pystring.lib
|
||||
debug ${OPENCOLORIO_ROOT_DIR}/lib/OpencolorIO_d.lib
|
||||
debug ${OPENCOLORIO_ROOT_DIR}/lib/libyaml-cpp_d.lib
|
||||
debug ${OPENCOLORIO_ROOT_DIR}/lib/libexpatdMD.lib
|
||||
debug ${OPENCOLORIO_ROOT_DIR}/lib/pystring_d.lib
|
||||
)
|
||||
else()
|
||||
find_package(OpenColorIO REQUIRED)
|
||||
endif()
|
||||
if(MSVC AND EXISTS ${_cycles_lib_dir})
|
||||
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO_ROOT_DIR}/include)
|
||||
set(OPENCOLORIO_LIBRARIES
|
||||
optimized ${OPENCOLORIO_ROOT_DIR}/lib/OpenColorIO.lib
|
||||
optimized ${OPENCOLORIO_ROOT_DIR}/lib/libyaml-cpp.lib
|
||||
optimized ${OPENCOLORIO_ROOT_DIR}/lib/libexpatMD.lib
|
||||
optimized ${OPENCOLORIO_ROOT_DIR}/lib/pystring.lib
|
||||
debug ${OPENCOLORIO_ROOT_DIR}/lib/OpencolorIO_d.lib
|
||||
debug ${OPENCOLORIO_ROOT_DIR}/lib/libyaml-cpp_d.lib
|
||||
debug ${OPENCOLORIO_ROOT_DIR}/lib/libexpatdMD.lib
|
||||
debug ${OPENCOLORIO_ROOT_DIR}/lib/pystring_d.lib
|
||||
)
|
||||
else()
|
||||
find_package(OpenColorIO REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -360,7 +366,7 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
||||
set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
|
||||
endif()
|
||||
|
||||
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB ${BOOST_DEFINITIONS}")
|
||||
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
|
||||
endif()
|
||||
|
||||
###########################################################################
|
||||
@@ -408,10 +414,26 @@ endif()
|
||||
# OpenSubdiv
|
||||
###########################################################################
|
||||
|
||||
if(WITH_CYCLES_HYDRA_RENDER_DELEGATE AND PXR_LIBRARY_DIR AND (WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV))
|
||||
find_library(OPENSUBDIV_LIBRARY_CPU_DEBUG_PXR NAMES osdCPU_d osdCPU PATHS ${PXR_LIBRARY_DIR} NO_CACHE NO_DEFAULT_PATH)
|
||||
find_library(OPENSUBDIV_LIBRARY_GPU_DEBUG_PXR NAMES osdGPU_d osdGPU PATHS ${PXR_LIBRARY_DIR} NO_CACHE NO_DEFAULT_PATH)
|
||||
find_library(OPENSUBDIV_LIBRARY_CPU_RELEASE_PXR NAMES osdCPU PATHS ${PXR_LIBRARY_DIR} NO_CACHE NO_DEFAULT_PATH)
|
||||
find_library(OPENSUBDIV_LIBRARY_GPU_RELEASE_PXR NAMES osdGPU PATHS ${PXR_LIBRARY_DIR} NO_CACHE NO_DEFAULT_PATH)
|
||||
if(OPENSUBDIV_LIBRARY_CPU_RELEASE_PXR AND OPENSUBDIV_LIBRARY_GPU_RELEASE_PXR)
|
||||
set(OPENSUBDIV_INCLUDE_DIRS ${PXR_INCLUDE_DIRS})
|
||||
set(OPENSUBDIV_LIBRARIES
|
||||
optimized ${OPENSUBDIV_LIBRARY_CPU_RELEASE_PXR}
|
||||
optimized ${OPENSUBDIV_LIBRARY_GPU_RELEASE_PXR}
|
||||
debug ${OPENSUBDIV_LIBRARY_CPU_DEBUG_PXR}
|
||||
debug ${OPENSUBDIV_LIBRARY_GPU_DEBUG_PXR}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_OPENSUBDIV)
|
||||
set(WITH_OPENSUBDIV ON)
|
||||
|
||||
if(NOT USD_OVERRIDE_OPENSUBDIV)
|
||||
if(NOT OPENSUBDIV_LIBRARY_CPU_RELEASE_PXR OR NOT OPENSUBDIV_LIBRARY_GPU_RELEASE_PXR)
|
||||
if(MSVC AND EXISTS ${_cycles_lib_dir})
|
||||
set(OPENSUBDIV_INCLUDE_DIRS ${OPENSUBDIV_ROOT_DIR}/include)
|
||||
set(OPENSUBDIV_LIBRARIES
|
||||
@@ -430,11 +452,19 @@ endif()
|
||||
# OpenVDB
|
||||
###########################################################################
|
||||
|
||||
if(WITH_CYCLES_HYDRA_RENDER_DELEGATE AND PXR_LIBRARY_DIR AND (WITH_OPENVDB OR WITH_CYCLES_OPENVDB))
|
||||
find_library(OPENVDB_LIBRARY_PXR NAMES openvdb PATHS ${PXR_LIBRARY_DIR} NO_CACHE NO_DEFAULT_PATH)
|
||||
if(OPENVDB_LIBRARY_PXR)
|
||||
set(OPENVDB_INCLUDE_DIRS ${PXR_INCLUDE_DIRS})
|
||||
set(OPENVDB_LIBRARIES ${OPENVDB_LIBRARY_PXR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_OPENVDB)
|
||||
set(WITH_OPENVDB ON)
|
||||
set(OPENVDB_DEFINITIONS -DNOMINMAX -D_USE_MATH_DEFINES)
|
||||
|
||||
if(NOT USD_OVERRIDE_OPENVDB)
|
||||
if(NOT OPENVDB_LIBRARY_PXR)
|
||||
find_package(OpenVDB REQUIRED)
|
||||
|
||||
if(MSVC AND EXISTS ${_cycles_lib_dir})
|
||||
@@ -448,20 +478,6 @@ if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_OPENVDB)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
###########################################################################
|
||||
# NanoVDB
|
||||
###########################################################################
|
||||
|
||||
if(CYCLES_STANDALONE_REPOSITORY AND WITH_CYCLES_NANOVDB)
|
||||
set(WITH_NANOVDB ON)
|
||||
|
||||
if(MSVC AND EXISTS ${_cycles_lib_dir})
|
||||
set(NANOVDB_INCLUDE_DIR ${NANOVDB_ROOT_DIR}/include)
|
||||
else()
|
||||
find_package(NanoVDB REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
###########################################################################
|
||||
# OpenImageDenoise
|
||||
###########################################################################
|
||||
@@ -488,8 +504,20 @@ endif()
|
||||
# TBB
|
||||
###########################################################################
|
||||
|
||||
if(WITH_CYCLES_HYDRA_RENDER_DELEGATE AND PXR_LIBRARY_DIR)
|
||||
find_library(TBB_LIBRARY_DEBUG_PXR NAMES tbb_debug tbb PATHS ${PXR_LIBRARY_DIR} NO_CACHE NO_DEFAULT_PATH)
|
||||
find_library(TBB_LIBRARY_RELEASE_PXR NAMES tbb PATHS ${PXR_LIBRARY_DIR} NO_CACHE NO_DEFAULT_PATH)
|
||||
if(TBB_LIBRARY_RELEASE_PXR)
|
||||
set(TBB_INCLUDE_DIRS ${PXR_INCLUDE_DIRS})
|
||||
set(TBB_LIBRARIES
|
||||
optimized ${TBB_LIBRARY_RELEASE_PXR}
|
||||
debug ${TBB_LIBRARY_DEBUG_PXR}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CYCLES_STANDALONE_REPOSITORY)
|
||||
if(NOT USD_OVERRIDE_TBB)
|
||||
if(NOT TBB_LIBRARY_RELEASE_PXR)
|
||||
if(MSVC AND EXISTS ${_cycles_lib_dir})
|
||||
set(TBB_INCLUDE_DIRS ${TBB_ROOT_DIR}/include)
|
||||
set(TBB_LIBRARIES
|
||||
@@ -558,8 +586,7 @@ endif()
|
||||
# OpenGL
|
||||
###########################################################################
|
||||
|
||||
if((WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI) OR
|
||||
WITH_CYCLES_HYDRA_RENDER_DELEGATE)
|
||||
if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
|
||||
if(CYCLES_STANDALONE_REPOSITORY)
|
||||
if(NOT DEFINED OpenGL_GL_PREFERENCE)
|
||||
set(OpenGL_GL_PREFERENCE "LEGACY")
|
||||
@@ -597,7 +624,7 @@ endif()
|
||||
# CUDA
|
||||
###########################################################################
|
||||
|
||||
if(WITH_CYCLES_DEVICE_CUDA AND (WITH_CYCLES_CUDA_BINARIES OR NOT WITH_CUDA_DYNLOAD))
|
||||
if(WITH_CYCLES_CUDA_BINARIES OR NOT WITH_CUDA_DYNLOAD)
|
||||
find_package(CUDA) # Try to auto locate CUDA toolkit
|
||||
if(CUDA_FOUND)
|
||||
message(STATUS "Found CUDA ${CUDA_NVCC_EXECUTABLE} (${CUDA_VERSION})")
|
||||
@@ -647,3 +674,16 @@ if(WITH_CYCLES_DEVICE_METAL)
|
||||
message(STATUS "Found Metal: ${METAL_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
###########################################################################
|
||||
# macOS
|
||||
###########################################################################
|
||||
|
||||
if(CYCLES_STANDALONE_REPOSITORY)
|
||||
# On macOS, always use zlib from system.
|
||||
if(APPLE)
|
||||
set(ZLIB_ROOT /usr)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -74,19 +74,6 @@ macro(cycles_add_library target library_deps)
|
||||
endmacro()
|
||||
|
||||
macro(cycles_external_libraries_append libraries)
|
||||
if(APPLE)
|
||||
list(APPEND ${libraries} "-framework Foundation")
|
||||
if(WITH_USD)
|
||||
list(APPEND ${libraries} "-framework CoreVideo -framework Cocoa")
|
||||
endif()
|
||||
if(WITH_CYCLES_STANDALONE_GUI OR WITH_USD)
|
||||
list(APPEND ${libraries} "-framework OpenGL")
|
||||
endif()
|
||||
elseif(UNIX)
|
||||
if(WITH_USD)
|
||||
list(APPEND ${libraries} "X11")
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_CYCLES_LOGGING)
|
||||
list(APPEND ${libraries} ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES})
|
||||
endif()
|
||||
@@ -103,7 +90,6 @@ macro(cycles_external_libraries_append libraries)
|
||||
list(APPEND ${libraries} ${OPENCOLORIO_LIBRARIES})
|
||||
if(APPLE)
|
||||
list(APPEND ${libraries} "-framework IOKit")
|
||||
list(APPEND ${libraries} "-framework Carbon")
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_OPENVDB)
|
||||
|
@@ -457,8 +457,6 @@ void CUDADevice::reserve_local_memory(const uint kernel_features)
|
||||
/* Use the biggest kernel for estimation. */
|
||||
const DeviceKernel test_kernel = (kernel_features & KERNEL_FEATURE_NODE_RAYTRACE) ?
|
||||
DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE :
|
||||
(kernel_features & KERNEL_FEATURE_MNEE) ?
|
||||
DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE :
|
||||
DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE;
|
||||
|
||||
/* Launch kernel, using just 1 block appears sufficient to reserve memory for all
|
||||
|
@@ -420,8 +420,6 @@ void HIPDevice::reserve_local_memory(const uint kernel_features)
|
||||
/* Use the biggest kernel for estimation. */
|
||||
const DeviceKernel test_kernel = (kernel_features & KERNEL_FEATURE_NODE_RAYTRACE) ?
|
||||
DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE :
|
||||
(kernel_features & KERNEL_FEATURE_MNEE) ?
|
||||
DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE :
|
||||
DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE;
|
||||
|
||||
/* Launch kernel, using just 1 block appears sufficient to reserve memory for all
|
||||
|
@@ -33,8 +33,6 @@ const char *device_kernel_as_string(DeviceKernel kernel)
|
||||
return "integrator_shade_surface";
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE:
|
||||
return "integrator_shade_surface_raytrace";
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE:
|
||||
return "integrator_shade_surface_mnee";
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_VOLUME:
|
||||
return "integrator_shade_volume";
|
||||
case DEVICE_KERNEL_INTEGRATOR_MEGAKERNEL:
|
||||
|
@@ -489,8 +489,7 @@ bool MetalDeviceKernels::load(MetalDevice *device, int kernel_type)
|
||||
i == DEVICE_KERNEL_INTEGRATOR_INTERSECT_SHADOW ||
|
||||
i == DEVICE_KERNEL_INTEGRATOR_INTERSECT_SUBSURFACE ||
|
||||
i == DEVICE_KERNEL_INTEGRATOR_INTERSECT_VOLUME_STACK ||
|
||||
i == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE ||
|
||||
i == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE) {
|
||||
i == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE) {
|
||||
kernel_function_list = function_list;
|
||||
}
|
||||
|
||||
|
@@ -265,7 +265,6 @@ bool MetalDeviceQueue::enqueue(DeviceKernel kernel,
|
||||
case DEVICE_KERNEL_INTEGRATOR_INTERSECT_SUBSURFACE:
|
||||
case DEVICE_KERNEL_INTEGRATOR_INTERSECT_VOLUME_STACK:
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE:
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE:
|
||||
break;
|
||||
default:
|
||||
bvhMetalRT = nil;
|
||||
|
@@ -432,10 +432,9 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
}
|
||||
|
||||
{ /* Load and compile PTX module with OptiX kernels. */
|
||||
string ptx_data, ptx_filename = path_get(
|
||||
(kernel_features & (KERNEL_FEATURE_NODE_RAYTRACE | KERNEL_FEATURE_MNEE)) ?
|
||||
"lib/kernel_optix_shader_raytrace.ptx" :
|
||||
"lib/kernel_optix.ptx");
|
||||
string ptx_data, ptx_filename = path_get((kernel_features & KERNEL_FEATURE_NODE_RAYTRACE) ?
|
||||
"lib/kernel_optix_shader_raytrace.ptx" :
|
||||
"lib/kernel_optix.ptx");
|
||||
if (use_adaptive_compilation() || path_file_size(ptx_filename) == -1) {
|
||||
if (!getenv("OPTIX_ROOT_DIR")) {
|
||||
set_error(
|
||||
@@ -445,9 +444,7 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
}
|
||||
ptx_filename = compile_kernel(
|
||||
kernel_features,
|
||||
(kernel_features & (KERNEL_FEATURE_NODE_RAYTRACE | KERNEL_FEATURE_MNEE)) ?
|
||||
"kernel_shader_raytrace" :
|
||||
"kernel",
|
||||
(kernel_features & KERNEL_FEATURE_NODE_RAYTRACE) ? "kernel_shader_raytrace" : "kernel",
|
||||
"optix",
|
||||
true);
|
||||
}
|
||||
@@ -585,14 +582,6 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
"__direct_callable__svm_node_bevel";
|
||||
}
|
||||
|
||||
/* MNEE. */
|
||||
if (kernel_features & KERNEL_FEATURE_MNEE) {
|
||||
group_descs[PG_RGEN_SHADE_SURFACE_MNEE].kind = OPTIX_PROGRAM_GROUP_KIND_RAYGEN;
|
||||
group_descs[PG_RGEN_SHADE_SURFACE_MNEE].raygen.module = optix_module;
|
||||
group_descs[PG_RGEN_SHADE_SURFACE_MNEE].raygen.entryFunctionName =
|
||||
"__raygen__kernel_optix_integrator_shade_surface_mnee";
|
||||
}
|
||||
|
||||
optix_assert(optixProgramGroupCreate(
|
||||
context, group_descs, NUM_PROGRAM_GROUPS, &group_options, nullptr, 0, groups));
|
||||
|
||||
@@ -674,46 +663,6 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
pipelines[PIP_SHADE_RAYTRACE], 0, dss, css, motion_blur ? 3 : 2));
|
||||
}
|
||||
|
||||
if (kernel_features & KERNEL_FEATURE_MNEE) {
|
||||
/* Create MNEE pipeline. */
|
||||
vector<OptixProgramGroup> pipeline_groups;
|
||||
pipeline_groups.reserve(NUM_PROGRAM_GROUPS);
|
||||
pipeline_groups.push_back(groups[PG_RGEN_SHADE_SURFACE_MNEE]);
|
||||
pipeline_groups.push_back(groups[PG_MISS]);
|
||||
pipeline_groups.push_back(groups[PG_HITD]);
|
||||
pipeline_groups.push_back(groups[PG_HITS]);
|
||||
pipeline_groups.push_back(groups[PG_HITL]);
|
||||
pipeline_groups.push_back(groups[PG_HITV]);
|
||||
if (motion_blur) {
|
||||
pipeline_groups.push_back(groups[PG_HITD_MOTION]);
|
||||
pipeline_groups.push_back(groups[PG_HITS_MOTION]);
|
||||
}
|
||||
if (kernel_features & KERNEL_FEATURE_POINTCLOUD) {
|
||||
pipeline_groups.push_back(groups[PG_HITD_POINTCLOUD]);
|
||||
pipeline_groups.push_back(groups[PG_HITS_POINTCLOUD]);
|
||||
}
|
||||
pipeline_groups.push_back(groups[PG_CALL_SVM_AO]);
|
||||
pipeline_groups.push_back(groups[PG_CALL_SVM_BEVEL]);
|
||||
|
||||
optix_assert(optixPipelineCreate(context,
|
||||
&pipeline_options,
|
||||
&link_options,
|
||||
pipeline_groups.data(),
|
||||
pipeline_groups.size(),
|
||||
nullptr,
|
||||
0,
|
||||
&pipelines[PIP_SHADE_MNEE]));
|
||||
|
||||
/* Combine ray generation and trace continuation stack size. */
|
||||
const unsigned int css = stack_size[PG_RGEN_SHADE_SURFACE_MNEE].cssRG +
|
||||
link_options.maxTraceDepth * trace_css;
|
||||
const unsigned int dss = 0;
|
||||
|
||||
/* Set stack size depending on pipeline options. */
|
||||
optix_assert(
|
||||
optixPipelineSetStackSize(pipelines[PIP_SHADE_MNEE], 0, dss, css, motion_blur ? 3 : 2));
|
||||
}
|
||||
|
||||
{ /* Create intersection-only pipeline. */
|
||||
vector<OptixProgramGroup> pipeline_groups;
|
||||
pipeline_groups.reserve(NUM_PROGRAM_GROUPS);
|
||||
|
@@ -24,7 +24,6 @@ enum {
|
||||
PG_RGEN_INTERSECT_SUBSURFACE,
|
||||
PG_RGEN_INTERSECT_VOLUME_STACK,
|
||||
PG_RGEN_SHADE_SURFACE_RAYTRACE,
|
||||
PG_RGEN_SHADE_SURFACE_MNEE,
|
||||
PG_MISS,
|
||||
PG_HITD, /* Default hit group. */
|
||||
PG_HITS, /* __SHADOW_RECORD_ALL__ hit group. */
|
||||
@@ -47,7 +46,7 @@ static const int CALLABLE_PROGRAM_GROUPS_BASE = PG_CALL_SVM_AO;
|
||||
static const int NUM_CALLABLE_PROGRAM_GROUPS = 2;
|
||||
|
||||
/* List of OptiX pipelines. */
|
||||
enum { PIP_SHADE_RAYTRACE, PIP_SHADE_MNEE, PIP_INTERSECT, NUM_PIPELINES };
|
||||
enum { PIP_SHADE_RAYTRACE, PIP_INTERSECT, NUM_PIPELINES };
|
||||
|
||||
/* A single shader binding table entry. */
|
||||
struct SbtRecord {
|
||||
|
@@ -28,7 +28,6 @@ void OptiXDeviceQueue::init_execution()
|
||||
static bool is_optix_specific_kernel(DeviceKernel kernel)
|
||||
{
|
||||
return (kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_INTERSECT_SHADOW ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_INTERSECT_SUBSURFACE ||
|
||||
@@ -64,8 +63,7 @@ bool OptiXDeviceQueue::enqueue(DeviceKernel kernel,
|
||||
cuda_stream_));
|
||||
|
||||
if (kernel == DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE) {
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE) {
|
||||
cuda_device_assert(
|
||||
cuda_device_,
|
||||
cuMemcpyHtoDAsync(launch_params_ptr + offsetof(KernelParamsOptiX, render_buffer),
|
||||
@@ -84,10 +82,6 @@ bool OptiXDeviceQueue::enqueue(DeviceKernel kernel,
|
||||
pipeline = optix_device->pipelines[PIP_SHADE_RAYTRACE];
|
||||
sbt_params.raygenRecord = sbt_data_ptr + PG_RGEN_SHADE_SURFACE_RAYTRACE * sizeof(SbtRecord);
|
||||
break;
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE:
|
||||
pipeline = optix_device->pipelines[PIP_SHADE_MNEE];
|
||||
sbt_params.raygenRecord = sbt_data_ptr + PG_RGEN_SHADE_SURFACE_MNEE * sizeof(SbtRecord);
|
||||
break;
|
||||
case DEVICE_KERNEL_INTEGRATOR_INTERSECT_CLOSEST:
|
||||
pipeline = optix_device->pipelines[PIP_INTERSECT];
|
||||
sbt_params.raygenRecord = sbt_data_ptr + PG_RGEN_INTERSECT_CLOSEST * sizeof(SbtRecord);
|
||||
|
@@ -19,10 +19,8 @@ struct NodeEnum {
|
||||
}
|
||||
void insert(const char *x, int y)
|
||||
{
|
||||
ustring ustr_x(x);
|
||||
|
||||
left[ustr_x] = y;
|
||||
right[y] = ustr_x;
|
||||
left[ustring(x)] = y;
|
||||
right[y] = ustring(x);
|
||||
}
|
||||
|
||||
bool exists(ustring x) const
|
||||
|
@@ -26,8 +26,8 @@ set(INC_HD_CYCLES
|
||||
camera.h
|
||||
config.h
|
||||
curves.h
|
||||
display_driver.h
|
||||
field.h
|
||||
file_reader.h
|
||||
geometry.h
|
||||
geometry.inl
|
||||
instancer.h
|
||||
@@ -48,8 +48,8 @@ set(SRC_HD_CYCLES
|
||||
attribute.cpp
|
||||
curves.cpp
|
||||
camera.cpp
|
||||
display_driver.cpp
|
||||
field.cpp
|
||||
file_reader.cpp
|
||||
instancer.cpp
|
||||
light.cpp
|
||||
material.cpp
|
||||
@@ -73,28 +73,21 @@ if(WITH_OPENVDB)
|
||||
)
|
||||
endif()
|
||||
|
||||
# Blender libraries do not include hgiGL, so build without display driver then.
|
||||
if(EXISTS ${USD_INCLUDE_DIR}/pxr/imaging/hgiGL)
|
||||
add_definitions(-DWITH_HYDRA_DISPLAY_DRIVER)
|
||||
list(APPEND SRC_HD_CYCLES display_driver.cpp)
|
||||
list(APPEND INC_HD_CYCLES display_driver.h)
|
||||
endif()
|
||||
|
||||
include_directories(${INC})
|
||||
include_directories(SYSTEM ${INC_SYS})
|
||||
|
||||
add_library(cycles_hydra STATIC
|
||||
add_library(hdCyclesStatic STATIC
|
||||
${SRC_HD_CYCLES}
|
||||
${INC_HD_CYCLES}
|
||||
)
|
||||
|
||||
target_compile_options(cycles_hydra
|
||||
target_compile_options(hdCyclesStatic
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/wd4003 /wd4244 /wd4506>
|
||||
$<$<CXX_COMPILER_ID:GNU>:-Wno-float-conversion -Wno-double-promotion -Wno-deprecated>
|
||||
)
|
||||
|
||||
target_compile_definitions(cycles_hydra
|
||||
target_compile_definitions(hdCyclesStatic
|
||||
PRIVATE
|
||||
GLOG_NO_ABBREVIATED_SEVERITIES=1
|
||||
OSL_DEBUG=$<CONFIG:DEBUG>
|
||||
@@ -102,93 +95,57 @@ target_compile_definitions(cycles_hydra
|
||||
$<$<CXX_COMPILER_ID:MSVC>:NOMINMAX=1>
|
||||
)
|
||||
|
||||
target_link_libraries(cycles_hydra
|
||||
target_link_libraries(hdCyclesStatic
|
||||
PUBLIC
|
||||
${USD_LIBRARIES}
|
||||
hd
|
||||
hgi
|
||||
hgiGL
|
||||
PRIVATE
|
||||
${LIB}
|
||||
)
|
||||
|
||||
if(WITH_CYCLES_HYDRA_RENDER_DELEGATE)
|
||||
set(HdCyclesPluginName hdCycles)
|
||||
add_library(${HdCyclesPluginName} SHARED
|
||||
plugin.h
|
||||
plugin.cpp
|
||||
)
|
||||
set(HdCyclesPluginName hdCycles)
|
||||
add_library(${HdCyclesPluginName} SHARED
|
||||
plugin.h
|
||||
plugin.cpp
|
||||
)
|
||||
|
||||
set_target_properties(${HdCyclesPluginName}
|
||||
PROPERTIES PREFIX ""
|
||||
)
|
||||
set_target_properties(${HdCyclesPluginName}
|
||||
PROPERTIES PREFIX ""
|
||||
)
|
||||
|
||||
target_compile_definitions(${HdCyclesPluginName}
|
||||
PRIVATE
|
||||
MFB_PACKAGE_NAME=${HdCyclesPluginName}
|
||||
MFB_ALT_PACKAGE_NAME=${HdCyclesPluginName}
|
||||
GLOG_NO_ABBREVIATED_SEVERITIES=1
|
||||
OSL_DEBUG=$<CONFIG:DEBUG>
|
||||
TBB_USE_DEBUG=$<CONFIG:DEBUG>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:NOMINMAX=1>
|
||||
)
|
||||
target_compile_definitions(${HdCyclesPluginName}
|
||||
PRIVATE
|
||||
MFB_PACKAGE_NAME=${HdCyclesPluginName}
|
||||
MFB_ALT_PACKAGE_NAME=${HdCyclesPluginName}
|
||||
GLOG_NO_ABBREVIATED_SEVERITIES=1
|
||||
OSL_DEBUG=$<CONFIG:DEBUG>
|
||||
TBB_USE_DEBUG=$<CONFIG:DEBUG>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:NOMINMAX=1>
|
||||
)
|
||||
|
||||
target_link_libraries(${HdCyclesPluginName}
|
||||
cycles_hydra
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
set_property(
|
||||
TARGET
|
||||
${HdCyclesPluginName}
|
||||
APPEND_STRING PROPERTY LINK_FLAGS
|
||||
" -Wl,-exported_symbols_list,'${CMAKE_CURRENT_SOURCE_DIR}/resources/apple_symbols.map'"
|
||||
)
|
||||
elseif(UNIX)
|
||||
set_property(
|
||||
TARGET
|
||||
${HdCyclesPluginName}
|
||||
APPEND_STRING PROPERTY LINK_FLAGS
|
||||
" -Wl,--version-script='${CMAKE_CURRENT_SOURCE_DIR}/resources/linux_symbols.map'"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
if(WITH_CYCLES_BLENDER)
|
||||
# Install inside add-on
|
||||
set(CYCLES_HYDRA_INSTALL_PATH ${CYCLES_INSTALL_PATH}/hydra)
|
||||
else()
|
||||
# Install next to cycles executable
|
||||
set(CYCLES_HYDRA_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/hydra)
|
||||
endif()
|
||||
target_link_libraries(${HdCyclesPluginName}
|
||||
hdCyclesStatic
|
||||
)
|
||||
|
||||
if(WITH_CYCLES_BLENDER)
|
||||
set(CYCLES_HYDRA_INSTALL_PATH "../")
|
||||
else()
|
||||
set(CYCLES_HYDRA_INSTALL_PATH ${CMAKE_INSTALL_PREFIX})
|
||||
# Put the root plugInfo.json one level up
|
||||
delayed_install("${CMAKE_CURRENT_SOURCE_DIR}" "plugInfo.json" ${CYCLES_HYDRA_INSTALL_PATH})
|
||||
delayed_install("" $<TARGET_FILE:${HdCyclesPluginName}> ${CYCLES_HYDRA_INSTALL_PATH})
|
||||
|
||||
set_target_properties(${HdCyclesPluginName}
|
||||
PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(PLUG_INFO_ROOT "..")
|
||||
|
||||
if(WITH_CYCLES_BLENDER)
|
||||
# Full path not yet know at this point and RELATIVE_PATH requires
|
||||
# absolute path as input. So just set manually.
|
||||
set(PLUG_INFO_LIBRARY_PATH "../${HdCyclesPluginName}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
set(PLUG_INFO_RESOURCE_PATH "../..")
|
||||
else()
|
||||
file(RELATIVE_PATH
|
||||
PLUG_INFO_LIBRARY_PATH
|
||||
"${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}"
|
||||
"${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
file(RELATIVE_PATH PLUG_INFO_RESOURCE_PATH
|
||||
"${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}"
|
||||
"${CYCLES_INSTALL_PATH}")
|
||||
endif()
|
||||
|
||||
configure_file(resources/plugInfo.json
|
||||
${CMAKE_CURRENT_BINARY_DIR}/resources/plugInfo.json
|
||||
@ONLY
|
||||
)
|
||||
|
||||
delayed_install("${CMAKE_CURRENT_BINARY_DIR}/resources" "plugInfo.json" "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}/resources")
|
||||
delayed_install("${CMAKE_CURRENT_SOURCE_DIR}" "plugInfo.json" ${CMAKE_INSTALL_PREFIX})
|
||||
endif()
|
||||
|
||||
delayed_install("" $<TARGET_FILE:${HdCyclesPluginName}> ${CYCLES_HYDRA_INSTALL_PATH})
|
||||
|
||||
set(PLUG_INFO_ROOT "..")
|
||||
|
||||
file(RELATIVE_PATH PLUG_INFO_LIBRARY_PATH "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}" "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
file(RELATIVE_PATH PLUG_INFO_RESOURCE_PATH "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}" "${CYCLES_INSTALL_PATH}")
|
||||
|
||||
configure_file(resources/plugInfo.json
|
||||
${CMAKE_CURRENT_BINARY_DIR}/resources/plugInfo.json
|
||||
@ONLY
|
||||
)
|
||||
|
||||
delayed_install("${CMAKE_CURRENT_BINARY_DIR}/resources" "plugInfo.json" "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}/resources")
|
||||
|
@@ -281,12 +281,9 @@ void HdCyclesCamera::ApplyCameraSettings(HdRenderParam *renderParam,
|
||||
auto data = dataUnconformedWindow;
|
||||
CameraUtilConformWindow(&data, windowPolicy, width / height);
|
||||
|
||||
if (data.GetProjection() == GfCamera::Orthographic) {
|
||||
cam->set_camera_type(CAMERA_ORTHOGRAPHIC);
|
||||
}
|
||||
else {
|
||||
cam->set_camera_type(CAMERA_PERSPECTIVE);
|
||||
}
|
||||
static_assert(GfCamera::Perspective == CAMERA_PERSPECTIVE &&
|
||||
GfCamera::Orthographic == CAMERA_ORTHOGRAPHIC);
|
||||
cam->set_camera_type(static_cast<CameraType>(data.GetProjection()));
|
||||
|
||||
const float metersPerUnit = static_cast<HdCyclesSession *>(renderParam)->GetStageMetersPerUnit();
|
||||
|
||||
|
@@ -19,6 +19,31 @@ HDCYCLES_NAMESPACE_OPEN_SCOPE
|
||||
HdCyclesDisplayDriver::HdCyclesDisplayDriver(HdCyclesSession *renderParam, Hgi *hgi)
|
||||
: _renderParam(renderParam), _hgi(hgi)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
hdc_ = GetDC(CreateWindowA("STATIC",
|
||||
"HdCycles",
|
||||
WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
0,
|
||||
0,
|
||||
64,
|
||||
64,
|
||||
NULL,
|
||||
NULL,
|
||||
GetModuleHandle(NULL),
|
||||
NULL));
|
||||
|
||||
int pixelFormat = GetPixelFormat(wglGetCurrentDC());
|
||||
PIXELFORMATDESCRIPTOR pfd = {sizeof(pfd)};
|
||||
DescribePixelFormat((HDC)hdc_, pixelFormat, sizeof(pfd), &pfd);
|
||||
SetPixelFormat((HDC)hdc_, pixelFormat, &pfd);
|
||||
|
||||
TF_VERIFY(gl_context_ = wglCreateContext((HDC)hdc_));
|
||||
TF_VERIFY(wglShareLists(wglGetCurrentContext(), (HGLRC)gl_context_));
|
||||
#endif
|
||||
|
||||
glewInit();
|
||||
|
||||
glGenBuffers(1, &gl_pbo_id_);
|
||||
}
|
||||
|
||||
HdCyclesDisplayDriver::~HdCyclesDisplayDriver()
|
||||
@@ -27,92 +52,11 @@ HdCyclesDisplayDriver::~HdCyclesDisplayDriver()
|
||||
_hgi->DestroyTexture(&texture_);
|
||||
}
|
||||
|
||||
if (gl_pbo_id_) {
|
||||
glDeleteBuffers(1, &gl_pbo_id_);
|
||||
}
|
||||
glDeleteBuffers(1, &gl_pbo_id_);
|
||||
|
||||
gl_context_dispose();
|
||||
}
|
||||
|
||||
void HdCyclesDisplayDriver::gl_context_create()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!gl_context_) {
|
||||
hdc_ = GetDC(CreateWindowA("STATIC",
|
||||
"HdCycles",
|
||||
WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
0,
|
||||
0,
|
||||
64,
|
||||
64,
|
||||
NULL,
|
||||
NULL,
|
||||
GetModuleHandle(NULL),
|
||||
NULL));
|
||||
|
||||
int pixelFormat = GetPixelFormat(wglGetCurrentDC());
|
||||
PIXELFORMATDESCRIPTOR pfd = {sizeof(pfd)};
|
||||
DescribePixelFormat((HDC)hdc_, pixelFormat, sizeof(pfd), &pfd);
|
||||
SetPixelFormat((HDC)hdc_, pixelFormat, &pfd);
|
||||
|
||||
TF_VERIFY(gl_context_ = wglCreateContext((HDC)hdc_));
|
||||
TF_VERIFY(wglShareLists(wglGetCurrentContext(), (HGLRC)gl_context_));
|
||||
}
|
||||
if (!gl_context_) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!gl_pbo_id_) {
|
||||
if (glewInit() != GLEW_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
glGenBuffers(1, &gl_pbo_id_);
|
||||
}
|
||||
}
|
||||
|
||||
bool HdCyclesDisplayDriver::gl_context_enable()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!hdc_ || !gl_context_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mutex_.lock();
|
||||
|
||||
// Do not change context if this is called in the main thread
|
||||
if (wglGetCurrentContext() == nullptr) {
|
||||
if (!TF_VERIFY(wglMakeCurrent((HDC)hdc_, (HGLRC)gl_context_))) {
|
||||
mutex_.unlock();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void HdCyclesDisplayDriver::gl_context_disable()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (wglGetCurrentContext() == gl_context_) {
|
||||
TF_VERIFY(wglMakeCurrent(nullptr, nullptr));
|
||||
}
|
||||
|
||||
mutex_.unlock();
|
||||
#endif
|
||||
}
|
||||
|
||||
void HdCyclesDisplayDriver::gl_context_dispose()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (gl_context_) {
|
||||
TF_VERIFY(wglDeleteContext((HGLRC)gl_context_));
|
||||
DestroyWindow(WindowFromDC((HDC)hdc_));
|
||||
}
|
||||
TF_VERIFY(wglDeleteContext((HGLRC)gl_context_));
|
||||
DestroyWindow(WindowFromDC((HDC)hdc_));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -124,9 +68,13 @@ bool HdCyclesDisplayDriver::update_begin(const Params ¶ms,
|
||||
int texture_width,
|
||||
int texture_height)
|
||||
{
|
||||
if (!gl_context_enable()) {
|
||||
#ifdef _WIN32
|
||||
if (!hdc_ || !gl_context_) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
graphics_interop_activate();
|
||||
|
||||
if (gl_render_sync_) {
|
||||
glWaitSync((GLsync)gl_render_sync_, 0, GL_TIMEOUT_IGNORED);
|
||||
@@ -151,14 +99,15 @@ bool HdCyclesDisplayDriver::update_begin(const Params ¶ms,
|
||||
void HdCyclesDisplayDriver::update_end()
|
||||
{
|
||||
gl_upload_sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
glFlush();
|
||||
|
||||
gl_context_disable();
|
||||
graphics_interop_deactivate();
|
||||
}
|
||||
|
||||
void HdCyclesDisplayDriver::flush()
|
||||
{
|
||||
gl_context_enable();
|
||||
graphics_interop_activate();
|
||||
|
||||
if (gl_upload_sync_) {
|
||||
glWaitSync((GLsync)gl_upload_sync_, 0, GL_TIMEOUT_IGNORED);
|
||||
@@ -168,7 +117,7 @@ void HdCyclesDisplayDriver::flush()
|
||||
glWaitSync((GLsync)gl_render_sync_, 0, GL_TIMEOUT_IGNORED);
|
||||
}
|
||||
|
||||
gl_context_disable();
|
||||
graphics_interop_deactivate();
|
||||
}
|
||||
|
||||
half4 *HdCyclesDisplayDriver::map_texture_buffer()
|
||||
@@ -208,12 +157,25 @@ DisplayDriver::GraphicsInterop HdCyclesDisplayDriver::graphics_interop_get()
|
||||
|
||||
void HdCyclesDisplayDriver::graphics_interop_activate()
|
||||
{
|
||||
gl_context_enable();
|
||||
mutex_.lock();
|
||||
|
||||
#ifdef _WIN32
|
||||
// Do not change context if this is called in the main thread
|
||||
if (wglGetCurrentContext() == nullptr) {
|
||||
TF_VERIFY(wglMakeCurrent((HDC)hdc_, (HGLRC)gl_context_));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void HdCyclesDisplayDriver::graphics_interop_deactivate()
|
||||
{
|
||||
gl_context_disable();
|
||||
#ifdef _WIN32
|
||||
if (wglGetCurrentContext() == gl_context_) {
|
||||
TF_VERIFY(wglMakeCurrent(nullptr, nullptr));
|
||||
}
|
||||
#endif
|
||||
|
||||
mutex_.unlock();
|
||||
}
|
||||
|
||||
void HdCyclesDisplayDriver::clear()
|
||||
@@ -230,12 +192,6 @@ void HdCyclesDisplayDriver::draw(const Params ¶ms)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!renderBuffer->IsResourceUsed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gl_context_create();
|
||||
|
||||
// Cycles 'DisplayDriver' only supports 'half4' format
|
||||
TF_VERIFY(renderBuffer->GetFormat() == HdFormatFloat16Vec4);
|
||||
|
||||
@@ -275,6 +231,7 @@ void HdCyclesDisplayDriver::draw(const Params ¶ms)
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
|
||||
gl_render_sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||
|
||||
glFlush();
|
||||
|
||||
need_update_ = false;
|
||||
|
@@ -38,11 +38,6 @@ class HdCyclesDisplayDriver final : public CCL_NS::DisplayDriver {
|
||||
|
||||
void draw(const Params ¶ms) override;
|
||||
|
||||
void gl_context_create();
|
||||
bool gl_context_enable();
|
||||
void gl_context_disable();
|
||||
void gl_context_dispose();
|
||||
|
||||
HdCyclesSession *const _renderParam;
|
||||
Hgi *const _hgi;
|
||||
|
||||
@@ -50,6 +45,7 @@ class HdCyclesDisplayDriver final : public CCL_NS::DisplayDriver {
|
||||
void *hdc_ = nullptr;
|
||||
void *gl_context_ = nullptr;
|
||||
#endif
|
||||
|
||||
CCL_NS::thread_mutex mutex_;
|
||||
|
||||
PXR_NS::HgiTextureHandle texture_;
|
||||
|
@@ -1,125 +0,0 @@
|
||||
/* SPDX-License-Identifier: Apache-2.0
|
||||
* Copyright 2011-2022 Blender Foundation */
|
||||
|
||||
#include "hydra/file_reader.h"
|
||||
#include "hydra/camera.h"
|
||||
#include "hydra/render_delegate.h"
|
||||
|
||||
#include "util/path.h"
|
||||
#include "util/unique_ptr.h"
|
||||
|
||||
#include "scene/scene.h"
|
||||
|
||||
#include <pxr/base/plug/registry.h>
|
||||
#include <pxr/imaging/hd/dirtyList.h>
|
||||
#include <pxr/imaging/hd/renderDelegate.h>
|
||||
#include <pxr/imaging/hd/renderIndex.h>
|
||||
#include <pxr/imaging/hd/rprimCollection.h>
|
||||
#include <pxr/imaging/hd/task.h>
|
||||
#include <pxr/usd/usd/stage.h>
|
||||
#include <pxr/usd/usdGeom/camera.h>
|
||||
#include <pxr/usd/usdGeom/metrics.h>
|
||||
#include <pxr/usdImaging/usdImaging/delegate.h>
|
||||
|
||||
HDCYCLES_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
/* Dummy task whose only purpose is to provide render tag tokens to the render index. */
|
||||
class DummyHdTask : public HdTask {
|
||||
public:
|
||||
DummyHdTask(HdSceneDelegate *delegate, SdfPath const &id)
|
||||
: HdTask(id), tags({HdRenderTagTokens->geometry, HdRenderTagTokens->render})
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
|
||||
{
|
||||
}
|
||||
|
||||
void Prepare(HdTaskContext *ctx, HdRenderIndex *render_index) override
|
||||
{
|
||||
}
|
||||
|
||||
void Execute(HdTaskContext *ctx) override
|
||||
{
|
||||
}
|
||||
|
||||
const TfTokenVector &GetRenderTags() const override
|
||||
{
|
||||
return tags;
|
||||
}
|
||||
|
||||
TfTokenVector tags;
|
||||
};
|
||||
|
||||
void HdCyclesFileReader::read(Session *session, const char *filepath, const bool use_camera)
|
||||
{
|
||||
/* Initialize USD. */
|
||||
PlugRegistry::GetInstance().RegisterPlugins(path_get("usd"));
|
||||
|
||||
/* Open Stage. */
|
||||
UsdStageRefPtr stage = UsdStage::Open(filepath);
|
||||
if (!stage) {
|
||||
fprintf(stderr, "%s read error\n", filepath);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Init paths. */
|
||||
SdfPath root_path = SdfPath::AbsoluteRootPath();
|
||||
SdfPath task_path("/_hdCycles/DummyHdTask");
|
||||
|
||||
/* Create render delegate. */
|
||||
HdRenderSettingsMap settings_map;
|
||||
settings_map.insert(std::make_pair(HdCyclesRenderSettingsTokens->stageMetersPerUnit,
|
||||
VtValue(UsdGeomGetStageMetersPerUnit(stage))));
|
||||
|
||||
HdCyclesDelegate render_delegate(settings_map, session, true);
|
||||
|
||||
/* Create render index and scene delegate. */
|
||||
unique_ptr<HdRenderIndex> render_index(HdRenderIndex::New(&render_delegate, {}));
|
||||
unique_ptr<UsdImagingDelegate> scene_delegate = make_unique<UsdImagingDelegate>(
|
||||
render_index.get(), root_path);
|
||||
|
||||
/* Add render tags and collection to render index. */
|
||||
HdRprimCollection collection(HdTokens->geometry, HdReprSelector(HdReprTokens->smoothHull));
|
||||
collection.SetRootPath(root_path);
|
||||
|
||||
render_index->InsertTask<DummyHdTask>(scene_delegate.get(), task_path);
|
||||
|
||||
#if PXR_VERSION < 2111
|
||||
HdDirtyListSharedPtr dirty_list = std::make_shared<HdDirtyList>(collection,
|
||||
*(render_index.get()));
|
||||
render_index->EnqueuePrimsToSync(dirty_list, collection);
|
||||
#else
|
||||
render_index->EnqueueCollectionToSync(collection);
|
||||
#endif
|
||||
|
||||
/* Create prims. */
|
||||
const UsdPrim &stage_root = stage->GetPseudoRoot();
|
||||
scene_delegate->Populate(stage_root.GetStage()->GetPrimAtPath(root_path), {});
|
||||
|
||||
/* Sync prims. */
|
||||
HdTaskContext task_context;
|
||||
HdTaskSharedPtrVector tasks;
|
||||
tasks.push_back(render_index->GetTask(task_path));
|
||||
|
||||
render_index->SyncAll(&tasks, &task_context);
|
||||
render_delegate.CommitResources(&render_index->GetChangeTracker());
|
||||
|
||||
/* Use first camera in stage.
|
||||
* TODO: get camera from UsdRender if available. */
|
||||
if (use_camera) {
|
||||
for (UsdPrim const &prim : stage->Traverse()) {
|
||||
if (prim.IsA<UsdGeomCamera>()) {
|
||||
HdSprim *sprim = render_index->GetSprim(HdPrimTypeTokens->camera, prim.GetPath());
|
||||
if (sprim) {
|
||||
HdCyclesCamera *camera = dynamic_cast<HdCyclesCamera *>(sprim);
|
||||
camera->ApplyCameraSettings(render_delegate.GetRenderParam(), session->scene->camera);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HDCYCLES_NAMESPACE_CLOSE_SCOPE
|
@@ -1,17 +0,0 @@
|
||||
/* SPDX-License-Identifier: Apache-2.0
|
||||
* Copyright 2011-2022 Blender Foundation */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hydra/config.h"
|
||||
|
||||
#include "session/session.h"
|
||||
|
||||
HDCYCLES_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
class HdCyclesFileReader {
|
||||
public:
|
||||
static void read(Session *session, const char *filepath, const bool use_camera = true);
|
||||
};
|
||||
|
||||
HDCYCLES_NAMESPACE_CLOSE_SCOPE
|
@@ -192,16 +192,11 @@ void HdCyclesGeometry<Base, CyclesBase>::Finalize(HdRenderParam *renderParam)
|
||||
}
|
||||
|
||||
const SceneLock lock(renderParam);
|
||||
const bool keep_nodes = static_cast<const HdCyclesSession *>(renderParam)->keep_nodes;
|
||||
|
||||
if (!keep_nodes) {
|
||||
lock.scene->delete_node(_geom);
|
||||
}
|
||||
lock.scene->delete_node(_geom);
|
||||
_geom = nullptr;
|
||||
|
||||
if (!keep_nodes) {
|
||||
lock.scene->delete_nodes(set<Object *>(_instances.begin(), _instances.end()));
|
||||
}
|
||||
lock.scene->delete_nodes(set<Object *>(_instances.begin(), _instances.end()));
|
||||
_instances.clear();
|
||||
_instances.shrink_to_fit();
|
||||
}
|
||||
|
@@ -352,12 +352,8 @@ void HdCyclesLight::Finalize(HdRenderParam *renderParam)
|
||||
}
|
||||
|
||||
const SceneLock lock(renderParam);
|
||||
const bool keep_nodes = static_cast<const HdCyclesSession *>(renderParam)->keep_nodes;
|
||||
|
||||
if (!keep_nodes) {
|
||||
lock.scene->delete_node(_light);
|
||||
}
|
||||
|
||||
lock.scene->delete_node(_light);
|
||||
_light = nullptr;
|
||||
}
|
||||
|
||||
|
@@ -266,7 +266,7 @@ void HdCyclesMaterial::UpdateParameters(NodeDesc &nodeDesc,
|
||||
const std::map<TfToken, VtValue> ¶meters,
|
||||
const SdfPath &nodePath)
|
||||
{
|
||||
for (const auto ¶m : parameters) {
|
||||
for (const std::pair<TfToken, VtValue> ¶m : parameters) {
|
||||
VtValue value = param.second;
|
||||
|
||||
// See if the parameter name is in USDPreviewSurface terms, and needs to be converted
|
||||
@@ -313,7 +313,7 @@ void HdCyclesMaterial::UpdateParameters(const HdMaterialNetwork &network)
|
||||
|
||||
void HdCyclesMaterial::UpdateParameters(const HdMaterialNetwork2 &network)
|
||||
{
|
||||
for (const auto &nodeEntry : network.nodes) {
|
||||
for (const std::pair<SdfPath, HdMaterialNode2> &nodeEntry : network.nodes) {
|
||||
const SdfPath &nodePath = nodeEntry.first;
|
||||
|
||||
const auto nodeIt = _nodes.find(nodePath);
|
||||
@@ -331,7 +331,8 @@ void HdCyclesMaterial::UpdateConnections(NodeDesc &nodeDesc,
|
||||
const SdfPath &nodePath,
|
||||
ShaderGraph *shaderGraph)
|
||||
{
|
||||
for (const auto &connection : matNode.inputConnections) {
|
||||
for (const std::pair<TfToken, std::vector<HdMaterialConnection2>> &connection :
|
||||
matNode.inputConnections) {
|
||||
const TfToken &dstSocketName = connection.first;
|
||||
|
||||
const UsdToCyclesMapping *inputMapping = nodeDesc.mapping;
|
||||
@@ -417,7 +418,7 @@ void HdCyclesMaterial::PopulateShaderGraph(const HdMaterialNetwork2 &networkMap)
|
||||
auto graph = new ShaderGraph();
|
||||
|
||||
// Iterate all the nodes first and build a complete but unconnected graph with parameters set
|
||||
for (const auto &nodeEntry : networkMap.nodes) {
|
||||
for (const std::pair<SdfPath, HdMaterialNode2> &nodeEntry : networkMap.nodes) {
|
||||
NodeDesc nodeDesc = {};
|
||||
const SdfPath &nodePath = nodeEntry.first;
|
||||
|
||||
@@ -464,7 +465,7 @@ void HdCyclesMaterial::PopulateShaderGraph(const HdMaterialNetwork2 &networkMap)
|
||||
|
||||
// Now that all nodes have been constructed, iterate the network again and build up any
|
||||
// connections between nodes
|
||||
for (const auto &nodeEntry : networkMap.nodes) {
|
||||
for (const std::pair<SdfPath, HdMaterialNode2> &nodeEntry : networkMap.nodes) {
|
||||
const SdfPath &nodePath = nodeEntry.first;
|
||||
|
||||
const auto nodeIt = _nodes.find(nodePath);
|
||||
@@ -477,7 +478,7 @@ void HdCyclesMaterial::PopulateShaderGraph(const HdMaterialNetwork2 &networkMap)
|
||||
}
|
||||
|
||||
// Finally connect the terminals to the graph output (Surface, Volume, Displacement)
|
||||
for (const auto &terminalEntry : networkMap.terminals) {
|
||||
for (const std::pair<TfToken, HdMaterialConnection2> &terminalEntry : networkMap.terminals) {
|
||||
const TfToken &terminalName = terminalEntry.first;
|
||||
const HdMaterialConnection2 &connection = terminalEntry.second;
|
||||
|
||||
@@ -562,13 +563,10 @@ void HdCyclesMaterial::Finalize(HdRenderParam *renderParam)
|
||||
}
|
||||
|
||||
const SceneLock lock(renderParam);
|
||||
const bool keep_nodes = static_cast<const HdCyclesSession *>(renderParam)->keep_nodes;
|
||||
|
||||
_nodes.clear();
|
||||
|
||||
if (!keep_nodes) {
|
||||
lock.scene->delete_node(_shader);
|
||||
}
|
||||
lock.scene->delete_node(_shader);
|
||||
_shader = nullptr;
|
||||
}
|
||||
|
||||
|
@@ -30,11 +30,11 @@ bool HdCyclesOutputDriver::update_render_tile(const Tile &tile)
|
||||
std::vector<float> pixels;
|
||||
|
||||
for (const HdRenderPassAovBinding &aovBinding : _renderParam->GetAovBindings()) {
|
||||
if (const auto renderBuffer = static_cast<HdCyclesRenderBuffer *>(aovBinding.renderBuffer)) {
|
||||
if (aovBinding == _renderParam->GetDisplayAovBinding() && renderBuffer->IsResourceUsed()) {
|
||||
continue; // Display AOV binding is already updated by Cycles display driver
|
||||
}
|
||||
if (aovBinding == _renderParam->GetDisplayAovBinding()) {
|
||||
continue; // Display AOV binding is already updated by Cycles display driver
|
||||
}
|
||||
|
||||
if (const auto renderBuffer = static_cast<HdCyclesRenderBuffer *>(aovBinding.renderBuffer)) {
|
||||
const HdFormat format = renderBuffer->GetFormat();
|
||||
if (format == HdFormatInvalid) {
|
||||
continue; // Skip invalid AOV bindings
|
||||
|
@@ -35,7 +35,7 @@ bool HdCyclesRenderBuffer::Allocate(const GfVec3i &dimensions, HdFormat format,
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t oldSize = _dataSize;
|
||||
const size_t oldSize = _data.size();
|
||||
const size_t newSize = dimensions[0] * dimensions[1] * HdDataSizeOfFormat(format);
|
||||
if (oldSize == newSize) {
|
||||
return true;
|
||||
@@ -49,8 +49,8 @@ bool HdCyclesRenderBuffer::Allocate(const GfVec3i &dimensions, HdFormat format,
|
||||
_width = dimensions[0];
|
||||
_height = dimensions[1];
|
||||
_format = format;
|
||||
_dataSize = newSize;
|
||||
_resourceUsed = false;
|
||||
|
||||
_data.resize(newSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -63,7 +63,6 @@ void HdCyclesRenderBuffer::_Deallocate()
|
||||
|
||||
_data.clear();
|
||||
_data.shrink_to_fit();
|
||||
_dataSize = 0;
|
||||
|
||||
_resource = VtValue();
|
||||
}
|
||||
@@ -75,10 +74,6 @@ void *HdCyclesRenderBuffer::Map()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (_data.size() != _dataSize) {
|
||||
_data.resize(_dataSize);
|
||||
}
|
||||
|
||||
++_mapped;
|
||||
|
||||
return _data.data();
|
||||
@@ -108,17 +103,10 @@ void HdCyclesRenderBuffer::SetConverged(bool converged)
|
||||
_converged = converged;
|
||||
}
|
||||
|
||||
bool HdCyclesRenderBuffer::IsResourceUsed() const
|
||||
{
|
||||
return _resourceUsed;
|
||||
}
|
||||
|
||||
VtValue HdCyclesRenderBuffer::GetResource(bool multiSampled) const
|
||||
{
|
||||
TF_UNUSED(multiSampled);
|
||||
|
||||
_resourceUsed = true;
|
||||
|
||||
return _resource;
|
||||
}
|
||||
|
||||
|
@@ -58,8 +58,6 @@ class HdCyclesRenderBuffer final : public PXR_NS::HdRenderBuffer {
|
||||
|
||||
void SetConverged(bool converged);
|
||||
|
||||
bool IsResourceUsed() const;
|
||||
|
||||
PXR_NS::VtValue GetResource(bool multiSampled = false) const override;
|
||||
|
||||
void SetResource(const PXR_NS::VtValue &resource);
|
||||
@@ -76,11 +74,9 @@ class HdCyclesRenderBuffer final : public PXR_NS::HdRenderBuffer {
|
||||
unsigned int _width = 0u;
|
||||
unsigned int _height = 0u;
|
||||
PXR_NS::HdFormat _format = PXR_NS::HdFormatInvalid;
|
||||
size_t _dataSize = 0;
|
||||
|
||||
std::vector<uint8_t> _data;
|
||||
PXR_NS::VtValue _resource;
|
||||
mutable std::atomic_bool _resourceUsed = false;
|
||||
|
||||
std::atomic_int _mapped = 0;
|
||||
std::atomic_bool _converged = false;
|
||||
|
@@ -26,13 +26,20 @@
|
||||
|
||||
HDCYCLES_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
TF_DEFINE_PUBLIC_TOKENS(HdCyclesRenderSettingsTokens, HD_CYCLES_RENDER_SETTINGS_TOKENS);
|
||||
|
||||
// clang-format off
|
||||
TF_DEFINE_PRIVATE_TOKENS(_tokens,
|
||||
(cycles)
|
||||
(openvdbAsset)
|
||||
);
|
||||
|
||||
TF_DEFINE_PRIVATE_TOKENS(HdCyclesRenderSettingsTokens,
|
||||
(stageMetersPerUnit)
|
||||
((device, "cycles:device"))
|
||||
((threads, "cycles:threads"))
|
||||
((timeLimit, "cycles:time_limit"))
|
||||
((samples, "cycles:samples"))
|
||||
((sampleOffset, "cycles:sample_offset"))
|
||||
);
|
||||
// clang-format on
|
||||
|
||||
namespace {
|
||||
@@ -112,22 +119,23 @@ SessionParams GetSessionParams(const HdRenderSettingsMap &settings)
|
||||
|
||||
} // namespace
|
||||
|
||||
HdCyclesDelegate::HdCyclesDelegate(const HdRenderSettingsMap &settingsMap,
|
||||
Session *session_,
|
||||
const bool keep_nodes)
|
||||
HdCyclesDelegate::HdCyclesDelegate(const HdRenderSettingsMap &settingsMap, Session *session_)
|
||||
: HdRenderDelegate()
|
||||
{
|
||||
_renderParam = session_ ? std::make_unique<HdCyclesSession>(session_, keep_nodes) :
|
||||
_renderParam = session_ ? std::make_unique<HdCyclesSession>(session_) :
|
||||
std::make_unique<HdCyclesSession>(GetSessionParams(settingsMap));
|
||||
|
||||
for (const auto &setting : settingsMap) {
|
||||
// Skip over the settings known to be used for initialization only
|
||||
if (setting.first == HdCyclesRenderSettingsTokens->device ||
|
||||
setting.first == HdCyclesRenderSettingsTokens->threads) {
|
||||
continue;
|
||||
}
|
||||
// If the delegate owns the session, pull any remaining settings
|
||||
if (!session_) {
|
||||
for (const auto &setting : settingsMap) {
|
||||
// Skip over the settings known to be used for initialization only
|
||||
if (setting.first == HdCyclesRenderSettingsTokens->device ||
|
||||
setting.first == HdCyclesRenderSettingsTokens->threads) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SetRenderSetting(setting.first, setting.second);
|
||||
SetRenderSetting(setting.first, setting.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +155,7 @@ void HdCyclesDelegate::SetDrivers(const HdDriverVector &drivers)
|
||||
|
||||
bool HdCyclesDelegate::IsDisplaySupported() const
|
||||
{
|
||||
#if defined(_WIN32) && defined(WITH_HYDRA_DISPLAY_DRIVER)
|
||||
#ifdef _WIN32
|
||||
return _hgi && _hgi->GetAPIName() == HgiTokens->OpenGL;
|
||||
#else
|
||||
return false;
|
||||
@@ -318,7 +326,7 @@ HdBprim *HdCyclesDelegate::CreateBprim(const TfToken &typeId, const SdfPath &bpr
|
||||
}
|
||||
#endif
|
||||
|
||||
TF_CODING_ERROR("Unknown Bprim type %s", typeId.GetText());
|
||||
TF_RUNTIME_ERROR("Unknown Bprim type %s", typeId.GetText());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -11,23 +11,10 @@
|
||||
|
||||
HDCYCLES_NAMESPACE_OPEN_SCOPE
|
||||
|
||||
// clang-format off
|
||||
#define HD_CYCLES_RENDER_SETTINGS_TOKENS \
|
||||
(stageMetersPerUnit) \
|
||||
((device, "cycles:device")) \
|
||||
((threads, "cycles:threads")) \
|
||||
((timeLimit, "cycles:time_limit")) \
|
||||
((samples, "cycles:samples")) \
|
||||
((sampleOffset, "cycles:sample_offset"))
|
||||
// clang-format on
|
||||
|
||||
TF_DECLARE_PUBLIC_TOKENS(HdCyclesRenderSettingsTokens, HD_CYCLES_RENDER_SETTINGS_TOKENS);
|
||||
|
||||
class HdCyclesDelegate final : public PXR_NS::HdRenderDelegate {
|
||||
public:
|
||||
HdCyclesDelegate(const PXR_NS::HdRenderSettingsMap &settingsMap,
|
||||
CCL_NS::Session *session_ = nullptr,
|
||||
const bool keep_nodes = false);
|
||||
CCL_NS::Session *session_ = nullptr);
|
||||
~HdCyclesDelegate() override;
|
||||
|
||||
void SetDrivers(const PXR_NS::HdDriverVector &drivers) override;
|
||||
|
@@ -4,19 +4,14 @@
|
||||
|
||||
#include "hydra/render_pass.h"
|
||||
#include "hydra/camera.h"
|
||||
#include "hydra/display_driver.h"
|
||||
#include "hydra/output_driver.h"
|
||||
#include "hydra/render_buffer.h"
|
||||
#include "hydra/render_delegate.h"
|
||||
#include "hydra/session.h"
|
||||
|
||||
#ifdef WITH_HYDRA_DISPLAY_DRIVER
|
||||
# include "hydra/display_driver.h"
|
||||
#endif
|
||||
|
||||
#include "scene/camera.h"
|
||||
#include "scene/integrator.h"
|
||||
#include "scene/scene.h"
|
||||
|
||||
#include "session/session.h"
|
||||
|
||||
#include <pxr/imaging/hd/renderPassState.h>
|
||||
@@ -37,10 +32,8 @@ HdCyclesRenderPass::HdCyclesRenderPass(HdRenderIndex *index,
|
||||
const auto renderDelegate = static_cast<const HdCyclesDelegate *>(
|
||||
GetRenderIndex()->GetRenderDelegate());
|
||||
if (renderDelegate->IsDisplaySupported()) {
|
||||
#ifdef WITH_HYDRA_DISPLAY_DRIVER
|
||||
session->set_display_driver(
|
||||
make_unique<HdCyclesDisplayDriver>(renderParam, renderDelegate->GetHgi()));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1 +0,0 @@
|
||||
*PXR*
|
@@ -1,8 +0,0 @@
|
||||
/* Hide everything except USD / Hydra symbols, to avoid conflicts with other
|
||||
* application using different library versions. */
|
||||
{
|
||||
global:
|
||||
PXR*;
|
||||
local:
|
||||
*;
|
||||
};
|
@@ -36,13 +36,12 @@ SceneLock::~SceneLock()
|
||||
{
|
||||
}
|
||||
|
||||
HdCyclesSession::HdCyclesSession(Session *session_, const bool keep_nodes)
|
||||
: session(session_), keep_nodes(true), _ownCyclesSession(false)
|
||||
HdCyclesSession::HdCyclesSession(Session *session_) : session(session_), _ownCyclesSession(false)
|
||||
{
|
||||
}
|
||||
|
||||
HdCyclesSession::HdCyclesSession(const SessionParams ¶ms)
|
||||
: session(new Session(params, SceneParams())), keep_nodes(false), _ownCyclesSession(true)
|
||||
: session(new Session(params, SceneParams())), _ownCyclesSession(true)
|
||||
{
|
||||
Scene *const scene = session->scene;
|
||||
|
||||
|
@@ -23,7 +23,7 @@ struct SceneLock {
|
||||
|
||||
class HdCyclesSession final : public PXR_NS::HdRenderParam {
|
||||
public:
|
||||
HdCyclesSession(CCL_NS::Session *session_, const bool keep_nodes);
|
||||
HdCyclesSession(CCL_NS::Session *session_);
|
||||
HdCyclesSession(const CCL_NS::SessionParams ¶ms);
|
||||
~HdCyclesSession() override;
|
||||
|
||||
@@ -59,7 +59,6 @@ class HdCyclesSession final : public PXR_NS::HdRenderParam {
|
||||
void RemoveAovBinding(PXR_NS::HdRenderBuffer *renderBuffer);
|
||||
|
||||
CCL_NS::Session *session;
|
||||
bool keep_nodes;
|
||||
|
||||
private:
|
||||
const bool _ownCyclesSession;
|
||||
|
@@ -626,7 +626,6 @@ uint OIDNDenoiser::get_device_type_mask() const
|
||||
Device *OIDNDenoiser::ensure_denoiser_device(Progress *progress)
|
||||
{
|
||||
#ifndef WITH_OPENIMAGEDENOISE
|
||||
(void)progress;
|
||||
path_trace_device_->set_error("Build without OpenImageDenoiser");
|
||||
return nullptr;
|
||||
#else
|
||||
|
@@ -647,6 +647,8 @@ void PathTrace::update_display(const RenderWork &render_work)
|
||||
|
||||
void PathTrace::rebalance(const RenderWork &render_work)
|
||||
{
|
||||
static const int kLogLevel = 3;
|
||||
|
||||
if (!render_work.rebalance) {
|
||||
return;
|
||||
}
|
||||
@@ -654,33 +656,33 @@ void PathTrace::rebalance(const RenderWork &render_work)
|
||||
const int num_works = path_trace_works_.size();
|
||||
|
||||
if (num_works == 1) {
|
||||
VLOG(3) << "Ignoring rebalance work due to single device render.";
|
||||
VLOG(kLogLevel) << "Ignoring rebalance work due to single device render.";
|
||||
return;
|
||||
}
|
||||
|
||||
const double start_time = time_dt();
|
||||
|
||||
if (VLOG_IS_ON(3)) {
|
||||
VLOG(3) << "Perform rebalance work.";
|
||||
VLOG(3) << "Per-device path tracing time (seconds):";
|
||||
if (VLOG_IS_ON(kLogLevel)) {
|
||||
VLOG(kLogLevel) << "Perform rebalance work.";
|
||||
VLOG(kLogLevel) << "Per-device path tracing time (seconds):";
|
||||
for (int i = 0; i < num_works; ++i) {
|
||||
VLOG(3) << path_trace_works_[i]->get_device()->info.description << ": "
|
||||
<< work_balance_infos_[i].time_spent;
|
||||
VLOG(kLogLevel) << path_trace_works_[i]->get_device()->info.description << ": "
|
||||
<< work_balance_infos_[i].time_spent;
|
||||
}
|
||||
}
|
||||
|
||||
const bool did_rebalance = work_balance_do_rebalance(work_balance_infos_);
|
||||
|
||||
if (VLOG_IS_ON(3)) {
|
||||
VLOG(3) << "Calculated per-device weights for works:";
|
||||
if (VLOG_IS_ON(kLogLevel)) {
|
||||
VLOG(kLogLevel) << "Calculated per-device weights for works:";
|
||||
for (int i = 0; i < num_works; ++i) {
|
||||
VLOG(3) << path_trace_works_[i]->get_device()->info.description << ": "
|
||||
<< work_balance_infos_[i].weight;
|
||||
VLOG(kLogLevel) << path_trace_works_[i]->get_device()->info.description << ": "
|
||||
<< work_balance_infos_[i].weight;
|
||||
}
|
||||
}
|
||||
|
||||
if (!did_rebalance) {
|
||||
VLOG(3) << "Balance in path trace works did not change.";
|
||||
VLOG(kLogLevel) << "Balance in path trace works did not change.";
|
||||
render_scheduler_.report_rebalance_time(render_work, time_dt() - start_time, false);
|
||||
return;
|
||||
}
|
||||
|
@@ -65,8 +65,6 @@ PathTraceWorkGPU::PathTraceWorkGPU(Device *device,
|
||||
integrator_shader_sort_counter_(device, "integrator_shader_sort_counter", MEM_READ_WRITE),
|
||||
integrator_shader_raytrace_sort_counter_(
|
||||
device, "integrator_shader_raytrace_sort_counter", MEM_READ_WRITE),
|
||||
integrator_shader_mnee_sort_counter_(
|
||||
device, "integrator_shader_mnee_sort_counter", MEM_READ_WRITE),
|
||||
integrator_shader_sort_prefix_sum_(
|
||||
device, "integrator_shader_sort_prefix_sum", MEM_READ_WRITE),
|
||||
integrator_next_main_path_index_(device, "integrator_next_main_path_index", MEM_READ_WRITE),
|
||||
@@ -190,9 +188,6 @@ void PathTraceWorkGPU::alloc_integrator_sorting()
|
||||
integrator_shader_raytrace_sort_counter_.alloc(max_shaders);
|
||||
integrator_shader_raytrace_sort_counter_.zero_to_device();
|
||||
|
||||
integrator_shader_mnee_sort_counter_.alloc(max_shaders);
|
||||
integrator_shader_mnee_sort_counter_.zero_to_device();
|
||||
|
||||
integrator_shader_sort_prefix_sum_.alloc(max_shaders);
|
||||
integrator_shader_sort_prefix_sum_.zero_to_device();
|
||||
|
||||
@@ -200,8 +195,6 @@ void PathTraceWorkGPU::alloc_integrator_sorting()
|
||||
(int *)integrator_shader_sort_counter_.device_pointer;
|
||||
integrator_state_gpu_.sort_key_counter[DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE] =
|
||||
(int *)integrator_shader_raytrace_sort_counter_.device_pointer;
|
||||
integrator_state_gpu_.sort_key_counter[DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE] =
|
||||
(int *)integrator_shader_mnee_sort_counter_.device_pointer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,7 +327,6 @@ void PathTraceWorkGPU::enqueue_reset()
|
||||
queue_->zero_to_device(integrator_queue_counter_);
|
||||
queue_->zero_to_device(integrator_shader_sort_counter_);
|
||||
queue_->zero_to_device(integrator_shader_raytrace_sort_counter_);
|
||||
queue_->zero_to_device(integrator_shader_mnee_sort_counter_);
|
||||
|
||||
/* Tiles enqueue need to know number of active paths, which is based on this counter. Zero the
|
||||
* counter on the host side because `zero_to_device()` is not doing it. */
|
||||
@@ -458,7 +450,6 @@ void PathTraceWorkGPU::enqueue_path_iteration(DeviceKernel kernel, const int num
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_SHADOW:
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE:
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE:
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE:
|
||||
case DEVICE_KERNEL_INTEGRATOR_SHADE_VOLUME: {
|
||||
/* Shading kernels with integrator state and render buffer. */
|
||||
DeviceKernelArguments args(&d_path_index, &buffers_->buffer.device_pointer, &work_size);
|
||||
@@ -1089,15 +1080,13 @@ int PathTraceWorkGPU::shadow_catcher_count_possible_splits()
|
||||
bool PathTraceWorkGPU::kernel_uses_sorting(DeviceKernel kernel)
|
||||
{
|
||||
return (kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE);
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE);
|
||||
}
|
||||
|
||||
bool PathTraceWorkGPU::kernel_creates_shadow_paths(DeviceKernel kernel)
|
||||
{
|
||||
return (kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_VOLUME);
|
||||
}
|
||||
|
||||
@@ -1105,8 +1094,7 @@ bool PathTraceWorkGPU::kernel_creates_ao_paths(DeviceKernel kernel)
|
||||
{
|
||||
return (device_scene_->data.kernel_features & KERNEL_FEATURE_AO) &&
|
||||
(kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE ||
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_MNEE);
|
||||
kernel == DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE);
|
||||
}
|
||||
|
||||
bool PathTraceWorkGPU::kernel_is_shadow_path(DeviceKernel kernel)
|
||||
|
@@ -133,7 +133,6 @@ class PathTraceWorkGPU : public PathTraceWork {
|
||||
/* Shader sorting. */
|
||||
device_vector<int> integrator_shader_sort_counter_;
|
||||
device_vector<int> integrator_shader_raytrace_sort_counter_;
|
||||
device_vector<int> integrator_shader_mnee_sort_counter_;
|
||||
device_vector<int> integrator_shader_sort_prefix_sum_;
|
||||
/* Path split. */
|
||||
device_vector<int> integrator_next_main_path_index_;
|
||||
|
@@ -750,11 +750,6 @@ double RenderScheduler::guess_display_update_interval_in_seconds_for_num_samples
|
||||
int RenderScheduler::calculate_num_samples_per_update() const
|
||||
{
|
||||
const double time_per_sample_average = path_trace_time_.get_average();
|
||||
/* Fall back to 1 sample if we have not recorded a time yet. */
|
||||
if (time_per_sample_average == 0.0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const double num_samples_in_second = pixel_size_ * pixel_size_ / time_per_sample_average;
|
||||
|
||||
const double update_interval_in_seconds = guess_display_update_interval_in_seconds();
|
||||
|
@@ -356,13 +356,16 @@ if(WITH_CYCLES_CUDA_BINARIES)
|
||||
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
|
||||
|
||||
# warn for other versions
|
||||
if((CUDA_VERSION STREQUAL "101") OR
|
||||
(CUDA_VERSION STREQUAL "102") OR
|
||||
(CUDA_VERSION_MAJOR STREQUAL "11"))
|
||||
if((CUDA_VERSION MATCHES "101") OR
|
||||
(CUDA_VERSION MATCHES "102") OR
|
||||
(CUDA_VERSION MATCHES "111") OR
|
||||
(CUDA_VERSION MATCHES "112") OR
|
||||
(CUDA_VERSION MATCHES "113") OR
|
||||
(CUDA_VERSION MATCHES "114"))
|
||||
else()
|
||||
message(WARNING
|
||||
"CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
|
||||
"build may succeed but only CUDA 11, 10.2 and 10.1 have been tested")
|
||||
"build may succeed but only CUDA 10.1 to 11.4 are officially supported")
|
||||
endif()
|
||||
|
||||
# build for each arch
|
||||
@@ -479,19 +482,19 @@ if(WITH_CYCLES_CUDA_BINARIES)
|
||||
if(DEFINED CUDA10_NVCC_EXECUTABLE)
|
||||
set(cuda_nvcc_executable ${CUDA10_NVCC_EXECUTABLE})
|
||||
set(cuda_toolkit_root_dir ${CUDA10_TOOLKIT_ROOT_DIR})
|
||||
elseif("${CUDA_VERSION}" LESS 110) # Support for sm_30 was removed in CUDA 11
|
||||
elseif(${CUDA_VERSION} LESS 110) # Support for sm_30 was removed in CUDA 11
|
||||
set(cuda_nvcc_executable ${CUDA_NVCC_EXECUTABLE})
|
||||
set(cuda_toolkit_root_dir ${CUDA_TOOLKIT_ROOT_DIR})
|
||||
else()
|
||||
message(STATUS "CUDA binaries for ${arch} require CUDA 10 or earlier, skipped.")
|
||||
endif()
|
||||
elseif(${arch} MATCHES ".*_7." AND "${CUDA_VERSION}" LESS 100)
|
||||
elseif(${arch} MATCHES ".*_7." AND ${CUDA_VERSION} LESS 100)
|
||||
message(STATUS "CUDA binaries for ${arch} require CUDA 10.0+, skipped.")
|
||||
elseif(${arch} MATCHES ".*_8.")
|
||||
if(DEFINED CUDA11_NVCC_EXECUTABLE)
|
||||
set(cuda_nvcc_executable ${CUDA11_NVCC_EXECUTABLE})
|
||||
set(cuda_toolkit_root_dir ${CUDA11_TOOLKIT_ROOT_DIR})
|
||||
elseif("${CUDA_VERSION}" GREATER_EQUAL 111) # Support for sm_86 was introduced in CUDA 11
|
||||
elseif(${CUDA_VERSION} GREATER_EQUAL 111) # Support for sm_86 was introduced in CUDA 11
|
||||
set(cuda_nvcc_executable ${CUDA_NVCC_EXECUTABLE})
|
||||
set(cuda_toolkit_root_dir ${CUDA_TOOLKIT_ROOT_DIR})
|
||||
else()
|
||||
@@ -730,14 +733,6 @@ if(CXX_HAS_AVX2)
|
||||
set_source_files_properties(device/cpu/kernel_avx2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
|
||||
endif()
|
||||
|
||||
# Warnings to avoid using doubles in the kernel.
|
||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_float_conversion "-Werror=float-conversion")
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_double_promotion "-Werror=double-promotion")
|
||||
unset(_has_cxxflag_float_conversion)
|
||||
unset(_has_cxxflag_double_promotion)
|
||||
endif()
|
||||
|
||||
cycles_add_library(cycles_kernel "${LIB}"
|
||||
${SRC_KERNEL_DEVICE_CPU}
|
||||
${SRC_KERNEL_DEVICE_CUDA}
|
||||
|
@@ -445,11 +445,6 @@ ccl_device_inline int bsdf_sample(KernelGlobals kg,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WITH_CYCLES_DEBUG
|
||||
kernel_assert(*pdf >= 0.0f);
|
||||
kernel_assert(eval->x >= 0.0f && eval->y >= 0.0f && eval->z >= 0.0f);
|
||||
#endif
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -640,10 +635,7 @@ ccl_device_inline
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef WITH_CYCLES_DEBUG
|
||||
kernel_assert(*pdf >= 0.0f);
|
||||
kernel_assert(eval.x >= 0.0f && eval.y >= 0.0f && eval.z >= 0.0f);
|
||||
#endif
|
||||
|
||||
return eval;
|
||||
}
|
||||
|
||||
|
@@ -53,10 +53,9 @@ bsdf_ashikhmin_shirley_eval_reflect(ccl_private const ShaderClosure *sc,
|
||||
|
||||
float out = 0.0f;
|
||||
|
||||
if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f) {
|
||||
*pdf = 0.0f;
|
||||
if (fmaxf(bsdf->alpha_x, bsdf->alpha_y) <= 1e-4f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
if (NdotI > 0.0f && NdotO > 0.0f) {
|
||||
NdotI = fmaxf(NdotI, 1e-6f);
|
||||
NdotO = fmaxf(NdotO, 1e-6f);
|
||||
@@ -113,7 +112,6 @@ ccl_device float3 bsdf_ashikhmin_shirley_eval_transmit(ccl_private const ShaderC
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
@@ -48,10 +48,9 @@ ccl_device float3 bsdf_ashikhmin_velvet_eval_reflect(ccl_private const ShaderClo
|
||||
float cosNH = dot(N, H);
|
||||
float cosHO = fabsf(dot(I, H));
|
||||
|
||||
if (!(fabsf(cosNH) < 1.0f - 1e-5f && cosHO > 1e-5f)) {
|
||||
*pdf = 0.0f;
|
||||
if (!(fabsf(cosNH) < 1.0f - 1e-5f && cosHO > 1e-5f))
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
float cosNHdivHO = cosNH / cosHO;
|
||||
cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
|
||||
|
||||
@@ -63,7 +62,7 @@ ccl_device float3 bsdf_ashikhmin_velvet_eval_reflect(ccl_private const ShaderClo
|
||||
float cotangent2 = (cosNH * cosNH) / sinNH2;
|
||||
|
||||
float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
|
||||
float G = fminf(1.0f, fminf(fac1, fac2)); // TODO: derive G from D analytically
|
||||
float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically
|
||||
|
||||
float out = 0.25f * (D * G) / cosNO;
|
||||
|
||||
@@ -71,7 +70,6 @@ ccl_device float3 bsdf_ashikhmin_velvet_eval_reflect(ccl_private const ShaderClo
|
||||
return make_float3(out, out, out);
|
||||
}
|
||||
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -80,7 +78,6 @@ ccl_device float3 bsdf_ashikhmin_velvet_eval_transmit(ccl_private const ShaderCl
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -125,7 +122,7 @@ ccl_device int bsdf_ashikhmin_velvet_sample(ccl_private const ShaderClosure *sc,
|
||||
float cotangent2 = (cosNH * cosNH) / sinNH2;
|
||||
|
||||
float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
|
||||
float G = fminf(1.0f, fminf(fac1, fac2)); // TODO: derive G from D analytically
|
||||
float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically
|
||||
|
||||
float power = 0.25f * (D * G) / cosNO;
|
||||
|
||||
@@ -137,15 +134,12 @@ ccl_device int bsdf_ashikhmin_velvet_sample(ccl_private const ShaderClosure *sc,
|
||||
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
else
|
||||
*pdf = 0.0f;
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
*pdf = 0.0f;
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
return LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
}
|
||||
|
||||
|
@@ -44,7 +44,6 @@ ccl_device float3 bsdf_diffuse_eval_transmit(ccl_private const ShaderClosure *sc
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -75,10 +74,9 @@ ccl_device int bsdf_diffuse_sample(ccl_private const ShaderClosure *sc,
|
||||
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
else
|
||||
*pdf = 0.0f;
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
return LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
}
|
||||
|
||||
@@ -95,7 +93,6 @@ ccl_device float3 bsdf_translucent_eval_reflect(ccl_private const ShaderClosure
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -141,7 +138,6 @@ ccl_device int bsdf_translucent_sample(ccl_private const ShaderClosure *sc,
|
||||
}
|
||||
else {
|
||||
*pdf = 0;
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
return LABEL_TRANSMIT | LABEL_DIFFUSE;
|
||||
}
|
||||
|
@@ -93,10 +93,9 @@ ccl_device int bsdf_diffuse_ramp_sample(ccl_private const ShaderClosure *sc,
|
||||
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
# endif
|
||||
}
|
||||
else {
|
||||
else
|
||||
*pdf = 0.0f;
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
return LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
}
|
||||
|
||||
|
@@ -89,7 +89,6 @@ ccl_device float3 bsdf_hair_transmission_eval_reflect(ccl_private const ShaderCl
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -98,7 +97,6 @@ ccl_device float3 bsdf_hair_reflection_eval_transmit(ccl_private const ShaderClo
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
@@ -368,10 +368,8 @@ ccl_device float3 bsdf_microfacet_ggx_eval_reflect(ccl_private const ShaderClosu
|
||||
bool m_refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
|
||||
float3 N = bsdf->N;
|
||||
|
||||
if (m_refractive || alpha_x * alpha_y <= 1e-7f) {
|
||||
*pdf = 0.0f;
|
||||
if (m_refractive || alpha_x * alpha_y <= 1e-7f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
float cosNO = dot(N, I);
|
||||
float cosNI = dot(N, omega_in);
|
||||
@@ -484,18 +482,15 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(ccl_private const ShaderClos
|
||||
bool m_refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
|
||||
float3 N = bsdf->N;
|
||||
|
||||
if (!m_refractive || alpha_x * alpha_y <= 1e-7f) {
|
||||
*pdf = 0.0f;
|
||||
if (!m_refractive || alpha_x * alpha_y <= 1e-7f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
float cosNO = dot(N, I);
|
||||
float cosNI = dot(N, omega_in);
|
||||
|
||||
if (cosNO <= 0 || cosNI >= 0) {
|
||||
*pdf = 0.0f;
|
||||
if (cosNO <= 0 || cosNI >= 0)
|
||||
return make_float3(0.0f, 0.0f, 0.0f); /* vectors on same side -- not possible */
|
||||
}
|
||||
|
||||
/* compute half-vector of the refraction (eq. 16) */
|
||||
float3 ht = -(m_eta * omega_in + I);
|
||||
float3 Ht = normalize(ht);
|
||||
@@ -678,10 +673,6 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals kg,
|
||||
*domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
*pdf = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -753,10 +744,6 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals kg,
|
||||
*eval = make_float3(out, out, out);
|
||||
}
|
||||
}
|
||||
else {
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
*pdf = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -846,10 +833,8 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_reflect(ccl_private const Shader
|
||||
bool m_refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
|
||||
float3 N = bsdf->N;
|
||||
|
||||
if (m_refractive || alpha_x * alpha_y <= 1e-7f) {
|
||||
*pdf = 0.0f;
|
||||
if (m_refractive || alpha_x * alpha_y <= 1e-7f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
float cosNO = dot(N, I);
|
||||
float cosNI = dot(N, omega_in);
|
||||
@@ -928,18 +913,15 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(ccl_private const Shade
|
||||
bool m_refractive = bsdf->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
|
||||
float3 N = bsdf->N;
|
||||
|
||||
if (!m_refractive || alpha_x * alpha_y <= 1e-7f) {
|
||||
*pdf = 0.0f;
|
||||
if (!m_refractive || alpha_x * alpha_y <= 1e-7f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
float cosNO = dot(N, I);
|
||||
float cosNI = dot(N, omega_in);
|
||||
|
||||
if (cosNO <= 0 || cosNI >= 0) {
|
||||
*pdf = 0.0f;
|
||||
if (cosNO <= 0 || cosNI >= 0)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
/* compute half-vector of the refraction (eq. 16) */
|
||||
float3 ht = -(m_eta * omega_in + I);
|
||||
float3 Ht = normalize(ht);
|
||||
@@ -1082,10 +1064,6 @@ ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals kg,
|
||||
*domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
*pdf = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1158,10 +1136,6 @@ ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals kg,
|
||||
*eval = make_float3(out, out, out);
|
||||
}
|
||||
}
|
||||
else {
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
*pdf = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@@ -434,22 +434,14 @@ ccl_device float3 bsdf_microfacet_multi_ggx_eval_reflect(ccl_private const Shade
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
|
||||
if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) {
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
float3 X, Y, Z;
|
||||
Z = bsdf->N;
|
||||
|
||||
/* Ensure that the both directions are on the outside w.r.t. the shading normal. */
|
||||
if (dot(Z, I) <= 0.0f || dot(Z, omega_in) <= 0.0f) {
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
bool use_fresnel = (bsdf->type == CLOSURE_BSDF_MICROFACET_MULTI_GGX_FRESNEL_ID);
|
||||
|
||||
bool is_aniso = (bsdf->alpha_x != bsdf->alpha_y);
|
||||
float3 X, Y, Z;
|
||||
Z = bsdf->N;
|
||||
if (is_aniso)
|
||||
make_orthonormals_tangent(Z, bsdf->T, &X, &Y);
|
||||
else
|
||||
@@ -494,20 +486,8 @@ ccl_device int bsdf_microfacet_multi_ggx_sample(KernelGlobals kg,
|
||||
float3 X, Y, Z;
|
||||
Z = bsdf->N;
|
||||
|
||||
/* Ensure that the view direction is on the outside w.r.t. the shading normal. */
|
||||
if (dot(Z, I) <= 0.0f) {
|
||||
*pdf = 0.0f;
|
||||
return LABEL_NONE;
|
||||
}
|
||||
|
||||
/* Special case: Extremely low roughness.
|
||||
* Don't bother with microfacets, just do specular reflection. */
|
||||
if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) {
|
||||
*omega_in = 2 * dot(Z, I) * Z - I;
|
||||
if (dot(Ng, *omega_in) <= 0.0f) {
|
||||
*pdf = 0.0f;
|
||||
return LABEL_NONE;
|
||||
}
|
||||
*pdf = 1e6f;
|
||||
*eval = make_float3(1e6f, 1e6f, 1e6f);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
@@ -537,20 +517,14 @@ ccl_device int bsdf_microfacet_multi_ggx_sample(KernelGlobals kg,
|
||||
bsdf->ior,
|
||||
use_fresnel,
|
||||
bsdf->extra->cspec0);
|
||||
*omega_in = X * localO.x + Y * localO.y + Z * localO.z;
|
||||
|
||||
/* Ensure that the light direction is on the outside w.r.t. the geometry normal. */
|
||||
if (dot(Ng, *omega_in) <= 0.0f) {
|
||||
*pdf = 0.0f;
|
||||
return LABEL_NONE;
|
||||
}
|
||||
|
||||
if (is_aniso)
|
||||
*pdf = mf_ggx_aniso_pdf(localI, localO, make_float2(bsdf->alpha_x, bsdf->alpha_y));
|
||||
else
|
||||
*pdf = mf_ggx_pdf(localI, localO, bsdf->alpha_x);
|
||||
*eval *= *pdf;
|
||||
|
||||
*omega_in = X * localO.x + Y * localO.y + Z * localO.z;
|
||||
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
*domega_in_dx = (2 * dot(Z, dIdx)) * Z - dIdx;
|
||||
*domega_in_dy = (2 * dot(Z, dIdy)) * Z - dIdy;
|
||||
@@ -598,7 +572,6 @@ bsdf_microfacet_multi_ggx_glass_eval_transmit(ccl_private const ShaderClosure *s
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
|
||||
if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) {
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -631,7 +604,6 @@ ccl_device float3 bsdf_microfacet_multi_ggx_glass_eval_reflect(ccl_private const
|
||||
ccl_private const MicrofacetBsdf *bsdf = (ccl_private const MicrofacetBsdf *)sc;
|
||||
|
||||
if (bsdf->alpha_x * bsdf->alpha_y < 1e-7f) {
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
@@ -68,7 +68,6 @@ ccl_device float3 bsdf_oren_nayar_eval_transmit(ccl_private const ShaderClosure
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
@@ -64,7 +64,7 @@ ccl_device float3 bsdf_phong_ramp_eval_reflect(ccl_private const ShaderClosure *
|
||||
return bsdf_phong_ramp_get_color(bsdf->colors, cosp) * out;
|
||||
}
|
||||
}
|
||||
*pdf = 0.0f;
|
||||
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ ccl_device float3 bsdf_phong_ramp_eval_transmit(ccl_private const ShaderClosure
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -123,10 +122,6 @@ ccl_device int bsdf_phong_ramp_sample(ccl_private const ShaderClosure *sc,
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
*pdf = 0.0f;
|
||||
}
|
||||
return LABEL_REFLECT | LABEL_GLOSSY;
|
||||
}
|
||||
|
||||
|
@@ -135,7 +135,6 @@ ccl_device float3 bsdf_principled_diffuse_eval_transmit(ccl_private const Shader
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -169,7 +168,6 @@ ccl_device int bsdf_principled_diffuse_sample(ccl_private const ShaderClosure *s
|
||||
}
|
||||
else {
|
||||
*pdf = 0.0f;
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
return LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
}
|
||||
|
@@ -86,7 +86,6 @@ ccl_device float3 bsdf_principled_sheen_eval_transmit(ccl_private const ShaderCl
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -121,7 +120,6 @@ ccl_device int bsdf_principled_sheen_sample(ccl_private const ShaderClosure *sc,
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
*pdf = 0.0f;
|
||||
}
|
||||
return LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
|
@@ -23,7 +23,6 @@ ccl_device float3 bsdf_reflection_eval_reflect(ccl_private const ShaderClosure *
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -32,7 +31,6 @@ ccl_device float3 bsdf_reflection_eval_transmit(ccl_private const ShaderClosure
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -66,10 +64,6 @@ ccl_device int bsdf_reflection_sample(ccl_private const ShaderClosure *sc,
|
||||
*eval = make_float3(1e6f, 1e6f, 1e6f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
*pdf = 0.0f;
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
return LABEL_REFLECT | LABEL_SINGULAR;
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,6 @@ ccl_device float3 bsdf_refraction_eval_reflect(ccl_private const ShaderClosure *
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -32,7 +31,6 @@ ccl_device float3 bsdf_refraction_eval_transmit(ccl_private const ShaderClosure
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -84,10 +82,6 @@ ccl_device int bsdf_refraction_sample(ccl_private const ShaderClosure *sc,
|
||||
*domega_in_dy = dTdy;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
*pdf = 0.0f;
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
return LABEL_TRANSMIT | LABEL_SINGULAR;
|
||||
}
|
||||
|
||||
|
@@ -67,7 +67,7 @@ ccl_device float3 bsdf_diffuse_toon_eval_reflect(ccl_private const ShaderClosure
|
||||
*pdf = 0.5f * M_1_PI_F / (1.0f - cosf(sample_angle));
|
||||
return *pdf * eval;
|
||||
}
|
||||
*pdf = 0.0f;
|
||||
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ ccl_device float3 bsdf_diffuse_toon_eval_transmit(ccl_private const ShaderClosur
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -111,14 +110,8 @@ ccl_device int bsdf_diffuse_toon_sample(ccl_private const ShaderClosure *sc,
|
||||
*domega_in_dy = (2.0f * dot(bsdf->N, dIdy)) * bsdf->N - dIdy;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
*eval = make_float3(0.f, 0.f, 0.f);
|
||||
else
|
||||
*pdf = 0.0f;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*eval = make_float3(0.f, 0.f, 0.f);
|
||||
*pdf = 0.0f;
|
||||
}
|
||||
|
||||
return LABEL_REFLECT | LABEL_DIFFUSE;
|
||||
@@ -159,7 +152,7 @@ ccl_device float3 bsdf_glossy_toon_eval_reflect(ccl_private const ShaderClosure
|
||||
*pdf = 0.5f * M_1_PI_F / (1.0f - cosf(sample_angle));
|
||||
return *pdf * eval;
|
||||
}
|
||||
*pdf = 0.0f;
|
||||
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -168,7 +161,6 @@ ccl_device float3 bsdf_glossy_toon_eval_transmit(ccl_private const ShaderClosure
|
||||
const float3 omega_in,
|
||||
ccl_private float *pdf)
|
||||
{
|
||||
*pdf = 0.0f;
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
@@ -211,15 +203,11 @@ ccl_device int bsdf_glossy_toon_sample(ccl_private const ShaderClosure *sc,
|
||||
*domega_in_dy = (2 * dot(bsdf->N, dIdy)) * bsdf->N - dIdy;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
else
|
||||
*pdf = 0.0f;
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
*pdf = 0.0f;
|
||||
*eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
return LABEL_GLOSSY | LABEL_REFLECT;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user