Compare commits
74 Commits
temp-geome
...
tmp-gpu-sh
Author | SHA1 | Date | |
---|---|---|---|
57f0987325 | |||
be08d432cd | |||
8b2fe52f09 | |||
94bf26bb90 | |||
376f6b12c6 | |||
e066ea04d0 | |||
6a6d80f42c | |||
fe9aa0cce1 | |||
d4ef1a3d6d | |||
ea6a791460 | |||
da0935d503 | |||
33c79e518d | |||
a3f5722cc6 | |||
3ed6b4bf63 | |||
f2801e5c6e | |||
fb6b4f42c4 | |||
1d2e4a2667 | |||
dce5210946 | |||
7eeb7fd406 | |||
bf13e5458d | |||
414d1ea1c1 | |||
e748d6d57c | |||
bbf6a0c6aa | |||
e6a8c874ba | |||
3509bda164 | |||
f4b6db1f6d | |||
162280ac22 | |||
258192e47c | |||
e72f81b750 | |||
9858968348 | |||
867f1209e0 | |||
651ae585ca | |||
0e8fd2b064 | |||
6ae20c4229 | |||
8822b39dd8 | |||
5f0e0c94cc | |||
e39a1525a5 | |||
375c872799 | |||
960ce1e628 | |||
a54cc2acd2 | |||
6e605978bf | |||
a5a947190a | |||
c958929617 | |||
2ff9688677 | |||
aa2ef3db7a | |||
e3444ba522 | |||
85a290b09d | |||
f430fb74ac | |||
1c975749b0 | |||
7dd207dae3 | |||
eccfea7dd2 | |||
887ec48df9 | |||
60f7652a92 | |||
eac81b732e | |||
0bf4c5d532 | |||
cdf37eea51 | |||
a532373ef2 | |||
1ef47fadc0 | |||
b34f0eec12 | |||
2d73721c02 | |||
84c6e04d79 | |||
403a3162f5 | |||
8632f10e7b | |||
e7136ac0da | |||
8b097d53b2 | |||
f87e51ad56 | |||
d7b310b699 | |||
c9b32f0412 | |||
5967e12c21 | |||
a590474f4c | |||
b2462b6f5c | |||
21ee89c52f | |||
2c95da88aa | |||
7358a5aba2 |
@@ -569,10 +569,6 @@ if(UNIX AND NOT APPLE)
|
||||
option(WITH_LINKER_LLD "Use ld.lld linker which is usually faster than ld.gold" OFF)
|
||||
mark_as_advanced(WITH_LINKER_LLD)
|
||||
endif()
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
option(WITH_LINKER_MOLD "Use ld.mold linker which is usually faster than ld.gold & ld.lld." OFF)
|
||||
mark_as_advanced(WITH_LINKER_MOLD)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(WITH_COMPILER_ASAN "Build and link against address sanitizer (only for Debug & RelWithDebInfo targets)." OFF)
|
||||
@@ -708,12 +704,9 @@ if(UNIX AND NOT APPLE)
|
||||
endif()
|
||||
|
||||
# Installation process.
|
||||
set(POSTINSTALL_SCRIPT "" CACHE FILEPATH "Run given CMake script after installation process")
|
||||
option(POSTINSTALL_SCRIPT "Run given CMake script after installation process" OFF)
|
||||
mark_as_advanced(POSTINSTALL_SCRIPT)
|
||||
|
||||
set(POSTCONFIGURE_SCRIPT "" CACHE FILEPATH "Run given CMake script as the last step of CMake configuration")
|
||||
mark_as_advanced(POSTCONFIGURE_SCRIPT)
|
||||
|
||||
# end option(...)
|
||||
|
||||
|
||||
@@ -2077,8 +2070,3 @@ endif()
|
||||
if(0)
|
||||
print_all_vars()
|
||||
endif()
|
||||
|
||||
# Should be the last step of configuration.
|
||||
if(POSTCONFIGURE_SCRIPT)
|
||||
include(${POSTCONFIGURE_SCRIPT})
|
||||
endif()
|
||||
|
@@ -63,7 +63,6 @@ include(cmake/jpeg.cmake)
|
||||
include(cmake/blosc.cmake)
|
||||
include(cmake/pthreads.cmake)
|
||||
include(cmake/openexr.cmake)
|
||||
include(cmake/brotli.cmake)
|
||||
include(cmake/freetype.cmake)
|
||||
include(cmake/freeglut.cmake)
|
||||
include(cmake/glew.cmake)
|
||||
|
@@ -1,38 +0,0 @@
|
||||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
set(BROTLI_EXTRA_ARGS
|
||||
)
|
||||
|
||||
ExternalProject_Add(external_brotli
|
||||
URL file://${PACKAGE_DIR}/${BROTLI_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${BROTLI_HASH_TYPE}=${BROTLI_HASH}
|
||||
PREFIX ${BUILD_DIR}/brotli
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/brotli ${DEFAULT_CMAKE_FLAGS} ${BROTLI_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/brotli
|
||||
)
|
||||
|
||||
if(BUILD_MODE STREQUAL Release AND WIN32)
|
||||
ExternalProject_Add_Step(external_brotli after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/brotli/include ${HARVEST_TARGET}/brotli/include
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/brotli/lib/brotlidec-static${LIBEXT} ${HARVEST_TARGET}/brotli/lib/brotlidec-static${LIBEXT}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/brotli/lib/brotlicommon-static${LIBEXT} ${HARVEST_TARGET}/brotli/lib/brotlicommon-static${LIBEXT}
|
||||
DEPENDEES install
|
||||
)
|
||||
endif()
|
@@ -94,4 +94,3 @@ download_source(POTRACE)
|
||||
download_source(HARU)
|
||||
download_source(ZSTD)
|
||||
download_source(FLEX)
|
||||
download_source(BROTLI)
|
||||
|
@@ -23,12 +23,9 @@ set(FREETYPE_EXTRA_ARGS
|
||||
-DWITH_HarfBuzz=OFF
|
||||
-DFT_WITH_HARFBUZZ=OFF
|
||||
-DFT_WITH_BZIP2=OFF
|
||||
-DFT_WITH_BROTLI=ON
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE
|
||||
-DPC_BROTLIDEC_INCLUDEDIR=${LIBDIR}/brotli/include
|
||||
-DPC_BROTLIDEC_LIBDIR=${LIBDIR}/brotli/lib
|
||||
)
|
||||
-DCMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE)
|
||||
|
||||
ExternalProject_Add(external_freetype
|
||||
URL file://${PACKAGE_DIR}/${FREETYPE_FILE}
|
||||
@@ -39,11 +36,6 @@ ExternalProject_Add(external_freetype
|
||||
INSTALL_DIR ${LIBDIR}/freetype
|
||||
)
|
||||
|
||||
add_dependencies(
|
||||
external_freetype
|
||||
external_brotli
|
||||
)
|
||||
|
||||
if(BUILD_MODE STREQUAL Release AND WIN32)
|
||||
ExternalProject_Add_Step(external_freetype after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freetype ${HARVEST_TARGET}/freetype
|
||||
|
@@ -79,8 +79,6 @@ endfunction()
|
||||
harvest(alembic/include alembic/include "*.h")
|
||||
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
|
||||
harvest(alembic/bin alembic/bin "*")
|
||||
harvest(brotli/include brotli/include "*.h")
|
||||
harvest(brotli/lib brotli/lib "*.a")
|
||||
harvest(boost/include boost/include "*")
|
||||
harvest(boost/lib boost/lib "*.a")
|
||||
harvest(ffmpeg/include ffmpeg/include "*.h")
|
||||
|
@@ -83,9 +83,9 @@ else()
|
||||
set(OPENEXR_VERSION_POSTFIX)
|
||||
endif()
|
||||
|
||||
set(FREETYPE_VERSION 2.11.0)
|
||||
set(FREETYPE_VERSION 2.10.2)
|
||||
set(FREETYPE_URI http://prdownloads.sourceforge.net/freetype/freetype-${FREETYPE_VERSION}.tar.gz)
|
||||
set(FREETYPE_HASH cf09172322f6b50cf8f568bf8fe14bde)
|
||||
set(FREETYPE_HASH b1cb620e4c875cd4d1bfa04945400945)
|
||||
set(FREETYPE_HASH_TYPE MD5)
|
||||
set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
|
||||
|
||||
@@ -500,10 +500,3 @@ set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
|
||||
|
||||
set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git)
|
||||
set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
|
||||
|
||||
set(BROTLI_VERSION v1.0.9)
|
||||
set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/${BROTLI_VERSION}.tar.gz)
|
||||
set(BROTLI_HASH f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46)
|
||||
set(BROTLI_HASH_TYPE SHA256)
|
||||
set(BROTLI_FILE brotli-${BROTLI_VERSION}.tar.gz)
|
||||
|
||||
|
@@ -492,7 +492,7 @@ OIIO_SKIP=false
|
||||
LLVM_VERSION="12.0.0"
|
||||
LLVM_VERSION_SHORT="12.0"
|
||||
LLVM_VERSION_MIN="11.0"
|
||||
LLVM_VERSION_MEX="14.0"
|
||||
LLVM_VERSION_MEX="13.0"
|
||||
LLVM_VERSION_FOUND=""
|
||||
LLVM_FORCE_BUILD=false
|
||||
LLVM_FORCE_REBUILD=false
|
||||
@@ -3620,8 +3620,8 @@ compile_FFmpeg() {
|
||||
fi
|
||||
|
||||
./configure --cc="gcc -Wl,--as-needed" \
|
||||
--extra-ldflags="-pthread" \
|
||||
--prefix=$_inst --enable-shared \
|
||||
--extra-ldflags="-pthread -static-libgcc" \
|
||||
--prefix=$_inst --enable-static \
|
||||
--disable-ffplay --disable-doc \
|
||||
--enable-gray \
|
||||
--enable-avfilter --disable-vdpau \
|
||||
@@ -5721,6 +5721,76 @@ install_OTHER() {
|
||||
# ----------------------------------------------------------------------------
|
||||
# Printing User Info
|
||||
|
||||
print_info_ffmpeglink_DEB() {
|
||||
dpkg -L $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
|
||||
}
|
||||
|
||||
print_info_ffmpeglink_RPM() {
|
||||
rpm -ql $_packages | grep -e ".*\/lib[^\/]\+\.so" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
|
||||
}
|
||||
|
||||
print_info_ffmpeglink_ARCH() {
|
||||
pacman -Ql $_packages | grep -e ".*\/lib[^\/]\+\.so$" | gawk '{ printf(nlines ? "'"$_ffmpeg_list_sep"'%s" : "%s", gensub(/.*lib([^\/]+)\.so/, "\\1", "g", $0)); nlines++ }'
|
||||
}
|
||||
|
||||
print_info_ffmpeglink() {
|
||||
# This func must only print a ';'-separated list of libs...
|
||||
if [ -z "$DISTRO" ]; then
|
||||
ERROR "Failed to detect distribution type"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create list of packages from which to get libs names...
|
||||
_packages=""
|
||||
|
||||
if [ "$THEORA_USE" = true ]; then
|
||||
_packages="$_packages $THEORA_DEV"
|
||||
fi
|
||||
|
||||
if [ "$VORBIS_USE" = true ]; then
|
||||
_packages="$_packages $VORBIS_DEV"
|
||||
fi
|
||||
|
||||
if [ "$OGG_USE" = true ]; then
|
||||
_packages="$_packages $OGG_DEV"
|
||||
fi
|
||||
|
||||
if [ "$XVID_USE" = true ]; then
|
||||
_packages="$_packages $XVID_DEV"
|
||||
fi
|
||||
|
||||
if [ "$VPX_USE" = true ]; then
|
||||
_packages="$_packages $VPX_DEV"
|
||||
fi
|
||||
|
||||
if [ "$OPUS_USE" = true ]; then
|
||||
_packages="$_packages $OPUS_DEV"
|
||||
fi
|
||||
|
||||
if [ "$MP3LAME_USE" = true ]; then
|
||||
_packages="$_packages $MP3LAME_DEV"
|
||||
fi
|
||||
|
||||
if [ "$X264_USE" = true ]; then
|
||||
_packages="$_packages $X264_DEV"
|
||||
fi
|
||||
|
||||
if [ "$OPENJPEG_USE" = true ]; then
|
||||
_packages="$_packages $OPENJPEG_DEV"
|
||||
fi
|
||||
|
||||
if [ "$DISTRO" = "DEB" ]; then
|
||||
print_info_ffmpeglink_DEB
|
||||
elif [ "$DISTRO" = "RPM" ]; then
|
||||
print_info_ffmpeglink_RPM
|
||||
elif [ "$DISTRO" = "ARCH" ]; then
|
||||
print_info_ffmpeglink_ARCH
|
||||
# XXX TODO!
|
||||
else
|
||||
PRINT "<Could not determine additional link libraries needed for ffmpeg, replace this by valid list of libs...>"
|
||||
fi
|
||||
}
|
||||
|
||||
print_info() {
|
||||
PRINT ""
|
||||
PRINT ""
|
||||
@@ -5932,10 +6002,12 @@ print_info() {
|
||||
|
||||
if [ "$FFMPEG_SKIP" = false ]; then
|
||||
_1="-D WITH_CODEC_FFMPEG=ON"
|
||||
_2="-D FFMPEG_LIBRARIES='avformat;avcodec;avutil;avdevice;swscale;swresample;lzma;rt;`print_info_ffmpeglink`'"
|
||||
PRINT " $_1"
|
||||
_buildargs="$_buildargs $_1"
|
||||
PRINT " $_2"
|
||||
_buildargs="$_buildargs $_1 $_2"
|
||||
if [ -d $INST/ffmpeg ]; then
|
||||
_1="-D FFMPEG_ROOT_DIR=$INST/ffmpeg"
|
||||
_1="-D FFMPEG=$INST/ffmpeg"
|
||||
PRINT " $_1"
|
||||
_buildargs="$_buildargs $_1"
|
||||
fi
|
||||
|
@@ -33,8 +33,6 @@ if(NOT FFMPEG_FIND_COMPONENTS)
|
||||
avfilter
|
||||
avformat
|
||||
avutil
|
||||
swscale
|
||||
swresample
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -52,9 +50,9 @@ foreach(_component ${FFMPEG_FIND_COMPONENTS})
|
||||
string(TOUPPER ${_component} _upper_COMPONENT)
|
||||
find_library(FFMPEG_${_upper_COMPONENT}_LIBRARY
|
||||
NAMES
|
||||
${_component}
|
||||
${_upper_COMPONENT}
|
||||
HINTS
|
||||
${_ffmpeg_SEARCH_DIRS}
|
||||
${LIBDIR}/ffmpeg
|
||||
PATH_SUFFIXES
|
||||
lib64 lib
|
||||
)
|
||||
|
@@ -488,6 +488,7 @@ function(blender_add_test_executable
|
||||
|
||||
include_directories(${includes})
|
||||
include_directories(${includes_sys})
|
||||
setup_libdirs()
|
||||
|
||||
BLENDER_SRC_GTEST_EX(
|
||||
NAME ${name}
|
||||
@@ -524,6 +525,83 @@ function(setup_heavy_lib_pool)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(SETUP_LIBDIRS)
|
||||
|
||||
# NOTE: For all new libraries, use absolute library paths.
|
||||
# This should eventually be phased out.
|
||||
# APPLE platform uses full paths for linking libraries, and avoids link_directories.
|
||||
if(NOT MSVC AND NOT APPLE)
|
||||
link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
|
||||
|
||||
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
|
||||
link_directories(${PYTHON_LIBPATH})
|
||||
endif()
|
||||
if(WITH_SDL AND NOT WITH_SDL_DYNLOAD)
|
||||
link_directories(${SDL_LIBPATH})
|
||||
endif()
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
link_directories(${FFMPEG_LIBPATH})
|
||||
endif()
|
||||
if(WITH_IMAGE_OPENEXR)
|
||||
link_directories(${OPENEXR_LIBPATH})
|
||||
endif()
|
||||
if(WITH_IMAGE_TIFF)
|
||||
link_directories(${TIFF_LIBPATH})
|
||||
endif()
|
||||
if(WITH_BOOST)
|
||||
link_directories(${BOOST_LIBPATH})
|
||||
endif()
|
||||
if(WITH_OPENIMAGEIO)
|
||||
link_directories(${OPENIMAGEIO_LIBPATH})
|
||||
endif()
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
link_directories(${OPENIMAGEDENOISE_LIBPATH})
|
||||
endif()
|
||||
if(WITH_OPENCOLORIO)
|
||||
link_directories(${OPENCOLORIO_LIBPATH})
|
||||
endif()
|
||||
if(WITH_OPENVDB)
|
||||
link_directories(${OPENVDB_LIBPATH})
|
||||
endif()
|
||||
if(WITH_OPENAL)
|
||||
link_directories(${OPENAL_LIBPATH})
|
||||
endif()
|
||||
if(WITH_JACK AND NOT WITH_JACK_DYNLOAD)
|
||||
link_directories(${JACK_LIBPATH})
|
||||
endif()
|
||||
if(WITH_PULSEAUDIO AND NOT WITH_PULSEAUDIO_DYNLOAD)
|
||||
link_directories(${LIBPULSE_LIBPATH})
|
||||
endif()
|
||||
if(WITH_CODEC_SNDFILE)
|
||||
link_directories(${LIBSNDFILE_LIBPATH})
|
||||
endif()
|
||||
if(WITH_FFTW3)
|
||||
link_directories(${FFTW3_LIBPATH})
|
||||
endif()
|
||||
if(WITH_OPENCOLLADA)
|
||||
link_directories(${OPENCOLLADA_LIBPATH})
|
||||
# # Never set
|
||||
# link_directories(${PCRE_LIBPATH})
|
||||
# link_directories(${EXPAT_LIBPATH})
|
||||
endif()
|
||||
if(WITH_LLVM)
|
||||
link_directories(${LLVM_LIBPATH})
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
link_directories(${ALEMBIC_LIBPATH})
|
||||
endif()
|
||||
|
||||
if(WITH_GMP)
|
||||
link_directories(${GMP_LIBPATH})
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT UNIX)
|
||||
link_directories(${PTHREADS_LIBPATH})
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Platform specific linker flags for targets.
|
||||
function(setup_platform_linker_flags
|
||||
target)
|
||||
|
@@ -166,18 +166,13 @@ if(WITH_FFTW3)
|
||||
find_package(Fftw3)
|
||||
endif()
|
||||
|
||||
# FreeType compiled with Brotli compression for woff2.
|
||||
find_package(Freetype REQUIRED)
|
||||
list(APPEND FREETYPE_LIBRARIES
|
||||
${LIBDIR}/brotli/lib/libbrotlicommon-static.a
|
||||
${LIBDIR}/brotli/lib/libbrotlidec-static.a)
|
||||
|
||||
if(WITH_IMAGE_OPENEXR)
|
||||
find_package(OpenEXR)
|
||||
endif()
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
set(FFMPEG_ROOT_DIR ${LIBDIR}/ffmpeg)
|
||||
set(FFMPEG_FIND_COMPONENTS
|
||||
avcodec avdevice avformat avutil
|
||||
mp3lame ogg opus swresample swscale
|
||||
@@ -484,11 +479,8 @@ string(APPEND PLATFORM_LINKFLAGS " -stdlib=libc++")
|
||||
# Suppress ranlib "has no symbols" warnings (workaround for T48250)
|
||||
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
# llvm-ranlib doesn't support this flag. Xcode's libtool does.
|
||||
if(NOT ${CMAKE_RANLIB} MATCHES ".*llvm-ranlib$")
|
||||
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
endif()
|
||||
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
|
||||
if(WITH_COMPILER_CCACHE)
|
||||
if(NOT CMAKE_GENERATOR STREQUAL "Xcode")
|
||||
@@ -515,6 +507,3 @@ list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}")
|
||||
|
||||
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
|
||||
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../Resources/${BLENDER_VERSION}/lib")
|
||||
|
||||
# Same as `CFBundleIdentifier` in Info.plist.
|
||||
set(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.blenderfoundation.blender")
|
||||
|
@@ -178,30 +178,26 @@ endif()
|
||||
|
||||
if(WITH_CODEC_FFMPEG)
|
||||
if(EXISTS ${LIBDIR})
|
||||
set(FFMPEG_ROOT_DIR ${LIBDIR}/ffmpeg)
|
||||
# Override FFMPEG components to also include static library dependencies
|
||||
# included with precompiled libraries, and to ensure correct link order.
|
||||
set(FFMPEG_FIND_COMPONENTS
|
||||
avformat avcodec avdevice avutil swresample swscale
|
||||
sndfile
|
||||
FLAC
|
||||
mp3lame
|
||||
opus
|
||||
theora theoradec theoraenc
|
||||
vorbis vorbisenc vorbisfile ogg
|
||||
vpx
|
||||
x264
|
||||
xvidcore)
|
||||
elseif(FFMPEG)
|
||||
# Old cache variable used for root dir, convert to new standard.
|
||||
set(FFMPEG_ROOT_DIR ${FFMPEG})
|
||||
# For precompiled lib directory, all ffmpeg dependencies are in the same folder
|
||||
file(GLOB ffmpeg_libs ${LIBDIR}/ffmpeg/lib/*.a ${LIBDIR}/sndfile/lib/*.a)
|
||||
set(FFMPEG ${LIBDIR}/ffmpeg CACHE PATH "FFMPEG Directory")
|
||||
set(FFMPEG_LIBRARIES ${ffmpeg_libs} ${ffmpeg_libs} CACHE STRING "FFMPEG Libraries")
|
||||
else()
|
||||
set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
|
||||
set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
|
||||
endif()
|
||||
find_package(FFmpeg)
|
||||
|
||||
if(NOT FFMPEG_FOUND)
|
||||
set(WITH_CODEC_FFMPEG OFF)
|
||||
message(STATUS "FFmpeg not found, disabling it")
|
||||
mark_as_advanced(FFMPEG)
|
||||
|
||||
# lame, but until we have proper find module for ffmpeg
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
|
||||
if(EXISTS "${FFMPEG}/include/ffmpeg/")
|
||||
list(APPEND FFMPEG_INCLUDE_DIRS "${FFMPEG}/include/ffmpeg")
|
||||
endif()
|
||||
# end lameness
|
||||
|
||||
mark_as_advanced(FFMPEG_LIBRARIES)
|
||||
set(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||
endif()
|
||||
|
||||
if(WITH_FFTW3)
|
||||
@@ -648,9 +644,6 @@ endif()
|
||||
# ----------------------------------------------------------------------------
|
||||
# Compilers
|
||||
|
||||
# Only set the linker once.
|
||||
set(_IS_LINKER_DEFAULT ON)
|
||||
|
||||
# GNU Compiler
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
# ffp-contract=off:
|
||||
@@ -669,89 +662,26 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
string(PREPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO "${GCC_EXTRA_FLAGS_RELEASE} ")
|
||||
unset(GCC_EXTRA_FLAGS_RELEASE)
|
||||
|
||||
# NOTE(@campbellbarton): Eventually mold will be able to use `-fuse-ld=mold`,
|
||||
# however at the moment this only works for GCC 12.1+ (unreleased at time of writing).
|
||||
# So a workaround is used here "-B" which points to another path to find system commands
|
||||
# such as `ld`.
|
||||
if(WITH_LINKER_MOLD AND _IS_LINKER_DEFAULT)
|
||||
find_program(MOLD_BIN "mold")
|
||||
mark_as_advanced(MOLD_BIN)
|
||||
if(NOT MOLD_BIN)
|
||||
message(STATUS "The \"mold\" binary could not be found, using system linker.")
|
||||
set(WITH_LINKER_MOLD OFF)
|
||||
else()
|
||||
# By default mold installs the binary to:
|
||||
# - `{PREFIX}/bin/mold` as well as a symbolic-link in...
|
||||
# - `{PREFIX}/lib/mold/ld`.
|
||||
# (where `PREFIX` is typically `/usr/`).
|
||||
#
|
||||
# This block of code finds `{PREFIX}/lib/mold` from the `mold` binary.
|
||||
# Other methods of searching for the path could also be made to work,
|
||||
# we could even make our own directory and symbolic-link, however it's more
|
||||
# convenient to use the one provided by mold.
|
||||
#
|
||||
# Use the binary path to "mold", to find the common prefix which contains "lib/mold".
|
||||
# The parent directory: e.g. `/usr/bin/mold` -> `/usr/bin/`.
|
||||
get_filename_component(MOLD_PREFIX "${MOLD_BIN}" DIRECTORY)
|
||||
# The common prefix path: e.g. `/usr/bin/` -> `/usr/` to use as a hint.
|
||||
get_filename_component(MOLD_PREFIX "${MOLD_PREFIX}" DIRECTORY)
|
||||
# Find `{PREFIX}/lib/mold/ld`, store the directory component (without the `ld`).
|
||||
# Then pass `-B {PREFIX}/lib/mold` to GCC so the `ld` located there overrides the default.
|
||||
find_path(
|
||||
MOLD_BIN_DIR "ld"
|
||||
HINTS "${MOLD_PREFIX}"
|
||||
# The default path is `libexec`, Arch Linux for e.g.
|
||||
# replaces this with `lib` so check both.
|
||||
PATH_SUFFIXES "libexec/mold" "lib/mold" "lib64/mold"
|
||||
NO_DEFAULT_PATH
|
||||
NO_CACHE
|
||||
)
|
||||
if(NOT MOLD_BIN_DIR)
|
||||
message(STATUS
|
||||
"The mold linker could not find the directory containing the linker command "
|
||||
"(typically "
|
||||
"\"${MOLD_PREFIX}/libexec/mold/ld\") or "
|
||||
"\"${MOLD_PREFIX}/lib/mold/ld\") using system linker.")
|
||||
set(WITH_LINKER_MOLD OFF)
|
||||
endif()
|
||||
unset(MOLD_PREFIX)
|
||||
endif()
|
||||
|
||||
if(WITH_LINKER_MOLD)
|
||||
# GCC will search for `ld` in this directory first.
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -B \"${MOLD_BIN_DIR}\"")
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -B \"${MOLD_BIN_DIR}\"")
|
||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS " -B \"${MOLD_BIN_DIR}\"")
|
||||
set(_IS_LINKER_DEFAULT OFF)
|
||||
endif()
|
||||
unset(MOLD_BIN)
|
||||
unset(MOLD_BIN_DIR)
|
||||
endif()
|
||||
|
||||
if(WITH_LINKER_GOLD AND _IS_LINKER_DEFAULT)
|
||||
if(WITH_LINKER_GOLD)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version
|
||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||
if("${LD_VERSION}" MATCHES "GNU gold")
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -fuse-ld=gold")
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -fuse-ld=gold")
|
||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS " -fuse-ld=gold")
|
||||
set(_IS_LINKER_DEFAULT OFF)
|
||||
string(APPEND CMAKE_C_FLAGS " -fuse-ld=gold")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -fuse-ld=gold")
|
||||
else()
|
||||
message(STATUS "GNU gold linker isn't available, using the default system linker.")
|
||||
endif()
|
||||
unset(LD_VERSION)
|
||||
endif()
|
||||
|
||||
if(WITH_LINKER_LLD AND _IS_LINKER_DEFAULT)
|
||||
if(WITH_LINKER_LLD)
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -fuse-ld=lld -Wl,--version
|
||||
ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||
if("${LD_VERSION}" MATCHES "LLD")
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -fuse-ld=lld")
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -fuse-ld=lld")
|
||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS " -fuse-ld=lld")
|
||||
set(_IS_LINKER_DEFAULT OFF)
|
||||
string(APPEND CMAKE_C_FLAGS " -fuse-ld=lld")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -fuse-ld=lld")
|
||||
else()
|
||||
message(STATUS "LLD linker isn't available, using the default system linker.")
|
||||
endif()
|
||||
@@ -761,28 +691,6 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
||||
# CLang is the same as GCC for now.
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||
|
||||
if(WITH_LINKER_MOLD AND _IS_LINKER_DEFAULT)
|
||||
find_program(MOLD_BIN "mold")
|
||||
mark_as_advanced(MOLD_BIN)
|
||||
if(NOT MOLD_BIN)
|
||||
message(STATUS "The \"mold\" binary could not be found, using system linker.")
|
||||
set(WITH_LINKER_MOLD OFF)
|
||||
else()
|
||||
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0)
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " --ld-path=\"${MOLD_BIN}\"")
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS " --ld-path=\"${MOLD_BIN}\"")
|
||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS " --ld-path=\"${MOLD_BIN}\"")
|
||||
else()
|
||||
string(APPEND CMAKE_EXE_LINKER_FLAGS " -fuse-ld=\"${MOLD_BIN}\"")
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS " -fuse-ld=\"${MOLD_BIN}\"")
|
||||
string(APPEND CMAKE_MODULE_LINKER_FLAGS " -fuse-ld=\"${MOLD_BIN}\"")
|
||||
endif()
|
||||
set(_IS_LINKER_DEFAULT OFF)
|
||||
endif()
|
||||
unset(MOLD_BIN)
|
||||
endif()
|
||||
|
||||
# Intel C++ Compiler
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
# think these next two are broken
|
||||
@@ -806,8 +714,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
||||
string(APPEND PLATFORM_LINKFLAGS " -static-intel")
|
||||
endif()
|
||||
|
||||
unset(_IS_LINKER_DEFAULT)
|
||||
|
||||
# Avoid conflicts with Mesa llvmpipe, Luxrender, and other plug-ins that may
|
||||
# use the same libraries as Blender with a different version or build options.
|
||||
set(PLATFORM_LINKFLAGS
|
||||
|
@@ -347,11 +347,7 @@ set(FREETYPE_INCLUDE_DIRS
|
||||
${LIBDIR}/freetype/include
|
||||
${LIBDIR}/freetype/include/freetype2
|
||||
)
|
||||
set(FREETYPE_LIBRARIES
|
||||
${LIBDIR}/freetype/lib/freetype2ST.lib
|
||||
${LIBDIR}/brotli/lib/brotlidec-static.lib
|
||||
${LIBDIR}/brotli/lib/brotlicommon-static.lib
|
||||
)
|
||||
set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
|
||||
windows_find_package(freetype REQUIRED)
|
||||
|
||||
if(WITH_FFTW3)
|
||||
|
@@ -8,42 +8,27 @@ def set_pose_matrices(obj, matrix_map):
|
||||
"Assign pose space matrices of all bones at once, ignoring constraints."
|
||||
|
||||
def rec(pbone, parent_matrix):
|
||||
if pbone.name in matrix_map:
|
||||
matrix = matrix_map[pbone.name]
|
||||
matrix = matrix_map[pbone.name]
|
||||
|
||||
## Instead of:
|
||||
# pbone.matrix = matrix
|
||||
# bpy.context.view_layer.update()
|
||||
## Instead of:
|
||||
# pbone.matrix = matrix
|
||||
# bpy.context.view_layer.update()
|
||||
|
||||
# Compute and assign local matrix, using the new parent matrix
|
||||
if pbone.parent:
|
||||
pbone.matrix_basis = pbone.bone.convert_local_to_pose(
|
||||
matrix,
|
||||
pbone.bone.matrix_local,
|
||||
parent_matrix=parent_matrix,
|
||||
parent_matrix_local=pbone.parent.bone.matrix_local,
|
||||
invert=True
|
||||
)
|
||||
else:
|
||||
pbone.matrix_basis = pbone.bone.convert_local_to_pose(
|
||||
matrix,
|
||||
pbone.bone.matrix_local,
|
||||
invert=True
|
||||
)
|
||||
# Compute and assign local matrix, using the new parent matrix
|
||||
if pbone.parent:
|
||||
pbone.matrix_basis = pbone.bone.convert_local_to_pose(
|
||||
matrix,
|
||||
pbone.bone.matrix_local,
|
||||
parent_matrix=parent_matrix,
|
||||
parent_matrix_local=pbone.parent.bone.matrix_local,
|
||||
invert=True
|
||||
)
|
||||
else:
|
||||
# Compute the updated pose matrix from local and new parent matrix
|
||||
if pbone.parent:
|
||||
matrix = pbone.bone.convert_local_to_pose(
|
||||
pbone.matrix_basis,
|
||||
pbone.bone.matrix_local,
|
||||
parent_matrix=parent_matrix,
|
||||
parent_matrix_local=pbone.parent.bone.matrix_local,
|
||||
)
|
||||
else:
|
||||
matrix = pbone.bone.convert_local_to_pose(
|
||||
pbone.matrix_basis,
|
||||
pbone.bone.matrix_local,
|
||||
)
|
||||
pbone.matrix_basis = pbone.bone.convert_local_to_pose(
|
||||
matrix,
|
||||
pbone.bone.matrix_local,
|
||||
invert=True
|
||||
)
|
||||
|
||||
# Recursively process children, passing the new matrix through
|
||||
for child in pbone.children:
|
||||
|
@@ -1762,7 +1762,6 @@ except ModuleNotFoundError:
|
||||
fw("html_show_sphinx = False\n")
|
||||
fw("html_baseurl = 'https://docs.blender.org/api/current/'\n")
|
||||
fw("html_use_opensearch = 'https://docs.blender.org/api/current'\n")
|
||||
fw("html_show_search_summary = True\n")
|
||||
fw("html_split_index = True\n")
|
||||
fw("html_static_path = ['static']\n")
|
||||
fw("html_extra_path = ['static/favicon.ico', 'static/blender_logo.svg']\n")
|
||||
|
6
extern/audaspace/CMakeLists.txt
vendored
6
extern/audaspace/CMakeLists.txt
vendored
@@ -1092,12 +1092,12 @@ if(WITH_PYTHON)
|
||||
configure_file(${PYTHON_SOURCE_DIRECTORY}/setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py ESCAPE_QUOTES @ONLY)
|
||||
|
||||
if(APPLE)
|
||||
add_custom_command(OUTPUT build COMMAND MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} ${PYTHON_EXECUTABLE} setup.py build DEPENDS ${PYTHON_SRC} ${PYTHON_HDR} setup.py)
|
||||
add_custom_command(OUTPUT build COMMAND MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} ${PYTHON_EXECUTABLE} setup.py build DEPENDS ${PYTHON_SRC} ${PYTHON_HDR})
|
||||
elseif(WIN32)
|
||||
set(ENV{VS100COMNTOOLS} $ENV{VS120COMNTOOLS})
|
||||
add_custom_command(OUTPUT build COMMAND ${PYTHON_EXECUTABLE} setup.py build DEPENDS ${PYTHON_SRC} ${PYTHON_HDR} setup.py)
|
||||
add_custom_command(OUTPUT build COMMAND ${PYTHON_EXECUTABLE} setup.py build DEPENDS ${PYTHON_SRC} ${PYTHON_HDR})
|
||||
else()
|
||||
add_custom_command(OUTPUT build COMMAND ${PYTHON_EXECUTABLE} setup.py build DEPENDS ${PYTHON_SRC} ${PYTHON_HDR} setup.py)
|
||||
add_custom_command(OUTPUT build COMMAND ${PYTHON_EXECUTABLE} setup.py build DEPENDS ${PYTHON_SRC} ${PYTHON_HDR})
|
||||
endif()
|
||||
add_custom_target(pythonmodule ALL DEPENDS build SOURCES ${PYTHON_SOURCE_DIRECTORY}/setup.py.in ${PYTHON_SRC} ${PYTHON_HDR})
|
||||
add_dependencies(pythonmodule audaspace)
|
||||
|
27
extern/audaspace/bindings/python/setup.py.in
vendored
27
extern/audaspace/bindings/python/setup.py.in
vendored
@@ -8,20 +8,20 @@ import numpy
|
||||
from distutils.core import setup, Extension
|
||||
|
||||
if len(sys.argv) > 2 and sys.argv[1] == '--build-docs':
|
||||
import subprocess
|
||||
from distutils.core import Distribution
|
||||
from distutils.command.build import build
|
||||
import subprocess
|
||||
from distutils.core import Distribution
|
||||
from distutils.command.build import build
|
||||
|
||||
dist = Distribution()
|
||||
cmd = build(dist)
|
||||
cmd.finalize_options()
|
||||
#print(cmd.build_platlib)
|
||||
dist = Distribution()
|
||||
cmd = build(dist)
|
||||
cmd.finalize_options()
|
||||
#print(cmd.build_platlib)
|
||||
|
||||
os.environ['PYTHONPATH'] = os.path.join(os.getcwd(), cmd.build_platlib)
|
||||
os.environ['LD_LIBRARY_PATH'] = os.getcwd()
|
||||
os.environ['PYTHONPATH'] = os.path.join(os.getcwd(), cmd.build_platlib)
|
||||
os.environ['LD_LIBRARY_PATH'] = os.getcwd()
|
||||
|
||||
ret = subprocess.call(sys.argv[2:])
|
||||
sys.exit(ret)
|
||||
ret = subprocess.call(sys.argv[2:])
|
||||
sys.exit(ret)
|
||||
|
||||
|
||||
# the following line is not working due to https://bugs.python.org/issue9023
|
||||
@@ -43,8 +43,7 @@ audaspace = Extension(
|
||||
library_dirs = ['.', 'Release', 'Debug'],
|
||||
language = 'c++',
|
||||
extra_compile_args = extra_args,
|
||||
define_macros = [('WITH_CONVOLUTION', None)] if '@WITH_FFTW@' == 'ON' else [],
|
||||
sources = [os.path.join(source_directory, file) for file in ['PyAPI.cpp', 'PyDevice.cpp', 'PyHandle.cpp', 'PySound.cpp', 'PySequenceEntry.cpp', 'PySequence.cpp', 'PyPlaybackManager.cpp', 'PyDynamicMusic.cpp', 'PyThreadPool.cpp', 'PySource.cpp'] + (['PyImpulseResponse.cpp', 'PyHRTF.cpp'] if '@WITH_FFTW@' == 'ON' else [])]
|
||||
sources = [os.path.join(source_directory, file) for file in ['PyAPI.cpp', 'PyDevice.cpp', 'PyHandle.cpp', 'PySound.cpp', 'PySequenceEntry.cpp', 'PySequence.cpp', 'PyPlaybackManager.cpp', 'PyDynamicMusic.cpp', 'PyThreadPool.cpp', 'PySource.cpp'] + (['PyImpulseResponse.cpp', 'PyHRTF.cpp'] if '@WITH_FFTW@' == 'ON' else [])]
|
||||
)
|
||||
|
||||
setup(
|
||||
@@ -57,6 +56,6 @@ setup(
|
||||
license = 'Apache License 2.0',
|
||||
long_description = codecs.open(os.path.join(source_directory, '../../README.md'), 'r', 'utf-8').read(),
|
||||
ext_modules = [audaspace],
|
||||
headers = [os.path.join(source_directory, file) for file in ['PyAPI.h', 'PyDevice.h', 'PyHandle.h', 'PySound.h', 'PySequenceEntry.h', 'PySequence.h', 'PyPlaybackManager.h', 'PyDynamicMusic.h', 'PyThreadPool.h', 'PySource.h'] + (['PyImpulseResponse.h', 'PyHRTF.h'] if '@WITH_FFTW@' == 'ON' else [])] + ['Audaspace.h']
|
||||
headers = [os.path.join(source_directory, file) for file in ['PyAPI.h', 'PyDevice.h', 'PyHandle.h', 'PySound.h', 'PySequenceEntry.h', 'PySequence.h', 'PyPlaybackManager.h', 'PyDynamicMusic.h', 'PyThreadPool.h', 'PySource.h'] + (['PyImpulseResponse.h', 'PyHRTF.h'] if '@WITH_FFTW@' == 'ON' else [])] + ['Audaspace.h']
|
||||
)
|
||||
|
||||
|
80
extern/audaspace/plugins/wasapi/WASAPIDevice.cpp
vendored
80
extern/audaspace/plugins/wasapi/WASAPIDevice.cpp
vendored
@@ -95,13 +95,6 @@ void WASAPIDevice::runMixingThread()
|
||||
sleep_duration = std::chrono::milliseconds(buffer_size * 1000 / int(m_specs.rate) / 2);
|
||||
}
|
||||
|
||||
if(m_default_device_changed)
|
||||
{
|
||||
m_default_device_changed = false;
|
||||
result = AUDCLNT_E_DEVICE_INVALIDATED;
|
||||
goto stop_thread;
|
||||
}
|
||||
|
||||
if(FAILED(result = m_audio_client->GetCurrentPadding(&padding)))
|
||||
goto stop_thread;
|
||||
|
||||
@@ -303,78 +296,13 @@ bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
|
||||
return true;
|
||||
}
|
||||
|
||||
ULONG WASAPIDevice::AddRef()
|
||||
{
|
||||
return InterlockedIncrement(&m_reference_count);
|
||||
}
|
||||
|
||||
ULONG WASAPIDevice::Release()
|
||||
{
|
||||
ULONG reference_count = InterlockedDecrement(&m_reference_count);
|
||||
|
||||
if(0 == reference_count)
|
||||
delete this;
|
||||
|
||||
return reference_count;
|
||||
}
|
||||
|
||||
HRESULT WASAPIDevice::QueryInterface(REFIID riid, void **ppvObject)
|
||||
{
|
||||
if(riid == __uuidof(IMMNotificationClient))
|
||||
{
|
||||
*ppvObject = reinterpret_cast<IMMNotificationClient*>(this);
|
||||
AddRef();
|
||||
}
|
||||
else if(riid == IID_IUnknown)
|
||||
{
|
||||
*ppvObject = reinterpret_cast<IUnknown*>(this);
|
||||
AddRef();
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppvObject = nullptr;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WASAPIDevice::OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WASAPIDevice::OnDeviceAdded(LPCWSTR pwstrDeviceId)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WASAPIDevice::OnDeviceRemoved(LPCWSTR pwstrDeviceId)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WASAPIDevice::OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId)
|
||||
{
|
||||
if(flow != EDataFlow::eCapture)
|
||||
m_default_device_changed = true;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WASAPIDevice::OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
|
||||
m_buffersize(buffersize),
|
||||
m_imm_device_enumerator(nullptr),
|
||||
m_imm_device(nullptr),
|
||||
m_audio_client(nullptr),
|
||||
m_wave_format_extensible({}),
|
||||
m_default_device_changed(false),
|
||||
m_reference_count(1)
|
||||
|
||||
m_wave_format_extensible({})
|
||||
{
|
||||
// initialize COM if it hasn't happened yet
|
||||
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
@@ -399,8 +327,6 @@ WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
|
||||
|
||||
create();
|
||||
|
||||
m_imm_device_enumerator->RegisterEndpointNotificationCallback(this);
|
||||
|
||||
return;
|
||||
|
||||
error:
|
||||
@@ -414,8 +340,6 @@ WASAPIDevice::~WASAPIDevice()
|
||||
{
|
||||
stopMixingThread();
|
||||
|
||||
m_imm_device_enumerator->UnregisterEndpointNotificationCallback(this);
|
||||
|
||||
SafeRelease(&m_audio_client);
|
||||
SafeRelease(&m_imm_device);
|
||||
SafeRelease(&m_imm_device_enumerator);
|
||||
|
15
extern/audaspace/plugins/wasapi/WASAPIDevice.h
vendored
15
extern/audaspace/plugins/wasapi/WASAPIDevice.h
vendored
@@ -40,7 +40,7 @@ AUD_NAMESPACE_BEGIN
|
||||
/**
|
||||
* This device plays back through WASAPI, the Windows audio API.
|
||||
*/
|
||||
class AUD_PLUGIN_API WASAPIDevice : IMMNotificationClient, public ThreadedDevice
|
||||
class AUD_PLUGIN_API WASAPIDevice : public ThreadedDevice
|
||||
{
|
||||
private:
|
||||
int m_buffersize;
|
||||
@@ -48,8 +48,6 @@ private:
|
||||
IMMDevice* m_imm_device;
|
||||
IAudioClient* m_audio_client;
|
||||
WAVEFORMATEXTENSIBLE m_wave_format_extensible;
|
||||
bool m_default_device_changed;
|
||||
LONG m_reference_count;
|
||||
|
||||
AUD_LOCAL HRESULT setupRenderClient(IAudioRenderClient*& render_client, UINT32& buffer_size);
|
||||
|
||||
@@ -60,17 +58,6 @@ private:
|
||||
|
||||
AUD_LOCAL bool setupDevice(DeviceSpecs& specs);
|
||||
|
||||
// IUnknown implementation
|
||||
ULONG STDMETHODCALLTYPE AddRef();
|
||||
ULONG STDMETHODCALLTYPE Release();
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
|
||||
// IMMNotificationClient implementation
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState);
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR pwstrDeviceId);
|
||||
HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR pwstrDeviceId);
|
||||
HRESULT STDMETHODCALLTYPE OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId);
|
||||
HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key);
|
||||
|
||||
// delete copy constructor and operator=
|
||||
WASAPIDevice(const WASAPIDevice&) = delete;
|
||||
WASAPIDevice& operator=(const WASAPIDevice&) = delete;
|
||||
|
@@ -51,6 +51,8 @@ list(APPEND LIBRARIES ${CYCLES_GL_LIBRARIES})
|
||||
|
||||
# Common configuration.
|
||||
|
||||
cycles_link_directories()
|
||||
|
||||
add_definitions(${GL_DEFINITIONS})
|
||||
|
||||
include_directories(${INC})
|
||||
|
@@ -119,6 +119,12 @@ def use_optix(context):
|
||||
return (get_device_type(context) == 'OPTIX' and cscene.device == 'GPU')
|
||||
|
||||
|
||||
def use_sample_all_lights(context):
|
||||
cscene = context.scene.cycles
|
||||
|
||||
return cscene.sample_all_lights_direct or cscene.sample_all_lights_indirect
|
||||
|
||||
|
||||
def show_device_active(context):
|
||||
cscene = context.scene.cycles
|
||||
if cscene.device != 'GPU':
|
||||
@@ -1797,45 +1803,18 @@ class CYCLES_RENDER_PT_bake_output(CyclesButtonsPanel, Panel):
|
||||
rd = scene.render
|
||||
|
||||
if rd.use_bake_multires:
|
||||
layout.prop(rd, "bake_margin")
|
||||
layout.prop(rd, "use_bake_clear", text="Clear Image")
|
||||
|
||||
if rd.bake_type == 'DISPLACEMENT':
|
||||
layout.prop(rd, "use_bake_lores_mesh")
|
||||
else:
|
||||
layout.prop(cbk, "target")
|
||||
|
||||
if cbk.target == 'IMAGE_TEXTURES':
|
||||
layout.prop(cbk, "margin")
|
||||
layout.prop(cbk, "use_clear", text="Clear Image")
|
||||
|
||||
class CYCLES_RENDER_PT_bake_output_margin(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Margin"
|
||||
bl_context = "render"
|
||||
bl_parent_id = "CYCLES_RENDER_PT_bake_output"
|
||||
COMPAT_ENGINES = {'CYCLES'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
scene = context.scene
|
||||
cbk = scene.render.bake
|
||||
return cbk.target == 'IMAGE_TEXTURES'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False # No animation.
|
||||
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
cbk = scene.render.bake
|
||||
rd = scene.render
|
||||
|
||||
if rd.use_bake_multires:
|
||||
layout.prop(rd, "bake_margin_type", text="Type")
|
||||
layout.prop(rd, "bake_margin", text="Size")
|
||||
else:
|
||||
if cbk.target == 'IMAGE_TEXTURES':
|
||||
layout.prop(cbk, "margin_type", text="Type")
|
||||
layout.prop(cbk, "margin", text="Size")
|
||||
|
||||
|
||||
|
||||
class CYCLES_RENDER_PT_debug(CyclesDebugButtonsPanel, Panel):
|
||||
bl_label = "Debug"
|
||||
@@ -2204,7 +2183,6 @@ classes = (
|
||||
CYCLES_RENDER_PT_bake_influence,
|
||||
CYCLES_RENDER_PT_bake_selected_to_active,
|
||||
CYCLES_RENDER_PT_bake_output,
|
||||
CYCLES_RENDER_PT_bake_output_margin,
|
||||
CYCLES_RENDER_PT_debug,
|
||||
node_panel(CYCLES_MATERIAL_PT_settings),
|
||||
node_panel(CYCLES_MATERIAL_PT_settings_surface),
|
||||
|
@@ -1071,15 +1071,7 @@ static void create_subd_mesh(Scene *scene,
|
||||
|
||||
for (BL::MeshEdge &e : b_mesh.edges) {
|
||||
if (e.crease() != 0.0f) {
|
||||
mesh->add_edge_crease(e.vertices()[0], e.vertices()[1], e.crease());
|
||||
}
|
||||
}
|
||||
|
||||
for (BL::MeshVertexCreaseLayer &c : b_mesh.vertex_creases) {
|
||||
for (int i = 0; i < c.data.length(); ++i) {
|
||||
if (c.data[i].value() != 0.0f) {
|
||||
mesh->add_vertex_crease(i, c.data[i].value());
|
||||
}
|
||||
mesh->add_crease(e.vertices()[0], e.vertices()[1], e.crease());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -529,17 +529,6 @@ void BlenderSync::sync_procedural(BL::Object &b_ob,
|
||||
string absolute_path = blender_absolute_path(b_data, b_ob, b_mesh_cache.cache_file().filepath());
|
||||
procedural->set_filepath(ustring(absolute_path));
|
||||
|
||||
array<ustring> layers;
|
||||
for (BL::CacheFileLayer &layer : cache_file.layers) {
|
||||
if (layer.hide_layer()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
absolute_path = blender_absolute_path(b_data, b_ob, layer.filepath());
|
||||
layers.push_back_slow(ustring(absolute_path));
|
||||
}
|
||||
procedural->set_layers(layers);
|
||||
|
||||
procedural->set_scale(cache_file.scale());
|
||||
|
||||
procedural->set_use_prefetch(cache_file.use_prefetch());
|
||||
|
@@ -51,7 +51,7 @@ bool BlenderOutputDriver::read_render_tile(const Tile &tile)
|
||||
|
||||
BL::RenderLayer b_rlay = *b_single_rlay;
|
||||
|
||||
vector<float> pixels(static_cast<size_t>(tile.size.x) * tile.size.y * 4);
|
||||
vector<float> pixels(tile.size.x * tile.size.y * 4);
|
||||
|
||||
/* Copy each pass.
|
||||
* TODO:copy only the required ones for better performance? */
|
||||
@@ -109,7 +109,7 @@ void BlenderOutputDriver::write_render_tile(const Tile &tile)
|
||||
|
||||
BL::RenderLayer b_rlay = *b_single_rlay;
|
||||
|
||||
vector<float> pixels(static_cast<size_t>(tile.size.x) * tile.size.y * 4);
|
||||
vector<float> pixels(tile.size.x * tile.size.y * 4);
|
||||
|
||||
/* Copy each pass. */
|
||||
for (BL::RenderPass &b_pass : b_rlay.passes) {
|
||||
|
@@ -935,7 +935,7 @@ BVHNode *BVHBuild::create_object_leaf_nodes(const BVHReference *ref, int start,
|
||||
|
||||
BVHNode *BVHBuild::create_leaf_node(const BVHRange &range, const vector<BVHReference> &references)
|
||||
{
|
||||
/* This is a bit over-allocating here (considering leaf size into account),
|
||||
/* This is a bit overallocating here (considering leaf size into account),
|
||||
* but chunk-based re-allocation in vector makes it difficult to use small
|
||||
* size of stack storage here. Some tweaks are possible tho.
|
||||
*
|
||||
|
@@ -84,6 +84,39 @@ macro(cycles_add_library target library_deps)
|
||||
cycles_set_solution_folder(${target})
|
||||
endmacro()
|
||||
|
||||
# Cycles library dependencies common to all executables
|
||||
|
||||
function(cycles_link_directories)
|
||||
if(APPLE)
|
||||
# APPLE platform uses full paths for linking libraries, and avoids link_directories.
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCOLORIO)
|
||||
link_directories(${OPENCOLORIO_LIBPATH})
|
||||
endif()
|
||||
if(WITH_OPENVDB)
|
||||
link_directories(${OPENVDB_LIBPATH} ${BLOSC_LIBPATH})
|
||||
endif()
|
||||
if(WITH_OPENSUBDIV)
|
||||
link_directories(${OPENSUBDIV_LIBPATH})
|
||||
endif()
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
link_directories(${OPENIMAGEDENOISE_LIBPATH})
|
||||
endif()
|
||||
|
||||
link_directories(
|
||||
${OPENIMAGEIO_LIBPATH}
|
||||
${BOOST_LIBPATH}
|
||||
${PNG_LIBPATH}
|
||||
${JPEG_LIBPATH}
|
||||
${ZLIB_LIBPATH}
|
||||
${TIFF_LIBPATH}
|
||||
${OPENEXR_LIBPATH}
|
||||
${OPENJPEG_LIBPATH}
|
||||
)
|
||||
endfunction()
|
||||
|
||||
macro(cycles_target_link_libraries target)
|
||||
if(WITH_CYCLES_LOGGING)
|
||||
target_link_libraries(${target} ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES})
|
||||
|
@@ -72,7 +72,7 @@ CPUDevice::CPUDevice(const DeviceInfo &info_, Stats &stats_, Profiler &profiler_
|
||||
<< " CPU kernels.";
|
||||
|
||||
if (info.cpu_threads == 0) {
|
||||
info.cpu_threads = TaskScheduler::max_concurrency();
|
||||
info.cpu_threads = TaskScheduler::num_threads();
|
||||
}
|
||||
|
||||
#ifdef WITH_OSL
|
||||
|
@@ -334,7 +334,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
|
||||
/* Ensure CPU device does not slow down GPU. */
|
||||
if (device.type == DEVICE_CPU && subdevices.size() > 1) {
|
||||
if (background) {
|
||||
int orig_cpu_threads = (threads) ? threads : TaskScheduler::max_concurrency();
|
||||
int orig_cpu_threads = (threads) ? threads : TaskScheduler::num_threads();
|
||||
int cpu_threads = max(orig_cpu_threads - (subdevices.size() - 1), 0);
|
||||
|
||||
VLOG(1) << "CPU render threads reduced from " << orig_cpu_threads << " to " << cpu_threads
|
||||
|
@@ -58,11 +58,6 @@ class BVHMetal : public BVH {
|
||||
id<MTLCommandQueue> queue,
|
||||
Geometry *const geom,
|
||||
bool refit);
|
||||
bool build_BLAS_pointcloud(Progress &progress,
|
||||
id<MTLDevice> device,
|
||||
id<MTLCommandQueue> queue,
|
||||
Geometry *const geom,
|
||||
bool refit);
|
||||
bool build_TLAS(Progress &progress, id<MTLDevice> device, id<MTLCommandQueue> queue, bool refit);
|
||||
};
|
||||
|
||||
|
@@ -19,7 +19,6 @@
|
||||
# include "scene/hair.h"
|
||||
# include "scene/mesh.h"
|
||||
# include "scene/object.h"
|
||||
# include "scene/pointcloud.h"
|
||||
|
||||
# include "util/progress.h"
|
||||
|
||||
@@ -476,220 +475,6 @@ bool BVHMetal::build_BLAS_hair(Progress &progress,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BVHMetal::build_BLAS_pointcloud(Progress &progress,
|
||||
id<MTLDevice> device,
|
||||
id<MTLCommandQueue> queue,
|
||||
Geometry *const geom,
|
||||
bool refit)
|
||||
{
|
||||
if (@available(macos 12.0, *)) {
|
||||
/* Build BLAS for point cloud */
|
||||
PointCloud *pointcloud = static_cast<PointCloud *>(geom);
|
||||
if (pointcloud->num_points() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*------------------------------------------------*/
|
||||
BVH_status("Building pointcloud BLAS | %7d points | %s",
|
||||
(int)pointcloud->num_points(),
|
||||
geom->name.c_str());
|
||||
/*------------------------------------------------*/
|
||||
|
||||
const size_t num_points = pointcloud->get_points().size();
|
||||
const float3 *points = pointcloud->get_points().data();
|
||||
const float *radius = pointcloud->get_radius().data();
|
||||
|
||||
const bool use_fast_trace_bvh = (params.bvh_type == BVH_TYPE_STATIC);
|
||||
|
||||
size_t num_motion_steps = 1;
|
||||
Attribute *motion_keys = pointcloud->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
|
||||
if (motion_blur && pointcloud->get_use_motion_blur() && motion_keys) {
|
||||
num_motion_steps = pointcloud->get_motion_steps();
|
||||
}
|
||||
|
||||
const size_t num_aabbs = num_motion_steps;
|
||||
|
||||
MTLResourceOptions storage_mode;
|
||||
if (device.hasUnifiedMemory) {
|
||||
storage_mode = MTLResourceStorageModeShared;
|
||||
}
|
||||
else {
|
||||
storage_mode = MTLResourceStorageModeManaged;
|
||||
}
|
||||
|
||||
/* Allocate a GPU buffer for the AABB data and populate it */
|
||||
id<MTLBuffer> aabbBuf = [device
|
||||
newBufferWithLength:num_aabbs * sizeof(MTLAxisAlignedBoundingBox)
|
||||
options:storage_mode];
|
||||
MTLAxisAlignedBoundingBox *aabb_data = (MTLAxisAlignedBoundingBox *)[aabbBuf contents];
|
||||
|
||||
/* Get AABBs for each motion step */
|
||||
size_t center_step = (num_motion_steps - 1) / 2;
|
||||
for (size_t step = 0; step < num_motion_steps; ++step) {
|
||||
/* The center step for motion vertices is not stored in the attribute */
|
||||
if (step != center_step) {
|
||||
size_t attr_offset = (step > center_step) ? step - 1 : step;
|
||||
points = motion_keys->data_float3() + attr_offset * num_points;
|
||||
}
|
||||
|
||||
for (size_t j = 0; j < num_points; ++j) {
|
||||
const PointCloud::Point point = pointcloud->get_point(j);
|
||||
BoundBox bounds = BoundBox::empty;
|
||||
point.bounds_grow(points, radius, bounds);
|
||||
|
||||
const size_t index = step * num_points + j;
|
||||
aabb_data[index].min = (MTLPackedFloat3 &)bounds.min;
|
||||
aabb_data[index].max = (MTLPackedFloat3 &)bounds.max;
|
||||
}
|
||||
}
|
||||
|
||||
if (storage_mode == MTLResourceStorageModeManaged) {
|
||||
[aabbBuf didModifyRange:NSMakeRange(0, aabbBuf.length)];
|
||||
}
|
||||
|
||||
# if 0
|
||||
for (size_t i=0; i<num_aabbs && i < 400; i++) {
|
||||
MTLAxisAlignedBoundingBox& bb = aabb_data[i];
|
||||
printf(" %d: %.1f,%.1f,%.1f -- %.1f,%.1f,%.1f\n", int(i), bb.min.x, bb.min.y, bb.min.z, bb.max.x, bb.max.y, bb.max.z);
|
||||
}
|
||||
# endif
|
||||
|
||||
MTLAccelerationStructureGeometryDescriptor *geomDesc;
|
||||
if (motion_blur) {
|
||||
std::vector<MTLMotionKeyframeData *> aabb_ptrs;
|
||||
aabb_ptrs.reserve(num_motion_steps);
|
||||
for (size_t step = 0; step < num_motion_steps; ++step) {
|
||||
MTLMotionKeyframeData *k = [MTLMotionKeyframeData data];
|
||||
k.buffer = aabbBuf;
|
||||
k.offset = step * num_points * sizeof(MTLAxisAlignedBoundingBox);
|
||||
aabb_ptrs.push_back(k);
|
||||
}
|
||||
|
||||
MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor *geomDescMotion =
|
||||
[MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor descriptor];
|
||||
geomDescMotion.boundingBoxBuffers = [NSArray arrayWithObjects:aabb_ptrs.data()
|
||||
count:aabb_ptrs.size()];
|
||||
geomDescMotion.boundingBoxCount = num_points;
|
||||
geomDescMotion.boundingBoxStride = sizeof(aabb_data[0]);
|
||||
geomDescMotion.intersectionFunctionTableOffset = 2;
|
||||
|
||||
/* Force a single any-hit call, so shadow record-all behavior works correctly */
|
||||
/* (Match optix behavior: unsigned int build_flags =
|
||||
* OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL;) */
|
||||
geomDescMotion.allowDuplicateIntersectionFunctionInvocation = false;
|
||||
geomDescMotion.opaque = true;
|
||||
geomDesc = geomDescMotion;
|
||||
}
|
||||
else {
|
||||
MTLAccelerationStructureBoundingBoxGeometryDescriptor *geomDescNoMotion =
|
||||
[MTLAccelerationStructureBoundingBoxGeometryDescriptor descriptor];
|
||||
geomDescNoMotion.boundingBoxBuffer = aabbBuf;
|
||||
geomDescNoMotion.boundingBoxBufferOffset = 0;
|
||||
geomDescNoMotion.boundingBoxCount = int(num_aabbs);
|
||||
geomDescNoMotion.boundingBoxStride = sizeof(aabb_data[0]);
|
||||
geomDescNoMotion.intersectionFunctionTableOffset = 2;
|
||||
|
||||
/* Force a single any-hit call, so shadow record-all behavior works correctly */
|
||||
/* (Match optix behavior: unsigned int build_flags =
|
||||
* OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL;) */
|
||||
geomDescNoMotion.allowDuplicateIntersectionFunctionInvocation = false;
|
||||
geomDescNoMotion.opaque = true;
|
||||
geomDesc = geomDescNoMotion;
|
||||
}
|
||||
|
||||
MTLPrimitiveAccelerationStructureDescriptor *accelDesc =
|
||||
[MTLPrimitiveAccelerationStructureDescriptor descriptor];
|
||||
accelDesc.geometryDescriptors = @[ geomDesc ];
|
||||
|
||||
if (motion_blur) {
|
||||
accelDesc.motionStartTime = 0.0f;
|
||||
accelDesc.motionEndTime = 1.0f;
|
||||
accelDesc.motionStartBorderMode = MTLMotionBorderModeVanish;
|
||||
accelDesc.motionEndBorderMode = MTLMotionBorderModeVanish;
|
||||
accelDesc.motionKeyframeCount = num_motion_steps;
|
||||
}
|
||||
|
||||
if (!use_fast_trace_bvh) {
|
||||
accelDesc.usage |= (MTLAccelerationStructureUsageRefit |
|
||||
MTLAccelerationStructureUsagePreferFastBuild);
|
||||
}
|
||||
|
||||
MTLAccelerationStructureSizes accelSizes = [device
|
||||
accelerationStructureSizesWithDescriptor:accelDesc];
|
||||
id<MTLAccelerationStructure> accel_uncompressed = [device
|
||||
newAccelerationStructureWithSize:accelSizes.accelerationStructureSize];
|
||||
id<MTLBuffer> scratchBuf = [device newBufferWithLength:accelSizes.buildScratchBufferSize
|
||||
options:MTLResourceStorageModePrivate];
|
||||
id<MTLBuffer> sizeBuf = [device newBufferWithLength:8 options:MTLResourceStorageModeShared];
|
||||
id<MTLCommandBuffer> accelCommands = [queue commandBuffer];
|
||||
id<MTLAccelerationStructureCommandEncoder> accelEnc =
|
||||
[accelCommands accelerationStructureCommandEncoder];
|
||||
if (refit) {
|
||||
[accelEnc refitAccelerationStructure:accel_struct
|
||||
descriptor:accelDesc
|
||||
destination:accel_uncompressed
|
||||
scratchBuffer:scratchBuf
|
||||
scratchBufferOffset:0];
|
||||
}
|
||||
else {
|
||||
[accelEnc buildAccelerationStructure:accel_uncompressed
|
||||
descriptor:accelDesc
|
||||
scratchBuffer:scratchBuf
|
||||
scratchBufferOffset:0];
|
||||
}
|
||||
if (use_fast_trace_bvh) {
|
||||
[accelEnc writeCompactedAccelerationStructureSize:accel_uncompressed
|
||||
toBuffer:sizeBuf
|
||||
offset:0
|
||||
sizeDataType:MTLDataTypeULong];
|
||||
}
|
||||
[accelEnc endEncoding];
|
||||
[accelCommands addCompletedHandler:^(id<MTLCommandBuffer> command_buffer) {
|
||||
/* free temp resources */
|
||||
[scratchBuf release];
|
||||
[aabbBuf release];
|
||||
|
||||
if (use_fast_trace_bvh) {
|
||||
/* Compact the accel structure */
|
||||
uint64_t compressed_size = *(uint64_t *)sizeBuf.contents;
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
id<MTLCommandBuffer> accelCommands = [queue commandBuffer];
|
||||
id<MTLAccelerationStructureCommandEncoder> accelEnc =
|
||||
[accelCommands accelerationStructureCommandEncoder];
|
||||
id<MTLAccelerationStructure> accel = [device
|
||||
newAccelerationStructureWithSize:compressed_size];
|
||||
[accelEnc copyAndCompactAccelerationStructure:accel_uncompressed
|
||||
toAccelerationStructure:accel];
|
||||
[accelEnc endEncoding];
|
||||
[accelCommands addCompletedHandler:^(id<MTLCommandBuffer> command_buffer) {
|
||||
uint64_t allocated_size = [accel allocatedSize];
|
||||
stats.mem_alloc(allocated_size);
|
||||
accel_struct = accel;
|
||||
[accel_uncompressed release];
|
||||
accel_struct_building = false;
|
||||
}];
|
||||
[accelCommands commit];
|
||||
});
|
||||
}
|
||||
else {
|
||||
/* set our acceleration structure to the uncompressed structure */
|
||||
accel_struct = accel_uncompressed;
|
||||
|
||||
uint64_t allocated_size = [accel_struct allocatedSize];
|
||||
stats.mem_alloc(allocated_size);
|
||||
accel_struct_building = false;
|
||||
}
|
||||
[sizeBuf release];
|
||||
}];
|
||||
|
||||
accel_struct_building = true;
|
||||
[accelCommands commit];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BVHMetal::build_BLAS(Progress &progress,
|
||||
id<MTLDevice> device,
|
||||
id<MTLCommandQueue> queue,
|
||||
@@ -706,8 +491,6 @@ bool BVHMetal::build_BLAS(Progress &progress,
|
||||
return build_BLAS_mesh(progress, device, queue, geom, refit);
|
||||
case Geometry::HAIR:
|
||||
return build_BLAS_hair(progress, device, queue, geom, refit);
|
||||
case Geometry::POINTCLOUD:
|
||||
return build_BLAS_pointcloud(progress, device, queue, geom, refit);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@@ -115,8 +115,6 @@ class MetalDevice : public Device {
|
||||
|
||||
void load_texture_info();
|
||||
|
||||
void erase_allocation(device_memory &mem);
|
||||
|
||||
virtual bool should_use_graphics_interop() override;
|
||||
|
||||
virtual unique_ptr<DeviceQueue> gpu_queue_create() override;
|
||||
|
@@ -87,14 +87,17 @@ MetalDevice::MetalDevice(const DeviceInfo &info, Stats &stats, Profiler &profile
|
||||
default:
|
||||
break;
|
||||
case METAL_GPU_INTEL: {
|
||||
use_metalrt = false;
|
||||
max_threads_per_threadgroup = 64;
|
||||
break;
|
||||
}
|
||||
case METAL_GPU_AMD: {
|
||||
use_metalrt = false;
|
||||
max_threads_per_threadgroup = 128;
|
||||
break;
|
||||
}
|
||||
case METAL_GPU_APPLE: {
|
||||
use_metalrt = true;
|
||||
max_threads_per_threadgroup = 512;
|
||||
break;
|
||||
}
|
||||
@@ -429,25 +432,6 @@ void MetalDevice::load_texture_info()
|
||||
}
|
||||
}
|
||||
|
||||
void MetalDevice::erase_allocation(device_memory &mem)
|
||||
{
|
||||
stats.mem_free(mem.device_size);
|
||||
mem.device_pointer = 0;
|
||||
mem.device_size = 0;
|
||||
|
||||
auto it = metal_mem_map.find(&mem);
|
||||
if (it != metal_mem_map.end()) {
|
||||
MetalMem *mmem = it->second.get();
|
||||
|
||||
/* blank out reference to MetalMem* in the launch params (fixes crash T94736) */
|
||||
if (mmem->pointer_index >= 0) {
|
||||
device_ptr *pointers = (device_ptr *)&launch_params;
|
||||
pointers[mmem->pointer_index] = 0;
|
||||
}
|
||||
metal_mem_map.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
MetalDevice::MetalMem *MetalDevice::generic_alloc(device_memory &mem)
|
||||
{
|
||||
size_t size = mem.memory_size();
|
||||
@@ -577,7 +561,11 @@ void MetalDevice::generic_free(device_memory &mem)
|
||||
mmem.mtlBuffer = nil;
|
||||
}
|
||||
|
||||
erase_allocation(mem);
|
||||
stats.mem_free(mem.device_size);
|
||||
mem.device_pointer = 0;
|
||||
mem.device_size = 0;
|
||||
|
||||
metal_mem_map.erase(&mem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -966,7 +954,10 @@ void MetalDevice::tex_free(device_texture &mem)
|
||||
delayed_free_list.push_back(mmem.mtlTexture);
|
||||
mmem.mtlTexture = nil;
|
||||
}
|
||||
erase_allocation(mem);
|
||||
stats.mem_free(mem.device_size);
|
||||
mem.device_pointer = 0;
|
||||
mem.device_size = 0;
|
||||
metal_mem_map.erase(&mem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -36,8 +36,6 @@ enum {
|
||||
METALRT_FUNC_CURVE_RIBBON_SHADOW,
|
||||
METALRT_FUNC_CURVE_ALL,
|
||||
METALRT_FUNC_CURVE_ALL_SHADOW,
|
||||
METALRT_FUNC_POINT,
|
||||
METALRT_FUNC_POINT_SHADOW,
|
||||
METALRT_FUNC_NUM
|
||||
};
|
||||
|
||||
|
@@ -358,8 +358,6 @@ bool MetalDeviceKernels::load(MetalDevice *device, int kernel_type)
|
||||
"__intersection__curve_ribbon_shadow",
|
||||
"__intersection__curve_all",
|
||||
"__intersection__curve_all_shadow",
|
||||
"__intersection__point",
|
||||
"__intersection__point_shadow",
|
||||
};
|
||||
assert(sizeof(function_names) / sizeof(function_names[0]) == METALRT_FUNC_NUM);
|
||||
|
||||
@@ -402,50 +400,36 @@ bool MetalDeviceKernels::load(MetalDevice *device, int kernel_type)
|
||||
NSArray *function_list = nil;
|
||||
|
||||
if (device->use_metalrt) {
|
||||
id<MTLFunction> curve_intersect_default = nil;
|
||||
id<MTLFunction> curve_intersect_shadow = nil;
|
||||
id<MTLFunction> point_intersect_default = nil;
|
||||
id<MTLFunction> point_intersect_shadow = nil;
|
||||
id<MTLFunction> box_intersect_default = nil;
|
||||
id<MTLFunction> box_intersect_shadow = nil;
|
||||
if (device->kernel_features & KERNEL_FEATURE_HAIR) {
|
||||
/* Add curve intersection programs. */
|
||||
if (device->kernel_features & KERNEL_FEATURE_HAIR_THICK) {
|
||||
/* Slower programs for thick hair since that also slows down ribbons.
|
||||
* Ideally this should not be needed. */
|
||||
curve_intersect_default = rt_intersection_funcs[kernel_type][METALRT_FUNC_CURVE_ALL];
|
||||
curve_intersect_shadow =
|
||||
rt_intersection_funcs[kernel_type][METALRT_FUNC_CURVE_ALL_SHADOW];
|
||||
box_intersect_default = rt_intersection_funcs[kernel_type][METALRT_FUNC_CURVE_ALL];
|
||||
box_intersect_shadow = rt_intersection_funcs[kernel_type][METALRT_FUNC_CURVE_ALL_SHADOW];
|
||||
}
|
||||
else {
|
||||
curve_intersect_default = rt_intersection_funcs[kernel_type][METALRT_FUNC_CURVE_RIBBON];
|
||||
curve_intersect_shadow =
|
||||
box_intersect_default = rt_intersection_funcs[kernel_type][METALRT_FUNC_CURVE_RIBBON];
|
||||
box_intersect_shadow =
|
||||
rt_intersection_funcs[kernel_type][METALRT_FUNC_CURVE_RIBBON_SHADOW];
|
||||
}
|
||||
}
|
||||
if (device->kernel_features & KERNEL_FEATURE_POINTCLOUD) {
|
||||
point_intersect_default = rt_intersection_funcs[kernel_type][METALRT_FUNC_POINT];
|
||||
point_intersect_shadow = rt_intersection_funcs[kernel_type][METALRT_FUNC_POINT_SHADOW];
|
||||
}
|
||||
table_functions[METALRT_TABLE_DEFAULT] = [NSArray
|
||||
arrayWithObjects:rt_intersection_funcs[kernel_type][METALRT_FUNC_DEFAULT_TRI],
|
||||
curve_intersect_default ?
|
||||
curve_intersect_default :
|
||||
rt_intersection_funcs[kernel_type][METALRT_FUNC_DEFAULT_BOX],
|
||||
point_intersect_default ?
|
||||
point_intersect_default :
|
||||
box_intersect_default ?
|
||||
box_intersect_default :
|
||||
rt_intersection_funcs[kernel_type][METALRT_FUNC_DEFAULT_BOX],
|
||||
nil];
|
||||
table_functions[METALRT_TABLE_SHADOW] = [NSArray
|
||||
arrayWithObjects:rt_intersection_funcs[kernel_type][METALRT_FUNC_SHADOW_TRI],
|
||||
curve_intersect_shadow ?
|
||||
curve_intersect_shadow :
|
||||
rt_intersection_funcs[kernel_type][METALRT_FUNC_SHADOW_BOX],
|
||||
point_intersect_shadow ?
|
||||
point_intersect_shadow :
|
||||
box_intersect_shadow ?
|
||||
box_intersect_shadow :
|
||||
rt_intersection_funcs[kernel_type][METALRT_FUNC_SHADOW_BOX],
|
||||
nil];
|
||||
table_functions[METALRT_TABLE_LOCAL] = [NSArray
|
||||
arrayWithObjects:rt_intersection_funcs[kernel_type][METALRT_FUNC_LOCAL_TRI],
|
||||
rt_intersection_funcs[kernel_type][METALRT_FUNC_LOCAL_BOX],
|
||||
rt_intersection_funcs[kernel_type][METALRT_FUNC_LOCAL_BOX],
|
||||
nil];
|
||||
|
||||
|
@@ -141,7 +141,6 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
|
||||
const PassType type = pass_access_info_.type;
|
||||
const PassMode mode = pass_access_info_.mode;
|
||||
const PassInfo pass_info = Pass::get_info(type, pass_access_info_.include_albedo);
|
||||
int num_written_components = pass_info.num_components;
|
||||
|
||||
if (pass_info.num_components == 1) {
|
||||
/* Single channel passes. */
|
||||
@@ -189,10 +188,8 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
|
||||
else if ((pass_info.divide_type != PASS_NONE || pass_info.direct_type != PASS_NONE ||
|
||||
pass_info.indirect_type != PASS_NONE) &&
|
||||
mode != PassMode::DENOISED) {
|
||||
/* RGB lighting passes that need to divide out color and/or sum direct and indirect.
|
||||
* These can also optionally write alpha like the combined pass. */
|
||||
/* RGB lighting passes that need to divide out color and/or sum direct and indirect. */
|
||||
get_pass_light_path(render_buffers, buffer_params, destination);
|
||||
num_written_components = 4;
|
||||
}
|
||||
else {
|
||||
/* Passes that need no special computation, or denoised passes that already
|
||||
@@ -218,7 +215,7 @@ bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
|
||||
}
|
||||
}
|
||||
|
||||
pad_pixels(buffer_params, destination, num_written_components);
|
||||
pad_pixels(buffer_params, destination, pass_info.num_components);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -148,23 +148,12 @@ ccl_device_inline
|
||||
/* intersect ray against primitive */
|
||||
for (; prim_addr < prim_addr2; prim_addr++) {
|
||||
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
|
||||
|
||||
/* Only intersect with matching object, for instanced objects we
|
||||
* already know we are only intersecting the right object. */
|
||||
if (object == OBJECT_NONE) {
|
||||
if (kernel_tex_fetch(__prim_object, prim_addr) != local_object) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
|
||||
if (triangle_intersect_local(kg,
|
||||
local_isect,
|
||||
P,
|
||||
dir,
|
||||
object,
|
||||
local_object,
|
||||
prim,
|
||||
prim_addr,
|
||||
isect_t,
|
||||
lcg_state,
|
||||
@@ -179,24 +168,13 @@ ccl_device_inline
|
||||
/* intersect ray against primitive */
|
||||
for (; prim_addr < prim_addr2; prim_addr++) {
|
||||
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
|
||||
|
||||
/* Only intersect with matching object, for instanced objects we
|
||||
* already know we are only intersecting the right object. */
|
||||
if (object == OBJECT_NONE) {
|
||||
if (kernel_tex_fetch(__prim_object, prim_addr) != local_object) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
|
||||
if (motion_triangle_intersect_local(kg,
|
||||
local_isect,
|
||||
P,
|
||||
dir,
|
||||
ray->time,
|
||||
object,
|
||||
local_object,
|
||||
prim,
|
||||
prim_addr,
|
||||
isect_t,
|
||||
lcg_state,
|
||||
|
@@ -146,7 +146,7 @@ ccl_device_inline
|
||||
--stack_ptr;
|
||||
|
||||
/* primitive intersection */
|
||||
for (; prim_addr < prim_addr2; prim_addr++) {
|
||||
while (prim_addr < prim_addr2) {
|
||||
kernel_assert((kernel_tex_fetch(__prim_type, prim_addr) & PRIMITIVE_ALL) ==
|
||||
(type & PRIMITIVE_ALL));
|
||||
bool hit;
|
||||
@@ -156,29 +156,16 @@ ccl_device_inline
|
||||
* might give a few % performance improvement */
|
||||
Intersection isect ccl_optional_struct_init;
|
||||
|
||||
const int prim_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
|
||||
switch (type & PRIMITIVE_ALL) {
|
||||
case PRIMITIVE_TRIANGLE: {
|
||||
hit = triangle_intersect(
|
||||
kg, &isect, P, dir, t_max_current, visibility, prim_object, prim, prim_addr);
|
||||
kg, &isect, P, dir, t_max_current, visibility, object, prim_addr);
|
||||
break;
|
||||
}
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
case PRIMITIVE_MOTION_TRIANGLE: {
|
||||
hit = motion_triangle_intersect(kg,
|
||||
&isect,
|
||||
P,
|
||||
dir,
|
||||
t_max_current,
|
||||
ray->time,
|
||||
visibility,
|
||||
prim_object,
|
||||
prim,
|
||||
prim_addr);
|
||||
hit = motion_triangle_intersect(
|
||||
kg, &isect, P, dir, t_max_current, ray->time, visibility, object, prim_addr);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -195,9 +182,20 @@ ccl_device_inline
|
||||
}
|
||||
}
|
||||
|
||||
const int curve_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int curve_type = kernel_tex_fetch(__prim_type, prim_addr);
|
||||
hit = curve_intersect(
|
||||
kg, &isect, P, dir, t_max_current, prim_object, prim, ray->time, curve_type);
|
||||
const int curve_prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
hit = curve_intersect(kg,
|
||||
&isect,
|
||||
P,
|
||||
dir,
|
||||
t_max_current,
|
||||
curve_object,
|
||||
curve_prim,
|
||||
ray->time,
|
||||
curve_type);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -213,9 +211,20 @@ ccl_device_inline
|
||||
}
|
||||
}
|
||||
|
||||
const int point_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int point_prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
const int point_type = kernel_tex_fetch(__prim_type, prim_addr);
|
||||
hit = point_intersect(
|
||||
kg, &isect, P, dir, t_max_current, prim_object, prim, ray->time, point_type);
|
||||
hit = point_intersect(kg,
|
||||
&isect,
|
||||
P,
|
||||
dir,
|
||||
t_max_current,
|
||||
point_object,
|
||||
point_prim,
|
||||
ray->time,
|
||||
point_type);
|
||||
break;
|
||||
}
|
||||
#endif /* BVH_FEATURE(BVH_POINTCLOUD) */
|
||||
@@ -292,6 +301,8 @@ ccl_device_inline
|
||||
integrator_state_write_shadow_isect(state, &isect, record_index);
|
||||
}
|
||||
}
|
||||
|
||||
prim_addr++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@@ -137,14 +137,8 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg,
|
||||
case PRIMITIVE_TRIANGLE: {
|
||||
for (; prim_addr < prim_addr2; prim_addr++) {
|
||||
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
|
||||
|
||||
const int prim_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
|
||||
if (triangle_intersect(
|
||||
kg, isect, P, dir, isect->t, visibility, prim_object, prim, prim_addr)) {
|
||||
kg, isect, P, dir, isect->t, visibility, object, prim_addr)) {
|
||||
/* shadow ray early termination */
|
||||
if (visibility & PATH_RAY_SHADOW_OPAQUE)
|
||||
return true;
|
||||
@@ -156,22 +150,8 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg,
|
||||
case PRIMITIVE_MOTION_TRIANGLE: {
|
||||
for (; prim_addr < prim_addr2; prim_addr++) {
|
||||
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
|
||||
|
||||
const int prim_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
|
||||
if (motion_triangle_intersect(kg,
|
||||
isect,
|
||||
P,
|
||||
dir,
|
||||
isect->t,
|
||||
ray->time,
|
||||
visibility,
|
||||
prim_object,
|
||||
prim,
|
||||
prim_addr)) {
|
||||
if (motion_triangle_intersect(
|
||||
kg, isect, P, dir, isect->t, ray->time, visibility, object, prim_addr)) {
|
||||
/* shadow ray early termination */
|
||||
if (visibility & PATH_RAY_SHADOW_OPAQUE)
|
||||
return true;
|
||||
@@ -193,14 +173,13 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg,
|
||||
}
|
||||
}
|
||||
|
||||
const int prim_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
|
||||
const int curve_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int curve_prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
const int curve_type = kernel_tex_fetch(__prim_type, prim_addr);
|
||||
const bool hit = curve_intersect(
|
||||
kg, isect, P, dir, isect->t, prim_object, prim, ray->time, curve_type);
|
||||
kg, isect, P, dir, isect->t, curve_object, curve_prim, ray->time, curve_type);
|
||||
if (hit) {
|
||||
/* shadow ray early termination */
|
||||
if (visibility & PATH_RAY_SHADOW_OPAQUE)
|
||||
@@ -221,14 +200,13 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals kg,
|
||||
}
|
||||
}
|
||||
|
||||
const int prim_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
|
||||
const int point_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int point_prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
const int point_type = kernel_tex_fetch(__prim_type, prim_addr);
|
||||
const bool hit = point_intersect(
|
||||
kg, isect, P, dir, isect->t, prim_object, prim, ray->time, point_type);
|
||||
kg, isect, P, dir, isect->t, point_object, point_prim, ray->time, point_type);
|
||||
if (hit) {
|
||||
/* shadow ray early termination */
|
||||
if (visibility & PATH_RAY_SHADOW_OPAQUE)
|
||||
|
@@ -140,17 +140,14 @@ ccl_device_inline
|
||||
for (; prim_addr < prim_addr2; prim_addr++) {
|
||||
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
|
||||
/* only primitives from volume object */
|
||||
const int prim_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
|
||||
int object_flag = kernel_tex_fetch(__object_flag, prim_object);
|
||||
uint tri_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
int object_flag = kernel_tex_fetch(__object_flag, tri_object);
|
||||
if ((object_flag & SD_OBJECT_HAS_VOLUME) == 0) {
|
||||
continue;
|
||||
}
|
||||
triangle_intersect(
|
||||
kg, isect, P, dir, isect->t, visibility, prim_object, prim, prim_addr);
|
||||
triangle_intersect(kg, isect, P, dir, isect->t, visibility, object, prim_addr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -160,24 +157,15 @@ ccl_device_inline
|
||||
for (; prim_addr < prim_addr2; prim_addr++) {
|
||||
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
|
||||
/* only primitives from volume object */
|
||||
const int prim_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
int object_flag = kernel_tex_fetch(__object_flag, prim_object);
|
||||
uint tri_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
int object_flag = kernel_tex_fetch(__object_flag, tri_object);
|
||||
if ((object_flag & SD_OBJECT_HAS_VOLUME) == 0) {
|
||||
continue;
|
||||
}
|
||||
motion_triangle_intersect(kg,
|
||||
isect,
|
||||
P,
|
||||
dir,
|
||||
isect->t,
|
||||
ray->time,
|
||||
visibility,
|
||||
prim_object,
|
||||
prim,
|
||||
prim_addr);
|
||||
motion_triangle_intersect(
|
||||
kg, isect, P, dir, isect->t, ray->time, visibility, object, prim_addr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -143,16 +143,15 @@ ccl_device_inline
|
||||
for (; prim_addr < prim_addr2; prim_addr++) {
|
||||
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
|
||||
/* only primitives from volume object */
|
||||
const int prim_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
int object_flag = kernel_tex_fetch(__object_flag, prim_object);
|
||||
uint tri_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
int object_flag = kernel_tex_fetch(__object_flag, tri_object);
|
||||
if ((object_flag & SD_OBJECT_HAS_VOLUME) == 0) {
|
||||
continue;
|
||||
}
|
||||
hit = triangle_intersect(
|
||||
kg, isect_array, P, dir, isect_t, visibility, prim_object, prim, prim_addr);
|
||||
kg, isect_array, P, dir, isect_t, visibility, object, prim_addr);
|
||||
if (hit) {
|
||||
/* Move on to next entry in intersections array. */
|
||||
isect_array++;
|
||||
@@ -184,24 +183,15 @@ ccl_device_inline
|
||||
for (; prim_addr < prim_addr2; prim_addr++) {
|
||||
kernel_assert(kernel_tex_fetch(__prim_type, prim_addr) == type);
|
||||
/* only primitives from volume object */
|
||||
const int prim_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
int object_flag = kernel_tex_fetch(__object_flag, prim_object);
|
||||
uint tri_object = (object == OBJECT_NONE) ?
|
||||
kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
int object_flag = kernel_tex_fetch(__object_flag, tri_object);
|
||||
if ((object_flag & SD_OBJECT_HAS_VOLUME) == 0) {
|
||||
continue;
|
||||
}
|
||||
hit = motion_triangle_intersect(kg,
|
||||
isect_array,
|
||||
P,
|
||||
dir,
|
||||
isect_t,
|
||||
ray->time,
|
||||
visibility,
|
||||
prim_object,
|
||||
prim,
|
||||
prim_addr);
|
||||
hit = motion_triangle_intersect(
|
||||
kg, isect_array, P, dir, isect_t, ray->time, visibility, object, prim_addr);
|
||||
if (hit) {
|
||||
/* Move on to next entry in intersections array. */
|
||||
isect_array++;
|
||||
|
@@ -199,18 +199,22 @@ ccl_device int volume_sample_channel(float3 albedo,
|
||||
* Tracing". Matt Jen-Yuan Chiang, Peter Kutz, Brent Burley. SIGGRAPH 2016. */
|
||||
float3 weights = fabs(throughput * albedo);
|
||||
float sum_weights = weights.x + weights.y + weights.z;
|
||||
float3 weights_pdf;
|
||||
|
||||
if (sum_weights > 0.0f) {
|
||||
*pdf = weights / sum_weights;
|
||||
weights_pdf = weights / sum_weights;
|
||||
}
|
||||
else {
|
||||
*pdf = make_float3(1.0f / 3.0f, 1.0f / 3.0f, 1.0f / 3.0f);
|
||||
weights_pdf = make_float3(1.0f / 3.0f, 1.0f / 3.0f, 1.0f / 3.0f);
|
||||
}
|
||||
|
||||
if (rand < pdf->x) {
|
||||
*pdf = weights_pdf;
|
||||
|
||||
/* OpenCL does not support -> on float3, so don't use pdf->x. */
|
||||
if (rand < weights_pdf.x) {
|
||||
return 0;
|
||||
}
|
||||
else if (rand < pdf->x + pdf->y) {
|
||||
else if (rand < weights_pdf.x + weights_pdf.y) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
|
@@ -243,10 +243,6 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __KERNEL_METAL__
|
||||
constant int __dummy_constant [[function_constant(0)]];
|
||||
#endif
|
||||
|
||||
ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
|
||||
ccl_gpu_kernel_signature(integrator_shade_surface_raytrace,
|
||||
ccl_global const int *path_index_array,
|
||||
@@ -257,16 +253,7 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS)
|
||||
|
||||
if (global_index < work_size) {
|
||||
const int state = (path_index_array) ? path_index_array[global_index] : global_index;
|
||||
|
||||
#ifdef __KERNEL_METAL__
|
||||
KernelGlobals kg = NULL;
|
||||
/* Workaround Ambient Occlusion and Bevel nodes not working with Metal.
|
||||
* Dummy offset should not affect result, but somehow fixes bug! */
|
||||
kg += __dummy_constant;
|
||||
ccl_gpu_kernel_call(integrator_shade_surface_raytrace(kg, state, render_buffer));
|
||||
#else
|
||||
ccl_gpu_kernel_call(integrator_shade_surface_raytrace(NULL, state, render_buffer));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -576,150 +576,6 @@ __intersection__curve_all_shadow(constant KernelParamsMetal &launch_params_metal
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif /* __HAIR__ */
|
||||
|
||||
#ifdef __POINTCLOUD__
|
||||
ccl_device_inline
|
||||
void metalrt_intersection_point(constant KernelParamsMetal &launch_params_metal,
|
||||
ray_data MetalKernelContext::MetalRTIntersectionPayload &payload,
|
||||
const uint object,
|
||||
const uint prim,
|
||||
const uint type,
|
||||
const float3 ray_origin,
|
||||
const float3 ray_direction,
|
||||
float time,
|
||||
const float ray_tmax,
|
||||
thread BoundingBoxIntersectionResult &result)
|
||||
{
|
||||
# ifdef __VISIBILITY_FLAG__
|
||||
const uint visibility = payload.visibility;
|
||||
if ((kernel_tex_fetch(__objects, object).visibility & visibility) == 0) {
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
float3 P = ray_origin;
|
||||
float3 dir = ray_direction;
|
||||
|
||||
/* The direction is not normalized by default, but the point intersection routine expects that */
|
||||
float len;
|
||||
dir = normalize_len(dir, &len);
|
||||
|
||||
Intersection isect;
|
||||
isect.t = ray_tmax;
|
||||
/* Transform maximum distance into object space. */
|
||||
if (isect.t != FLT_MAX)
|
||||
isect.t *= len;
|
||||
|
||||
MetalKernelContext context(launch_params_metal);
|
||||
if (context.point_intersect(NULL, &isect, P, dir, isect.t, object, prim, time, type)) {
|
||||
result = metalrt_visibility_test<BoundingBoxIntersectionResult, METALRT_HIT_BOUNDING_BOX>(
|
||||
launch_params_metal, payload, object, prim, isect.u);
|
||||
if (result.accept) {
|
||||
result.distance = isect.t / len;
|
||||
payload.u = isect.u;
|
||||
payload.v = isect.v;
|
||||
payload.prim = prim;
|
||||
payload.type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ccl_device_inline
|
||||
void metalrt_intersection_point_shadow(constant KernelParamsMetal &launch_params_metal,
|
||||
ray_data MetalKernelContext::MetalRTIntersectionShadowPayload &payload,
|
||||
const uint object,
|
||||
const uint prim,
|
||||
const uint type,
|
||||
const float3 ray_origin,
|
||||
const float3 ray_direction,
|
||||
float time,
|
||||
const float ray_tmax,
|
||||
thread BoundingBoxIntersectionResult &result)
|
||||
{
|
||||
const uint visibility = payload.visibility;
|
||||
|
||||
float3 P = ray_origin;
|
||||
float3 dir = ray_direction;
|
||||
|
||||
/* The direction is not normalized by default, but the point intersection routine expects that */
|
||||
float len;
|
||||
dir = normalize_len(dir, &len);
|
||||
|
||||
Intersection isect;
|
||||
isect.t = ray_tmax;
|
||||
/* Transform maximum distance into object space */
|
||||
if (isect.t != FLT_MAX)
|
||||
isect.t *= len;
|
||||
|
||||
MetalKernelContext context(launch_params_metal);
|
||||
if (context.point_intersect(NULL, &isect, P, dir, isect.t, object, prim, time, type)) {
|
||||
result.continue_search = metalrt_shadow_all_hit<METALRT_HIT_BOUNDING_BOX>(
|
||||
launch_params_metal, payload, object, prim, float2(isect.u, isect.v), ray_tmax);
|
||||
result.accept = !result.continue_search;
|
||||
|
||||
if (result.accept) {
|
||||
result.distance = isect.t / len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[[intersection(bounding_box, triangle_data, METALRT_TAGS)]]
|
||||
BoundingBoxIntersectionResult
|
||||
__intersection__point(constant KernelParamsMetal &launch_params_metal [[buffer(1)]],
|
||||
ray_data MetalKernelContext::MetalRTIntersectionPayload &payload [[payload]],
|
||||
const uint object [[user_instance_id]],
|
||||
const uint primitive_id [[primitive_id]],
|
||||
const float3 ray_origin [[origin]],
|
||||
const float3 ray_direction [[direction]],
|
||||
const float ray_tmax [[max_distance]])
|
||||
{
|
||||
const uint prim = primitive_id + kernel_tex_fetch(__object_prim_offset, object);
|
||||
const int type = kernel_tex_fetch(__objects, object).primitive_type;
|
||||
|
||||
BoundingBoxIntersectionResult result;
|
||||
result.accept = false;
|
||||
result.continue_search = true;
|
||||
result.distance = ray_tmax;
|
||||
|
||||
metalrt_intersection_point(launch_params_metal, payload, object, prim, type, ray_origin, ray_direction,
|
||||
# if defined(__METALRT_MOTION__)
|
||||
payload.time,
|
||||
# else
|
||||
0.0f,
|
||||
# endif
|
||||
ray_tmax, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[[intersection(bounding_box, triangle_data, METALRT_TAGS)]]
|
||||
BoundingBoxIntersectionResult
|
||||
__intersection__point_shadow(constant KernelParamsMetal &launch_params_metal [[buffer(1)]],
|
||||
ray_data MetalKernelContext::MetalRTIntersectionShadowPayload &payload [[payload]],
|
||||
const uint object [[user_instance_id]],
|
||||
const uint primitive_id [[primitive_id]],
|
||||
const float3 ray_origin [[origin]],
|
||||
const float3 ray_direction [[direction]],
|
||||
const float ray_tmax [[max_distance]])
|
||||
{
|
||||
const uint prim = primitive_id + kernel_tex_fetch(__object_prim_offset, object);
|
||||
const int type = kernel_tex_fetch(__objects, object).primitive_type;
|
||||
|
||||
BoundingBoxIntersectionResult result;
|
||||
result.accept = false;
|
||||
result.continue_search = true;
|
||||
result.distance = ray_tmax;
|
||||
|
||||
metalrt_intersection_point_shadow(launch_params_metal, payload, object, prim, type, ray_origin, ray_direction,
|
||||
# if defined(__METALRT_MOTION__)
|
||||
payload.time,
|
||||
# else
|
||||
0.0f,
|
||||
# endif
|
||||
ray_tmax, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif /* __POINTCLOUD__ */
|
||||
#endif /* __METALRT__ */
|
||||
|
@@ -92,14 +92,6 @@ ccl_device_forceinline void kernel_write_denoising_features_surface(
|
||||
else if (sc->type == CLOSURE_BSDF_HAIR_PRINCIPLED_ID) {
|
||||
closure_albedo *= bsdf_principled_hair_albedo(sc);
|
||||
}
|
||||
else if (sc->type == CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID) {
|
||||
/* BSSRDF already accounts for weight, retro-reflection would double up. */
|
||||
ccl_private const PrincipledDiffuseBsdf *bsdf = (ccl_private const PrincipledDiffuseBsdf *)
|
||||
sc;
|
||||
if (bsdf->components == PRINCIPLED_DIFFUSE_RETRO_REFLECTION) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (bsdf_get_specular_roughness_squared(sc) > sqr(0.075f)) {
|
||||
diffuse_albedo += closure_albedo;
|
||||
|
@@ -214,21 +214,6 @@ ccl_device_inline void film_get_pass_pixel_light_path(
|
||||
pixel[0] = f.x;
|
||||
pixel[1] = f.y;
|
||||
pixel[2] = f.z;
|
||||
|
||||
/* Optional alpha channel. */
|
||||
if (kfilm_convert->num_components >= 4) {
|
||||
if (kfilm_convert->pass_combined != PASS_UNUSED) {
|
||||
float scale, scale_exposure;
|
||||
film_get_scale_and_scale_exposure(kfilm_convert, buffer, &scale, &scale_exposure);
|
||||
|
||||
ccl_global const float *in_combined = buffer + kfilm_convert->pass_combined;
|
||||
const float alpha = in_combined[3] * scale;
|
||||
pixel[3] = film_transparency_to_alpha(alpha);
|
||||
}
|
||||
else {
|
||||
pixel[3] = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ccl_device_inline void film_get_pass_pixel_float3(ccl_global const KernelFilmConvert *ccl_restrict
|
||||
|
@@ -153,12 +153,14 @@ ccl_device_inline bool motion_triangle_intersect(KernelGlobals kg,
|
||||
float time,
|
||||
uint visibility,
|
||||
int object,
|
||||
int prim,
|
||||
int prim_addr)
|
||||
{
|
||||
/* Primitive index for vertex location lookup. */
|
||||
int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
int fobject = (object == OBJECT_NONE) ? kernel_tex_fetch(__prim_object, prim_addr) : object;
|
||||
/* Get vertex locations for intersection. */
|
||||
float3 verts[3];
|
||||
motion_triangle_vertices(kg, object, prim, time, verts);
|
||||
motion_triangle_vertices(kg, fobject, prim, time, verts);
|
||||
/* Ray-triangle intersection, unoptimized. */
|
||||
float t, u, v;
|
||||
if (ray_triangle_intersect(P, dir, tmax, verts[0], verts[1], verts[2], &u, &v, &t)) {
|
||||
@@ -173,7 +175,8 @@ ccl_device_inline bool motion_triangle_intersect(KernelGlobals kg,
|
||||
isect->u = u;
|
||||
isect->v = v;
|
||||
isect->prim = prim;
|
||||
isect->object = object;
|
||||
isect->object = (object == OBJECT_NONE) ? kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
isect->type = PRIMITIVE_MOTION_TRIANGLE;
|
||||
return true;
|
||||
}
|
||||
@@ -193,15 +196,25 @@ ccl_device_inline bool motion_triangle_intersect_local(KernelGlobals kg,
|
||||
float3 dir,
|
||||
float time,
|
||||
int object,
|
||||
int prim,
|
||||
int local_object,
|
||||
int prim_addr,
|
||||
float tmax,
|
||||
ccl_private uint *lcg_state,
|
||||
int max_hits)
|
||||
{
|
||||
/* Only intersect with matching object, for instanced objects we
|
||||
* already know we are only intersecting the right object. */
|
||||
if (object == OBJECT_NONE) {
|
||||
if (kernel_tex_fetch(__prim_object, prim_addr) != local_object) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Primitive index for vertex location lookup. */
|
||||
int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
/* Get vertex locations for intersection. */
|
||||
float3 verts[3];
|
||||
motion_triangle_vertices(kg, object, prim, time, verts);
|
||||
motion_triangle_vertices(kg, local_object, prim, time, verts);
|
||||
/* Ray-triangle intersection, unoptimized. */
|
||||
float t, u, v;
|
||||
if (!ray_triangle_intersect(P, dir, tmax, verts[0], verts[1], verts[2], &u, &v, &t)) {
|
||||
@@ -253,7 +266,7 @@ ccl_device_inline bool motion_triangle_intersect_local(KernelGlobals kg,
|
||||
isect->u = u;
|
||||
isect->v = v;
|
||||
isect->prim = prim;
|
||||
isect->object = object;
|
||||
isect->object = local_object;
|
||||
isect->type = PRIMITIVE_MOTION_TRIANGLE;
|
||||
|
||||
/* Record geometric normal. */
|
||||
|
@@ -33,9 +33,9 @@ ccl_device_inline bool triangle_intersect(KernelGlobals kg,
|
||||
float tmax,
|
||||
uint visibility,
|
||||
int object,
|
||||
int prim,
|
||||
int prim_addr)
|
||||
{
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
const uint tri_vindex = kernel_tex_fetch(__tri_vindex, prim).w;
|
||||
const float3 tri_a = kernel_tex_fetch(__tri_verts, tri_vindex + 0),
|
||||
tri_b = kernel_tex_fetch(__tri_verts, tri_vindex + 1),
|
||||
@@ -49,7 +49,8 @@ ccl_device_inline bool triangle_intersect(KernelGlobals kg,
|
||||
if (kernel_tex_fetch(__prim_visibility, prim_addr) & visibility)
|
||||
#endif
|
||||
{
|
||||
isect->object = object;
|
||||
isect->object = (object == OBJECT_NONE) ? kernel_tex_fetch(__prim_object, prim_addr) :
|
||||
object;
|
||||
isect->prim = prim;
|
||||
isect->type = PRIMITIVE_TRIANGLE;
|
||||
isect->u = u;
|
||||
@@ -73,12 +74,21 @@ ccl_device_inline bool triangle_intersect_local(KernelGlobals kg,
|
||||
float3 P,
|
||||
float3 dir,
|
||||
int object,
|
||||
int prim,
|
||||
int local_object,
|
||||
int prim_addr,
|
||||
float tmax,
|
||||
ccl_private uint *lcg_state,
|
||||
int max_hits)
|
||||
{
|
||||
/* Only intersect with matching object, for instanced objects we
|
||||
* already know we are only intersecting the right object. */
|
||||
if (object == OBJECT_NONE) {
|
||||
if (kernel_tex_fetch(__prim_object, prim_addr) != local_object) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const int prim = kernel_tex_fetch(__prim_index, prim_addr);
|
||||
const uint tri_vindex = kernel_tex_fetch(__tri_vindex, prim).w;
|
||||
const float3 tri_a = kernel_tex_fetch(__tri_verts, tri_vindex + 0),
|
||||
tri_b = kernel_tex_fetch(__tri_verts, tri_vindex + 1),
|
||||
@@ -129,7 +139,7 @@ ccl_device_inline bool triangle_intersect_local(KernelGlobals kg,
|
||||
/* Record intersection. */
|
||||
ccl_private Intersection *isect = &local_isect->hits[hit];
|
||||
isect->prim = prim;
|
||||
isect->object = object;
|
||||
isect->object = local_object;
|
||||
isect->type = PRIMITIVE_TRIANGLE;
|
||||
isect->u = u;
|
||||
isect->v = v;
|
||||
|
@@ -188,7 +188,7 @@ ccl_device_forceinline void integrate_surface_direct_light(KernelGlobals kg,
|
||||
const uint16_t transparent_bounce = INTEGRATOR_STATE(state, path, transparent_bounce);
|
||||
uint32_t shadow_flag = INTEGRATOR_STATE(state, path, flag);
|
||||
shadow_flag |= (is_light) ? PATH_RAY_SHADOW_FOR_LIGHT : 0;
|
||||
shadow_flag |= (shadow_flag & PATH_RAY_ANY_PASS) ? 0 : PATH_RAY_SURFACE_PASS;
|
||||
shadow_flag |= PATH_RAY_SURFACE_PASS;
|
||||
const float3 throughput = INTEGRATOR_STATE(state, path, throughput) * bsdf_eval_sum(&bsdf_eval);
|
||||
|
||||
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
||||
|
@@ -797,7 +797,7 @@ ccl_device_forceinline void integrate_volume_direct_light(
|
||||
const uint16_t transparent_bounce = INTEGRATOR_STATE(state, path, transparent_bounce);
|
||||
uint32_t shadow_flag = INTEGRATOR_STATE(state, path, flag);
|
||||
shadow_flag |= (is_light) ? PATH_RAY_SHADOW_FOR_LIGHT : 0;
|
||||
shadow_flag |= (shadow_flag & PATH_RAY_ANY_PASS) ? 0 : PATH_RAY_VOLUME_PASS;
|
||||
shadow_flag |= PATH_RAY_VOLUME_PASS;
|
||||
const float3 throughput_phase = throughput * bsdf_eval_sum(&phase_eval);
|
||||
|
||||
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
||||
|
@@ -85,4 +85,6 @@ shader node_normal_map(normal NormalIn = N,
|
||||
|
||||
if (Strength != 1.0)
|
||||
Normal = normalize(NormalIn + (Normal - NormalIn) * max(Strength, 0.0));
|
||||
|
||||
Normal = ensure_valid_reflection(Ng, I, Normal);
|
||||
}
|
||||
|
@@ -87,9 +87,7 @@ ccl_device_noinline void svm_node_attr(KernelGlobals kg,
|
||||
if (node.y == ATTR_STD_GENERATED && desc.element == ATTR_ELEMENT_NONE) {
|
||||
/* No generated attribute, fall back to object coordinates. */
|
||||
float3 f = sd->P;
|
||||
if (sd->object != OBJECT_NONE) {
|
||||
object_inverse_position_transform(kg, sd, &f);
|
||||
}
|
||||
object_inverse_position_transform(kg, sd, &f);
|
||||
if (type == NODE_ATTR_OUTPUT_FLOAT) {
|
||||
stack_store_float(stack, out_offset, average(f));
|
||||
}
|
||||
@@ -181,9 +179,7 @@ ccl_device_noinline void svm_node_attr_bump_dx(KernelGlobals kg,
|
||||
if (node.y == ATTR_STD_GENERATED && desc.element == ATTR_ELEMENT_NONE) {
|
||||
/* No generated attribute, fall back to object coordinates. */
|
||||
float3 f = sd->P + sd->dP.dx;
|
||||
if (sd->object != OBJECT_NONE) {
|
||||
object_inverse_position_transform(kg, sd, &f);
|
||||
}
|
||||
object_inverse_position_transform(kg, sd, &f);
|
||||
if (type == NODE_ATTR_OUTPUT_FLOAT) {
|
||||
stack_store_float(stack, out_offset, average(f));
|
||||
}
|
||||
@@ -279,9 +275,7 @@ ccl_device_noinline void svm_node_attr_bump_dy(KernelGlobals kg,
|
||||
if (node.y == ATTR_STD_GENERATED && desc.element == ATTR_ELEMENT_NONE) {
|
||||
/* No generated attribute, fall back to object coordinates. */
|
||||
float3 f = sd->P + sd->dP.dy;
|
||||
if (sd->object != OBJECT_NONE) {
|
||||
object_inverse_position_transform(kg, sd, &f);
|
||||
}
|
||||
object_inverse_position_transform(kg, sd, &f);
|
||||
if (type == NODE_ATTR_OUTPUT_FLOAT) {
|
||||
stack_store_float(stack, out_offset, average(f));
|
||||
}
|
||||
|
@@ -742,7 +742,6 @@ NODE_DEFINE(AlembicProcedural)
|
||||
NodeType *type = NodeType::add("alembic", create);
|
||||
|
||||
SOCKET_STRING(filepath, "Filename", ustring());
|
||||
SOCKET_STRING_ARRAY(layers, "Layers", array<ustring>());
|
||||
SOCKET_FLOAT(frame, "Frame", 1.0f);
|
||||
SOCKET_FLOAT(start_frame, "Start Frame", 1.0f);
|
||||
SOCKET_FLOAT(end_frame, "End Frame", 1.0f);
|
||||
@@ -840,26 +839,14 @@ void AlembicProcedural::generate(Scene *scene, Progress &progress)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!archive.valid() || filepath_is_modified() || layers_is_modified()) {
|
||||
if (!archive.valid()) {
|
||||
Alembic::AbcCoreFactory::IFactory factory;
|
||||
factory.setPolicy(Alembic::Abc::ErrorHandler::kQuietNoopPolicy);
|
||||
|
||||
std::vector<std::string> filenames;
|
||||
filenames.push_back(filepath.c_str());
|
||||
|
||||
for (const ustring &layer : layers) {
|
||||
filenames.push_back(layer.c_str());
|
||||
}
|
||||
|
||||
/* We need to reverse the order as overriding archives should come first. */
|
||||
std::reverse(filenames.begin(), filenames.end());
|
||||
|
||||
archive = factory.getArchive(filenames);
|
||||
archive = factory.getArchive(filepath.c_str());
|
||||
|
||||
if (!archive.valid()) {
|
||||
/* avoid potential infinite update loops in viewport synchronization */
|
||||
filepath.clear();
|
||||
layers.clear();
|
||||
clear_modified();
|
||||
return;
|
||||
}
|
||||
@@ -1178,12 +1165,6 @@ void AlembicProcedural::read_subd(AlembicObject *abc_object, Abc::chrono_t frame
|
||||
cached_data.subd_creases_weight.copy_to_socket(
|
||||
frame_time, mesh, mesh->get_subd_creases_weight_socket());
|
||||
|
||||
cached_data.subd_vertex_crease_indices.copy_to_socket(
|
||||
frame_time, mesh, mesh->get_subd_vert_creases_socket());
|
||||
|
||||
cached_data.subd_vertex_crease_weights.copy_to_socket(
|
||||
frame_time, mesh, mesh->get_subd_vert_creases_weight_socket());
|
||||
|
||||
mesh->set_num_subd_faces(mesh->get_subd_shader().size());
|
||||
|
||||
/* Update attributes. */
|
||||
|
@@ -320,8 +320,6 @@ struct CachedData {
|
||||
DataStore<int> num_ngons;
|
||||
DataStore<array<int>> subd_creases_edge;
|
||||
DataStore<array<float>> subd_creases_weight;
|
||||
DataStore<array<int>> subd_vertex_crease_indices;
|
||||
DataStore<array<float>> subd_vertex_crease_weights;
|
||||
|
||||
/* hair data */
|
||||
DataStore<array<float3>> curve_keys;
|
||||
@@ -481,10 +479,6 @@ class AlembicProcedural : public Procedural {
|
||||
/* The file path to the Alembic archive */
|
||||
NODE_SOCKET_API(ustring, filepath)
|
||||
|
||||
/* Layers for the Alembic archive. Layers are in the order in which they override data, with the
|
||||
* latter elements overriding the former ones. */
|
||||
NODE_SOCKET_API_ARRAY(array<ustring>, layers)
|
||||
|
||||
/* The current frame to render. */
|
||||
NODE_SOCKET_API(float, frame)
|
||||
|
||||
|
@@ -478,9 +478,7 @@ static void add_subd_polygons(CachedData &cached_data, const SubDSchemaData &dat
|
||||
cached_data.uv_loops.add_data(uv_loops, time);
|
||||
}
|
||||
|
||||
static void add_subd_edge_creases(CachedData &cached_data,
|
||||
const SubDSchemaData &data,
|
||||
chrono_t time)
|
||||
static void add_subd_creases(CachedData &cached_data, const SubDSchemaData &data, chrono_t time)
|
||||
{
|
||||
if (!(data.crease_indices.valid() && data.crease_indices.valid() &&
|
||||
data.crease_sharpnesses.valid())) {
|
||||
@@ -519,37 +517,6 @@ static void add_subd_edge_creases(CachedData &cached_data,
|
||||
}
|
||||
}
|
||||
|
||||
static void add_subd_vertex_creases(CachedData &cached_data,
|
||||
const SubDSchemaData &data,
|
||||
chrono_t time)
|
||||
{
|
||||
if (!(data.corner_indices.valid() && data.crease_sharpnesses.valid())) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ISampleSelector iss = ISampleSelector(time);
|
||||
const Int32ArraySamplePtr creases_indices = data.crease_indices.getValue(iss);
|
||||
const FloatArraySamplePtr creases_sharpnesses = data.crease_sharpnesses.getValue(iss);
|
||||
|
||||
if (!(creases_indices && creases_sharpnesses) ||
|
||||
creases_indices->size() != creases_sharpnesses->size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
array<float> sharpnesses;
|
||||
sharpnesses.reserve(creases_indices->size());
|
||||
array<int> indices;
|
||||
indices.reserve(creases_indices->size());
|
||||
|
||||
for (size_t i = 0; i < creases_indices->size(); i++) {
|
||||
indices.push_back_reserved((*creases_indices)[i]);
|
||||
sharpnesses.push_back_reserved((*creases_sharpnesses)[i]);
|
||||
}
|
||||
|
||||
cached_data.subd_vertex_crease_indices.add_data(indices, time);
|
||||
cached_data.subd_vertex_crease_weights.add_data(sharpnesses, time);
|
||||
}
|
||||
|
||||
static void read_subd_geometry(CachedData &cached_data, const SubDSchemaData &data, chrono_t time)
|
||||
{
|
||||
const ISampleSelector iss = ISampleSelector(time);
|
||||
@@ -558,8 +525,7 @@ static void read_subd_geometry(CachedData &cached_data, const SubDSchemaData &da
|
||||
|
||||
if (data.topology_variance != kHomogenousTopology || cached_data.shader.size() == 0) {
|
||||
add_subd_polygons(cached_data, data, time);
|
||||
add_subd_edge_creases(cached_data, data, time);
|
||||
add_subd_vertex_creases(cached_data, data, time);
|
||||
add_subd_creases(cached_data, data, time);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -76,10 +76,9 @@ struct SubDSchemaData {
|
||||
|
||||
vector<FaceSetShaderIndexPair> shader_face_sets;
|
||||
|
||||
// Those are unsupported for now.
|
||||
Alembic::AbcGeom::IInt32ArrayProperty corner_indices;
|
||||
Alembic::AbcGeom::IFloatArrayProperty corner_sharpnesses;
|
||||
|
||||
// Those are unsupported for now.
|
||||
Alembic::AbcGeom::IInt32Property face_varying_interpolate_boundary;
|
||||
Alembic::AbcGeom::IInt32Property face_varying_propagate_corners;
|
||||
Alembic::AbcGeom::IInt32Property interpolate_boundary;
|
||||
|
@@ -263,9 +263,7 @@ template<typename T> inline void cast_from_float4(T *data, float4 value)
|
||||
|
||||
/* Slower versions for other all data types, which needs to convert to float and back. */
|
||||
template<typename T, bool compress_as_srgb = false>
|
||||
inline void processor_apply_pixels_rgba(const OCIO::Processor *processor,
|
||||
T *pixels,
|
||||
size_t num_pixels)
|
||||
inline void processor_apply_pixels(const OCIO::Processor *processor, T *pixels, size_t num_pixels)
|
||||
{
|
||||
/* TODO: implement faster version for when we know the conversion
|
||||
* is a simple matrix transform between linear spaces. In that case
|
||||
@@ -312,79 +310,25 @@ inline void processor_apply_pixels_rgba(const OCIO::Processor *processor,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, bool compress_as_srgb = false>
|
||||
inline void processor_apply_pixels_grayscale(const OCIO::Processor *processor,
|
||||
T *pixels,
|
||||
size_t num_pixels)
|
||||
{
|
||||
OCIO::ConstCPUProcessorRcPtr device_processor = processor->getDefaultCPUProcessor();
|
||||
|
||||
/* Process large images in chunks to keep temporary memory requirement down. */
|
||||
const size_t chunk_size = std::min((size_t)(16 * 1024 * 1024), num_pixels);
|
||||
vector<float> float_pixels(chunk_size * 3);
|
||||
|
||||
for (size_t j = 0; j < num_pixels; j += chunk_size) {
|
||||
size_t width = std::min(chunk_size, num_pixels - j);
|
||||
|
||||
/* Convert to 3 channels, since that's the minimum required by OpenColorIO. */
|
||||
{
|
||||
const T *pixel = pixels + j;
|
||||
float *fpixel = float_pixels.data();
|
||||
for (size_t i = 0; i < width; i++, pixel++, fpixel += 3) {
|
||||
const float f = util_image_cast_to_float<T>(*pixel);
|
||||
fpixel[0] = f;
|
||||
fpixel[1] = f;
|
||||
fpixel[2] = f;
|
||||
}
|
||||
}
|
||||
|
||||
OCIO::PackedImageDesc desc((float *)float_pixels.data(), width, 1, 3);
|
||||
device_processor->apply(desc);
|
||||
|
||||
{
|
||||
T *pixel = pixels + j;
|
||||
const float *fpixel = float_pixels.data();
|
||||
for (size_t i = 0; i < width; i++, pixel++, fpixel += 3) {
|
||||
float f = average(make_float3(fpixel[0], fpixel[1], fpixel[2]));
|
||||
if (compress_as_srgb) {
|
||||
f = color_linear_to_srgb(f);
|
||||
}
|
||||
*pixel = util_image_cast_from_float<T>(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
void ColorSpaceManager::to_scene_linear(
|
||||
ustring colorspace, T *pixels, size_t num_pixels, bool is_rgba, bool compress_as_srgb)
|
||||
void ColorSpaceManager::to_scene_linear(ustring colorspace,
|
||||
T *pixels,
|
||||
size_t num_pixels,
|
||||
bool compress_as_srgb)
|
||||
{
|
||||
#ifdef WITH_OCIO
|
||||
const OCIO::Processor *processor = (const OCIO::Processor *)get_processor(colorspace);
|
||||
|
||||
if (processor) {
|
||||
if (is_rgba) {
|
||||
if (compress_as_srgb) {
|
||||
/* Compress output as sRGB. */
|
||||
processor_apply_pixels_rgba<T, true>(processor, pixels, num_pixels);
|
||||
}
|
||||
else {
|
||||
/* Write output as scene linear directly. */
|
||||
processor_apply_pixels_rgba<T>(processor, pixels, num_pixels);
|
||||
}
|
||||
if (compress_as_srgb) {
|
||||
/* Compress output as sRGB. */
|
||||
processor_apply_pixels<T, true>(processor, pixels, num_pixels);
|
||||
}
|
||||
else {
|
||||
if (compress_as_srgb) {
|
||||
/* Compress output as sRGB. */
|
||||
processor_apply_pixels_grayscale<T, true>(processor, pixels, num_pixels);
|
||||
}
|
||||
else {
|
||||
/* Write output as scene linear directly. */
|
||||
processor_apply_pixels_grayscale<T>(processor, pixels, num_pixels);
|
||||
}
|
||||
/* Write output as scene linear directly. */
|
||||
processor_apply_pixels<T>(processor, pixels, num_pixels);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -404,11 +348,6 @@ void ColorSpaceManager::to_scene_linear(ColorSpaceProcessor *processor_,
|
||||
|
||||
if (processor) {
|
||||
OCIO::ConstCPUProcessorRcPtr device_processor = processor->getDefaultCPUProcessor();
|
||||
if (channels == 1) {
|
||||
float3 rgb = make_float3(pixel[0], pixel[0], pixel[0]);
|
||||
device_processor->applyRGB(&rgb.x);
|
||||
pixel[0] = average(rgb);
|
||||
}
|
||||
if (channels == 3) {
|
||||
device_processor->applyRGB(pixel);
|
||||
}
|
||||
@@ -451,9 +390,9 @@ void ColorSpaceManager::free_memory()
|
||||
}
|
||||
|
||||
/* Template instantiations so we don't have to inline functions. */
|
||||
template void ColorSpaceManager::to_scene_linear(ustring, uchar *, size_t, bool, bool);
|
||||
template void ColorSpaceManager::to_scene_linear(ustring, ushort *, size_t, bool, bool);
|
||||
template void ColorSpaceManager::to_scene_linear(ustring, half *, size_t, bool, bool);
|
||||
template void ColorSpaceManager::to_scene_linear(ustring, float *, size_t, bool, bool);
|
||||
template void ColorSpaceManager::to_scene_linear(ustring, uchar *, size_t, bool);
|
||||
template void ColorSpaceManager::to_scene_linear(ustring, ushort *, size_t, bool);
|
||||
template void ColorSpaceManager::to_scene_linear(ustring, half *, size_t, bool);
|
||||
template void ColorSpaceManager::to_scene_linear(ustring, float *, size_t, bool);
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
@@ -43,8 +43,10 @@ class ColorSpaceManager {
|
||||
/* Convert pixels in the specified colorspace to scene linear color for
|
||||
* rendering. Must be a colorspace returned from detect_known_colorspace. */
|
||||
template<typename T>
|
||||
static void to_scene_linear(
|
||||
ustring colorspace, T *pixels, size_t num_pixels, bool is_rgba, bool compress_as_srgb);
|
||||
static void to_scene_linear(ustring colorspace,
|
||||
T *pixels,
|
||||
size_t num_pixels,
|
||||
bool compress_as_srgb);
|
||||
|
||||
/* Efficiently convert pixels to scene linear colorspace at render time,
|
||||
* for OSL where the image texture cache contains original pixels. The
|
||||
|
@@ -441,13 +441,9 @@ void ConstantFolder::fold_mapping(NodeMappingType type) const
|
||||
if (is_zero(scale_in)) {
|
||||
make_zero();
|
||||
}
|
||||
else if (
|
||||
/* Can't constant fold since we always need to normalize the output. */
|
||||
(type != NODE_MAPPING_TYPE_NORMAL) &&
|
||||
/* Check all use values are zero, note location is not used by vector and normal types. */
|
||||
(is_zero(location_in) || type == NODE_MAPPING_TYPE_VECTOR ||
|
||||
type == NODE_MAPPING_TYPE_NORMAL) &&
|
||||
is_zero(rotation_in) && is_one(scale_in)) {
|
||||
else if ((is_zero(location_in) || type == NODE_MAPPING_TYPE_VECTOR ||
|
||||
type == NODE_MAPPING_TYPE_NORMAL) &&
|
||||
is_zero(rotation_in) && is_one(scale_in)) {
|
||||
try_bypass_or_make_constant(vector_in);
|
||||
}
|
||||
}
|
||||
|
@@ -576,13 +576,13 @@ bool ImageManager::file_load_image(Image *img, int texture_limit)
|
||||
pixels[i * 4 + 3] = one;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (img->metadata.colorspace != u_colorspace_raw &&
|
||||
img->metadata.colorspace != u_colorspace_srgb) {
|
||||
/* Convert to scene linear. */
|
||||
ColorSpaceManager::to_scene_linear(
|
||||
img->metadata.colorspace, pixels, num_pixels, is_rgba, img->metadata.compress_as_srgb);
|
||||
if (img->metadata.colorspace != u_colorspace_raw &&
|
||||
img->metadata.colorspace != u_colorspace_srgb) {
|
||||
/* Convert to scene linear. */
|
||||
ColorSpaceManager::to_scene_linear(
|
||||
img->metadata.colorspace, pixels, num_pixels, img->metadata.compress_as_srgb);
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure we don't have buggy values. */
|
||||
@@ -891,10 +891,6 @@ void ImageManager::device_free(Device *device)
|
||||
void ImageManager::collect_statistics(RenderStats *stats)
|
||||
{
|
||||
foreach (const Image *image, images) {
|
||||
if (!image) {
|
||||
/* Image may have been freed due to lack of users. */
|
||||
continue;
|
||||
}
|
||||
stats->image.textures.add_entry(
|
||||
NamedSizeEntry(image->loader->name(), image->mem->memory_size()));
|
||||
}
|
||||
|
@@ -141,9 +141,6 @@ NODE_DEFINE(Mesh)
|
||||
subdivision_type_enum.insert("catmull_clark", SUBDIVISION_CATMULL_CLARK);
|
||||
SOCKET_ENUM(subdivision_type, "Subdivision Type", subdivision_type_enum, SUBDIVISION_NONE);
|
||||
|
||||
SOCKET_INT_ARRAY(subd_vert_creases, "Subdivision Vertex Crease", array<int>());
|
||||
SOCKET_FLOAT_ARRAY(
|
||||
subd_vert_creases_weight, "Subdivision Vertex Crease Weights", array<float>());
|
||||
SOCKET_INT_ARRAY(subd_creases_edge, "Subdivision Crease Edges", array<int>());
|
||||
SOCKET_FLOAT_ARRAY(subd_creases_weight, "Subdivision Crease Weights", array<float>());
|
||||
SOCKET_INT_ARRAY(subd_face_corners, "Subdivision Face Corners", array<int>());
|
||||
@@ -411,7 +408,7 @@ Mesh::SubdFace Mesh::get_subd_face(size_t index) const
|
||||
return s;
|
||||
}
|
||||
|
||||
void Mesh::add_edge_crease(int v0, int v1, float weight)
|
||||
void Mesh::add_crease(int v0, int v1, float weight)
|
||||
{
|
||||
subd_creases_edge.push_back_slow(v0);
|
||||
subd_creases_edge.push_back_slow(v1);
|
||||
@@ -422,17 +419,6 @@ void Mesh::add_edge_crease(int v0, int v1, float weight)
|
||||
tag_subd_creases_weight_modified();
|
||||
}
|
||||
|
||||
void Mesh::add_vertex_crease(int v, float weight)
|
||||
{
|
||||
assert(v < verts.size());
|
||||
|
||||
subd_vert_creases.push_back_slow(v);
|
||||
subd_vert_creases_weight.push_back_slow(weight);
|
||||
|
||||
tag_subd_vert_creases_modified();
|
||||
tag_subd_vert_creases_weight_modified();
|
||||
}
|
||||
|
||||
void Mesh::copy_center_to_motion_step(const int motion_step)
|
||||
{
|
||||
Attribute *attr_mP = attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
|
||||
|
@@ -160,9 +160,6 @@ class Mesh : public Geometry {
|
||||
NODE_SOCKET_API_ARRAY(array<int>, subd_creases_edge)
|
||||
NODE_SOCKET_API_ARRAY(array<float>, subd_creases_weight)
|
||||
|
||||
NODE_SOCKET_API_ARRAY(array<int>, subd_vert_creases)
|
||||
NODE_SOCKET_API_ARRAY(array<float>, subd_vert_creases_weight)
|
||||
|
||||
/* Subdivisions parameters */
|
||||
NODE_SOCKET_API(float, subd_dicing_rate)
|
||||
NODE_SOCKET_API(int, subd_max_level)
|
||||
@@ -213,8 +210,7 @@ class Mesh : public Geometry {
|
||||
void add_vertex_slow(float3 P);
|
||||
void add_triangle(int v0, int v1, int v2, int shader, bool smooth);
|
||||
void add_subd_face(int *corners, int num_corners, int shader_, bool smooth_);
|
||||
void add_edge_crease(int v0, int v1, float weight);
|
||||
void add_vertex_crease(int v, float weight);
|
||||
void add_crease(int v0, int v1, float weight);
|
||||
|
||||
void copy_center_to_motion_step(const int motion_step);
|
||||
|
||||
|
@@ -82,54 +82,24 @@ template<>
|
||||
bool TopologyRefinerFactory<ccl::Mesh>::assignComponentTags(TopologyRefiner &refiner,
|
||||
ccl::Mesh const &mesh)
|
||||
{
|
||||
/* Historical maximum crease weight used at Pixar, influencing the maximum in OpenSubDiv. */
|
||||
static constexpr float CREASE_SCALE = 10.0f;
|
||||
|
||||
size_t num_creases = mesh.get_subd_creases_weight().size();
|
||||
size_t num_vertex_creases = mesh.get_subd_vert_creases().size();
|
||||
|
||||
/* The last loop is over the vertices, so early exit to avoid iterating them needlessly. */
|
||||
if (num_creases == 0 && num_vertex_creases == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_creases; i++) {
|
||||
ccl::Mesh::SubdEdgeCrease crease = mesh.get_subd_crease(i);
|
||||
Index edge = findBaseEdge(refiner, crease.v[0], crease.v[1]);
|
||||
|
||||
if (edge != INDEX_INVALID) {
|
||||
setBaseEdgeSharpness(refiner, edge, crease.crease * CREASE_SCALE);
|
||||
setBaseEdgeSharpness(refiner, edge, crease.crease * 10.0f);
|
||||
}
|
||||
}
|
||||
|
||||
std::map<int, float> vertex_creases;
|
||||
|
||||
for (size_t i = 0; i < num_vertex_creases; ++i) {
|
||||
const int vertex_idx = mesh.get_subd_vert_creases()[i];
|
||||
const float weight = mesh.get_subd_vert_creases_weight()[i];
|
||||
|
||||
vertex_creases[vertex_idx] = weight * CREASE_SCALE;
|
||||
}
|
||||
|
||||
for (int i = 0; i < mesh.get_verts().size(); i++) {
|
||||
float sharpness = 0.0f;
|
||||
std::map<int, float>::const_iterator iter = vertex_creases.find(i);
|
||||
|
||||
if (iter != vertex_creases.end()) {
|
||||
sharpness = iter->second;
|
||||
}
|
||||
|
||||
ConstIndexArray vert_edges = getBaseVertexEdges(refiner, i);
|
||||
|
||||
if (vert_edges.size() == 2) {
|
||||
const float sharpness0 = refiner.getLevel(0).getEdgeSharpness(vert_edges[0]);
|
||||
const float sharpness1 = refiner.getLevel(0).getEdgeSharpness(vert_edges[1]);
|
||||
float sharpness = refiner.getLevel(0).getEdgeSharpness(vert_edges[0]);
|
||||
sharpness = ccl::min(sharpness, refiner.getLevel(0).getEdgeSharpness(vert_edges[1]));
|
||||
|
||||
sharpness += ccl::min(sharpness0, sharpness1);
|
||||
sharpness = ccl::min(sharpness, CREASE_SCALE);
|
||||
}
|
||||
|
||||
if (sharpness != 0.0f) {
|
||||
setBaseVertexSharpness(refiner, i, sharpness);
|
||||
}
|
||||
}
|
||||
|
@@ -428,7 +428,7 @@ void Session::do_delayed_reset()
|
||||
|
||||
/* Update temp directory on reset.
|
||||
* This potentially allows to finish the existing rendering with a previously configure temporary
|
||||
* directory in the host software and switch to a new temp directory when new render starts. */
|
||||
* direcotry in the host software and switch to a new temp directory when new render starts. */
|
||||
tile_manager_.set_temp_dir(params.temp_dir);
|
||||
|
||||
/* Progress. */
|
||||
|
@@ -38,6 +38,8 @@ set(ALL_CYCLES_LIBRARIES
|
||||
)
|
||||
include_directories(${INC})
|
||||
|
||||
cycles_link_directories()
|
||||
|
||||
set(SRC
|
||||
integrator_adaptive_sampling_test.cpp
|
||||
integrator_render_scheduler_test.cpp
|
||||
|
@@ -64,7 +64,7 @@ template<typename T, size_t alignment = MIN_ALIGNMENT_CPU_DATA_TYPES> class arra
|
||||
else {
|
||||
data_ = mem_allocate(from.datasize_);
|
||||
if (from.datasize_ > 0) {
|
||||
mem_copy(data_, from.data_, from.datasize_);
|
||||
memcpy(data_, from.data_, from.datasize_ * sizeof(T));
|
||||
}
|
||||
datasize_ = from.datasize_;
|
||||
capacity_ = datasize_;
|
||||
@@ -76,7 +76,7 @@ template<typename T, size_t alignment = MIN_ALIGNMENT_CPU_DATA_TYPES> class arra
|
||||
if (this != &from) {
|
||||
resize(from.size());
|
||||
if (datasize_ > 0) {
|
||||
mem_copy(data_, from.data_, datasize_);
|
||||
memcpy((void *)data_, from.data_, datasize_ * sizeof(T));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ template<typename T, size_t alignment = MIN_ALIGNMENT_CPU_DATA_TYPES> class arra
|
||||
resize(from.size());
|
||||
|
||||
if (from.size() > 0 && datasize_ > 0) {
|
||||
mem_copy(data_, from.data(), datasize_);
|
||||
memcpy(data_, &from[0], datasize_ * sizeof(T));
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -161,7 +161,8 @@ template<typename T, size_t alignment = MIN_ALIGNMENT_CPU_DATA_TYPES> class arra
|
||||
return NULL;
|
||||
}
|
||||
else if (data_ != NULL) {
|
||||
mem_copy(newdata, data_, ((datasize_ < newsize) ? datasize_ : newsize));
|
||||
memcpy(
|
||||
(void *)newdata, data_, ((datasize_ < newsize) ? datasize_ : newsize) * sizeof(T));
|
||||
mem_free(data_, capacity_);
|
||||
}
|
||||
data_ = newdata;
|
||||
@@ -245,7 +246,7 @@ template<typename T, size_t alignment = MIN_ALIGNMENT_CPU_DATA_TYPES> class arra
|
||||
if (newcapacity > capacity_) {
|
||||
T *newdata = mem_allocate(newcapacity);
|
||||
if (data_ != NULL) {
|
||||
mem_copy(newdata, data_, ((datasize_ < newcapacity) ? datasize_ : newcapacity));
|
||||
memcpy(newdata, data_, ((datasize_ < newcapacity) ? datasize_ : newcapacity) * sizeof(T));
|
||||
mem_free(data_, capacity_);
|
||||
}
|
||||
data_ = newdata;
|
||||
@@ -279,7 +280,7 @@ template<typename T, size_t alignment = MIN_ALIGNMENT_CPU_DATA_TYPES> class arra
|
||||
if (from.size()) {
|
||||
size_t old_size = size();
|
||||
resize(old_size + from.size());
|
||||
mem_copy(data_ + old_size, from.data(), from.size());
|
||||
memcpy(data_ + old_size, from.data(), sizeof(T) * from.size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,11 +308,6 @@ template<typename T, size_t alignment = MIN_ALIGNMENT_CPU_DATA_TYPES> class arra
|
||||
}
|
||||
}
|
||||
|
||||
inline void mem_copy(T *mem_to, const T *mem_from, const size_t N)
|
||||
{
|
||||
memcpy((void *)mem_to, mem_from, sizeof(T) * N);
|
||||
}
|
||||
|
||||
T *data_;
|
||||
size_t datasize_;
|
||||
size_t capacity_;
|
||||
|
@@ -131,7 +131,10 @@ ccl_device_inline int4 clamp(const int4 &a, const int4 &mn, const int4 &mx)
|
||||
ccl_device_inline int4 select(const int4 &mask, const int4 &a, const int4 &b)
|
||||
{
|
||||
# ifdef __KERNEL_SSE__
|
||||
return int4(_mm_or_si128(_mm_and_si128(mask, a), _mm_andnot_si128(mask, b)));
|
||||
const __m128 m = _mm_cvtepi32_ps(mask);
|
||||
/* TODO(sergey): avoid cvt. */
|
||||
return int4(_mm_castps_si128(
|
||||
_mm_or_ps(_mm_and_ps(m, _mm_castsi128_ps(a)), _mm_andnot_ps(m, _mm_castsi128_ps(b)))));
|
||||
# else
|
||||
return make_int4(
|
||||
(mask.x) ? a.x : b.x, (mask.y) ? a.y : b.y, (mask.z) ? a.z : b.z, (mask.w) ? a.w : b.w);
|
||||
|
@@ -109,10 +109,9 @@ void TaskScheduler::free_memory()
|
||||
assert(users == 0);
|
||||
}
|
||||
|
||||
int TaskScheduler::max_concurrency()
|
||||
int TaskScheduler::num_threads()
|
||||
{
|
||||
thread_scoped_lock lock(mutex);
|
||||
return (users > 0) ? active_num_threads : tbb::this_task_arena::max_concurrency();
|
||||
return active_num_threads;
|
||||
}
|
||||
|
||||
/* Dedicated Task Pool */
|
||||
|
@@ -86,9 +86,10 @@ class TaskScheduler {
|
||||
static void exit();
|
||||
static void free_memory();
|
||||
|
||||
/* Maximum number of threads that will work on task. Use as little as
|
||||
* possible and leave scheduling and splitting up tasks to the scheduler. */
|
||||
static int max_concurrency();
|
||||
/* Approximate number of threads that will work on task, which may be lower
|
||||
* or higher than the actual number of threads. Use as little as possible and
|
||||
* leave splitting up tasks to the scheduler. */
|
||||
static int num_threads();
|
||||
|
||||
protected:
|
||||
static thread_mutex mutex;
|
||||
|
@@ -544,7 +544,7 @@ void GHOST_WindowX11::refreshXInputDevices()
|
||||
std::vector<XEventClass> xevents;
|
||||
|
||||
for (GHOST_SystemX11::GHOST_TabletX11 &xtablet : m_system->GetXTablets()) {
|
||||
/* With modern XInput (XLIB 1.6.2 at least and/or EVDEV 2.9.0) and some 'no-name' tablets
|
||||
/* With modern XInput (xlib 1.6.2 at least and/or evdev 2.9.0) and some 'no-name' tablets
|
||||
* like 'UC-LOGIC Tablet WP5540U', we also need to 'select' ButtonPress for motion event,
|
||||
* otherwise we do not get any tablet motion event once pen is pressed... See T43367.
|
||||
*/
|
||||
|
@@ -130,7 +130,8 @@ GHOST_Wintab *GHOST_Wintab::loadWintab(HWND hwnd)
|
||||
}
|
||||
}
|
||||
|
||||
return new GHOST_Wintab(std::move(handle),
|
||||
return new GHOST_Wintab(hwnd,
|
||||
std::move(handle),
|
||||
info,
|
||||
get,
|
||||
set,
|
||||
@@ -173,7 +174,8 @@ void GHOST_Wintab::extractCoordinates(LOGCONTEXT &lc, Coord &tablet, Coord &syst
|
||||
system.y.ext = -lc.lcSysExtY;
|
||||
}
|
||||
|
||||
GHOST_Wintab::GHOST_Wintab(unique_hmodule handle,
|
||||
GHOST_Wintab::GHOST_Wintab(HWND hwnd,
|
||||
unique_hmodule handle,
|
||||
GHOST_WIN32_WTInfo info,
|
||||
GHOST_WIN32_WTGet get,
|
||||
GHOST_WIN32_WTSet set,
|
||||
|
@@ -214,7 +214,8 @@ class GHOST_Wintab {
|
||||
/** Most recently received tablet data, or none if pen is not in range. */
|
||||
GHOST_TabletData m_lastTabletData = GHOST_TABLET_DATA_NONE;
|
||||
|
||||
GHOST_Wintab(unique_hmodule handle,
|
||||
GHOST_Wintab(HWND hwnd,
|
||||
unique_hmodule handle,
|
||||
GHOST_WIN32_WTInfo info,
|
||||
GHOST_WIN32_WTGet get,
|
||||
GHOST_WIN32_WTSet set,
|
||||
|
@@ -292,7 +292,7 @@ target_link_libraries(multitest_c
|
||||
guardedalloc_lib
|
||||
wcwidth_lib
|
||||
${OPENGL_gl_LIBRARY}
|
||||
${FREETYPE_LIBRARIES}
|
||||
${FREETYPE_LIBRARY}
|
||||
${ZLIB_LIBRARIES}
|
||||
${CMAKE_DL_LIBS}
|
||||
${PLATFORM_LINKLIBS}
|
||||
|
@@ -38,6 +38,8 @@ set(LIB
|
||||
)
|
||||
|
||||
if(WITH_LIBMV)
|
||||
setup_libdirs()
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-D_USE_MATH_DEFINES)
|
||||
endif()
|
||||
|
@@ -118,6 +118,8 @@ set(LIB
|
||||
)
|
||||
|
||||
if(WITH_LIBMV)
|
||||
setup_libdirs()
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-D_USE_MATH_DEFINES)
|
||||
endif()
|
||||
|
@@ -642,7 +642,7 @@ bool OCIOImpl::gpuDisplayShaderBind(OCIO_ConstConfigRcPtr *config,
|
||||
}
|
||||
|
||||
/* Bind textures to sampler units. Texture 0 is set by caller.
|
||||
* Uniforms have already been set for texture bind points. */
|
||||
* Uniforms have already been set for texture bind points.*/
|
||||
if (!use_overlay) {
|
||||
/* Avoid missing binds. */
|
||||
GPU_texture_bind(textures.dummy, TEXTURE_SLOT_OVERLAY);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13</string>
|
||||
<string>10.9.0</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
Submodule release/datafiles/locale updated: 620b85f16d...d46eacffd9
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 556 KiB |
Submodule release/scripts/addons updated: 6afec05c32...880efe429a
@@ -100,19 +100,6 @@ class Texture(bpy_types.ID):
|
||||
class Collection(bpy_types.ID):
|
||||
__slots__ = ()
|
||||
|
||||
@property
|
||||
def children_recursive(self):
|
||||
"""A list of all children from this collection."""
|
||||
children_recursive = []
|
||||
|
||||
def recurse(parent):
|
||||
for child in parent.children:
|
||||
children_recursive.append(child)
|
||||
recurse(child)
|
||||
|
||||
recurse(self)
|
||||
return children_recursive
|
||||
|
||||
@property
|
||||
def users_dupli_group(self):
|
||||
"""The collection instance objects this collection is used in"""
|
||||
@@ -133,27 +120,6 @@ class Object(bpy_types.ID):
|
||||
return tuple(child for child in bpy.data.objects
|
||||
if child.parent == self)
|
||||
|
||||
@property
|
||||
def children_recursive(self):
|
||||
"""A list of all children from this object.
|
||||
|
||||
.. note:: Takes ``O(len(bpy.data.objects))`` time."""
|
||||
import bpy
|
||||
parent_child_map = {}
|
||||
for child in bpy.data.objects:
|
||||
if (parent := child.parent) is not None:
|
||||
parent_child_map.setdefault(parent, []).append(child)
|
||||
|
||||
children_recursive = []
|
||||
|
||||
def recurse(parent):
|
||||
for child in parent_child_map.get(parent, ()):
|
||||
children_recursive.append(child)
|
||||
recurse(child)
|
||||
|
||||
recurse(self)
|
||||
return children_recursive
|
||||
|
||||
@property
|
||||
def users_collection(self):
|
||||
"""
|
||||
|
@@ -245,7 +245,7 @@ def RKS_GEN_custom_props(_ksi, _context, ks, data):
|
||||
# Can technically happen, but there is no known case.
|
||||
continue
|
||||
if rna_property is None:
|
||||
# In this case the property cannot be converted to an
|
||||
# In this case the property cannot be converted to an
|
||||
# FCurve-compatible value, so we can't keyframe it anyways.
|
||||
continue
|
||||
if rna_property.rna_type not in prop_type_compat:
|
||||
|
@@ -6267,8 +6267,7 @@ def km_image_editor_tool_uv_select(params, *, fallback):
|
||||
_fallback_id("Image Editor Tool: Uv, Tweak", fallback),
|
||||
{"space_type": 'IMAGE_EDITOR', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
*([] if (fallback and (params.select_mouse == 'RIGHTMOUSE')) else _template_items_tool_select(
|
||||
params, "uv.select", "uv.cursor_set", extend="extend")),
|
||||
*([] if fallback else _template_items_tool_select(params, "uv.select", "uv.cursor_set", extend="extend")),
|
||||
*([] if (not params.use_fallback_tool_rmb) else _template_uv_select(
|
||||
type=params.select_mouse, value=params.select_mouse_value, legacy=params.legacy)),
|
||||
]},
|
||||
@@ -6386,7 +6385,7 @@ def km_node_editor_tool_select(params, *, fallback):
|
||||
_fallback_id("Node Tool: Tweak", fallback),
|
||||
{"space_type": 'NODE_EDITOR', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
*([] if (fallback and (params.select_mouse == 'RIGHTMOUSE')) else [
|
||||
*([] if fallback else [
|
||||
("node.select", {"type": params.select_mouse, "value": 'PRESS'},
|
||||
{"properties": [("deselect_all", not params.legacy)]}),
|
||||
]),
|
||||
@@ -6468,7 +6467,7 @@ def km_3d_view_tool_select(params, *, fallback):
|
||||
_fallback_id("3D View Tool: Tweak", fallback),
|
||||
{"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
*([] if (fallback and (params.select_mouse == 'RIGHTMOUSE')) else _template_items_tool_select(
|
||||
*([] if fallback else _template_items_tool_select(
|
||||
params, "view3d.select", "view3d.cursor3d", extend="toggle")),
|
||||
*([] if (not params.use_fallback_tool_rmb) else _template_view3d_select(
|
||||
type=params.select_mouse, value=params.select_mouse_value, legacy=params.legacy)),
|
||||
@@ -7378,7 +7377,7 @@ def km_3d_view_tool_edit_gpencil_select(params, *, fallback):
|
||||
_fallback_id("3D View Tool: Edit Gpencil, Tweak", fallback),
|
||||
{"space_type": 'VIEW_3D', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
*([] if (fallback and (params.select_mouse == 'RIGHTMOUSE')) else _template_items_tool_select(
|
||||
*([] if fallback else _template_items_tool_select(
|
||||
params, "gpencil.select", "view3d.cursor3d", extend="toggle")),
|
||||
*([] if (not params.use_fallback_tool_rmb) else _template_view3d_gpencil_select(
|
||||
type=params.select_mouse, value=params.select_mouse_value, legacy=params.legacy)),
|
||||
@@ -7554,7 +7553,7 @@ def km_sequencer_editor_tool_generic_select(params, *, fallback):
|
||||
_fallback_id("Sequencer Tool: Tweak", fallback),
|
||||
{"space_type": 'SEQUENCE_EDITOR', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
*([] if (fallback and (params.select_mouse == 'RIGHTMOUSE')) else _template_items_tool_select(
|
||||
*([] if fallback else _template_items_tool_select(
|
||||
params, "sequencer.select", "sequencer.cursor_set", extend="toggle")),
|
||||
|
||||
*([] if (not params.use_fallback_tool_rmb) else _template_sequencer_preview_select(
|
||||
|
@@ -2467,22 +2467,18 @@ class WM_OT_batch_rename(Operator):
|
||||
name="Type",
|
||||
items=(
|
||||
('OBJECT', "Objects", ""),
|
||||
('COLLECTION', "Collections", ""),
|
||||
('MATERIAL', "Materials", ""),
|
||||
None,
|
||||
# Enum identifiers are compared with 'object.type'.
|
||||
# Follow order in "Add" menu.
|
||||
('MESH', "Meshes", ""),
|
||||
('CURVE', "Curves", ""),
|
||||
('META', "Metaballs", ""),
|
||||
('VOLUME', "Volumes", ""),
|
||||
('GPENCIL', "Grease Pencils", ""),
|
||||
('ARMATURE', "Armatures", ""),
|
||||
('LATTICE', "Lattices", ""),
|
||||
('LIGHT', "Light", ""),
|
||||
('LIGHT_PROBE', "Light Probes", ""),
|
||||
('GPENCIL', "Grease Pencils", ""),
|
||||
('CAMERA', "Cameras", ""),
|
||||
('SPEAKER', "Speakers", ""),
|
||||
('LIGHT_PROBE', "Light Probes", ""),
|
||||
None,
|
||||
('BONE', "Bones", ""),
|
||||
('NODE', "Nodes", ""),
|
||||
@@ -2502,26 +2498,7 @@ class WM_OT_batch_rename(Operator):
|
||||
actions: CollectionProperty(type=BatchRenameAction)
|
||||
|
||||
@staticmethod
|
||||
def _selected_ids_from_outliner_by_type(context, ty):
|
||||
return [
|
||||
id for id in context.selected_ids
|
||||
if isinstance(id, ty)
|
||||
if id.library is None
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def _selected_ids_from_outliner_by_type_for_object_data(context, ty):
|
||||
# Include selected object-data as well as the selected ID's.
|
||||
from bpy.types import Object
|
||||
# De-duplicate the result as object-data may cause duplicates.
|
||||
return tuple(set([
|
||||
id for id_base in context.selected_ids
|
||||
if isinstance(id := id_base.data if isinstance(id_base, Object) else id_base, ty)
|
||||
if id.library is None
|
||||
]))
|
||||
|
||||
@classmethod
|
||||
def _data_from_context(cls, context, data_type, only_selected, *, check_context=False):
|
||||
def _data_from_context(context, data_type, only_selected, *, check_context=False):
|
||||
|
||||
mode = context.mode
|
||||
scene = context.scene
|
||||
@@ -2535,9 +2512,10 @@ class WM_OT_batch_rename(Operator):
|
||||
return data_type_test
|
||||
if data_type == data_type_test:
|
||||
data = (
|
||||
context.selected_sequences
|
||||
# TODO, we don't have access to seqbasep, this won't work when inside metas.
|
||||
[seq for seq in context.scene.sequence_editor.sequences_all if seq.select]
|
||||
if only_selected else
|
||||
scene.sequence_editor.sequences_all,
|
||||
context.scene.sequence_editor.sequences_all,
|
||||
"name",
|
||||
"Strip(s)",
|
||||
)
|
||||
@@ -2553,18 +2531,6 @@ class WM_OT_batch_rename(Operator):
|
||||
"name",
|
||||
"Node(s)",
|
||||
)
|
||||
elif space_type == 'OUTLINER':
|
||||
data_type_test = 'COLLECTION'
|
||||
if check_context:
|
||||
return data_type_test
|
||||
if data_type == data_type_test:
|
||||
data = (
|
||||
cls._selected_ids_from_outliner_by_type(context, bpy.types.Collection)
|
||||
if only_selected else
|
||||
scene.collection.children_recursive,
|
||||
"name",
|
||||
"Collection(s)",
|
||||
)
|
||||
else:
|
||||
if mode == 'POSE' or (mode == 'WEIGHT_PAINT' and context.pose_object):
|
||||
data_type_test = 'BONE'
|
||||
@@ -2595,17 +2561,15 @@ class WM_OT_batch_rename(Operator):
|
||||
return 'OBJECT'
|
||||
|
||||
object_data_type_attrs_map = {
|
||||
'MESH': ("meshes", "Mesh(es)", bpy.types.Mesh),
|
||||
'CURVE': ("curves", "Curve(s)", bpy.types.Curve),
|
||||
'META': ("metaballs", "Metaball(s)", bpy.types.MetaBall),
|
||||
'VOLUME': ("volumes", "Volume(s)", bpy.types.Volume),
|
||||
'GPENCIL': ("grease_pencils", "Grease Pencil(s)", bpy.types.GreasePencil),
|
||||
'ARMATURE': ("armatures", "Armature(s)", bpy.types.Armature),
|
||||
'LATTICE': ("lattices", "Lattice(s)", bpy.types.Lattice),
|
||||
'LIGHT': ("lights", "Light(s)", bpy.types.Light),
|
||||
'LIGHT_PROBE': ("light_probes", "Light Probe(s)", bpy.types.LightProbe),
|
||||
'CAMERA': ("cameras", "Camera(s)", bpy.types.Camera),
|
||||
'SPEAKER': ("speakers", "Speaker(s)", bpy.types.Speaker),
|
||||
'MESH': ("meshes", "Mesh(es)"),
|
||||
'CURVE': ("curves", "Curve(s)"),
|
||||
'META': ("metaballs", "Metaball(s)"),
|
||||
'ARMATURE': ("armatures", "Armature(s)"),
|
||||
'LATTICE': ("lattices", "Lattice(s)"),
|
||||
'GPENCIL': ("grease_pencils", "Grease Pencil(s)"),
|
||||
'CAMERA': ("cameras", "Camera(s)"),
|
||||
'SPEAKER': ("speakers", "Speaker(s)"),
|
||||
'LIGHT_PROBE': ("light_probes", "Light Probe(s)"),
|
||||
}
|
||||
|
||||
# Finish with space types.
|
||||
@@ -2613,67 +2577,34 @@ class WM_OT_batch_rename(Operator):
|
||||
|
||||
if data_type == 'OBJECT':
|
||||
data = (
|
||||
(
|
||||
# Outliner.
|
||||
cls._selected_ids_from_outliner_by_type(context, bpy.types.Object)
|
||||
if space_type == 'OUTLINER' else
|
||||
# 3D View (default).
|
||||
context.selected_editable_objects
|
||||
)
|
||||
context.selected_editable_objects
|
||||
if only_selected else
|
||||
[id for id in bpy.data.objects if id.library is None],
|
||||
"name",
|
||||
"Object(s)",
|
||||
)
|
||||
elif data_type == 'COLLECTION':
|
||||
data = (
|
||||
# Outliner case is handled already.
|
||||
tuple(set(
|
||||
ob.instance_collection
|
||||
for ob in context.selected_objects
|
||||
if ((ob.instance_type == 'COLLECTION') and
|
||||
(collection := ob.instance_collection) is not None and
|
||||
(collection.library is None))
|
||||
))
|
||||
if only_selected else
|
||||
[id for id in bpy.data.collections if id.library is None],
|
||||
"name",
|
||||
"Collection(s)",
|
||||
)
|
||||
elif data_type == 'MATERIAL':
|
||||
data = (
|
||||
(
|
||||
# Outliner.
|
||||
cls._selected_ids_from_outliner_by_type(context, bpy.types.Material)
|
||||
if space_type == 'OUTLINER' else
|
||||
# 3D View (default).
|
||||
tuple(set(
|
||||
id
|
||||
for ob in context.selected_objects
|
||||
for slot in ob.material_slots
|
||||
if (id := slot.material) is not None and id.library is None
|
||||
))
|
||||
)
|
||||
tuple(set(
|
||||
slot.material
|
||||
for ob in context.selected_objects
|
||||
for slot in ob.material_slots
|
||||
if slot.material is not None
|
||||
))
|
||||
if only_selected else
|
||||
[id for id in bpy.data.materials if id.library is None],
|
||||
"name",
|
||||
"Material(s)",
|
||||
)
|
||||
elif data_type in object_data_type_attrs_map.keys():
|
||||
attr, descr, ty = object_data_type_attrs_map[data_type]
|
||||
attr, descr = object_data_type_attrs_map[data_type]
|
||||
data = (
|
||||
(
|
||||
# Outliner.
|
||||
cls._selected_ids_from_outliner_by_type_for_object_data(context, ty)
|
||||
if space_type == 'OUTLINER' else
|
||||
# 3D View (default).
|
||||
tuple(set(
|
||||
id
|
||||
for ob in context.selected_objects
|
||||
if ob.type == data_type
|
||||
if (id := ob.data) is not None and id.library is None
|
||||
))
|
||||
)
|
||||
tuple(set(
|
||||
id
|
||||
for ob in context.selected_objects
|
||||
if ob.type == data_type
|
||||
if (id := ob.data) is not None and id.library is None
|
||||
))
|
||||
if only_selected else
|
||||
[id for id in getattr(bpy.data, attr) if id.library is None],
|
||||
"name",
|
||||
|
@@ -1161,11 +1161,6 @@ class ConstraintButtonsSubPanel:
|
||||
context, self.layout.template_cache_file_time_settings
|
||||
)
|
||||
|
||||
def draw_transform_cache_layers(self, context):
|
||||
self.draw_transform_cache_subpanel(
|
||||
context, self.layout.template_cache_file_layers
|
||||
)
|
||||
|
||||
def draw_transform_cache_subpanel(self, context, template_func):
|
||||
con = self.get_constraint(context)
|
||||
if con.cache_file is None:
|
||||
@@ -1579,22 +1574,6 @@ class BONE_PT_bTransformCacheConstraint_velocity(BoneConstraintPanel, Constraint
|
||||
self.draw_transform_cache_velocity(context)
|
||||
|
||||
|
||||
class OBJECT_PT_bTransformCacheConstraint_layers(ObjectConstraintPanel, ConstraintButtonsSubPanel, Panel):
|
||||
bl_parent_id = "OBJECT_PT_bTransformCacheConstraint"
|
||||
bl_label = "Override Layers"
|
||||
|
||||
def draw(self, context):
|
||||
self.draw_transform_cache_layers(context)
|
||||
|
||||
|
||||
class BONE_PT_bTransformCacheConstraint_layers(BoneConstraintPanel, ConstraintButtonsSubPanel, Panel):
|
||||
bl_parent_id = "BONE_PT_bTransformCacheConstraint"
|
||||
bl_label = "Override Layers"
|
||||
|
||||
def draw(self, context):
|
||||
self.draw_transform_cache_layers(context)
|
||||
|
||||
|
||||
class OBJECT_PT_bTransformCacheConstraint_procedural(ObjectConstraintPanel, ConstraintButtonsSubPanel, Panel):
|
||||
bl_parent_id = "OBJECT_PT_bTransformCacheConstraint"
|
||||
bl_label = "Render Procedural"
|
||||
@@ -1716,7 +1695,6 @@ classes = (
|
||||
OBJECT_PT_bTransformCacheConstraint_time,
|
||||
OBJECT_PT_bTransformCacheConstraint_procedural,
|
||||
OBJECT_PT_bTransformCacheConstraint_velocity,
|
||||
OBJECT_PT_bTransformCacheConstraint_layers,
|
||||
OBJECT_PT_bPythonConstraint,
|
||||
OBJECT_PT_bArmatureConstraint,
|
||||
OBJECT_PT_bArmatureConstraint_bones,
|
||||
@@ -1757,7 +1735,6 @@ classes = (
|
||||
BONE_PT_bTransformCacheConstraint_time,
|
||||
BONE_PT_bTransformCacheConstraint_procedural,
|
||||
BONE_PT_bTransformCacheConstraint_velocity,
|
||||
BONE_PT_bTransformCacheConstraint_layers,
|
||||
BONE_PT_bPythonConstraint,
|
||||
BONE_PT_bArmatureConstraint,
|
||||
BONE_PT_bArmatureConstraint_bones,
|
||||
|
@@ -82,14 +82,6 @@ class MESH_MT_shape_key_context_menu(Menu):
|
||||
layout.operator("object.shape_key_move", icon='TRIA_UP_BAR', text="Move to Top").type = 'TOP'
|
||||
layout.operator("object.shape_key_move", icon='TRIA_DOWN_BAR', text="Move to Bottom").type = 'BOTTOM'
|
||||
|
||||
class MESH_MT_attribute_context_menu(Menu):
|
||||
bl_label = "Attribute Specials"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("geometry.attribute_convert")
|
||||
|
||||
|
||||
class MESH_UL_vgroups(UIList):
|
||||
def draw_item(self, _context, layout, _data, item, icon, _active_data_, _active_propname, _index):
|
||||
@@ -565,7 +557,6 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel):
|
||||
col.enabled = obj is not None and obj.mode != 'EDIT'
|
||||
col.prop(me, "use_customdata_vertex_bevel", text="Vertex Bevel Weight")
|
||||
col.prop(me, "use_customdata_edge_bevel", text="Edge Bevel Weight")
|
||||
col.prop(me, "use_customdata_vertex_crease", text="Vertex Crease")
|
||||
col.prop(me, "use_customdata_edge_crease", text="Edge Crease")
|
||||
|
||||
|
||||
@@ -623,10 +614,6 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
|
||||
col.operator("geometry.attribute_add", icon='ADD', text="")
|
||||
col.operator("geometry.attribute_remove", icon='REMOVE', text="")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.menu("MESH_MT_attribute_context_menu", icon='DOWNARROW_HLT', text="")
|
||||
|
||||
self.draw_attribute_warnings(context, layout)
|
||||
|
||||
def draw_attribute_warnings(self, context, layout):
|
||||
@@ -664,7 +651,6 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
|
||||
classes = (
|
||||
MESH_MT_vertex_group_context_menu,
|
||||
MESH_MT_shape_key_context_menu,
|
||||
MESH_MT_attribute_context_menu,
|
||||
MESH_UL_vgroups,
|
||||
MESH_UL_fmaps,
|
||||
MESH_UL_shape_keys,
|
||||
|
@@ -184,18 +184,24 @@ class OBJECT_PT_collections(ObjectButtonsPanel, Panel):
|
||||
row.operator("object.collection_add", text="Add to Collection")
|
||||
row.operator("object.collection_add", text="", icon='ADD')
|
||||
|
||||
for collection in obj.users_collection:
|
||||
col = layout.column(align=True)
|
||||
obj_name = obj.name
|
||||
for collection in bpy.data.collections:
|
||||
# XXX this is slow and stupid!, we need 2 checks, one that's fast
|
||||
# and another that we can be sure its not a name collision
|
||||
# from linked library data
|
||||
collection_objects = collection.objects
|
||||
if obj_name in collection.objects and obj in collection_objects[:]:
|
||||
col = layout.column(align=True)
|
||||
|
||||
col.context_pointer_set("collection", collection)
|
||||
col.context_pointer_set("collection", collection)
|
||||
|
||||
row = col.box().row()
|
||||
row.prop(collection, "name", text="")
|
||||
row.operator("object.collection_remove", text="", icon='X', emboss=False)
|
||||
row.menu("COLLECTION_MT_context_menu", icon='DOWNARROW_HLT', text="")
|
||||
row = col.box().row()
|
||||
row.prop(collection, "name", text="")
|
||||
row.operator("object.collection_remove", text="", icon='X', emboss=False)
|
||||
row.menu("COLLECTION_MT_context_menu", icon='DOWNARROW_HLT', text="")
|
||||
|
||||
row = col.box().row()
|
||||
row.prop(collection, "instance_offset", text="")
|
||||
row = col.box().row()
|
||||
row.prop(collection, "instance_offset", text="")
|
||||
|
||||
|
||||
class OBJECT_PT_display(ObjectButtonsPanel, Panel):
|
||||
|
@@ -1107,11 +1107,7 @@ def brush_basic_texpaint_settings(layout, context, brush, *, compact=False):
|
||||
capabilities = brush.image_paint_capabilities
|
||||
|
||||
if capabilities.has_color:
|
||||
row = layout.row(align=True)
|
||||
row.ui_units_x = 4
|
||||
UnifiedPaintPanel.prop_unified_color(row, context, brush, "color", text="")
|
||||
UnifiedPaintPanel.prop_unified_color(row, context, brush, "secondary_color", text="")
|
||||
row.separator()
|
||||
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
|
||||
layout.prop(brush, "blend", text="" if compact else "Blend")
|
||||
|
||||
UnifiedPaintPanel.prop_unified(
|
||||
|
@@ -2320,7 +2320,6 @@ class USERPREF_PT_experimental_debugging(ExperimentalPanel, Panel):
|
||||
({"property": "use_cycles_debug"}, None),
|
||||
({"property": "use_geometry_nodes_legacy"}, "T91274"),
|
||||
({"property": "show_asset_debug_info"}, None),
|
||||
({"property": "use_asset_indexing"}, None),
|
||||
),
|
||||
)
|
||||
|
||||
|
@@ -4026,10 +4026,6 @@ class VIEW3D_MT_edit_mesh_vertices(Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("transform.vert_crease")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("mesh.blend_from_shape")
|
||||
layout.operator("mesh.shape_propagate_to_all", text="Propagate to Shapes")
|
||||
|
||||
|
@@ -142,8 +142,6 @@ def mesh_node_items(context):
|
||||
yield NodeItemCustom(draw=lambda self, layout, context: layout.separator())
|
||||
|
||||
yield NodeItem("GeometryNodeDualMesh")
|
||||
yield NodeItem("GeometryNodeExtrudeMesh")
|
||||
yield NodeItem("GeometryNodeFlipFaces")
|
||||
yield NodeItem("GeometryNodeMeshBoolean")
|
||||
yield NodeItem("GeometryNodeMeshToCurve")
|
||||
yield NodeItem("GeometryNodeMeshToPoints")
|
||||
@@ -151,7 +149,6 @@ def mesh_node_items(context):
|
||||
yield NodeItem("GeometryNodeSubdivideMesh")
|
||||
yield NodeItem("GeometryNodeSubdivisionSurface")
|
||||
yield NodeItem("GeometryNodeTriangulate")
|
||||
yield NodeItem("GeometryNodeScaleElements")
|
||||
yield NodeItemCustom(draw=lambda self, layout, context: layout.separator())
|
||||
yield NodeItem("GeometryNodeInputMeshEdgeAngle")
|
||||
yield NodeItem("GeometryNodeInputMeshEdgeNeighbors")
|
||||
@@ -504,7 +501,6 @@ compositor_node_categories = [
|
||||
NodeItem("CompositorNodeTexture"),
|
||||
NodeItem("CompositorNodeBokehImage"),
|
||||
NodeItem("CompositorNodeTime"),
|
||||
NodeItem("CompositorNodeSceneTime"),
|
||||
NodeItem("CompositorNodeTrackPos"),
|
||||
]),
|
||||
CompositorNodeCategory("CMP_OUTPUT", "Output", items=[
|
||||
@@ -707,7 +703,6 @@ geometry_node_categories = [
|
||||
NodeItem("GeometryNodeCurvePrimitiveCircle"),
|
||||
NodeItem("GeometryNodeCurveStar"),
|
||||
NodeItem("GeometryNodeCurveSpiral"),
|
||||
NodeItem("GeometryNodeCurveArc"),
|
||||
NodeItem("GeometryNodeCurveQuadraticBezier"),
|
||||
NodeItem("GeometryNodeCurvePrimitiveQuadrilateral"),
|
||||
NodeItem("GeometryNodeCurvePrimitiveBezierSegment"),
|
||||
@@ -761,7 +756,6 @@ geometry_node_categories = [
|
||||
]),
|
||||
GeometryNodeCategory("GEO_UTILITIES", "Utilities", items=[
|
||||
NodeItem("GeometryNodeAccumulateField"),
|
||||
NodeItem("GeometryNodeFieldAtIndex"),
|
||||
NodeItem("ShaderNodeMapRange"),
|
||||
NodeItem("ShaderNodeFloatCurve"),
|
||||
NodeItem("ShaderNodeClamp"),
|
||||
|
@@ -25,10 +25,6 @@ endif()
|
||||
if(WITH_CLANG_TIDY AND NOT MSVC)
|
||||
if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
message(WARNING "Currently Clang-Tidy might fail with GCC toolchain, switch to Clang toolchain if that happens")
|
||||
if(COMMAND target_precompile_headers)
|
||||
message(STATUS "Clang-Tidy and GCC precompiled headers are incompatible, disabling precompiled headers")
|
||||
set(CMAKE_DISABLE_PRECOMPILE_HEADERS On)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(ClangTidy REQUIRED)
|
||||
|
@@ -54,7 +54,7 @@ set(LIB
|
||||
bf_gpu
|
||||
bf_intern_guardedalloc
|
||||
|
||||
${FREETYPE_LIBRARIES}
|
||||
${FREETYPE_LIBRARY}
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
|
@@ -390,6 +390,12 @@ struct Mesh *editbmesh_get_eval_cage_from_orig(struct Depsgraph *depsgraph,
|
||||
struct Scene *scene,
|
||||
struct Object *obedit,
|
||||
const struct CustomData_MeshMasks *dataMask);
|
||||
struct Mesh *editbmesh_get_eval_cage_and_final(struct Depsgraph *depsgraph,
|
||||
struct Scene *scene,
|
||||
struct Object *,
|
||||
struct BMEditMesh *em,
|
||||
const struct CustomData_MeshMasks *dataMask,
|
||||
struct Mesh **r_final);
|
||||
|
||||
float (*editbmesh_vert_coords_alloc(struct BMEditMesh *em, int *r_vert_len))[3];
|
||||
bool editbmesh_modifier_is_enabled(struct Scene *scene,
|
||||
|
@@ -141,7 +141,7 @@ class AssetCatalogService {
|
||||
AssetCatalogFilter create_catalog_filter(CatalogID active_catalog_id) const;
|
||||
|
||||
/** Create a catalog with some sensible auto-generated catalog ID.
|
||||
* The catalog will be saved to the default catalog file. */
|
||||
* The catalog will be saved to the default catalog file.*/
|
||||
AssetCatalog *create_catalog(const AssetCatalogPath &catalog_path);
|
||||
|
||||
/**
|
||||
|
@@ -26,8 +26,9 @@
|
||||
#include "BKE_attribute.h"
|
||||
|
||||
#include "BLI_color.hh"
|
||||
#include "BLI_float2.hh"
|
||||
#include "BLI_float3.hh"
|
||||
#include "BLI_function_ref.hh"
|
||||
#include "BLI_math_vec_types.hh"
|
||||
|
||||
/**
|
||||
* This file defines classes that help to provide access to attribute data on a #GeometryComponent.
|
||||
|
@@ -18,7 +18,8 @@
|
||||
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_color.hh"
|
||||
#include "BLI_math_vec_types.hh"
|
||||
#include "BLI_float2.hh"
|
||||
#include "BLI_float3.hh"
|
||||
|
||||
#include "DNA_customdata_types.h"
|
||||
|
||||
@@ -159,12 +160,12 @@ template<> inline float mix2(const float factor, const float &a, const float &b)
|
||||
|
||||
template<> inline float2 mix2(const float factor, const float2 &a, const float2 &b)
|
||||
{
|
||||
return math::interpolate(a, b, factor);
|
||||
return float2::interpolate(a, b, factor);
|
||||
}
|
||||
|
||||
template<> inline float3 mix2(const float factor, const float3 &a, const float3 &b)
|
||||
{
|
||||
return math::interpolate(a, b, factor);
|
||||
return float3::interpolate(a, b, factor);
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -230,43 +231,6 @@ template<typename T> class SimpleMixer {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Mixes together booleans with "or" while fitting the same interface as the other mixers in order
|
||||
* to make using it simpler. This mixing method has a few benefits:
|
||||
* - An "average" for selections is relatively meaningless.
|
||||
* - Predictable selection propagation is very super important.
|
||||
* - It's generally easier to remove an element from a selection that is slightly too large than
|
||||
* the opposite.
|
||||
*/
|
||||
class BooleanPropagationMixer {
|
||||
private:
|
||||
MutableSpan<bool> buffer_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \param buffer: Span where the interpolated values should be stored.
|
||||
*/
|
||||
BooleanPropagationMixer(MutableSpan<bool> buffer) : buffer_(buffer)
|
||||
{
|
||||
buffer_.fill(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mix a #value into the element with the given #index.
|
||||
*/
|
||||
void mix_in(const int64_t index, const bool value, [[maybe_unused]] const float weight = 1.0f)
|
||||
{
|
||||
buffer_[index] |= value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does not do anything, since the mixing is trivial.
|
||||
*/
|
||||
void finalize()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This mixer accumulates values in a type that is different from the one that is mixed.
|
||||
* Some types cannot encode the floating point weights in their values (e.g. int and bool).
|
||||
@@ -328,7 +292,7 @@ class ColorGeometryMixer {
|
||||
};
|
||||
|
||||
template<typename T> struct DefaultMixerStruct {
|
||||
/* Use void by default. This can be checked for in `if constexpr` statements. */
|
||||
/* Use void by default. This can be check for in `if constexpr` statements. */
|
||||
using type = void;
|
||||
};
|
||||
template<> struct DefaultMixerStruct<float> {
|
||||
@@ -364,23 +328,6 @@ template<> struct DefaultMixerStruct<bool> {
|
||||
using type = SimpleMixerWithAccumulationType<bool, float, float_to_bool>;
|
||||
};
|
||||
|
||||
template<typename T> struct DefaultPropatationMixerStruct {
|
||||
/* Use void by default. This can be checked for in `if constexpr` statements. */
|
||||
using type = typename DefaultMixerStruct<T>::type;
|
||||
};
|
||||
|
||||
template<> struct DefaultPropatationMixerStruct<bool> {
|
||||
using type = BooleanPropagationMixer;
|
||||
};
|
||||
|
||||
/**
|
||||
* This mixer is meant for propagating attributes when creating new geometry. A key difference
|
||||
* with the default mixer is that booleans are mixed with "or" instead of "at least half"
|
||||
* (the default mixing for booleans).
|
||||
*/
|
||||
template<typename T>
|
||||
using DefaultPropatationMixer = typename DefaultPropatationMixerStruct<T>::type;
|
||||
|
||||
/* Utility to get a good default mixer for a given type. This is `void` when there is no default
|
||||
* mixer for the given type. */
|
||||
template<typename T> using DefaultMixer = typename DefaultMixerStruct<T>::type;
|
||||
|
@@ -150,7 +150,7 @@ typedef enum eBlendfileLinkAppendForeachItemFlag {
|
||||
*
|
||||
* IMPORTANT: Those 'indirect' items currently may not cover **all** indirectly linked data.
|
||||
* See comments in #foreach_libblock_link_append_callback. */
|
||||
BKE_BLENDFILE_LINK_APPEND_FOREACH_ITEM_FLAG_DO_INDIRECT = 1 << 1,
|
||||
BKE_BLENDFILE_LINK_APPEND_FOREACH_ITEM_FLAG_DO_INDIRECT = 1 << 0,
|
||||
} eBlendfileLinkAppendForeachItemFlag;
|
||||
/**
|
||||
* Callback called by #BKE_blendfile_link_append_context_item_foreach over each (or a subset of
|
||||
|
@@ -71,7 +71,6 @@ typedef struct BVHTreeFromMesh {
|
||||
|
||||
/* Vertex array, so that callbacks have instant access to data. */
|
||||
const struct MVert *vert;
|
||||
const float (*vert_normals)[3];
|
||||
const struct MEdge *edge; /* only used for #BVHTreeFromMeshEdges */
|
||||
const struct MFace *face;
|
||||
const struct MLoop *loop;
|
||||
|
@@ -28,7 +28,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
struct CacheFile;
|
||||
struct CacheFileLayer;
|
||||
struct CacheReader;
|
||||
struct Depsgraph;
|
||||
struct Main;
|
||||
@@ -70,15 +69,6 @@ bool BKE_cache_file_uses_render_procedural(const struct CacheFile *cache_file,
|
||||
struct Scene *scene,
|
||||
int dag_eval_mode);
|
||||
|
||||
/* Add a layer to the cache_file. Return NULL if the filename is already that of an existing layer
|
||||
* or if the number of layers exceeds the maximum allowed layer count. */
|
||||
struct CacheFileLayer *BKE_cachefile_add_layer(struct CacheFile *cache_file,
|
||||
const char filename[1024]);
|
||||
|
||||
struct CacheFileLayer *BKE_cachefile_get_active_layer(struct CacheFile *cache_file);
|
||||
|
||||
void BKE_cachefile_remove_layer(struct CacheFile *cache_file, struct CacheFileLayer *layer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user