Compare commits

..

8 Commits

Author SHA1 Message Date
51bc509d62 Use the new dissolve function for all operators. 2021-07-18 08:51:06 +01:00
727b500465 Improved link dissolve method that supports multiple nodes.
The new functions keep links between the selected nodes intact when
disconnecting them from their surroundings.
2021-07-17 18:39:09 +01:00
65c13b0243 Removed the NODE_OT_duplicate_move_keep_inputs operator.
This is a variation of NODE_OT_duplicate_move with the "keep_inputs"
property set. This can be done in keymaps instead.
2021-07-17 08:22:40 +01:00
90f986cee4 Ensure that link hilites are cleared when the alt key is pressed. 2021-07-17 08:04:14 +01:00
a8327542c5 Removed the NODE_OT_translate_attach_remove_on_cancel operator.
This is just a variation of NODE_OT_translate_attach with the
"remove_on_cancel" property set. This can be done from keymaps instead.
2021-07-17 08:02:57 +01:00
8b4052e063 Use a modal keymap entry to toggle node unlinking with ALT. 2021-07-16 19:33:20 +01:00
2b43df378c Add operator properties to transform for toggling node link intersect. 2021-07-16 16:36:51 +01:00
65509a4a05 Rename the ED_node_link_intersect_test function for clarity. 2021-07-16 09:43:12 +01:00
2576 changed files with 83427 additions and 164911 deletions

View File

@@ -110,10 +110,6 @@ if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) cmake_policy(SET CMP0074 NEW)
endif() endif()
# Install CODE|SCRIPT allow the use of generator expressions.
if(POLICY CMP0087)
cmake_policy(SET CMP0087 NEW)
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Load some macros. # Load some macros.
include(build_files/cmake/macros.cmake) include(build_files/cmake/macros.cmake)
@@ -403,31 +399,31 @@ option(WITH_CYCLES_CUDA_BINARIES "Build Cycles CUDA binaries" OFF)
option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF) option(WITH_CYCLES_CUBIN_COMPILER "Build cubins with nvrtc based compiler instead of nvcc" OFF)
option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF) option(WITH_CYCLES_CUDA_BUILD_SERIAL "Build cubins one after another (useful on machines with limited RAM)" OFF)
mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL) mark_as_advanced(WITH_CYCLES_CUDA_BUILD_SERIAL)
set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX)" ) set(CYCLES_TEST_DEVICES CPU CACHE STRING "Run regression tests on the specified device types (CPU CUDA OPTIX OPENCL)" )
set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for") set(CYCLES_CUDA_BINARIES_ARCH sm_30 sm_35 sm_37 sm_50 sm_52 sm_60 sm_61 sm_70 sm_75 sm_86 compute_75 CACHE STRING "CUDA architectures to build binaries for")
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH) mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
unset(PLATFORM_DEFAULT) unset(PLATFORM_DEFAULT)
option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON) option(WITH_CYCLES_LOGGING "Build Cycles with logging support" ON)
option(WITH_CYCLES_DEBUG_NAN "Build Cycles with additional asserts for detecting NaNs and invalid values" OFF) option(WITH_CYCLES_DEBUG "Build Cycles with extra debug capabilities" OFF)
option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF) option(WITH_CYCLES_NATIVE_ONLY "Build Cycles with native kernel only (which fits current CPU, use for development only)" OFF)
option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF) option(WITH_CYCLES_KERNEL_ASAN "Build Cycles kernels with address sanitizer when WITH_COMPILER_ASAN is on, even if it's very slow" OFF)
mark_as_advanced(WITH_CYCLES_KERNEL_ASAN) mark_as_advanced(WITH_CYCLES_KERNEL_ASAN)
mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER) mark_as_advanced(WITH_CYCLES_CUBIN_COMPILER)
mark_as_advanced(WITH_CYCLES_LOGGING) mark_as_advanced(WITH_CYCLES_LOGGING)
mark_as_advanced(WITH_CYCLES_DEBUG_NAN) mark_as_advanced(WITH_CYCLES_DEBUG)
mark_as_advanced(WITH_CYCLES_NATIVE_ONLY) mark_as_advanced(WITH_CYCLES_NATIVE_ONLY)
option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON) option(WITH_CYCLES_DEVICE_CUDA "Enable Cycles CUDA compute support" ON)
option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles OptiX support" ON) option(WITH_CYCLES_DEVICE_OPTIX "Enable Cycles OptiX support" OFF)
option(WITH_CYCLES_DEVICE_OPENCL "Enable Cycles OpenCL compute support" ON)
option(WITH_CYCLES_NETWORK "Enable Cycles compute over network support (EXPERIMENTAL and unfinished)" OFF)
mark_as_advanced(WITH_CYCLES_DEVICE_CUDA) mark_as_advanced(WITH_CYCLES_DEVICE_CUDA)
mark_as_advanced(WITH_CYCLES_DEVICE_OPENCL)
mark_as_advanced(WITH_CYCLES_NETWORK)
option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON) option(WITH_CUDA_DYNLOAD "Dynamically load CUDA libraries at runtime" ON)
mark_as_advanced(WITH_CUDA_DYNLOAD) mark_as_advanced(WITH_CUDA_DYNLOAD)
# Draw Manager
option(WITH_DRAW_DEBUG "Add extra debug capabilities to Draw Manager" OFF)
mark_as_advanced(WITH_DRAW_DEBUG)
# LLVM # LLVM
option(WITH_LLVM "Use LLVM" OFF) option(WITH_LLVM "Use LLVM" OFF)
if(APPLE) if(APPLE)
@@ -608,6 +604,12 @@ if(WIN32)
option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF) option(WITH_WINDOWS_FIND_MODULES "Use find_package to locate libraries" OFF)
mark_as_advanced(WITH_WINDOWS_FIND_MODULES) mark_as_advanced(WITH_WINDOWS_FIND_MODULES)
option(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS "Organize the visual studio projects according to source folder structure." ON)
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
option(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS "Organize the source files in filters matching the source folders." ON)
mark_as_advanced(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
option(WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF) option(WINDOWS_PYTHON_DEBUG "Include the files needed for debugging python scripts with visual studio 2017+." OFF)
mark_as_advanced(WINDOWS_PYTHON_DEBUG) mark_as_advanced(WINDOWS_PYTHON_DEBUG)
@@ -625,18 +627,6 @@ if(WIN32)
endif() endif()
if(WIN32 OR XCODE)
option(IDE_GROUP_SOURCES_IN_FOLDERS "Organize the source files in filters matching the source folders." ON)
mark_as_advanced(IDE_GROUP_SOURCES_IN_FOLDERS)
option(IDE_GROUP_PROJECTS_IN_FOLDERS "Organize the projects according to source folder structure." ON)
mark_as_advanced(IDE_GROUP_PROJECTS_IN_FOLDERS)
if (IDE_GROUP_PROJECTS_IN_FOLDERS)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
endif()
if(UNIX) if(UNIX)
# See WITH_WINDOWS_SCCACHE for Windows. # See WITH_WINDOWS_SCCACHE for Windows.
option(WITH_COMPILER_CCACHE "Use ccache to improve rebuild times (Works with Ninja, Makefiles and Xcode)" OFF) option(WITH_COMPILER_CCACHE "Use ccache to improve rebuild times (Works with Ninja, Makefiles and Xcode)" OFF)
@@ -1594,9 +1584,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
# Using C++20 features while having C++17 as the project language isn't allowed by MSVC.
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_CXX20_DESIGNATOR -Wc++20-designator)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_AUTOLOGICAL_COMPARE -Wno-tautological-compare)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_UNKNOWN_PRAGMAS -Wno-unknown-pragmas)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_CHAR_SUBSCRIPTS -Wno-char-subscripts)

View File

@@ -63,7 +63,7 @@ Package Targets
* package_debian: Build a debian package. * package_debian: Build a debian package.
* package_pacman: Build an arch linux pacman package. * package_pacman: Build an arch linux pacman package.
* package_archive: Build an archive package. * package_archive: Build an archive package.
Testing Targets Testing Targets
Not associated with building Blender. Not associated with building Blender.
@@ -167,7 +167,7 @@ endef
# This makefile is not meant for Windows # This makefile is not meant for Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
$(error On Windows, use "cmd //c make.bat" instead of "make") $(error On Windows, use "cmd //c make.bat" instead of "make")
endif endif
# System Vars # System Vars
@@ -379,7 +379,7 @@ deps: .FORCE
@cmake -H"$(DEPS_SOURCE_DIR)" \ @cmake -H"$(DEPS_SOURCE_DIR)" \
-B"$(DEPS_BUILD_DIR)" \ -B"$(DEPS_BUILD_DIR)" \
-DHARVEST_TARGET=$(DEPS_INSTALL_DIR) -DHARVEST_TARGET=$(DEPS_INSTALL_DIR)
@echo @echo
@echo Building dependencies ... @echo Building dependencies ...
@@ -456,8 +456,7 @@ project_eclipse: .FORCE
check_cppcheck: .FORCE check_cppcheck: .FORCE
$(CMAKE_CONFIG) $(CMAKE_CONFIG)
cd "$(BUILD_DIR)" ; \ cd "$(BUILD_DIR)" ; \
$(PYTHON) \ $(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
"$(BLENDER_DIR)/build_files/cmake/cmake_static_check_cppcheck.py" 2> \
"$(BLENDER_DIR)/check_cppcheck.txt" "$(BLENDER_DIR)/check_cppcheck.txt"
@echo "written: check_cppcheck.txt" @echo "written: check_cppcheck.txt"
@@ -519,9 +518,8 @@ source_archive: .FORCE
python3 ./build_files/utils/make_source_archive.py python3 ./build_files/utils/make_source_archive.py
source_archive_complete: .FORCE source_archive_complete: .FORCE
cmake \ cmake -S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \
-S "$(BLENDER_DIR)/build_files/build_environment" -B"$(BUILD_DIR)/source_archive" \ -DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
-DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF
# This assumes CMake is still using a default `PACKAGE_DIR` variable: # This assumes CMake is still using a default `PACKAGE_DIR` variable:
python3 ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages" python3 ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages"
@@ -529,11 +527,9 @@ source_archive_complete: .FORCE
INKSCAPE_BIN?="inkscape" INKSCAPE_BIN?="inkscape"
icons: .FORCE icons: .FORCE
BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \ BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/blender_icons_update.py" "$(BLENDER_DIR)/release/datafiles/blender_icons_update.py"
INKSCAPE_BIN=$(INKSCAPE_BIN) \ BLENDER_BIN=$(BLENDER_BIN) INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/prvicons_update.py" "$(BLENDER_DIR)/release/datafiles/prvicons_update.py"
INKSCAPE_BIN=$(INKSCAPE_BIN) \
"$(BLENDER_DIR)/release/datafiles/alert_icons_update.py"
icons_geom: .FORCE icons_geom: .FORCE
BLENDER_BIN=$(BLENDER_BIN) \ BLENDER_BIN=$(BLENDER_BIN) \
@@ -547,7 +543,7 @@ update_code: .FORCE
format: .FORCE format: .FORCE
PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \ PATH="../lib/${OS_NCASE}_${CPU}/llvm/bin/:../lib/${OS_NCASE}_centos7_${CPU}/llvm/bin/:../lib/${OS_NCASE}/llvm/bin/:$(PATH)" \
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS) $(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -557,9 +553,8 @@ format: .FORCE
# Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation. # Simple version of ./doc/python_api/sphinx_doc_gen.sh with no PDF generation.
doc_py: .FORCE doc_py: .FORCE
ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \ ASAN_OPTIONS=halt_on_error=0:${ASAN_OPTIONS} \
$(BLENDER_BIN) \ $(BLENDER_BIN) --background -noaudio --factory-startup \
--background -noaudio --factory-startup \ --python doc/python_api/sphinx_doc_gen.py
--python doc/python_api/sphinx_doc_gen.py
sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'" @echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'"
@@ -568,9 +563,8 @@ doc_doxy: .FORCE
@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'" @echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
doc_dna: .FORCE doc_dna: .FORCE
$(BLENDER_BIN) \ $(BLENDER_BIN) --background -noaudio --factory-startup \
--background -noaudio --factory-startup \ --python doc/blender_file_format/BlendFileDnaExporter_25.py
--python doc/blender_file_format/BlendFileDnaExporter_25.py
@echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'" @echo "docs written into: '$(BLENDER_DIR)/doc/blender_file_format/dna.html'"
doc_man: .FORCE doc_man: .FORCE

View File

@@ -82,11 +82,7 @@ if(UNIX)
endif() endif()
include(cmake/openimageio.cmake) include(cmake/openimageio.cmake)
include(cmake/tiff.cmake) include(cmake/tiff.cmake)
if(WIN32) include(cmake/flexbison.cmake)
include(cmake/flexbison.cmake)
elseif(UNIX AND NOT APPLE)
include(cmake/flex.cmake)
endif()
include(cmake/osl.cmake) include(cmake/osl.cmake)
include(cmake/tbb.cmake) include(cmake/tbb.cmake)
include(cmake/openvdb.cmake) include(cmake/openvdb.cmake)

View File

@@ -93,4 +93,3 @@ download_source(GMP)
download_source(POTRACE) download_source(POTRACE)
download_source(HARU) download_source(HARU)
download_source(ZSTD) download_source(ZSTD)
download_source(FLEX)

View File

@@ -30,7 +30,6 @@ if(WIN32)
--enable-w32threads --enable-w32threads
--disable-pthreads --disable-pthreads
--enable-libopenjpeg --enable-libopenjpeg
--disable-mediafoundation
) )
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4")
set(FFMPEG_EXTRA_FLAGS set(FFMPEG_EXTRA_FLAGS

View File

@@ -1,28 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
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
)

View File

@@ -106,7 +106,6 @@ harvest(llvm/include llvm/include "*")
harvest(llvm/bin llvm/bin "llvm-config") harvest(llvm/bin llvm/bin "llvm-config")
harvest(llvm/lib llvm/lib "libLLVM*.a") harvest(llvm/lib llvm/lib "libLLVM*.a")
harvest(llvm/lib llvm/lib "libclang*.a") harvest(llvm/lib llvm/lib "libclang*.a")
harvest(llvm/lib/clang llvm/lib/clang "*.h")
if(APPLE) if(APPLE)
harvest(openmp/lib openmp/lib "*") harvest(openmp/lib openmp/lib "*")
harvest(openmp/include openmp/include "*.h") harvest(openmp/include openmp/include "*.h")

View File

@@ -35,7 +35,6 @@ elseif(APPLE)
else() else()
set(ISPC_EXTRA_ARGS_APPLE set(ISPC_EXTRA_ARGS_APPLE
-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison -DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison
-DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex
-DARM_ENABLED=Off -DARM_ENABLED=Off
) )
endif() endif()
@@ -44,7 +43,6 @@ elseif(UNIX)
-DCMAKE_C_COMPILER=${LIBDIR}/llvm/bin/clang -DCMAKE_C_COMPILER=${LIBDIR}/llvm/bin/clang
-DCMAKE_CXX_COMPILER=${LIBDIR}/llvm/bin/clang++ -DCMAKE_CXX_COMPILER=${LIBDIR}/llvm/bin/clang++
-DARM_ENABLED=Off -DARM_ENABLED=Off
-DFLEX_EXECUTABLE=${LIBDIR}/flex/bin/flex
) )
endif() endif()
@@ -84,9 +82,4 @@ if(WIN32)
external_ispc external_ispc
external_flexbison external_flexbison
) )
elseif(UNIX AND NOT APPLE)
add_dependencies(
external_ispc
external_flex
)
endif() endif()

View File

@@ -66,11 +66,7 @@ ExternalProject_Add(ll
if(MSVC) if(MSVC)
if(BUILD_MODE STREQUAL Release) if(BUILD_MODE STREQUAL Release)
set(LLVM_HARVEST_COMMAND set(LLVM_HARVEST_COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/ ${HARVEST_TARGET}/llvm/ )
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib ${HARVEST_TARGET}/llvm/lib &&
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/include ${HARVEST_TARGET}/llvm/include &&
${CMAKE_COMMAND} -E copy ${LIBDIR}/llvm/bin/clang-format.exe ${HARVEST_TARGET}/llvm/bin/clang-format.exe
)
else() else()
set(LLVM_HARVEST_COMMAND set(LLVM_HARVEST_COMMAND
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib/ ${HARVEST_TARGET}/llvm/debug/lib/ && ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib/ ${HARVEST_TARGET}/llvm/debug/lib/ &&

View File

@@ -45,6 +45,7 @@ ExternalProject_Add(external_openimagedenoise
DOWNLOAD_DIR ${DOWNLOAD_DIR} DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OIDN_HASH_TYPE}=${OIDN_HASH} URL_HASH ${OIDN_HASH_TYPE}=${OIDN_HASH}
PREFIX ${BUILD_DIR}/openimagedenoise 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} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimagedenoise ${DEFAULT_CMAKE_FLAGS} ${OIDN_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/openimagedenoise INSTALL_DIR ${LIBDIR}/openimagedenoise
) )

View File

@@ -16,20 +16,15 @@
# #
# ***** END GPL LICENSE BLOCK ***** # ***** END GPL LICENSE BLOCK *****
if(APPLE)
set(OPENMP_PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openmp/src/external_openmp < ${PATCH_DIR}/openmp.diff)
else()
set(OPENMP_PATCH_COMMAND)
endif()
ExternalProject_Add(external_openmp ExternalProject_Add(external_openmp
URL file://${PACKAGE_DIR}/${OPENMP_FILE} URL file://${PACKAGE_DIR}/${OPENMP_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR} DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH} URL_HASH ${OPENMP_HASH_TYPE}=${OPENMP_HASH}
PREFIX ${BUILD_DIR}/openmp PREFIX ${BUILD_DIR}/openmp
PATCH_COMMAND ${OPENMP_PATCH_COMMAND} 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} CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
INSTALL_COMMAND cd ${BUILD_DIR}/openmp/src/external_openmp-build && install_name_tool -id @rpath/libomp.dylib runtime/src/libomp.dylib && make install INSTALL_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_DIR ${LIBDIR}/openmp INSTALL_DIR ${LIBDIR}/openmp
) )

View File

@@ -20,10 +20,12 @@ if(WIN32)
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}") set(OSL_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}")
set(OSL_FLEX_BISON -DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe -DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe) set(OSL_FLEX_BISON -DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe -DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe)
set(OSL_SIMD_FLAGS -DOIIO_NOSIMD=1 -DOIIO_SIMD=sse2) set(OSL_SIMD_FLAGS -DOIIO_NOSIMD=1 -DOIIO_SIMD=sse2)
SET(OSL_PLATFORM_FLAGS -DLINKSTATIC=ON)
else() else()
set(OSL_CMAKE_CXX_STANDARD_LIBRARIES) set(OSL_CMAKE_CXX_STANDARD_LIBRARIES)
set(OSL_FLEX_BISON) set(OSL_FLEX_BISON)
set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}") set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf${OPENEXR_VERSION_POSTFIX}${LIBEXT}")
SET(OSL_PLATFORM_FLAGS)
endif() endif()
set(OSL_ILMBASE_CUSTOM_LIBRARIES "${LIBDIR}/openexr/lib/Imath${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Half{OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/IlmThread${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Iex${OPENEXR_VERSION_POSTFIX}.lib") set(OSL_ILMBASE_CUSTOM_LIBRARIES "${LIBDIR}/openexr/lib/Imath${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Half{OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/IlmThread${OPENEXR_VERSION_POSTFIX}.lib^^${LIBDIR}/openexr/lib/Iex${OPENEXR_VERSION_POSTFIX}.lib")
@@ -49,13 +51,12 @@ set(OSL_EXTRA_ARGS
-DOpenImageIO_ROOT=${LIBDIR}/openimageio/ -DOpenImageIO_ROOT=${LIBDIR}/openimageio/
-DOSL_BUILD_TESTS=OFF -DOSL_BUILD_TESTS=OFF
-DOSL_BUILD_MATERIALX=OFF -DOSL_BUILD_MATERIALX=OFF
-DPNG_ROOT=${LIBDIR}/png
-DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
-DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/ -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
${OSL_FLEX_BISON} ${OSL_FLEX_BISON}
-DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES} -DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES}
-DBUILD_SHARED_LIBS=OFF -DBUILD_SHARED_LIBS=OFF
-DLINKSTATIC=ON ${OSL_PLATFORM_FLAGS}
-DOSL_BUILD_PLUGINS=OFF -DOSL_BUILD_PLUGINS=OFF
-DSTOP_ON_WARNING=OFF -DSTOP_ON_WARNING=OFF
-DUSE_LLVM_BITCODE=OFF -DUSE_LLVM_BITCODE=OFF
@@ -68,9 +69,13 @@ set(OSL_EXTRA_ARGS
${OSL_SIMD_FLAGS} ${OSL_SIMD_FLAGS}
-Dpugixml_ROOT=${LIBDIR}/pugixml -Dpugixml_ROOT=${LIBDIR}/pugixml
-DUSE_PYTHON=OFF -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 ExternalProject_Add(external_osl
URL file://${PACKAGE_DIR}/${OSL_FILE} URL file://${PACKAGE_DIR}/${OSL_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR} DOWNLOAD_DIR ${DOWNLOAD_DIR}
@@ -88,20 +93,10 @@ add_dependencies(
ll ll
external_openexr external_openexr
external_zlib external_zlib
external_flexbison
external_openimageio external_openimageio
external_pugixml external_pugixml
) )
if(WIN32)
add_dependencies(
external_osl
external_flexbison
)
elseif(UNIX AND NOT APPLE)
add_dependencies(
external_osl
external_flex
)
endif()
if(WIN32) if(WIN32)
if(BUILD_MODE STREQUAL Release) if(BUILD_MODE STREQUAL Release)

View File

@@ -23,7 +23,7 @@ set(PNG_EXTRA_ARGS
) )
if(BLENDER_PLATFORM_ARM) if(BLENDER_PLATFORM_ARM)
set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=on -DCMAKE_SYSTEM_PROCESSOR="aarch64") set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=ON -DCMAKE_SYSTEM_PROCESSOR="aarch64")
endif() endif()
ExternalProject_Add(external_png ExternalProject_Add(external_png

View File

@@ -152,28 +152,35 @@ set(OPENCOLORIO_HASH 1a2e3478b6cd9a1549f24e1b2205e3f0)
set(OPENCOLORIO_HASH_TYPE MD5) set(OPENCOLORIO_HASH_TYPE MD5)
set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz) set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz)
set(LLVM_VERSION 12.0.0) if(BLENDER_PLATFORM_ARM)
set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz) # Newer version required by ISPC with arm support.
set(LLVM_HASH 5a4fab4d7fc84aefffb118ac2c8a4fc0) set(LLVM_VERSION 11.0.1)
set(LLVM_HASH_TYPE MD5) set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz)
set(LLVM_FILE 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)
if(APPLE)
# Cloth physics test is crashing due to this bug:
# https://bugs.llvm.org/show_bug.cgi?id=50579
set(OPENMP_VERSION 9.0.1) set(OPENMP_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 6eade16057edbdecb3c4eef9daa2bfcf)
set(OPENMP_HASH_TYPE MD5)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
else() else()
set(OPENMP_VERSION ${LLVM_VERSION}) set(LLVM_VERSION 9.0.1)
set(OPENMP_HASH ac48ce3e4582ccb82f81ab59eb3fc9dc) set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.tar.xz)
endif() set(LLVM_HASH b4268e733dfe352960140dc07ef2efcb)
set(OPENMP_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${OPENMP_VERSION}/openmp-${OPENMP_VERSION}.src.tar.xz) set(LLVM_HASH_TYPE MD5)
set(OPENMP_HASH_TYPE MD5) set(LLVM_FILE llvm-project-${LLVM_VERSION}.tar.xz)
set(OPENMP_FILE openmp-${OPENMP_VERSION}.src.tar.xz)
set(OPENIMAGEIO_VERSION 2.2.15.1) 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_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz) set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.tar.gz)
set(OPENIMAGEIO_HASH 3db5c5f0b3dc91597c75e5df09eb9072) set(OPENIMAGEIO_HASH f03aa5e3ac4795af04771ee4146e9832)
set(OPENIMAGEIO_HASH_TYPE MD5) set(OPENIMAGEIO_HASH_TYPE MD5)
set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz) set(OPENIMAGEIO_FILE OpenImageIO-${OPENIMAGEIO_VERSION}.tar.gz)
@@ -183,9 +190,9 @@ set(TIFF_HASH 2165e7aba557463acc0664e71a3ed424)
set(TIFF_HASH_TYPE MD5) set(TIFF_HASH_TYPE MD5)
set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz) set(TIFF_FILE tiff-${TIFF_VERSION}.tar.gz)
set(OSL_VERSION 1.11.14.1) set(OSL_VERSION 1.11.10.0)
set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz) set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.tar.gz)
set(OSL_HASH 1abd7ce40481771a9fa937f19595d2f2) set(OSL_HASH dfdc23597aeef083832cbada62211756)
set(OSL_HASH_TYPE MD5) set(OSL_HASH_TYPE MD5)
set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz) set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
@@ -363,18 +370,12 @@ set(PUGIXML_HASH 0c208b0664c7fb822bf1b49ad035e8fd)
set(PUGIXML_HASH_TYPE MD5) set(PUGIXML_HASH_TYPE MD5)
set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz) set(PUGIXML_FILE pugixml-${PUGIXML_VERSION}.tar.gz)
set(FLEXBISON_VERSION 2.5.24) set(FLEXBISON_VERSION 2.5.5)
set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip) set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison/win_flex_bison-${FLEXBISON_VERSION}.zip)
set(FLEXBISON_HASH 6b549d43e34ece0e8ed05af92daa31c4) set(FLEXBISON_HASH d87a3938194520d904013abef3df10ce)
set(FLEXBISON_HASH_TYPE MD5) set(FLEXBISON_HASH_TYPE MD5)
set(FLEXBISON_FILE win_flex_bison-${FLEXBISON_VERSION}.zip) 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. # Libraries to keep Python modules static on Linux.
# NOTE: bzip.org domain does no longer belong to BZip 2 project, so we download # NOTE: bzip.org domain does no longer belong to BZip 2 project, so we download
@@ -431,9 +432,9 @@ set(USD_HASH 1dd1e2092d085ed393c1f7c450a4155a)
set(USD_HASH_TYPE MD5) set(USD_HASH_TYPE MD5)
set(USD_FILE usd-v${USD_VERSION}.tar.gz) set(USD_FILE usd-v${USD_VERSION}.tar.gz)
set(OIDN_VERSION 1.4.1) set(OIDN_VERSION 1.4.0)
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz) set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
set(OIDN_HASH df4007b0ab93b1c41cdf223b075d01c0) set(OIDN_HASH 421824019becc5b664a22a2b98332bc5)
set(OIDN_HASH_TYPE MD5) set(OIDN_HASH_TYPE MD5)
set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz) set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz)
@@ -443,10 +444,10 @@ set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3)
set(LIBGLU_HASH_TYPE MD5) set(LIBGLU_HASH_TYPE MD5)
set(LIBGLU_FILE glu-${LIBGLU_VERSION}.tar.xz) set(LIBGLU_FILE glu-${LIBGLU_VERSION}.tar.xz)
set(MESA_VERSION 21.1.5) set(MESA_VERSION 20.3.4)
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz) set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa/mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH 022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d) set(MESA_HASH 556338446aef8ae947a789b3e0b5e056)
set(MESA_HASH_TYPE SHA256) set(MESA_HASH_TYPE MD5)
set(MESA_FILE mesa-${MESA_VERSION}.tar.xz) set(MESA_FILE mesa-${MESA_VERSION}.tar.xz)
set(NASM_VERSION 2.15.02) set(NASM_VERSION 2.15.02)
@@ -467,11 +468,19 @@ set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a) set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
set(WL_PROTOCOLS_HASH_TYPE MD5) set(WL_PROTOCOLS_HASH_TYPE MD5)
set(ISPC_VERSION v1.16.0) if(BLENDER_PLATFORM_ARM)
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz) # Unreleased version with macOS arm support.
set(ISPC_HASH 2e3abedbc0ea9aaec17d6562c632454d) set(ISPC_URI https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
set(ISPC_HASH_TYPE MD5) set(ISPC_HASH d382fea18d01dbd0cd05d9e1ede36d7d)
set(ISPC_FILE ispc-${ISPC_VERSION}.tar.gz) 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(GMP_VERSION 6.2.0) set(GMP_VERSION 6.2.0)
set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz) set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)

