Compare commits
44 Commits
node-group
...
tmp-buildb
Author | SHA1 | Date | |
---|---|---|---|
f27b5120b0 | |||
07688ca2d2 | |||
db4fe8e322 | |||
e37c876cd7 | |||
58eacb8e7c | |||
b1a2abd6b2 | |||
c5e5ac4a17 | |||
5a07174ce3 | |||
b331acf477 | |||
675d8a9c43 | |||
![]() |
6ee14c966d | ||
05315af81d | |||
![]() |
6a903d9088 | ||
a4a72bffd3 | |||
e33814ef6b | |||
883fb49d4f | |||
a117794f8c | |||
cf74cd9367 | |||
![]() |
6eb94d8df2 | ||
22b03e1c68 | |||
abf3ce811f | |||
cee67f3be2 | |||
a14ee85ccd | |||
231b313c55 | |||
![]() |
3059853732 | ||
a9121640be | |||
14f94fd1ca | |||
1b53fde9fc | |||
71d7505487 | |||
a0cba9fb95 | |||
faa65f151d | |||
c17a266e29 | |||
![]() |
1a3cb90e4e | ||
12afb19959 | |||
![]() |
6abf63f463 | ||
501bca9f5b | |||
828c66f393 | |||
471d4b105a | |||
a77d203932 | |||
0cb25a51de | |||
6a673b6000 | |||
8fda1f363a | |||
4886ed2863 | |||
0aad8100ae |
@@ -217,7 +217,7 @@ if(UNIX AND NOT (APPLE OR HAIKU))
|
||||
option(WITH_GHOST_X11 "Enable building Blender against X11 for windowing" ON)
|
||||
mark_as_advanced(WITH_GHOST_X11)
|
||||
|
||||
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing" ON)
|
||||
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing (under development)" OFF)
|
||||
mark_as_advanced(WITH_GHOST_WAYLAND)
|
||||
endif()
|
||||
|
||||
|
@@ -82,7 +82,11 @@ if(UNIX)
|
||||
endif()
|
||||
include(cmake/openimageio.cmake)
|
||||
include(cmake/tiff.cmake)
|
||||
include(cmake/flexbison.cmake)
|
||||
if(WIN32)
|
||||
include(cmake/flexbison.cmake)
|
||||
else()
|
||||
include(cmake/flex.cmake)
|
||||
endif()
|
||||
include(cmake/osl.cmake)
|
||||
include(cmake/tbb.cmake)
|
||||
include(cmake/openvdb.cmake)
|
||||
|
@@ -93,3 +93,4 @@ download_source(GMP)
|
||||
download_source(POTRACE)
|
||||
download_source(HARU)
|
||||
download_source(ZSTD)
|
||||
download_source(FLEX)
|
||||
|
28
build_files/build_environment/cmake/flex.cmake
Normal file
28
build_files/build_environment/cmake/flex.cmake
Normal file
@@ -0,0 +1,28 @@
|
||||
# ***** 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 *****
|
||||
|
||||
ExternalProject_Add(external_flex
|
||||
URL file://${PACKAGE_DIR}/${FLEX_FILE}
|
||||
URL_HASH ${FLEX_HASH_TYPE}=${FLEX_HASH}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
PREFIX ${BUILD_DIR}/flex
|
||||
CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/flex
|
||||
BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && make -j${MAKE_THREADS}
|
||||
INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flex/src/external_flex/ && make install
|
||||
INSTALL_DIR ${LIBDIR}/flex
|
||||
)
|
@@ -106,6 +106,7 @@ harvest(llvm/include llvm/include "*")
|
||||
harvest(llvm/bin llvm/bin "llvm-config")
|
||||
harvest(llvm/lib llvm/lib "libLLVM*.a")
|
||||
harvest(llvm/lib llvm/lib "libclang*.a")
|
||||
harvest(llvm/lib/clang llvm/lib/clang "*.h")
|
||||
if(APPLE)
|
||||
harvest(openmp/lib openmp/lib "*")
|
||||
harvest(openmp/include openmp/include "*.h")
|
||||
|
@@ -29,12 +29,13 @@ elseif(APPLE)
|
||||
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64")
|
||||
set(ISPC_EXTRA_ARGS_APPLE
|
||||
-DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison
|
||||
-DFLEX_EXECUTABLE=/opt/homebrew/opt/flex/bin/flex
|
||||
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
|
||||
-DARM_ENABLED=On
|
||||
)
|
||||
else()
|
||||
set(ISPC_EXTRA_ARGS_APPLE
|
||||
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
|
||||
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
|
||||
-DARM_ENABLED=Off
|
||||
)
|
||||
endif()
|
||||
@@ -43,6 +44,7 @@ elseif(UNIX)
|
||||
-DCMAKE_C_COMPILER=${LIBDIR}/llvm/bin/clang
|
||||
-DCMAKE_CXX_COMPILER=${LIBDIR}/llvm/bin/clang++
|
||||
-DARM_ENABLED=Off
|
||||
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -82,4 +84,9 @@ if(WIN32)
|
||||
external_ispc
|
||||
external_flexbison
|
||||
)
|
||||
else()
|
||||
add_dependencies(
|
||||
external_ispc
|
||||
external_flex
|
||||
)
|
||||
endif()
|
||||
|
@@ -45,7 +45,6 @@ ExternalProject_Add(external_openimagedenoise
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${OIDN_HASH_TYPE}=${OIDN_HASH}
|
||||
PREFIX ${BUILD_DIR}/openimagedenoise
|
||||
PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/openimagedenoise/src/external_openimagedenoise < ${PATCH_DIR}/oidn.diff
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimagedenoise ${DEFAULT_CMAKE_FLAGS} ${OIDN_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/openimagedenoise
|
||||
)
|
||||
|
@@ -22,9 +22,8 @@ ExternalProject_Add(external_openmp
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH}
|
||||
PREFIX ${BUILD_DIR}/openmp
|
||||
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
|
||||
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @executable_path/../Resources/lib/libomp.dylib runtime/src/libomp.dylib && make install
|
||||
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @rpath/libomp.dylib runtime/src/libomp.dylib && make install
|
||||
INSTALL_DIR ${LIBDIR}/openmp
|
||||
)
|
||||
|
||||
|
@@ -51,6 +51,7 @@ set(OSL_EXTRA_ARGS
|
||||
-DOpenImageIO_ROOT=${LIBDIR}/openimageio/
|
||||
-DOSL_BUILD_TESTS=OFF
|
||||
-DOSL_BUILD_MATERIALX=OFF
|
||||
-DPNG_ROOT=${LIBDIR}/png
|
||||
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
|
||||
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
|
||||
${OSL_FLEX_BISON}
|
||||
@@ -69,13 +70,9 @@ set(OSL_EXTRA_ARGS
|
||||
${OSL_SIMD_FLAGS}
|
||||
-Dpugixml_ROOT=${LIBDIR}/pugixml
|
||||
-DUSE_PYTHON=OFF
|
||||
-DCMAKE_CXX_STANDARD=14
|
||||
)
|
||||
|
||||
# Apple arm64 uses LLVM 11, LLVM 10+ requires C++14
|
||||
if (APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||
list(APPEND OSL_EXTRA_ARGS -DCMAKE_CXX_STANDARD=14)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(external_osl
|
||||
URL file://${PACKAGE_DIR}/${OSL_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
@@ -93,10 +90,20 @@ add_dependencies(
|
||||
ll
|
||||
external_openexr
|
||||
external_zlib
|
||||
external_flexbison
|
||||
external_openimageio
|
||||
external_pugixml
|
||||
)
|
||||
if(WIN32)
|
||||
add_dependencies(
|
||||
external_osl
|
||||
external_flexbison
|
||||
)
|
||||
else()
|
||||
add_dependencies(
|
||||
external_osl
|
||||
external_flex
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
|
@@ -152,35 +152,20 @@ set(OPENCOLORIO_HASH 1a2e3478b6cd9a1549f24e1b2205e3f0)
|
||||
set(OPENCOLORIO_HASH_TYPE MD5)
|
||||
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
|
||||
|
||||
if(BLENDER_PLATFORM_ARM)
|
||||
# Newer version required by ISPC with arm support.
|
||||
set(LLVM_VERSION 11.0.1)
|
||||
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
|
||||
set(LLVM_HASH e700af40ab83463e4e9ab0ba3708312e)
|
||||
set(LLVM_HASH_TYPE MD5)
|
||||
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
|
||||
set(LLVM_VERSION 12.0.0)
|
||||
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
|
||||
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0)
|
||||
set(LLVM_HASH_TYPE MD5)
|
||||
set(LLVM_FILE llvm-project-${LLVM_VERSION}.src.tar.xz)
|
||||
|
||||
set(OPENMP_VERSION 9.0.1)
|
||||
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz)
|
||||
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
|
||||
set(OPENMP_HASH_TYPE MD5)
|
||||
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
|
||||
else()
|
||||
set(LLVM_VERSION 9.0.1)
|
||||
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.tar.xz)
|
||||
set(LLVM_HASH b4268e733dfe352960140dc07ef2efcb)
|
||||
set(LLVM_HASH_TYPE MD5)
|
||||
set(LLVM_FILE llvm-project-${LLVM_VERSION}.tar.xz)
|
||||
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
|
||||
set(OPENMP_HASH ac48ce3e4582ccb82f81ab59eb3fc9dc)
|
||||
set(OPENMP_HASH_TYPE MD5)
|
||||
set(OPENMP_FILE openmp-${LLVM_VERSION}.src.tar.xz)
|
||||
|
||||
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
|
||||
set(OPENMP_HASH 6eade16057edbdecb3c4eef9daa2bfcf)
|
||||
set(OPENMP_HASH_TYPE MD5)
|
||||
set(OPENMP_FILE openmp-${LLVM_VERSION}.src.tar.xz)
|
||||
endif()
|
||||
|
||||
set(OPENIMAGEIO_VERSION 2.1.15.0)
|
||||
set(OPENIMAGEIO_VERSION 2.2.15.1)
|
||||
set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
|
||||
set(OPENIMAGEIO_HASH f03aa5e3ac4795af04771ee4146e9832)
|
||||
set(OPENIMAGEIO_HASH 3db5c5f0b3dc91597c75e5df09eb9072)
|
||||
set(OPENIMAGEIO_HASH_TYPE MD5)
|
||||
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
|
||||
|
||||
@@ -190,9 +175,9 @@ set(TIFF_HASH 2165e7aba557463acc0664e71a3ed424)
|
||||
set(TIFF_HASH_TYPE MD5)
|
||||
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
|
||||
|
||||
set(OSL_VERSION 1.11.10.0)
|
||||
set(OSL_VERSION 1.11.14.1)
|
||||
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
|
||||
set(OSL_HASH dfdc23597aeef083832cbada62211756)
|
||||
set(OSL_HASH 1abd7ce40481771a9fa937f19595d2f2)
|
||||
set(OSL_HASH_TYPE MD5)
|
||||
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
|
||||
|
||||
@@ -370,12 +355,18 @@ set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
|
||||
set(PUGIXML_HASH_TYPE MD5)
|
||||
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
|
||||
|
||||
set(FLEXBISON_VERSION 2.5.5)
|
||||
set(FLEXBISON_VERSION 2.5.24)
|
||||
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
|
||||
set(FLEXBISON_HASH d87a3938194520d904013abef3df10ce)
|
||||
set(FLEXBISON_HASH 6b549d43e34ece0e8ed05af92daa31c4)
|
||||
set(FLEXBISON_HASH_TYPE MD5)
|
||||
set(FLEXBISON_FILE win_flex_bison-${FLEXBISON_VERSION}.zip)
|
||||
|
||||
set(FLEX_VERSION 2.6.4)
|
||||
set(FLEX_URI https://github.com/westes/flex/releases/download/v${FLEX_VERSION}/flex-${FLEX_VERSION}.tar.gz)
|
||||
set(FLEX_HASH 2882e3179748cc9f9c23ec593d6adc8d)
|
||||
set(FLEX_HASH_TYPE MD5)
|
||||
set(FLEX_FILE flex-${FLEX_VERSION}.tar.gz)
|
||||
|
||||
# Libraries to keep Python modules static on Linux.
|
||||
|
||||
# NOTE: bzip.org domain does no longer belong to BZip 2 project, so we download
|
||||
@@ -432,9 +423,9 @@ set(USD_HASH 1dd1e2092d085ed393c1f7c450a4155a)
|
||||
set(USD_HASH_TYPE MD5)
|
||||
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
|
||||
|
||||
set(OIDN_VERSION 1.4.0)
|
||||
set(OIDN_VERSION 1.4.1)
|
||||
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
|
||||
set(OIDN_HASH 421824019becc5b664a22a2b98332bc5)
|
||||
set(OIDN_HASH df4007b0ab93b1c41cdf223b075d01c0)
|
||||
set(OIDN_HASH_TYPE MD5)
|
||||
set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz)
|
||||
|
||||
@@ -444,10 +435,10 @@ set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3)
|
||||
set(LIBGLU_HASH_TYPE MD5)
|
||||
set(LIBGLU_FILE glu-${LIBGLU_VERSION}.tar.xz)
|
||||
|
||||
set(MESA_VERSION 20.3.4)
|
||||
set(MESA_VERSION 21.1.5)
|
||||
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
|
||||
set(MESA_HASH 556338446aef8ae947a789b3e0b5e056)
|
||||
set(MESA_HASH_TYPE MD5)
|
||||
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d)
|
||||
set(MESA_HASH_TYPE SHA256)
|
||||
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
|
||||
|
||||
set(NASM_VERSION 2.15.02)
|
||||
@@ -468,19 +459,11 @@ set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/
|
||||
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
|
||||
set(WL_PROTOCOLS_HASH_TYPE MD5)
|
||||
|
||||
if(BLENDER_PLATFORM_ARM)
|
||||
# Unreleased version with macOS arm support.
|
||||
set(ISPC_URI https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
|
||||
set(ISPC_HASH d382fea18d01dbd0cd05d9e1ede36d7d)
|
||||
set(ISPC_HASH_TYPE MD5)
|
||||
set(ISPC_FILE f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
|
||||
else()
|
||||
set(ISPC_VERSION v1.14.1)
|
||||
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
|
||||
set(ISPC_HASH 968fbc8dfd16a60ba4e32d2e0e03ea7a)
|
||||
set(ISPC_HASH_TYPE MD5)
|
||||
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
|
||||
endif()
|
||||
set(ISPC_VERSION v1.16.0)
|
||||
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
|
||||
set(ISPC_HASH 2e3abedbc0ea9aaec17d6562c632454d)
|
||||
set(ISPC_HASH_TYPE MD5)
|
||||
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz)
|
||||
|
||||
set(GMP_VERSION 6.2.0)
|
||||
set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)
|
||||
|
@@ -1,10 +0,0 @@
|
||||
--- external_openimagedenoise/cmake/oidn_ispc.cmake 2021-02-15 17:29:34.000000000 +0100
|
||||
+++ external_openimagedenoise/cmake/oidn_ispc.cmake2 2021-02-15 17:29:28.000000000 +0100
|
||||
@@ -98,7 +98,7 @@
|
||||
elseif(OIDN_ARCH STREQUAL "ARM64")
|
||||
set(ISPC_ARCHITECTURE "aarch64")
|
||||
if(APPLE)
|
||||
- set(ISPC_TARGET_OS "--target-os=ios")
|
||||
+ set(ISPC_TARGET_OS "--target-os=macos")
|
||||
endif()
|
||||
endif()
|
@@ -34,24 +34,3 @@ diff -Naur orig/src/include/OpenImageIO/platform.h external_openimageio/src/incl
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
diff -Naur orig/src/libutil/ustring.cpp external_openimageio/src/libutil/ustring.cpp
|
||||
--- orig/src/libutil/ustring.cpp 2020-05-11 05:43:52.000000000 +0200
|
||||
+++ external_openimageio/src/libutil/ustring.cpp 2020-11-26 12:06:08.000000000 +0100
|
||||
@@ -337,6 +337,8 @@
|
||||
// the std::string to make it point to our chars! In such a case, the
|
||||
// destructor will be careful not to allow a deallocation.
|
||||
|
||||
+ // Disable internal std::string for Apple silicon based Macs
|
||||
+#if !(defined(__APPLE__) && defined(__arm64__))
|
||||
#if defined(__GNUC__) && !defined(_LIBCPP_VERSION) \
|
||||
&& defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI
|
||||
// NEW gcc ABI
|
||||
@@ -382,7 +384,7 @@
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
-
|
||||
+#endif
|
||||
// Remaining cases - just assign the internal string. This may result
|
||||
// in double allocation for the chars. If you care about that, do
|
||||
// something special for your platform, much like we did for gcc and
|
@@ -1,23 +0,0 @@
|
||||
diff --git a/runtime/src/z_Linux_asm.S b/runtime/src/z_Linux_asm.S
|
||||
index 0d8885e..42aa5ad 100644
|
||||
--- a/runtime/src/z_Linux_asm.S
|
||||
+++ b/runtime/src/z_Linux_asm.S
|
||||
@@ -1540,10 +1540,12 @@ __kmp_unnamed_critical_addr:
|
||||
.comm .gomp_critical_user_,32,8
|
||||
.data
|
||||
.align 8
|
||||
- .global __kmp_unnamed_critical_addr
|
||||
-__kmp_unnamed_critical_addr:
|
||||
+ .global ___kmp_unnamed_critical_addr
|
||||
+___kmp_unnamed_critical_addr:
|
||||
.8byte .gomp_critical_user_
|
||||
- .size __kmp_unnamed_critical_addr,8
|
||||
+# if !(KMP_OS_DARWIN)
|
||||
+ .size ___kmp_unnamed_critical_addr,8
|
||||
+# endif
|
||||
#endif /* KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 */
|
||||
|
||||
#if KMP_OS_LINUX
|
||||
|
||||
|
||||
|
@@ -63,19 +63,50 @@ diff -Naur org/CMakeLists.txt external_osl/CMakeLists.txt
|
||||
|
||||
set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
|
||||
if (OSL_NO_DEFAULT_TEXTURESYSTEM)
|
||||
diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp
|
||||
index 445f6400..3d468de2 100644
|
||||
--- a/src/liboslexec/llvm_util.cpp
|
||||
+++ b/src/liboslexec/llvm_util.cpp
|
||||
@@ -3430,8 +3430,9 @@ LLVM_Util::call_function (llvm::Value *func, cspan<llvm::Value *> args)
|
||||
#endif
|
||||
//llvm_gen_debug_printf (std::string("start ") + std::string(name));
|
||||
#if OSL_LLVM_VERSION >= 110
|
||||
- OSL_DASSERT(llvm::isa<llvm::Function>(func));
|
||||
- llvm::Value *r = builder().CreateCall(llvm::cast<llvm::Function>(func), llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
|
||||
+ llvm::Value* r = builder().CreateCall(
|
||||
+ llvm::cast<llvm::FunctionType>(func->getType()->getPointerElementType()), func,
|
||||
+ llvm::ArrayRef<llvm::Value*>(args.data(), args.size()));
|
||||
#else
|
||||
llvm::Value *r = builder().CreateCall (func, llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 990f50d69..46ef7351d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -252,11 +252,9 @@ install (EXPORT OSL_EXPORTED_TARGETS
|
||||
FILE ${OSL_TARGETS_EXPORT_NAME}
|
||||
NAMESPACE ${PROJECT_NAME}::)
|
||||
|
||||
-
|
||||
-
|
||||
-
|
||||
-osl_add_all_tests()
|
||||
-
|
||||
+if (${PROJECT_NAME}_BUILD_TESTS AND NOT ${PROJECT_NAME}_IS_SUBPROJECT)
|
||||
+ osl_add_all_tests()
|
||||
+endif ()
|
||||
|
||||
if (NOT ${PROJECT_NAME}_IS_SUBPROJECT)
|
||||
include (packaging)
|
||||
diff -Naur external_osl_orig/src/cmake/externalpackages.cmake external_osl/src/cmake/externalpackages.cmake
|
||||
--- external_osl_orig/src/cmake/externalpackages.cmake 2021-06-01 13:44:18 -0600
|
||||
+++ external_osl/src/cmake/externalpackages.cmake 2021-06-28 07:44:32 -0600
|
||||
@@ -80,6 +80,7 @@
|
||||
|
||||
|
||||
checked_find_package (ZLIB REQUIRED) # Needed by several packages
|
||||
+checked_find_package (PNG REQUIRED) # Needed since OIIO needs it
|
||||
|
||||
# IlmBase & OpenEXR
|
||||
checked_find_package (OpenEXR REQUIRED
|
||||
diff -Naur external_osl_orig/src/liboslcomp/oslcomp.cpp external_osl/src/liboslcomp/oslcomp.cpp
|
||||
--- external_osl_orig/src/liboslcomp/oslcomp.cpp 2021-06-01 13:44:18 -0600
|
||||
+++ external_osl/src/liboslcomp/oslcomp.cpp 2021-06-28 09:11:06 -0600
|
||||
@@ -21,6 +21,13 @@
|
||||
#if !defined(__STDC_CONSTANT_MACROS)
|
||||
# define __STDC_CONSTANT_MACROS 1
|
||||
#endif
|
||||
+
|
||||
+// clang uses CALLBACK in its templates which causes issues if it is already defined
|
||||
+#ifdef _WIN32 && defined(CALLBACK)
|
||||
+# undef CALLBACK
|
||||
+#endif
|
||||
+
|
||||
+//
|
||||
#include <clang/Basic/TargetInfo.h>
|
||||
#include <clang/Frontend/CompilerInstance.h>
|
||||
#include <clang/Frontend/TextDiagnosticPrinter.h>
|
||||
|
@@ -404,7 +404,7 @@ endif()
|
||||
|
||||
# CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
|
||||
if(WITH_OPENMP)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0")
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
# Use OpenMP from our precompiled libraries.
|
||||
message(STATUS "Using ${LIBDIR}/openmp for OpenMP")
|
||||
set(OPENMP_CUSTOM ON)
|
||||
@@ -480,10 +480,8 @@ else()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic")
|
||||
endif()
|
||||
|
||||
if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
|
||||
# Xcode 5 is always using CLANG, which has too low template depth of 128 for libmv
|
||||
string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024")
|
||||
endif()
|
||||
# Clang has too low template depth of 128 for libmv.
|
||||
string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024")
|
||||
|
||||
# Avoid conflicts with Luxrender, and other plug-ins that may use the same
|
||||
# libraries as Blender with a different version or build options.
|
||||
|
@@ -41,7 +41,7 @@
|
||||
},
|
||||
"cuda11":
|
||||
{
|
||||
"version": "11.3"
|
||||
"version": "11.4"
|
||||
}
|
||||
},
|
||||
"cmake":
|
||||
|
70
build_files/config/pipeline_config.yaml
Normal file
70
build_files/config/pipeline_config.yaml
Normal file
@@ -0,0 +1,70 @@
|
||||
#
|
||||
# Used by Buildbot build pipeline make_update.py script only for now
|
||||
# We intended to update the make_update.py in the branches to use this file eventually
|
||||
#
|
||||
update-code:
|
||||
git:
|
||||
submodules:
|
||||
- branch: master
|
||||
commit_id: HEAD
|
||||
path: release/scripts/addons
|
||||
- branch: master
|
||||
commit_id: HEAD
|
||||
path: release/scripts/addons_contrib
|
||||
- branch: master
|
||||
commit_id: HEAD
|
||||
path: release/datafiles/locale
|
||||
- branch: master
|
||||
commit_id: HEAD
|
||||
path: source/tools
|
||||
svn:
|
||||
libraries:
|
||||
darwin-arm64:
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/darwin_arm64
|
||||
darwin-x86_64:
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/darwin
|
||||
linux-x86_64:
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/linux_centos7_x86_64
|
||||
windows-amd64:
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/win64_vc15
|
||||
tests:
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/tests
|
||||
benchmarks:
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/benchmarks
|
||||
|
||||
#
|
||||
# Buildbot only configs
|
||||
#
|
||||
buildbot:
|
||||
gcc:
|
||||
version: '10.0.0'
|
||||
cuda10:
|
||||
version: '10.1.0'
|
||||
cuda11:
|
||||
version: '11.4.0'
|
||||
optix:
|
||||
version: '7.1.0'
|
||||
cmake:
|
||||
default:
|
||||
version: any
|
||||
overrides: {}
|
||||
darwin-arm64:
|
||||
overrides: {}
|
||||
darwin-x86_64:
|
||||
overrides: {}
|
||||
linux-x86_64:
|
||||
overrides: {}
|
||||
windows-amd64:
|
||||
overrides: {}
|
@@ -263,6 +263,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
name="Use Denoising",
|
||||
description="Denoise the rendered image",
|
||||
default=False,
|
||||
update=update_render_passes,
|
||||
)
|
||||
use_preview_denoising: BoolProperty(
|
||||
name="Use Viewport Denoising",
|
||||
|
@@ -461,18 +461,19 @@ string CUDADevice::compile_kernel(const DeviceRequestedFeatures &requested_featu
|
||||
|
||||
const int nvcc_cuda_version = cuewCompilerVersion();
|
||||
VLOG(1) << "Found nvcc " << nvcc << ", CUDA version " << nvcc_cuda_version << ".";
|
||||
if (nvcc_cuda_version < 80) {
|
||||
if (nvcc_cuda_version < 101) {
|
||||
printf(
|
||||
"Unsupported CUDA version %d.%d detected, "
|
||||
"you need CUDA 8.0 or newer.\n",
|
||||
"you need CUDA 10.1 or newer.\n",
|
||||
nvcc_cuda_version / 10,
|
||||
nvcc_cuda_version % 10);
|
||||
return string();
|
||||
}
|
||||
else if (!(nvcc_cuda_version == 101 || nvcc_cuda_version == 102)) {
|
||||
else if (!(nvcc_cuda_version == 101 || nvcc_cuda_version == 102 || nvcc_cuda_version == 111 ||
|
||||
nvcc_cuda_version == 112 || nvcc_cuda_version == 113 || nvcc_cuda_version == 114)) {
|
||||
printf(
|
||||
"CUDA version %d.%d detected, build may succeed but only "
|
||||
"CUDA 10.1 and 10.2 are officially supported.\n",
|
||||
"CUDA 10.1 to 11.4 are officially supported.\n",
|
||||
nvcc_cuda_version / 10,
|
||||
nvcc_cuda_version % 10);
|
||||
}
|
||||
|
@@ -380,11 +380,16 @@ if(WITH_CYCLES_CUDA_BINARIES)
|
||||
set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
|
||||
|
||||
# warn for other versions
|
||||
if((CUDA_VERSION MATCHES "101") OR (CUDA_VERSION MATCHES "102") OR (CUDA_VERSION MATCHES "111"))
|
||||
if((CUDA_VERSION MATCHES "101") OR
|
||||
(CUDA_VERSION MATCHES "102") OR
|
||||
(CUDA_VERSION MATCHES "111") OR
|
||||
(CUDA_VERSION MATCHES "112") OR
|
||||
(CUDA_VERSION MATCHES "113") OR
|
||||
(CUDA_VERSION MATCHES "114"))
|
||||
else()
|
||||
message(WARNING
|
||||
"CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
|
||||
"build may succeed but only CUDA 10.1, 10.2 and 11.1 are officially supported")
|
||||
"build may succeed but only CUDA 10.1 to 11.4 are officially supported")
|
||||
endif()
|
||||
|
||||
# build for each arch
|
||||
|
@@ -385,7 +385,7 @@ void ColorSpaceManager::free_memory()
|
||||
{
|
||||
#ifdef WITH_OCIO
|
||||
map_free_memory(cached_colorspaces);
|
||||
map_free_memory(cached_colorspaces);
|
||||
map_free_memory(cached_processors);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -103,7 +103,7 @@ ccl_device float fast_sinf(float x)
|
||||
* 1.19209e-07 max error
|
||||
*/
|
||||
int q = fast_rint(x * M_1_PI_F);
|
||||
float qf = q;
|
||||
float qf = (float)q;
|
||||
x = madd(qf, -0.78515625f * 4, x);
|
||||
x = madd(qf, -0.00024187564849853515625f * 4, x);
|
||||
x = madd(qf, -3.7747668102383613586e-08f * 4, x);
|
||||
@@ -132,7 +132,7 @@ ccl_device float fast_cosf(float x)
|
||||
{
|
||||
/* Same argument reduction as fast_sinf(). */
|
||||
int q = fast_rint(x * M_1_PI_F);
|
||||
float qf = q;
|
||||
float qf = (float)q;
|
||||
x = madd(qf, -0.78515625f * 4, x);
|
||||
x = madd(qf, -0.00024187564849853515625f * 4, x);
|
||||
x = madd(qf, -3.7747668102383613586e-08f * 4, x);
|
||||
@@ -160,7 +160,7 @@ ccl_device void fast_sincosf(float x, float *sine, float *cosine)
|
||||
{
|
||||
/* Same argument reduction as fast_sin. */
|
||||
int q = fast_rint(x * M_1_PI_F);
|
||||
float qf = q;
|
||||
float qf = (float)q;
|
||||
x = madd(qf, -0.78515625f * 4, x);
|
||||
x = madd(qf, -0.00024187564849853515625f * 4, x);
|
||||
x = madd(qf, -3.7747668102383613586e-08f * 4, x);
|
||||
@@ -207,7 +207,7 @@ ccl_device float fast_tanf(float x)
|
||||
* we sometimes need to take the reciprocal of the polynomial
|
||||
*/
|
||||
int q = fast_rint(x * 2.0f * M_1_PI_F);
|
||||
float qf = q;
|
||||
float qf = (float)q;
|
||||
x = madd(qf, -0.78515625f * 2, x);
|
||||
x = madd(qf, -0.00024187564849853515625f * 2, x);
|
||||
x = madd(qf, -3.7747668102383613586e-08f * 2, x);
|
||||
@@ -407,7 +407,7 @@ ccl_device float fast_logb(float x)
|
||||
x = fabsf(x);
|
||||
x = clamp(x, FLT_MIN, FLT_MAX);
|
||||
unsigned bits = __float_as_uint(x);
|
||||
return (int)(bits >> 23) - 127;
|
||||
return (float)((int)(bits >> 23) - 127);
|
||||
}
|
||||
|
||||
ccl_device float fast_exp2f(float x)
|
||||
|
@@ -188,8 +188,8 @@ extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
||||
GHOST_GLSettings glSettings);
|
||||
|
||||
/**
|
||||
* Create a new offscreen context.
|
||||
* Never explicitly delete the context, use disposeContext() instead.
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the context, use #disposeContext() instead.
|
||||
* \param systemhandle: The handle to the system.
|
||||
* \param platform_support_callback: An optional callback to check platform support.
|
||||
* \return A handle to the new context ( == NULL if creation failed).
|
||||
|
@@ -29,8 +29,8 @@
|
||||
/**
|
||||
* Interface for GHOST context.
|
||||
*
|
||||
* You can create a offscreen context (windowless) with the system's
|
||||
* GHOST_ISystem::createOffscreenContext method.
|
||||
* You can create a off-screen context (windowless) with the system's
|
||||
* #GHOST_ISystem::createOffscreenContext method.
|
||||
* \see GHOST_ISystem#createOffscreenContext
|
||||
*/
|
||||
class GHOST_IContext {
|
||||
|
@@ -261,8 +261,8 @@ class GHOST_ISystem {
|
||||
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow *window) = 0;
|
||||
|
||||
/**
|
||||
* Create a new offscreen context.
|
||||
* Never explicitly delete the context, use disposeContext() instead.
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the context, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
virtual GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) = 0;
|
||||
|
@@ -611,9 +611,9 @@ typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_
|
||||
struct GHOST_XrDrawViewInfo;
|
||||
struct GHOST_XrError;
|
||||
/**
|
||||
* The XR view (i.e. the OpenXR runtime) may require a different graphics library than OpenGL. An
|
||||
* offscreen texture of the viewport will then be drawn into using OpenGL, but the final texture
|
||||
* draw call will happen through another lib (say DirectX).
|
||||
* The XR view (i.e. the OpenXR runtime) may require a different graphics library than OpenGL.
|
||||
* An off-screen texture of the viewport will then be drawn into using OpenGL,
|
||||
* but the final texture draw call will happen through another library (say DirectX).
|
||||
*
|
||||
* This enum defines the possible graphics bindings to attempt to enable.
|
||||
*/
|
||||
|
@@ -239,7 +239,7 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
|
||||
}
|
||||
attribs[i++] = 0;
|
||||
|
||||
/* Some drivers don't like having a true offscreen context.
|
||||
/* Some drivers don't like having a true off-screen context.
|
||||
* Create a pixel buffer instead of a window to render to.
|
||||
* even if it will never be used for drawing. */
|
||||
int pbuffer_attribs[] = {GLX_PBUFFER_WIDTH, 1, GLX_PBUFFER_HEIGHT, 1, None};
|
||||
|
@@ -57,12 +57,6 @@ GHOST_TSuccess GHOST_ISystem::createSystem()
|
||||
/* Special case, try Wayland, fall back to X11. */
|
||||
try {
|
||||
m_system = new GHOST_SystemWayland();
|
||||
if (!std::getenv("BLENDER_WAYLAND")) {
|
||||
printf("Connected to a Wayland compositor but Wayland is disabled at "\
|
||||
"runtime.\nSet environment variable 'BLENDER_WAYLAND' (e.g. "\
|
||||
"BLENDER_WAYLAND= blender) to use Wayland.\n");
|
||||
throw std::runtime_error(std::string());
|
||||
}
|
||||
}
|
||||
catch (const std::runtime_error &) {
|
||||
/* fallback to X11. */
|
||||
|
@@ -113,8 +113,8 @@ class GHOST_System : public GHOST_ISystem {
|
||||
GHOST_TSuccess disposeWindow(GHOST_IWindow *window);
|
||||
|
||||
/**
|
||||
* Create a new offscreen context.
|
||||
* Never explicitly delete the context, use disposeContext() instead.
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the context, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
virtual GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) = 0;
|
||||
|
@@ -112,8 +112,8 @@ class GHOST_SystemCocoa : public GHOST_System {
|
||||
const GHOST_IWindow *parentWindow = NULL);
|
||||
|
||||
/**
|
||||
* Create a new offscreen context.
|
||||
* Never explicitly delete the context, use disposeContext() instead.
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the context, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
|
||||
|
@@ -761,7 +761,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new offscreen context.
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the context, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
|
@@ -259,7 +259,7 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title,
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new offscreen context.
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the window, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
@@ -363,7 +363,7 @@ GHOST_TSuccess GHOST_SystemWin32::disposeContext(GHOST_IContext *context)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new offscreen DirectX 11 context.
|
||||
* Create a new off-screen DirectX 11 context.
|
||||
* Never explicitly delete the window, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
|
@@ -138,8 +138,8 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
const GHOST_IWindow *parentWindow = 0);
|
||||
|
||||
/**
|
||||
* Create a new offscreen context.
|
||||
* Never explicitly delete the window, use disposeContext() instead.
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the window, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
|
||||
@@ -152,8 +152,8 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
GHOST_TSuccess disposeContext(GHOST_IContext *context);
|
||||
|
||||
/**
|
||||
* Create a new offscreen DirectX context.
|
||||
* Never explicitly delete the context, use disposeContext() instead.
|
||||
* Create a new off-screen DirectX context.
|
||||
* Never explicitly delete the context, use #disposeContext() instead.
|
||||
* This is for GHOST internal, Win32 specific use, so it can be called statically.
|
||||
*
|
||||
* \return The new context (or 0 if creation failed).
|
||||
|
@@ -390,8 +390,8 @@ GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title,
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new offscreen context.
|
||||
* Never explicitly delete the context, use disposeContext() instead.
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the context, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSettings)
|
||||
|
@@ -148,8 +148,8 @@ class GHOST_SystemX11 : public GHOST_System {
|
||||
const GHOST_IWindow *parentWindow = 0);
|
||||
|
||||
/**
|
||||
* Create a new offscreen context.
|
||||
* Never explicitly delete the context, use disposeContext() instead.
|
||||
* Create a new off-screen context.
|
||||
* Never explicitly delete the context, use #disposeContext() instead.
|
||||
* \return The new context (or 0 if creation failed).
|
||||
*/
|
||||
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
|
||||
|
@@ -148,7 +148,7 @@ static void create_reference_spaces(OpenXRSessionData &oxr, const GHOST_XrPose &
|
||||
|
||||
if (XR_FAILED(result)) {
|
||||
/* One of the rare cases where we don't want to immediately throw an exception on failure,
|
||||
* since runtimes are not required to support the stage reference space. Although we need the
|
||||
* since run-times are not required to support the stage reference space. Although we need the
|
||||
* stage reference space for absolute tracking, if the runtime doesn't support it then just
|
||||
* fallback to the local space. */
|
||||
if (result == XR_ERROR_REFERENCE_SPACE_UNSUPPORTED) {
|
||||
|
@@ -67,7 +67,7 @@ const char *(*MEM_name_ptr)(void *vmemh) = MEM_lockfree_name_ptr;
|
||||
|
||||
void *aligned_malloc(size_t size, size_t alignment)
|
||||
{
|
||||
/* posix_memalign requires alignment to be a multiple of sizeof(void *). */
|
||||
/* #posix_memalign requires alignment to be a multiple of `sizeof(void *)`. */
|
||||
assert(alignment >= ALIGNED_MALLOC_MINIMUM_ALIGNMENT);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
Submodule release/scripts/addons updated: 1adb56d8b0...4475cbd11a
@@ -734,11 +734,9 @@ class PHYSICS_PT_noise(PhysicButtonsPanel, Panel):
|
||||
|
||||
col = flow.column()
|
||||
col.prop(domain, "noise_scale", text="Upres Factor")
|
||||
# TODO (sebbas): Mantaflow only supports wavelet noise. Maybe get rid of noise type field.
|
||||
col.prop(domain, "noise_type", text="Noise Method")
|
||||
col.prop(domain, "noise_strength", text="Strength")
|
||||
|
||||
col = flow.column()
|
||||
col.prop(domain, "noise_strength", text="Strength")
|
||||
col.prop(domain, "noise_pos_scale", text="Scale")
|
||||
col.prop(domain, "noise_time_anim", text="Time")
|
||||
|
||||
|
@@ -2294,8 +2294,8 @@ class SEQUENCER_PT_snapping(Panel):
|
||||
col.prop(sequencer_tool_settings, "snap_ignore_muted", text="Muted Strips")
|
||||
col.prop(sequencer_tool_settings, "snap_ignore_sound", text="Sound Strips")
|
||||
|
||||
col = layout.column()
|
||||
col.prop(sequencer_tool_settings, "use_snap_current_frame_to_strips")
|
||||
col = layout.column(heading="Current Frame", align=True)
|
||||
col.prop(sequencer_tool_settings, "use_snap_current_frame_to_strips", text="Snap to Strips")
|
||||
|
||||
|
||||
classes = (
|
||||
|
@@ -191,6 +191,11 @@ class _defs_annotate:
|
||||
row.prop(tool_settings.gpencil_sculpt, "lockaxis")
|
||||
elif tool_settings.gpencil_stroke_placement_view3d in {'SURFACE', 'STROKE'}:
|
||||
row.prop(tool_settings, "use_gpencil_stroke_endpoints")
|
||||
elif space_type in {'IMAGE_EDITOR', 'NODE_EDITOR', 'SEQUENCE_EDITOR', 'CLIP_EDITOR'}:
|
||||
layout.separator()
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(tool_settings, "annotation_stroke_placement_view2d", text="Placement")
|
||||
|
||||
if tool.idname == "builtin.annotate_line":
|
||||
layout.separator()
|
||||
|
@@ -94,6 +94,9 @@ def node_group_items(context):
|
||||
|
||||
yield NodeItemCustom(draw=group_tools_draw)
|
||||
|
||||
yield NodeItem("NodeGroupInput", poll=group_input_output_item_poll)
|
||||
yield NodeItem("NodeGroupOutput", poll=group_input_output_item_poll)
|
||||
|
||||
yield NodeItemCustom(draw=lambda self, layout, context: layout.separator())
|
||||
|
||||
def contains_group(nodetree, group):
|
||||
@@ -120,40 +123,6 @@ def node_group_items(context):
|
||||
settings={"node_tree": "bpy.data.node_groups[%r]" % group.name})
|
||||
|
||||
|
||||
def node_group_input_items(context):
|
||||
if context is None:
|
||||
return
|
||||
space = context.space_data
|
||||
if not space:
|
||||
return
|
||||
ntree = space.edit_tree
|
||||
if not ntree:
|
||||
return
|
||||
|
||||
for i, iosock in enumerate(ntree.inputs):
|
||||
settings = dict()
|
||||
settings["use_extension_socket"] = "False"
|
||||
for k, _ in enumerate(ntree.inputs):
|
||||
settings["outputs[{}].hide".format(k)] = "False" if k == i else "True"
|
||||
yield NodeItem("NodeGroupInput", label=iosock.name, settings=settings, poll=group_input_output_item_poll)
|
||||
|
||||
|
||||
def node_group_output_items(context):
|
||||
if context is None:
|
||||
return
|
||||
space = context.space_data
|
||||
if not space:
|
||||
return
|
||||
ntree = space.edit_tree
|
||||
if not ntree:
|
||||
return
|
||||
|
||||
# Node groups are not added as single-socket nodes currently, because only one node can be active output.
|
||||
# Dividing group output between multiple nodes will require changes to the "active output" concept (NODE_DO_OUTPUT flag).
|
||||
|
||||
yield NodeItem("NodeGroupOutput", poll=group_input_output_item_poll)
|
||||
|
||||
|
||||
# only show input/output nodes inside node groups
|
||||
def group_input_output_item_poll(context):
|
||||
space = context.space_data
|
||||
@@ -325,8 +294,6 @@ shader_node_categories = [
|
||||
NodeItem("ShaderNodeScript"),
|
||||
]),
|
||||
ShaderNodeCategory("SH_NEW_GROUP", "Group", items=node_group_items),
|
||||
ShaderNodeCategory("SH_NEW_GROUP_INPUTS", "Group Inputs", items=node_group_input_items),
|
||||
ShaderNodeCategory("SH_NEW_GROUP_OUTPUTS", "Group Outputs", items=node_group_output_items),
|
||||
ShaderNodeCategory("SH_NEW_LAYOUT", "Layout", items=[
|
||||
NodeItem("NodeFrame"),
|
||||
NodeItem("NodeReroute"),
|
||||
@@ -442,8 +409,6 @@ compositor_node_categories = [
|
||||
NodeItem("CompositorNodeCornerPin"),
|
||||
]),
|
||||
CompositorNodeCategory("CMP_GROUP", "Group", items=node_group_items),
|
||||
CompositorNodeCategory("CMP_GROUP_INPUTS", "Group Inputs", items=node_group_input_items),
|
||||
CompositorNodeCategory("CMP_GROUP_OUTPUTS", "Group Outputs", items=node_group_output_items),
|
||||
CompositorNodeCategory("CMP_LAYOUT", "Layout", items=[
|
||||
NodeItem("NodeFrame"),
|
||||
NodeItem("NodeReroute"),
|
||||
@@ -501,8 +466,6 @@ texture_node_categories = [
|
||||
NodeItem("TextureNodeAt"),
|
||||
]),
|
||||
TextureNodeCategory("TEX_GROUP", "Group", items=node_group_items),
|
||||
TextureNodeCategory("TEX_GROUP_INPUTS", "Group Inputs", items=node_group_input_items),
|
||||
TextureNodeCategory("TEX_GROUP_OUTPUTS", "Group Outputs", items=node_group_output_items),
|
||||
TextureNodeCategory("TEX_LAYOUT", "Layout", items=[
|
||||
NodeItem("NodeFrame"),
|
||||
NodeItem("NodeReroute"),
|
||||
@@ -633,8 +596,6 @@ geometry_node_categories = [
|
||||
NodeItem("GeometryNodeVolumeToMesh"),
|
||||
]),
|
||||
GeometryNodeCategory("GEO_GROUP", "Group", items=node_group_items),
|
||||
GeometryNodeCategory("GEO_GROUP_INPUTS", "Group Inputs", items=node_group_input_items),
|
||||
GeometryNodeCategory("GEO_GROUP_OUTPUTS", "Group Outputs", items=node_group_output_items),
|
||||
GeometryNodeCategory("GEO_LAYOUT", "Layout", items=[
|
||||
NodeItem("NodeFrame"),
|
||||
NodeItem("NodeReroute"),
|
||||
|
@@ -66,7 +66,7 @@
|
||||
/* Batching buffer for drawing. */
|
||||
BatchBLF g_batch;
|
||||
|
||||
/* freetype2 handle ONLY for this file!. */
|
||||
/* freetype2 handle ONLY for this file! */
|
||||
static FT_Library ft_lib;
|
||||
static SpinLock ft_lib_mutex;
|
||||
static SpinLock blf_glyph_cache_mutex;
|
||||
|
@@ -98,6 +98,9 @@ struct LayerCollection *BKE_layer_collection_from_index(struct ViewLayer *view_l
|
||||
const int index);
|
||||
int BKE_layer_collection_findindex(struct ViewLayer *view_layer, const struct LayerCollection *lc);
|
||||
|
||||
void BKE_layer_collection_resync_forbid(void);
|
||||
void BKE_layer_collection_resync_allow(void);
|
||||
|
||||
void BKE_main_collection_sync(const struct Main *bmain);
|
||||
void BKE_scene_collection_sync(const struct Scene *scene);
|
||||
void BKE_layer_collection_sync(const struct Scene *scene, struct ViewLayer *view_layer);
|
||||
|
@@ -48,6 +48,7 @@ struct BLI_mempool;
|
||||
struct BlendThumbnail;
|
||||
struct GHash;
|
||||
struct GSet;
|
||||
struct IDNameLib_Map;
|
||||
struct ImBuf;
|
||||
struct Library;
|
||||
struct MainLock;
|
||||
@@ -191,6 +192,9 @@ typedef struct Main {
|
||||
*/
|
||||
struct MainIDRelations *relations;
|
||||
|
||||
/* IDMap of IDs. Currently used when reading (expanding) libraries. */
|
||||
struct IDNameLib_Map *id_map;
|
||||
|
||||
struct MainLock *lock;
|
||||
} Main;
|
||||
|
||||
|
@@ -50,8 +50,13 @@ struct IDNameLib_Map *BKE_main_idmap_create(struct Main *bmain,
|
||||
const int idmap_types) ATTR_WARN_UNUSED_RESULT
|
||||
ATTR_NONNULL(1);
|
||||
void BKE_main_idmap_destroy(struct IDNameLib_Map *id_map) ATTR_NONNULL();
|
||||
|
||||
void BKE_main_idmap_insert_id(struct IDNameLib_Map *id_map, struct ID *id) ATTR_NONNULL();
|
||||
void BKE_main_idmap_remove_id(struct IDNameLib_Map *id_map, struct ID *id) ATTR_NONNULL();
|
||||
|
||||
struct Main *BKE_main_idmap_main_get(struct IDNameLib_Map *id_map) ATTR_WARN_UNUSED_RESULT
|
||||
ATTR_NONNULL();
|
||||
|
||||
struct ID *BKE_main_idmap_lookup_name(struct IDNameLib_Map *id_map,
|
||||
short id_type,
|
||||
const char *name,
|
||||
|
@@ -5005,7 +5005,6 @@ void BKE_fluid_modifier_copy(const struct FluidModifierData *fmd,
|
||||
tfds->noise_pos_scale = fds->noise_pos_scale;
|
||||
tfds->noise_time_anim = fds->noise_time_anim;
|
||||
tfds->noise_scale = fds->noise_scale;
|
||||
tfds->noise_type = fds->noise_type;
|
||||
|
||||
/* liquid domain options */
|
||||
tfds->flip_ratio = fds->flip_ratio;
|
||||
|
@@ -737,6 +737,35 @@ int BKE_layer_collection_findindex(ViewLayer *view_layer, const LayerCollection
|
||||
* in at least one layer collection. That list is also synchronized here, and
|
||||
* stores state like selection. */
|
||||
|
||||
/* This API allows to temporarily forbid resync of LayerCollections.
|
||||
*
|
||||
* This can greatly improve performances in cases where those functions get
|
||||
* called a lot (e.g. during massive remappings of IDs).
|
||||
*
|
||||
* Usage of these should be done very carefully though. In particular, calling
|
||||
* code must ensures it resync LayerCollections before any UI/Event loop
|
||||
* handling can happen.
|
||||
*
|
||||
* WARNING: This is not threadsafe at all, only use from main thread.
|
||||
*
|
||||
* NOTE: This is a quick and safe band-aid around the long-known issue
|
||||
* regarding this resync process.
|
||||
* Proper fix would be to make resync itself lazy, i.e. only happen
|
||||
* when actually needed.
|
||||
* See also T73411.
|
||||
*/
|
||||
static bool no_resync = false;
|
||||
|
||||
void BKE_layer_collection_resync_forbid(void)
|
||||
{
|
||||
no_resync = true;
|
||||
}
|
||||
|
||||
void BKE_layer_collection_resync_allow(void)
|
||||
{
|
||||
no_resync = false;
|
||||
}
|
||||
|
||||
static void layer_collection_objects_sync(ViewLayer *view_layer,
|
||||
LayerCollection *layer,
|
||||
ListBase *r_lb_new_object_bases,
|
||||
@@ -933,6 +962,10 @@ static void layer_collection_sync(ViewLayer *view_layer,
|
||||
*/
|
||||
void BKE_layer_collection_sync(const Scene *scene, ViewLayer *view_layer)
|
||||
{
|
||||
if (no_resync) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!scene->master_collection) {
|
||||
/* Happens for old files that don't have versioning applied yet. */
|
||||
return;
|
||||
@@ -997,6 +1030,10 @@ void BKE_layer_collection_sync(const Scene *scene, ViewLayer *view_layer)
|
||||
|
||||
void BKE_scene_collection_sync(const Scene *scene)
|
||||
{
|
||||
if (no_resync) {
|
||||
return;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
||||
BKE_layer_collection_sync(scene, view_layer);
|
||||
}
|
||||
@@ -1004,6 +1041,10 @@ void BKE_scene_collection_sync(const Scene *scene)
|
||||
|
||||
void BKE_main_collection_sync(const Main *bmain)
|
||||
{
|
||||
if (no_resync) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO: if a single collection changed, figure out which
|
||||
* scenes it belongs to and only update those. */
|
||||
|
||||
@@ -1018,6 +1059,10 @@ void BKE_main_collection_sync(const Main *bmain)
|
||||
|
||||
void BKE_main_collection_sync_remap(const Main *bmain)
|
||||
{
|
||||
if (no_resync) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* On remapping of object or collection pointers free caches. */
|
||||
/* TODO: try to make this faster */
|
||||
|
||||
@@ -1320,6 +1365,10 @@ static void layer_collection_local_sync(ViewLayer *view_layer,
|
||||
|
||||
void BKE_layer_collection_local_sync(ViewLayer *view_layer, const View3D *v3d)
|
||||
{
|
||||
if (no_resync) {
|
||||
return;
|
||||
}
|
||||
|
||||
const unsigned short local_collections_uuid = v3d->local_collections_uuid;
|
||||
|
||||
/* Reset flags and set the bases visible by default. */
|
||||
@@ -1337,6 +1386,10 @@ void BKE_layer_collection_local_sync(ViewLayer *view_layer, const View3D *v3d)
|
||||
*/
|
||||
void BKE_layer_collection_local_sync_all(const Main *bmain)
|
||||
{
|
||||
if (no_resync) {
|
||||
return;
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
|
@@ -1722,6 +1722,11 @@ void BKE_lib_override_library_main_resync(Main *bmain,
|
||||
COLLECTION_RESTRICT_RENDER;
|
||||
}
|
||||
|
||||
/* Necessary to improve performances, and prevent layers matching override sub-collections to be
|
||||
* lost when re-syncing the parent override collection.
|
||||
* Ref. T73411. */
|
||||
BKE_layer_collection_resync_forbid();
|
||||
|
||||
int library_indirect_level = lib_override_libraries_index_define(bmain);
|
||||
while (library_indirect_level >= 0) {
|
||||
/* Update overrides from each indirect level separately. */
|
||||
@@ -1734,6 +1739,8 @@ void BKE_lib_override_library_main_resync(Main *bmain,
|
||||
library_indirect_level--;
|
||||
}
|
||||
|
||||
BKE_layer_collection_resync_allow();
|
||||
|
||||
/* Essentially ensures that potentially new overrides of new objects will be instantiated. */
|
||||
lib_override_library_create_post_process(
|
||||
bmain, scene, view_layer, NULL, NULL, override_resync_residual_storage, true);
|
||||
|
@@ -38,6 +38,7 @@
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_main_idmap.h"
|
||||
|
||||
#include "IMB_imbuf.h"
|
||||
#include "IMB_imbuf_types.h"
|
||||
@@ -194,6 +195,10 @@ void BKE_main_free(Main *mainvar)
|
||||
BKE_main_relations_free(mainvar);
|
||||
}
|
||||
|
||||
if (mainvar->id_map) {
|
||||
BKE_main_idmap_destroy(mainvar->id_map);
|
||||
}
|
||||
|
||||
BLI_spin_end((SpinLock *)mainvar->lock);
|
||||
MEM_freeN(mainvar->lock);
|
||||
MEM_freeN(mainvar);
|
||||
|
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "BLI_ghash.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_mempool.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "DNA_ID.h"
|
||||
@@ -58,8 +59,6 @@ struct IDNameLib_Key {
|
||||
struct IDNameLib_TypeMap {
|
||||
GHash *map;
|
||||
short id_type;
|
||||
/* only for storage of keys in the ghash, avoid many single allocs */
|
||||
struct IDNameLib_Key *keys;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -71,6 +70,9 @@ struct IDNameLib_Map {
|
||||
struct Main *bmain;
|
||||
struct GSet *valid_id_pointers;
|
||||
int idmap_types;
|
||||
|
||||
/* For storage of keys for the TypeMap ghash, avoids many single allocs. */
|
||||
BLI_mempool *type_maps_keys_pool;
|
||||
};
|
||||
|
||||
static struct IDNameLib_TypeMap *main_idmap_from_idcode(struct IDNameLib_Map *id_map,
|
||||
@@ -115,6 +117,7 @@ struct IDNameLib_Map *BKE_main_idmap_create(struct Main *bmain,
|
||||
BLI_assert(type_map->id_type != 0);
|
||||
}
|
||||
BLI_assert(index == INDEX_ID_MAX);
|
||||
id_map->type_maps_keys_pool = NULL;
|
||||
|
||||
if (idmap_types & MAIN_IDMAP_TYPE_UUID) {
|
||||
ID *id;
|
||||
@@ -148,6 +151,60 @@ struct IDNameLib_Map *BKE_main_idmap_create(struct Main *bmain,
|
||||
return id_map;
|
||||
}
|
||||
|
||||
void BKE_main_idmap_insert_id(struct IDNameLib_Map *id_map, ID *id)
|
||||
{
|
||||
if (id_map->idmap_types & MAIN_IDMAP_TYPE_NAME) {
|
||||
const short id_type = GS(id->name);
|
||||
struct IDNameLib_TypeMap *type_map = main_idmap_from_idcode(id_map, id_type);
|
||||
|
||||
/* No need to do anything if map has not been lazyly created yet. */
|
||||
if (LIKELY(type_map != NULL) && type_map->map != NULL) {
|
||||
BLI_assert(id_map->type_maps_keys_pool != NULL);
|
||||
|
||||
struct IDNameLib_Key *key = BLI_mempool_alloc(id_map->type_maps_keys_pool);
|
||||
key->name = id->name + 2;
|
||||
key->lib = id->lib;
|
||||
BLI_ghash_insert(type_map->map, key, id);
|
||||
}
|
||||
}
|
||||
|
||||
if (id_map->idmap_types & MAIN_IDMAP_TYPE_UUID) {
|
||||
BLI_assert(id_map->uuid_map != NULL);
|
||||
BLI_assert(id->session_uuid != MAIN_ID_SESSION_UUID_UNSET);
|
||||
void **id_ptr_v;
|
||||
const bool existing_key = BLI_ghash_ensure_p(
|
||||
id_map->uuid_map, POINTER_FROM_UINT(id->session_uuid), &id_ptr_v);
|
||||
BLI_assert(existing_key == false);
|
||||
UNUSED_VARS_NDEBUG(existing_key);
|
||||
|
||||
*id_ptr_v = id;
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_main_idmap_remove_id(struct IDNameLib_Map *id_map, ID *id)
|
||||
{
|
||||
if (id_map->idmap_types & MAIN_IDMAP_TYPE_NAME) {
|
||||
const short id_type = GS(id->name);
|
||||
struct IDNameLib_TypeMap *type_map = main_idmap_from_idcode(id_map, id_type);
|
||||
|
||||
/* No need to do anything if map has not been lazyly created yet. */
|
||||
if (LIKELY(type_map != NULL) && type_map->map != NULL) {
|
||||
BLI_assert(id_map->type_maps_keys_pool != NULL);
|
||||
|
||||
/* NOTE: We cannot free the key from the MemPool here, would need new API from GHash to also
|
||||
* retrieve key pointer. Not a big deal for now */
|
||||
BLI_ghash_remove(type_map->map, &(struct IDNameLib_Key){id->name + 2, id->lib}, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (id_map->idmap_types & MAIN_IDMAP_TYPE_UUID) {
|
||||
BLI_assert(id_map->uuid_map != NULL);
|
||||
BLI_assert(id->session_uuid != MAIN_ID_SESSION_UUID_UNSET);
|
||||
|
||||
BLI_ghash_remove(id_map->uuid_map, POINTER_FROM_UINT(id->session_uuid), NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
struct Main *BKE_main_idmap_main_get(struct IDNameLib_Map *id_map)
|
||||
{
|
||||
return id_map->bmain;
|
||||
@@ -181,20 +238,17 @@ ID *BKE_main_idmap_lookup_name(struct IDNameLib_Map *id_map,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* lazy init */
|
||||
/* Lazy init. */
|
||||
if (type_map->map == NULL) {
|
||||
ListBase *lb = which_libbase(id_map->bmain, id_type);
|
||||
const int lb_len = BLI_listbase_count(lb);
|
||||
if (lb_len == 0) {
|
||||
return NULL;
|
||||
if (id_map->type_maps_keys_pool == NULL) {
|
||||
id_map->type_maps_keys_pool = BLI_mempool_create(
|
||||
sizeof(struct IDNameLib_Key), 1024, 1024, BLI_MEMPOOL_NOP);
|
||||
}
|
||||
type_map->map = BLI_ghash_new_ex(idkey_hash, idkey_cmp, __func__, lb_len);
|
||||
type_map->keys = MEM_mallocN(sizeof(struct IDNameLib_Key) * lb_len, __func__);
|
||||
|
||||
GHash *map = type_map->map;
|
||||
struct IDNameLib_Key *key = type_map->keys;
|
||||
|
||||
for (ID *id = lb->first; id; id = id->next, key++) {
|
||||
GHash *map = type_map->map = BLI_ghash_new(idkey_hash, idkey_cmp, __func__);
|
||||
ListBase *lb = which_libbase(id_map->bmain, id_type);
|
||||
for (ID *id = lb->first; id; id = id->next) {
|
||||
struct IDNameLib_Key *key = BLI_mempool_alloc(id_map->type_maps_keys_pool);
|
||||
key->name = id->name + 2;
|
||||
key->lib = id->lib;
|
||||
BLI_ghash_insert(map, key, id);
|
||||
@@ -235,14 +289,19 @@ void BKE_main_idmap_destroy(struct IDNameLib_Map *id_map)
|
||||
if (type_map->map) {
|
||||
BLI_ghash_free(type_map->map, NULL, NULL);
|
||||
type_map->map = NULL;
|
||||
MEM_freeN(type_map->keys);
|
||||
}
|
||||
}
|
||||
if (id_map->type_maps_keys_pool != NULL) {
|
||||
BLI_mempool_destroy(id_map->type_maps_keys_pool);
|
||||
id_map->type_maps_keys_pool = NULL;
|
||||
}
|
||||
}
|
||||
if (id_map->idmap_types & MAIN_IDMAP_TYPE_UUID) {
|
||||
BLI_ghash_free(id_map->uuid_map, NULL, NULL);
|
||||
}
|
||||
|
||||
BLI_assert(id_map->type_maps_keys_pool == NULL);
|
||||
|
||||
if (id_map->valid_id_pointers != NULL) {
|
||||
BLI_gset_free(id_map->valid_id_pointers, NULL);
|
||||
}
|
||||
|
@@ -97,6 +97,8 @@ class MeshesToIMeshInfo {
|
||||
/* Transformation matrix to transform a coordinate in the corresponding
|
||||
* Mesh to the local space of the first Mesh. */
|
||||
Array<float4x4> to_target_transform;
|
||||
/* For each input mesh, whether or not their transform is negative. */
|
||||
Array<bool> has_negative_transform;
|
||||
/* For each input mesh, how to remap the material slot numbers to
|
||||
* the material slots in the first mesh. */
|
||||
Span<Array<short>> material_remaps;
|
||||
@@ -277,6 +279,7 @@ static IMesh meshes_to_imesh(Span<const Mesh *> meshes,
|
||||
r_info->mesh_edge_offset = Array<int>(nmeshes);
|
||||
r_info->mesh_poly_offset = Array<int>(nmeshes);
|
||||
r_info->to_target_transform = Array<float4x4>(nmeshes);
|
||||
r_info->has_negative_transform = Array<bool>(nmeshes);
|
||||
r_info->material_remaps = material_remaps;
|
||||
int v = 0;
|
||||
int e = 0;
|
||||
@@ -309,6 +312,12 @@ static IMesh meshes_to_imesh(Span<const Mesh *> meshes,
|
||||
const float4x4 objn_mat = (obmats[mi] == nullptr) ? float4x4::identity() :
|
||||
clean_obmat(*obmats[mi]);
|
||||
r_info->to_target_transform[mi] = inv_target_mat * objn_mat;
|
||||
r_info->has_negative_transform[mi] = objn_mat.is_negative();
|
||||
|
||||
/* All meshes 1 and up will be transformed into the local space of operand 0.
|
||||
* Historical behavior of the modifier has been to flip the faces of any meshes
|
||||
* that would have a negative transform if you do that. */
|
||||
bool need_face_flip = r_info->has_negative_transform[mi] != r_info->has_negative_transform[0];
|
||||
|
||||
Vector<Vert *> verts(me->totvert);
|
||||
Span<MVert> mverts = Span(me->mvert, me->totvert);
|
||||
@@ -346,14 +355,21 @@ static IMesh meshes_to_imesh(Span<const Mesh *> meshes,
|
||||
|
||||
for (const MPoly &poly : Span(me->mpoly, me->totpoly)) {
|
||||
int flen = poly.totloop;
|
||||
face_vert.clear();
|
||||
face_edge_orig.clear();
|
||||
face_vert.resize(flen);
|
||||
face_edge_orig.resize(flen);
|
||||
const MLoop *l = &me->mloop[poly.loopstart];
|
||||
for (int i = 0; i < flen; ++i) {
|
||||
int mverti = r_info->mesh_vert_offset[mi] + l->v;
|
||||
const Vert *fv = r_info->mesh_to_imesh_vert[mverti];
|
||||
face_vert.append(fv);
|
||||
face_edge_orig.append(e + l->e);
|
||||
if (need_face_flip) {
|
||||
face_vert[flen - i - 1] = fv;
|
||||
int iedge = i < flen - 1 ? flen - i - 2 : flen - 1;
|
||||
face_edge_orig[iedge] = e + l->e;
|
||||
}
|
||||
else {
|
||||
face_vert[i] = fv;
|
||||
face_edge_orig[i] = e + l->e;
|
||||
}
|
||||
++l;
|
||||
}
|
||||
r_info->mesh_to_imesh_face[f] = arena.add_face(face_vert, f, face_edge_orig);
|
||||
|
@@ -218,6 +218,11 @@ struct float4x4 {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool is_negative() const
|
||||
{
|
||||
return is_negative_m4(ptr());
|
||||
}
|
||||
|
||||
uint64_t hash() const
|
||||
{
|
||||
uint64_t h = 435109;
|
||||
|
@@ -464,6 +464,13 @@ void blo_join_main(ListBase *mainlist)
|
||||
Main *tojoin, *mainl;
|
||||
|
||||
mainl = mainlist->first;
|
||||
|
||||
if (mainl->id_map != NULL) {
|
||||
/* Cannot keep this since we add some IDs from joined mains. */
|
||||
BKE_main_idmap_destroy(mainl->id_map);
|
||||
mainl->id_map = NULL;
|
||||
}
|
||||
|
||||
while ((tojoin = mainl->next)) {
|
||||
add_main_to_main(mainl, tojoin);
|
||||
BLI_remlink(mainlist, tojoin);
|
||||
@@ -502,6 +509,12 @@ void blo_split_main(ListBase *mainlist, Main *main)
|
||||
return;
|
||||
}
|
||||
|
||||
if (main->id_map != NULL) {
|
||||
/* Cannot keep this since we remove some IDs from given main. */
|
||||
BKE_main_idmap_destroy(main->id_map);
|
||||
main->id_map = NULL;
|
||||
}
|
||||
|
||||
/* (Library.temp_index -> Main), lookup table */
|
||||
const uint lib_main_array_len = BLI_listbase_count(&main->libraries);
|
||||
Main **lib_main_array = MEM_malloc_arrayN(lib_main_array_len, sizeof(*lib_main_array), __func__);
|
||||
@@ -3209,6 +3222,10 @@ static ID *create_placeholder(Main *mainvar, const short idcode, const char *idn
|
||||
BLI_addtail(lb, ph_id);
|
||||
id_sort_by_name(lb, ph_id, NULL);
|
||||
|
||||
if (mainvar->id_map != NULL) {
|
||||
BKE_main_idmap_insert_id(mainvar->id_map, ph_id);
|
||||
}
|
||||
|
||||
if ((tag & LIB_TAG_TEMP_MAIN) == 0) {
|
||||
BKE_lib_libblock_session_uuid_ensure(ph_id);
|
||||
}
|
||||
@@ -3667,6 +3684,10 @@ static BHead *read_libblock(FileData *fd,
|
||||
if (r_id) {
|
||||
*r_id = id_old;
|
||||
}
|
||||
if (main->id_map != NULL) {
|
||||
BKE_main_idmap_insert_id(main->id_map, id_old);
|
||||
}
|
||||
|
||||
return blo_bhead_next(fd, bhead);
|
||||
}
|
||||
}
|
||||
@@ -3725,6 +3746,11 @@ static BHead *read_libblock(FileData *fd,
|
||||
}
|
||||
|
||||
direct_link_id(fd, main, id_tag, id, id_old);
|
||||
|
||||
if (main->id_map != NULL) {
|
||||
BKE_main_idmap_insert_id(main->id_map, id);
|
||||
}
|
||||
|
||||
return blo_bhead_next(fd, bhead);
|
||||
}
|
||||
|
||||
@@ -3748,6 +3774,13 @@ static BHead *read_libblock(FileData *fd,
|
||||
else if (id_old) {
|
||||
/* For undo, store contents read into id at id_old. */
|
||||
read_libblock_undo_restore_at_old_address(fd, main, id, id_old);
|
||||
|
||||
if (main->id_map != NULL) {
|
||||
BKE_main_idmap_insert_id(main->id_map, id_old);
|
||||
}
|
||||
}
|
||||
else if (main->id_map != NULL) {
|
||||
BKE_main_idmap_insert_id(main->id_map, id);
|
||||
}
|
||||
|
||||
return bhead;
|
||||
@@ -4299,6 +4332,8 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
|
||||
|
||||
fd->mainlist = NULL; /* Safety, this is local variable, shall not be used afterward. */
|
||||
|
||||
BLI_assert(bfd->main->id_map == NULL);
|
||||
|
||||
return bfd;
|
||||
}
|
||||
|
||||
@@ -4443,9 +4478,16 @@ static BHead *find_bhead_from_idname(FileData *fd, const char *idname)
|
||||
|
||||
static ID *is_yet_read(FileData *fd, Main *mainvar, BHead *bhead)
|
||||
{
|
||||
if (mainvar->id_map == NULL) {
|
||||
mainvar->id_map = BKE_main_idmap_create(mainvar, false, NULL, MAIN_IDMAP_TYPE_NAME);
|
||||
}
|
||||
BLI_assert(BKE_main_idmap_main_get(mainvar->id_map) == mainvar);
|
||||
|
||||
const char *idname = blo_bhead_id_name(fd, bhead);
|
||||
/* which_libbase can be NULL, intentionally not using idname+2 */
|
||||
return BLI_findstring(which_libbase(mainvar, GS(idname)), idname, offsetof(ID, name));
|
||||
|
||||
ID *id = BKE_main_idmap_lookup_name(mainvar->id_map, GS(idname), idname + 2, mainvar->curlib);
|
||||
BLI_assert(id == BLI_findstring(which_libbase(mainvar, GS(idname)), idname, offsetof(ID, name)));
|
||||
return id;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -5196,6 +5238,10 @@ static void library_link_end(Main *mainl,
|
||||
Main *mainvar;
|
||||
Library *curlib;
|
||||
|
||||
if (mainl->id_map == NULL) {
|
||||
mainl->id_map = BKE_main_idmap_create(mainl, false, NULL, MAIN_IDMAP_TYPE_NAME);
|
||||
}
|
||||
|
||||
/* expander now is callback function */
|
||||
BLO_main_expander(expand_doit_library);
|
||||
|
||||
@@ -5401,6 +5447,9 @@ static void read_library_linked_ids(FileData *basefd,
|
||||
ID *id_next = id->next;
|
||||
if ((id->tag & LIB_TAG_ID_LINK_PLACEHOLDER) && !(id->flag & LIB_INDIRECT_WEAK_LINK)) {
|
||||
BLI_remlink(lbarray[a], id);
|
||||
if (mainvar->id_map != NULL) {
|
||||
BKE_main_idmap_remove_id(mainvar->id_map, id);
|
||||
}
|
||||
|
||||
/* When playing with lib renaming and such, you may end with cases where
|
||||
* you have more than one linked ID of the same data-block from same
|
||||
@@ -5569,6 +5618,10 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
|
||||
|
||||
if (fd) {
|
||||
do_it = true;
|
||||
|
||||
if (mainptr->id_map == NULL) {
|
||||
mainptr->id_map = BKE_main_idmap_create(mainptr, false, NULL, MAIN_IDMAP_TYPE_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
/* Read linked data-locks for each link placeholder, and replace
|
||||
|
@@ -1115,8 +1115,6 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "gpencil_v3d_align")) {
|
||||
ts->gpencil_v3d_align = GP_PROJECT_VIEWSPACE;
|
||||
ts->gpencil_v2d_align = GP_PROJECT_VIEWSPACE;
|
||||
ts->gpencil_seq_align = GP_PROJECT_VIEWSPACE;
|
||||
ts->gpencil_ima_align = GP_PROJECT_VIEWSPACE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -663,6 +663,12 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set default 2D annotation placement. */
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
ts->gpencil_v2d_align = GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -384,7 +384,7 @@ typedef struct BevelParams {
|
||||
|
||||
// #pragma GCC diagnostic ignored "-Wpadded"
|
||||
|
||||
/* Only for debugging, this file shouldn't be in blender repo. */
|
||||
/* Only for debugging, this file shouldn't be in blender repository. */
|
||||
// #include "bevdebug.c"
|
||||
|
||||
/* Use the unused _BM_ELEM_TAG_ALT flag to flag the 'long' loops (parallel to beveled edge)
|
||||
@@ -1495,8 +1495,9 @@ static void offset_meet(BevelParams *bp,
|
||||
}
|
||||
}
|
||||
|
||||
/* Chosen so 1/sin(BEVEL_GOOD_ANGLE) is about 4, giving that expansion factor to bevel width. */
|
||||
#define BEVEL_GOOD_ANGLE 0.25f
|
||||
/* This was changed from 0.25f to fix bug T86768.
|
||||
* Original bug T44961 remains fixed with this value. */
|
||||
#define BEVEL_GOOD_ANGLE 0.0001f
|
||||
|
||||
/**
|
||||
* Calculate the meeting point between e1 and e2 (one of which should have zero offsets),
|
||||
|
@@ -94,6 +94,7 @@ ConstantOperation *ConstantFolder::fold_operation(NodeOperation *operation)
|
||||
const DataType data_type = operation->getOutputSocket()->getDataType();
|
||||
MemoryBuffer fold_buf(data_type, first_elem_area_);
|
||||
Vector<MemoryBuffer *> input_bufs = get_constant_input_buffers(operation);
|
||||
operation->init_data();
|
||||
operation->render(&fold_buf, {first_elem_area_}, input_bufs);
|
||||
|
||||
MemoryBuffer *constant_buf = create_constant_buffer(data_type);
|
||||
|
@@ -518,7 +518,7 @@ void COM_convert_resolution(NodeOperationBuilder &builder,
|
||||
NodeOperation *first = nullptr;
|
||||
ScaleOperation *scaleOperation = nullptr;
|
||||
if (doScale) {
|
||||
scaleOperation = new ScaleOperation(fromSocket->getDataType());
|
||||
scaleOperation = new ScaleRelativeOperation(fromSocket->getDataType());
|
||||
scaleOperation->getInputSocket(1)->setResizeMode(ResizeMode::None);
|
||||
scaleOperation->getInputSocket(2)->setResizeMode(ResizeMode::None);
|
||||
first = scaleOperation;
|
||||
|
@@ -492,6 +492,7 @@ void DebugInfo::delete_operation_exports()
|
||||
BLI_delete(file->path, false, false);
|
||||
}
|
||||
}
|
||||
BLI_filelist_free(file_list, num_files);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,9 +17,28 @@
|
||||
*/
|
||||
|
||||
#include "COM_Enums.h"
|
||||
#include "BLI_rect.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
void expand_area_for_sampler(rcti &area, PixelSampler sampler)
|
||||
{
|
||||
switch (sampler) {
|
||||
case PixelSampler::Nearest:
|
||||
break;
|
||||
case PixelSampler::Bilinear:
|
||||
area.xmax += 1;
|
||||
area.ymax += 1;
|
||||
break;
|
||||
case PixelSampler::Bicubic:
|
||||
area.xmin -= 1;
|
||||
area.xmax += 2;
|
||||
area.ymin -= 1;
|
||||
area.ymax += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const eCompositorPriority &priority)
|
||||
{
|
||||
switch (priority) {
|
||||
|
@@ -22,6 +22,8 @@
|
||||
|
||||
#include <ostream>
|
||||
|
||||
struct rcti;
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
/**
|
||||
@@ -85,6 +87,13 @@ enum class eWorkPackageType {
|
||||
CustomFunction = 1
|
||||
};
|
||||
|
||||
enum class PixelSampler {
|
||||
Nearest = 0,
|
||||
Bilinear = 1,
|
||||
Bicubic = 2,
|
||||
};
|
||||
void expand_area_for_sampler(rcti &area, PixelSampler sampler);
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const eCompositorPriority &priority);
|
||||
std::ostream &operator<<(std::ostream &os, const eWorkPackageState &execution_state);
|
||||
|
||||
|
@@ -82,6 +82,7 @@ ExecutionSystem::ExecutionSystem(RenderData *rd,
|
||||
BLI_assert_msg(0, "Non implemented execution model");
|
||||
break;
|
||||
}
|
||||
num_work_threads_ = WorkScheduler::get_num_cpu_threads();
|
||||
}
|
||||
|
||||
ExecutionSystem::~ExecutionSystem()
|
||||
@@ -112,6 +113,9 @@ void ExecutionSystem::set_operations(const Vector<NodeOperation *> &operations,
|
||||
void ExecutionSystem::execute()
|
||||
{
|
||||
DebugInfo::execute_started(this);
|
||||
for (NodeOperation *op : m_operations) {
|
||||
op->init_data();
|
||||
}
|
||||
execution_model_->execute(*this);
|
||||
}
|
||||
|
||||
@@ -127,7 +131,7 @@ void ExecutionSystem::execute_work(const rcti &work_rect,
|
||||
|
||||
/* Split work vertically to maximize continuous memory. */
|
||||
const int work_height = BLI_rcti_size_y(&work_rect);
|
||||
const int num_sub_works = MIN2(WorkScheduler::get_num_cpu_threads(), work_height);
|
||||
const int num_sub_works = MIN2(num_work_threads_, work_height);
|
||||
const int split_height = num_sub_works == 0 ? 0 : work_height / num_sub_works;
|
||||
int remaining_height = work_height - split_height * num_sub_works;
|
||||
|
||||
|
@@ -31,6 +31,7 @@ class ExecutionGroup;
|
||||
#include "DNA_node_types.h"
|
||||
|
||||
#include "BLI_vector.hh"
|
||||
#include "atomic_ops.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
@@ -150,6 +151,11 @@ class ExecutionSystem {
|
||||
*/
|
||||
ExecutionModel *execution_model_;
|
||||
|
||||
/**
|
||||
* Number of cpu threads available for work execution.
|
||||
*/
|
||||
int num_work_threads_;
|
||||
|
||||
ThreadMutex work_mutex_;
|
||||
ThreadCondition work_finished_cond_;
|
||||
|
||||
@@ -201,6 +207,27 @@ class ExecutionSystem {
|
||||
|
||||
void execute_work(const rcti &work_rect, std::function<void(const rcti &split_rect)> work_func);
|
||||
|
||||
/**
|
||||
* Multi-threaded execution of given work function passing work_rect splits as argument.
|
||||
* Once finished, caller thread will call reduce_func for each thread result.
|
||||
*/
|
||||
template<typename TResult>
|
||||
void execute_work(const rcti &work_rect,
|
||||
std::function<TResult(const rcti &split_rect)> work_func,
|
||||
TResult &join,
|
||||
std::function<void(TResult &join, const TResult &chunk)> reduce_func)
|
||||
{
|
||||
Array<TResult> chunks(num_work_threads_);
|
||||
int num_started = 0;
|
||||
execute_work(work_rect, [&](const rcti &split_rect) {
|
||||
const int current = atomic_fetch_and_add_int32(&num_started, 1);
|
||||
chunks[current] = work_func(split_rect);
|
||||
});
|
||||
for (const int i : IndexRange(num_started)) {
|
||||
reduce_func(join, chunks[i]);
|
||||
}
|
||||
}
|
||||
|
||||
bool is_breaked() const;
|
||||
|
||||
private:
|
||||
|
@@ -189,6 +189,25 @@ class MemoryBuffer {
|
||||
return m_buffer + get_coords_offset(x, y);
|
||||
}
|
||||
|
||||
void read_elem(int x, int y, float *out) const
|
||||
{
|
||||
memcpy(out, get_elem(x, y), m_num_channels * sizeof(float));
|
||||
}
|
||||
|
||||
void read_elem_sampled(float x, float y, PixelSampler sampler, float *out) const
|
||||
{
|
||||
switch (sampler) {
|
||||
case PixelSampler::Nearest:
|
||||
this->read_elem(x, y, out);
|
||||
break;
|
||||
case PixelSampler::Bilinear:
|
||||
case PixelSampler::Bicubic:
|
||||
/* No bicubic. Current implementation produces fuzzy results. */
|
||||
this->readBilinear(out, x, y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get channel value at given coordinates.
|
||||
*/
|
||||
@@ -330,7 +349,7 @@ class MemoryBuffer {
|
||||
inline void wrap_pixel(float &x,
|
||||
float &y,
|
||||
MemoryBufferExtend extend_x,
|
||||
MemoryBufferExtend extend_y)
|
||||
MemoryBufferExtend extend_y) const
|
||||
{
|
||||
const float w = (float)getWidth();
|
||||
const float h = (float)getHeight();
|
||||
@@ -427,7 +446,7 @@ class MemoryBuffer {
|
||||
float x,
|
||||
float y,
|
||||
MemoryBufferExtend extend_x = MemoryBufferExtend::Clip,
|
||||
MemoryBufferExtend extend_y = MemoryBufferExtend::Clip)
|
||||
MemoryBufferExtend extend_y = MemoryBufferExtend::Clip) const
|
||||
{
|
||||
float u = x;
|
||||
float v = y;
|
||||
|
@@ -100,6 +100,11 @@ void NodeOperation::setResolutionInputSocketIndex(unsigned int index)
|
||||
{
|
||||
this->m_resolutionInputSocketIndex = index;
|
||||
}
|
||||
|
||||
void NodeOperation::init_data()
|
||||
{
|
||||
/* Pass. */
|
||||
}
|
||||
void NodeOperation::initExecution()
|
||||
{
|
||||
/* pass */
|
||||
|
@@ -75,12 +75,6 @@ enum class ResizeMode {
|
||||
Stretch = NS_CR_STRETCH,
|
||||
};
|
||||
|
||||
enum class PixelSampler {
|
||||
Nearest = 0,
|
||||
Bilinear = 1,
|
||||
Bicubic = 2,
|
||||
};
|
||||
|
||||
class NodeOperationInput {
|
||||
private:
|
||||
NodeOperation *m_operation;
|
||||
@@ -424,6 +418,12 @@ class NodeOperation {
|
||||
exec_system_ = system;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes operation data needed after operations are linked and resolutions determined. For
|
||||
* rendering heap memory data use initExecution().
|
||||
*/
|
||||
virtual void init_data();
|
||||
|
||||
virtual void initExecution();
|
||||
|
||||
/**
|
||||
|
@@ -43,7 +43,7 @@ void ScaleNode::convertToOperations(NodeConverter &converter,
|
||||
|
||||
switch (bnode->custom1) {
|
||||
case CMP_SCALE_RELATIVE: {
|
||||
ScaleOperation *operation = new ScaleOperation();
|
||||
ScaleRelativeOperation *operation = new ScaleRelativeOperation();
|
||||
converter.addOperation(operation);
|
||||
|
||||
converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
|
||||
@@ -59,7 +59,7 @@ void ScaleNode::convertToOperations(NodeConverter &converter,
|
||||
scaleFactorOperation->setValue(context.getRenderPercentageAsFactor());
|
||||
converter.addOperation(scaleFactorOperation);
|
||||
|
||||
ScaleOperation *operation = new ScaleOperation();
|
||||
ScaleRelativeOperation *operation = new ScaleRelativeOperation();
|
||||
converter.addOperation(operation);
|
||||
|
||||
converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
|
||||
|
@@ -43,7 +43,7 @@ void Stabilize2dNode::convertToOperations(NodeConverter &converter,
|
||||
MovieClip *clip = (MovieClip *)editorNode->id;
|
||||
bool invert = (editorNode->custom2 & CMP_NODEFLAG_STABILIZE_INVERSE) != 0;
|
||||
|
||||
ScaleOperation *scaleOperation = new ScaleOperation();
|
||||
ScaleRelativeOperation *scaleOperation = new ScaleRelativeOperation();
|
||||
scaleOperation->setSampler((PixelSampler)editorNode->custom1);
|
||||
RotateOperation *rotateOperation = new RotateOperation();
|
||||
rotateOperation->setDoDegree2RadConversion(false);
|
||||
|
@@ -40,7 +40,7 @@ void TransformNode::convertToOperations(NodeConverter &converter,
|
||||
NodeInput *angleInput = this->getInputSocket(3);
|
||||
NodeInput *scaleInput = this->getInputSocket(4);
|
||||
|
||||
ScaleOperation *scaleOperation = new ScaleOperation();
|
||||
ScaleRelativeOperation *scaleOperation = new ScaleRelativeOperation();
|
||||
converter.addOperation(scaleOperation);
|
||||
|
||||
RotateOperation *rotateOperation = new RotateOperation();
|
||||
|
@@ -105,6 +105,64 @@ void BoxMaskOperation::executePixelSampled(float output[4], float x, float y, Pi
|
||||
}
|
||||
}
|
||||
|
||||
void BoxMaskOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs)
|
||||
{
|
||||
MaskFunc mask_func;
|
||||
switch (m_maskType) {
|
||||
case CMP_NODE_MASKTYPE_ADD:
|
||||
mask_func = [](const bool is_inside, const float *mask, const float *value) {
|
||||
return is_inside ? MAX2(mask[0], value[0]) : mask[0];
|
||||
};
|
||||
break;
|
||||
case CMP_NODE_MASKTYPE_SUBTRACT:
|
||||
mask_func = [](const bool is_inside, const float *mask, const float *value) {
|
||||
return is_inside ? CLAMPIS(mask[0] - value[0], 0, 1) : mask[0];
|
||||
};
|
||||
break;
|
||||
case CMP_NODE_MASKTYPE_MULTIPLY:
|
||||
mask_func = [](const bool is_inside, const float *mask, const float *value) {
|
||||
return is_inside ? mask[0] * value[0] : 0;
|
||||
};
|
||||
break;
|
||||
case CMP_NODE_MASKTYPE_NOT:
|
||||
mask_func = [](const bool is_inside, const float *mask, const float *value) {
|
||||
if (is_inside) {
|
||||
return mask[0] > 0.0f ? 0.0f : value[0];
|
||||
}
|
||||
return mask[0];
|
||||
};
|
||||
break;
|
||||
}
|
||||
apply_mask(output, area, inputs, mask_func);
|
||||
}
|
||||
|
||||
void BoxMaskOperation::apply_mask(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs,
|
||||
MaskFunc mask_func)
|
||||
{
|
||||
const float op_w = this->getWidth();
|
||||
const float op_h = this->getHeight();
|
||||
const float half_w = this->m_data->width / 2.0f;
|
||||
const float half_h = this->m_data->height / 2.0f;
|
||||
for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
|
||||
const float op_ry = it.y / op_h;
|
||||
const float dy = (op_ry - this->m_data->y) / m_aspectRatio;
|
||||
const float op_rx = it.x / op_w;
|
||||
const float dx = op_rx - this->m_data->x;
|
||||
const float rx = this->m_data->x + (m_cosine * dx + m_sine * dy);
|
||||
const float ry = this->m_data->y + (-m_sine * dx + m_cosine * dy);
|
||||
|
||||
const bool inside = (rx > this->m_data->x - half_w && rx < this->m_data->x + half_w &&
|
||||
ry > this->m_data->y - half_h && ry < this->m_data->y + half_h);
|
||||
const float *mask = it.in(0);
|
||||
const float *value = it.in(1);
|
||||
*it.out = mask_func(inside, mask, value);
|
||||
}
|
||||
}
|
||||
|
||||
void BoxMaskOperation::deinitExecution()
|
||||
{
|
||||
this->m_inputMask = nullptr;
|
||||
|
@@ -18,12 +18,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "COM_NodeOperation.h"
|
||||
#include "COM_MultiThreadedOperation.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
class BoxMaskOperation : public NodeOperation {
|
||||
class BoxMaskOperation : public MultiThreadedOperation {
|
||||
private:
|
||||
using MaskFunc = std::function<float(bool is_inside, const float *mask, const float *value)>;
|
||||
|
||||
/**
|
||||
* Cached reference to the inputProgram
|
||||
*/
|
||||
@@ -64,6 +66,16 @@ class BoxMaskOperation : public NodeOperation {
|
||||
{
|
||||
this->m_maskType = maskType;
|
||||
}
|
||||
|
||||
void update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) override;
|
||||
|
||||
private:
|
||||
void apply_mask(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs,
|
||||
MaskFunc mask_func);
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "COM_CalculateMeanOperation.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
#include "IMB_colormanagement.h"
|
||||
|
||||
@@ -128,4 +129,93 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer *tile)
|
||||
this->m_result = sum / pixels;
|
||||
}
|
||||
|
||||
void CalculateMeanOperation::setSetting(int setting)
|
||||
{
|
||||
this->m_setting = setting;
|
||||
switch (setting) {
|
||||
case 1: {
|
||||
setting_func_ = IMB_colormanagement_get_luminance;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
setting_func_ = [](const float *elem) { return elem[0]; };
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
setting_func_ = [](const float *elem) { return elem[1]; };
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
setting_func_ = [](const float *elem) { return elem[2]; };
|
||||
break;
|
||||
}
|
||||
case 5: {
|
||||
setting_func_ = [](const float *elem) {
|
||||
float yuv[3];
|
||||
rgb_to_yuv(elem[0], elem[1], elem[2], &yuv[0], &yuv[1], &yuv[2], BLI_YUV_ITU_BT709);
|
||||
return yuv[0];
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateMeanOperation::get_area_of_interest(int input_idx,
|
||||
const rcti &UNUSED(output_area),
|
||||
rcti &r_input_area)
|
||||
{
|
||||
BLI_assert(input_idx == 0);
|
||||
NodeOperation *operation = getInputOperation(input_idx);
|
||||
r_input_area.xmin = 0;
|
||||
r_input_area.ymin = 0;
|
||||
r_input_area.xmax = operation->getWidth();
|
||||
r_input_area.ymax = operation->getHeight();
|
||||
}
|
||||
|
||||
void CalculateMeanOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(output),
|
||||
const rcti &UNUSED(area),
|
||||
Span<MemoryBuffer *> inputs)
|
||||
{
|
||||
if (!this->m_iscalculated) {
|
||||
MemoryBuffer *input = inputs[0];
|
||||
m_result = calc_mean(input);
|
||||
this->m_iscalculated = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateMeanOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> UNUSED(inputs))
|
||||
{
|
||||
output->fill(area, &m_result);
|
||||
}
|
||||
|
||||
float CalculateMeanOperation::calc_mean(const MemoryBuffer *input)
|
||||
{
|
||||
PixelsSum total = {0};
|
||||
exec_system_->execute_work<PixelsSum>(
|
||||
input->get_rect(),
|
||||
[=](const rcti &split) { return calc_area_sum(input, split); },
|
||||
total,
|
||||
[](PixelsSum &join, const PixelsSum &chunk) {
|
||||
join.sum += chunk.sum;
|
||||
join.num_pixels += chunk.num_pixels;
|
||||
});
|
||||
return total.num_pixels == 0 ? 0.0f : total.sum / total.num_pixels;
|
||||
}
|
||||
|
||||
using PixelsSum = CalculateMeanOperation::PixelsSum;
|
||||
PixelsSum CalculateMeanOperation::calc_area_sum(const MemoryBuffer *input, const rcti &area)
|
||||
{
|
||||
PixelsSum result = {0};
|
||||
for (const float *elem : input->get_buffer_area(area)) {
|
||||
if (elem[3] <= 0.0f) {
|
||||
continue;
|
||||
}
|
||||
result.sum += setting_func_(elem);
|
||||
result.num_pixels++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
@@ -18,8 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "COM_NodeOperation.h"
|
||||
#include "COM_MultiThreadedOperation.h"
|
||||
#include "DNA_node_types.h"
|
||||
#include <functional>
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
@@ -27,7 +28,13 @@ namespace blender::compositor {
|
||||
* \brief base class of CalculateMean, implementing the simple CalculateMean
|
||||
* \ingroup operation
|
||||
*/
|
||||
class CalculateMeanOperation : public NodeOperation {
|
||||
class CalculateMeanOperation : public MultiThreadedOperation {
|
||||
public:
|
||||
struct PixelsSum {
|
||||
float sum;
|
||||
int num_pixels;
|
||||
};
|
||||
|
||||
protected:
|
||||
/**
|
||||
* \brief Cached reference to the reader
|
||||
@@ -37,6 +44,7 @@ class CalculateMeanOperation : public NodeOperation {
|
||||
bool m_iscalculated;
|
||||
float m_result;
|
||||
int m_setting;
|
||||
std::function<float(const float *elem)> setting_func_;
|
||||
|
||||
public:
|
||||
CalculateMeanOperation();
|
||||
@@ -61,13 +69,24 @@ class CalculateMeanOperation : public NodeOperation {
|
||||
bool determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output) override;
|
||||
void setSetting(int setting)
|
||||
{
|
||||
this->m_setting = setting;
|
||||
}
|
||||
void setSetting(int setting);
|
||||
|
||||
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
|
||||
|
||||
virtual void update_memory_buffer_started(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) override;
|
||||
|
||||
virtual void update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) override;
|
||||
|
||||
protected:
|
||||
void calculateMean(MemoryBuffer *tile);
|
||||
float calc_mean(const MemoryBuffer *input);
|
||||
|
||||
private:
|
||||
PixelsSum calc_area_sum(const MemoryBuffer *input, const rcti &area);
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include "COM_CalculateStandardDeviationOperation.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_utildefines.h"
|
||||
#include "COM_ExecutionSystem.h"
|
||||
|
||||
#include "IMB_colormanagement.h"
|
||||
|
||||
@@ -96,4 +97,50 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CalculateStandardDeviationOperation::update_memory_buffer_started(
|
||||
MemoryBuffer *UNUSED(output), const rcti &UNUSED(area), Span<MemoryBuffer *> inputs)
|
||||
{
|
||||
if (!this->m_iscalculated) {
|
||||
const MemoryBuffer *input = inputs[0];
|
||||
const float mean = CalculateMeanOperation::calc_mean(input);
|
||||
|
||||
PixelsSum total = {0};
|
||||
exec_system_->execute_work<PixelsSum>(
|
||||
input->get_rect(),
|
||||
[=](const rcti &split) { return calc_area_sum(input, split, mean); },
|
||||
total,
|
||||
[](PixelsSum &join, const PixelsSum &chunk) {
|
||||
join.sum += chunk.sum;
|
||||
join.num_pixels += chunk.num_pixels;
|
||||
});
|
||||
this->m_standardDeviation = total.num_pixels <= 1 ?
|
||||
0.0f :
|
||||
sqrt(total.sum / (float)(total.num_pixels - 1));
|
||||
this->m_iscalculated = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateStandardDeviationOperation::update_memory_buffer_partial(
|
||||
MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> UNUSED(inputs))
|
||||
{
|
||||
output->fill(area, &m_standardDeviation);
|
||||
}
|
||||
|
||||
using PixelsSum = CalculateMeanOperation::PixelsSum;
|
||||
PixelsSum CalculateStandardDeviationOperation::calc_area_sum(const MemoryBuffer *input,
|
||||
const rcti &area,
|
||||
const float mean)
|
||||
{
|
||||
PixelsSum result = {0};
|
||||
for (const float *elem : input->get_buffer_area(area)) {
|
||||
if (elem[3] <= 0.0f) {
|
||||
continue;
|
||||
}
|
||||
const float value = setting_func_(elem);
|
||||
result.sum += (value - mean) * (value - mean);
|
||||
result.num_pixels++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
@@ -40,6 +40,17 @@ class CalculateStandardDeviationOperation : public CalculateMeanOperation {
|
||||
void executePixel(float output[4], int x, int y, void *data) override;
|
||||
|
||||
void *initializeTileData(rcti *rect) override;
|
||||
|
||||
void update_memory_buffer_started(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) override;
|
||||
|
||||
void update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) override;
|
||||
|
||||
private:
|
||||
PixelsSum calc_area_sum(const MemoryBuffer *input, const rcti &area, float mean);
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "COM_ScaleOperation.h"
|
||||
#include "COM_ConstantOperation.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
@@ -52,13 +53,51 @@ ScaleOperation::ScaleOperation(DataType data_type) : BaseScaleOperation()
|
||||
this->m_inputXOperation = nullptr;
|
||||
this->m_inputYOperation = nullptr;
|
||||
}
|
||||
|
||||
float ScaleOperation::get_constant_scale(const int input_op_idx, const float factor)
|
||||
{
|
||||
const bool is_constant = getInputOperation(input_op_idx)->get_flags().is_constant_operation;
|
||||
if (is_constant) {
|
||||
return ((ConstantOperation *)getInputOperation(input_op_idx))->get_constant_elem()[0] * factor;
|
||||
}
|
||||
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
float ScaleOperation::get_constant_scale_x()
|
||||
{
|
||||
return get_constant_scale(1, get_relative_scale_x_factor());
|
||||
}
|
||||
|
||||
float ScaleOperation::get_constant_scale_y()
|
||||
{
|
||||
return get_constant_scale(2, get_relative_scale_y_factor());
|
||||
}
|
||||
|
||||
BLI_INLINE float scale_coord(const int coord, const float center, const float relative_scale)
|
||||
{
|
||||
return center + (coord - center) / relative_scale;
|
||||
}
|
||||
|
||||
void ScaleOperation::scale_area(rcti &rect, float scale_x, float scale_y)
|
||||
{
|
||||
rect.xmin = scale_coord(rect.xmin, m_centerX, scale_x);
|
||||
rect.xmax = scale_coord(rect.xmax, m_centerX, scale_x);
|
||||
rect.ymin = scale_coord(rect.ymin, m_centerY, scale_y);
|
||||
rect.ymax = scale_coord(rect.ymax, m_centerY, scale_y);
|
||||
}
|
||||
|
||||
void ScaleOperation::init_data()
|
||||
{
|
||||
m_centerX = getWidth() / 2.0f;
|
||||
m_centerY = getHeight() / 2.0f;
|
||||
}
|
||||
|
||||
void ScaleOperation::initExecution()
|
||||
{
|
||||
this->m_inputOperation = this->getInputSocketReader(0);
|
||||
this->m_inputXOperation = this->getInputSocketReader(1);
|
||||
this->m_inputYOperation = this->getInputSocketReader(2);
|
||||
this->m_centerX = this->getWidth() / 2.0;
|
||||
this->m_centerY = this->getHeight() / 2.0;
|
||||
}
|
||||
|
||||
void ScaleOperation::deinitExecution()
|
||||
@@ -68,7 +107,52 @@ void ScaleOperation::deinitExecution()
|
||||
this->m_inputYOperation = nullptr;
|
||||
}
|
||||
|
||||
void ScaleOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
|
||||
void ScaleOperation::get_area_of_interest(const int input_idx,
|
||||
const rcti &output_area,
|
||||
rcti &r_input_area)
|
||||
{
|
||||
r_input_area = output_area;
|
||||
if (input_idx != 0 || m_variable_size) {
|
||||
return;
|
||||
}
|
||||
|
||||
float scale_x = get_constant_scale_x();
|
||||
float scale_y = get_constant_scale_y();
|
||||
scale_area(r_input_area, scale_x, scale_y);
|
||||
expand_area_for_sampler(r_input_area, (PixelSampler)m_sampler);
|
||||
}
|
||||
|
||||
void ScaleOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs)
|
||||
{
|
||||
const MemoryBuffer *input_img = inputs[0];
|
||||
MemoryBuffer *input_x = inputs[1];
|
||||
MemoryBuffer *input_y = inputs[2];
|
||||
const float scale_x_factor = get_relative_scale_x_factor();
|
||||
const float scale_y_factor = get_relative_scale_y_factor();
|
||||
BuffersIterator<float> it = output->iterate_with({input_x, input_y}, area);
|
||||
for (; !it.is_end(); ++it) {
|
||||
const float rel_scale_x = *it.in(0) * scale_x_factor;
|
||||
const float rel_scale_y = *it.in(1) * scale_y_factor;
|
||||
const float scaled_x = scale_coord(it.x, m_centerX, rel_scale_x);
|
||||
const float scaled_y = scale_coord(it.y, m_centerY, rel_scale_y);
|
||||
input_img->read_elem_sampled(scaled_x, scaled_y, (PixelSampler)m_sampler, it.out);
|
||||
}
|
||||
}
|
||||
|
||||
ScaleRelativeOperation::ScaleRelativeOperation() : ScaleOperation()
|
||||
{
|
||||
}
|
||||
|
||||
ScaleRelativeOperation::ScaleRelativeOperation(DataType data_type) : ScaleOperation(data_type)
|
||||
{
|
||||
}
|
||||
|
||||
void ScaleRelativeOperation::executePixelSampled(float output[4],
|
||||
float x,
|
||||
float y,
|
||||
PixelSampler sampler)
|
||||
{
|
||||
PixelSampler effective_sampler = getEffectiveSampler(sampler);
|
||||
|
||||
@@ -86,9 +170,9 @@ void ScaleOperation::executePixelSampled(float output[4], float x, float y, Pixe
|
||||
this->m_inputOperation->readSampled(output, nx, ny, effective_sampler);
|
||||
}
|
||||
|
||||
bool ScaleOperation::determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output)
|
||||
bool ScaleRelativeOperation::determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output)
|
||||
{
|
||||
rcti newInput;
|
||||
if (!m_variable_size) {
|
||||
@@ -115,34 +199,6 @@ bool ScaleOperation::determineDependingAreaOfInterest(rcti *input,
|
||||
return BaseScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
|
||||
}
|
||||
|
||||
// SCALE ABSOLUTE
|
||||
ScaleAbsoluteOperation::ScaleAbsoluteOperation() : BaseScaleOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_inputXOperation = nullptr;
|
||||
this->m_inputYOperation = nullptr;
|
||||
}
|
||||
void ScaleAbsoluteOperation::initExecution()
|
||||
{
|
||||
this->m_inputOperation = this->getInputSocketReader(0);
|
||||
this->m_inputXOperation = this->getInputSocketReader(1);
|
||||
this->m_inputYOperation = this->getInputSocketReader(2);
|
||||
this->m_centerX = this->getWidth() / 2.0;
|
||||
this->m_centerY = this->getHeight() / 2.0;
|
||||
}
|
||||
|
||||
void ScaleAbsoluteOperation::deinitExecution()
|
||||
{
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_inputXOperation = nullptr;
|
||||
this->m_inputYOperation = nullptr;
|
||||
}
|
||||
|
||||
void ScaleAbsoluteOperation::executePixelSampled(float output[4],
|
||||
float x,
|
||||
float y,
|
||||
@@ -202,8 +258,7 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input,
|
||||
newInput.ymax = this->getHeight();
|
||||
newInput.ymin = 0;
|
||||
}
|
||||
|
||||
return BaseScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
|
||||
return ScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
|
||||
}
|
||||
|
||||
// Absolute fixed size
|
||||
@@ -215,11 +270,12 @@ ScaleFixedSizeOperation::ScaleFixedSizeOperation() : BaseScaleOperation()
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_is_offset = false;
|
||||
}
|
||||
void ScaleFixedSizeOperation::initExecution()
|
||||
|
||||
void ScaleFixedSizeOperation::init_data()
|
||||
{
|
||||
this->m_inputOperation = this->getInputSocketReader(0);
|
||||
this->m_relX = this->m_inputOperation->getWidth() / (float)this->m_newWidth;
|
||||
this->m_relY = this->m_inputOperation->getHeight() / (float)this->m_newHeight;
|
||||
const NodeOperation *input_op = getInputOperation(0);
|
||||
this->m_relX = input_op->getWidth() / (float)this->m_newWidth;
|
||||
this->m_relY = input_op->getHeight() / (float)this->m_newHeight;
|
||||
|
||||
/* *** all the options below are for a fairly special case - camera framing *** */
|
||||
if (this->m_offsetX != 0.0f || this->m_offsetY != 0.0f) {
|
||||
@@ -237,8 +293,8 @@ void ScaleFixedSizeOperation::initExecution()
|
||||
|
||||
if (this->m_is_aspect) {
|
||||
/* apply aspect from clip */
|
||||
const float w_src = this->m_inputOperation->getWidth();
|
||||
const float h_src = this->m_inputOperation->getHeight();
|
||||
const float w_src = input_op->getWidth();
|
||||
const float h_src = input_op->getHeight();
|
||||
|
||||
/* destination aspect is already applied from the camera frame */
|
||||
const float w_dst = this->m_newWidth;
|
||||
@@ -267,6 +323,11 @@ void ScaleFixedSizeOperation::initExecution()
|
||||
/* *** end framing options *** */
|
||||
}
|
||||
|
||||
void ScaleFixedSizeOperation::initExecution()
|
||||
{
|
||||
this->m_inputOperation = this->getInputSocketReader(0);
|
||||
}
|
||||
|
||||
void ScaleFixedSizeOperation::deinitExecution()
|
||||
{
|
||||
this->m_inputOperation = nullptr;
|
||||
@@ -315,4 +376,38 @@ void ScaleFixedSizeOperation::determineResolution(unsigned int resolution[2],
|
||||
resolution[1] = this->m_newHeight;
|
||||
}
|
||||
|
||||
void ScaleFixedSizeOperation::get_area_of_interest(const int input_idx,
|
||||
const rcti &output_area,
|
||||
rcti &r_input_area)
|
||||
{
|
||||
BLI_assert(input_idx == 0);
|
||||
UNUSED_VARS_NDEBUG(input_idx);
|
||||
r_input_area.xmax = (output_area.xmax - m_offsetX) * this->m_relX;
|
||||
r_input_area.xmin = (output_area.xmin - m_offsetX) * this->m_relX;
|
||||
r_input_area.ymax = (output_area.ymax - m_offsetY) * this->m_relY;
|
||||
r_input_area.ymin = (output_area.ymin - m_offsetY) * this->m_relY;
|
||||
expand_area_for_sampler(r_input_area, (PixelSampler)m_sampler);
|
||||
}
|
||||
|
||||
void ScaleFixedSizeOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs)
|
||||
{
|
||||
const MemoryBuffer *input_img = inputs[0];
|
||||
PixelSampler sampler = (PixelSampler)m_sampler;
|
||||
BuffersIterator<float> it = output->iterate_with({}, area);
|
||||
if (this->m_is_offset) {
|
||||
for (; !it.is_end(); ++it) {
|
||||
const float nx = (it.x - this->m_offsetX) * this->m_relX;
|
||||
const float ny = (it.y - this->m_offsetY) * this->m_relY;
|
||||
input_img->read_elem_sampled(nx, ny, sampler, it.out);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (; !it.is_end(); ++it) {
|
||||
input_img->read_elem_sampled(it.x * this->m_relX, it.y * this->m_relY, sampler, it.out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
@@ -18,11 +18,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "COM_NodeOperation.h"
|
||||
#include "COM_MultiThreadedOperation.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
class BaseScaleOperation : public NodeOperation {
|
||||
class BaseScaleOperation : public MultiThreadedOperation {
|
||||
public:
|
||||
void setSampler(PixelSampler sampler)
|
||||
{
|
||||
@@ -46,7 +46,7 @@ class BaseScaleOperation : public NodeOperation {
|
||||
};
|
||||
|
||||
class ScaleOperation : public BaseScaleOperation {
|
||||
private:
|
||||
protected:
|
||||
SocketReader *m_inputOperation;
|
||||
SocketReader *m_inputXOperation;
|
||||
SocketReader *m_inputYOperation;
|
||||
@@ -56,31 +56,59 @@ class ScaleOperation : public BaseScaleOperation {
|
||||
public:
|
||||
ScaleOperation();
|
||||
ScaleOperation(DataType data_type);
|
||||
bool determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output) override;
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
void init_data() override;
|
||||
void initExecution() override;
|
||||
void deinitExecution() override;
|
||||
|
||||
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
|
||||
void update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) override;
|
||||
|
||||
protected:
|
||||
virtual float get_relative_scale_x_factor() = 0;
|
||||
virtual float get_relative_scale_y_factor() = 0;
|
||||
|
||||
private:
|
||||
float get_constant_scale(int input_op_idx, float factor);
|
||||
float get_constant_scale_x();
|
||||
float get_constant_scale_y();
|
||||
void scale_area(rcti &rect, float scale_x, float scale_y);
|
||||
};
|
||||
|
||||
class ScaleAbsoluteOperation : public BaseScaleOperation {
|
||||
SocketReader *m_inputOperation;
|
||||
SocketReader *m_inputXOperation;
|
||||
SocketReader *m_inputYOperation;
|
||||
float m_centerX;
|
||||
float m_centerY;
|
||||
|
||||
class ScaleRelativeOperation : public ScaleOperation {
|
||||
public:
|
||||
ScaleAbsoluteOperation();
|
||||
ScaleRelativeOperation();
|
||||
ScaleRelativeOperation(DataType data_type);
|
||||
bool determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output) override;
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
float get_relative_scale_x_factor() override
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
float get_relative_scale_y_factor() override
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
};
|
||||
|
||||
void initExecution() override;
|
||||
void deinitExecution() override;
|
||||
class ScaleAbsoluteOperation : public ScaleOperation {
|
||||
public:
|
||||
bool determineDependingAreaOfInterest(rcti *input,
|
||||
ReadBufferOperation *readOperation,
|
||||
rcti *output) override;
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
float get_relative_scale_x_factor() override
|
||||
{
|
||||
return 1.0f / getWidth();
|
||||
}
|
||||
float get_relative_scale_y_factor() override
|
||||
{
|
||||
return 1.0f / getHeight();
|
||||
}
|
||||
};
|
||||
|
||||
class ScaleFixedSizeOperation : public BaseScaleOperation {
|
||||
@@ -108,6 +136,7 @@ class ScaleFixedSizeOperation : public BaseScaleOperation {
|
||||
unsigned int preferredResolution[2]) override;
|
||||
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
void init_data() override;
|
||||
void initExecution() override;
|
||||
void deinitExecution() override;
|
||||
void setNewWidth(int width)
|
||||
@@ -131,6 +160,11 @@ class ScaleFixedSizeOperation : public BaseScaleOperation {
|
||||
this->m_offsetX = x;
|
||||
this->m_offsetY = y;
|
||||
}
|
||||
|
||||
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
|
||||
void update_memory_buffer_partial(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) override;
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
@@ -52,8 +52,8 @@ set(INC
|
||||
set(SRC
|
||||
intern/draw_cache.c
|
||||
intern/draw_cache_extract_mesh.cc
|
||||
intern/draw_cache_extract_mesh_extractors.c
|
||||
intern/draw_cache_extract_mesh_render_data.c
|
||||
intern/mesh_extractors/extract_mesh.c
|
||||
intern/mesh_extractors/extract_mesh_ibo_edituv.cc
|
||||
intern/mesh_extractors/extract_mesh_ibo_fdots.cc
|
||||
intern/mesh_extractors/extract_mesh_ibo_lines.cc
|
||||
@@ -193,7 +193,6 @@ set(SRC
|
||||
intern/DRW_render.h
|
||||
intern/draw_cache.h
|
||||
intern/draw_cache_extract.h
|
||||
intern/draw_cache_extract_mesh_private.h
|
||||
intern/draw_cache_impl.h
|
||||
intern/draw_cache_inline.h
|
||||
intern/draw_color_management.h
|
||||
@@ -207,6 +206,7 @@ set(SRC
|
||||
intern/draw_manager_text.h
|
||||
intern/draw_shader.h
|
||||
intern/draw_view.h
|
||||
intern/mesh_extractors/extract_mesh.h
|
||||
intern/smaa_textures.h
|
||||
engines/basic/basic_engine.h
|
||||
engines/eevee/eevee_engine.h
|
||||
|
@@ -178,19 +178,19 @@ static void eevee_cache_finish(void *vedata)
|
||||
}
|
||||
EEVEE_renderpasses_output_init(sldata, vedata, tot_samples);
|
||||
|
||||
/* Restart taa if a shader has finish compiling. */
|
||||
/* HACK We should use notification of some sort from the compilation job instead. */
|
||||
/* Restart TAA if a shader has finish compiling. */
|
||||
/* HACK: We should use notification of some sort from the compilation job instead. */
|
||||
if (g_data->queued_shaders_count != g_data->queued_shaders_count_prev) {
|
||||
g_data->queued_shaders_count_prev = g_data->queued_shaders_count;
|
||||
EEVEE_temporal_sampling_reset(vedata);
|
||||
}
|
||||
}
|
||||
|
||||
/* As renders in an HDR offscreen buffer, we need draw everything once
|
||||
/* As renders in an HDR off-screen buffer, we need draw everything once
|
||||
* during the background pass. This way the other drawing callback between
|
||||
* the background and the scene pass are visible.
|
||||
* NOTE: we could break it up in two passes using some depth test
|
||||
* to reduce the fillrate */
|
||||
* to reduce the fill-rate. */
|
||||
static void eevee_draw_scene(void *vedata)
|
||||
{
|
||||
EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
|
||||
|
@@ -287,7 +287,7 @@ GPENCIL_tLayer *gpencil_layer_cache_add(GPENCIL_PrivateData *pd,
|
||||
pd->is_render ? gpl->vertex_paint_opacity :
|
||||
pd->vertex_paint_opacity;
|
||||
/* Negate thickness sign to tag that strokes are in screen space.
|
||||
* Convert to world units (by default, 1 meter = 2000 px). */
|
||||
* Convert to world units (by default, 1 meter = 2000 pixels). */
|
||||
float thickness_scale = (is_screenspace) ? -1.0f : (gpd->pixfactor / GPENCIL_PIXEL_FACTOR);
|
||||
float layer_opacity = gpencil_layer_final_opacity_get(pd, ob, gpl);
|
||||
float layer_tint[4];
|
||||
|
@@ -196,7 +196,7 @@ static void gpencil_layer_cache_populate(bGPDlayer *gpl,
|
||||
|
||||
float object_scale = mat4_to_scale(iter->ob->obmat);
|
||||
/* Negate thickness sign to tag that strokes are in screen space.
|
||||
* Convert to world units (by default, 1 meter = 2000 px). */
|
||||
* Convert to world units (by default, 1 meter = 2000 pixels). */
|
||||
float thickness_scale = (is_screenspace) ? -1.0f : (gpd->pixfactor / 2000.0f);
|
||||
|
||||
DRWShadingGroup *grp = iter->stroke_grp = DRW_shgroup_create_sub(iter->stroke_grp);
|
||||
|
@@ -41,9 +41,10 @@
|
||||
#include "GPU_capabilities.h"
|
||||
|
||||
#include "draw_cache_extract.h"
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
#include "draw_cache_inline.h"
|
||||
|
||||
#include "mesh_extractors/extract_mesh.h"
|
||||
|
||||
// #define DEBUG_TIME
|
||||
|
||||
#ifdef DEBUG_TIME
|
||||
|
@@ -38,7 +38,7 @@
|
||||
|
||||
#include "ED_mesh.h"
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
#include "mesh_extractors/extract_mesh.h"
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Update Loose Geometry
|
||||
@@ -340,10 +340,8 @@ static int *mesh_render_data_mat_tri_len_build(MeshRenderData *mr)
|
||||
return mesh_render_data_mat_tri_len_build_threaded(
|
||||
mr, bm->totface, mesh_render_data_mat_tri_len_bm_range_fn);
|
||||
}
|
||||
else {
|
||||
return mesh_render_data_mat_tri_len_build_threaded(
|
||||
mr, mr->poly_len, mesh_render_data_mat_tri_len_mesh_range_fn);
|
||||
}
|
||||
return mesh_render_data_mat_tri_len_build_threaded(
|
||||
mr, mr->poly_len, mesh_render_data_mat_tri_len_mesh_range_fn);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@@ -67,11 +67,12 @@
|
||||
#include "ED_uvedit.h"
|
||||
|
||||
#include "draw_cache_extract.h"
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
#include "draw_cache_inline.h"
|
||||
|
||||
#include "draw_cache_impl.h" /* own include */
|
||||
|
||||
#include "mesh_extractors/extract_mesh.h"
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Dependencies between buffer and batch
|
||||
* \{ */
|
||||
|
@@ -304,7 +304,7 @@ static DRWVolumeGrid *volume_grid_cache_get(const Volume *volume,
|
||||
BLI_addtail(&cache->grids, cache_grid);
|
||||
|
||||
/* TODO: can we load this earlier, avoid accessing the global and take
|
||||
* advantage of dependency graph multithreading? */
|
||||
* advantage of dependency graph multi-threading? */
|
||||
BKE_volume_load(volume, G.main);
|
||||
|
||||
/* Test if we support textures with the number of channels. */
|
||||
|
@@ -74,8 +74,8 @@ BLI_INLINE void DRW_ibo_request(GPUBatch *batch, GPUIndexBuf **ibo)
|
||||
|
||||
BLI_INLINE bool DRW_ibo_requested(GPUIndexBuf *ibo)
|
||||
{
|
||||
/* TODO: do not rely on data uploaded. This prevents multithreading.
|
||||
* (need access to a gl context) */
|
||||
/* TODO: do not rely on data uploaded. This prevents multi-threading.
|
||||
* (need access to a OpenGL context). */
|
||||
return (ibo != NULL && !GPU_indexbuf_is_init(ibo));
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ BLI_INLINE void DRW_vbo_request(GPUBatch *batch, GPUVertBuf **vbo)
|
||||
*vbo = GPU_vertbuf_calloc();
|
||||
}
|
||||
if (batch != NULL) {
|
||||
/* HACK we set vbos that may not yet be valid. */
|
||||
/* HACK we set VBO's that may not yet be valid. */
|
||||
GPU_batch_vertbuf_add(batch, *vbo);
|
||||
}
|
||||
}
|
||||
|
@@ -110,8 +110,8 @@ typedef struct DRWCullingState {
|
||||
|
||||
/* Minimum max UBO size is 64KiB. We take the largest
|
||||
* UBO struct and alloc the max number.
|
||||
* ((1 << 16) / sizeof(DRWObjectMatrix)) = 512
|
||||
* Keep in sync with common_view_lib.glsl */
|
||||
* `((1 << 16) / sizeof(DRWObjectMatrix)) = 512`
|
||||
* Keep in sync with `common_view_lib.glsl`. */
|
||||
#define DRW_RESOURCE_CHUNK_LEN 512
|
||||
|
||||
/**
|
||||
|
@@ -29,7 +29,8 @@
|
||||
|
||||
#include "ED_uvedit.h"
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
#include "extract_mesh.h"
|
||||
|
||||
#include "draw_cache_impl.h"
|
||||
|
||||
void *mesh_extract_buffer_get(const MeshExtract *extractor, MeshBufferCache *mbc)
|
@@ -21,12 +21,12 @@
|
||||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
|
||||
namespace blender::draw {
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Extract Edit UV Triangles Indices
|
||||
|
@@ -21,12 +21,12 @@
|
||||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
|
||||
namespace blender::draw {
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Extract Face-dots Indices
|
||||
|
@@ -21,10 +21,10 @@
|
||||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@@ -21,13 +21,13 @@
|
||||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
|
||||
#include "BLI_edgehash.h"
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@@ -21,14 +21,14 @@
|
||||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
|
||||
#include "BLI_bitmap.h"
|
||||
#include "BLI_vector.hh"
|
||||
#include "atomic_ops.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
|
||||
namespace blender::draw {
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/** \name Extract Paint Mask Line Indices
|
||||
|
@@ -21,12 +21,12 @@
|
||||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
|
||||
#include "BLI_vector.hh"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@@ -21,10 +21,10 @@
|
||||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "extract_mesh.h"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
static void extract_tris_mat_task_reduce(void *_userdata_to, void *_userdata_from)
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "GPU_capabilities.h"
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
#include "extract_mesh.h"
|
||||
|
||||
namespace blender::draw {
|
||||
|
||||
|
@@ -21,7 +21,8 @@
|
||||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
#include "extract_mesh.h"
|
||||
|
||||
#include "draw_cache_impl.h"
|
||||
|
||||
namespace blender::draw {
|
||||
|
@@ -21,7 +21,8 @@
|
||||
* \ingroup draw
|
||||
*/
|
||||
|
||||
#include "draw_cache_extract_mesh_private.h"
|
||||
#include "extract_mesh.h"
|
||||
|
||||
#include "draw_cache_impl.h"
|
||||
|
||||
namespace blender::draw {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user