View File

@@ -474,25 +474,25 @@ OPENEXR_FORCE_REBUILD=false
OPENEXR_SKIP=false OPENEXR_SKIP=false
_with_built_openexr=false _with_built_openexr=false
OIIO_VERSION="2.2.15.1" OIIO_VERSION="2.1.15.0"
OIIO_VERSION_SHORT="2.2" OIIO_VERSION_SHORT="2.1"
OIIO_VERSION_MIN="2.1.12" OIIO_VERSION_MIN="2.1.12"
OIIO_VERSION_MAX="2.3.0" OIIO_VERSION_MAX="2.2.10"
OIIO_FORCE_BUILD=false OIIO_FORCE_BUILD=false
OIIO_FORCE_REBUILD=false OIIO_FORCE_REBUILD=false
OIIO_SKIP=false OIIO_SKIP=false
LLVM_VERSION="12.0.0" LLVM_VERSION="9.0.1"
LLVM_VERSION_SHORT="12.0" LLVM_VERSION_SHORT="9.0"
LLVM_VERSION_MIN="11.0" LLVM_VERSION_MIN="6.0"
LLVM_VERSION_MAX="13.0" LLVM_VERSION_MAX="12.0"
LLVM_VERSION_FOUND="" LLVM_VERSION_FOUND=""
LLVM_FORCE_BUILD=false LLVM_FORCE_BUILD=false
LLVM_FORCE_REBUILD=false LLVM_FORCE_REBUILD=false
LLVM_SKIP=false LLVM_SKIP=false
# OSL needs to be compiled for now! # OSL needs to be compiled for now!
OSL_VERSION="1.11.14.1" OSL_VERSION="1.11.10.0"
OSL_VERSION_SHORT="1.11" OSL_VERSION_SHORT="1.11"
OSL_VERSION_MIN="1.11" OSL_VERSION_MIN="1.11"
OSL_VERSION_MAX="2.0" OSL_VERSION_MAX="2.0"
@@ -553,7 +553,7 @@ EMBREE_FORCE_BUILD=false
EMBREE_FORCE_REBUILD=false EMBREE_FORCE_REBUILD=false
EMBREE_SKIP=false EMBREE_SKIP=false
OIDN_VERSION="1.4.1" OIDN_VERSION="1.4.0"
OIDN_VERSION_SHORT="1.4" OIDN_VERSION_SHORT="1.4"
OIDN_VERSION_MIN="1.4.0" OIDN_VERSION_MIN="1.4.0"
OIDN_VERSION_MAX="1.5" OIDN_VERSION_MAX="1.5"
@@ -561,7 +561,7 @@ OIDN_FORCE_BUILD=false
OIDN_FORCE_REBUILD=false OIDN_FORCE_REBUILD=false
OIDN_SKIP=false OIDN_SKIP=false
ISPC_VERSION="1.16.0" ISPC_VERSION="1.14.1"
FFMPEG_VERSION="4.4" FFMPEG_VERSION="4.4"
FFMPEG_VERSION_SHORT="4.4" FFMPEG_VERSION_SHORT="4.4"
@@ -1019,7 +1019,7 @@ PRINT ""
PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" ) PYTHON_SOURCE=( "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" )
_boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'` _boost_version_nodots=`echo "$BOOST_VERSION" | sed -r 's/\./_/g'`
BOOST_SOURCE=( "https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" ) BOOST_SOURCE=( "https://dl.bintray.com/boostorg/release/$BOOST_VERSION/source/boost_$_boost_version_nodots.tar.bz2" )
BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options --with-serialization --with-atomic" BOOST_BUILD_MODULES="--with-system --with-filesystem --with-thread --with-regex --with-locale --with-date_time --with-wave --with-iostreams --with-python --with-program_options --with-serialization --with-atomic"
TBB_SOURCE=( "https://github.com/oneapi-src/oneTBB/archive/$TBB_VERSION$TBB_VERSION_UPDATE.tar.gz" ) TBB_SOURCE=( "https://github.com/oneapi-src/oneTBB/archive/$TBB_VERSION$TBB_VERSION_UPDATE.tar.gz" )
@@ -1129,7 +1129,7 @@ Those libraries should be available as packages in all recent distributions (opt
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal]. * libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed). * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland) * libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
* libsqlite3, libzstd, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp, flex. * libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
* libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig, [libharu/libhpdf].\"" * libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig, [libharu/libhpdf].\""
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES: DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
@@ -1447,7 +1447,9 @@ compile_Python() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Python--$PYTHON_VERSION failed to compile, exiting" ERROR "Python--$PYTHON_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -1463,9 +1465,6 @@ compile_Python() {
INFO "If you want to force rebuild of this lib, use the --force-python option." INFO "If you want to force rebuild of this lib, use the --force-python option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "python-$PYTHON_VERSION_SHORT" run_ldconfig "python-$PYTHON_VERSION_SHORT"
# Extra step: install required modules with pip. # Extra step: install required modules with pip.
@@ -1559,7 +1558,9 @@ compile_Boost() {
--prefix=$_inst --disable-icu boost.locale.icu=off install --prefix=$_inst --disable-icu boost.locale.icu=off install
./b2 --clean ./b2 --clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Boost-$BOOST_VERSION failed to compile, exiting" ERROR "Boost-$BOOST_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -1573,9 +1574,7 @@ compile_Boost() {
INFO "If you want to force rebuild of this lib, use the --force-boost option." INFO "If you want to force rebuild of this lib, use the --force-boost option."
fi fi
if [ -d $_inst ]; then # Just always run it, much simpler this way!
_create_inst_shortcut
fi
run_ldconfig "boost" run_ldconfig "boost"
} }
@@ -1688,7 +1687,9 @@ compile_TBB() {
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "TBB-$TBB_VERSION$TBB_VERSION_UPDATE failed to compile, exiting" ERROR "TBB-$TBB_VERSION$TBB_VERSION_UPDATE failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -1702,9 +1703,6 @@ compile_TBB() {
INFO "If you want to force rebuild of this lib, use the --force-tbb option." INFO "If you want to force rebuild of this lib, use the --force-tbb option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "tbb" run_ldconfig "tbb"
} }
@@ -1824,7 +1822,9 @@ compile_OCIO() {
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting" ERROR "OpenColorIO-$OCIO_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -1838,9 +1838,6 @@ compile_OCIO() {
INFO "If you want to force rebuild of this lib, use the --force-ocio option." INFO "If you want to force rebuild of this lib, use the --force-ocio option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "ocio" run_ldconfig "ocio"
} }
@@ -1956,7 +1953,9 @@ compile_OPENEXR() {
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting" ERROR "OpenEXR-$OPENEXR_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -1972,9 +1971,7 @@ compile_OPENEXR() {
_with_built_openexr=true _with_built_openexr=true
if [ -d $_inst ]; then # Just always run it, much simpler this way!
_create_inst_shortcut
fi
run_ldconfig "openexr" run_ldconfig "openexr"
} }
@@ -2115,7 +2112,9 @@ compile_OIIO() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting" ERROR "OpenImageIO-$OIIO_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2129,9 +2128,7 @@ compile_OIIO() {
INFO "If you want to force rebuild of this lib, use the --force-oiio option." INFO "If you want to force rebuild of this lib, use the --force-oiio option."
fi fi
if [ -d $_inst ]; then # Just always run it, much simpler this way!
_create_inst_shortcut
fi
run_ldconfig "oiio" run_ldconfig "oiio"
} }
@@ -2240,7 +2237,9 @@ compile_LLVM() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "LLVM-$LLVM_VERSION failed to compile, exiting" ERROR "LLVM-$LLVM_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2253,10 +2252,6 @@ compile_LLVM() {
INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!" INFO "Own LLVM-$LLVM_VERSION (CLANG included) is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-llvm option." INFO "If you want to force rebuild of this lib, use the --force-llvm option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -2321,7 +2316,6 @@ compile_OSL() {
tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \ tar -C $SRC --transform "s,(.*/?)OpenShadingLanguage-[^/]*(.*),\1OpenShadingLanguage-$OSL_VERSION\2,x" \
-xf $_src.tar.gz -xf $_src.tar.gz
fi fi
patch -d $_src -p1 < $SCRIPT_DIR/patches/osl.diff
fi fi
cd $_src cd $_src
@@ -2344,6 +2338,7 @@ compile_OSL() {
cmake_d="-D CMAKE_BUILD_TYPE=Release" cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst" cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D BUILD_TESTING=OFF"
cmake_d="$cmake_d -D STOP_ON_WARNING=OFF" cmake_d="$cmake_d -D STOP_ON_WARNING=OFF"
cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF" cmake_d="$cmake_d -D OSL_BUILD_PLUGINS=OFF"
cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF" cmake_d="$cmake_d -D OSL_BUILD_TESTS=OFF"
@@ -2351,10 +2346,7 @@ compile_OSL() {
cmake_d="$cmake_d -D USE_PARTIO=OFF" cmake_d="$cmake_d -D USE_PARTIO=OFF"
cmake_d="$cmake_d -D OSL_BUILD_MATERIALX=OFF" cmake_d="$cmake_d -D OSL_BUILD_MATERIALX=OFF"
cmake_d="$cmake_d -D USE_QT=OFF" cmake_d="$cmake_d -D USE_QT=OFF"
cmake_d="$cmake_d -D USE_Qt5=OFF"
cmake_d="$cmake_d -D USE_PYTHON=OFF" cmake_d="$cmake_d -D USE_PYTHON=OFF"
cmake_d="$cmake_d -D USE_PARTIO=OFF"
cmake_d="$cmake_d -D INSTALL_DOCS=OFF"
if [ $(uname -m) != "aarch64" ]; then if [ $(uname -m) != "aarch64" ]; then
cmake_d="$cmake_d -D USE_SIMD=sse2" cmake_d="$cmake_d -D USE_SIMD=sse2"
@@ -2376,7 +2368,10 @@ compile_OSL() {
fi fi
if [ -d $INST/oiio ]; then if [ -d $INST/oiio ]; then
cmake_d="$cmake_d -D OpenImageIO_ROOT=$INST/oiio" cmake_d="$cmake_d -D OPENIMAGEIO_ROOT_DIR=$INST/oiio"
# HACK! SIC!!!!
# Quiet incredible, but if root dir is given, path to lib is found, but not path to include...
cmake_d="$cmake_d -D OPENIMAGEIO_INCLUDE_DIR=$INST/oiio/include"
fi fi
if [ ! -z $LLVM_VERSION_FOUND ]; then if [ ! -z $LLVM_VERSION_FOUND ]; then
@@ -2395,7 +2390,9 @@ compile_OSL() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting" ERROR "OpenShadingLanguage-$OSL_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2409,9 +2406,6 @@ compile_OSL() {
INFO "If you want to force rebuild of this lib, use the --force-osl option." INFO "If you want to force rebuild of this lib, use the --force-osl option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "osl" run_ldconfig "osl"
} }
@@ -2512,7 +2506,9 @@ compile_OSD() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting" ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2526,9 +2522,6 @@ compile_OSD() {
INFO "If you want to force rebuild of this lib, use the --force-osd option." INFO "If you want to force rebuild of this lib, use the --force-osd option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "osd" run_ldconfig "osd"
} }
@@ -2618,7 +2611,9 @@ compile_BLOSC() {
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting" ERROR "Blosc-$OPENVDB_BLOSC_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2631,9 +2626,6 @@ compile_BLOSC() {
magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic magic_compile_set blosc-$OPENVDB_BLOSC_VERSION $blosc_magic
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "blosc" run_ldconfig "blosc"
} }
@@ -2724,7 +2716,9 @@ install_NanoVDB() {
#~ mkdir -p $_inst #~ mkdir -p $_inst
#~ cp -r $_src/include $_inst/include #~ cp -r $_src/include $_inst/include
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "NanoVDB-v$OPENVDB_VERSION failed to install, exiting" ERROR "NanoVDB-v$OPENVDB_VERSION failed to install, exiting"
exit 1 exit 1
fi fi
@@ -2736,10 +2730,6 @@ install_NanoVDB() {
else else
INFO "Own NanoVDB-v$OPENVDB_VERSION is up to date, nothing to do!" INFO "Own NanoVDB-v$OPENVDB_VERSION is up to date, nothing to do!"
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
} }
@@ -2859,7 +2849,9 @@ compile_OPENVDB() {
make -j$THREADS install make -j$THREADS install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting" ERROR "OpenVDB-$OPENVDB_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2873,9 +2865,6 @@ compile_OPENVDB() {
INFO "If you want to force rebuild of this lib, use the --force-openvdb option." INFO "If you want to force rebuild of this lib, use the --force-openvdb option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "openvdb" run_ldconfig "openvdb"
if [ "$WITH_NANOVDB" = true ]; then if [ "$WITH_NANOVDB" = true ]; then
@@ -2973,7 +2962,9 @@ compile_ALEMBIC() {
make -j$THREADS install make -j$THREADS install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting" ERROR "Alembic-$ALEMBIC_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -2987,9 +2978,6 @@ compile_ALEMBIC() {
INFO "If you want to force rebuild of this lib, use the --force-alembic option." INFO "If you want to force rebuild of this lib, use the --force-alembic option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "alembic" run_ldconfig "alembic"
} }
@@ -3074,7 +3062,9 @@ compile_USD() {
make -j$THREADS install make -j$THREADS install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "USD-$USD_VERSION failed to compile, exiting" ERROR "USD-$USD_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3088,9 +3078,6 @@ compile_USD() {
INFO "If you want to force rebuild of this lib, use the --force-usd option." INFO "If you want to force rebuild of this lib, use the --force-usd option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "usd" run_ldconfig "usd"
} }
@@ -3184,7 +3171,9 @@ compile_OpenCOLLADA() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting" ERROR "OpenCOLLADA-$OPENCOLLADA_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3197,10 +3186,6 @@ compile_OpenCOLLADA() {
INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!" INFO "Own OpenCOLLADA-$OPENCOLLADA_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-opencollada option." INFO "If you want to force rebuild of this lib, use the --force-opencollada option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -3301,7 +3286,9 @@ compile_Embree() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "Embree-$EMBREE_VERSION failed to compile, exiting" ERROR "Embree-$EMBREE_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3314,10 +3301,6 @@ compile_Embree() {
INFO "Own Embree-$EMBREE_VERSION is up to date, nothing to do!" INFO "Own Embree-$EMBREE_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-embree option." INFO "If you want to force rebuild of this lib, use the --force-embree option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -3380,7 +3363,9 @@ install_ISPC() {
mkdir -p $_inst mkdir -p $_inst
cp -r $_src/bin $_inst/bin cp -r $_src/bin $_inst/bin
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "ISPC-v$ISPC_VERSION failed to install, exiting" ERROR "ISPC-v$ISPC_VERSION failed to install, exiting"
exit 1 exit 1
fi fi
@@ -3393,10 +3378,6 @@ install_ISPC() {
INFO "Own ISPC-v$ISPC_VERSION is up to date, nothing to do!" INFO "Own ISPC-v$ISPC_VERSION is up to date, nothing to do!"
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
_ispc_path_bin=$_inst/bin _ispc_path_bin=$_inst/bin
run_ldconfig "ispc" run_ldconfig "ispc"
} }
@@ -3496,7 +3477,9 @@ compile_OIDN() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenImageDenoise-$OIDN_VERSION failed to compile, exiting" ERROR "OpenImageDenoise-$OIDN_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3510,9 +3493,6 @@ compile_OIDN() {
INFO "If you want to force rebuild of this lib, use the --force-oidn option." INFO "If you want to force rebuild of this lib, use the --force-oidn option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "oidn" run_ldconfig "oidn"
} }
@@ -3629,7 +3609,9 @@ compile_FFmpeg() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting" ERROR "FFmpeg-$FFMPEG_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3642,10 +3624,6 @@ compile_FFmpeg() {
INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!" INFO "Own ffmpeg-$FFMPEG_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option." INFO "If you want to force rebuild of this lib, use the --force-ffmpeg option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
} }
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -3744,7 +3722,9 @@ compile_XR_OpenXR_SDK() {
make -j$THREADS && make install make -j$THREADS && make install
make clean make clean
if [ ! -d $_inst ]; then if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "XR-OpenXR-SDK-$XR_OPENXR_VERSION failed to compile, exiting" ERROR "XR-OpenXR-SDK-$XR_OPENXR_VERSION failed to compile, exiting"
exit 1 exit 1
fi fi
@@ -3758,9 +3738,6 @@ compile_XR_OpenXR_SDK() {
INFO "If you want to force rebuild of this lib, use the --force-xr-openxr option." INFO "If you want to force rebuild of this lib, use the --force-xr-openxr option."
fi fi
if [ -d $_inst ]; then
_create_inst_shortcut
fi
run_ldconfig "xr-openxr-sdk" run_ldconfig "xr-openxr-sdk"
} }
@@ -3867,7 +3844,7 @@ install_DEB() {
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \ libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \ libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \ libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev libzstd-dev" libgmp-dev libpugixml-dev libpotrace-dev libhpdf-dev"
# libglewmx-dev (broken in deb testing currently...) # libglewmx-dev (broken in deb testing currently...)
VORBIS_USE=true VORBIS_USE=true
@@ -4135,8 +4112,6 @@ install_DEB() {
PRINT "" PRINT ""
# Debian OIIO includes again libopencv, without even properly dealing with this dependency...
OIIO_FORCE_BUILD=true
if [ "$OIIO_SKIP" = true ]; then if [ "$OIIO_SKIP" = true ]; then
WARNING "Skipping OpenImageIO installation, as requested..." WARNING "Skipping OpenImageIO installation, as requested..."
elif [ "$OIIO_FORCE_BUILD" = true ]; then elif [ "$OIIO_FORCE_BUILD" = true ]; then
@@ -4539,7 +4514,7 @@ install_RPM() {
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \ wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \ glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \ libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
gmp-devel pugixml-devel potrace-devel libharu-devel libzstd-devel" gmp-devel pugixml-devel potrace-devel libharu-devel"
OPENJPEG_USE=true OPENJPEG_USE=true
VORBIS_USE=true VORBIS_USE=true
@@ -5117,11 +5092,10 @@ install_ARCH() {
BASE_DEVEL=`pacman -Sgq base-devel | sed -e 's/^gcc$/gcc-multilib/g' | paste -s -d' '` BASE_DEVEL=`pacman -Sgq base-devel | sed -e 's/^gcc$/gcc-multilib/g' | paste -s -d' '`
fi fi
_packages="$BASE_DEVEL git cmake fontconfig flex \ _packages="$BASE_DEVEL git cmake fontconfig \
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \ libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \ $OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu \ libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml libharu"
zstd"
OPENJPEG_USE=true OPENJPEG_USE=true
VORBIS_USE=true VORBIS_USE=true

View File

@@ -70,18 +70,16 @@
} }
--- a/libavcodec/rl.c --- a/libavcodec/rl.c
+++ b/libavcodec/rl.c +++ b/libavcodec/rl.c
@@ -71,17 +71,19 @@ @@ -71,7 +71,7 @@ av_cold void ff_rl_init(RLTable *rl,
av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size) av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
{ {
int i, q; int i, q;
- VLC_TYPE table[1500][2] = {{0}}; - VLC_TYPE table[1500][2] = {{0}};
+ VLC_TYPE (*table)[2] = av_calloc(sizeof(VLC_TYPE), 1500 * 2); + VLC_TYPE (*table)[2] = av_calloc(sizeof(VLC_TYPE), 1500 * 2);
VLC vlc = { .table = table, .table_allocated = static_size }; VLC vlc = { .table = table, .table_allocated = static_size };
- av_assert0(static_size <= FF_ARRAY_ELEMS(table)); av_assert0(static_size <= FF_ARRAY_ELEMS(table));
+ av_assert0(static_size < 1500);
init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC); init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
@@ -80,8 +80,10 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
for (q = 0; q < 32; q++) {
int qmul = q * 2; int qmul = q * 2;
int qadd = (q - 1) | 1; int qadd = (q - 1) | 1;
@@ -93,7 +91,7 @@
if (q == 0) { if (q == 0) {
qmul = 1; qmul = 1;
@@ -113,4 +115,5 @@ @@ -113,4 +115,5 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
rl->rl_vlc[q][i].run = run; rl->rl_vlc[q][i].run = run;
} }
} }

View File

@@ -0,0 +1,10 @@
--- 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()

View File

@@ -34,3 +34,24 @@ diff -Naur orig/src/include/OpenImageIO/platform.h external_openimageio/src/incl
# include <windows.h> # include <windows.h>
#endif #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

View File

@@ -1,3 +1,18 @@
diff -Naur OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej external_osl/src/cmake/flexbison.cmake.rej
--- OpenShadingLanguage-Release-1.9.9/src/cmake/flexbison.cmake.rej 1969-12-31 17:00:00 -0700
+++ external_osl/src/cmake/flexbison.cmake.rej 2018-08-24 17:42:11 -0600
@@ -0,0 +1,11 @@
+--- src/cmake/flexbison.cmake 2018-05-01 16:39:02 -0600
++++ src/cmake/flexbison.cmake 2018-08-24 10:24:03 -0600
+@@ -77,7 +77,7 @@
+ DEPENDS ${${compiler_headers}}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
+ ADD_CUSTOM_COMMAND ( OUTPUT ${flexoutputcxx}
+- COMMAND ${FLEX_EXECUTABLE} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
++ COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXTRA_OPTIONS} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}"
+ MAIN_DEPENDENCY ${flexsrc}
+ DEPENDS ${${compiler_headers}}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
diff -Naur OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h external_osl/src/include/OSL/llvm_util.h diff -Naur OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h external_osl/src/include/OSL/llvm_util.h
--- OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h 2018-05-01 16:39:02 -0600 --- OpenShadingLanguage-Release-1.9.9/src/include/OSL/llvm_util.h 2018-05-01 16:39:02 -0600
+++ external_osl/src/include/OSL/llvm_util.h 2018-08-25 14:05:00 -0600 +++ external_osl/src/include/OSL/llvm_util.h 2018-08-25 14:05:00 -0600
@@ -48,50 +63,19 @@ 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") set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
if (OSL_NO_DEFAULT_TEXTURESYSTEM) if (OSL_NO_DEFAULT_TEXTURESYSTEM)
diff --git a/CMakeLists.txt b/CMakeLists.txt diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp
index 990f50d69..46ef7351d 100644 index 445f6400..3d468de2 100644
--- a/CMakeLists.txt --- a/src/liboslexec/llvm_util.cpp
+++ b/CMakeLists.txt +++ b/src/liboslexec/llvm_util.cpp
@@ -252,11 +252,9 @@ install (EXPORT OSL_EXPORTED_TARGETS @@ -3430,8 +3430,9 @@ LLVM_Util::call_function (llvm::Value *func, cspan<llvm::Value *> args)
FILE ${OSL_TARGETS_EXPORT_NAME} #endif
NAMESPACE ${PROJECT_NAME}::) //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(
-osl_add_all_tests() + llvm::cast<llvm::FunctionType>(func->getType()->getPointerElementType()), func,
- + llvm::ArrayRef<llvm::Value*>(args.data(), args.size()));
+if (${PROJECT_NAME}_BUILD_TESTS AND NOT ${PROJECT_NAME}_IS_SUBPROJECT) #else
+ osl_add_all_tests() llvm::Value *r = builder().CreateCall (func, llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
+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 #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>

View File

@@ -33,23 +33,11 @@ FIND_PATH(OPTIX_INCLUDE_DIR
include include
) )
IF(EXISTS "${OPTIX_INCLUDE_DIR}/optix.h")
FILE(STRINGS "${OPTIX_INCLUDE_DIR}/optix.h" _optix_version REGEX "^#define OPTIX_VERSION[ \t].*$")
STRING(REGEX MATCHALL "[0-9]+" _optix_version ${_optix_version})
MATH(EXPR _optix_version_major "${_optix_version} / 10000")
MATH(EXPR _optix_version_minor "(${_optix_version} % 10000) / 100")
MATH(EXPR _optix_version_patch "${_optix_version} % 100")
SET(OPTIX_VERSION "${_optix_version_major}.${_optix_version_minor}.${_optix_version_patch}")
ENDIF()
# handle the QUIETLY and REQUIRED arguments and set OPTIX_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set OPTIX_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OptiX FIND_PACKAGE_HANDLE_STANDARD_ARGS(OptiX DEFAULT_MSG
REQUIRED_VARS OPTIX_INCLUDE_DIR OPTIX_INCLUDE_DIR)
VERSION_VAR OPTIX_VERSION)
IF(OPTIX_FOUND) IF(OPTIX_FOUND)
SET(OPTIX_INCLUDE_DIRS ${OPTIX_INCLUDE_DIR}) SET(OPTIX_INCLUDE_DIRS ${OPTIX_INCLUDE_DIR})
@@ -57,7 +45,6 @@ ENDIF()
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
OPTIX_INCLUDE_DIR OPTIX_INCLUDE_DIR
OPTIX_VERSION
) )
UNSET(_optix_SEARCH_DIRS) UNSET(_optix_SEARCH_DIRS)

View File

@@ -1,66 +0,0 @@
# - Find Zstd library
# Find the native Zstd includes and library
# This module defines
# ZSTD_INCLUDE_DIRS, where to find zstd.h, Set when
# ZSTD_INCLUDE_DIR is found.
# ZSTD_LIBRARIES, libraries to link against to use Zstd.
# ZSTD_ROOT_DIR, The base directory to search for Zstd.
# This can also be an environment variable.
# ZSTD_FOUND, If false, do not try to use Zstd.
#
# also defined, but not for general use are
# ZSTD_LIBRARY, where to find the Zstd library.
#=============================================================================
# Copyright 2019 Blender Foundation.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# If ZSTD_ROOT_DIR was defined in the environment, use it.
IF(NOT ZSTD_ROOT_DIR AND NOT $ENV{ZSTD_ROOT_DIR} STREQUAL "")
SET(ZSTD_ROOT_DIR $ENV{ZSTD_ROOT_DIR})
ENDIF()
SET(_zstd_SEARCH_DIRS
${ZSTD_ROOT_DIR}
)
FIND_PATH(ZSTD_INCLUDE_DIR
NAMES
zstd.h
HINTS
${_zstd_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(ZSTD_LIBRARY
NAMES
zstd
HINTS
${_zstd_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set ZSTD_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Zstd DEFAULT_MSG
ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
IF(ZSTD_FOUND)
SET(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
SET(ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR})
ENDIF()
MARK_AS_ADVANCED(
ZSTD_INCLUDE_DIR
ZSTD_LIBRARY
)

View File

@@ -82,7 +82,7 @@ def create_nb_project_main():
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM") make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
make_exe_basename = os.path.basename(make_exe) make_exe_basename = os.path.basename(make_exe)
# --------------- NetBeans specific. # --------------- NB specific
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines] defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()] defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]

View File

@@ -7,6 +7,7 @@
set(WITH_ASSERT_ABORT ON CACHE BOOL "" FORCE) set(WITH_ASSERT_ABORT ON CACHE BOOL "" FORCE)
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE) set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
set(WITH_COMPILER_ASAN ON CACHE BOOL "" FORCE) set(WITH_COMPILER_ASAN ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_DEBUG ON CACHE BOOL "" FORCE)
set(WITH_CYCLES_NATIVE_ONLY ON CACHE BOOL "" FORCE) set(WITH_CYCLES_NATIVE_ONLY ON CACHE BOOL "" FORCE)
set(WITH_DOC_MANPAGE OFF CACHE BOOL "" FORCE) set(WITH_DOC_MANPAGE OFF CACHE BOOL "" FORCE)
set(WITH_GTESTS ON CACHE BOOL "" FORCE) set(WITH_GTESTS ON CACHE BOOL "" FORCE)

View File

@@ -208,7 +208,7 @@ function(blender_source_group
) )
# if enabled, use the sources directories as filters. # if enabled, use the sources directories as filters.
if(IDE_GROUP_SOURCES_IN_FOLDERS) if(WINDOWS_USE_VISUAL_STUDIO_SOURCE_FOLDERS)
foreach(_SRC ${sources}) foreach(_SRC ${sources})
# remove ../'s # remove ../'s
get_filename_component(_SRC_DIR ${_SRC} REALPATH) get_filename_component(_SRC_DIR ${_SRC} REALPATH)
@@ -240,8 +240,8 @@ function(blender_source_group
endforeach() endforeach()
endif() endif()
# if enabled, set the FOLDER property for the projects # if enabled, set the FOLDER property for visual studio projects
if(IDE_GROUP_PROJECTS_IN_FOLDERS) if(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY) get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir}) string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
set_target_properties(${name} PROPERTIES FOLDER ${FolderDir}) set_target_properties(${name} PROPERTIES FOLDER ${FolderDir})

View File

@@ -404,16 +404,32 @@ endif()
# CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags. # CMake FindOpenMP doesn't know about AppleClang before 3.12, so provide custom flags.
if(WITH_OPENMP) if(WITH_OPENMP)
if(CMAKE_C_COMPILER_ID MATCHES "Clang") if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0")
# Use OpenMP from our precompiled libraries. # Use OpenMP from our precompiled libraries.
message(STATUS "Using ${LIBDIR}/openmp for OpenMP") message(STATUS "Using ${LIBDIR}/openmp for OpenMP")
set(OPENMP_CUSTOM ON) set(OPENMP_CUSTOM ON)
set(OPENMP_FOUND ON) set(OPENMP_FOUND ON)
set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'") set(OpenMP_C_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'") set(OpenMP_CXX_FLAGS "-Xclang -fopenmp -I'${LIBDIR}/openmp/include'")
set(OpenMP_LIBRARY_DIR "${LIBDIR}/openmp/lib/") set(OpenMP_LINKER_FLAGS "-L'${LIBDIR}/openmp/lib' -lomp")
set(OpenMP_LINKER_FLAGS "-L'${OpenMP_LIBRARY_DIR}' -lomp")
set(OpenMP_LIBRARY "${OpenMP_LIBRARY_DIR}/libomp.dylib") # Copy libomp.dylib to allow executables like datatoc and tests to work.
# `@executable_path/../Resources/lib/` `LC_ID_DYLIB` is added by the deps builder.
# For single config generator datatoc, tests etc.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib
)
# For multi-config generator datatoc, etc.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/Resources/lib/libomp.dylib
)
# For multi-config generator tests.
execute_process(
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/bin/tests/Resources/lib/libomp.dylib
)
endif() endif()
endif() endif()
@@ -441,9 +457,6 @@ if(WITH_HARU)
endif() endif()
endif() endif()
set(ZSTD_ROOT_DIR ${LIBDIR}/zstd)
find_package(Zstd REQUIRED)
if(EXISTS ${LIBDIR}) if(EXISTS ${LIBDIR})
without_system_libs_end() without_system_libs_end()
endif() endif()
@@ -467,8 +480,10 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -mdynamic-no-pic")
endif() endif()
# Clang has too low template depth of 128 for libmv. if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
string(APPEND CMAKE_CXX_FLAGS " -ftemplate-depth=1024") # 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()
# Avoid conflicts with Luxrender, and other plug-ins that may use the same # Avoid conflicts with Luxrender, and other plug-ins that may use the same
# libraries as Blender with a different version or build options. # libraries as Blender with a different version or build options.
@@ -498,15 +513,3 @@ if(WITH_COMPILER_CCACHE)
endif() endif()
endif() endif()
endif() endif()
# For binaries that are built but not installed (also not distributed) (datatoc,
# makesdna, tests, etc.), we add an rpath to the OpenMP library dir through
# CMAKE_BUILD_RPATH. This avoids having to make many copies of the dylib next to each binary.
#
# For the installed Python module and installed Blender executable, CMAKE_INSTALL_RPATH
# is modified to find the dylib in an adjacent folder. Install step puts the libraries there.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
list(APPEND CMAKE_BUILD_RPATH "${OpenMP_LIBRARY_DIR}")
set(CMAKE_SKIP_INSTALL_RPATH FALSE)
list(APPEND CMAKE_INSTALL_RPATH "@loader_path/../Resources/${BLENDER_VERSION}/lib")

View File

@@ -99,7 +99,6 @@ endif()
find_package_wrapper(JPEG REQUIRED) find_package_wrapper(JPEG REQUIRED)
find_package_wrapper(PNG REQUIRED) find_package_wrapper(PNG REQUIRED)
find_package_wrapper(ZLIB REQUIRED) find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Zstd REQUIRED)
find_package_wrapper(Freetype REQUIRED) find_package_wrapper(Freetype REQUIRED)
if(WITH_PYTHON) if(WITH_PYTHON)

View File

@@ -57,6 +57,8 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif() endif()
endif() endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS})
if(NOT WITH_PYTHON_MODULE) if(NOT WITH_PYTHON_MODULE)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT blender) set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT blender)
endif() endif()
@@ -151,8 +153,8 @@ if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
string(APPEND CMAKE_CXX_FLAGS " ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ") string(APPEND CMAKE_CXX_FLAGS " ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference")
else() else()
string(APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj /Zc:inline") string(APPEND CMAKE_CXX_FLAGS " /nologo /J /Gd /MP /EHsc /bigobj")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj /Zc:inline") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj")
endif() endif()
# X64 ASAN is available and usable on MSVC 16.9 preview 4 and up) # X64 ASAN is available and usable on MSVC 16.9 preview 4 and up)
@@ -215,8 +217,8 @@ else()
endif() endif()
if(WITH_WINDOWS_PDB) if(WITH_WINDOWS_PDB)
set(PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}") set(PDB_INFO_OVERRIDE_FLAGS "${SYMBOL_FORMAT_RELEASE}")
set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO") set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
endif() endif()
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}") string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MDd ${SYMBOL_FORMAT}")
@@ -259,7 +261,7 @@ if(NOT DEFINED LIBDIR)
else() else()
message(FATAL_ERROR "32 bit compiler detected, blender no longer provides pre-build libraries for 32 bit windows, please set the LIBDIR cmake variable to your own library folder") message(FATAL_ERROR "32 bit compiler detected, blender no longer provides pre-build libraries for 32 bit windows, please set the LIBDIR cmake variable to your own library folder")
endif() endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.30.30423) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30130)
message(STATUS "Visual Studio 2022 detected.") message(STATUS "Visual Studio 2022 detected.")
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15) set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
elseif(MSVC_VERSION GREATER 1919) elseif(MSVC_VERSION GREATER 1919)
@@ -873,6 +875,3 @@ if(WITH_HARU)
set(WITH_HARU OFF) set(WITH_HARU OFF)
endif() endif()
endif() endif()
set(ZSTD_INCLUDE_DIRS ${LIBDIR}/zstd/include)
set(ZSTD_LIBRARIES ${LIBDIR}/zstd/lib/zstd_static.lib)

View File

@@ -1,10 +1,8 @@
Pipeline Config Pipeline Config
=============== ===============
The `yaml` configuration file is used by buildbot build pipeline `update-code` step. This configuration file is used by buildbot new pipeline for the `update-code` step.
The file allows to set branches or specific commits for both git submodules and svn artifacts. Can also define various build package versions for use by build workers. Especially useful in experimental and release branches. It will soon be used by the ../utils/make_update.py script.
NOTE: Both buildbot and developers will eventually use the same configuration file.
* The configuration file is ```NOT``` used by the `../utils/make_update.py` script.
* That will implemented in the future.

View File

@@ -0,0 +1,87 @@
{
"update-code":
{
"git" :
{
"submodules":
[
{ "path": "release/scripts/addons", "branch": "master", "commit_id": "HEAD" },
{ "path": "release/scripts/addons_contrib", "branch": "master", "commit_id": "HEAD" },
{ "path": "release/datafiles/locale", "branch": "master", "commit_id": "HEAD" },
{ "path": "source/tools", "branch": "master", "commit_id": "HEAD" }
]
},
"svn":
{
"tests": { "path": "lib/tests", "branch": "trunk", "commit_id": "HEAD" },
"libraries":
{
"darwin-x86_64": { "path": "lib/darwin", "branch": "trunk", "commit_id": "HEAD" },
"darwin-arm64": { "path": "lib/darwin_arm64", "branch": "trunk", "commit_id": "HEAD" },
"linux-x86_64": { "path": "lib/linux_centos7_x86_64", "branch": "trunk", "commit_id": "HEAD" },
"windows-amd64": { "path": "lib/win64_vc15", "branch": "trunk", "commit_id": "HEAD" }
}
}
},
"buildbot":
{
"gcc":
{
"version": "9.0"
},
"sdks":
{
"optix":
{
"version": "7.1.0"
},
"cuda10":
{
"version": "10.1"
},
"cuda11":
{
"version": "11.3"
}
},
"cmake":
{
"default":
{
"version": "any",
"overrides":
{
}
},
"darwin-x86_64":
{
"overrides":
{
}
},
"darwin-arm64":
{
"overrides":
{
}
},
"linux-x86_64":
{
"overrides":
{
}
},
"windows-amd64":
{
"overrides":
{
}
}
}
}
}

View File

@@ -1,70 +0,0 @@
#
# 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: '9.0.0'
cuda10:
version: '10.1.243'
cuda11:
version: '11.4.1'
optix:
version: '7.3.0'
cmake:
default:
version: any
overrides: {}
darwin-arm64:
overrides: {}
darwin-x86_64:
overrides: {}
linux-x86_64:
overrides: {}
windows-amd64:
overrides: {}

View File

@@ -31,7 +31,6 @@ def parse_arguments():
parser.add_argument("--no-submodules", action="store_true") parser.add_argument("--no-submodules", action="store_true")
parser.add_argument("--use-tests", action="store_true") parser.add_argument("--use-tests", action="store_true")
parser.add_argument("--svn-command", default="svn") parser.add_argument("--svn-command", default="svn")
parser.add_argument("--svn-branch", default=None)
parser.add_argument("--git-command", default="git") parser.add_argument("--git-command", default="git")
parser.add_argument("--use-centos-libraries", action="store_true") parser.add_argument("--use-centos-libraries", action="store_true")
return parser.parse_args() return parser.parse_args()
@@ -47,7 +46,7 @@ def svn_update(args, release_version):
svn_non_interactive = [args.svn_command, '--non-interactive'] svn_non_interactive = [args.svn_command, '--non-interactive']
lib_dirpath = os.path.join(get_blender_git_root(), '..', 'lib') lib_dirpath = os.path.join(get_blender_git_root(), '..', 'lib')
svn_url = make_utils.svn_libraries_base_url(release_version, args.svn_branch) svn_url = make_utils.svn_libraries_base_url(release_version)
# Checkout precompiled libraries # Checkout precompiled libraries
if sys.platform == 'darwin': if sys.platform == 'darwin':
@@ -171,28 +170,26 @@ def submodules_update(args, release_version, branch):
sys.stderr.write("git not found, can't update code\n") sys.stderr.write("git not found, can't update code\n")
sys.exit(1) sys.exit(1)
# Update submodules to appropriate given branch, # Update submodules to latest master or appropriate release branch.
# falling back to master if none is given and/or found in a sub-repository. if not release_version:
branch_fallback = "master" branch = "master"
if not branch:
branch = branch_fallback
submodules = [ submodules = [
("release/scripts/addons", branch, branch_fallback), ("release/scripts/addons", branch),
("release/scripts/addons_contrib", branch, branch_fallback), ("release/scripts/addons_contrib", branch),
("release/datafiles/locale", branch, branch_fallback), ("release/datafiles/locale", branch),
("source/tools", branch, branch_fallback), ("source/tools", branch),
] ]
# Initialize submodules only if needed. # Initialize submodules only if needed.
for submodule_path, submodule_branch, submodule_branch_fallback in submodules: for submodule_path, submodule_branch in submodules:
if not os.path.exists(os.path.join(submodule_path, ".git")): if not os.path.exists(os.path.join(submodule_path, ".git")):
call([args.git_command, "submodule", "update", "--init", "--recursive"]) call([args.git_command, "submodule", "update", "--init", "--recursive"])
break break
# Checkout appropriate branch and pull changes. # Checkout appropriate branch and pull changes.
skip_msg = "" skip_msg = ""
for submodule_path, submodule_branch, submodule_branch_fallback in submodules: for submodule_path, submodule_branch in submodules:
cwd = os.getcwd() cwd = os.getcwd()
try: try:
os.chdir(submodule_path) os.chdir(submodule_path)
@@ -200,20 +197,10 @@ def submodules_update(args, release_version, branch):
if msg: if msg:
skip_msg += submodule_path + " skipped: " + msg + "\n" skip_msg += submodule_path + " skipped: " + msg + "\n"
else: else:
# Find a matching branch that exists. if make_utils.git_branch(args.git_command) != submodule_branch:
call([args.git_command, "fetch", "origin"]) call([args.git_command, "fetch", "origin"])
if make_utils.git_branch_exists(args.git_command, submodule_branch): call([args.git_command, "checkout", submodule_branch])
pass call([args.git_command, "pull", "--rebase", "origin", submodule_branch])
elif make_utils.git_branch_exists(args.git_command, submodule_branch_fallback):
submodule_branch = submodule_branch_fallback
else:
submodule_branch = None
# Switch to branch and pull.
if submodule_branch:
if make_utils.git_branch(args.git_command) != submodule_branch:
call([args.git_command, "checkout", submodule_branch])
call([args.git_command, "pull", "--rebase", "origin", submodule_branch])
finally: finally:
os.chdir(cwd) os.chdir(cwd)
@@ -227,10 +214,6 @@ if __name__ == "__main__":
# Test if we are building a specific release version. # Test if we are building a specific release version.
branch = make_utils.git_branch(args.git_command) branch = make_utils.git_branch(args.git_command)
if branch == 'HEAD':
sys.stderr.write('Blender git repository is in detached HEAD state, must be in a branch\n')
sys.exit(1)
tag = make_utils.git_tag(args.git_command) tag = make_utils.git_tag(args.git_command)
release_version = make_utils.git_branch_release_version(branch, tag) release_version = make_utils.git_branch_release_version(branch, tag)

View File

@@ -8,19 +8,14 @@ import subprocess
import sys import sys
def call(cmd, exit_on_error=True, silent=False): def call(cmd, exit_on_error=True):
if not silent: print(" ".join(cmd))
print(" ".join(cmd))
# Flush to ensure correct order output on Windows. # Flush to ensure correct order output on Windows.
sys.stdout.flush() sys.stdout.flush()
sys.stderr.flush() sys.stderr.flush()
if silent: retcode = subprocess.call(cmd)
retcode = subprocess.call(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
else:
retcode = subprocess.call(cmd)
if exit_on_error and retcode != 0: if exit_on_error and retcode != 0:
sys.exit(retcode) sys.exit(retcode)
return retcode return retcode
@@ -43,11 +38,6 @@ def check_output(cmd, exit_on_error=True):
return output.strip() return output.strip()
def git_branch_exists(git_command, branch):
return call([git_command, "rev-parse", "--verify", branch], exit_on_error=False, silent=True) == 0 or \
call([git_command, "rev-parse", "--verify", "remotes/origin/" + branch], exit_on_error=False, silent=True) == 0
def git_branch(git_command): def git_branch(git_command):
# Get current branch name. # Get current branch name.
try: try:
@@ -80,11 +70,9 @@ def git_branch_release_version(branch, tag):
return release_version return release_version
def svn_libraries_base_url(release_version, branch=None): def svn_libraries_base_url(release_version):
if release_version: if release_version:
svn_branch = "tags/blender-" + release_version + "-release" svn_branch = "tags/blender-" + release_version + "-release"
elif branch:
svn_branch = "branches/" + branch
else: else:
svn_branch = "trunk" svn_branch = "trunk"
return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/" return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/"

View File

@@ -1,34 +0,0 @@
set SOURCEDIR=%BLENDER_DIR%/doc/python_api/sphinx-in
set BUILDDIR=%BLENDER_DIR%/doc/python_api/sphinx-out
if "%BF_LANG%" == "" set BF_LANG=en
set SPHINXOPTS=-j auto -D language=%BF_LANG%
call "%~dp0\find_sphinx.cmd"
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
echo unable to locate sphinx-build, run "set sphinx_BIN=full_path_to_sphinx-build.exe"
exit /b 1
:detect_sphinx_done
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%BLENDER_BIN% ^
--background -noaudio --factory-startup ^
--python %BLENDER_DIR%/doc/python_api/sphinx_doc_gen.py
"%SPHINX_BIN%" -b html %SPHINXOPTS% %O% %SOURCEDIR% %BUILDDIR%
:EOF

View File

@@ -1,28 +0,0 @@
REM First see if there is an environment variable set
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the build folder next, if ninja was used there will be no
REM debug/release folder
set BLENDER_BIN=%BUILD_DIR%\bin\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the release folder next
set BLENDER_BIN=%BUILD_DIR%\bin\release\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM Check the debug folder next
set BLENDER_BIN=%BUILD_DIR%\bin\debug\blender.exe
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
REM at this point, we don't know where blender is, clear the variable
set BLENDER_BIN=
:detect_blender_done

View File

@@ -1,21 +0,0 @@
REM First see if there is an environment variable set
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM Then see if inkscape is available in the path
for %%X in (inkscape.exe) do (set INKSCAPE_BIN=%%~$PATH:X)
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM Finally see if it is perhaps installed at the default location
set INKSCAPE_BIN=%ProgramFiles%\Inkscape\bin\inkscape.exe
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
REM If still not found clear the variable
set INKSCAPE_BIN=
:detect_inkscape_done

View File

@@ -1,23 +0,0 @@
REM First see if there is an environment variable set
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
REM Then see if inkscape is available in the path
for %%X in (sphinx-build.exe) do (set SPHINX_BIN=%%~$PATH:X)
if EXIST "%SPHINX_BIN%" (
goto detect_sphinx_done
)
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINX_BIN environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
REM If still not found clear the variable
set SPHINX_BIN=
:detect_sphinx_done

View File

@@ -1,42 +0,0 @@
if EXIST "%PYTHON%" (
goto detect_python_done
)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
if EXIST %PYTHON% (
goto detect_python_done
)
echo python not found at %PYTHON%
exit /b 1
:detect_python_done
echo found python (%PYTHON%)
call "%~dp0\find_inkscape.cmd"
if EXIST "%INKSCAPE_BIN%" (
goto detect_inkscape_done
)
echo unable to locate inkscape, run "set inkscape_BIN=full_path_to_inkscape.exe"
exit /b 1
:detect_inkscape_done
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_update.py
%PYTHON% -B %BLENDER_DIR%\release\datafiles\prvicons_update.py
%PYTHON% -B %BLENDER_DIR%\release\datafiles\alert_icons_update.py
:EOF

View File

@@ -1,29 +0,0 @@
if EXIST %PYTHON% (
goto detect_python_done
)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc15\python\39\bin\python.exe
if EXIST %PYTHON% (
goto detect_python_done
)
echo python not found at %PYTHON%
exit /b 1
:detect_python_done
echo found python (%PYTHON%)
call "%~dp0\find_blender.cmd"
if EXIST "%BLENDER_BIN%" (
goto detect_blender_done
)
echo unable to locate blender, run "set BLENDER_BIN=full_path_to_blender.exe"
exit /b 1
:detect_blender_done
%PYTHON% -B %BLENDER_DIR%\release\datafiles\blender_icons_geom_update.py
:EOF

View File

@@ -107,15 +107,6 @@ if NOT "%1" == "" (
set FORMAT=1 set FORMAT=1
set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9 set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9
goto EOF goto EOF
) else if "%1" == "icons" (
set ICONS=1
goto EOF
) else if "%1" == "icons_geom" (
set ICONS_GEOM=1
goto EOF
) else if "%1" == "doc_py" (
set DOC_PY=1
goto EOF
) else ( ) else (
echo Command "%1" unknown, aborting! echo Command "%1" unknown, aborting!
goto ERR goto ERR

View File

@@ -31,6 +31,3 @@ set PYDEBUG_CMAKE_ARGS=
set FORMAT= set FORMAT=
set TEST= set TEST=
set BUILD_WITH_SCCACHE= set BUILD_WITH_SCCACHE=
set ICONS=
set ICONS_GEOM=
set DOC_PY=

View File

@@ -31,10 +31,6 @@ echo - 2019 ^(build with visual studio 2019^)
echo - 2019pre ^(build with visual studio 2019 pre-release^) echo - 2019pre ^(build with visual studio 2019 pre-release^)
echo - 2019b ^(build with visual studio 2019 Build Tools^) echo - 2019b ^(build with visual studio 2019 Build Tools^)
echo.
echo Documentation Targets ^(Not associated with building^)
echo - doc_py ^(Generate sphinx python api docs^)
echo. echo.
echo Experimental options echo Experimental options
echo - with_opengl_tests ^(enable both the render and draw opengl test suites^) echo - with_opengl_tests ^(enable both the render and draw opengl test suites^)

View File

@@ -123,7 +123,7 @@ def Align(handle):
class BlendFile: class BlendFile:
''' '''
Reads a blendfile and store the header, all the fileblocks, and catalogue Reads a blendfile and store the header, all the fileblocks, and catalogue
structs found in the DNA fileblock structs foound in the DNA fileblock
- BlendFile.Header (BlendFileHeader instance) - BlendFile.Header (BlendFileHeader instance)
- BlendFile.Blocks (list of BlendFileBlock instances) - BlendFile.Blocks (list of BlendFileBlock instances)

View File

@@ -122,7 +122,7 @@ is a full-featured 3D application. It supports the entirety of the 3D pipeline -
'''modeling, rigging, animation, simulation, rendering, compositing, motion tracking, and video editing. '''modeling, rigging, animation, simulation, rendering, compositing, motion tracking, and video editing.
Use Blender to create 3D images and animations, films and commercials, content for games, ''' Use Blender to create 3D images and animations, films and commercials, content for games, '''
r'''architectural and industrial visualizations, and scientific visualizations. r'''architectural and industrial visualizatons, and scientific visualizations.
https://www.blender.org''') https://www.blender.org''')

View File

@@ -14,7 +14,7 @@ sound = aud.Sound('music.ogg')
# play the audio, this return a handle to control play/pause # play the audio, this return a handle to control play/pause
handle = device.play(sound) handle = device.play(sound)
# if the audio is not too big and will be used often you can buffer it # if the audio is not too big and will be used often you can buffer it
sound_buffered = aud.Sound.cache(sound) sound_buffered = aud.Sound.buffer(sound)
handle_buffered = device.play(sound_buffered) handle_buffered = device.play(sound_buffered)
# stop the sounds (otherwise they play until their ends) # stop the sounds (otherwise they play until their ends)

View File

@@ -31,8 +31,7 @@ def draw():
context.space_data, context.space_data,
context.region, context.region,
view_matrix, view_matrix,
projection_matrix, projection_matrix)
True)
gpu.state.depth_mask_set(False) gpu.state.depth_mask_set(False)
draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT) draw_texture_2d(offscreen.texture_color, (10, 10), WIDTH, HEIGHT)

View File

@@ -1,13 +1,13 @@
sphinx==4.1.1 sphinx==3.5.4
# Sphinx dependencies that are important # Sphinx dependencies that are important
Jinja2==3.0.1 Jinja2==2.11.3
Pygments==2.10.0 Pygments==2.9.0
docutils==0.17.1 docutils==0.16
snowballstemmer==2.1.0 snowballstemmer==2.1.0
babel==2.9.1 babel==2.9.1
requests==2.26.0 requests==2.25.1
# Only needed to match the theme used for the official documentation. # Only needed to match the theme used for the official documentation.
# Without this theme, the default theme will be used. # Without this theme, the default theme will be used.
sphinx_rtd_theme==1.0.0 sphinx_rtd_theme==0.5.2

View File

@@ -254,8 +254,6 @@ else:
"gpu.shader", "gpu.shader",
"gpu.state", "gpu.state",
"gpu.texture", "gpu.texture",
"gpu.platform",
"gpu.capabilities",
"gpu_extras", "gpu_extras",
"idprop.types", "idprop.types",
"mathutils", "mathutils",
@@ -1039,21 +1037,16 @@ context_type_map = {
# context_member: (RNA type, is_collection) # context_member: (RNA type, is_collection)
"active_annotation_layer": ("GPencilLayer", False), "active_annotation_layer": ("GPencilLayer", False),
"active_bone": ("EditBone", False), "active_bone": ("EditBone", False),
"active_file": ("FileSelectEntry", False),
"active_gpencil_frame": ("GreasePencilLayer", True), "active_gpencil_frame": ("GreasePencilLayer", True),
"active_gpencil_layer": ("GPencilLayer", True), "active_gpencil_layer": ("GPencilLayer", True),
"active_node": ("Node", False), "active_node": ("Node", False),
"active_object": ("Object", False), "active_object": ("Object", False),
"active_operator": ("Operator", False), "active_operator": ("Operator", False),
"active_pose_bone": ("PoseBone", False), "active_pose_bone": ("PoseBone", False),
"active_sequence_strip": ("Sequence", False),
"active_editable_fcurve": ("FCurve", False), "active_editable_fcurve": ("FCurve", False),
"active_nla_strip": ("NlaStrip", False),
"active_nla_track": ("NlaTrack", False),
"annotation_data": ("GreasePencil", False), "annotation_data": ("GreasePencil", False),
"annotation_data_owner": ("ID", False), "annotation_data_owner": ("ID", False),
"armature": ("Armature", False), "armature": ("Armature", False),
"asset_library_ref": ("AssetLibraryReference", False),
"bone": ("Bone", False), "bone": ("Bone", False),
"brush": ("Brush", False), "brush": ("Brush", False),
"camera": ("Camera", False), "camera": ("Camera", False),
@@ -1078,7 +1071,6 @@ context_type_map = {
"gpencil_data": ("GreasePencil", False), "gpencil_data": ("GreasePencil", False),
"gpencil_data_owner": ("ID", False), "gpencil_data_owner": ("ID", False),
"hair": ("Hair", False), "hair": ("Hair", False),
"id": ("ID", False),
"image_paint_object": ("Object", False), "image_paint_object": ("Object", False),
"lattice": ("Lattice", False), "lattice": ("Lattice", False),
"light": ("Light", False), "light": ("Light", False),
@@ -1107,7 +1099,6 @@ context_type_map = {
"selected_editable_keyframes": ("Keyframe", True), "selected_editable_keyframes": ("Keyframe", True),
"selected_editable_objects": ("Object", True), "selected_editable_objects": ("Object", True),
"selected_editable_sequences": ("Sequence", True), "selected_editable_sequences": ("Sequence", True),
"selected_files": ("FileSelectEntry", True),
"selected_nla_strips": ("NlaStrip", True), "selected_nla_strips": ("NlaStrip", True),
"selected_nodes": ("Node", True), "selected_nodes": ("Node", True),
"selected_objects": ("Object", True), "selected_objects": ("Object", True),
@@ -1122,7 +1113,6 @@ context_type_map = {
"texture_slot": ("MaterialTextureSlot", False), "texture_slot": ("MaterialTextureSlot", False),
"texture_user": ("ID", False), "texture_user": ("ID", False),
"texture_user_property": ("Property", False), "texture_user_property": ("Property", False),
"ui_list": ("UIList", False),
"vertex_paint_object": ("Object", False), "vertex_paint_object": ("Object", False),
"view_layer": ("ViewLayer", False), "view_layer": ("ViewLayer", False),
"visible_bones": ("EditBone", True), "visible_bones": ("EditBone", True),
@@ -1204,7 +1194,6 @@ def pycontext2sphinx(basepath):
"text_context_dir", "text_context_dir",
"clip_context_dir", "clip_context_dir",
"sequencer_context_dir", "sequencer_context_dir",
"file_context_dir",
) )
unique = set() unique = set()
@@ -2002,15 +1991,13 @@ def write_rst_importable_modules(basepath):
"blf": "Font Drawing", "blf": "Font Drawing",
"imbuf": "Image Buffer", "imbuf": "Image Buffer",
"imbuf.types": "Image Buffer Types", "imbuf.types": "Image Buffer Types",
"gpu": "GPU Module", "gpu": "GPU Shader Module",
"gpu.types": "GPU Types", "gpu.types": "GPU Types",
"gpu.matrix": "GPU Matrix Utilities", "gpu.matrix": "GPU Matrix Utilities",
"gpu.select": "GPU Select Utilities", "gpu.select": "GPU Select Utilities",
"gpu.shader": "GPU Shader Utilities", "gpu.shader": "GPU Shader Utilities",
"gpu.state": "GPU State Utilities", "gpu.state": "GPU State Utilities",
"gpu.texture": "GPU Texture Utilities", "gpu.texture": "GPU Texture Utilities",
"gpu.platform": "GPU Platform Utilities",
"gpu.capabilities": "GPU Capabilities Utilities",
"bmesh": "BMesh Module", "bmesh": "BMesh Module",
"bmesh.ops": "BMesh Operators", "bmesh.ops": "BMesh Operators",
"bmesh.types": "BMesh Types", "bmesh.types": "BMesh Types",

View File

@@ -111,5 +111,5 @@ if(WITH_MOD_FLUID)
endif() endif()
if (WITH_COMPOSITOR) if (WITH_COMPOSITOR)
add_subdirectory(smaa_areatex) add_subdirectory(smaa_areatex)
endif() endif()

View File

@@ -129,7 +129,6 @@ set(SRC
src/util/Barrier.cpp src/util/Barrier.cpp
src/util/Buffer.cpp src/util/Buffer.cpp
src/util/BufferReader.cpp src/util/BufferReader.cpp
src/util/RingBuffer.cpp
src/util/StreamBuffer.cpp src/util/StreamBuffer.cpp
src/util/ThreadPool.cpp src/util/ThreadPool.cpp
) )
@@ -153,7 +152,6 @@ set(PUBLIC_HDR
include/devices/ThreadedDevice.h include/devices/ThreadedDevice.h
include/Exception.h include/Exception.h
include/file/File.h include/file/File.h
include/file/FileInfo.h
include/file/FileManager.h include/file/FileManager.h
include/file/FileWriter.h include/file/FileWriter.h
include/file/IFileInput.h include/file/IFileInput.h
@@ -246,7 +244,6 @@ set(PUBLIC_HDR
include/util/BufferReader.h include/util/BufferReader.h
include/util/ILockable.h include/util/ILockable.h
include/util/Math3D.h include/util/Math3D.h
include/util/RingBuffer.h
include/util/StreamBuffer.h include/util/StreamBuffer.h
include/util/ThreadPool.h include/util/ThreadPool.h
) )
@@ -963,10 +960,7 @@ endif()
if(BUILD_DEMOS) if(BUILD_DEMOS)
include_directories(${INCLUDE}) include_directories(${INCLUDE})
set(DEMOS audainfo audaplay audaconvert audaremap signalgen randsounds dynamicmusic playbackmanager) set(DEMOS audaplay audaconvert audaremap signalgen randsounds dynamicmusic playbackmanager)
add_executable(audainfo demos/audainfo.cpp)
target_link_libraries(audainfo audaspace)
add_executable(audaplay demos/audaplay.cpp) add_executable(audaplay demos/audaplay.cpp)
target_link_libraries(audaplay audaspace) target_link_libraries(audaplay audaspace)

View File

@@ -39,7 +39,7 @@ extern AUD_API void AUD_PlaybackManager_free(AUD_PlaybackManager* manager);
* Plays a sound through the playback manager, adding it into a category. * Plays a sound through the playback manager, adding it into a category.
* \param manager The PlaybackManager object. * \param manager The PlaybackManager object.
* \param sound The sound to be played. * \param sound The sound to be played.
* \param catKey The key of the category into which the sound will be added. If it doesn't exist a new one will be created. * \param catKey The key of the category into which the sound will be added. If it doesn't exist a new one will be creatd.
*/ */
extern AUD_API void AUD_PlaybackManager_play(AUD_PlaybackManager* manager, AUD_Sound* sound, unsigned int catKey); extern AUD_API void AUD_PlaybackManager_play(AUD_PlaybackManager* manager, AUD_Sound* sound, unsigned int catKey);

View File

@@ -94,40 +94,6 @@ AUD_API int AUD_Sound_getLength(AUD_Sound* sound)
return (*sound)->createReader()->getLength(); return (*sound)->createReader()->getLength();
} }
AUD_API int AUD_Sound_getFileStreams(AUD_Sound* sound, AUD_StreamInfo **stream_infos)
{
assert(sound);
std::shared_ptr<File> file = std::dynamic_pointer_cast<File>(*sound);
if(file)
{
try
{
auto streams = file->queryStreams();
size_t size = sizeof(AUD_StreamInfo) * streams.size();
if(!size)
{
*stream_infos = nullptr;
return 0;
}
*stream_infos = reinterpret_cast<AUD_StreamInfo*>(std::malloc(size));
std::memcpy(*stream_infos, streams.data(), size);
return streams.size();
}
catch(Exception&)
{
}
}
*stream_infos = nullptr;
return 0;
}
AUD_API sample_t* AUD_Sound_data(AUD_Sound* sound, int* length, AUD_Specs* specs) AUD_API sample_t* AUD_Sound_data(AUD_Sound* sound, int* length, AUD_Specs* specs)
{ {
assert(sound); assert(sound);
@@ -286,12 +252,6 @@ AUD_API AUD_Sound* AUD_Sound_bufferFile(unsigned char* buffer, int size)
return new AUD_Sound(new File(buffer, size)); return new AUD_Sound(new File(buffer, size));
} }
AUD_API AUD_Sound* AUD_Sound_bufferFileStream(unsigned char* buffer, int size, int stream)
{
assert(buffer);
return new AUD_Sound(new File(buffer, size, stream));
}
AUD_API AUD_Sound* AUD_Sound_cache(AUD_Sound* sound) AUD_API AUD_Sound* AUD_Sound_cache(AUD_Sound* sound)
{ {
assert(sound); assert(sound);
@@ -312,12 +272,6 @@ AUD_API AUD_Sound* AUD_Sound_file(const char* filename)
return new AUD_Sound(new File(filename)); return new AUD_Sound(new File(filename));
} }
AUD_API AUD_Sound* AUD_Sound_fileStream(const char* filename, int stream)
{
assert(filename);
return new AUD_Sound(new File(filename, stream));
}
AUD_API AUD_Sound* AUD_Sound_sawtooth(float frequency, AUD_SampleRate rate) AUD_API AUD_Sound* AUD_Sound_sawtooth(float frequency, AUD_SampleRate rate)
{ {
return new AUD_Sound(new Sawtooth(frequency, rate)); return new AUD_Sound(new Sawtooth(frequency, rate));

View File

@@ -36,15 +36,7 @@ extern AUD_API AUD_Specs AUD_Sound_getSpecs(AUD_Sound* sound);
* \return The length of the sound in samples. * \return The length of the sound in samples.
* \note This function creates a reader from the sound and deletes it again. * \note This function creates a reader from the sound and deletes it again.
*/ */
extern AUD_API int AUD_Sound_getLength(AUD_Sound* sound); extern AUD_API int AUD_getLength(AUD_Sound* sound);
/**
* Retrieves the stream infos of a sound file.
* \param sound The sound to retrieve from which must be a file sound.
* \param infos A pointer to a AUD_StreamInfo array that will be allocated and must afterwards be freed by the caller.
* \return The number of items in the infos array.
*/
extern AUD_API int AUD_Sound_getFileStreams(AUD_Sound* sound, AUD_StreamInfo** stream_infos);
/** /**
* Reads a sound's samples into memory. * Reads a sound's samples into memory.
@@ -97,15 +89,6 @@ extern AUD_API AUD_Sound* AUD_Sound_buffer(sample_t* data, int length, AUD_Specs
*/ */
extern AUD_API AUD_Sound* AUD_Sound_bufferFile(unsigned char* buffer, int size); extern AUD_API AUD_Sound* AUD_Sound_bufferFile(unsigned char* buffer, int size);
/**
* Loads a sound file from a memory buffer.
* \param buffer The buffer which contains the sound file.
* \param size The size of the buffer.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \return A handle of the sound file.
*/
extern AUD_API AUD_Sound* AUD_Sound_bufferFileStream(unsigned char* buffer, int size, int stream);
/** /**
* Caches a sound into a memory buffer. * Caches a sound into a memory buffer.
* \param sound The sound to cache. * \param sound The sound to cache.
@@ -120,14 +103,6 @@ extern AUD_API AUD_Sound* AUD_Sound_cache(AUD_Sound* sound);
*/ */
extern AUD_API AUD_Sound* AUD_Sound_file(const char* filename); extern AUD_API AUD_Sound* AUD_Sound_file(const char* filename);
/**
* Loads a sound file.
* \param filename The filename of the sound file.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \return A handle of the sound file.
*/
extern AUD_API AUD_Sound* AUD_Sound_fileStream(const char* filename, int stream);
/** /**
* Creates a sawtooth sound. * Creates a sawtooth sound.
* \param frequency The frequency of the generated sawtooth sound. * \param frequency The frequency of the generated sawtooth sound.

View File

@@ -107,7 +107,7 @@ AUD_API AUD_SoundInfo AUD_getInfo(AUD_Sound* sound)
AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float high, AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float high,
float attack, float release, float threshold, float attack, float release, float threshold,
int accumulate, int additive, int square, int accumulate, int additive, int square,
float sthreshold, double samplerate, int* length, int stream) float sthreshold, double samplerate, int* length)
{ {
Buffer buffer; Buffer buffer;
DeviceSpecs specs; DeviceSpecs specs;
@@ -115,7 +115,7 @@ AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float high,
specs.rate = (SampleRate)samplerate; specs.rate = (SampleRate)samplerate;
std::shared_ptr<ISound> sound; std::shared_ptr<ISound> sound;
std::shared_ptr<ISound> file = std::shared_ptr<ISound>(new File(filename, stream)); std::shared_ptr<ISound> file = std::shared_ptr<ISound>(new File(filename));
int position = 0; int position = 0;
@@ -245,7 +245,7 @@ AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, int sampl
buffer[i * 3] = min; buffer[i * 3] = min;
buffer[i * 3 + 1] = max; buffer[i * 3 + 1] = max;
buffer[i * 3 + 2] = std::sqrt(power / len); buffer[i * 3 + 2] = sqrt(power) / len;
if(overallmax < max) if(overallmax < max)
overallmax = max; overallmax = max;

View File

@@ -37,7 +37,7 @@ extern AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float
float attack, float release, float threshold, float attack, float release, float threshold,
int accumulate, int additive, int square, int accumulate, int additive, int square,
float sthreshold, double samplerate, float sthreshold, double samplerate,
int* length, int stream); int* length);
/** /**
* Pauses a playing sound after a specific amount of time. * Pauses a playing sound after a specific amount of time.

View File

@@ -177,16 +177,3 @@ typedef struct
AUD_Specs specs; AUD_Specs specs;
float length; float length;
} AUD_SoundInfo; } AUD_SoundInfo;
/// Specification of a sound source.
typedef struct
{
/// Start time in seconds.
double start;
/// Duration in seconds. May be estimated or 0 if unknown.
double duration;
/// Audio data parameters.
AUD_DeviceSpecs specs;
} AUD_StreamInfo;

View File

@@ -89,11 +89,10 @@ Sound_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
self = (Sound*)type->tp_alloc(type, 0); self = (Sound*)type->tp_alloc(type, 0);
if(self != nullptr) if(self != nullptr)
{ {
static const char* kwlist[] = {"filename", "stream", nullptr}; static const char* kwlist[] = {"filename", nullptr};
const char* filename = nullptr; const char* filename = nullptr;
int stream = 0;
if(!PyArg_ParseTupleAndKeywords(args, kwds, "s|i:Sound", const_cast<char**>(kwlist), &filename, &stream)) if(!PyArg_ParseTupleAndKeywords(args, kwds, "s:Sound", const_cast<char**>(kwlist), &filename))
{ {
Py_DECREF(self); Py_DECREF(self);
return nullptr; return nullptr;
@@ -101,7 +100,7 @@ Sound_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
try try
{ {
self->sound = new std::shared_ptr<ISound>(new File(filename, stream)); self->sound = new std::shared_ptr<ISound>(new File(filename));
} }
catch(Exception& e) catch(Exception& e)
{ {
@@ -408,9 +407,8 @@ static PyObject *
Sound_file(PyTypeObject* type, PyObject* args) Sound_file(PyTypeObject* type, PyObject* args)
{ {
const char* filename = nullptr; const char* filename = nullptr;
int stream = 0;
if(!PyArg_ParseTuple(args, "s|i:file", &filename, &stream)) if(!PyArg_ParseTuple(args, "s:file", &filename))
return nullptr; return nullptr;
Sound* self; Sound* self;
@@ -420,7 +418,7 @@ Sound_file(PyTypeObject* type, PyObject* args)
{ {
try try
{ {
self->sound = new std::shared_ptr<ISound>(new File(filename, stream)); self->sound = new std::shared_ptr<ISound>(new File(filename));
} }
catch(Exception& e) catch(Exception& e)
{ {

View File

@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys import sys
import os import os

View File

@@ -23,11 +23,9 @@
*/ */
#include "ISound.h" #include "ISound.h"
#include "FileInfo.h"
#include <string> #include <string>
#include <memory> #include <memory>
#include <vector>
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
@@ -50,14 +48,6 @@ private:
*/ */
std::shared_ptr<Buffer> m_buffer; std::shared_ptr<Buffer> m_buffer;
/**
* The index of the stream within the file if it contains multiple.
* The first audio stream in the file has index 0 and the index increments by one
* for every other audio stream in the file. Other types of streams in the file
* do not count.
*/
int m_stream;
// delete copy constructor and operator= // delete copy constructor and operator=
File(const File&) = delete; File(const File&) = delete;
File& operator=(const File&) = delete; File& operator=(const File&) = delete;
@@ -67,25 +57,16 @@ public:
* Creates a new sound. * Creates a new sound.
* The file is read from the file system using the given path. * The file is read from the file system using the given path.
* \param filename The sound file path. * \param filename The sound file path.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
*/ */
File(std::string filename, int stream = 0); File(std::string filename);
/** /**
* Creates a new sound. * Creates a new sound.
* The file is read from memory using the supplied buffer. * The file is read from memory using the supplied buffer.
* \param buffer The buffer to read from. * \param buffer The buffer to read from.
* \param size The size of the buffer. * \param size The size of the buffer.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
*/ */
File(const data_t* buffer, int size, int stream = 0); File(const data_t* buffer, int size);
/**
* Queries the streams of the file.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
std::vector<StreamInfo> queryStreams();
virtual std::shared_ptr<IReader> createReader(); virtual std::shared_ptr<IReader> createReader();
}; };

View File

@@ -1,42 +0,0 @@
/*******************************************************************************
* Copyright 2009-2016 Jörg Müller
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
#pragma once
/**
* @file FileInfo.h
* @ingroup file
* The FileInfo data structures.
*/
#include "respec/Specification.h"
AUD_NAMESPACE_BEGIN
/// Specification of a sound source.
struct StreamInfo
{
/// Start time in seconds.
double start;
/// Duration in seconds. May be estimated or 0 if unknown.
double duration;
/// Audio data parameters.
DeviceSpecs specs;
};
AUD_NAMESPACE_END

View File

@@ -22,14 +22,12 @@
* The FileManager class. * The FileManager class.
*/ */
#include "FileInfo.h"
#include "respec/Specification.h" #include "respec/Specification.h"
#include "IWriter.h" #include "IWriter.h"
#include <list> #include <list>
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector>
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
@@ -68,36 +66,18 @@ public:
/** /**
* Creates a file reader for the given filename if a registed IFileInput is able to read it. * Creates a file reader for the given filename if a registed IFileInput is able to read it.
* @param filename The path to the file. * @param filename The path to the file.
* @param stream The index of the audio stream within the file if it contains multiple audio streams.
* @return The reader created. * @return The reader created.
* @exception Exception If no file input can read the file an exception is thrown. * @exception Exception If no file input can read the file an exception is thrown.
*/ */
static std::shared_ptr<IReader> createReader(std::string filename, int stream = 0); static std::shared_ptr<IReader> createReader(std::string filename);
/** /**
* Creates a file reader for the given buffer if a registed IFileInput is able to read it. * Creates a file reader for the given buffer if a registed IFileInput is able to read it.
* @param buffer The buffer to read the file from. * @param buffer The buffer to read the file from.
* @param stream The index of the audio stream within the file if it contains multiple audio streams.
* @return The reader created. * @return The reader created.
* @exception Exception If no file input can read the file an exception is thrown. * @exception Exception If no file input can read the file an exception is thrown.
*/ */
static std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0); static std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer);
/**
* Queries the streams of a sound file.
* \param filename Path to the file to be read.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
static std::vector<StreamInfo> queryStreams(std::string filename);
/**
* Queries the streams of a sound file.
* \param buffer The in-memory file buffer.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
static std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
/** /**
* Creates a file writer that writes a sound to the given file path. * Creates a file writer that writes a sound to the given file path.

View File

@@ -23,11 +23,9 @@
*/ */
#include "Audaspace.h" #include "Audaspace.h"
#include "FileInfo.h"
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector>
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
@@ -50,36 +48,18 @@ public:
/** /**
* Creates a reader for a file to be read. * Creates a reader for a file to be read.
* \param filename Path to the file to be read. * \param filename Path to the file to be read.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \return The reader that reads the file. * \return The reader that reads the file.
* \exception Exception Thrown if the file specified cannot be read. * \exception Exception Thrown if the file specified cannot be read.
*/ */
virtual std::shared_ptr<IReader> createReader(std::string filename, int stream = 0)=0; virtual std::shared_ptr<IReader> createReader(std::string filename)=0;
/** /**
* Creates a reader for a file to be read from memory. * Creates a reader for a file to be read from memory.
* \param buffer The in-memory file buffer. * \param buffer The in-memory file buffer.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \return The reader that reads the file. * \return The reader that reads the file.
* \exception Exception Thrown if the file specified cannot be read. * \exception Exception Thrown if the file specified cannot be read.
*/ */
virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0)=0; virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer)=0;
/**
* Queries the streams of a sound file.
* \param filename Path to the file to be read.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
virtual std::vector<StreamInfo> queryStreams(std::string filename)=0;
/**
* Queries the streams of a sound file.
* \param buffer The in-memory file buffer.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
virtual std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer)=0;
}; };
AUD_NAMESPACE_END AUD_NAMESPACE_END

View File

@@ -1,97 +0,0 @@
/*******************************************************************************
* Copyright 2009-2021 Jörg Müller
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
#pragma once
/**
* @file RingBuffer.h
* @ingroup util
* The RingBuffer class.
*/
#include "Audaspace.h"
#include "Buffer.h"
#include <cstddef>
AUD_NAMESPACE_BEGIN
/**
* This class is a simple ring buffer in RAM which is 32 Byte aligned and provides
* functionality for concurrent reading and writting without locks.
*/
class AUD_API RingBuffer
{
private:
/// The buffer storing the actual data.
Buffer m_buffer;
/// The reading pointer.
volatile size_t m_read;
/// The writing pointer.
volatile size_t m_write;
// delete copy constructor and operator=
RingBuffer(const RingBuffer&) = delete;
RingBuffer& operator=(const RingBuffer&) = delete;
public:
/**
* Creates a new ring buffer.
* \param size The size of the buffer in bytes.
*/
RingBuffer(int size = 0);
/**
* Returns the pointer to the ring buffer in memory.
*/
sample_t* getBuffer() const;
/**
* Returns the size of the ring buffer in bytes.
*/
int getSize() const;
size_t getReadSize() const;
size_t getWriteSize() const;
size_t read(data_t* target, size_t size);
size_t write(data_t* source, size_t size);
/**
* Resets the ring buffer to a state where nothing has been written or read.
*/
void reset();
/**
* Resizes the ring buffer.
* \param size The new size of the ring buffer, measured in bytes.
*/
void resize(int size);
/**
* Makes sure the ring buffer has a minimum size.
* If size is >= current size, nothing will happen.
* Otherwise the ring buffer is resized with keep as parameter.
* \param size The new minimum size of the ring buffer, measured in bytes.
*/
void assureSize(int size);
};
AUD_NAMESPACE_END

View File

@@ -35,24 +35,14 @@ void FFMPEG::registerPlugin()
FileManager::registerOutput(plugin); FileManager::registerOutput(plugin);
} }
std::shared_ptr<IReader> FFMPEG::createReader(std::string filename, int stream) std::shared_ptr<IReader> FFMPEG::createReader(std::string filename)
{ {
return std::shared_ptr<IReader>(new FFMPEGReader(filename, stream)); return std::shared_ptr<IReader>(new FFMPEGReader(filename));
} }
std::shared_ptr<IReader> FFMPEG::createReader(std::shared_ptr<Buffer> buffer, int stream) std::shared_ptr<IReader> FFMPEG::createReader(std::shared_ptr<Buffer> buffer)
{ {
return std::shared_ptr<IReader>(new FFMPEGReader(buffer, stream)); return std::shared_ptr<IReader>(new FFMPEGReader(buffer));
}
std::vector<StreamInfo> FFMPEG::queryStreams(std::string filename)
{
return FFMPEGReader(filename).queryStreams();
}
std::vector<StreamInfo> FFMPEG::queryStreams(std::shared_ptr<Buffer> buffer)
{
return FFMPEGReader(buffer).queryStreams();
} }
std::shared_ptr<IWriter> FFMPEG::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate) std::shared_ptr<IWriter> FFMPEG::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)

View File

@@ -52,10 +52,8 @@ public:
*/ */
static void registerPlugin(); static void registerPlugin();
virtual std::shared_ptr<IReader> createReader(std::string filename, int stream = 0); virtual std::shared_ptr<IReader> createReader(std::string filename);
virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0); virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer);
virtual std::vector<StreamInfo> queryStreams(std::string filename);
virtual std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate); virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
}; };

View File

@@ -31,25 +31,6 @@ AUD_NAMESPACE_BEGIN
#define FFMPEG_OLD_CODE #define FFMPEG_OLD_CODE
#endif #endif
SampleFormat FFMPEGReader::convertSampleFormat(AVSampleFormat format)
{
switch(av_get_packed_sample_fmt(format))
{
case AV_SAMPLE_FMT_U8:
return FORMAT_U8;
case AV_SAMPLE_FMT_S16:
return FORMAT_S16;
case AV_SAMPLE_FMT_S32:
return FORMAT_S32;
case AV_SAMPLE_FMT_FLT:
return FORMAT_FLOAT32;
case AV_SAMPLE_FMT_DBL:
return FORMAT_FLOAT64;
default:
AUD_THROW(FileException, "FFMPEG sample format unknown.");
}
}
int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer) int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
{ {
int buf_size = buffer.getSize(); int buf_size = buffer.getSize();
@@ -142,7 +123,7 @@ int FFMPEGReader::decode(AVPacket& packet, Buffer& buffer)
return buf_pos; return buf_pos;
} }
void FFMPEGReader::init(int stream) void FFMPEGReader::init()
{ {
m_position = 0; m_position = 0;
m_pkgbuf_left = 0; m_pkgbuf_left = 0;
@@ -162,13 +143,8 @@ void FFMPEGReader::init(int stream)
#endif #endif
&& (m_stream < 0)) && (m_stream < 0))
{ {
if(stream == 0) m_stream=i;
{ break;
m_stream=i;
break;
}
else
stream--;
} }
} }
@@ -239,7 +215,7 @@ void FFMPEGReader::init(int stream)
m_specs.rate = (SampleRate) m_codecCtx->sample_rate; m_specs.rate = (SampleRate) m_codecCtx->sample_rate;
} }
FFMPEGReader::FFMPEGReader(std::string filename, int stream) : FFMPEGReader::FFMPEGReader(std::string filename) :
m_pkgbuf(), m_pkgbuf(),
m_formatCtx(nullptr), m_formatCtx(nullptr),
m_codecCtx(nullptr), m_codecCtx(nullptr),
@@ -253,7 +229,7 @@ FFMPEGReader::FFMPEGReader(std::string filename, int stream) :
try try
{ {
init(stream); init();
} }
catch(Exception&) catch(Exception&)
{ {
@@ -262,7 +238,7 @@ FFMPEGReader::FFMPEGReader(std::string filename, int stream) :
} }
} }
FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer, int stream) : FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer) :
m_pkgbuf(), m_pkgbuf(),
m_codecCtx(nullptr), m_codecCtx(nullptr),
m_frame(nullptr), m_frame(nullptr),
@@ -289,7 +265,7 @@ FFMPEGReader::FFMPEGReader(std::shared_ptr<Buffer> buffer, int stream) :
try try
{ {
init(stream); init();
} }
catch(Exception&) catch(Exception&)
{ {
@@ -312,51 +288,6 @@ FFMPEGReader::~FFMPEGReader()
avformat_close_input(&m_formatCtx); avformat_close_input(&m_formatCtx);
} }
std::vector<StreamInfo> FFMPEGReader::queryStreams()
{
std::vector<StreamInfo> result;
for(unsigned int i = 0; i < m_formatCtx->nb_streams; i++)
{
#ifdef FFMPEG_OLD_CODE
if(m_formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
#else
if(m_formatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
#endif
{
StreamInfo info;
double time_base = av_q2d(m_formatCtx->streams[i]->time_base);
if(m_formatCtx->streams[i]->start_time != AV_NOPTS_VALUE)
info.start = m_formatCtx->streams[i]->start_time * time_base;
else
info.start = 0;
if(m_formatCtx->streams[i]->duration != AV_NOPTS_VALUE)
info.duration = m_formatCtx->streams[i]->duration * time_base;
else if(m_formatCtx->duration != AV_NOPTS_VALUE)
info.duration = double(m_formatCtx->duration) / AV_TIME_BASE - info.start;
else
info.duration = 0;
#ifdef FFMPEG_OLD_CODE
info.specs.channels = Channels(m_formatCtx->streams[i]->codec->channels);
info.specs.rate = m_formatCtx->streams[i]->codec->sample_rate;
info.specs.format = convertSampleFormat(m_formatCtx->streams[i]->codec->sample_fmt);
#else
info.specs.channels = Channels(m_formatCtx->streams[i]->codecpar->channels);
info.specs.rate = m_formatCtx->streams[i]->codecpar->sample_rate;
info.specs.format = convertSampleFormat(AVSampleFormat(m_formatCtx->streams[i]->codecpar->format));
#endif
result.emplace_back(info);
}
}
return result;
}
int FFMPEGReader::read_packet(void* opaque, uint8_t* buf, int buf_size) int FFMPEGReader::read_packet(void* opaque, uint8_t* buf, int buf_size)
{ {
FFMPEGReader* reader = reinterpret_cast<FFMPEGReader*>(opaque); FFMPEGReader* reader = reinterpret_cast<FFMPEGReader*>(opaque);
@@ -407,16 +338,22 @@ void FFMPEGReader::seek(int position)
{ {
if(position >= 0) if(position >= 0)
{ {
double pts_time_base = av_q2d(m_formatCtx->streams[m_stream]->time_base); uint64_t st_time = m_formatCtx->start_time;
uint64_t seek_pos = ((uint64_t)position) * ((uint64_t)AV_TIME_BASE) / ((uint64_t)m_specs.rate);
uint64_t st_time = m_formatCtx->streams[m_stream]->start_time; if(st_time != AV_NOPTS_VALUE) {
uint64_t seek_pos = (uint64_t)(position / (pts_time_base * m_specs.rate));
if(st_time != AV_NOPTS_VALUE)
seek_pos += st_time; seek_pos += st_time;
}
double pts_time_base =
av_q2d(m_formatCtx->streams[m_stream]->time_base);
uint64_t pts_st_time =
((st_time != AV_NOPTS_VALUE) ? st_time : 0)
/ pts_time_base / (uint64_t) AV_TIME_BASE;
// a value < 0 tells us that seeking failed // a value < 0 tells us that seeking failed
if(av_seek_frame(m_formatCtx, m_stream, seek_pos, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0) if(av_seek_frame(m_formatCtx, -1, seek_pos,
AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >= 0)
{ {
avcodec_flush_buffers(m_codecCtx); avcodec_flush_buffers(m_codecCtx);
m_position = position; m_position = position;
@@ -437,7 +374,7 @@ void FFMPEGReader::seek(int position)
if(packet.pts != AV_NOPTS_VALUE) if(packet.pts != AV_NOPTS_VALUE)
{ {
// calculate real position, and read to frame! // calculate real position, and read to frame!
m_position = (packet.pts - (st_time != AV_NOPTS_VALUE ? st_time : 0)) * pts_time_base * m_specs.rate; m_position = (packet.pts - pts_st_time) * pts_time_base * m_specs.rate;
if(m_position < position) if(m_position < position)
{ {
@@ -467,25 +404,9 @@ void FFMPEGReader::seek(int position)
int FFMPEGReader::getLength() const int FFMPEGReader::getLength() const
{ {
auto stream = m_formatCtx->streams[m_stream];
double time_base = av_q2d(stream->time_base);
double duration;
if(stream->duration != AV_NOPTS_VALUE)
duration = stream->duration * time_base;
else if(m_formatCtx->duration != AV_NOPTS_VALUE)
{
duration = float(m_formatCtx->duration) / AV_TIME_BASE;
if(stream->start_time != AV_NOPTS_VALUE)
duration -= stream->start_time * time_base;
}
else
duration = -1;
// return approximated remaning size // return approximated remaning size
return (int)(duration * m_codecCtx->sample_rate) - m_position; return (int)((m_formatCtx->duration * m_codecCtx->sample_rate)
/ AV_TIME_BASE)-m_position;
} }
int FFMPEGReader::getPosition() const int FFMPEGReader::getPosition() const

View File

@@ -29,11 +29,9 @@
#include "respec/ConverterFunctions.h" #include "respec/ConverterFunctions.h"
#include "IReader.h" #include "IReader.h"
#include "util/Buffer.h" #include "util/Buffer.h"
#include "file/FileInfo.h"
#include <string> #include <string>
#include <memory> #include <memory>
#include <vector>
struct AVCodecContext; struct AVCodecContext;
extern "C" { extern "C" {
@@ -121,13 +119,6 @@ private:
*/ */
bool m_tointerleave; bool m_tointerleave;
/**
* Converts an ffmpeg sample format to an audaspace one.
* \param format The AVSampleFormat sample format.
* \return The sample format as SampleFormat.
*/
AUD_LOCAL static SampleFormat convertSampleFormat(AVSampleFormat format);
/** /**
* Decodes a packet into the given buffer. * Decodes a packet into the given buffer.
* \param packet The AVPacket to decode. * \param packet The AVPacket to decode.
@@ -138,9 +129,8 @@ private:
/** /**
* Initializes the object. * Initializes the object.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
*/ */
AUD_LOCAL void init(int stream); AUD_LOCAL void init();
// delete copy constructor and operator= // delete copy constructor and operator=
FFMPEGReader(const FFMPEGReader&) = delete; FFMPEGReader(const FFMPEGReader&) = delete;
@@ -150,33 +140,24 @@ public:
/** /**
* Creates a new reader. * Creates a new reader.
* \param filename The path to the file to be read. * \param filename The path to the file to be read.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \exception Exception Thrown if the file specified does not exist or * \exception Exception Thrown if the file specified does not exist or
* cannot be read with ffmpeg. * cannot be read with ffmpeg.
*/ */
FFMPEGReader(std::string filename, int stream = 0); FFMPEGReader(std::string filename);
/** /**
* Creates a new reader. * Creates a new reader.
* \param buffer The buffer to read from. * \param buffer The buffer to read from.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \exception Exception Thrown if the buffer specified cannot be read * \exception Exception Thrown if the buffer specified cannot be read
* with ffmpeg. * with ffmpeg.
*/ */
FFMPEGReader(std::shared_ptr<Buffer> buffer, int stream = 0); FFMPEGReader(std::shared_ptr<Buffer> buffer);
/** /**
* Destroys the reader and closes the file. * Destroys the reader and closes the file.
*/ */
virtual ~FFMPEGReader(); virtual ~FFMPEGReader();
/**
* Queries the streams of a sound file.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
virtual std::vector<StreamInfo> queryStreams();
/** /**
* Reads data to a memory buffer. * Reads data to a memory buffer.
* This function is used for avio only. * This function is used for avio only.

View File

@@ -32,26 +32,16 @@ void SndFile::registerPlugin()
FileManager::registerOutput(plugin); FileManager::registerOutput(plugin);
} }
std::shared_ptr<IReader> SndFile::createReader(std::string filename, int stream) std::shared_ptr<IReader> SndFile::createReader(std::string filename)
{ {
return std::shared_ptr<IReader>(new SndFileReader(filename)); return std::shared_ptr<IReader>(new SndFileReader(filename));
} }
std::shared_ptr<IReader> SndFile::createReader(std::shared_ptr<Buffer> buffer, int stream) std::shared_ptr<IReader> SndFile::createReader(std::shared_ptr<Buffer> buffer)
{ {
return std::shared_ptr<IReader>(new SndFileReader(buffer)); return std::shared_ptr<IReader>(new SndFileReader(buffer));
} }
std::vector<StreamInfo> SndFile::queryStreams(std::string filename)
{
return SndFileReader(filename).queryStreams();
}
std::vector<StreamInfo> SndFile::queryStreams(std::shared_ptr<Buffer> buffer)
{
return SndFileReader(buffer).queryStreams();
}
std::shared_ptr<IWriter> SndFile::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate) std::shared_ptr<IWriter> SndFile::createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
{ {
return std::shared_ptr<IWriter>(new SndFileWriter(filename, specs, format, codec, bitrate)); return std::shared_ptr<IWriter>(new SndFileWriter(filename, specs, format, codec, bitrate));

View File

@@ -52,10 +52,8 @@ public:
*/ */
static void registerPlugin(); static void registerPlugin();
virtual std::shared_ptr<IReader> createReader(std::string filename, int stream = 0); virtual std::shared_ptr<IReader> createReader(std::string filename);
virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer, int stream = 0); virtual std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer);
virtual std::vector<StreamInfo> queryStreams(std::string filename);
virtual std::vector<StreamInfo> queryStreams(std::shared_ptr<Buffer> buffer);
virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate); virtual std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
}; };

View File

@@ -118,21 +118,6 @@ SndFileReader::~SndFileReader()
sf_close(m_sndfile); sf_close(m_sndfile);
} }
std::vector<StreamInfo> SndFileReader::queryStreams()
{
std::vector<StreamInfo> result;
StreamInfo info;
info.start = 0;
info.duration = double(getLength()) / m_specs.rate;
info.specs.specs = m_specs;
info.specs.format = FORMAT_FLOAT32;
result.emplace_back(info);
return result;
}
bool SndFileReader::isSeekable() const bool SndFileReader::isSeekable() const
{ {
return m_seekable; return m_seekable;

View File

@@ -28,12 +28,9 @@
* The SndFileReader class. * The SndFileReader class.
*/ */
#include "file/FileInfo.h"
#include <string> #include <string>
#include <sndfile.h> #include <sndfile.h>
#include <memory> #include <memory>
#include <vector>
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
@@ -99,7 +96,6 @@ public:
/** /**
* Creates a new reader. * Creates a new reader.
* \param filename The path to the file to be read. * \param filename The path to the file to be read.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \exception Exception Thrown if the file specified does not exist or * \exception Exception Thrown if the file specified does not exist or
* cannot be read with libsndfile. * cannot be read with libsndfile.
*/ */
@@ -108,7 +104,6 @@ public:
/** /**
* Creates a new reader. * Creates a new reader.
* \param buffer The buffer to read from. * \param buffer The buffer to read from.
* \param stream The index of the audio stream within the file if it contains multiple audio streams.
* \exception Exception Thrown if the buffer specified cannot be read * \exception Exception Thrown if the buffer specified cannot be read
* with libsndfile. * with libsndfile.
*/ */
@@ -119,13 +114,6 @@ public:
*/ */
virtual ~SndFileReader(); virtual ~SndFileReader();
/**
* Queries the streams of a sound file.
* \return A vector with as many streams as there are in the file.
* \exception Exception Thrown if the file specified cannot be read.
*/
virtual std::vector<StreamInfo> queryStreams();
virtual bool isSeekable() const; virtual bool isSeekable() const;
virtual void seek(int position); virtual void seek(int position);
virtual int getLength() const; virtual int getLength() const;

View File

@@ -23,121 +23,89 @@
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
PulseAudioDevice::PulseAudioSynchronizer::PulseAudioSynchronizer(PulseAudioDevice *device) :
m_device(device)
{
}
double PulseAudioDevice::PulseAudioSynchronizer::getPosition(std::shared_ptr<IHandle> handle)
{
pa_usec_t latency;
int negative;
AUD_pa_stream_get_latency(m_device->m_stream, &latency, &negative);
double delay = m_device->m_ring_buffer.getReadSize() / (AUD_SAMPLE_SIZE(m_device->m_specs) * m_device->m_specs.rate) + latency * 1.0e-6;
return handle->getPosition() - delay;
}
void PulseAudioDevice::updateRingBuffer()
{
unsigned int samplesize = AUD_SAMPLE_SIZE(m_specs);
std::unique_lock<std::mutex> lock(m_mixingLock);
Buffer buffer;
while(m_valid)
{
size_t size = m_ring_buffer.getWriteSize();
size_t sample_count = size / samplesize;
if(sample_count > 0)
{
size = sample_count * samplesize;
buffer.assureSize(size);
mix(reinterpret_cast<data_t*>(buffer.getBuffer()), sample_count);
m_ring_buffer.write(reinterpret_cast<data_t*>(buffer.getBuffer()), size);
}
m_mixingCondition.wait(lock);
}
}
void PulseAudioDevice::PulseAudio_state_callback(pa_context *context, void *data) void PulseAudioDevice::PulseAudio_state_callback(pa_context *context, void *data)
{ {
PulseAudioDevice* device = (PulseAudioDevice*)data; PulseAudioDevice* device = (PulseAudioDevice*)data;
device->m_state = AUD_pa_context_get_state(context); std::lock_guard<ILockable> lock(*device);
AUD_pa_threaded_mainloop_signal(device->m_mainloop, 0); device->m_state = AUD_pa_context_get_state(context);
} }
void PulseAudioDevice::PulseAudio_request(pa_stream *stream, size_t total_bytes, void *data) void PulseAudioDevice::PulseAudio_request(pa_stream *stream, size_t num_bytes, void *data)
{ {
PulseAudioDevice* device = (PulseAudioDevice*)data; PulseAudioDevice* device = (PulseAudioDevice*)data;
data_t* buffer; void* buffer;
size_t sample_size = AUD_DEVICE_SAMPLE_SIZE(device->m_specs); AUD_pa_stream_begin_write(stream, &buffer, &num_bytes);
while(total_bytes > 0) device->mix((data_t*)buffer, num_bytes / AUD_DEVICE_SAMPLE_SIZE(device->m_specs));
AUD_pa_stream_write(stream, buffer, num_bytes, nullptr, 0, PA_SEEK_RELATIVE);
}
void PulseAudioDevice::PulseAudio_underflow(pa_stream *stream, void *data)
{
PulseAudioDevice* device = (PulseAudioDevice*)data;
DeviceSpecs specs = device->getSpecs();
if(++device->m_underflows > 4 && device->m_buffersize < AUD_DEVICE_SAMPLE_SIZE(specs) * specs.rate * 2)
{ {
size_t num_bytes = total_bytes; device->m_buffersize <<= 1;
device->m_underflows = 0;
AUD_pa_stream_begin_write(stream, reinterpret_cast<void**>(&buffer), &num_bytes); pa_buffer_attr buffer_attr;
size_t readsamples = device->m_ring_buffer.getReadSize(); buffer_attr.fragsize = -1U;
buffer_attr.maxlength = -1U;
buffer_attr.minreq = -1U;
buffer_attr.prebuf = -1U;
buffer_attr.tlength = device->m_buffersize;
readsamples = std::min(readsamples, size_t(num_bytes)) / sample_size; AUD_pa_stream_set_buffer_attr(stream, &buffer_attr, nullptr, nullptr);
device->m_ring_buffer.read(buffer, readsamples * sample_size);
if(readsamples * sample_size < num_bytes)
std::memset(buffer + readsamples * sample_size, 0, num_bytes - readsamples * sample_size);
if(device->m_mixingLock.try_lock())
{
device->m_mixingCondition.notify_all();
device->m_mixingLock.unlock();
}
AUD_pa_stream_write(stream, reinterpret_cast<void*>(buffer), num_bytes, nullptr, 0, PA_SEEK_RELATIVE);
total_bytes -= num_bytes;
} }
} }
void PulseAudioDevice::playing(bool playing) void PulseAudioDevice::runMixingThread()
{ {
m_playback = playing; for(;;)
{
{
std::lock_guard<ILockable> lock(*this);
AUD_pa_threaded_mainloop_lock(m_mainloop); if(shouldStop())
AUD_pa_stream_cork(m_stream, playing ? 0 : 1, nullptr, nullptr); {
AUD_pa_threaded_mainloop_unlock(m_mainloop); AUD_pa_stream_cork(m_stream, 1, nullptr, nullptr);
AUD_pa_stream_flush(m_stream, nullptr, nullptr);
doStop();
return;
}
}
if(AUD_pa_stream_is_corked(m_stream))
AUD_pa_stream_cork(m_stream, 0, nullptr, nullptr);
// similar to AUD_pa_mainloop_iterate(m_mainloop, false, nullptr); except with a longer timeout
AUD_pa_mainloop_prepare(m_mainloop, 1 << 14);
AUD_pa_mainloop_poll(m_mainloop);
AUD_pa_mainloop_dispatch(m_mainloop);
}
} }
PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buffersize) : PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buffersize) :
m_synchronizer(this),
m_playback(false),
m_state(PA_CONTEXT_UNCONNECTED), m_state(PA_CONTEXT_UNCONNECTED),
m_valid(true), m_buffersize(buffersize),
m_underflows(0) m_underflows(0)
{ {
m_mainloop = AUD_pa_threaded_mainloop_new(); m_mainloop = AUD_pa_mainloop_new();
AUD_pa_threaded_mainloop_lock(m_mainloop); m_context = AUD_pa_context_new(AUD_pa_mainloop_get_api(m_mainloop), name.c_str());
m_context = AUD_pa_context_new(AUD_pa_threaded_mainloop_get_api(m_mainloop), name.c_str());
if(!m_context) if(!m_context)
{ {
AUD_pa_threaded_mainloop_unlock(m_mainloop); AUD_pa_mainloop_free(m_mainloop);
AUD_pa_threaded_mainloop_free(m_mainloop);
AUD_THROW(DeviceException, "Could not connect to PulseAudio."); AUD_THROW(DeviceException, "Could not connect to PulseAudio.");
} }
@@ -146,26 +114,21 @@ PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buff
AUD_pa_context_connect(m_context, nullptr, PA_CONTEXT_NOFLAGS, nullptr); AUD_pa_context_connect(m_context, nullptr, PA_CONTEXT_NOFLAGS, nullptr);
AUD_pa_threaded_mainloop_start(m_mainloop);
while(m_state != PA_CONTEXT_READY) while(m_state != PA_CONTEXT_READY)
{ {
switch(m_state) switch(m_state)
{ {
case PA_CONTEXT_FAILED: case PA_CONTEXT_FAILED:
case PA_CONTEXT_TERMINATED: case PA_CONTEXT_TERMINATED:
AUD_pa_threaded_mainloop_unlock(m_mainloop);
AUD_pa_threaded_mainloop_stop(m_mainloop);
AUD_pa_context_disconnect(m_context); AUD_pa_context_disconnect(m_context);
AUD_pa_context_unref(m_context); AUD_pa_context_unref(m_context);
AUD_pa_threaded_mainloop_free(m_mainloop); AUD_pa_mainloop_free(m_mainloop);
AUD_THROW(DeviceException, "Could not connect to PulseAudio."); AUD_THROW(DeviceException, "Could not connect to PulseAudio.");
break; break;
default: default:
AUD_pa_threaded_mainloop_wait(m_mainloop); AUD_pa_mainloop_iterate(m_mainloop, true, nullptr);
break; break;
} }
} }
@@ -213,21 +176,16 @@ PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buff
if(!m_stream) if(!m_stream)
{ {
AUD_pa_threaded_mainloop_unlock(m_mainloop);
AUD_pa_threaded_mainloop_stop(m_mainloop);
AUD_pa_context_disconnect(m_context); AUD_pa_context_disconnect(m_context);
AUD_pa_context_unref(m_context); AUD_pa_context_unref(m_context);
AUD_pa_threaded_mainloop_free(m_mainloop); AUD_pa_mainloop_free(m_mainloop);
AUD_THROW(DeviceException, "Could not create PulseAudio stream."); AUD_THROW(DeviceException, "Could not create PulseAudio stream.");
} }
AUD_pa_stream_set_write_callback(m_stream, PulseAudio_request, this); AUD_pa_stream_set_write_callback(m_stream, PulseAudio_request, this);
AUD_pa_stream_set_underflow_callback(m_stream, PulseAudio_underflow, this);
buffersize *= AUD_DEVICE_SAMPLE_SIZE(m_specs);
m_buffersize = buffersize;
pa_buffer_attr buffer_attr; pa_buffer_attr buffer_attr;
@@ -237,53 +195,31 @@ PulseAudioDevice::PulseAudioDevice(std::string name, DeviceSpecs specs, int buff
buffer_attr.prebuf = -1U; buffer_attr.prebuf = -1U;
buffer_attr.tlength = buffersize; buffer_attr.tlength = buffersize;
m_ring_buffer.resize(buffersize); if(AUD_pa_stream_connect_playback(m_stream, nullptr, &buffer_attr, static_cast<pa_stream_flags_t>(PA_STREAM_START_CORKED | PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE), nullptr, nullptr) < 0)
if(AUD_pa_stream_connect_playback(m_stream, nullptr, &buffer_attr, static_cast<pa_stream_flags_t>(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE), nullptr, nullptr) < 0)
{ {
AUD_pa_threaded_mainloop_unlock(m_mainloop);
AUD_pa_threaded_mainloop_stop(m_mainloop);
AUD_pa_context_disconnect(m_context); AUD_pa_context_disconnect(m_context);
AUD_pa_context_unref(m_context); AUD_pa_context_unref(m_context);
AUD_pa_threaded_mainloop_free(m_mainloop); AUD_pa_mainloop_free(m_mainloop);
AUD_THROW(DeviceException, "Could not connect PulseAudio stream."); AUD_THROW(DeviceException, "Could not connect PulseAudio stream.");
} }
AUD_pa_threaded_mainloop_unlock(m_mainloop);
create(); create();
m_mixingThread = std::thread(&PulseAudioDevice::updateRingBuffer, this);
} }
PulseAudioDevice::~PulseAudioDevice() PulseAudioDevice::~PulseAudioDevice()
{ {
m_valid = false; stopMixingThread();
m_mixingLock.lock();
m_mixingCondition.notify_all();
m_mixingLock.unlock();
m_mixingThread.join();
AUD_pa_threaded_mainloop_stop(m_mainloop);
AUD_pa_context_disconnect(m_context); AUD_pa_context_disconnect(m_context);
AUD_pa_context_unref(m_context); AUD_pa_context_unref(m_context);
AUD_pa_threaded_mainloop_free(m_mainloop); AUD_pa_mainloop_free(m_mainloop);
destroy(); destroy();
} }
ISynchronizer *PulseAudioDevice::getSynchronizer()
{
return &m_synchronizer;
}
class PulseAudioDeviceFactory : public IDeviceFactory class PulseAudioDeviceFactory : public IDeviceFactory
{ {
private: private:

View File

@@ -26,11 +26,7 @@
* The PulseAudioDevice class. * The PulseAudioDevice class.
*/ */
#include "devices/SoftwareDevice.h" #include "devices/ThreadedDevice.h"
#include "util/RingBuffer.h"
#include <condition_variable>
#include <thread>
#include <pulse/pulseaudio.h> #include <pulse/pulseaudio.h>
@@ -39,65 +35,17 @@ AUD_NAMESPACE_BEGIN
/** /**
* This device plays back through PulseAudio, the simple direct media layer. * This device plays back through PulseAudio, the simple direct media layer.
*/ */
class AUD_PLUGIN_API PulseAudioDevice : public SoftwareDevice class AUD_PLUGIN_API PulseAudioDevice : public ThreadedDevice
{ {
private: private:
class PulseAudioSynchronizer : public DefaultSynchronizer pa_mainloop* m_mainloop;
{
PulseAudioDevice* m_device;
public:
PulseAudioSynchronizer(PulseAudioDevice* device);
virtual double getPosition(std::shared_ptr<IHandle> handle);
};
/// Synchronizer.
PulseAudioSynchronizer m_synchronizer;
/**
* Whether there is currently playback.
*/
volatile bool m_playback;
pa_threaded_mainloop* m_mainloop;
pa_context* m_context; pa_context* m_context;
pa_stream* m_stream; pa_stream* m_stream;
pa_context_state_t m_state; pa_context_state_t m_state;
/**
* The mixing ring buffer.
*/
RingBuffer m_ring_buffer;
/**
* Whether the device is valid.
*/
bool m_valid;
int m_buffersize; int m_buffersize;
uint32_t m_underflows; uint32_t m_underflows;
/**
* The mixing thread.
*/
std::thread m_mixingThread;
/**
* Mutex for mixing.
*/
std::mutex m_mixingLock;
/**
* Condition for mixing.
*/
std::condition_variable m_mixingCondition;
/**
* Updates the ring buffer.
*/
AUD_LOCAL void updateRingBuffer();
/** /**
* Reports the state of the PulseAudio server connection. * Reports the state of the PulseAudio server connection.
* \param context The PulseAudio context. * \param context The PulseAudio context.
@@ -111,15 +59,25 @@ private:
* \param num_bytes The length in bytes to be supplied. * \param num_bytes The length in bytes to be supplied.
* \param data The PulseAudio device. * \param data The PulseAudio device.
*/ */
AUD_LOCAL static void PulseAudio_request(pa_stream* stream, size_t total_bytes, void* data); AUD_LOCAL static void PulseAudio_request(pa_stream* stream, size_t num_bytes, void* data);
/**
* Reports an underflow from the PulseAudio server.
* Automatically adjusts the latency if this happens too often.
* @param stream The PulseAudio stream.
* \param data The PulseAudio device.
*/
AUD_LOCAL static void PulseAudio_underflow(pa_stream* stream, void* data);
/**
* Streaming thread main function.
*/
AUD_LOCAL void runMixingThread();
// delete copy constructor and operator= // delete copy constructor and operator=
PulseAudioDevice(const PulseAudioDevice&) = delete; PulseAudioDevice(const PulseAudioDevice&) = delete;
PulseAudioDevice& operator=(const PulseAudioDevice&) = delete; PulseAudioDevice& operator=(const PulseAudioDevice&) = delete;
protected:
virtual void playing(bool playing);
public: public:
/** /**
* Opens the PulseAudio audio device for playback. * Opens the PulseAudio audio device for playback.
@@ -135,8 +93,6 @@ public:
*/ */
virtual ~PulseAudioDevice(); virtual ~PulseAudioDevice();
virtual ISynchronizer* getSynchronizer();
/** /**
* Registers this plugin. * Registers this plugin.
*/ */

View File

@@ -25,7 +25,6 @@ PULSEAUDIO_SYMBOL(pa_stream_begin_write);
PULSEAUDIO_SYMBOL(pa_stream_connect_playback); PULSEAUDIO_SYMBOL(pa_stream_connect_playback);
PULSEAUDIO_SYMBOL(pa_stream_cork); PULSEAUDIO_SYMBOL(pa_stream_cork);
PULSEAUDIO_SYMBOL(pa_stream_flush); PULSEAUDIO_SYMBOL(pa_stream_flush);
PULSEAUDIO_SYMBOL(pa_stream_get_latency);
PULSEAUDIO_SYMBOL(pa_stream_is_corked); PULSEAUDIO_SYMBOL(pa_stream_is_corked);
PULSEAUDIO_SYMBOL(pa_stream_new); PULSEAUDIO_SYMBOL(pa_stream_new);
PULSEAUDIO_SYMBOL(pa_stream_set_buffer_attr); PULSEAUDIO_SYMBOL(pa_stream_set_buffer_attr);
@@ -40,13 +39,3 @@ PULSEAUDIO_SYMBOL(pa_mainloop_iterate);
PULSEAUDIO_SYMBOL(pa_mainloop_prepare); PULSEAUDIO_SYMBOL(pa_mainloop_prepare);
PULSEAUDIO_SYMBOL(pa_mainloop_poll); PULSEAUDIO_SYMBOL(pa_mainloop_poll);
PULSEAUDIO_SYMBOL(pa_mainloop_dispatch); PULSEAUDIO_SYMBOL(pa_mainloop_dispatch);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_free);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_get_api);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_lock);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_new);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_signal);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_start);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_stop);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_unlock);
PULSEAUDIO_SYMBOL(pa_threaded_mainloop_wait);

View File

@@ -23,31 +23,23 @@
AUD_NAMESPACE_BEGIN AUD_NAMESPACE_BEGIN
File::File(std::string filename, int stream) : File::File(std::string filename) :
m_filename(filename), m_stream(stream) m_filename(filename)
{ {
} }
File::File(const data_t* buffer, int size, int stream) : File::File(const data_t* buffer, int size) :
m_buffer(new Buffer(size)), m_stream(stream) m_buffer(new Buffer(size))
{ {
std::memcpy(m_buffer->getBuffer(), buffer, size); std::memcpy(m_buffer->getBuffer(), buffer, size);
} }
std::vector<StreamInfo> File::queryStreams()
{
if(m_buffer.get())
return FileManager::queryStreams(m_buffer);
else
return FileManager::queryStreams(m_filename);
}
std::shared_ptr<IReader> File::createReader() std::shared_ptr<IReader> File::createReader()
{ {
if(m_buffer.get()) if(m_buffer.get())
return FileManager::createReader(m_buffer, m_stream); return FileManager::createReader(m_buffer);
else else
return FileManager::createReader(m_filename, m_stream); return FileManager::createReader(m_filename);
} }
AUD_NAMESPACE_END AUD_NAMESPACE_END

View File

@@ -43,13 +43,13 @@ void FileManager::registerOutput(std::shared_ptr<aud::IFileOutput> output)
outputs().push_back(output); outputs().push_back(output);
} }
std::shared_ptr<IReader> FileManager::createReader(std::string filename, int stream) std::shared_ptr<IReader> FileManager::createReader(std::string filename)
{ {
for(std::shared_ptr<IFileInput> input : inputs()) for(std::shared_ptr<IFileInput> input : inputs())
{ {
try try
{ {
return input->createReader(filename, stream); return input->createReader(filename);
} }
catch(Exception&) {} catch(Exception&) {}
} }
@@ -57,41 +57,13 @@ std::shared_ptr<IReader> FileManager::createReader(std::string filename, int str
AUD_THROW(FileException, "The file couldn't be read with any installed file reader."); AUD_THROW(FileException, "The file couldn't be read with any installed file reader.");
} }
std::shared_ptr<IReader> FileManager::createReader(std::shared_ptr<Buffer> buffer, int stream) std::shared_ptr<IReader> FileManager::createReader(std::shared_ptr<Buffer> buffer)
{ {
for(std::shared_ptr<IFileInput> input : inputs()) for(std::shared_ptr<IFileInput> input : inputs())
{ {
try try
{ {
return input->createReader(buffer, stream); return input->createReader(buffer);
}
catch(Exception&) {}
}
AUD_THROW(FileException, "The file couldn't be read with any installed file reader.");
}
std::vector<StreamInfo> FileManager::queryStreams(std::string filename)
{
for(std::shared_ptr<IFileInput> input : inputs())
{
try
{
return input->queryStreams(filename);
}
catch(Exception&) {}
}
AUD_THROW(FileException, "The file couldn't be read with any installed file reader.");
}
std::vector<StreamInfo> FileManager::queryStreams(std::shared_ptr<Buffer> buffer)
{
for(std::shared_ptr<IFileInput> input : inputs())
{
try
{
return input->queryStreams(buffer);
} }
catch(Exception&) {} catch(Exception&) {}
} }

View File

@@ -1,137 +0,0 @@
/*******************************************************************************
* Copyright 2009-2021 Jörg Müller
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
#include "util/RingBuffer.h"
#include <algorithm>
#include <cstring>
#include <cstdlib>
#define ALIGNMENT 32
#define ALIGN(a) (a + ALIGNMENT - ((long long)a & (ALIGNMENT-1)))
AUD_NAMESPACE_BEGIN
RingBuffer::RingBuffer(int size) :
m_buffer(size),
m_read(0),
m_write(0)
{
}
sample_t* RingBuffer::getBuffer() const
{
return m_buffer.getBuffer();
}
int RingBuffer::getSize() const
{
return m_buffer.getSize();
}
size_t RingBuffer::getReadSize() const
{
size_t read = m_read;
size_t write = m_write;
if(read > write)
return write + getSize() - read;
else
return write - read;
}
size_t RingBuffer::getWriteSize() const
{
size_t read = m_read;
size_t write = m_write;
if(read > write)
return read - write - 1;
else
return read + getSize() - write - 1;
}
size_t RingBuffer::read(data_t* target, size_t size)
{
size = std::min(size, getReadSize());
data_t* buffer = reinterpret_cast<data_t*>(m_buffer.getBuffer());
if(m_read + size > m_buffer.getSize())
{
size_t read_first = m_buffer.getSize() - m_read;
size_t read_second = size - read_first;
std::memcpy(target, buffer + m_read, read_first);
std::memcpy(target + read_first, buffer, read_second);
m_read = read_second;
}
else
{
std::memcpy(target, buffer + m_read, size);
m_read += size;
}
return size;
}
size_t RingBuffer::write(data_t* source, size_t size)
{
size = std::min(size, getWriteSize());
data_t* buffer = reinterpret_cast<data_t*>(m_buffer.getBuffer());
if(m_write + size > m_buffer.getSize())
{
size_t write_first = m_buffer.getSize() - m_write;
size_t write_second = size - write_first;
std::memcpy(buffer + m_write, source, write_first);
std::memcpy(buffer, source + write_first, write_second);
m_write = write_second;
}
else
{
std::memcpy(buffer + m_write, source, size);
m_write += size;
}
return size;
}
void RingBuffer::reset()
{
m_read = 0;
m_write = 0;
}
void RingBuffer::resize(int size)
{
m_buffer.resize(size);
reset();
}
void RingBuffer::assureSize(int size)
{
m_buffer.assureSize(size);
reset();
}
AUD_NAMESPACE_END

View File

@@ -645,8 +645,7 @@ typedef enum CUdevice_P2PAttribute_enum {
CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = 0x01, CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK = 0x01,
CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = 0x02, CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED = 0x02,
CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = 0x03, CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED = 0x03,
CU_DEVICE_P2P_ATTRIBUTE_ACCESS_ACCESS_SUPPORTED = 0x04, CU_DEVICE_P2P_ATTRIBUTE_ARRAY_ACCESS_ACCESS_SUPPORTED = 0x04,
CU_DEVICE_P2P_ATTRIBUTE_CUDA_ARRAY_ACCESS_SUPPORTED = 0x04,
} CUdevice_P2PAttribute; } CUdevice_P2PAttribute;
typedef void (CUDA_CB *CUstreamCallback)(CUstream hStream, CUresult status, void* userData); typedef void (CUDA_CB *CUstreamCallback)(CUstream hStream, CUresult status, void* userData);

View File

@@ -1,5 +0,0 @@
Project: JSON
URL: https://github.com/nlohmann/json/
License: MIT License
Upstream version: 3.10.2
Local modifications: None

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
# YOUR INSTALLATION PATHS GO HERE: # YOUR INSTALLATION PATHS GO HERE:
MANTA_INSTALLATION=/Users/sebbas/Developer/Mantaflow/mantaflowDevelop MANTA_INSTALLATION=/Users/sebbas/Developer/Mantaflow/mantaflowDevelop
BLENDER_INSTALLATION=/Users/sebbas/Developer/Blender BLENDER_INSTALLATION=/Users/sebbas/Developer/Blender/fluid-mantaflow
# Try to check out Mantaflow repository before building? # Try to check out Mantaflow repository before building?
CLEAN_REPOSITORY=0 CLEAN_REPOSITORY=0

View File

@@ -28,13 +28,11 @@ extern PyTypeObject PbVec3Type;
extern PyTypeObject PbVec4Type; extern PyTypeObject PbVec4Type;
struct PbVec3 { struct PbVec3 {
PyObject_HEAD PyObject_HEAD float data[3];
float data[3];
}; };
struct PbVec4 { struct PbVec4 {
PyObject_HEAD PyObject_HEAD float data[4];
float data[4];
}; };
PyObject *getPyNone() PyObject *getPyNone()

View File

@@ -25,8 +25,7 @@ namespace Manta {
extern PyTypeObject PbVec3Type; extern PyTypeObject PbVec3Type;
struct PbVec3 { struct PbVec3 {
PyObject_HEAD PyObject_HEAD float data[3];
float data[3];
}; };
static void PbVec3Dealloc(PbVec3 *self) static void PbVec3Dealloc(PbVec3 *self)
@@ -294,8 +293,7 @@ inline PyObject *castPy(PyTypeObject *p)
extern PyTypeObject PbVec4Type; extern PyTypeObject PbVec4Type;
struct PbVec4 { struct PbVec4 {
PyObject_HEAD PyObject_HEAD float data[4];
float data[4];
}; };
static PyMethodDef PbVec4Methods[] = { static PyMethodDef PbVec4Methods[] = {

View File

@@ -76,8 +76,7 @@ struct ClassData {
}; };
struct PbObject { struct PbObject {
PyObject_HEAD PyObject_HEAD Manta::PbClass *instance;
Manta::PbClass *instance;
ClassData *classdef; ClassData *classdef;
}; };

View File

@@ -874,136 +874,6 @@ static const Vec3i nb[6] = {Vec3i(1, 0, 0),
Vec3i(0, 0, 1), Vec3i(0, 0, 1),
Vec3i(0, 0, -1)}; Vec3i(0, 0, -1)};
struct knMarkSkipCells : public KernelBase {
knMarkSkipCells(Grid<Real> &phi, Grid<int> &tmp, bool inside)
: KernelBase(&phi, 1), phi(phi), tmp(tmp), inside(inside)
{
runMessage();
run();
}
inline void op(int i, int j, int k, Grid<Real> &phi, Grid<int> &tmp, bool inside) const
{
if (!inside && phi(i, j, k) < 0.) {
tmp(i, j, k) = 1;
}
if (inside && phi(i, j, k) > 0.) {
tmp(i, j, k) = 1;
}
}
inline Grid<Real> &getArg0()
{
return phi;
}
typedef Grid<Real> type0;
inline Grid<int> &getArg1()
{
return tmp;
}
typedef Grid<int> type1;
inline bool &getArg2()
{
return inside;
}
typedef bool type2;
void runMessage()
{
debMsg("Executing kernel knMarkSkipCells ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 1; j < _maxY; j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, phi, tmp, inside);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, phi, tmp, inside);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
}
Grid<Real> &phi;
Grid<int> &tmp;
bool inside;
};
struct knSetFirstLayer : public KernelBase {
knSetFirstLayer(Grid<int> &tmp, int dim) : KernelBase(&tmp, 1), tmp(tmp), dim(dim)
{
runMessage();
run();
}
inline void op(int i, int j, int k, Grid<int> &tmp, int dim) const
{
Vec3i p(i, j, k);
if (tmp(p))
return;
for (int n = 0; n < 2 * dim; ++n) {
if (tmp(p + nb[n]) == 1) {
tmp(i, j, k) = 2;
break;
}
}
}
inline Grid<int> &getArg0()
{
return tmp;
}
typedef Grid<int> type0;
inline int &getArg1()
{
return dim;
}
typedef int type1;
void runMessage()
{
debMsg("Executing kernel knSetFirstLayer ", 3);
debMsg("Kernel range"
<< " x " << maxX << " y " << maxY << " z " << minZ << " - " << maxZ << " ",
4);
};
void operator()(const tbb::blocked_range<IndexInt> &__r) const
{
const int _maxX = maxX;
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = 1; j < _maxY; j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, tmp, dim);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, tmp, dim);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
}
Grid<int> &tmp;
int dim;
};
template<class S> struct knExtrapolateLsSimple : public KernelBase { template<class S> struct knExtrapolateLsSimple : public KernelBase {
knExtrapolateLsSimple(Grid<S> &val, int distance, Grid<int> &tmp, const int d, S direction) knExtrapolateLsSimple(Grid<S> &val, int distance, Grid<int> &tmp, const int d, S direction)
: KernelBase(&val, 1), val(val), distance(distance), tmp(tmp), d(d), direction(direction) : KernelBase(&val, 1), val(val), distance(distance), tmp(tmp), d(d), direction(direction)
@@ -1173,12 +1043,39 @@ void extrapolateLsSimple(Grid<Real> &phi, int distance = 4, bool inside = false)
tmp.clear(); tmp.clear();
const int dim = (phi.is3D() ? 3 : 2); const int dim = (phi.is3D() ? 3 : 2);
// by default, march outside (ie mark all inside to be skipped) // by default, march outside
Real direction = (inside) ? -1. : 1.; Real direction = 1.;
knMarkSkipCells(phi, tmp, inside); if (!inside) {
// mark all inside
FOR_IJK_BND(phi, 1)
{
if (phi(i, j, k) < 0.) {
tmp(i, j, k) = 1;
}
}
}
else {
direction = -1.;
FOR_IJK_BND(phi, 1)
{
if (phi(i, j, k) > 0.) {
tmp(i, j, k) = 1;
}
}
}
// + first layer around // + first layer around
knSetFirstLayer(tmp, dim); FOR_IJK_BND(phi, 1)
{
Vec3i p(i, j, k);
if (tmp(p))
continue;
for (int n = 0; n < 2 * dim; ++n) {
if (tmp(p + nb[n]) == 1) {
tmp(i, j, k) = 2;
n = 2 * dim;
}
}
}
// extrapolate for distance // extrapolate for distance
for (int d = 2; d < 1 + distance; ++d) { for (int d = 2; d < 1 + distance; ++d) {
@@ -1229,12 +1126,37 @@ void extrapolateVec3Simple(Grid<Vec3> &vel, Grid<Real> &phi, int distance = 4, b
tmp.clear(); tmp.clear();
const int dim = (vel.is3D() ? 3 : 2); const int dim = (vel.is3D() ? 3 : 2);
// mark initial cells, by default, march outside (ie mark all inside to be skipped) // mark initial cells, by default, march outside
Real direction = (inside) ? -1. : 1.; if (!inside) {
knMarkSkipCells(phi, tmp, inside); // mark all inside
FOR_IJK_BND(phi, 1)
{
if (phi(i, j, k) < 0.) {
tmp(i, j, k) = 1;
}
}
}
else {
FOR_IJK_BND(phi, 1)
{
if (phi(i, j, k) > 0.) {
tmp(i, j, k) = 1;
}
}
}
// + first layer next to initial cells // + first layer next to initial cells
knSetFirstLayer(tmp, dim); FOR_IJK_BND(vel, 1)
{
Vec3i p(i, j, k);
if (tmp(p))
continue;
for (int n = 0; n < 2 * dim; ++n) {
if (tmp(p + nb[n]) == 1) {
tmp(i, j, k) = 2;
n = 2 * dim;
}
}
}
for (int d = 2; d < 1 + distance; ++d) { for (int d = 2; d < 1 + distance; ++d) {
knExtrapolateLsSimple<Vec3>(vel, distance, tmp, d, Vec3(0.)); knExtrapolateLsSimple<Vec3>(vel, distance, tmp, d, Vec3(0.));

View File

@@ -1,3 +1,3 @@
#define MANTA_GIT_VERSION "commit d5d9a6c28daa8f21426d7a285f48639c0d8fd13f" #define MANTA_GIT_VERSION "commit 8fbebe02459b7f72575872c20961f7cb757db408"

View File

@@ -1,7 +0,0 @@
Project: NanoSVG
URL: https://github.com/memononen/nanosvg
License: zlib
Upstream version:
Local modifications: Added some functionality to manage grease pencil layers
Added a fix to SVG import arc and float errors (https://developer.blender.org/rB11dc674c78b49fc4e0b7c134c375b6c8b8eacbcc)

View File

@@ -1,86 +0,0 @@
diff --git a/c:/tmp/nanosvg_original.h b/c:/tmp/nanosvg_modif.h
index 24a01a86d3d..eca0d07e79d 100644
--- a/c:/tmp/nanosvg_original.h
+++ b/c:/tmp/nanosvg_modif.h
@@ -24,7 +24,8 @@
*
* Bounding box calculation based on http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html
*
- */
+ * This is a modified version for Blender used by importers.
+ **/
#ifndef NANOSVG_H
#define NANOSVG_H
@@ -148,6 +149,8 @@ extern "C" {
typedef struct NSVGshape
{
char id[64]; // Optional 'id' attr of the shape or its group
+ /* Blender: Parent ID used for layer creation. */
+ char id_parent[64];
NSVGpaint fill; // Fill paint
NSVGpaint stroke; // Stroke paint
float opacity; // Opacity of the shape.
@@ -370,6 +373,7 @@ int nsvg__parseXML(char* input,
/* Simple SVG parser. */
#define NSVG_MAX_ATTR 128
+#define NSVG_MAX_BREADCRUMB 5
enum NSVGgradientUnits
{
@@ -471,6 +475,10 @@ typedef struct NSVGparser
float dpi;
char pathFlag;
char defsFlag;
+ /** Blender breadcrumb for layers. */
+ char breadcrumb[NSVG_MAX_BREADCRUMB][64];
+ /** Blender number of elements in breadcrumb. */
+ int breadcrumb_len;
} NSVGparser;
static void nsvg__xformIdentity(float* t)
@@ -980,6 +988,14 @@ static void nsvg__addShape(NSVGparser* p)
memset(shape, 0, sizeof(NSVGshape));
memcpy(shape->id, attr->id, sizeof shape->id);
+ /* Copy parent id from breadcrumb. */
+ if (p->breadcrumb_len > 0) {
+ memcpy(shape->id_parent, p->breadcrumb[0], sizeof shape->id_parent);
+ }
+ else {
+ memcpy(shape->id_parent, attr->id, sizeof shape->id_parent);
+ }
+
scale = nsvg__getAverageScale(attr->xform);
shape->strokeWidth = attr->strokeWidth * scale;
shape->strokeDashOffset = attr->strokeDashOffset * scale;
@@ -2814,6 +2830,14 @@ static void nsvg__startElement(void* ud, const char* el, const char** attr)
if (strcmp(el, "g") == 0) {
nsvg__pushAttr(p);
nsvg__parseAttribs(p, attr);
+
+ /* Save the breadcrumb of groups. */
+ if (p->breadcrumb_len < NSVG_MAX_BREADCRUMB) {
+ NSVGattrib *attr_id = nsvg__getAttr(p);
+ memcpy(
+ p->breadcrumb[p->breadcrumb_len], attr_id->id, sizeof(p->breadcrumb[p->breadcrumb_len]));
+ p->breadcrumb_len++;
+ }
}
else if (strcmp(el, "path") == 0) {
if (p->pathFlag) // Do not allow nested paths.
@@ -2874,7 +2898,12 @@ static void nsvg__endElement(void* ud, const char* el)
NSVGparser* p = (NSVGparser*)ud;
if (strcmp(el, "g") == 0) {
- nsvg__popAttr(p);
+ /* Remove the breadcrumb level. */
+ if (p->breadcrumb_len > 0) {
+ p->breadcrumb[p->breadcrumb_len - 1][0] = '\0';
+ p->breadcrumb_len--;
+ }
+ nsvg__popAttr(p);
}
else if (strcmp(el, "path") == 0) {
p->pathFlag = 0;

View File

@@ -32,7 +32,7 @@
* - #TPOOL_STRUCT: Name for pool struct name. * - #TPOOL_STRUCT: Name for pool struct name.
* - #TPOOL_CHUNK_SIZE: Chunk size (optional), use 64kb when not defined. * - #TPOOL_CHUNK_SIZE: Chunk size (optional), use 64kb when not defined.
* *
* \note #TPOOL_ALLOC_TYPE must be at least `sizeof(void *)`. * \note #TPOOL_ALLOC_TYPE must be at least ``sizeof(void *)``.
* *
* Defines the API, uses #TPOOL_IMPL_PREFIX to prefix each function. * Defines the API, uses #TPOOL_IMPL_PREFIX to prefix each function.
* *

View File

@@ -1,6 +0,0 @@
Project: TinyGLTF
URL: https://github.com/syoyo/tinygltf
License: MIT
Upstream version: 2.5.0, 19a41d20ec0
Local modifications:
* Silence "enum value not handled in switch" warnings due to JSON dependency.

File diff suppressed because it is too large Load Diff

View File

@@ -60,108 +60,9 @@
# define JE_FORCE_SYNC_COMPARE_AND_SWAP_8 # define JE_FORCE_SYNC_COMPARE_AND_SWAP_8
#endif #endif
/* Define the `ATOMIC_FORCE_USE_FALLBACK` to force lock-based fallback implementation to be used /******************************************************************************/
* (even on platforms where there is native implementation available via compiler. /* 64-bit operations. */
* Useful for development purposes. */ #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
#undef ATOMIC_FORCE_USE_FALLBACK
/* -------------------------------------------------------------------- */
/** \name Spin-lock implementation
*
* Used to implement atomics on unsupported platforms.
* The spin implementation is shared for all platforms to make sure it compiles and tested.
* \{ */
typedef struct AtomicSpinLock {
volatile int lock;
/* Pad the structure size to a cache-line, to avoid unwanted sharing with other data. */
int pad[32 - sizeof(int)];
} __attribute__((aligned(32))) AtomicSpinLock;
ATOMIC_INLINE void atomic_spin_lock(volatile AtomicSpinLock *lock)
{
while (__sync_lock_test_and_set(&lock->lock, 1)) {
while (lock->lock) {
}
}
}
ATOMIC_INLINE void atomic_spin_unlock(volatile AtomicSpinLock *lock)
{
__sync_lock_release(&lock->lock);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Common part of locking fallback implementation
* \{ */
/* Global lock, shared by all atomic operations implementations.
*
* Could be split into per-size locks, although added complexity and being more error-proone does
* not seem to worth it for a fall-back implementation. */
static _ATOMIC_MAYBE_UNUSED AtomicSpinLock _atomic_global_lock = {0};
#define ATOMIC_LOCKING_OP_AND_FETCH_DEFINE(_type, _op_name, _op) \
ATOMIC_INLINE _type##_t atomic_##_op_name##_and_fetch_##_type(_type##_t *p, _type##_t x) \
{ \
atomic_spin_lock(&_atomic_global_lock); \
const _type##_t original_value = *(p); \
const _type##_t new_value = original_value _op(x); \
*(p) = new_value; \
atomic_spin_unlock(&_atomic_global_lock); \
return new_value; \
}
#define ATOMIC_LOCKING_FETCH_AND_OP_DEFINE(_type, _op_name, _op) \
ATOMIC_INLINE _type##_t atomic_fetch_and_##_op_name##_##_type(_type##_t *p, _type##_t x) \
{ \
atomic_spin_lock(&_atomic_global_lock); \
const _type##_t original_value = *(p); \
*(p) = original_value _op(x); \
atomic_spin_unlock(&_atomic_global_lock); \
return original_value; \
}
#define ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE(_type) \
ATOMIC_LOCKING_OP_AND_FETCH_DEFINE(_type, add, +)
#define ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE(_type) \
ATOMIC_LOCKING_OP_AND_FETCH_DEFINE(_type, sub, -)
#define ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE(_type) \
ATOMIC_LOCKING_FETCH_AND_OP_DEFINE(_type, add, +)
#define ATOMIC_LOCKING_FETCH_AND_SUB_DEFINE(_type) \
ATOMIC_LOCKING_FETCH_AND_OP_DEFINE(_type, sub, -)
#define ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(_type) ATOMIC_LOCKING_FETCH_AND_OP_DEFINE(_type, or, |)
#define ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(_type) \
ATOMIC_LOCKING_FETCH_AND_OP_DEFINE(_type, and, &)
#define ATOMIC_LOCKING_CAS_DEFINE(_type) \
ATOMIC_INLINE _type##_t atomic_cas_##_type(_type##_t *v, _type##_t old, _type##_t _new) \
{ \
atomic_spin_lock(&_atomic_global_lock); \
const _type##_t original_value = *v; \
if (*v == old) { \
*v = _new; \
} \
atomic_spin_unlock(&_atomic_global_lock); \
return original_value; \
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name 64-bit operations
* \{ */
#if !defined(ATOMIC_FORCE_USE_FALLBACK) && \
(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
/* Unsigned */ /* Unsigned */
ATOMIC_INLINE uint64_t atomic_add_and_fetch_uint64(uint64_t *p, uint64_t x) ATOMIC_INLINE uint64_t atomic_add_and_fetch_uint64(uint64_t *p, uint64_t x)
{ {
@@ -214,7 +115,7 @@ ATOMIC_INLINE int64_t atomic_cas_int64(int64_t *v, int64_t old, int64_t _new)
return __sync_val_compare_and_swap(v, old, _new); return __sync_val_compare_and_swap(v, old, _new);
} }
#elif !defined(ATOMIC_FORCE_USE_FALLBACK) && (defined(__amd64__) || defined(__x86_64__)) #elif (defined(__amd64__) || defined(__x86_64__))
/* Unsigned */ /* Unsigned */
ATOMIC_INLINE uint64_t atomic_fetch_and_add_uint64(uint64_t *p, uint64_t x) ATOMIC_INLINE uint64_t atomic_fetch_and_add_uint64(uint64_t *p, uint64_t x)
{ {
@@ -289,36 +190,12 @@ ATOMIC_INLINE int64_t atomic_cas_int64(int64_t *v, int64_t old, int64_t _new)
return ret; return ret;
} }
#else #else
# error "Missing implementation for 64-bit atomic operations"
/* Unsigned */
ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE(uint64)
ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE(uint64)
ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE(uint64)
ATOMIC_LOCKING_FETCH_AND_SUB_DEFINE(uint64)
ATOMIC_LOCKING_CAS_DEFINE(uint64)
/* Signed */
ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE(int64)
ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE(int64)
ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE(int64)
ATOMIC_LOCKING_FETCH_AND_SUB_DEFINE(int64)
ATOMIC_LOCKING_CAS_DEFINE(int64)
#endif #endif
/** \} */ /******************************************************************************/
/* 32-bit operations. */
/* -------------------------------------------------------------------- */ #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
/** \name 32-bit operations
* \{ */
#if !defined(ATOMIC_FORCE_USE_FALLBACK) && \
(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
/* Unsigned */ /* Unsigned */
ATOMIC_INLINE uint32_t atomic_add_and_fetch_uint32(uint32_t *p, uint32_t x) ATOMIC_INLINE uint32_t atomic_add_and_fetch_uint32(uint32_t *p, uint32_t x)
{ {
@@ -351,8 +228,7 @@ ATOMIC_INLINE int32_t atomic_cas_int32(int32_t *v, int32_t old, int32_t _new)
return __sync_val_compare_and_swap(v, old, _new); return __sync_val_compare_and_swap(v, old, _new);
} }
#elif !defined(ATOMIC_FORCE_USE_FALLBACK) && \ #elif (defined(__i386__) || defined(__amd64__) || defined(__x86_64__))
(defined(__i386__) || defined(__amd64__) || defined(__x86_64__))
/* Unsigned */ /* Unsigned */
ATOMIC_INLINE uint32_t atomic_add_and_fetch_uint32(uint32_t *p, uint32_t x) ATOMIC_INLINE uint32_t atomic_add_and_fetch_uint32(uint32_t *p, uint32_t x)
{ {
@@ -410,25 +286,10 @@ ATOMIC_INLINE int32_t atomic_cas_int32(int32_t *v, int32_t old, int32_t _new)
} }
#else #else
# error "Missing implementation for 32-bit atomic operations"
/* Unsigned */
ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE(uint32)
ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE(uint32)
ATOMIC_LOCKING_CAS_DEFINE(uint32)
/* Signed */
ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE(int32)
ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE(int32)
ATOMIC_LOCKING_CAS_DEFINE(int32)
#endif #endif
#if !defined(ATOMIC_FORCE_USE_FALLBACK) && \ #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
/* Unsigned */ /* Unsigned */
ATOMIC_INLINE uint32_t atomic_fetch_and_add_uint32(uint32_t *p, uint32_t x) ATOMIC_INLINE uint32_t atomic_fetch_and_add_uint32(uint32_t *p, uint32_t x)
{ {
@@ -462,27 +323,12 @@ ATOMIC_INLINE int32_t atomic_fetch_and_and_int32(int32_t *p, int32_t x)
} }
#else #else
# error "Missing implementation for 32-bit atomic operations"
/* Unsigned */
ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE(uint32)
ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(uint32)
ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(uint32)
/* Signed */
ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE(int32)
ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(int32)
ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(int32)
#endif #endif
/** \} */ /******************************************************************************/
/* 16-bit operations. */
/* -------------------------------------------------------------------- */ #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_2))
/** \name 16-bit operations
* \{ */
#if !defined(ATOMIC_FORCE_USE_FALLBACK) && \
(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_2))
/* Signed */ /* Signed */
ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b) ATOMIC_INLINE int16_t atomic_fetch_and_and_int16(int16_t *p, int16_t b)
@@ -495,21 +341,12 @@ ATOMIC_INLINE int16_t atomic_fetch_and_or_int16(int16_t *p, int16_t b)
} }
#else #else
# error "Missing implementation for 16-bit atomic operations"
ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(int16)
ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(int16)
#endif #endif
/** \} */ /******************************************************************************/
/* 8-bit operations. */
/* -------------------------------------------------------------------- */ #if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_1))
/** \name 8-bit operations
* \{ */
#if !defined(ATOMIC_FORCE_USE_FALLBACK) && \
(defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_1))
/* Unsigned */ /* Unsigned */
ATOMIC_INLINE uint8_t atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b) ATOMIC_INLINE uint8_t atomic_fetch_and_and_uint8(uint8_t *p, uint8_t b)
{ {
@@ -531,27 +368,7 @@ ATOMIC_INLINE int8_t atomic_fetch_and_or_int8(int8_t *p, int8_t b)
} }
#else #else
# error "Missing implementation for 8-bit atomic operations"
/* Unsigned */
ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(uint8)
ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(uint8)
/* Signed */
ATOMIC_LOCKING_FETCH_AND_AND_DEFINE(int8)
ATOMIC_LOCKING_FETCH_AND_OR_DEFINE(int8)
#endif #endif
/** \} */
#undef ATOMIC_LOCKING_OP_AND_FETCH_DEFINE
#undef ATOMIC_LOCKING_FETCH_AND_OP_DEFINE
#undef ATOMIC_LOCKING_ADD_AND_FETCH_DEFINE
#undef ATOMIC_LOCKING_SUB_AND_FETCH_DEFINE
#undef ATOMIC_LOCKING_FETCH_AND_ADD_DEFINE
#undef ATOMIC_LOCKING_FETCH_AND_SUB_DEFINE
#undef ATOMIC_LOCKING_FETCH_AND_OR_DEFINE
#undef ATOMIC_LOCKING_FETCH_AND_AND_DEFINE
#undef ATOMIC_LOCKING_CAS_DEFINE
#endif /* __ATOMIC_OPS_UNIX_H__ */ #endif /* __ATOMIC_OPS_UNIX_H__ */

View File

@@ -64,11 +64,9 @@
#ifdef __GNUC__ #ifdef __GNUC__
# define _ATOMIC_LIKELY(x) __builtin_expect(!!(x), 1) # define _ATOMIC_LIKELY(x) __builtin_expect(!!(x), 1)
# define _ATOMIC_UNLIKELY(x) __builtin_expect(!!(x), 0) # define _ATOMIC_UNLIKELY(x) __builtin_expect(!!(x), 0)
# define _ATOMIC_MAYBE_UNUSED __attribute__((unused))
#else #else
# define _ATOMIC_LIKELY(x) (x) # define _ATOMIC_LIKELY(x) (x)
# define _ATOMIC_UNLIKELY(x) (x) # define _ATOMIC_UNLIKELY(x) (x)
# define _ATOMIC_MAYBE_UNUSED
#endif #endif
#if defined(__SIZEOF_POINTER__) #if defined(__SIZEOF_POINTER__)

View File

@@ -247,7 +247,7 @@ if(WITH_CYCLES_OSL)
endif() endif()
if(WITH_CYCLES_DEVICE_OPTIX) if(WITH_CYCLES_DEVICE_OPTIX)
find_package(OptiX 7.3.0) find_package(OptiX)
if(OPTIX_FOUND) if(OPTIX_FOUND)
add_definitions(-DWITH_OPTIX) add_definitions(-DWITH_OPTIX)
@@ -286,17 +286,11 @@ if(WITH_OPENSUBDIV)
) )
endif() endif()
if(WITH_OPENIMAGEDENOISE)
add_definitions(-DWITH_OPENIMAGEDENOISE)
add_definitions(-DOIDN_STATIC_LIB)
include_directories(
SYSTEM
${OPENIMAGEDENOISE_INCLUDE_DIRS}
)
endif()
if(WITH_CYCLES_STANDALONE) if(WITH_CYCLES_STANDALONE)
set(WITH_CYCLES_DEVICE_OPENCL TRUE)
set(WITH_CYCLES_DEVICE_CUDA TRUE) set(WITH_CYCLES_DEVICE_CUDA TRUE)
# Experimental and unfinished.
set(WITH_CYCLES_NETWORK FALSE)
endif() endif()
# TODO(sergey): Consider removing it, only causes confusion in interface. # TODO(sergey): Consider removing it, only causes confusion in interface.
set(WITH_CYCLES_DEVICE_MULTI TRUE) set(WITH_CYCLES_DEVICE_MULTI TRUE)
@@ -313,9 +307,9 @@ if(WITH_CYCLES_LOGGING)
) )
endif() endif()
# NaN debugging # Debugging capabilities (debug passes etc).
if(WITH_CYCLES_DEBUG_NAN) if(WITH_CYCLES_DEBUG)
add_definitions(-DWITH_CYCLES_DEBUG_NAN) add_definitions(-DWITH_CYCLES_DEBUG)
endif() endif()
if(NOT OPENIMAGEIO_PUGIXML_FOUND) if(NOT OPENIMAGEIO_PUGIXML_FOUND)
@@ -392,12 +386,18 @@ if(WITH_CYCLES_BLENDER)
add_subdirectory(blender) add_subdirectory(blender)
endif() endif()
add_subdirectory(app) if(WITH_CYCLES_NETWORK)
add_definitions(-DWITH_NETWORK)
endif()
if(WITH_CYCLES_STANDALONE OR WITH_CYCLES_NETWORK OR WITH_CYCLES_CUBIN_COMPILER)
add_subdirectory(app)
endif()
add_subdirectory(bvh) add_subdirectory(bvh)
add_subdirectory(device) add_subdirectory(device)
add_subdirectory(doc) add_subdirectory(doc)
add_subdirectory(graph) add_subdirectory(graph)
add_subdirectory(integrator)
add_subdirectory(kernel) add_subdirectory(kernel)
add_subdirectory(render) add_subdirectory(render)
add_subdirectory(subd) add_subdirectory(subd)

View File

@@ -90,6 +90,24 @@ if(WITH_CYCLES_STANDALONE)
endif() endif()
endif() endif()
#####################################################################
# Cycles network server executable
#####################################################################
if(WITH_CYCLES_NETWORK)
set(SRC
cycles_server.cpp
)
add_executable(cycles_server ${SRC})
target_link_libraries(cycles_server ${LIBRARIES})
cycles_target_link_libraries(cycles_server)
if(UNIX AND NOT APPLE)
set_target_properties(cycles_server PROPERTIES INSTALL_RPATH $ORIGIN/lib)
endif()
unset(SRC)
endif()
##################################################################### #####################################################################
# Cycles cubin compiler executable # Cycles cubin compiler executable
##################################################################### #####################################################################

View File

@@ -53,7 +53,7 @@ struct Options {
SessionParams session_params; SessionParams session_params;
bool quiet; bool quiet;
bool show_help, interactive, pause; bool show_help, interactive, pause;
string output_filepath; string output_path;
} options; } options;
static void session_print(const string &str) static void session_print(const string &str)
@@ -126,7 +126,7 @@ static BufferParams &session_buffer_params()
static void scene_init() static void scene_init()
{ {
options.scene = options.session->scene; options.scene = new Scene(options.scene_params, options.session->device);
/* Read XML */ /* Read XML */
xml_read_file(options.scene, options.filepath.c_str()); xml_read_file(options.scene, options.filepath.c_str());
@@ -148,7 +148,7 @@ static void scene_init()
static void session_init() static void session_init()
{ {
options.session_params.write_render_cb = write_render; options.session_params.write_render_cb = write_render;
options.session = new Session(options.session_params, options.scene_params); options.session = new Session(options.session_params);
if (options.session_params.background && !options.quiet) if (options.session_params.background && !options.quiet)
options.session->progress.set_update_callback(function_bind(&session_print_status)); options.session->progress.set_update_callback(function_bind(&session_print_status));
@@ -159,8 +159,9 @@ static void session_init()
/* load scene */ /* load scene */
scene_init(); scene_init();
options.session->scene = options.scene;
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
options.session->start(); options.session->start();
} }
@@ -222,7 +223,9 @@ static void display_info(Progress &progress)
static void display() static void display()
{ {
options.session->draw(); static DeviceDrawParams draw_params = DeviceDrawParams();
options.session->draw(session_buffer_params(), draw_params);
display_info(options.session->progress); display_info(options.session->progress);
} }
@@ -252,7 +255,7 @@ static void motion(int x, int y, int button)
options.session->scene->camera->need_flags_update = true; options.session->scene->camera->need_flags_update = true;
options.session->scene->camera->need_device_update = true; options.session->scene->camera->need_device_update = true;
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
} }
} }
@@ -269,7 +272,7 @@ static void resize(int width, int height)
options.session->scene->camera->need_flags_update = true; options.session->scene->camera->need_flags_update = true;
options.session->scene->camera->need_device_update = true; options.session->scene->camera->need_device_update = true;
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
} }
} }
@@ -281,7 +284,7 @@ static void keyboard(unsigned char key)
/* Reset */ /* Reset */
else if (key == 'r') else if (key == 'r')
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
/* Cancel */ /* Cancel */
else if (key == 27) // escape else if (key == 27) // escape
@@ -318,7 +321,7 @@ static void keyboard(unsigned char key)
options.session->scene->camera->need_flags_update = true; options.session->scene->camera->need_flags_update = true;
options.session->scene->camera->need_device_update = true; options.session->scene->camera->need_device_update = true;
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
} }
/* Set Max Bounces */ /* Set Max Bounces */
@@ -344,7 +347,7 @@ static void keyboard(unsigned char key)
options.session->scene->integrator->set_max_bounce(bounce); options.session->scene->integrator->set_max_bounce(bounce);
options.session->reset(options.session_params, session_buffer_params()); options.session->reset(session_buffer_params(), options.session_params.samples);
} }
} }
#endif #endif
@@ -359,13 +362,11 @@ static int files_parse(int argc, const char *argv[])
static void options_parse(int argc, const char **argv) static void options_parse(int argc, const char **argv)
{ {
options.width = 1024; options.width = 0;
options.height = 512; options.height = 0;
options.filepath = ""; options.filepath = "";
options.session = NULL; options.session = NULL;
options.quiet = false; options.quiet = false;
options.session_params.use_auto_tile = false;
options.session_params.tile_size = 0;
/* device names */ /* device names */
string device_names = ""; string device_names = "";
@@ -411,7 +412,7 @@ static void options_parse(int argc, const char **argv)
&options.session_params.samples, &options.session_params.samples,
"Number of samples to render", "Number of samples to render",
"--output %s", "--output %s",
&options.output_filepath, &options.output_path,
"File path to write output image", "File path to write output image",
"--threads %d", "--threads %d",
&options.session_params.threads, &options.session_params.threads,
@@ -422,9 +423,12 @@ static void options_parse(int argc, const char **argv)
"--height %d", "--height %d",
&options.height, &options.height,
"Window height in pixel", "Window height in pixel",
"--tile-size %d", "--tile-width %d",
&options.session_params.tile_size, &options.session_params.tile_size.x,
"Tile size in pixels", "Tile width in pixels",
"--tile-height %d",
&options.session_params.tile_size.y,
"Tile height in pixels",
"--list-devices", "--list-devices",
&list, &list,
"List information about all available devices", "List information about all available devices",
@@ -486,9 +490,8 @@ static void options_parse(int argc, const char **argv)
options.session_params.background = true; options.session_params.background = true;
#endif #endif
if (options.session_params.tile_size > 0) { /* Use progressive rendering */
options.session_params.use_auto_tile = true; options.session_params.progressive = true;
}
/* find matching device */ /* find matching device */
DeviceType device_type = Device::type_from_string(devicename.c_str()); DeviceType device_type = Device::type_from_string(devicename.c_str());
@@ -524,6 +527,9 @@ static void options_parse(int argc, const char **argv)
fprintf(stderr, "No file path specified\n"); fprintf(stderr, "No file path specified\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* For smoother Viewport */
options.session_params.start_resolution = 64;
} }
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -703,7 +703,7 @@ void xml_read_file(Scene *scene, const char *filepath)
xml_read_include(state, path_filename(filepath)); xml_read_include(state, path_filename(filepath));
scene->params.bvh_type = BVH_TYPE_STATIC; scene->params.bvh_type = SceneParams::BVH_STATIC;
} }
CCL_NAMESPACE_END CCL_NAMESPACE_END

View File

@@ -33,7 +33,6 @@ set(SRC
blender_device.cpp blender_device.cpp
blender_image.cpp blender_image.cpp
blender_geometry.cpp blender_geometry.cpp
blender_gpu_display.cpp
blender_light.cpp blender_light.cpp
blender_mesh.cpp blender_mesh.cpp
blender_object.cpp blender_object.cpp
@@ -51,7 +50,6 @@ set(SRC
CCL_api.h CCL_api.h
blender_device.h blender_device.h
blender_gpu_display.h
blender_id_map.h blender_id_map.h
blender_image.h blender_image.h
blender_object_cull.h blender_object_cull.h
@@ -95,6 +93,14 @@ set(ADDON_FILES
add_definitions(${GL_DEFINITIONS}) add_definitions(${GL_DEFINITIONS})
if(WITH_CYCLES_DEVICE_OPENCL)
add_definitions(-DWITH_OPENCL)
endif()
if(WITH_CYCLES_NETWORK)
add_definitions(-DWITH_NETWORK)
endif()
if(WITH_MOD_FLUID) if(WITH_MOD_FLUID)
add_definitions(-DWITH_FLUID) add_definitions(-DWITH_FLUID)
endif() endif()
@@ -109,16 +115,6 @@ if(WITH_OPENVDB)
) )
endif() endif()
if(WITH_ALEMBIC)
add_definitions(-DWITH_ALEMBIC)
list(APPEND INC_SYS
${ALEMBIC_INCLUDE_DIRS}
)
list(APPEND LIB
${ALEMBIC_LIBRARIES}
)
endif()
if(WITH_OPENIMAGEDENOISE) if(WITH_OPENIMAGEDENOISE)
add_definitions(-DWITH_OPENIMAGEDENOISE) add_definitions(-DWITH_OPENIMAGEDENOISE)
list(APPEND INC_SYS list(APPEND INC_SYS

View File

@@ -58,9 +58,9 @@ class CyclesRender(bpy.types.RenderEngine):
bl_use_eevee_viewport = True bl_use_eevee_viewport = True
bl_use_preview = True bl_use_preview = True
bl_use_exclude_layers = True bl_use_exclude_layers = True
bl_use_save_buffers = True
bl_use_spherical_stereo = True bl_use_spherical_stereo = True
bl_use_custom_freestyle = True bl_use_custom_freestyle = True
bl_use_alembic_procedural = True
def __init__(self): def __init__(self):
self.session = None self.session = None
@@ -84,12 +84,6 @@ class CyclesRender(bpy.types.RenderEngine):
def render(self, depsgraph): def render(self, depsgraph):
engine.render(self, depsgraph) engine.render(self, depsgraph)
def render_frame_finish(self):
engine.render_frame_finish(self)
def draw(self, context, depsgraph):
engine.draw(self, depsgraph, context.space_data)
def bake(self, depsgraph, obj, pass_type, pass_filter, width, height): def bake(self, depsgraph, obj, pass_type, pass_filter, width, height):
engine.bake(self, depsgraph, obj, pass_type, pass_filter, width, height) engine.bake(self, depsgraph, obj, pass_type, pass_filter, width, height)
@@ -103,7 +97,7 @@ class CyclesRender(bpy.types.RenderEngine):
engine.sync(self, depsgraph, context.blend_data) engine.sync(self, depsgraph, context.blend_data)
def view_draw(self, context, depsgraph): def view_draw(self, context, depsgraph):
engine.view_draw(self, depsgraph, context.region, context.space_data, context.region_data) engine.draw(self, depsgraph, context.region, context.space_data, context.region_data)
def update_script_node(self, node): def update_script_node(self, node):
if engine.with_osl(): if engine.with_osl():

View File

@@ -18,17 +18,62 @@
from __future__ import annotations from __future__ import annotations
def _is_using_buggy_driver():
import gpu
# We need to be conservative here because in multi-GPU systems display card
# might be quite old, but others one might be just good.
#
# So We shouldn't disable possible good dedicated cards just because display
# card seems weak. And instead we only blacklist configurations which are
# proven to cause problems.
if gpu.platform.vendor_get() == "ATI Technologies Inc.":
import re
version = gpu.platform.version_get()
if version.endswith("Compatibility Profile Context"):
# Old HD 4xxx and 5xxx series drivers did not have driver version
# in the version string, but those cards do not quite work and
# causing crashes.
return True
regex = re.compile(".*Compatibility Profile Context ([0-9]+(\\.[0-9]+)+)$")
if not regex.match(version):
# Skip cards like FireGL
return False
version = regex.sub("\\1", version).split('.')
return int(version[0]) == 8
return False
def _workaround_buggy_drivers():
if _is_using_buggy_driver():
import _cycles
if hasattr(_cycles, "opencl_disable"):
print("Cycles: OpenGL driver known to be buggy, disabling OpenCL platform.")
_cycles.opencl_disable()
def _configure_argument_parser(): def _configure_argument_parser():
import argparse import argparse
# No help because it conflicts with general Python scripts argument parsing # No help because it conflicts with general Python scripts argument parsing
parser = argparse.ArgumentParser(description="Cycles Addon argument parser", parser = argparse.ArgumentParser(description="Cycles Addon argument parser",
add_help=False) add_help=False)
parser.add_argument("--cycles-resumable-num-chunks",
help="Number of chunks to split sample range into",
default=None)
parser.add_argument("--cycles-resumable-current-chunk",
help="Current chunk of samples range to render",
default=None)
parser.add_argument("--cycles-resumable-start-chunk",
help="Start chunk to render",
default=None)
parser.add_argument("--cycles-resumable-end-chunk",
help="End chunk to render",
default=None)
parser.add_argument("--cycles-print-stats", parser.add_argument("--cycles-print-stats",
help="Print rendering statistics to stderr", help="Print rendering statistics to stderr",
action='store_true') action='store_true')
parser.add_argument("--cycles-device", parser.add_argument("--cycles-device",
help="Set the device to use for Cycles, overriding user preferences and the scene setting." help="Set the device to use for Cycles, overriding user preferences and the scene setting."
"Valid options are 'CPU', 'CUDA' or 'OPTIX'." "Valid options are 'CPU', 'CUDA', 'OPTIX' or 'OPENCL'."
"Additionally, you can append '+CPU' to any GPU type for hybrid rendering.", "Additionally, you can append '+CPU' to any GPU type for hybrid rendering.",
default=None) default=None)
return parser return parser
@@ -44,6 +89,21 @@ def _parse_command_line():
parser = _configure_argument_parser() parser = _configure_argument_parser()
args, _ = parser.parse_known_args(argv[argv.index("--") + 1:]) args, _ = parser.parse_known_args(argv[argv.index("--") + 1:])
if args.cycles_resumable_num_chunks is not None:
if args.cycles_resumable_current_chunk is not None:
import _cycles
_cycles.set_resumable_chunk(
int(args.cycles_resumable_num_chunks),
int(args.cycles_resumable_current_chunk),
)
elif args.cycles_resumable_start_chunk is not None and \
args.cycles_resumable_end_chunk:
import _cycles
_cycles.set_resumable_chunk_range(
int(args.cycles_resumable_num_chunks),
int(args.cycles_resumable_start_chunk),
int(args.cycles_resumable_end_chunk),
)
if args.cycles_print_stats: if args.cycles_print_stats:
import _cycles import _cycles
_cycles.enable_print_stats() _cycles.enable_print_stats()
@@ -58,11 +118,23 @@ def init():
import _cycles import _cycles
import os.path import os.path
# Workaround possibly buggy legacy drivers which crashes on the OpenCL
# device enumeration.
#
# This checks are not really correct because they might still fail
# in the case of multiple GPUs. However, currently buggy drivers
# are really old and likely to be used in single GPU systems only
# anyway.
#
# Can't do it in the background mode, so we hope OpenCL is no enabled
# in the user preferences.
if not bpy.app.background:
_workaround_buggy_drivers()
path = os.path.dirname(__file__) path = os.path.dirname(__file__)
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', path=''))) user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', path='')))
temp_path = bpy.app.tempdir
_cycles.init(path, user_path, temp_path, bpy.app.background) _cycles.init(path, user_path, bpy.app.background)
_parse_command_line() _parse_command_line()
@@ -105,25 +177,6 @@ def render(engine, depsgraph):
_cycles.render(engine.session, depsgraph.as_pointer()) _cycles.render(engine.session, depsgraph.as_pointer())
def render_frame_finish(engine):
if not engine.session:
return
import _cycles
_cycles.render_frame_finish(engine.session)
def draw(engine, depsgraph, space_image):
if not engine.session:
return
depsgraph_ptr = depsgraph.as_pointer()
space_image_ptr = space_image.as_pointer()
screen_ptr = space_image.id_data.as_pointer()
import _cycles
_cycles.draw(engine.session, depsgraph_ptr, screen_ptr, space_image_ptr)
def bake(engine, depsgraph, obj, pass_type, pass_filter, width, height): def bake(engine, depsgraph, obj, pass_type, pass_filter, width, height):
import _cycles import _cycles
session = getattr(engine, "session", None) session = getattr(engine, "session", None)
@@ -151,14 +204,14 @@ def sync(engine, depsgraph, data):
_cycles.sync(engine.session, depsgraph.as_pointer()) _cycles.sync(engine.session, depsgraph.as_pointer())
def view_draw(engine, depsgraph, region, v3d, rv3d): def draw(engine, depsgraph, region, v3d, rv3d):
import _cycles import _cycles
depsgraph = depsgraph.as_pointer() depsgraph = depsgraph.as_pointer()
v3d = v3d.as_pointer() v3d = v3d.as_pointer()
rv3d = rv3d.as_pointer() rv3d = rv3d.as_pointer()
# draw render image # draw render image
_cycles.view_draw(engine.session, depsgraph, v3d, rv3d) _cycles.draw(engine.session, depsgraph, v3d, rv3d)
def available_devices(): def available_devices():
@@ -171,28 +224,29 @@ def with_osl():
return _cycles.with_osl return _cycles.with_osl
def with_network():
import _cycles
return _cycles.with_network
def system_info(): def system_info():
import _cycles import _cycles
return _cycles.system_info() return _cycles.system_info()
def list_render_passes(scene, srl): def list_render_passes(scene, srl):
crl = srl.cycles # Builtin Blender passes.
# Combined pass.
yield ("Combined", "RGBA", 'COLOR') yield ("Combined", "RGBA", 'COLOR')
# Data passes.
if srl.use_pass_z: yield ("Depth", "Z", 'VALUE') if srl.use_pass_z: yield ("Depth", "Z", 'VALUE')
if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE') if srl.use_pass_mist: yield ("Mist", "Z", 'VALUE')
if srl.use_pass_position: yield ("Position", "XYZ", 'VECTOR')
if srl.use_pass_normal: yield ("Normal", "XYZ", 'VECTOR') if srl.use_pass_normal: yield ("Normal", "XYZ", 'VECTOR')
if srl.use_pass_vector: yield ("Vector", "XYZW", 'VECTOR') if srl.use_pass_vector: yield ("Vector", "XYZW", 'VECTOR')
if srl.use_pass_uv: yield ("UV", "UVA", 'VECTOR') if srl.use_pass_uv: yield ("UV", "UVA", 'VECTOR')
if srl.use_pass_object_index: yield ("IndexOB", "X", 'VALUE') if srl.use_pass_object_index: yield ("IndexOB", "X", 'VALUE')
if srl.use_pass_material_index: yield ("IndexMA", "X", 'VALUE') if srl.use_pass_material_index: yield ("IndexMA", "X", 'VALUE')
if srl.use_pass_shadow: yield ("Shadow", "RGB", 'COLOR')
# Light passes. if srl.use_pass_ambient_occlusion: yield ("AO", "RGB", 'COLOR')
if srl.use_pass_diffuse_direct: yield ("DiffDir", "RGB", 'COLOR') if srl.use_pass_diffuse_direct: yield ("DiffDir", "RGB", 'COLOR')
if srl.use_pass_diffuse_indirect: yield ("DiffInd", "RGB", 'COLOR') if srl.use_pass_diffuse_indirect: yield ("DiffInd", "RGB", 'COLOR')
if srl.use_pass_diffuse_color: yield ("DiffCol", "RGB", 'COLOR') if srl.use_pass_diffuse_color: yield ("DiffCol", "RGB", 'COLOR')
@@ -202,17 +256,19 @@ def list_render_passes(scene, srl):
if srl.use_pass_transmission_direct: yield ("TransDir", "RGB", 'COLOR') if srl.use_pass_transmission_direct: yield ("TransDir", "RGB", 'COLOR')
if srl.use_pass_transmission_indirect: yield ("TransInd", "RGB", 'COLOR') if srl.use_pass_transmission_indirect: yield ("TransInd", "RGB", 'COLOR')
if srl.use_pass_transmission_color: yield ("TransCol", "RGB", 'COLOR') if srl.use_pass_transmission_color: yield ("TransCol", "RGB", 'COLOR')
if crl.use_pass_volume_direct: yield ("VolumeDir", "RGB", 'COLOR')
if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
if srl.use_pass_emit: yield ("Emit", "RGB", 'COLOR') if srl.use_pass_emit: yield ("Emit", "RGB", 'COLOR')
if srl.use_pass_environment: yield ("Env", "RGB", 'COLOR') if srl.use_pass_environment: yield ("Env", "RGB", 'COLOR')
if srl.use_pass_shadow: yield ("Shadow", "RGB", 'COLOR')
if srl.use_pass_ambient_occlusion: yield ("AO", "RGB", 'COLOR')
if crl.use_pass_shadow_catcher: yield ("Shadow Catcher", "RGB", 'COLOR')
# Debug passes. # Cycles specific passes.
crl = srl.cycles
if crl.pass_debug_render_time: yield ("Debug Render Time", "X", 'VALUE') if crl.pass_debug_render_time: yield ("Debug Render Time", "X", 'VALUE')
if crl.pass_debug_bvh_traversed_nodes: yield ("Debug BVH Traversed Nodes", "X", 'VALUE')
if crl.pass_debug_bvh_traversed_instances: yield ("Debug BVH Traversed Instances", "X", 'VALUE')
if crl.pass_debug_bvh_intersections: yield ("Debug BVH Intersections", "X", 'VALUE')
if crl.pass_debug_ray_bounces: yield ("Debug Ray Bounces", "X", 'VALUE')
if crl.pass_debug_sample_count: yield ("Debug Sample Count", "X", 'VALUE') if crl.pass_debug_sample_count: yield ("Debug Sample Count", "X", 'VALUE')
if crl.use_pass_volume_direct: yield ("VolumeDir", "RGB", 'COLOR')
if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
# Cryptomatte passes. # Cryptomatte passes.
crypto_depth = (srl.pass_cryptomatte_depth + 1) // 2 crypto_depth = (srl.pass_cryptomatte_depth + 1) // 2
@@ -227,20 +283,30 @@ def list_render_passes(scene, srl):
yield ("CryptoAsset" + '{:02d}'.format(i), "RGBA", 'COLOR') yield ("CryptoAsset" + '{:02d}'.format(i), "RGBA", 'COLOR')
# Denoising passes. # Denoising passes.
if scene.cycles.use_denoising and crl.use_denoising: if (scene.cycles.use_denoising and crl.use_denoising) or crl.denoising_store_passes:
yield ("Noisy Image", "RGBA", 'COLOR') yield ("Noisy Image", "RGBA", 'COLOR')
if crl.use_pass_shadow_catcher: if crl.denoising_store_passes:
yield ("Noisy Shadow Catcher", "RGBA", 'COLOR') yield ("Denoising Normal", "XYZ", 'VECTOR')
if crl.denoising_store_passes: yield ("Denoising Albedo", "RGB", 'COLOR')
yield ("Denoising Normal", "XYZ", 'VECTOR') yield ("Denoising Depth", "Z", 'VALUE')
yield ("Denoising Albedo", "RGB", 'COLOR')
if scene.cycles.denoiser == 'NLM':
yield ("Denoising Shadowing", "X", 'VALUE')
yield ("Denoising Variance", "RGB", 'COLOR')
yield ("Denoising Intensity", "X", 'VALUE')
clean_options = ("denoising_diffuse_direct", "denoising_diffuse_indirect",
"denoising_glossy_direct", "denoising_glossy_indirect",
"denoising_transmission_direct", "denoising_transmission_indirect")
if any(getattr(crl, option) for option in clean_options):
yield ("Denoising Clean", "RGB", 'COLOR')
# Custom AOV passes. # Custom AOV passes.
for aov in srl.aovs: for aov in srl.aovs:
if aov.type == 'VALUE': if aov.type == 'VALUE':
yield (aov.name, "X", 'VALUE') yield (aov.name, "X", 'VALUE')
else: else:
yield (aov.name, "RGB", 'COLOR') yield (aov.name, "RGBA", 'COLOR')
def register_passes(engine, scene, view_layer): def register_passes(engine, scene, view_layer):

View File

@@ -60,48 +60,32 @@ class AddPresetSampling(AddPresetBase, Operator):
] ]
preset_values = [ preset_values = [
"cycles.use_adaptive_sampling",
"cycles.samples", "cycles.samples",
"cycles.adaptive_threshold", "cycles.preview_samples",
"cycles.adaptive_min_samples", "cycles.aa_samples",
"cycles.time_limit", "cycles.preview_aa_samples",
"cycles.use_denoising", "cycles.diffuse_samples",
"cycles.denoiser", "cycles.glossy_samples",
"cycles.denoising_input_passes", "cycles.transmission_samples",
"cycles.denoising_prefilter", "cycles.ao_samples",
"cycles.mesh_light_samples",
"cycles.subsurface_samples",
"cycles.volume_samples",
"cycles.use_square_samples",
"cycles.progressive",
"cycles.seed",
"cycles.sample_clamp_direct",
"cycles.sample_clamp_indirect",
"cycles.sample_all_lights_direct",
"cycles.sample_all_lights_indirect",
] ]
preset_subdir = "cycles/sampling" preset_subdir = "cycles/sampling"
class AddPresetViewportSampling(AddPresetBase, Operator):
'''Add a Viewport Sampling Preset'''
bl_idname = "render.cycles_viewport_sampling_preset_add"
bl_label = "Add Viewport Sampling Preset"
preset_menu = "CYCLES_PT_viewport_sampling_presets"
preset_defines = [
"cycles = bpy.context.scene.cycles"
]
preset_values = [
"cycles.use_preview_adaptive_sampling",
"cycles.preview_samples",
"cycles.preview_adaptive_threshold",
"cycles.preview_adaptive_min_samples",
"cycles.use_preview_denoising",
"cycles.preview_denoiser",
"cycles.preview_denoising_input_passes",
"cycles.preview_denoising_prefilter",
"cycles.preview_denoising_start_sample",
]
preset_subdir = "cycles/viewport_sampling"
classes = ( classes = (
AddPresetIntegrator, AddPresetIntegrator,
AddPresetSampling, AddPresetSampling,
AddPresetViewportSampling,
) )

Some files were not shown because too many files have changed in this diff Show More