Compare commits

..

43 Commits

Author SHA1 Message Date
30f65b54a7 Merge branch 'master' into draw-colormanagement 2020-02-11 14:57:41 +01:00
9052c6fafa Fix crash when selecting in edit mode with eevee 2020-02-11 14:52:42 +01:00
a01e7d62c5 Style: Rename processor arguments in C api and glsl impl. 2020-02-11 14:52:09 +01:00
a9ad4c805e Add comment about UI color space 2020-02-11 13:21:31 +01:00
0db60af623 - Address reviewers comments 2020-02-11 01:49:06 +01:00
c7b319279e Merge branch 'master' into draw-colormanagement
# Conflicts:
#	source/blender/draw/engines/overlay/overlay_armature.c
2020-02-07 02:05:45 +01:00
863632e7e2 OCIO: Style fixes 2020-02-07 02:03:15 +01:00
61d66b528e Cleanup: Update comments & fix some style issues 2020-02-05 00:25:32 +01:00
c0675868a3 Overlay: Fix edit text overlay invert logic op not working
The result is still different as the inversion is done in scene refered
linear and not in sRGB space as it used to be.
2020-01-31 23:58:49 +01:00
f9914a8ef9 Overlay: Armature: Fix look regression because of linear space rendering
If rendering using linear color the blending of color is different.
So we compensate by using non linear mix of the color inside the shader and
modify color mixing on the cpu.
2020-01-31 19:40:56 +01:00
fe327c0970 Overlay: Put all colors inside draw_common.c for correct colormanagment.
The only exception is for text drawing where the color needs to be sRGB
bytes. This could be fixed in the future.

There are only two hardcoded values remaining but are rather not important:
- object center transform gizmo darkening.
- particle display default color.
2020-01-31 18:59:32 +01:00
691c6f94bb Cleanup: Workbench: Remove background code
We now use clear color to apply background color in render mode.
2020-01-31 04:21:56 +01:00
a7ac3a3ee3 Overlay: Support viewport background modes
Port code from Workbench.
2020-01-31 04:19:33 +01:00
711c4bba54 Cleanup: DRW: Remove unused code and redundant state changes 2020-01-31 04:18:28 +01:00
a3ee3b8f24 Overlay: Move Alt+B clipping bounds display from workbench to overlay 2020-01-29 04:10:55 +01:00
66e1ca26f0 Cleanup: OCIO: Remove immVertexFormat in GLSL implementation
This was only needed for cycles/external engines.
2020-01-28 02:25:52 +01:00
b180c8b847 Render API: Make external engine render in linear space for the viewport
This just replace the OCIO shader by a simple image shader without
color transformation.
2020-01-28 02:18:08 +01:00
089b55885c OCIO: Use GroupTransform to avoid doing 3 transforms instead of 2
This exposes OCIO::GroupTransform to C api to be able to chain the
display transform with a corrective transform to output display linear
colors.

For now the display code only use an exponent transform to go back to
linear but should use a ColorSpaceTransform once we have the correct
config.
2020-01-28 00:23:34 +01:00
5cab93d89f DRW: Remove drw_engines_draw_overlays routine
It makes no sense to have it separate now.
2020-01-27 01:28:41 +01:00
8de055452d Overlays: Fix wireframe shading not working 2020-01-27 01:24:58 +01:00
da240defef Overlay: Don't always allocate the antialiasing buffer and draw background...
...in the main overlay buffer.

This is required if we do caching in the future.
2020-01-26 21:36:46 +01:00
bef1c0d11e DRW: ColorManagement: Fix ghosting with cycles. 2020-01-26 21:08:30 +01:00
be68e89948 DRW: ColorManagement: Fix viewport render pipeline
The final output needs to be merged in another buffer. So we still use
the offscreen buffer for that.
2020-01-26 20:45:52 +01:00
5db185d1c4 GPUViewport: Fix image uv editor. 2020-01-26 17:33:19 +01:00
2616a0a9d6 GPUViewport: Add fallback colormanagment
Just assume sRGB display and no color correction.
2020-01-26 17:32:53 +01:00
adf98e6360 DRW: Move color management to the GPUViewport
This moves the colormanagement step at the blitting step of the viewport.
This means the overlay (including gizmos) must all be rendered in a
separate buffer (meaning they are more or less properly color managed).

The draw manager sets the display transform to apply to the GPUViewport.
2020-01-26 17:09:27 +01:00
419a818eec OCIO: Support overlay blending in linear colorspace in GLSL backend
This add the possibility for the caller to add an extra color texture
to composite on top of the main texture. The compositing is done in post
viewtransform linear space.

However, this means the caller needs to pass the proper color processor
to undo and apply the display transform.
2020-01-26 17:03:25 +01:00
281fb48440 DRW: Color Management: Rework code to accept new color transform needed 2020-01-25 01:11:04 +01:00
e18f0a4cfb Overlay: Add other background types (checker and gradient) 2020-01-24 19:24:04 +01:00
e9411b8ccf Overlay: Cleanup Image background implementation
The background images are now rendered normally on a cleared
canvas. They then get masked by the render when the background
is drawn with a special blend mode.
2020-01-24 18:08:20 +01:00
05dda64cf2 DRW: Color Management: Do some rearangement of the draw code
This puts the color management functions inside one file.

We group all post transform drawing into DRW_draw_callbacks_post_scene.
2020-01-24 16:23:51 +01:00
a25bb245e9 Overlay: Fix background covering the outline 2020-01-24 16:21:56 +01:00
34fd04f3b9 OCIO: Fix curve cache preventing curvemapping update 2020-01-23 01:57:37 +01:00
7d25c74615 DRW: Remove DrawEngineType draw_background function
This moves all background duties to the overlay engine which does alpha
under drawing (sort of).

This means keeping transparency info through the whole pipeline.

For now I just updated workbench which surely still need some cleanups.

Only Solid background is reimplemented.
2020-01-23 00:16:40 +01:00
a6bfab516e OCIO: Add back IMM hack
This is needed to avoid crash in some circumstances.
2020-01-23 00:01:44 +01:00
af37c863eb Cleanup: EEVEE: Remove alpha checker drawing
This will be ported to the overlay engine.
2020-01-22 19:36:34 +01:00
45dc1139e8 DRW: Move Color-Management handling to draw manager
This is first part of the color managmeent refactor.

The drawing of the overlays is done in a sRGB texture to retain some bits
of accuracy.

The transform is applied after the overlays blending for now.

There is much left to be done.
2020-01-22 19:36:34 +01:00
a23f7a85ca Cleanup: EEVEE: Move debug draw to eevee_renderpass.c 2020-01-22 19:36:34 +01:00
73f612fa3b GPU: Add sRGB framebuffer support
Only enable GL_FRAMEBUFFER_SRGB on framebuffer objects as the main
framebuffer is likely to be srgb, and as of now we don't use linear
color for area texture.
2020-01-22 19:36:34 +01:00
986ff34d1e GPUViewport: Cleanup and use always use RGBA16F 2020-01-22 19:36:34 +01:00
e00455381f Cleanup: OpenColorIO: Remove state tracking
Theses are useless. Better assume the state is has been changed.
2020-01-22 19:36:34 +01:00
fa010dddda DRW: Use Batch API instead of IMM for color managment
A little cleanup that should avoid some state changes and pipeline stall.
2020-01-22 19:36:34 +01:00
a0283355fc OpenColorIO: Improve/Cleanup Implementation
This split the shader cache into caches for Shader, Lut and CurveMapping.

This way we can have smoother updates when tweaking/animating the color
managment (i.e. exposure and gamma should only recompile the shader).

The curvemapping, predivide and dither options are no longer compile time
optimized but use uniforms. I did not measure any performance difference.
2020-01-22 19:36:34 +01:00
2168 changed files with 332501 additions and 377358 deletions

View File

@@ -1,7 +1,6 @@
{
"project_id" : "Blender",
"conduit_uri" : "https://developer.blender.org/",
"phabricator.uri" : "https://developer.blender.org/",
"git.default-relative-commit" : "origin/master",
"arc.land.update.default" : "rebase",
"arc.land.onto.default" : "master"

View File

@@ -180,15 +180,6 @@ option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
mark_as_advanced(WITH_SYSTEM_BULLET)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ON)
if(APPLE)
# There's no OpenXR runtime in sight for macOS, neither is code well
# tested there -> disable it by default.
option(WITH_XR_OPENXR "Enable VR features through the OpenXR specification" OFF)
mark_as_advanced(WITH_XR_OPENXR)
else()
# Disabled until there's more than just the build system stuff. Should be enabled soon.
option(WITH_XR_OPENXR "Enable VR features through the OpenXR specification" OFF)
endif()
# Compositor
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
@@ -501,8 +492,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
if(NOT MSVC)
find_library(COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
else()
find_library(
COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
find_library( COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
@@ -642,9 +632,6 @@ set_and_warn_dependency(WITH_TBB WITH_OPENIMAGEDENOISE OFF)
set_and_warn_dependency(WITH_TBB WITH_OPENVDB OFF)
set_and_warn_dependency(WITH_TBB WITH_MOD_FLUID OFF)
# OpenVDB uses 'half' type from OpenEXR & fails to link without OpenEXR enabled.
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENVDB OFF)
# auto enable openimageio for cycles
if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
@@ -911,28 +898,6 @@ if(NOT WITH_SYSTEM_EIGEN3)
set(EIGEN3_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/Eigen3)
endif()
if(WITH_OPENVDB)
list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB)
if(WITH_OPENVDB_3_ABI_COMPATIBLE)
list(APPEND OPENVDB_DEFINITIONS -DOPENVDB_3_ABI_COMPATIBLE)
endif()
list(APPEND OPENVDB_INCLUDE_DIRS
${BOOST_INCLUDE_DIR}
${TBB_INCLUDE_DIRS}
${OPENEXR_INCLUDE_DIRS})
list(APPEND OPENVDB_LIBRARIES ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
if(WITH_OPENVDB_BLOSC)
list(APPEND OPENVDB_DEFINITIONS -DWITH_OPENVDB_BLOSC)
list(APPEND OPENVDB_LIBRARIES ${BLOSC_LIBRARIES} ${ZLIB_LIBRARIES})
endif()
list(APPEND OPENVDB_LIBRARIES ${BOOST_LIBRARIES} ${TBB_LIBRARIES})
endif()
#-----------------------------------------------------------------------------
# Configure OpenGL.
@@ -1436,7 +1401,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
@@ -1455,8 +1419,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_COMMENT -Wno-comment)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNDEFINED_VAR_TEMPLATE -Wno-undefined-var-template)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_INSTANTIATION_AFTER_SPECIALIZATION -Wno-instantiation-after-specialization)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
@@ -1707,7 +1669,6 @@ if(FIRST_RUN)
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_FREESTYLE)
info_cfg_option(WITH_OPENCOLORIO)
info_cfg_option(WITH_XR_OPENXR)
info_cfg_option(WITH_OPENIMAGEDENOISE)
info_cfg_option(WITH_OPENVDB)
info_cfg_option(WITH_ALEMBIC)

View File

@@ -545,7 +545,7 @@ update: .FORCE
$(PYTHON) ./build_files/utils/make_update.py
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}/llvm/bin/:$(PATH)" \
$(PYTHON) source/tools/utils_maintenance/clang_format_paths.py $(PATHS)

View File

@@ -98,13 +98,15 @@ else()
include(cmake/pugixml.cmake)
endif()
include(cmake/openimagedenoise.cmake)
include(cmake/embree.cmake)
include(cmake/xr_openxr.cmake)
if(WITH_WEBP)
include(cmake/webp.cmake)
endif()
if(WITH_EMBREE)
include(cmake/embree.cmake)
endif()
if(WIN32)
# HMD branch deps
include(cmake/hidapi.cmake)

View File

@@ -44,7 +44,7 @@ if(WIN32)
elseif(APPLE)
set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh)
set(BOOST_BUILD_COMMAND ./b2)
set(BOOST_BUILD_OPTIONS toolset=darwin cxxflags=${PLATFORM_CXXFLAGS} linkflags=${PLATFORM_LDFLAGS} visibility=global --disable-icu boost.locale.icu=off)
set(BOOST_BUILD_OPTIONS toolset=darwin cxxflags=${PLATFORM_CXXFLAGS} linkflags=${PLATFORM_LDFLAGS} --disable-icu boost.locale.icu=off)
set(BOOST_HARVEST_CMD echo .)
set(BOOST_PATCH_COMMAND echo .)
else()

View File

@@ -161,8 +161,6 @@ harvest(opensubdiv/include opensubdiv/include "*.h")
harvest(opensubdiv/lib opensubdiv/lib "*.a")
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
harvest(openvdb/lib openvdb/lib "*.a")
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
harvest(xr_openxr_sdk/lib xr_openxr_sdk/src/loader "*.a")
harvest(osl/bin osl/bin "oslc")
harvest(osl/include osl/include "*.h")
harvest(osl/lib osl/lib "*.a")

View File

@@ -40,7 +40,6 @@ ExternalProject_Add(ll
URL_HASH MD5=${LLVM_HASH}
CMAKE_GENERATOR ${LLVM_GENERATOR}
PREFIX ${BUILD_DIR}/ll
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/ll/src/ll < ${PATCH_DIR}/llvm.diff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/llvm ${DEFAULT_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/llvm
)

View File

@@ -20,6 +20,7 @@ if(WIN32)
option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/lapack/fftw3 by installing mingw64" ON)
endif()
option(WITH_WEBP "Enable building of oiio with webp support" OFF)
option(WITH_EMBREE "Enable building of Embree" OFF)
set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with")
if(NOT BUILD_MODE)

View File

@@ -73,7 +73,6 @@ set(OSL_EXTRA_ARGS
-DSTOP_ON_WARNING=OFF
-DUSE_LLVM_BITCODE=OFF
-DUSE_PARTIO=OFF
-DUSE_QT=OFF
${OSL_SIMD_FLAGS}
-DPARTIO_LIBRARIES=
)

View File

@@ -43,7 +43,7 @@ if(WIN32)
PREFIX ${BUILD_DIR}/python
CONFIGURE_COMMAND ""
BUILD_COMMAND cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && call build.bat -e -p ${PYTHON_ARCH} -c ${BUILD_MODE}
INSTALL_COMMAND ${PYTHON_BINARY_INTERNAL} ${PYTHON_SRC}/PC/layout/main.py -b ${PYTHON_SRC}/PCbuild/amd64 -s ${PYTHON_SRC} -t ${PYTHON_SRC}/tmp/ --include-underpth --include-stable --include-pip --include-dev --include-launchers --include-venv --include-symbols ${PYTHON_EXTRA_INSTLAL_FLAGS} --copy ${LIBDIR}/python
INSTALL_COMMAND ${PYTHON_BINARY_INTERNAL} ${PYTHON_SRC}/PC/layout/main.py -b ${PYTHON_SRC}/PCbuild/amd64 -s ${PYTHON_SRC} -t ${PYTHON_SRC}/tmp/ --include-underpth --include-stable --include-pip --include-dev --include-launchers --include-symbols ${PYTHON_EXTRA_INSTLAL_FLAGS} --copy ${LIBDIR}/python
)
else()

View File

@@ -299,9 +299,9 @@ set(SQLITE_VERSION 3.24.0)
set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
set(EMBREE_VERSION 3.8.0)
set(EMBREE_VERSION 3.2.4)
set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
set(EMBREE_HASH ac504d5426945fe25dec1267e0c39d52)
set(EMBREE_HASH 3d4a1147002ff43939d45140aa9d6fb8)
set(USD_VERSION 19.11)
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
@@ -318,7 +318,3 @@ set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3)
set(MESA_VERSION 18.3.1)
set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa//mesa-${MESA_VERSION}.tar.xz)
set(MESA_HASH d60828056d77bfdbae0970f9b15fb1be)
set(XR_OPENXR_SDK_VERSION 1.0.6)
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(XR_OPENXR_SDK_HASH 21daea7c3bfec365298d779a0e19caa1)

View File

@@ -1,58 +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 *****
# Keep flags in sync with install_deps.sh ones in compile_XR_OpenXR_SDK()
set(XR_OPENXR_SDK_EXTRA_ARGS
-DBUILD_FORCE_GENERATION=OFF
-DBUILD_LOADER=ON
-DDYNAMIC_LOADER=OFF
)
if(UNIX AND NOT APPLE)
list(APPEND XR_OPENXR_SDK_EXTRA_ARGS
-DBUILD_WITH_WAYLAND_HEADERS=OFF
-DBUILD_WITH_XCB_HEADERS=OFF
-DBUILD_WITH_XLIB_HEADERS=ON
)
endif()
ExternalProject_Add(external_xr_openxr_sdk
URL ${XR_OPENXR_SDK_URI}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH MD5=${XR_OPENXR_SDK_HASH}
PREFIX ${BUILD_DIR}/xr_openxr_sdk
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/xr_openxr_sdk ${DEFAULT_CMAKE_FLAGS} ${XR_OPENXR_SDK_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/xr_openxr_sdk
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_xr_openxr_sdk after_install
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/xr_openxr_sdk/include/openxr ${HARVEST_TARGET}/xr_openxr_sdk/include/openxr
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/xr_openxr_sdk/lib ${HARVEST_TARGET}/xr_openxr_sdk/lib
DEPENDEES install
)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_xr_openxr_sdk after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/xr_openxr_sdk/lib/openxr_loader.lib ${HARVEST_TARGET}/xr_openxr_sdk/lib/openxr_loader_d.lib
DEPENDEES install
)
endif()
endif()

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +0,0 @@
# Files contains mixed line endings, patch needs to preserve them to apply.
opencollada.diff binary

View File

@@ -26,8 +26,8 @@ include(FindPackageMessage)
include(SelectLibraryConfigurations)
if(ILMBASE_USE_STATIC_LIBS)
set(_ilmbase_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if( ILMBASE_USE_STATIC_LIBS )
set( _ilmbase_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
@@ -247,7 +247,7 @@ if(ILMBASE_FOUND)
endif()
# Restore the original find library ordering
if(ILMBASE_USE_STATIC_LIBS )
if( ILMBASE_USE_STATIC_LIBS )
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ilmbase_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()

View File

@@ -230,7 +230,7 @@ if(OPENEXR_FOUND)
endif()
# Restore the original find library ordering
if(OPENEXR_USE_STATIC_LIBS )
if( OPENEXR_USE_STATIC_LIBS )
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openexr_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()

View File

@@ -1,13 +0,0 @@
--- a/lib/Support/Unix/Path.inc 2020-02-17 09:24:26.000000000 +0100
+++ b/lib/Support/Unix/Path.inc 2020-02-17 09:26:25.000000000 +0100
@@ -1200,7 +1200,9 @@
/// implementation.
std::error_code copy_file(const Twine &From, const Twine &To) {
uint32_t Flag = COPYFILE_DATA;
-#if __has_builtin(__builtin_available) && defined(COPYFILE_CLONE)
+ // BLENDER: This optimization makes LLVM not build on older Xcode versions,
+ // just disable until everyone has new enough Xcode versions.
+#if 0
if (__builtin_available(macos 10.12, *)) {
bool IsSymlink;
if (std::error_code Error = is_symlink_file(From, IsSymlink))

View File

@@ -3,32 +3,19 @@ index 95abbe2..4f14f30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -254,11 +254,11 @@ if(USE_STATIC_MSVC_RUNTIME)
endif()
#adding PCRE
-find_package(PCRE)
+#find_package(PCRE)
if (PCRE_FOUND)
message(STATUS "SUCCESSFUL: PCRE found")
else () # if pcre not found building its local copy from ./Externals
- if (WIN32 OR APPLE)
+ if (1)
message("WARNING: Native PCRE not found, taking PCRE from ./Externals")
add_definitions(-DPCRE_STATIC)
add_subdirectory(${EXTERNAL_LIBRARIES}/pcre)
diff --git a/DAEValidator/CMakeLists.txt b/DAEValidator/CMakeLists.txt
index 03ad540..f7d05cf 100644
--- a/DAEValidator/CMakeLists.txt
+++ b/DAEValidator/CMakeLists.txt
@@ -98,7 +98,7 @@ if (WIN32)
# C4710: 'function' : function not inlined
# C4711: function 'function' selected for inline expansion
# C4820: 'bytes' bytes padding added after construct 'member_name'
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall /WX /wd4505 /wd4514 /wd4592 /wd4710 /wd4711 /wd4820")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall /wd4505 /wd4514 /wd4592 /wd4710 /wd4711 /wd4820")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
endif ()
endif()
#adding PCRE
-find_package(PCRE)
+#find_package(PCRE)
if (PCRE_FOUND)
message(STATUS "SUCCESSFUL: PCRE found")
else () # if pcre not found building its local copy from ./Externals
- if (WIN32 OR APPLE)
+ if (1)
message("WARNING: Native PCRE not found, taking PCRE from ./Externals")
add_definitions(-DPCRE_STATIC)
add_subdirectory(${EXTERNAL_LIBRARIES}/pcre)
diff --git a/DAEValidator/library/include/no_warning_begin b/DAEValidator/library/include/no_warning_begin
index 7a69c32..defb315 100644
--- a/DAEValidator/library/include/no_warning_begin
@@ -43,8 +30,34 @@ index 7a69c32..defb315 100644
# if defined(_MSC_VER) && defined(_DEBUG)
# pragma warning(disable:4548)
# endif
diff --git a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
index 1f9a3ee..d151e9a 100644
--- a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
+++ b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
@@ -1553,7 +1553,7 @@ namespace GeneratedSaxParser
#if defined(COLLADABU_OS_WIN) && !defined(__MINGW32__)
return _isnan( value ) ? true : false;
#else
-#ifdef isnan
+#if defined(isnan) || defined(__APPLE__)
return isnan( value );
#else
return std::isnan(value);
diff --git a/DAEValidator/CMakeLists.txt b/DAEValidator/CMakeLists.txt
index 03ad540f..f7d05cfb 100644
--- a/DAEValidator/CMakeLists.txt
+++ b/DAEValidator/CMakeLists.txt
@@ -98,7 +98,7 @@ if (WIN32)
# C4710: 'function' : function not inlined
# C4711: function 'function' selected for inline expansion
# C4820: 'bytes' bytes padding added after construct 'member_name'
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall /WX /wd4505 /wd4514 /wd4592 /wd4710 /wd4711 /wd4820")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /Wall /wd4505 /wd4514 /wd4592 /wd4710 /wd4711 /wd4820")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
endif ()
diff --git a/DAEValidator/library/src/ArgumentParser.cpp b/DAEValidator/library/src/ArgumentParser.cpp
index 897e4dc..98a69ff 100644
index 897e4dcf..98a69ff1 100644
--- a/DAEValidator/library/src/ArgumentParser.cpp
+++ b/DAEValidator/library/src/ArgumentParser.cpp
@@ -6,10 +6,10 @@
@@ -61,28 +74,14 @@ index 897e4dc..98a69ff 100644
#endif
namespace opencollada
diff --git a/Externals/LibXML/CMakeLists.txt b/Externals/LibXML/CMakeLists.txt
index 40081e7..e1d1bfa 100644
--- a/Externals/LibXML/CMakeLists.txt
+++ b/Externals/LibXML/CMakeLists.txt
@@ -9,6 +9,7 @@ add_definitions(
-DLIBXML_SCHEMAS_ENABLED
-DLIBXML_XPATH_ENABLED
-DLIBXML_TREE_ENABLED
+ -DLIBXML_STATIC
)
if(USE_STATIC_MSVC_RUNTIME)
diff --git a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
index 1f9a3ee..d151e9a 100644
--- a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
+++ b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
@@ -1553,7 +1553,7 @@ namespace GeneratedSaxParser
#if defined(COLLADABU_OS_WIN) && !defined(__MINGW32__)
return _isnan( value ) ? true : false;
#else
-#ifdef isnan
+#if defined(isnan) || defined(__APPLE__)
return isnan( value );
#else
return std::isnan(value);
diff -Naur orig/Externals/LibXML/CMakeLists.txt external_opencollada/Externals/LibXML/CMakeLists.txt
--- orig/Externals/LibXML/CMakeLists.txt 2018-11-26 15:43:10 -0700
+++ external_opencollada/Externals/LibXML/CMakeLists.txt 2020-01-21 14:15:04 -0700
@@ -9,6 +9,7 @@
-DLIBXML_SCHEMAS_ENABLED
-DLIBXML_XPATH_ENABLED
-DLIBXML_TREE_ENABLED
+ -DLIBXML_STATIC
)
if(USE_STATIC_MSVC_RUNTIME)

View File

@@ -70,64 +70,9 @@ class ArchiveWithIndicator:
self.archive_filepath = self.base_dir / archive_name
self.ready_indicator_filepath = self.base_dir / ready_indicator_name
def is_ready_unsafe(self) -> bool:
"""
Check whether the archive is ready for access.
No guarding about possible network failres is done here.
"""
if not self.ready_indicator_filepath.exists():
return False
# Sometimes on macOS indicator file appears prior to the actual archive
# despite the order of creation and os.sync() used in tag_ready().
# So consider archive not ready if there is an indicator without an
# actual archive.
if not self.archive_filepath.exists():
print('Found indicator without actual archive, waiting for archive '
f'({self.archive_filepath}) to appear.')
return False
# Read archive size from indicator/
#
# Assume that file is either empty or is fully written. This is being checked
# by performing ValueError check since empty string will throw this exception
# when attempted to be converted to int.
expected_archive_size_str = self.ready_indicator_filepath.read_text()
try:
expected_archive_size = int(expected_archive_size_str)
except ValueError:
print(f'Invalid archive size "{expected_archive_size_str}"')
return False
# Wait for until archive is fully stored.
actual_archive_size = self.archive_filepath.stat().st_size
if actual_archive_size != expected_archive_size:
print('Partial/invalid archive size (expected '
f'{expected_archive_size} got {actual_archive_size})')
return False
return True
def is_ready(self) -> bool:
"""
Check whether the archive is ready for access.
Will tolerate possible network failures: if there is a network failure
or if there is still no proper permission on a file False is returned.
"""
# There are some intermitten problem happening at a random which is
# translates to "OSError : [WinError 59] An unexpected network error occurred".
# Some reports suggests it might be due to lack of permissions to the file,
# which might be applicable in our case since it's possible that file is
# initially created with non-accessible permissions and gets chmod-ed
# after initial creation.
try:
return self.is_ready_unsafe()
except OSError as e:
print(f'Exception checking archive: {e}')
return False
"""Check whether the archive is ready for access."""
return self.ready_indicator_filepath.exists()
def tag_ready(self) -> None:
"""
@@ -143,8 +88,7 @@ class ArchiveWithIndicator:
# an actual file.
if util.get_current_platform() != util.Platform.WINDOWS:
os.sync()
archive_size = self.archive_filepath.stat().st_size
self.ready_indicator_filepath.write_text(str(archive_size))
self.ready_indicator_filepath.touch()
def clean(self) -> None:
"""

View File

@@ -326,9 +326,6 @@ class BaseCodeSigner(metaclass=abc.ABCMeta):
self.copy_signed_files_to_directory(
unpacked_signed_files_dir, destination_dir)
logger_builder.info('Removing archive with signed files...')
self.signed_archive_info.clean()
############################################################################
# Signing server side helpers.

View File

@@ -40,5 +40,5 @@ execute_process(
)
if(NOT exit_code EQUAL "0")
message(FATAL_ERROR "Non-zero exit code of codesign tool")
message( FATAL_ERROR "Non-zero exit code of codesign tool")
endif()

View File

@@ -49,7 +49,6 @@ if(NOT LLVM_ROOT_DIR)
OUTPUT_VARIABLE LLVM_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(LLVM_ROOT_DIR ${LLVM_ROOT_DIR} CACHE PATH "Path to the LLVM installation")
set(LLVM_INCLUDE_DIRS ${LLVM_ROOT_DIR}/include CACHE PATH "Path to the LLVM include directory")
endif()
if(NOT LLVM_LIBPATH)
execute_process(COMMAND ${LLVM_CONFIG} --libdir

View File

@@ -66,22 +66,6 @@ FIND_PROGRAM(OSL_COMPILER oslc
HINTS ${_osl_SEARCH_DIRS}
PATH_SUFFIXES bin)
get_filename_component(OSL_SHADER_HINT ${OSL_COMPILER} DIRECTORY)
get_filename_component(OSL_SHADER_HINT ${OSL_SHADER_DIR}/../ ABSOLUTE)
FIND_PATH(OSL_SHADER_DIR
NAMES
stdosl.h
HINTS
${OSL_ROOT_DIR}
${OSL_SHADER_HINT}
$ENV{OSLHOME}
/usr/share/OSL/
/usr/include/OSL/
PATH_SUFFIXES
shaders
)
# handle the QUIETLY and REQUIRED arguments and set OSL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)

View File

@@ -1,73 +0,0 @@
# - Find OpenXR-SDK libraries
# Find the native OpenXR-SDK includes and libraries
#
# Note that there is a distinction between the OpenXR standard and the SDK. The
# latter provides utilities to use the standard but is not part of it. Most
# importantly, it contains C headers and a loader library, which manages
# dynamic linking to OpenXR runtimes like Monado, Windows Mixed Reality or
# Oculus. See the repository for more details:
# https://github.com/KhronosGroup/OpenXR-SDK
#
# This module defines
# XR_OPENXR_SDK_INCLUDE_DIRS, where to find OpenXR-SDK headers, Set when
# XR_OPENXR_SDK_INCLUDE_DIR is found.
# XR_OPENXR_SDK_LIBRARIES, libraries to link against to use OpenXR.
# XR_OPENXR_SDK_ROOT_DIR, the base directory to search for OpenXR-SDK.
# This can also be an environment variable.
# XR_OPENXR_SDK_FOUND, if false, do not try to use OpenXR-SDK.
#
# also defined, but not for general use are
# XR_OPENXR_SDK_LOADER_LIBRARY, where to find the OpenXR-SDK loader library.
#=============================================================================
# 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 XR_OPENXR_SDK_ROOT_DIR was defined in the environment, use it.
IF(NOT XR_OPENXR_SDK_ROOT_DIR AND NOT $ENV{XR_OPENXR_SDK_ROOT_DIR} STREQUAL "")
SET(XR_OPENXR_SDK_ROOT_DIR $ENV{XR_OPENXR_SDK_ROOT_DIR})
ENDIF()
SET(_xr_openxr_sdk_SEARCH_DIRS
${XR_OPENXR_SDK_ROOT_DIR}
/opt/lib/xr-openxr-sdk
)
FIND_PATH(XR_OPENXR_SDK_INCLUDE_DIR
NAMES
openxr/openxr.h
HINTS
${_xr_openxr_sdk_SEARCH_DIRS}
PATH_SUFFIXES
include
)
FIND_LIBRARY(XR_OPENXR_SDK_LOADER_LIBRARY
NAMES
openxr_loader
HINTS
${_xr_openxr_sdk_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# handle the QUIETLY and REQUIRED arguments and set XR_OPENXR_SDK_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XR_OPENXR_SDK DEFAULT_MSG
XR_OPENXR_SDK_LOADER_LIBRARY XR_OPENXR_SDK_INCLUDE_DIR)
IF(XR_OPENXR_SDK_FOUND)
SET(XR_OPENXR_SDK_LIBRARIES ${XR_OPENXR_SDK_LOADER_LIBRARY})
SET(XR_OPENXR_SDK_INCLUDE_DIRS ${XR_OPENXR_SDK_INCLUDE_DIR})
ENDIF(XR_OPENXR_SDK_FOUND)
MARK_AS_ADVANCED(
XR_OPENXR_SDK_INCLUDE_DIR
XR_OPENXR_SDK_LOADER_LIBRARY
)

View File

@@ -63,9 +63,6 @@ macro(BLENDER_SRC_GTEST_EX)
if(WITH_OPENMP_STATIC)
target_link_libraries(${TARGET_NAME} ${OpenMP_LIBRARIES})
endif()
if(UNIX AND NOT APPLE)
target_link_libraries(${TARGET_NAME} bf_intern_libc_compat)
endif()
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(GENERATOR_IS_MULTI_CONFIG)

View File

@@ -61,6 +61,3 @@ if(UNIX AND NOT APPLE)
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
endif()
if(NOT APPLE)
set(WITH_XR_OPENXR ON CACHE BOOL "" FORCE)
endif()

View File

@@ -6,6 +6,7 @@
#
set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
set(WITH_SYSTEM_GLEW ON CACHE BOOL "" FORCE)
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
set(WITH_BOOST OFF CACHE BOOL "" FORCE)
@@ -44,7 +45,6 @@ set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEDENOISE OFF CACHE BOOL "" FORCE)
set(WITH_XR_OPENXR OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)

View File

@@ -65,6 +65,3 @@ if(UNIX AND NOT APPLE)
set(WITH_X11_XINPUT ON CACHE BOOL "" FORCE)
set(WITH_X11_XF86VMODE ON CACHE BOOL "" FORCE)
endif()
if(NOT APPLE)
set(WITH_XR_OPENXR ON CACHE BOOL "" FORCE)
endif()

View File

@@ -45,7 +45,3 @@ elseif(APPLE)
# OpenMP causes linking error on build, disable.
set(WITH_MEM_JEMALLOC OFF CACHE BOOL "" FORCE)
endif()
if(WIN32)
set(WITH_WINDOWS_BUNDLE_CRT OFF CACHE BOOL "" FORCE)
endif()

View File

@@ -122,7 +122,7 @@ function(target_link_libraries_optimized
)
foreach(_LIB ${LIBS})
target_link_libraries(${TARGET} INTERFACE optimized "${_LIB}")
target_link_libraries(${TARGET} optimized "${_LIB}")
endforeach()
endfunction()
@@ -132,7 +132,7 @@ function(target_link_libraries_debug
)
foreach(_LIB ${LIBS})
target_link_libraries(${TARGET} INTERFACE debug "${_LIB}")
target_link_libraries(${TARGET} debug "${_LIB}")
endforeach()
endfunction()
@@ -170,7 +170,6 @@ function(blender_include_dirs_sys
endfunction()
function(blender_source_group
name
sources
)
@@ -206,13 +205,6 @@ function(blender_source_group
source_group("${GROUP_ID}" FILES ${_SRC})
endforeach()
endif()
# if enabled, set the FOLDER property for visual studio projects
if(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
set_target_properties(${name} PROPERTIES FOLDER ${FolderDir})
endif()
endfunction()
@@ -303,11 +295,11 @@ function(blender_add_lib__impl
set(next_library_mode "${library_lower}")
else()
if("${next_library_mode}" STREQUAL "optimized")
target_link_libraries(${name} INTERFACE optimized ${library})
target_link_libraries(${name} optimized ${library})
elseif("${next_library_mode}" STREQUAL "debug")
target_link_libraries(${name} INTERFACE debug ${library})
target_link_libraries(${name} debug ${library})
else()
target_link_libraries(${name} INTERFACE ${library})
target_link_libraries(${name} ${library})
endif()
set(next_library_mode "")
endif()
@@ -316,7 +308,14 @@ function(blender_add_lib__impl
# works fine without having the includes
# listed is helpful for IDE's (QtCreator/MSVC)
blender_source_group("${name}" "${sources}")
blender_source_group("${sources}")
# if enabled, set the FOLDER property for visual studio projects
if(WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS)
get_filename_component(FolderDir ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
string(REPLACE ${CMAKE_SOURCE_DIR} "" FolderDir ${FolderDir})
set_target_properties(${name} PROPERTIES FOLDER ${FolderDir})
endif()
list_assert_duplicates("${sources}")
list_assert_duplicates("${includes}")
@@ -947,7 +946,7 @@ function(data_to_c_simple
set_source_files_properties(${_file_to} PROPERTIES GENERATED TRUE)
endfunction()
# Function for converting pixmap directory to a '.png' and then a '.c' file.
# macro for converting pixmap directory to a png and then a c file
function(data_to_c_simple_icons
path_from icon_prefix icon_names
list_to_add
@@ -1139,8 +1138,8 @@ endmacro()
macro(blender_precompile_headers target cpp header)
if(MSVC)
# get the name for the pch output file
get_filename_component(pchbase ${cpp} NAME_WE)
set(pchfinal "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${pchbase}.pch")
get_filename_component( pchbase ${cpp} NAME_WE )
set( pchfinal "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${pchbase}.pch" )
# mark the cpp as the one outputting the pch
set_property(SOURCE ${cpp} APPEND PROPERTY OBJECT_OUTPUTS "${pchfinal}")
@@ -1160,18 +1159,11 @@ macro(blender_precompile_headers target cpp header)
endmacro()
macro(set_and_warn_dependency
_dependency _setting _val)
# when $_dependency is disabled, forces $_setting = $_val
if(NOT ${${_dependency}} AND ${${_setting}})
message(STATUS "'${_dependency}' is disabled: forcing 'set(${_setting} ${_val})'")
set(${_setting} ${_val})
endif()
_dependency _setting _val)
# when $_dependency is disabled, forces $_setting = $_val
if(NOT ${${_dependency}} AND ${${_setting}})
message(STATUS "'${_dependency}' is disabled: forcing 'set(${_setting} ${_val})'")
set(${_setting} ${_val})
endif()
endmacro()
macro(without_system_libs_begin)
set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
endmacro()
macro(without_system_libs_end)
unset(CMAKE_IGNORE_PATH)
endmacro()

View File

@@ -381,7 +381,7 @@ if(WITH_CYCLES_OSL)
endif()
if(WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)
find_package(Embree 3.2.4 REQUIRED)
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000")
endif()
@@ -411,21 +411,11 @@ if(WITH_OPENMP)
# Copy libomp.dylib to allow executables like datatoc and tests to work.
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
)
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/Resources/lib
COMMAND cp -p ${LIBDIR}/openmp/lib/libomp.dylib ${CMAKE_BINARY_DIR}/Resources/lib/libomp.dylib)
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
)
endif()
endif()
if(WITH_XR_OPENXR)
find_package(OpenXR-SDK)
if(NOT OPENXR_SDK_FOUND)
message(WARNING "OpenXR-SDK was not found, disabling WITH_XR_OPENXR")
set(WITH_XR_OPENXR OFF)
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)
endif()
endif()

View File

@@ -104,7 +104,7 @@ else()
endif()
if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
# Force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else (CMake bug?)
# force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else ( cmake bug ? )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")

View File

@@ -72,21 +72,26 @@ macro(find_package_wrapper)
endif()
endmacro()
# ----------------------------------------------------------------------------
# Precompiled Libraries
#
# These are libraries that may be precompiled. For this we disable searching in
# the system directories so that we don't accidentally use them instead.
if(EXISTS ${LIBDIR})
without_system_libs_begin()
endif()
find_package_wrapper(JPEG REQUIRED)
find_package_wrapper(PNG REQUIRED)
find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Freetype REQUIRED)
if(WITH_LZO AND WITH_SYSTEM_LZO)
find_package_wrapper(LZO)
if(NOT LZO_FOUND)
message(FATAL_ERROR "Failed finding system LZO version!")
endif()
endif()
if(WITH_SYSTEM_EIGEN3)
find_package_wrapper(Eigen3)
if(NOT EIGEN3_FOUND)
message(FATAL_ERROR "Failed finding system Eigen3 version!")
endif()
endif()
# else values are set below for all platforms
if(WITH_PYTHON)
# No way to set py35, remove for now.
# find_package(PythonLibs)
@@ -121,6 +126,14 @@ if(WITH_IMAGE_TIFF)
endif()
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
find_package_wrapper(Audaspace)
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
message(FATAL_ERROR "Audaspace external library not found!")
endif()
endif()
if(WITH_OPENAL)
find_package_wrapper(OpenAL)
if(NOT OPENAL_FOUND)
@@ -153,6 +166,13 @@ if(WITH_SDL)
endif()
endif()
if(WITH_JACK)
find_package_wrapper(Jack)
if(NOT JACK_FOUND)
set(WITH_JACK OFF)
endif()
endif()
# Codecs
if(WITH_CODEC_SNDFILE)
find_package_wrapper(SndFile)
@@ -373,7 +393,7 @@ if(WITH_OPENCOLORIO)
endif()
if(WITH_CYCLES_EMBREE)
find_package(Embree 3.8.0 REQUIRED)
find_package(Embree 3.2.4 REQUIRED)
endif()
if(WITH_OPENIMAGEDENOISE)
@@ -428,21 +448,6 @@ if(WITH_TBB)
find_package_wrapper(TBB)
endif()
if(WITH_XR_OPENXR)
find_package(XR-OpenXR-SDK)
if(NOT XR_OPENXR_SDK_FOUND)
message(WARNING "OpenXR-SDK not found, disabling WITH_XR_OPENXR")
set(WITH_XR_OPENXR OFF)
endif()
endif()
if(EXISTS ${LIBDIR})
without_system_libs_end()
endif()
# ----------------------------------------------------------------------------
# Build and Link Flags
# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
if(HAIKU)
list(APPEND PLATFORM_LINKLIBS -lnetwork)
@@ -475,36 +480,6 @@ add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
#
# Keep last, so indirectly linked libraries don't override our own pre-compiled libs.
if(WITH_LZO AND WITH_SYSTEM_LZO)
find_package_wrapper(LZO)
if(NOT LZO_FOUND)
message(FATAL_ERROR "Failed finding system LZO version!")
endif()
endif()
if(WITH_SYSTEM_EIGEN3)
find_package_wrapper(Eigen3)
if(NOT EIGEN3_FOUND)
message(FATAL_ERROR "Failed finding system Eigen3 version!")
endif()
endif()
# Jack is intended to use the system library.
if(WITH_JACK)
find_package_wrapper(Jack)
if(NOT JACK_FOUND)
set(WITH_JACK OFF)
endif()
endif()
# Audio IO
if(WITH_SYSTEM_AUDASPACE)
find_package_wrapper(Audaspace)
if(NOT AUDASPACE_FOUND OR NOT AUDASPACE_C_FOUND)
message(FATAL_ERROR "Audaspace external library not found!")
endif()
endif()
if(WITH_X11)
find_package(X11 REQUIRED)

View File

@@ -144,14 +144,6 @@ else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd /MP /bigobj")
endif()
# C++ standards conformace (/permissive-) is available on msvc 15.5 (1912) and up
if(MSVC_VERSION GREATER 1911 AND NOT MSVC_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive-")
# Two-phase name lookup does not place nicely with OpenMP yet, so disable for now
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:twoPhase-")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /ZI")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd /ZI")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
@@ -504,7 +496,7 @@ if(WITH_OPENVDB)
set(OPENVDB_LIBPATH ${OPENVDB}/lib)
set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
set(OPENVDB_LIBRARIES optimized ${OPENVDB_LIBPATH}/openvdb.lib debug ${OPENVDB_LIBPATH}/openvdb_d.lib ${BLOSC_LIBRARIES})
set(OPENVDB_DEFINITIONS -DNOMINMAX -DOPENVDB_STATICLIB -D_USE_MATH_DEFINES)
set(OPENVDB_DEFINITIONS -DNOMINMAX)
endif()
if(WITH_OPENIMAGEDENOISE)
@@ -607,7 +599,7 @@ endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
set(OSL_SHADER_DIR ${CYCLES_OSL}/shaders)
find_library(OSL_LIB_EXEC NAMES oslexec PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib)
find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
@@ -671,8 +663,8 @@ if(WITH_USD)
set(USD_DEBUG_LIB ${LIBDIR}/usd/lib/libusd_m_d.lib)
set(USD_LIBRARY_DIR ${LIBDIR}/usd/lib/usd)
set(USD_LIBRARIES
debug ${USD_DEBUG_LIB}
optimized ${USD_RELEASE_LIB}
debug ${USD_DEBUG_LIB}
optimized ${USD_RELEASE_LIB}
)
endif()
endif()
@@ -713,15 +705,3 @@ if(WINDOWS_PYTHON_DEBUG)
</Project>")
endif()
endif()
if(WITH_XR_OPENXR)
if(EXISTS ${LIBDIR}/xr_openxr_sdk)
set(XR_OPENXR_SDK ${LIBDIR}/xr_openxr_sdk)
set(XR_OPENXR_SDK_LIBPATH ${LIBDIR}/xr_openxr_sdk/lib)
set(XR_OPENXR_SDK_INCLUDE_DIR ${XR_OPENXR_SDK}/include)
set(XR_OPENXR_SDK_LIBRARIES optimized ${XR_OPENXR_SDK_LIBPATH}/openxr_loader.lib debug ${XR_OPENXR_SDK_LIBPATH}/openxr_loader_d.lib)
else()
message(WARNING "OpenXR-SDK was not found, disabling WITH_XR_OPENXR")
set(WITH_XR_OPENXR OFF)
endif()
endif()

View File

@@ -34,9 +34,6 @@ if "%VS_InstallDir%"=="" (
set VCVARS=%VS_InstallDir%\VC\Auxiliary\Build\vcvarsall.bat
if exist "%VCVARS%" (
if NOT "%verbose%" == "" (
echo calling "%VCVARS%" %BUILD_ARCH%
)
call "%VCVARS%" %BUILD_ARCH%
) else (
if NOT "%verbose%" == "" (
@@ -46,9 +43,6 @@ if exist "%VCVARS%" (
)
rem try msbuild
if NOT "%verbose%" == "" (
echo Testing for MSBuild
)
msbuild /version > NUL
if errorlevel 1 (
if NOT "%verbose%" == "" (
@@ -62,9 +56,6 @@ if NOT "%verbose%" == "" (
)
REM try the c++ compiler
if NOT "%verbose%" == "" (
echo Testing for the C/C++ Compiler
)
cl 2> NUL 1>&2
if errorlevel 1 (
if NOT "%verbose%" == "" (

View File

@@ -1,44 +0,0 @@
"""
The message bus system can be used to receive notifications when properties of
Blender datablocks are changed via the data API.
Limitations
-----------
The message bus system is triggered by updates via the RNA system. This means
that the following updates will result in a notification on the message bus:
- Changes via the Python API, for example ``some_object.location.x += 3``.
- Changes via the sliders, fields, and buttons in the user interface.
The following updates do **not** trigger message bus notifications:
- Moving objects in the 3D Viewport.
- Changes performed by the animation system.
Example Use
-----------
Below is an example of subscription to changes in the active object's location.
"""
import bpy
# Any Python object can act as the subscription's owner.
owner = object()
subscribe_to = bpy.context.object.location
def msgbus_callback(*args):
# This will print:
# Something changed! (1, 2, 3)
print("Something changed!", args)
bpy.msgbus.subscribe_rna(
key=subscribe_to,
owner=owner,
args=(1, 2, 3),
notify=msgbus_callback,
)

View File

@@ -1,6 +0,0 @@
"""
Some properties are converted to Python objects when you retrieve them. This
needs to be avoided in order to create the subscription, by using
``datablock.path_resolve("property_name", False)``:
"""
subscribe_to = bpy.context.object.path_resolve("name", False)

View File

@@ -1,5 +0,0 @@
"""
It is also possible to create subscriptions on a property of all instances of a
certain type:
"""
subscribe_to = (bpy.types.Object, "location")

View File

@@ -6,7 +6,7 @@ bl_info = {
"location": "SpaceBar Search -> Add-on Preferences Example",
"description": "Example Add-on",
"warning": "",
"doc_url": "",
"wiki_url": "",
"tracker_url": "",
"category": "Object",
}

View File

@@ -22,7 +22,7 @@ offers a set of extensive examples, including advanced features.
.. note::
You can use the :class:`Image` type to load and set textures.
See :class:`Image.gl_load` and :class:`Image.gl_free`,
See :class:`Image.gl_load` and :class:`Image.gl_load`,
for example.

View File

@@ -255,9 +255,9 @@ Examples:
>>> bpy.ops.object.scale_apply()
{'FINISHED'}
.. tip::
.. note::
The :ref:`Operator Cheat Sheet <blender_manual:bpy.ops.wm.operator_cheat_sheet>`.
The menu item: :menuselection:`Help --> Operator Cheat Sheet`
gives a list of all operators and their default values in Python syntax, along with the generated docs.
This is a good way to get an overview of all Blender's operators.

View File

@@ -223,7 +223,6 @@ else:
"aud",
"bgl",
"blf",
"imbuf",
"bmesh",
"bmesh.ops",
"bmesh.types",
@@ -1756,7 +1755,6 @@ def write_rst_contents(basepath):
app_modules = (
"bpy.context", # note: not actually a module
"bpy.data", # note: not actually a module
"bpy.msgbus", # note: not actually a module
"bpy.ops",
"bpy.types",
@@ -1781,7 +1779,7 @@ def write_rst_contents(basepath):
standalone_modules = (
# submodules are added in parent page
"mathutils", "freestyle", "bgl", "blf", "imbuf", "gpu", "gpu_extras",
"mathutils", "freestyle", "bgl", "blf", "gpu", "gpu_extras",
"aud", "bpy_extras", "idprop.types", "bmesh",
)
@@ -1847,29 +1845,6 @@ def write_rst_ops_index(basepath):
file.close()
def write_rst_msgbus(basepath):
"""
Write the rst files of bpy.msgbus module
"""
if 'bpy.msgbus' in EXCLUDE_MODULES:
return
# Write the index.
filepath = os.path.join(basepath, "bpy.msgbus.rst")
file = open(filepath, "w", encoding="utf-8")
fw = file.write
fw(title_string("Message Bus (bpy.msgbus)", "="))
write_example_ref("", fw, "bpy.msgbus")
fw(".. toctree::\n")
fw(" :glob:\n\n")
fw(" bpy.msgbus.*\n\n")
file.close()
# Write the contents.
pymodule2sphinx(basepath, 'bpy.msgbus', bpy.msgbus, 'Message Bus')
EXAMPLE_SET_USED.add("bpy.msgbus")
def write_rst_data(basepath):
'''
Write the rst file of bpy.data module
@@ -1911,7 +1886,6 @@ def write_rst_importable_modules(basepath):
# C_modules
"aud": "Audio System",
"blf": "Font Drawing",
"imbuf": "Image Buffer",
"gpu": "GPU Shader Module",
"gpu.types": "GPU Types",
"gpu.matrix": "GPU Matrix",
@@ -2024,7 +1998,6 @@ def rna2sphinx(basepath):
write_rst_bpy(basepath) # bpy, disabled by default
write_rst_types_index(basepath) # bpy.types
write_rst_ops_index(basepath) # bpy.ops
write_rst_msgbus(basepath) # bpy.msgbus
pyrna2sphinx(basepath) # bpy.types.* and bpy.ops.*
write_rst_data(basepath) # bpy.data
write_rst_importable_modules(basepath)

View File

@@ -37,10 +37,10 @@ class ISynchronizer;
/**
* @interface IDevice
* The IDevice interface represents an output device for sound sources.
* Output devices may be several backends such as platform independand like
* SDL or OpenAL or platform specific like ALSA, but they may also be
* Output devices may be several backends such as plattform independand like
* SDL or OpenAL or plattform specific like ALSA, but they may also be
* files, RAM buffers or other types of streams.
* \warning Thread safety must be insured so that no reader is being called
* \warning Thread safety must be insured so that no reader is beeing called
* twice at the same time.
*/
class IDevice : public ILockable

View File

@@ -35,8 +35,6 @@ AUD_NAMESPACE_BEGIN
class AUD_API IDeviceFactory
{
public:
virtual ~IDeviceFactory() {}
/**
* Opens an audio device for playback.
* \exception Exception Thrown if the audio device cannot be opened.

View File

@@ -40,8 +40,6 @@ class Buffer;
class AUD_API IFileInput
{
public:
virtual ~IFileInput() {};
/**
* Creates a reader for a file to be read.
* \param filename Path to the file to be read.

View File

@@ -171,7 +171,7 @@ bool DynamicMusic::pause()
bool DynamicMusic::seek(float position)
{
bool result = false;
bool result;
if(m_currentHandle != nullptr)
{

View File

@@ -683,23 +683,23 @@ static int cuewNvrtcInit(void) {
int cuewInit(cuuint32_t flags) {
int result = CUEW_SUCCESS;
int result = CUEW_SUCCESS;
if (flags & CUEW_INIT_CUDA) {
result = cuewCudaInit();
if (result != CUEW_SUCCESS) {
return result;
}
}
if (flags & CUEW_INIT_CUDA) {
result = cuewCudaInit();
if (result != CUEW_SUCCESS) {
return result;
}
}
if (flags & CUEW_INIT_NVRTC) {
result = cuewNvrtcInit();
if (result != CUEW_SUCCESS) {
return result;
}
}
if (flags & CUEW_INIT_NVRTC) {
result = cuewNvrtcInit();
if (result != CUEW_SUCCESS) {
return result;
}
}
return result;
return result;
}
@@ -798,10 +798,7 @@ static int path_exists(const char *path) {
const char *cuewCompilerPath(void) {
#ifdef _WIN32
const char *defaultpaths[] = {
"C:/CUDA/bin",
"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin",
NULL};
const char *defaultpaths[] = {"C:/CUDA/bin", NULL};
const char *executable = "nvcc.exe";
#else
const char *defaultpaths[] = {
@@ -835,12 +832,9 @@ const char *cuewCompilerPath(void) {
}
}
#ifndef _WIN32
{
#ifdef _WIN32
FILE *handle = popen("where nvcc", "r");
#else
FILE *handle = popen("which nvcc", "r");
#endif
if (handle) {
char buffer[4096] = {0};
int len = fread(buffer, 1, sizeof(buffer) - 1, handle);
@@ -851,6 +845,7 @@ const char *cuewCompilerPath(void) {
}
}
}
#endif
return NULL;
}
@@ -864,6 +859,23 @@ int cuewNvrtcVersion(void) {
return 0;
}
static size_t safe_strnlen(const char *s, size_t maxlen) {
size_t length;
for (length = 0; length < maxlen; s++, length++) {
if (*s == '\0') {
break;
}
}
return length;
}
static char *safe_strncpy(char *dest, const char *src, size_t n) {
const size_t src_len = safe_strnlen(src, n - 1);
memcpy(dest, src, src_len);
dest[src_len] = '\0';
return dest;
}
int cuewCompilerVersion(void) {
const char *path = cuewCompilerPath();
const char *marker = "Cuda compilation tools, release ";
@@ -879,9 +891,8 @@ int cuewCompilerVersion(void) {
}
/* get --version output */
strncat(command, "\"", 1);
strncat(command, path, sizeof(command) - 1);
strncat(command, "\" --version", sizeof(command) - strlen(path) - 1);
safe_strncpy(command, path, sizeof(command));
strncat(command, " --version", sizeof(command) - strlen(path));
pipe = popen(command, "r");
if (!pipe) {
fprintf(stderr, "CUDA: failed to run compiler to retrieve version");
@@ -911,3 +922,4 @@ int cuewCompilerVersion(void) {
return 10 * major + minor;
}

View File

@@ -24,21 +24,6 @@ set(CMAKE_CXX_STANDARD 14)
add_subdirectory(dracoenc)
# Build blender-draco-exporter module.
set(SRC
src/draco-compressor.cpp
src/draco-compressor.h
)
set(INC
dracoenc/src
)
set(LIB
dracoenc
)
add_library(extern_draco SHARED "${SRC}")
target_include_directories(extern_draco PUBLIC "${INC}")
target_link_libraries(extern_draco PUBLIC "${LIB}")
blender_source_group(extern_draco "${SRC}")
add_library(extern_draco SHARED src/draco-compressor.cpp src/draco-compressor.h)
target_include_directories(extern_draco PUBLIC dracoenc/src)
target_link_libraries(extern_draco PUBLIC dracoenc)

View File

@@ -54,10 +54,6 @@ if(WITH_OPENVDB)
add_definitions(-DOPENVDB_STATICLIB)
endif()
if(WIN32)
add_definitions(-D_USE_MATH_DEFINES)
endif()
set(INC
${MANTA_PP}
${MANTA_PP}/fileio
@@ -84,11 +80,22 @@ endif()
if(WITH_OPENVDB)
list(APPEND INC_SYS
${BOOST_INCLUDE_DIR}
${OPENEXR_INCLUDE_DIRS}
${OPENVDB_INCLUDE_DIRS}
)
list(APPEND LIB
${OPENVDB_LIBRARIES}
${OPENEXR_LIBRARIES}
${ZLIB_LIBRARIES}
${BOOST_LIBRARIES}
)
if(WITH_OPENVDB_BLOSC)
list(APPEND LIB
${BLOSC_LIBRARIES}
${ZLIB_LIBRARIES}
)
endif()
endif()
set(SRC
@@ -106,7 +113,6 @@ set(SRC
${MANTA_PP}/fastmarch.cpp
${MANTA_PP}/fastmarch.h
${MANTA_PP}/fastmarch.h.reg.cpp
${MANTA_PP}/fileio/ioutil.cpp
${MANTA_PP}/fileio/iogrids.cpp
${MANTA_PP}/fileio/iomeshes.cpp
${MANTA_PP}/fileio/ioparticles.cpp

View File

@@ -47,17 +47,17 @@ if [[ "$CLEAN_REPOSITORY" -eq "1" ]]; then
git checkout develop
fi
MANTA_BUILD_PATH=$MANTA_INSTALLATION/build_blender/
MANTA_BUILD_PATH=$MANTA_INSTALLATION/mantaflowgit/build_blender/
mkdir -p $MANTA_BUILD_PATH
cd $MANTA_BUILD_PATH
cmake ../mantaflowgit -DGUI=OFF -DOPENMP=$USE_OMP -DTBB=$USE_TBB -DBLENDER=ON -DPREPDEBUG=ON && make -j8
cmake .. -DGUI=OFF -DOPENMP=$USE_OMP -DTBB=$USE_TBB -DBLENDER=ON -DPREPDEBUG=ON && make -j8
# ==================== 3) COPY MANTAFLOW FILES TO BLENDER ROOT ===========================
mkdir -p $BLENDER_INSTALLATION/blender/tmp/dependencies/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/dependencies/cnpy "$_"
mkdir -p $BLENDER_INSTALLATION/blender/tmp/helper/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/source/util "$_"
mkdir -p $BLENDER_INSTALLATION/blender/tmp/helper/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/source/pwrapper "$_"
mkdir -p $BLENDER_INSTALLATION/blender/tmp/preprocessed/ && cp -Rf $MANTA_INSTALLATION/build_blender/pp/source/. "$_"
mkdir -p $BLENDER_INSTALLATION/blender/tmp/preprocessed/ && cp -Rf $MANTA_INSTALLATION/mantaflowgit/build_blender/pp/source/. "$_"
# Remove some files that are not need in Blender
rm $BLENDER_INSTALLATION/blender/tmp/dependencies/cnpy/example1.cpp

View File

@@ -17,13 +17,16 @@
// link to omp & tbb for now
#if OPENMP == 1 || TBB == 1
# define MANTA_ENABLE_PARALLEL 1
# define MANTA_ENABLE_PARALLEL 0
// allow the preconditioner to be computed in parallel? (can lead to slightly non-deterministic
// results)
# define MANTA_ENABLE_PARALLEL_PC 0
// use c++11 code?
# define MANTA_USE_CPP11 1
#else
# define MANTA_ENABLE_PARALLEL 0
# define MANTA_ENABLE_PARALLEL_PC 0
# define MANTA_USE_CPP11 0
#endif
#if MANTA_ENABLE_PARALLEL == 1
@@ -500,7 +503,11 @@ template<class N, class T> struct RCMatrix {
for (Iterator it = row_begin(i); it; ++it)
result.fix_element(it.index(), i, it.value());
}
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix getKtK() const
@@ -525,7 +532,12 @@ template<class N, class T> struct RCMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix operator*(const RCMatrix &m) const
@@ -549,7 +561,12 @@ template<class N, class T> struct RCMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix sqrt() const
@@ -564,7 +581,12 @@ template<class N, class T> struct RCMatrix {
result.set_element(i, j, std::sqrt(it_A.value()));
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix operator*(const double k) const
@@ -579,7 +601,12 @@ template<class N, class T> struct RCMatrix {
result.add_to_element(i, j, it_A.value() * k);
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix applyKernel(const RCMatrix &kernel, const int nx, const int ny) const
@@ -613,7 +640,12 @@ template<class N, class T> struct RCMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix applyHorizontalKernel(const RCMatrix &kernel, const int nx, const int ny) const
@@ -647,7 +679,12 @@ template<class N, class T> struct RCMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix applyVerticalKernel(const RCMatrix &kernel, const int nx, const int ny) const
@@ -681,7 +718,12 @@ template<class N, class T> struct RCMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix applySeparableKernel(const RCMatrix &kernelH,
@@ -705,7 +747,11 @@ template<class N, class T> struct RCMatrix {
{
std::vector<T> result(n, 0.0);
multiply(rhs, result);
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
void multiply(const std::vector<T> &rhs, std::vector<T> &result) const
{
@@ -786,7 +832,11 @@ template<class N, class T> struct RCMatrix {
for (N i = 0; i < result.size(); i++) {
result[i] = std::abs(result[i] - rhs[i]);
}
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
T norm() const
{
@@ -974,7 +1024,11 @@ template<class N, class T> struct RCFixedMatrix {
{
std::vector<T> result(n, 0.0);
multiply(rhs, result);
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
void multiply(const std::vector<T> &rhs, std::vector<T> &result) const
{
@@ -1010,7 +1064,12 @@ template<class N, class T> struct RCFixedMatrix {
}
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
RCMatrix<N, T> toRCMatrix() const
@@ -1028,7 +1087,12 @@ template<class N, class T> struct RCFixedMatrix {
result.matrix[i]->value[j] = value[rowstart[i] + j];
}
}
parallel_end return result;
parallel_end
#if MANTA_USE_CPP11 == 1
return std::move(result);
#else
return result;
#endif
}
};

View File

@@ -298,7 +298,7 @@ template<class T> void writeGridRaw(const string &name, Grid<T> *grid)
debMsg("writing grid " << grid->getName() << " to raw file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("writeGridRaw: can't open file " << name);
gzwrite(gzf, &((*grid)[0]), sizeof(T) * grid->getSizeX() * grid->getSizeY() * grid->getSizeZ());
@@ -313,7 +313,7 @@ template<class T> void readGridRaw(const string &name, Grid<T> *grid)
debMsg("reading grid " << grid->getName() << " from raw file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("readGridRaw: can't open file " << name);
@@ -350,7 +350,7 @@ void getUniFileSize(const string &name, int &x, int &y, int &z, int *t, std::str
{
x = y = z = 0;
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (gzf) {
char ID[5] = {0, 0, 0, 0, 0};
gzread(gzf, ID, 4);
@@ -499,7 +499,7 @@ template<class T> void writeGridUni(const string &name, Grid<T> *grid)
else
errMsg("writeGridUni: unknown element type");
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("writeGridUni: can't open file " << name);
@@ -527,7 +527,7 @@ template<class T> void readGridUni(const string &name, Grid<T> *grid)
debMsg("Reading grid " << grid->getName() << " from uni file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("readGridUni: can't open file " << name);
@@ -736,7 +736,7 @@ template<class T> void writeGrid4dUni(const string &name, Grid4d<T> *grid)
else
errMsg("writeGrid4dUni: unknown element type");
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("writeGrid4dUni: can't open file " << name);
@@ -778,7 +778,7 @@ void readGrid4dUni(
// optionally - reuse file handle, if valid one is passed in fileHandle pointer...
if ((!fileHandle) || (fileHandle && (*fileHandle == NULL))) {
gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("readGrid4dUni: can't open file " << name);
@@ -905,7 +905,7 @@ template<class T> void writeGrid4dRaw(const string &name, Grid4d<T> *grid)
debMsg("writing grid4d " << grid->getName() << " to raw file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("writeGrid4dRaw: can't open file " << name);
gzwrite(gzf,
@@ -922,7 +922,7 @@ template<class T> void readGrid4dRaw(const string &name, Grid4d<T> *grid)
debMsg("reading grid4d " << grid->getName() << " from raw file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("readGrid4dRaw: can't open file " << name);

View File

@@ -158,7 +158,7 @@ void readBobjFile(const string &name, Mesh *mesh, bool append)
const Real dx = mesh->getParent()->getDx();
const Vec3 gs = toVec3(mesh->getParent()->getGridSize());
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "rb1"); // do some compression
if (!gzf)
errMsg("readBobj: unable to open file");
@@ -213,7 +213,7 @@ void writeBobjFile(const string &name, Mesh *mesh)
const Real dx = mesh->getParent()->getDx();
const Vec3i gs = mesh->getParent()->getGridSize();
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("writeBobj: unable to open file");
@@ -412,7 +412,7 @@ template<class T> void readMdataUni(const std::string &name, MeshDataImpl<T> *md
debMsg("reading mesh data " << mdata->getName() << " from uni file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("can't open file " << name);
@@ -460,7 +460,7 @@ template<class T> void writeMdataUni(const std::string &name, MeshDataImpl<T> *m
MuTime stamp;
head.timestamp = stamp.time;
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("can't open file " << name);
gzwrite(gzf, ID, 4);

View File

@@ -176,7 +176,7 @@ void writeParticlesUni(const std::string &name, const BasicParticleSystem *parts
MuTime stamp;
head.timestamp = stamp.time;
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("can't open file " << name);
@@ -206,7 +206,7 @@ void readParticlesUni(const std::string &name, BasicParticleSystem *parts)
debMsg("reading particles " << parts->getName() << " from uni file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("can't open file " << name);
@@ -273,7 +273,7 @@ template<class T> void writePdataUni(const std::string &name, ParticleDataImpl<T
MuTime stamp;
head.timestamp = stamp.time;
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1"); // do some compression
gzFile gzf = gzopen(name.c_str(), "wb1"); // do some compression
if (!gzf)
errMsg("can't open file " << name);
gzwrite(gzf, ID, 4);
@@ -299,7 +299,7 @@ template<class T> void readPdataUni(const std::string &name, ParticleDataImpl<T>
debMsg("reading particle data " << pdata->getName() << " from uni file " << name, 1);
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "rb");
gzFile gzf = gzopen(name.c_str(), "rb");
if (!gzf)
errMsg("can't open file " << name);

View File

@@ -1,60 +0,0 @@
// DO NOT EDIT !
// This file is generated using the MantaFlow preprocessor (prep generate).
/******************************************************************************
*
* MantaFlow fluid solver framework
* Copyright 2011-2020 Tobias Pfaff, Nils Thuerey
*
* This program is free software, distributed under the terms of the
* Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Helper functions to handle file IO
*
******************************************************************************/
#include "mantaio.h"
#if NO_ZLIB != 1
extern "C" {
# include <zlib.h>
}
# if defined(WIN32) || defined(_WIN32)
# include <windows.h>
# include <string>
# endif
using namespace std;
namespace Manta {
# if defined(WIN32) || defined(_WIN32)
static wstring stringToWstring(const char *str)
{
const int length_wc = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0);
wstring strWide(length_wc, 0);
MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), &strWide[0], length_wc);
return strWide;
}
# endif
void *safeGzopen(const char *filename, const char *mode)
{
gzFile gzfile;
# if defined(WIN32) || defined(_WIN32)
wstring filenameWide = stringToWstring(filename);
gzfile = gzopen_w(filenameWide.c_str(), mode);
# else
gzfile = gzopen(filename, mode);
# endif
return gzfile;
}
#endif
} // namespace

View File

@@ -76,8 +76,6 @@ template<class T> void readMdataUni(const std::string &name, MeshDataImpl<T> *md
void getUniFileSize(
const std::string &name, int &x, int &y, int &z, int *t = NULL, std::string *info = NULL);
void *safeGzopen(const char *filename, const char *mode);
} // namespace Manta
#endif

View File

@@ -1,3 +1,3 @@
#define MANTA_GIT_VERSION "commit 1d55979473c25318f39c4a6bf48a5ab77b3bf39b"
#define MANTA_GIT_VERSION "commit abfff159b5ea8cee93d858f4b8be2a308b58b51d"

View File

@@ -1244,67 +1244,15 @@ void PbRegister_gridMaxDiffVec3()
}
}
struct knCopyMacToVec3 : public KernelBase {
knCopyMacToVec3(MACGrid &source, Grid<Vec3> &target)
: KernelBase(&source, 0), source(source), target(target)
{
runMessage();
run();
}
inline void op(int i, int j, int k, MACGrid &source, Grid<Vec3> &target) const
{
target(i, j, k) = source(i, j, k);
}
inline MACGrid &getArg0()
{
return source;
}
typedef MACGrid type0;
inline Grid<Vec3> &getArg1()
{
return target;
}
typedef Grid<Vec3> type1;
void runMessage()
{
debMsg("Executing kernel knCopyMacToVec3 ", 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 = 0; j < _maxY; j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, target);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, target);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, maxY), *this);
}
MACGrid &source;
Grid<Vec3> &target;
};
// simple helper functions to copy (convert) mac to vec3 , and levelset to real grids
// (are assumed to be the same for running the test cases - in general they're not!)
void copyMacToVec3(MACGrid &source, Grid<Vec3> &target)
{
knCopyMacToVec3(source, target);
FOR_IJK(target)
{
target(i, j, k) = source(i, j, k);
}
}
static PyObject *_W_3(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1375,14 +1323,10 @@ void PbRegister_convertMacToVec3()
}
}
struct knResampleVec3ToMac : public KernelBase {
knResampleVec3ToMac(Grid<Vec3> &source, MACGrid &target)
: KernelBase(&source, 1), source(source), target(target)
{
runMessage();
run();
}
inline void op(int i, int j, int k, Grid<Vec3> &source, MACGrid &target) const
//! vec3->mac grid conversion , but with full resampling
void resampleVec3ToMac(Grid<Vec3> &source, MACGrid &target)
{
FOR_IJK_BND(target, 1)
{
target(i, j, k)[0] = 0.5 * (source(i - 1, j, k)[0] + source(i, j, k))[0];
target(i, j, k)[1] = 0.5 * (source(i, j - 1, k)[1] + source(i, j, k))[1];
@@ -1390,55 +1334,6 @@ struct knResampleVec3ToMac : public KernelBase {
target(i, j, k)[2] = 0.5 * (source(i, j, k - 1)[2] + source(i, j, k))[2];
}
}
inline Grid<Vec3> &getArg0()
{
return source;
}
typedef Grid<Vec3> type0;
inline MACGrid &getArg1()
{
return target;
}
typedef MACGrid type1;
void runMessage()
{
debMsg("Executing kernel knResampleVec3ToMac ", 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, source, target);
}
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, source, target);
}
}
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<Vec3> &source;
MACGrid &target;
};
//! vec3->mac grid conversion , but with full resampling
void resampleVec3ToMac(Grid<Vec3> &source, MACGrid &target)
{
knResampleVec3ToMac(source, target);
}
static PyObject *_W_5(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1472,66 +1367,13 @@ void PbRegister_resampleVec3ToMac()
}
}
struct knResampleMacToVec3 : public KernelBase {
knResampleMacToVec3(MACGrid &source, Grid<Vec3> &target)
: KernelBase(&source, 1), source(source), target(target)
{
runMessage();
run();
}
inline void op(int i, int j, int k, MACGrid &source, Grid<Vec3> &target) const
//! mac->vec3 grid conversion , with full resampling
void resampleMacToVec3(MACGrid &source, Grid<Vec3> &target)
{
FOR_IJK_BND(target, 1)
{
target(i, j, k) = source.getCentered(i, j, k);
}
inline MACGrid &getArg0()
{
return source;
}
typedef MACGrid type0;
inline Grid<Vec3> &getArg1()
{
return target;
}
typedef Grid<Vec3> type1;
void runMessage()
{
debMsg("Executing kernel knResampleMacToVec3 ", 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, source, target);
}
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, source, target);
}
}
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);
}
MACGrid &source;
Grid<Vec3> &target;
};
//! mac->vec3 grid conversion , with full resampling
void resampleMacToVec3(MACGrid &source, Grid<Vec3> &target)
{
knResampleMacToVec3(source, target);
}
static PyObject *_W_6(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1565,65 +1407,12 @@ void PbRegister_resampleMacToVec3()
}
}
struct knCopyLevelsetToReal : public KernelBase {
knCopyLevelsetToReal(LevelsetGrid &source, Grid<Real> &target)
: KernelBase(&source, 0), source(source), target(target)
{
runMessage();
run();
}
inline void op(int i, int j, int k, LevelsetGrid &source, Grid<Real> &target) const
void copyLevelsetToReal(LevelsetGrid &source, Grid<Real> &target)
{
FOR_IJK(target)
{
target(i, j, k) = source(i, j, k);
}
inline LevelsetGrid &getArg0()
{
return source;
}
typedef LevelsetGrid type0;
inline Grid<Real> &getArg1()
{
return target;
}
typedef Grid<Real> type1;
void runMessage()
{
debMsg("Executing kernel knCopyLevelsetToReal ", 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 = 0; j < _maxY; j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, target);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, target);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, maxY), *this);
}
LevelsetGrid &source;
Grid<Real> &target;
};
void copyLevelsetToReal(LevelsetGrid &source, Grid<Real> &target)
{
knCopyLevelsetToReal(source, target);
}
static PyObject *_W_7(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1657,95 +1446,17 @@ void PbRegister_copyLevelsetToReal()
}
}
struct knCopyVec3ToReal : public KernelBase {
knCopyVec3ToReal(Grid<Vec3> &source,
Grid<Real> &targetX,
Grid<Real> &targetY,
Grid<Real> &targetZ)
: KernelBase(&source, 0),
source(source),
targetX(targetX),
targetY(targetY),
targetZ(targetZ)
{
runMessage();
run();
}
inline void op(int i,
int j,
int k,
Grid<Vec3> &source,
Grid<Real> &targetX,
Grid<Real> &targetY,
Grid<Real> &targetZ) const
{
targetX(i, j, k) = source(i, j, k).x;
targetY(i, j, k) = source(i, j, k).y;
targetZ(i, j, k) = source(i, j, k).z;
}
inline Grid<Vec3> &getArg0()
{
return source;
}
typedef Grid<Vec3> type0;
inline Grid<Real> &getArg1()
{
return targetX;
}
typedef Grid<Real> type1;
inline Grid<Real> &getArg2()
{
return targetY;
}
typedef Grid<Real> type2;
inline Grid<Real> &getArg3()
{
return targetZ;
}
typedef Grid<Real> type3;
void runMessage()
{
debMsg("Executing kernel knCopyVec3ToReal ", 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 = 0; j < _maxY; j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, targetX, targetY, targetZ);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, source, targetX, targetY, targetZ);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, maxY), *this);
}
Grid<Vec3> &source;
Grid<Real> &targetX;
Grid<Real> &targetY;
Grid<Real> &targetZ;
};
void copyVec3ToReal(Grid<Vec3> &source,
Grid<Real> &targetX,
Grid<Real> &targetY,
Grid<Real> &targetZ)
{
knCopyVec3ToReal(source, targetX, targetY, targetZ);
FOR_IJK(source)
{
targetX(i, j, k) = source(i, j, k).x;
targetY(i, j, k) = source(i, j, k).y;
targetZ(i, j, k) = source(i, j, k).z;
}
}
static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1781,95 +1492,17 @@ void PbRegister_copyVec3ToReal()
}
}
struct knCopyRealToVec3 : public KernelBase {
knCopyRealToVec3(Grid<Real> &sourceX,
Grid<Real> &sourceY,
Grid<Real> &sourceZ,
Grid<Vec3> &target)
: KernelBase(&sourceX, 0),
sourceX(sourceX),
sourceY(sourceY),
sourceZ(sourceZ),
target(target)
{
runMessage();
run();
}
inline void op(int i,
int j,
int k,
Grid<Real> &sourceX,
Grid<Real> &sourceY,
Grid<Real> &sourceZ,
Grid<Vec3> &target) const
{
target(i, j, k).x = sourceX(i, j, k);
target(i, j, k).y = sourceY(i, j, k);
target(i, j, k).z = sourceZ(i, j, k);
}
inline Grid<Real> &getArg0()
{
return sourceX;
}
typedef Grid<Real> type0;
inline Grid<Real> &getArg1()
{
return sourceY;
}
typedef Grid<Real> type1;
inline Grid<Real> &getArg2()
{
return sourceZ;
}
typedef Grid<Real> type2;
inline Grid<Vec3> &getArg3()
{
return target;
}
typedef Grid<Vec3> type3;
void runMessage()
{
debMsg("Executing kernel knCopyRealToVec3 ", 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 = 0; j < _maxY; j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, sourceX, sourceY, sourceZ, target);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = 0; i < _maxX; i++)
op(i, j, k, sourceX, sourceY, sourceZ, target);
}
}
void run()
{
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(0, maxY), *this);
}
Grid<Real> &sourceX;
Grid<Real> &sourceY;
Grid<Real> &sourceZ;
Grid<Vec3> &target;
};
void copyRealToVec3(Grid<Real> &sourceX,
Grid<Real> &sourceY,
Grid<Real> &sourceZ,
Grid<Vec3> &target)
{
knCopyRealToVec3(sourceX, sourceY, sourceZ, target);
FOR_IJK(target)
{
target(i, j, k).x = sourceX(i, j, k);
target(i, j, k).y = sourceY(i, j, k);
target(i, j, k).z = sourceZ(i, j, k);
}
}
static PyObject *_W_9(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{

View File

@@ -773,9 +773,9 @@ void LevelsetGrid::createMesh(Mesh &mesh)
Grid<int> edgeVY(mParent);
Grid<int> edgeVZ(mParent);
for (int k = 0; k < mSize.z - 1; k++)
for (int i = 0; i < mSize.x - 1; i++)
for (int j = 0; j < mSize.y - 1; j++)
for (int i = 0; i < mSize.x - 1; i++) {
for (int k = 0; k < mSize.z - 1; k++) {
Real value[8] = {get(i, j, k),
get(i + 1, j, k),
get(i + 1, j + 1, k),

View File

@@ -182,7 +182,7 @@ void BasicParticleSystem::writeParticlesText(const string name) const
void BasicParticleSystem::writeParticlesRawPositionsGz(const string name) const
{
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");
gzFile gzf = gzopen(name.c_str(), "wb1");
if (!gzf)
errMsg("can't open file " << name);
for (IndexInt i = 0; i < this->size(); ++i) {
@@ -198,7 +198,7 @@ void BasicParticleSystem::writeParticlesRawPositionsGz(const string name) const
void BasicParticleSystem::writeParticlesRawVelocityGz(const string name) const
{
#if NO_ZLIB != 1
gzFile gzf = (gzFile)safeGzopen(name.c_str(), "wb1");
gzFile gzf = gzopen(name.c_str(), "wb1");
if (!gzf)
errMsg("can't open file " << name);
if (mPdataVec3.size() < 1)

View File

@@ -1335,7 +1335,7 @@ struct KnConfForce : public KernelBase {
void vorticityConfinement(MACGrid &vel,
const FlagGrid &flags,
Real strength = 0,
Real strengthGlobal = 0,
const Grid<Real> *strengthCell = NULL)
{
Grid<Vec3> velCenter(flags.getParent()), curl(flags.getParent()), force(flags.getParent());
@@ -1344,7 +1344,7 @@ void vorticityConfinement(MACGrid &vel,
GetCentered(velCenter, vel);
CurlOp(velCenter, curl);
GridNorm(norm, curl);
KnConfForce(force, norm, curl, strength, strengthCell);
KnConfForce(force, norm, curl, strengthGlobal, strengthCell);
KnApplyForceField(flags, vel, force, NULL, true, false);
}
static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
@@ -1359,11 +1359,11 @@ static PyObject *_W_8(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
ArgLocker _lock;
MACGrid &vel = *_args.getPtr<MACGrid>("vel", 0, &_lock);
const FlagGrid &flags = *_args.getPtr<FlagGrid>("flags", 1, &_lock);
Real strength = _args.getOpt<Real>("strength", 2, 0, &_lock);
Real strengthGlobal = _args.getOpt<Real>("strengthGlobal", 2, 0, &_lock);
const Grid<Real> *strengthCell = _args.getPtrOpt<Grid<Real>>(
"strengthCell", 3, NULL, &_lock);
_retval = getPyNone();
vorticityConfinement(vel, flags, strength, strengthCell);
vorticityConfinement(vel, flags, strengthGlobal, strengthCell);
_args.check();
}
pbFinalizePlugin(parent, "vorticityConfinement", !noTiming);

View File

@@ -18,7 +18,6 @@
******************************************************************************/
#include "particle.h"
#include "general.h"
#include "grid.h"
#include "commonkernels.h"
#include "randomstream.h"
@@ -1430,9 +1429,9 @@ struct correctLevelset : public KernelBase {
Real t = (t_high - maxEV) / (t_high - t_low);
correction = t * t * t - 3 * t * t + 3 * t;
}
correction = clamp(correction,
Real(0),
Real(1)); // enforce correction factor to [0,1] (not explicitly in paper)
correction = (correction < 0) ?
0 :
correction; // enforce correction factor to [0,1] (not explicitly in paper)
const Vec3 gridPos = Vec3(i, j, k) + Vec3(0.5); // shifted by half cell
const Real correctedPhi = fabs(norm(gridPos - pAcc(i, j, k))) - rAcc(i, j, k) * correction;

View File

@@ -1829,15 +1829,13 @@ struct KnUpdateFlagsObs : public KernelBase {
const MACGrid *fractions,
const Grid<Real> &phiObs,
const Grid<Real> *phiOut,
const Grid<Real> *phiIn,
int boundaryWidth)
: KernelBase(&flags, boundaryWidth),
const Grid<Real> *phiIn)
: KernelBase(&flags, 1),
flags(flags),
fractions(fractions),
phiObs(phiObs),
phiOut(phiOut),
phiIn(phiIn),
boundaryWidth(boundaryWidth)
phiIn(phiIn)
{
runMessage();
run();
@@ -1849,8 +1847,7 @@ struct KnUpdateFlagsObs : public KernelBase {
const MACGrid *fractions,
const Grid<Real> &phiObs,
const Grid<Real> *phiOut,
const Grid<Real> *phiIn,
int boundaryWidth) const
const Grid<Real> *phiIn) const
{
bool isObs = false;
@@ -1913,11 +1910,6 @@ struct KnUpdateFlagsObs : public KernelBase {
return phiIn;
}
typedef Grid<Real> type4;
inline int &getArg5()
{
return boundaryWidth;
}
typedef int type5;
void runMessage()
{
debMsg("Executing kernel KnUpdateFlagsObs ", 3);
@@ -1931,15 +1923,15 @@ struct KnUpdateFlagsObs : public KernelBase {
const int _maxY = maxY;
if (maxZ > 1) {
for (int k = __r.begin(); k != (int)__r.end(); k++)
for (int j = boundaryWidth; j < _maxY; j++)
for (int i = boundaryWidth; i < _maxX; i++)
op(i, j, k, flags, fractions, phiObs, phiOut, phiIn, boundaryWidth);
for (int j = 1; j < _maxY; j++)
for (int i = 1; i < _maxX; i++)
op(i, j, k, flags, fractions, phiObs, phiOut, phiIn);
}
else {
const int k = 0;
for (int j = __r.begin(); j != (int)__r.end(); j++)
for (int i = boundaryWidth; i < _maxX; i++)
op(i, j, k, flags, fractions, phiObs, phiOut, phiIn, boundaryWidth);
for (int i = 1; i < _maxX; i++)
op(i, j, k, flags, fractions, phiObs, phiOut, phiIn);
}
}
void run()
@@ -1947,14 +1939,13 @@ struct KnUpdateFlagsObs : public KernelBase {
if (maxZ > 1)
tbb::parallel_for(tbb::blocked_range<IndexInt>(minZ, maxZ), *this);
else
tbb::parallel_for(tbb::blocked_range<IndexInt>(boundaryWidth, maxY), *this);
tbb::parallel_for(tbb::blocked_range<IndexInt>(1, maxY), *this);
}
FlagGrid &flags;
const MACGrid *fractions;
const Grid<Real> &phiObs;
const Grid<Real> *phiOut;
const Grid<Real> *phiIn;
int boundaryWidth;
};
//! update obstacle and outflow flags from levelsets
@@ -1963,10 +1954,9 @@ void setObstacleFlags(FlagGrid &flags,
const Grid<Real> &phiObs,
const MACGrid *fractions = NULL,
const Grid<Real> *phiOut = NULL,
const Grid<Real> *phiIn = NULL,
int boundaryWidth = 1)
const Grid<Real> *phiIn = NULL)
{
KnUpdateFlagsObs(flags, fractions, phiObs, phiOut, phiIn, boundaryWidth);
KnUpdateFlagsObs(flags, fractions, phiObs, phiOut, phiIn);
}
static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
{
@@ -1983,9 +1973,8 @@ static PyObject *_W_18(PyObject *_self, PyObject *_linargs, PyObject *_kwds)
const MACGrid *fractions = _args.getPtrOpt<MACGrid>("fractions", 2, NULL, &_lock);
const Grid<Real> *phiOut = _args.getPtrOpt<Grid<Real>>("phiOut", 3, NULL, &_lock);
const Grid<Real> *phiIn = _args.getPtrOpt<Grid<Real>>("phiIn", 4, NULL, &_lock);
int boundaryWidth = _args.getOpt<int>("boundaryWidth", 5, 1, &_lock);
_retval = getPyNone();
setObstacleFlags(flags, phiObs, fractions, phiOut, phiIn, boundaryWidth);
setObstacleFlags(flags, phiObs, fractions, phiOut, phiIn);
_args.check();
}
pbFinalizePlugin(parent, "setObstacleFlags", !noTiming);

View File

@@ -1171,11 +1171,6 @@ void solvePressureSystem(Grid<Real> &rhs,
maxIter = 100;
pmg = gMapMG[parent];
// Release MG from previous step if present (e.g. if previous solve was with MGStatic)
if (pmg && preconditioner == PcMGDynamic) {
releaseMG(parent);
pmg = nullptr;
}
if (!pmg) {
pmg = new GridMg(pressure.getSize());
gMapMG[parent] = pmg;

View File

@@ -76,7 +76,3 @@ endif()
if(WITH_QUADRIFLOW)
add_subdirectory(quadriflow)
endif()
if(UNIX AND NOT APPLE)
add_subdirectory(libc_compat)
endif()

View File

@@ -228,8 +228,11 @@ if(WITH_CYCLES_DEVICE_OPTIX)
SYSTEM
${OPTIX_INCLUDE_DIR}
)
# Need pre-compiled CUDA binaries in the OptiX device
set(WITH_CYCLES_CUDA_BINARIES ON)
else()
message(STATUS "OptiX not found, disabling it from Cycles")
message(STATUS "Optix not found, disabling it from Cycles")
set(WITH_CYCLES_DEVICE_OPTIX OFF)
endif()
endif()

View File

@@ -51,16 +51,14 @@ endif()
# Common configuration.
link_directories(
${OPENIMAGEIO_LIBPATH}
${BOOST_LIBPATH}
${PNG_LIBPATH}
${JPEG_LIBPATH}
${ZLIB_LIBPATH}
${TIFF_LIBPATH}
${OPENEXR_LIBPATH}
${OPENJPEG_LIBPATH}
)
link_directories(${OPENIMAGEIO_LIBPATH}
${BOOST_LIBPATH}
${PNG_LIBPATH}
${JPEG_LIBPATH}
${ZLIB_LIBPATH}
${TIFF_LIBPATH}
${OPENEXR_LIBPATH}
${OPENJPEG_LIBPATH})
if(WITH_OPENCOLORIO)
link_directories(${OPENCOLORIO_LIBPATH})

View File

@@ -22,7 +22,7 @@ bl_info = {
"blender": (2, 80, 0),
"description": "Cycles renderer integration",
"warning": "",
"doc_url": "https://docs.blender.org/manual/en/latest/render/cycles/",
"wiki_url": "https://docs.blender.org/manual/en/latest/render/cycles/",
"tracker_url": "",
"support": 'OFFICIAL',
"category": "Render"}

View File

@@ -245,6 +245,9 @@ def list_render_passes(srl):
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_color: yield ("TransCol", "RGB", 'COLOR')
if srl.use_pass_subsurface_direct: yield ("SubsurfaceDir", "RGB", 'COLOR')
if srl.use_pass_subsurface_indirect: yield ("SubsurfaceInd", "RGB", 'COLOR')
if srl.use_pass_subsurface_color: yield ("SubsurfaceCol", "RGB", 'COLOR')
if srl.use_pass_emit: yield ("Emit", "RGB", 'COLOR')
if srl.use_pass_environment: yield ("Env", "RGB", 'COLOR')
@@ -255,7 +258,6 @@ def list_render_passes(srl):
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.use_pass_volume_direct: yield ("VolumeDir", "RGB", 'COLOR')
if crl.use_pass_volume_indirect: yield ("VolumeInd", "RGB", 'COLOR')
@@ -282,7 +284,8 @@ def list_render_passes(srl):
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")
"denoising_transmission_direct", "denoising_transmission_indirect",
"denoising_subsurface_direct", "denoising_subsurface_indirect")
if any(getattr(crl, option) for option in clean_options):
yield ("Denoising Clean", "RGB", 'COLOR')

View File

@@ -153,12 +153,12 @@ class CYCLES_OT_denoise_animation(Operator):
self.report({'ERROR'}, str(e))
return {'FINISHED'}
self.report({'INFO'}, "Denoising completed")
self.report({'INFO'}, "Denoising completed.")
return {'FINISHED'}
class CYCLES_OT_merge_images(Operator):
"Combine OpenEXR multilayer images rendered with different sample " \
"Combine OpenEXR multilayer images rendered with different sample" \
"ranges into one image with reduced noise"
bl_idname = "cycles.merge_images"
bl_label = "Merge Images"

View File

@@ -112,7 +112,6 @@ enum_use_layer_samples = (
enum_sampling_pattern = (
('SOBOL', "Sobol", "Use Sobol random sampling pattern"),
('CORRELATED_MUTI_JITTER', "Correlated Multi-Jitter", "Use Correlated Multi-Jitter random sampling pattern"),
('PROGRESSIVE_MUTI_JITTER', "Progressive Multi-Jitter", "Use Progressive Multi-Jitter random sampling pattern"),
)
enum_integrator = (
@@ -179,6 +178,10 @@ enum_view3d_shading_render_pass= (
('TRANSMISSION_INDIRECT', "Transmission Indirect", "Show the Transmission Indirect render pass", 45),
('TRANSMISSION_COLOR', "Transmission Color", "Show the Transmission Color render pass", 46),
('SUBSURFACE_DIRECT', "Subsurface Direct", "Show the Subsurface Direct render pass", 47),
('SUBSURFACE_INDIRECT', "Subsurface Indirect", "Show the Subsurface Indirect render pass", 48),
('SUBSURFACE_COLOR', "Subsurface Color", "Show the Subsurface Color render pass", 49),
('VOLUME_DIRECT', "Volume Direct", "Show the Volume Direct render pass", 50),
('VOLUME_INDIRECT', "Volume Indirect", "Show the Volume Indirect render pass", 51),
@@ -194,12 +197,7 @@ enum_aov_types = (
('COLOR', "Color", "Write a Color pass", 1),
)
enum_viewport_denoising = (
('NONE', "None", "Disable viewport denoising", 0),
('OPTIX', "OptiX AI-Accelerated", "Use the OptiX denoiser running on the GPU (requires at least one compatible OptiX device)", 1),
)
enum_denoising_optix_input_passes = (
enum_denoising_optix_input_passes= (
('RGB', "Color", "Use only color as input", 1),
('RGB_ALBEDO', "Color + Albedo", "Use color and albedo data as input", 2),
('RGB_ALBEDO_NORMAL', "Color + Albedo + Normal", "Use color, albedo and normal data as input", 3),
@@ -231,18 +229,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default='PATH',
)
preview_pause: BoolProperty(
name="Pause Preview",
description="Pause all viewport preview renders",
default=False,
)
preview_denoising: EnumProperty(
name="Viewport Denoising",
description="Denoise the image after each preview update with the selected denoiser engine",
items=enum_viewport_denoising,
default='NONE',
)
use_square_samples: BoolProperty(
name="Square Samples",
description="Square sampling values for easier artist control",
@@ -261,6 +247,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
min=0, max=(1 << 24),
default=32,
)
preview_pause: BoolProperty(
name="Pause Preview",
description="Pause all viewport preview renders",
default=False,
)
aa_samples: IntProperty(
name="AA Samples",
description="Number of antialiasing samples to render for each pixel",
@@ -273,7 +264,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
min=0, max=2097151,
default=32,
)
diffuse_samples: IntProperty(
name="Diffuse Samples",
description="Number of diffuse bounce samples to render for each AA sample",
@@ -304,12 +294,14 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
min=1, max=1024,
default=1,
)
subsurface_samples: IntProperty(
name="Subsurface Samples",
description="Number of subsurface scattering samples to render for each AA sample",
min=1, max=1024,
default=1,
)
volume_samples: IntProperty(
name="Volume Samples",
description="Number of volume scattering samples to render for each AA sample",
@@ -350,25 +342,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=0.01,
)
use_adaptive_sampling: BoolProperty(
name="Use Adaptive Sampling",
description="Automatically reduce the number of samples per pixel based on estimated noise level",
default=False,
)
adaptive_threshold: FloatProperty(
name="Adaptive Sampling Threshold",
description="Noise level step to stop sampling at, lower values reduce noise the cost of render time. Zero for automatic setting based on number of AA samples",
min=0.0, max=1.0,
default=0.0,
)
adaptive_min_samples: IntProperty(
name="Adaptive Min Samples",
description="Minimum AA samples for adaptive sampling, to discover noisy features before stopping sampling. Zero for automatic setting based on number of AA samples",
min=0, max=4096,
default=0,
)
min_light_bounces: IntProperty(
name="Min Light Bounces",
description="Minimum number of light bounces. Setting this higher reduces noise in the first bounces, "
@@ -589,12 +562,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
default=64,
subtype='PIXEL'
)
preview_denoising_start_sample: IntProperty(
name="Start Denoising",
description="Sample to start denoising the preview at",
min=0, max=(1 << 24),
default=1,
)
debug_reset_timeout: FloatProperty(
name="Reset timeout",
@@ -674,6 +641,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
('DIFFUSE', "Diffuse", ""),
('GLOSSY', "Glossy", ""),
('TRANSMISSION', "Transmission", ""),
('SUBSURFACE', "Subsurface", ""),
),
)
@@ -1153,7 +1121,7 @@ class CyclesObjectSettings(bpy.types.PropertyGroup):
motion_steps: IntProperty(
name="Motion Steps",
description="Control accuracy of motion blur, more steps gives more memory usage (actual number of steps is 2^(steps - 1))",
min=1, max=7,
min=1, soft_max=8,
default=1,
)
@@ -1317,12 +1285,7 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
default=False,
update=update_render_passes,
)
pass_debug_sample_count: BoolProperty(
name="Debug Sample Count",
description="Number of samples/camera rays per pixel",
default=False,
update=update_render_passes,
)
use_pass_volume_direct: BoolProperty(
name="Volume Direct",
description="Deliver direct volumetric scattering pass",
@@ -1342,6 +1305,12 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
default=False,
update=update_render_passes,
)
use_optix_denoising: BoolProperty(
name="Use OptiX AI Denoising",
description="Denoise the rendered image with the OptiX AI denoiser",
default=False,
update=update_render_passes,
)
denoising_diffuse_direct: BoolProperty(
name="Diffuse Direct",
description="Denoise the direct diffuse lighting",
@@ -1372,6 +1341,16 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
description="Denoise the indirect transmission lighting",
default=True,
)
denoising_subsurface_direct: BoolProperty(
name="Subsurface Direct",
description="Denoise the direct subsurface lighting",
default=True,
)
denoising_subsurface_indirect: BoolProperty(
name="Subsurface Indirect",
description="Denoise the indirect subsurface lighting",
default=True,
)
denoising_strength: FloatProperty(
name="Denoising Strength",
description="Controls neighbor pixel weighting for the denoising filter (lower values preserve more detail, but aren't as smooth)",
@@ -1408,18 +1387,11 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
min=0, max=7,
default=0,
)
use_optix_denoising: BoolProperty(
name="OptiX AI-Accelerated",
description="Use the OptiX denoiser to denoise the rendered image",
default=False,
update=update_render_passes,
)
denoising_optix_input_passes: EnumProperty(
name="Input Passes",
description="Passes handed over to the OptiX denoiser (this can have different effects on the denoised image)",
description="Controls which passes the OptiX AI denoiser should use as input, which can have different effects on the denoised image",
items=enum_denoising_optix_input_passes,
default='RGB_ALBEDO',
default='RGB',
)
use_pass_crypto_object: BoolProperty(

View File

@@ -112,10 +112,6 @@ def show_device_active(context):
return True
return context.preferences.addons[__package__].preferences.has_active_device()
def show_optix_denoising(context):
# OptiX AI denoiser can be used when at least one device supports OptiX
return bool(context.preferences.addons[__package__].preferences.get_devices_for_type('OPTIX'))
def draw_samples_info(layout, context):
cscene = context.scene.cycles
@@ -181,23 +177,17 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
if not use_optix(context):
layout.prop(cscene, "progressive")
if not use_branched_path(context):
if cscene.progressive == 'PATH' or use_branched_path(context) is False:
col = layout.column(align=True)
col.prop(cscene, "samples", text="Render")
col.prop(cscene, "preview_samples", text="Viewport")
draw_samples_info(layout, context)
else:
col = layout.column(align=True)
col.prop(cscene, "aa_samples", text="Render")
col.prop(cscene, "preview_aa_samples", text="Viewport")
# Viewport denoising is currently only supported with OptiX
if show_optix_denoising(context):
col = layout.column()
col.prop(cscene, "preview_denoising")
if not use_branched_path(context):
draw_samples_info(layout, context)
class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel):
bl_label = "Sub Samples"
@@ -205,7 +195,9 @@ class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
return use_branched_path(context)
scene = context.scene
cscene = scene.cycles
return cscene.progressive != 'PATH' and use_branched_path(context)
def draw(self, context):
layout = self.layout
@@ -230,32 +222,6 @@ class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel):
draw_samples_info(layout, context)
class CYCLES_RENDER_PT_sampling_adaptive(CyclesButtonsPanel, Panel):
bl_label = "Adaptive Sampling"
bl_parent_id = "CYCLES_RENDER_PT_sampling"
bl_options = {'DEFAULT_CLOSED'}
def draw_header(self, context):
layout = self.layout
scene = context.scene
cscene = scene.cycles
layout.prop(cscene, "use_adaptive_sampling", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
scene = context.scene
cscene = scene.cycles
layout.active = cscene.use_adaptive_sampling
col = layout.column(align=True)
col.prop(cscene, "adaptive_min_samples", text="Min Samples")
col.prop(cscene, "adaptive_threshold", text="Noise Threshold")
class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
bl_label = "Advanced"
bl_parent_id = "CYCLES_RENDER_PT_sampling"
@@ -273,9 +239,7 @@ class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
row.prop(cscene, "seed")
row.prop(cscene, "use_animated_seed", text="", icon='TIME')
col = layout.column(align=True)
col.active = not(cscene.use_adaptive_sampling)
col.prop(cscene, "sampling_pattern", text="Pattern")
layout.prop(cscene, "sampling_pattern", text="Pattern")
layout.prop(cscene, "use_square_samples")
@@ -671,6 +635,9 @@ class CYCLES_RENDER_PT_performance_tiles(CyclesButtonsPanel, Panel):
sub = col.column()
sub.active = not rd.use_save_buffers
for view_layer in scene.view_layers:
if view_layer.cycles.use_denoising:
sub.active = False
sub.prop(cscene, "use_progressive_refine")
@@ -738,11 +705,6 @@ class CYCLES_RENDER_PT_performance_viewport(CyclesButtonsPanel, Panel):
col.prop(rd, "preview_pixel_size", text="Pixel Size")
col.prop(cscene, "preview_start_resolution", text="Start Pixels")
if show_optix_denoising(context):
sub = col.row(align=True)
sub.active = cscene.preview_denoising != 'NONE'
sub.prop(cscene, "preview_denoising_start_sample", text="Denoising Start Sample")
class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
bl_label = "Filter"
@@ -841,8 +803,6 @@ class CYCLES_RENDER_PT_passes_data(CyclesButtonsPanel, Panel):
col.prop(cycles_view_layer, "denoising_store_passes", text="Denoising Data")
col = flow.column()
col.prop(cycles_view_layer, "pass_debug_render_time", text="Render Time")
col = flow.column()
col.prop(cycles_view_layer, "pass_debug_sample_count", text="Sample Count")
layout.separator()
@@ -886,6 +846,14 @@ class CYCLES_RENDER_PT_passes_light(CyclesButtonsPanel, Panel):
row.prop(view_layer, "use_pass_transmission_indirect", text="Indirect", toggle=True)
row.prop(view_layer, "use_pass_transmission_color", text="Color", toggle=True)
split = layout.split(factor=0.35)
split.use_property_split = False
split.label(text="Subsurface")
row = split.row(align=True)
row.prop(view_layer, "use_pass_subsurface_direct", text="Direct", toggle=True)
row.prop(view_layer, "use_pass_subsurface_indirect", text="Indirect", toggle=True)
row.prop(view_layer, "use_pass_subsurface_color", text="Color", toggle=True)
split = layout.split(factor=0.35)
split.use_property_split = False
split.label(text="Volume")
@@ -1013,14 +981,15 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
col = split.column(align=True)
if show_optix_denoising(context):
col.prop(cycles_view_layer, "use_optix_denoising")
col.separator(factor=2.0)
if use_optix(context):
col.prop(cycles_view_layer, "use_optix_denoising", text="OptiX AI Denoising")
if cycles_view_layer.use_optix_denoising:
col.prop(cycles_view_layer, "denoising_optix_input_passes")
return
col.separator(factor=2.0)
col.prop(cycles_view_layer, "denoising_radius", text="Radius")
col.prop(cycles_view_layer, "denoising_strength", slider=True, text="Strength")
col.prop(cycles_view_layer, "denoising_feature_strength", slider=True, text="Feature Strength")
@@ -1067,6 +1036,15 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
split = layout.split(factor=0.5)
split.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
col = split.column()
col.alignment = 'RIGHT'
col.label(text="Subsurface")
row = split.row(align=True)
row.use_property_split = False
row.prop(cycles_view_layer, "denoising_subsurface_direct", text="Direct", toggle=True)
row.prop(cycles_view_layer, "denoising_subsurface_indirect", text="Indirect", toggle=True)
class CYCLES_PT_post_processing(CyclesButtonsPanel, Panel):
bl_label = "Post Processing"
@@ -1874,7 +1852,7 @@ class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
cscene = scene.cycles
rd = scene.render
if rd.use_bake_multires == False and cscene.bake_type in {
'NORMAL', 'COMBINED', 'DIFFUSE', 'GLOSSY', 'TRANSMISSION'}:
'NORMAL', 'COMBINED', 'DIFFUSE', 'GLOSSY', 'TRANSMISSION', 'SUBSURFACE'}:
return True
def draw(self, context):
@@ -1913,7 +1891,7 @@ class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
flow.prop(cbk, "use_pass_ambient_occlusion")
flow.prop(cbk, "use_pass_emit")
elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION'}:
elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION', 'SUBSURFACE'}:
row = col.row(align=True)
row.use_property_split = False
row.prop(cbk, "use_pass_direct", toggle=True)
@@ -2214,6 +2192,8 @@ def draw_device(self, context):
col = layout.column()
col.prop(cscene, "feature_set")
scene = context.scene
col = layout.column()
col.active = show_device_active(context)
col.prop(cscene, "device")
@@ -2268,7 +2248,6 @@ classes = (
CYCLES_PT_integrator_presets,
CYCLES_RENDER_PT_sampling,
CYCLES_RENDER_PT_sampling_sub_samples,
CYCLES_RENDER_PT_sampling_adaptive,
CYCLES_RENDER_PT_sampling_advanced,
CYCLES_RENDER_PT_light_paths,
CYCLES_RENDER_PT_light_paths_max_bounces,

View File

@@ -42,7 +42,10 @@ def custom_bake_remap(scene):
'GLOSSY_COLOR',
'TRANSMISSION_DIRECT',
'TRANSMISSION_INDIRECT',
'TRANSMISSION_COLOR')
'TRANSMISSION_COLOR',
'SUBSURFACE_DIRECT',
'SUBSURFACE_INDIRECT',
'SUBSURFACE_COLOR')
diffuse_direct_idx = bake_lookup.index('DIFFUSE_DIRECT')

View File

@@ -725,26 +725,22 @@ static void blender_camera_view_subset(BL::RenderEngine &b_engine,
BoundBox2D cam, view;
float view_aspect, cam_aspect, sensor_size;
/* Get viewport viewplane. */
/* get viewport viewplane */
BlenderCamera view_bcam;
blender_camera_init(&view_bcam, b_render);
blender_camera_from_view(&view_bcam, b_engine, b_scene, b_v3d, b_rv3d, width, height, true);
blender_camera_viewplane(&view_bcam, width, height, &view, &view_aspect, &sensor_size);
/* Get camera viewplane. */
/* get camera viewplane */
BlenderCamera cam_bcam;
blender_camera_init(&cam_bcam, b_render);
blender_camera_from_object(&cam_bcam, b_engine, b_ob, true);
/* Camera border is affect by aspect, viewport is not. */
cam_bcam.pixelaspect.x = b_render.pixel_aspect_x();
cam_bcam.pixelaspect.y = b_render.pixel_aspect_y();
blender_camera_viewplane(
&cam_bcam, cam_bcam.full_width, cam_bcam.full_height, &cam, &cam_aspect, &sensor_size);
/* Return */
/* return */
*view_box = view * (1.0f / view_aspect);
*cam_box = cam * (1.0f / cam_aspect);
}
@@ -867,8 +863,7 @@ void BlenderSync::sync_view(BL::SpaceView3D &b_v3d,
}
}
BufferParams BlenderSync::get_buffer_params(BL::Scene &b_scene,
BL::RenderSettings &b_render,
BufferParams BlenderSync::get_buffer_params(BL::RenderSettings &b_render,
BL::SpaceView3D &b_v3d,
BL::RegionView3D &b_rv3d,
Camera *cam,
@@ -904,11 +899,7 @@ BufferParams BlenderSync::get_buffer_params(BL::Scene &b_scene,
params.height = height;
}
PassType display_pass = update_viewport_display_passes(b_v3d, params.passes);
/* Can only denoise the combined image pass */
params.denoising_data_pass = display_pass == PASS_COMBINED &&
update_viewport_display_denoising(b_v3d, b_scene);
update_viewport_display_passes(b_v3d, params.passes);
return params;
}

View File

@@ -1154,10 +1154,7 @@ void BlenderSync::sync_particle_hair(
}
}
void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Geometry *geom,
const vector<Shader *> &used_shaders)
void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Geometry *geom)
{
Hair *hair = (geom->type == Geometry::HAIR) ? static_cast<Hair *>(geom) : NULL;
Mesh *mesh = (geom->type == Geometry::MESH) ? static_cast<Mesh *>(geom) : NULL;
@@ -1175,9 +1172,6 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph,
oldtriangles.steal_data(mesh->triangles);
}
geom->clear();
geom->used_shaders = used_shaders;
if (view_layer.use_hair && scene->curve_system_manager->use_curves) {
/* Particle hair. */
bool need_undeformed = geom->need_attribute(scene, ATTR_STD_GENERATED);

View File

@@ -19,22 +19,6 @@
CCL_NAMESPACE_BEGIN
enum DenoiserType {
DENOISER_NONE = 0,
DENOISER_OPTIX = 1,
DENOISER_NUM
};
enum ComputeDevice {
COMPUTE_DEVICE_CPU = 0,
COMPUTE_DEVICE_CUDA = 1,
COMPUTE_DEVICE_OPENCL = 2,
COMPUTE_DEVICE_OPTIX = 3,
COMPUTE_DEVICE_NUM
};
int blender_device_threads(BL::Scene &b_scene)
{
BL::RenderSettings b_r = b_scene.render();
@@ -56,7 +40,7 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scen
/* Find network device. */
vector<DeviceInfo> devices = Device::available_devices(DEVICE_MASK_NETWORK);
if (!devices.empty()) {
return devices.front();
device = devices.front();
}
}
else if (get_enum(cscene, "device") == 1) {
@@ -73,6 +57,14 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scen
}
/* Test if we are using GPU devices. */
enum ComputeDevice {
COMPUTE_DEVICE_CPU = 0,
COMPUTE_DEVICE_CUDA = 1,
COMPUTE_DEVICE_OPENCL = 2,
COMPUTE_DEVICE_OPTIX = 3,
COMPUTE_DEVICE_NUM = 4,
};
ComputeDevice compute_device = (ComputeDevice)get_enum(
cpreferences, "compute_device_type", COMPUTE_DEVICE_NUM, COMPUTE_DEVICE_CPU);
@@ -114,34 +106,6 @@ DeviceInfo blender_device_info(BL::Preferences &b_preferences, BL::Scene &b_scen
}
}
/* Ensure there is an OptiX device when using the OptiX denoiser. */
bool use_optix_denoising = get_enum(cscene, "preview_denoising", DENOISER_NUM, DENOISER_NONE) ==
DENOISER_OPTIX &&
!background;
BL::Scene::view_layers_iterator b_view_layer;
for (b_scene.view_layers.begin(b_view_layer); b_view_layer != b_scene.view_layers.end();
++b_view_layer) {
PointerRNA crl = RNA_pointer_get(&b_view_layer->ptr, "cycles");
if (get_boolean(crl, "use_optix_denoising")) {
use_optix_denoising = true;
}
}
if (use_optix_denoising && device.type != DEVICE_OPTIX) {
vector<DeviceInfo> optix_devices = Device::available_devices(DEVICE_MASK_OPTIX);
if (!optix_devices.empty()) {
/* Convert to a special multi device with separate denoising devices. */
if (device.multi_devices.empty()) {
device.multi_devices.push_back(device);
}
/* Simply use the first available OptiX device. */
const DeviceInfo optix_device = optix_devices.front();
device.id += optix_device.id; /* Uniquely identify this special multi device. */
device.denoising_devices.push_back(optix_device);
}
}
return device;
}

View File

@@ -117,18 +117,20 @@ Geometry *BlenderSync::sync_geometry(BL::Depsgraph &b_depsgraph,
geometry_synced.insert(geom);
geom->clear();
geom->used_shaders = used_shaders;
geom->name = ustring(b_ob_data.name().c_str());
if (use_particle_hair) {
sync_hair(b_depsgraph, b_ob, geom, used_shaders);
sync_hair(b_depsgraph, b_ob, geom);
}
else if (object_fluid_gas_domain_find(b_ob)) {
Mesh *mesh = static_cast<Mesh *>(geom);
sync_volume(b_ob, mesh, used_shaders);
sync_volume(b_ob, mesh);
}
else {
Mesh *mesh = static_cast<Mesh *>(geom);
sync_mesh(b_depsgraph, b_ob, mesh, used_shaders);
sync_mesh(b_depsgraph, b_ob, mesh);
}
return geom;

View File

@@ -285,27 +285,14 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
BL::Mesh::vertex_colors_iterator l;
for (b_mesh.vertex_colors.begin(l); l != b_mesh.vertex_colors.end(); ++l) {
const bool active_render = l->active_render();
AttributeStandard vcol_std = (active_render) ? ATTR_STD_VERTEX_COLOR : ATTR_STD_NONE;
ustring vcol_name = ustring(l->name().c_str());
const bool need_vcol = mesh->need_attribute(scene, vcol_name) ||
mesh->need_attribute(scene, vcol_std);
if (!need_vcol) {
if (!mesh->need_attribute(scene, ustring(l->name().c_str())))
continue;
}
Attribute *vcol_attr = NULL;
if (active_render) {
vcol_attr = mesh->subd_attributes.add(vcol_std, vcol_name);
}
else {
vcol_attr = mesh->subd_attributes.add(vcol_name, TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
}
Attribute *attr = mesh->subd_attributes.add(
ustring(l->name().c_str()), TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
BL::Mesh::polygons_iterator p;
uchar4 *cdata = vcol_attr->data_uchar4();
uchar4 *cdata = attr->data_uchar4();
for (b_mesh.polygons.begin(p); p != b_mesh.polygons.end(); ++p) {
int n = p->loop_total();
@@ -320,27 +307,14 @@ static void attr_create_vertex_color(Scene *scene, Mesh *mesh, BL::Mesh &b_mesh,
else {
BL::Mesh::vertex_colors_iterator l;
for (b_mesh.vertex_colors.begin(l); l != b_mesh.vertex_colors.end(); ++l) {
const bool active_render = l->active_render();
AttributeStandard vcol_std = (active_render) ? ATTR_STD_VERTEX_COLOR : ATTR_STD_NONE;
ustring vcol_name = ustring(l->name().c_str());
const bool need_vcol = mesh->need_attribute(scene, vcol_name) ||
mesh->need_attribute(scene, vcol_std);
if (!need_vcol) {
if (!mesh->need_attribute(scene, ustring(l->name().c_str())))
continue;
}
Attribute *vcol_attr = NULL;
if (active_render) {
vcol_attr = mesh->attributes.add(vcol_std, vcol_name);
}
else {
vcol_attr = mesh->attributes.add(vcol_name, TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
}
Attribute *attr = mesh->attributes.add(
ustring(l->name().c_str()), TypeRGBA, ATTR_ELEMENT_CORNER_BYTE);
BL::Mesh::loop_triangles_iterator t;
uchar4 *cdata = vcol_attr->data_uchar4();
uchar4 *cdata = attr->data_uchar4();
for (b_mesh.loop_triangles.begin(t); t != b_mesh.loop_triangles.end(); ++t) {
int3 li = get_int3(t->loops());
@@ -941,10 +915,7 @@ static void sync_mesh_fluid_motion(BL::Object &b_ob, Scene *scene, Mesh *mesh)
}
}
void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Mesh *mesh,
const vector<Shader *> &used_shaders)
void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh)
{
array<int> oldtriangles;
array<Mesh::SubdFace> oldsubd_faces;
@@ -953,9 +924,6 @@ void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph,
oldsubd_faces.steal_data(mesh->subd_faces);
oldsubd_face_corners.steal_data(mesh->subd_face_corners);
mesh->clear();
mesh->used_shaders = used_shaders;
mesh->subdivision_type = Mesh::SUBDIVISION_NONE;
if (view_layer.use_surfaces) {
@@ -997,12 +965,6 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph b_depsgraph,
Mesh *mesh,
int motion_step)
{
/* Fluid motion blur already exported. */
BL::FluidDomainSettings b_fluid_domain = object_fluid_liquid_domain_find(b_ob);
if (b_fluid_domain) {
return;
}
/* Skip if no vertices were exported. */
size_t numverts = mesh->verts.size();
if (numverts == 0) {

View File

@@ -266,7 +266,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
uint motion_steps;
if (need_motion == Scene::MOTION_BLUR) {
motion_steps = object_motion_steps(b_parent, b_ob, Object::MAX_MOTION_STEPS);
motion_steps = object_motion_steps(b_parent, b_ob);
geom->motion_steps = motion_steps;
if (motion_steps && object_use_deform_motion(b_parent, b_ob)) {
geom->use_motion_blur = true;

View File

@@ -166,7 +166,7 @@ void BlenderSession::create_session()
/* set buffer parameters */
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
b_render, b_v3d, b_rv3d, scene->camera, width, height);
session->reset(buffer_params, session_params.samples);
b_engine.use_highlight_tiles(session_params.progressive_refine == false);
@@ -244,7 +244,7 @@ void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsg
BL::SpaceView3D b_null_space_view3d(PointerRNA_NULL);
BL::RegionView3D b_null_region_view3d(PointerRNA_NULL);
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_null_space_view3d, b_null_region_view3d, scene->camera, width, height);
b_render, b_null_space_view3d, b_null_region_view3d, scene->camera, width, height);
session->reset(buffer_params, session_params.samples);
b_engine.use_highlight_tiles(session_params.progressive_refine == false);
@@ -278,6 +278,8 @@ static ShaderEvalType get_shader_type(const string &pass_type)
return SHADER_EVAL_GLOSSY_COLOR;
else if (strcmp(shader_type, "TRANSMISSION_COLOR") == 0)
return SHADER_EVAL_TRANSMISSION_COLOR;
else if (strcmp(shader_type, "SUBSURFACE_COLOR") == 0)
return SHADER_EVAL_SUBSURFACE_COLOR;
else if (strcmp(shader_type, "EMIT") == 0)
return SHADER_EVAL_EMISSION;
@@ -294,6 +296,8 @@ static ShaderEvalType get_shader_type(const string &pass_type)
return SHADER_EVAL_GLOSSY;
else if (strcmp(shader_type, "TRANSMISSION") == 0)
return SHADER_EVAL_TRANSMISSION;
else if (strcmp(shader_type, "SUBSURFACE") == 0)
return SHADER_EVAL_SUBSURFACE;
/* extra */
else if (strcmp(shader_type, "ENVIRONMENT") == 0)
@@ -456,7 +460,7 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
SessionParams session_params = BlenderSync::get_session_params(
b_engine, b_userpref, b_scene, background);
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
b_render, b_v3d, b_rv3d, scene->camera, width, height);
/* render each layer */
BL::ViewLayer b_view_layer = b_depsgraph.view_layer_eval();
@@ -470,8 +474,7 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
b_rlay_name = b_view_layer.name();
/* add passes */
vector<Pass> passes = sync->sync_render_passes(
b_rlay, b_view_layer, session_params.adaptive_sampling);
vector<Pass> passes = sync->sync_render_passes(b_rlay, b_view_layer);
buffer_params.passes = passes;
PointerRNA crl = RNA_pointer_get(&b_view_layer.ptr, "cycles");
@@ -637,6 +640,8 @@ static int bake_pass_filter_get(const int pass_filter)
flag |= BAKE_FILTER_GLOSSY;
if ((pass_filter & BL::BakeSettings::pass_filter_TRANSMISSION) != 0)
flag |= BAKE_FILTER_TRANSMISSION;
if ((pass_filter & BL::BakeSettings::pass_filter_SUBSURFACE) != 0)
flag |= BAKE_FILTER_SUBSURFACE;
if ((pass_filter & BL::BakeSettings::pass_filter_EMIT) != 0)
flag |= BAKE_FILTER_EMISSION;
@@ -701,7 +706,7 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
SessionParams session_params = BlenderSync::get_session_params(
b_engine, b_userpref, b_scene, background);
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
b_render, b_v3d, b_rv3d, scene->camera, width, height);
scene->bake_manager->set_shader_limit((size_t)b_engine.tile_x(), (size_t)b_engine.tile_y());
@@ -846,11 +851,11 @@ void BlenderSession::synchronize(BL::Depsgraph &b_depsgraph_)
if (session->params.modified(session_params) || scene->params.modified(scene_params)) {
free_session();
create_session();
return;
}
/* increase samples, but never decrease */
session->set_samples(session_params.samples);
session->set_denoising_start_sample(session_params.denoising_start_sample);
session->set_pause(session_pause);
/* copy recalc flags, outside of mutex so we can decide to do the real
@@ -881,28 +886,10 @@ void BlenderSession::synchronize(BL::Depsgraph &b_depsgraph_)
else
sync->sync_camera(b_render, b_camera_override, width, height, "");
/* get buffer parameters */
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
if (session_params.device.type != DEVICE_OPTIX &&
session_params.device.denoising_devices.empty()) {
/* cannot use OptiX denoising when it is not supported by the device. */
buffer_params.denoising_data_pass = false;
}
else {
session->set_denoising(buffer_params.denoising_data_pass, true);
}
if (scene->film->denoising_data_pass != buffer_params.denoising_data_pass) {
scene->film->denoising_data_pass = buffer_params.denoising_data_pass;
/* Force a scene and session reset below. */
scene->film->tag_update(scene);
}
/* reset if needed */
if (scene->need_reset()) {
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_render, b_v3d, b_rv3d, scene->camera, width, height);
session->reset(buffer_params, session_params.samples);
/* After session reset, so device is not accessing image data anymore. */
@@ -969,7 +956,7 @@ bool BlenderSession::draw(int w, int h)
SessionParams session_params = BlenderSync::get_session_params(
b_engine, b_userpref, b_scene, background);
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
b_render, b_v3d, b_rv3d, scene->camera, width, height);
bool session_pause = BlenderSync::get_session_pause(b_scene, background);
if (session_pause == false) {
@@ -987,7 +974,7 @@ bool BlenderSession::draw(int w, int h)
/* draw */
BufferParams buffer_params = BlenderSync::get_buffer_params(
b_scene, b_render, b_v3d, b_rv3d, scene->camera, width, height);
b_render, b_v3d, b_rv3d, scene->camera, width, height);
DeviceDrawParams draw_params;
if (session->params.display_buffer_linear) {

View File

@@ -17,19 +17,15 @@
#ifndef __BLENDER_SESSION_H__
#define __BLENDER_SESSION_H__
#include "RNA_blender_cpp.h"
#include "device/device.h"
#include "render/bake.h"
#include "render/scene.h"
#include "render/session.h"
#include "render/bake.h"
#include "util/util_vector.h"
CCL_NAMESPACE_BEGIN
class BlenderSync;
class ImageMetaData;
class Scene;
class Session;

View File

@@ -323,13 +323,6 @@ static ShaderNode *add_node(Scene *scene,
vector_math_node->type = (NodeVectorMathType)b_vector_math_node.operation();
node = vector_math_node;
}
else if (b_node.is_a(&RNA_ShaderNodeVectorRotate)) {
BL::ShaderNodeVectorRotate b_vector_rotate_node(b_node);
VectorRotateNode *vector_rotate_node = new VectorRotateNode();
vector_rotate_node->type = (NodeVectorRotateType)b_vector_rotate_node.rotation_type();
vector_rotate_node->invert = b_vector_rotate_node.invert();
node = vector_rotate_node;
}
else if (b_node.is_a(&RNA_ShaderNodeVectorTransform)) {
BL::ShaderNodeVectorTransform b_vector_transform_node(b_node);
VectorTransformNode *vtransform = new VectorTransformNode();
@@ -641,14 +634,6 @@ static ShaderNode *add_node(Scene *scene,
BL::Image b_image(b_image_node.image());
BL::ImageUser b_image_user(b_image_node.image_user());
ImageTextureNode *image = new ImageTextureNode();
image->interpolation = get_image_interpolation(b_image_node);
image->extension = get_image_extension(b_image_node);
image->projection = (NodeImageProjection)b_image_node.projection();
image->projection_blend = b_image_node.projection_blend();
BL::TexMapping b_texture_mapping(b_image_node.texture_mapping());
get_tex_mapping(&image->tex_mapping, b_texture_mapping);
if (b_image) {
/* builtin images will use callback-based reading because
* they could only be loaded correct from blender side
@@ -691,10 +676,21 @@ static ShaderNode *add_node(Scene *scene,
/* TODO(sergey): Does not work properly when we change builtin type. */
#if 0
if (b_image.is_updated()) {
scene->image_manager->tag_reload_image(image->image_key());
scene->image_manager->tag_reload_image(image->filename.string(),
image->builtin_data,
get_image_interpolation(b_image_node),
get_image_extension(b_image_node),
image->use_alpha,
image->colorspace);
}
#endif
}
image->projection = (NodeImageProjection)b_image_node.projection();
image->interpolation = get_image_interpolation(b_image_node);
image->extension = get_image_extension(b_image_node);
image->projection_blend = b_image_node.projection_blend();
BL::TexMapping b_texture_mapping(b_image_node.texture_mapping());
get_tex_mapping(&image->tex_mapping, b_texture_mapping);
node = image;
}
else if (b_node.is_a(&RNA_ShaderNodeTexEnvironment)) {
@@ -702,12 +698,6 @@ static ShaderNode *add_node(Scene *scene,
BL::Image b_image(b_env_node.image());
BL::ImageUser b_image_user(b_env_node.image_user());
EnvironmentTextureNode *env = new EnvironmentTextureNode();
env->interpolation = get_image_interpolation(b_env_node);
env->projection = (NodeEnvironmentProjection)b_env_node.projection();
BL::TexMapping b_texture_mapping(b_env_node.texture_mapping());
get_tex_mapping(&env->tex_mapping, b_texture_mapping);
if (b_image) {
bool is_builtin = b_image.packed_file() || b_image.source() == BL::Image::source_GENERATED ||
b_image.source() == BL::Image::source_MOVIE ||
@@ -735,10 +725,19 @@ static ShaderNode *add_node(Scene *scene,
/* TODO(sergey): Does not work properly when we change builtin type. */
#if 0
if (b_image.is_updated()) {
scene->image_manager->tag_reload_image(env->image_key());
scene->image_manager->tag_reload_image(env->filename.string(),
env->builtin_data,
get_image_interpolation(b_env_node),
EXTENSION_REPEAT,
env->use_alpha,
env->colorspace);
}
#endif
}
env->interpolation = get_image_interpolation(b_env_node);
env->projection = (NodeEnvironmentProjection)b_env_node.projection();
BL::TexMapping b_texture_mapping(b_env_node.texture_mapping());
get_tex_mapping(&env->tex_mapping, b_texture_mapping);
node = env;
}
else if (b_node.is_a(&RNA_ShaderNodeTexGradient)) {
@@ -771,8 +770,6 @@ static ShaderNode *add_node(Scene *scene,
BL::ShaderNodeTexWave b_wave_node(b_node);
WaveTextureNode *wave = new WaveTextureNode();
wave->type = (NodeWaveType)b_wave_node.wave_type();
wave->bands_direction = (NodeWaveBandsDirection)b_wave_node.bands_direction();
wave->rings_direction = (NodeWaveRingsDirection)b_wave_node.rings_direction();
wave->profile = (NodeWaveProfile)b_wave_node.wave_profile();
BL::TexMapping b_texture_mapping(b_wave_node.texture_mapping());
get_tex_mapping(&wave->tex_mapping, b_texture_mapping);
@@ -891,7 +888,12 @@ static ShaderNode *add_node(Scene *scene,
if (true) {
point_density->add_image();
b_point_density_node.cache_point_density(b_depsgraph);
scene->image_manager->tag_reload_image(point_density->image_key());
scene->image_manager->tag_reload_image(point_density->filename.string(),
point_density->builtin_data,
point_density->interpolation,
EXTENSION_CLIP,
IMAGE_ALPHA_AUTO,
u_colorspace_raw);
}
node = point_density;

View File

@@ -296,16 +296,6 @@ void BlenderSync::sync_integrator()
integrator->sample_all_lights_indirect = get_boolean(cscene, "sample_all_lights_indirect");
integrator->light_sampling_threshold = get_float(cscene, "light_sampling_threshold");
if (RNA_boolean_get(&cscene, "use_adaptive_sampling")) {
integrator->sampling_pattern = SAMPLING_PATTERN_PMJ;
integrator->adaptive_min_samples = get_int(cscene, "adaptive_min_samples");
integrator->adaptive_threshold = get_float(cscene, "adaptive_threshold");
}
else {
integrator->adaptive_min_samples = INT_MAX;
integrator->adaptive_threshold = 0.0f;
}
int diffuse_samples = get_int(cscene, "diffuse_samples");
int glossy_samples = get_int(cscene, "glossy_samples");
int transmission_samples = get_int(cscene, "transmission_samples");
@@ -322,8 +312,6 @@ void BlenderSync::sync_integrator()
integrator->mesh_light_samples = mesh_light_samples * mesh_light_samples;
integrator->subsurface_samples = subsurface_samples * subsurface_samples;
integrator->volume_samples = volume_samples * volume_samples;
integrator->adaptive_min_samples = min(
integrator->adaptive_min_samples * integrator->adaptive_min_samples, INT_MAX);
}
else {
integrator->diffuse_samples = diffuse_samples;
@@ -473,16 +461,19 @@ PassType BlenderSync::get_pass_type(BL::RenderPass &b_pass)
MAP_PASS("DiffDir", PASS_DIFFUSE_DIRECT);
MAP_PASS("GlossDir", PASS_GLOSSY_DIRECT);
MAP_PASS("TransDir", PASS_TRANSMISSION_DIRECT);
MAP_PASS("SubsurfaceDir", PASS_SUBSURFACE_DIRECT);
MAP_PASS("VolumeDir", PASS_VOLUME_DIRECT);
MAP_PASS("DiffInd", PASS_DIFFUSE_INDIRECT);
MAP_PASS("GlossInd", PASS_GLOSSY_INDIRECT);
MAP_PASS("TransInd", PASS_TRANSMISSION_INDIRECT);
MAP_PASS("SubsurfaceInd", PASS_SUBSURFACE_INDIRECT);
MAP_PASS("VolumeInd", PASS_VOLUME_INDIRECT);
MAP_PASS("DiffCol", PASS_DIFFUSE_COLOR);
MAP_PASS("GlossCol", PASS_GLOSSY_COLOR);
MAP_PASS("TransCol", PASS_TRANSMISSION_COLOR);
MAP_PASS("SubsurfaceCol", PASS_SUBSURFACE_COLOR);
MAP_PASS("Emit", PASS_EMISSION);
MAP_PASS("Env", PASS_BACKGROUND);
@@ -496,8 +487,6 @@ PassType BlenderSync::get_pass_type(BL::RenderPass &b_pass)
MAP_PASS("Debug Ray Bounces", PASS_RAY_BOUNCES);
#endif
MAP_PASS("Debug Render Time", PASS_RENDER_TIME);
MAP_PASS("AdaptiveAuxBuffer", PASS_ADAPTIVE_AUX_BUFFER);
MAP_PASS("Debug Sample Count", PASS_SAMPLE_COUNT);
if (string_startswith(name, cryptomatte_prefix)) {
return PASS_CRYPTOMATTE;
}
@@ -533,9 +522,7 @@ int BlenderSync::get_denoising_pass(BL::RenderPass &b_pass)
return -1;
}
vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
BL::ViewLayer &b_view_layer,
bool adaptive_sampling)
vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLayer &b_view_layer)
{
vector<Pass> passes;
@@ -569,6 +556,8 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
MAP_OPTION("denoising_glossy_indirect", DENOISING_CLEAN_GLOSSY_IND);
MAP_OPTION("denoising_transmission_direct", DENOISING_CLEAN_TRANSMISSION_DIR);
MAP_OPTION("denoising_transmission_indirect", DENOISING_CLEAN_TRANSMISSION_IND);
MAP_OPTION("denoising_subsurface_direct", DENOISING_CLEAN_SUBSURFACE_DIR);
MAP_OPTION("denoising_subsurface_indirect", DENOISING_CLEAN_SUBSURFACE_IND);
#undef MAP_OPTION
}
b_engine.add_pass("Noisy Image", 4, "RGBA", b_view_layer.name().c_str());
@@ -611,10 +600,6 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
b_engine.add_pass("Debug Render Time", 1, "X", b_view_layer.name().c_str());
Pass::add(PASS_RENDER_TIME, passes, "Debug Render Time");
}
if (get_boolean(crp, "pass_debug_sample_count")) {
b_engine.add_pass("Debug Sample Count", 1, "X", b_view_layer.name().c_str());
Pass::add(PASS_SAMPLE_COUNT, passes, "Debug Sample Count");
}
if (get_boolean(crp, "use_pass_volume_direct")) {
b_engine.add_pass("VolumeDir", 3, "RGB", b_view_layer.name().c_str());
Pass::add(PASS_VOLUME_DIRECT, passes, "VolumeDir");
@@ -661,13 +646,6 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay,
CRYPT_ACCURATE);
}
if (adaptive_sampling) {
Pass::add(PASS_ADAPTIVE_AUX_BUFFER, passes);
if (!get_boolean(crp, "pass_debug_sample_count")) {
Pass::add(PASS_SAMPLE_COUNT, passes);
}
}
RNA_BEGIN (&crp, b_aov, "aovs") {
bool is_color = (get_enum(b_aov, "type") == 1);
string name = get_string(b_aov, "name");
@@ -859,7 +837,6 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
/* other parameters */
params.start_resolution = get_int(cscene, "preview_start_resolution");
params.denoising_start_sample = get_int(cscene, "preview_denoising_start_sample");
params.pixel_size = b_engine.get_preview_pixel_size(b_scene);
/* other parameters */
@@ -869,10 +846,20 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
/* progressive refine */
BL::RenderSettings b_r = b_scene.render();
params.progressive_refine = b_engine.is_preview() ||
get_boolean(cscene, "use_progressive_refine");
if (b_r.use_save_buffers())
params.progressive_refine = false;
params.progressive_refine = (b_engine.is_preview() ||
get_boolean(cscene, "use_progressive_refine")) &&
!b_r.use_save_buffers();
if (params.progressive_refine) {
BL::Scene::view_layers_iterator b_view_layer;
for (b_scene.view_layers.begin(b_view_layer); b_view_layer != b_scene.view_layers.end();
++b_view_layer) {
PointerRNA crl = RNA_pointer_get(&b_view_layer->ptr, "cycles");
if (get_boolean(crl, "use_denoising")) {
params.progressive_refine = false;
}
}
}
if (background) {
if (params.progressive_refine)
@@ -907,8 +894,6 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
params.use_profiling = params.device.has_profiling && !b_engine.is_preview() && background &&
BlenderSession::print_render_stats;
params.adaptive_sampling = RNA_boolean_get(&cscene, "use_adaptive_sampling");
return params;
}

View File

@@ -71,9 +71,7 @@ class BlenderSync {
int height,
void **python_thread_state);
void sync_view_layer(BL::SpaceView3D &b_v3d, BL::ViewLayer &b_view_layer);
vector<Pass> sync_render_passes(BL::RenderLayer &b_render_layer,
BL::ViewLayer &b_view_layer,
bool adaptive_sampling);
vector<Pass> sync_render_passes(BL::RenderLayer &b_render_layer, BL::ViewLayer &b_view_layer);
void sync_integrator();
void sync_camera(BL::RenderSettings &b_render,
BL::Object &b_override,
@@ -97,8 +95,7 @@ class BlenderSync {
BL::Scene &b_scene,
bool background);
static bool get_session_pause(BL::Scene &b_scene, bool background);
static BufferParams get_buffer_params(BL::Scene &b_scene,
BL::RenderSettings &b_render,
static BufferParams get_buffer_params(BL::RenderSettings &b_render,
BL::SpaceView3D &b_v3d,
BL::RegionView3D &b_rv3d,
Camera *cam,
@@ -139,20 +136,14 @@ class BlenderSync {
bool *use_portal);
/* Volume */
void sync_volume(BL::Object &b_ob, Mesh *mesh, const vector<Shader *> &used_shaders);
void sync_volume(BL::Object &b_ob, Mesh *mesh);
/* Mesh */
void sync_mesh(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Mesh *mesh,
const vector<Shader *> &used_shaders);
void sync_mesh(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh);
void sync_mesh_motion(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh, int motion_step);
/* Hair */
void sync_hair(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Geometry *geom,
const vector<Shader *> &used_shaders);
void sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Geometry *geom);
void sync_hair_motion(BL::Depsgraph b_depsgraph,
BL::Object b_ob,
Geometry *geom,

View File

@@ -483,9 +483,7 @@ static inline void mesh_texture_space(BL::Mesh &b_mesh, float3 &loc, float3 &siz
}
/* Object motion steps, returns 0 if no motion blur needed. */
static inline uint object_motion_steps(BL::Object &b_parent,
BL::Object &b_ob,
const int max_steps = INT_MAX)
static inline uint object_motion_steps(BL::Object &b_parent, BL::Object &b_ob)
{
/* Get motion enabled and steps from object itself. */
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
@@ -494,7 +492,7 @@ static inline uint object_motion_steps(BL::Object &b_parent,
return 0;
}
int steps = max(1, get_int(cobject, "motion_steps"));
uint steps = max(1, get_int(cobject, "motion_steps"));
/* Also check parent object, so motion blur and steps can be
* controlled by dupligroup duplicator for linked groups. */
@@ -512,7 +510,7 @@ static inline uint object_motion_steps(BL::Object &b_parent,
/* Use uneven number of steps so we get one keyframe at the current frame,
* and use 2^(steps - 1) so objects with more/fewer steps still have samples
* at the same times, to avoid sampling at many different times. */
return min((2 << (steps - 1)) + 1, max_steps);
return (2 << (steps - 1)) + 1;
}
/* object uses deformation motion blur */

View File

@@ -61,17 +61,6 @@ const bool BlenderViewportParameters::custom_viewport_parameters() const
return !(use_scene_world && use_scene_lights);
}
bool BlenderViewportParameters::get_viewport_display_denoising(BL::SpaceView3D &b_v3d,
BL::Scene &b_scene)
{
bool use_denoising = false;
if (b_v3d) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
use_denoising = get_enum(cscene, "preview_denoising") != 0;
}
return use_denoising;
}
PassType BlenderViewportParameters::get_viewport_display_render_pass(BL::SpaceView3D &b_v3d)
{
PassType display_pass = PASS_NONE;
@@ -83,11 +72,6 @@ PassType BlenderViewportParameters::get_viewport_display_render_pass(BL::SpaceVi
return display_pass;
}
bool update_viewport_display_denoising(BL::SpaceView3D &b_v3d, BL::Scene &b_scene)
{
return BlenderViewportParameters::get_viewport_display_denoising(b_v3d, b_scene);
}
PassType update_viewport_display_passes(BL::SpaceView3D &b_v3d, vector<Pass> &passes)
{
if (b_v3d) {

View File

@@ -44,15 +44,11 @@ class BlenderViewportParameters {
friend class BlenderSync;
public:
/* Get whether to enable denoising data pass in viewport. */
static bool get_viewport_display_denoising(BL::SpaceView3D &b_v3d, BL::Scene &b_scene);
/* Retrieve the render pass that needs to be displayed on the given `SpaceView3D`
* When the `b_v3d` parameter is not given `PASS_NONE` will be returned. */
static PassType get_viewport_display_render_pass(BL::SpaceView3D &b_v3d);
};
bool update_viewport_display_denoising(BL::SpaceView3D &b_v3d, BL::Scene &b_scene);
PassType update_viewport_display_passes(BL::SpaceView3D &b_v3d, vector<Pass> &passes);
CCL_NAMESPACE_END

View File

@@ -51,13 +51,18 @@ static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Mesh *mesh, float
Attribute *attr = mesh->attributes.add(std);
VoxelAttribute *volume_data = attr->data_voxel();
ImageMetaData metadata;
ImageKey key;
key.filename = Attribute::standard_name(std);
key.builtin_data = b_ob.ptr.data;
bool animated = false;
volume_data->manager = image_manager;
volume_data->slot = image_manager->add_image(key, frame, metadata);
volume_data->slot = image_manager->add_image(Attribute::standard_name(std),
b_ob.ptr.data,
animated,
frame,
INTERPOLATION_LINEAR,
EXTENSION_CLIP,
IMAGE_ALPHA_AUTO,
u_colorspace_raw,
metadata);
}
/* Create a matrix to transform from object space to mesh texture space.
@@ -75,13 +80,10 @@ static void sync_smoke_volume(Scene *scene, BL::Object &b_ob, Mesh *mesh, float
}
}
void BlenderSync::sync_volume(BL::Object &b_ob, Mesh *mesh, const vector<Shader *> &used_shaders)
void BlenderSync::sync_volume(BL::Object &b_ob, Mesh *mesh)
{
bool old_has_voxel_attributes = mesh->has_voxel_attributes();
mesh->clear();
mesh->used_shaders = used_shaders;
/* Smoke domain. */
sync_smoke_volume(scene, b_ob, mesh, b_scene.frame_current());

View File

@@ -58,11 +58,6 @@
CCL_NAMESPACE_BEGIN
static_assert(Object::MAX_MOTION_STEPS <= RTC_MAX_TIME_STEP_COUNT,
"Object and Embree max motion steps inconsistent");
static_assert(Object::MAX_MOTION_STEPS == Geometry::MAX_MOTION_STEPS,
"Object and Geometry max motion steps inconsistent");
# define IS_HAIR(x) (x & 1)
/* This gets called by Embree at every valid ray/object intersection.
@@ -562,29 +557,15 @@ void BVHEmbree::add_instance(Object *ob, int i)
instance_bvh->top_level = this;
}
const size_t num_object_motion_steps = ob->use_motion() ? ob->motion.size() : 1;
const size_t num_motion_steps = min(num_object_motion_steps, RTC_MAX_TIME_STEP_COUNT);
assert(num_object_motion_steps <= RTC_MAX_TIME_STEP_COUNT);
const size_t num_motion_steps = ob->use_motion() ? ob->motion.size() : 1;
RTCGeometry geom_id = rtcNewGeometry(rtc_shared_device, RTC_GEOMETRY_TYPE_INSTANCE);
rtcSetGeometryInstancedScene(geom_id, instance_bvh->scene);
rtcSetGeometryTimeStepCount(geom_id, num_motion_steps);
if (ob->use_motion()) {
array<DecomposedTransform> decomp(ob->motion.size());
transform_motion_decompose(decomp.data(), ob->motion.data(), ob->motion.size());
for (size_t step = 0; step < num_motion_steps; ++step) {
RTCQuaternionDecomposition rtc_decomp;
rtcInitQuaternionDecomposition(&rtc_decomp);
rtcQuaternionDecompositionSetQuaternion(
&rtc_decomp, decomp[step].x.w, decomp[step].x.x, decomp[step].x.y, decomp[step].x.z);
rtcQuaternionDecompositionSetScale(
&rtc_decomp, decomp[step].y.w, decomp[step].z.w, decomp[step].w.w);
rtcQuaternionDecompositionSetTranslation(
&rtc_decomp, decomp[step].y.x, decomp[step].y.y, decomp[step].y.z);
rtcQuaternionDecompositionSetSkew(
&rtc_decomp, decomp[step].z.x, decomp[step].z.y, decomp[step].w.x);
rtcSetGeometryTransformQuaternion(geom_id, step, &rtc_decomp);
rtcSetGeometryTransform(
geom_id, step, RTC_FORMAT_FLOAT3X4_ROW_MAJOR, (const float *)&ob->motion[step]);
}
}
else {
@@ -597,7 +578,7 @@ void BVHEmbree::add_instance(Object *ob, int i)
pack.prim_tri_index.push_back_slow(-1);
rtcSetGeometryUserData(geom_id, (void *)instance_bvh->scene);
rtcSetGeometryMask(geom_id, ob->visibility_for_tracing());
rtcSetGeometryMask(geom_id, ob->visibility);
rtcCommitGeometry(geom_id);
rtcAttachGeometryByID(scene, geom_id, i * 2);
@@ -608,17 +589,18 @@ void BVHEmbree::add_triangles(const Object *ob, const Mesh *mesh, int i)
{
size_t prim_offset = pack.prim_index.size();
const Attribute *attr_mP = NULL;
size_t num_geometry_motion_steps = 1;
size_t num_motion_steps = 1;
if (mesh->has_motion_blur()) {
attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
if (attr_mP) {
num_geometry_motion_steps = mesh->motion_steps;
num_motion_steps = mesh->motion_steps;
if (num_motion_steps > RTC_MAX_TIME_STEP_COUNT) {
assert(0);
num_motion_steps = RTC_MAX_TIME_STEP_COUNT;
}
}
}
const size_t num_motion_steps = min(num_geometry_motion_steps, RTC_MAX_TIME_STEP_COUNT);
assert(num_geometry_motion_steps <= RTC_MAX_TIME_STEP_COUNT);
const size_t num_triangles = mesh->num_triangles();
RTCGeometry geom_id = rtcNewGeometry(rtc_shared_device, RTC_GEOMETRY_TYPE_TRIANGLE);
rtcSetGeometryBuildQuality(geom_id, build_quality);
@@ -660,7 +642,7 @@ void BVHEmbree::add_triangles(const Object *ob, const Mesh *mesh, int i)
rtcSetGeometryUserData(geom_id, (void *)prim_offset);
rtcSetGeometryIntersectFilterFunction(geom_id, rtc_filter_func);
rtcSetGeometryOccludedFilterFunction(geom_id, rtc_filter_occluded_func);
rtcSetGeometryMask(geom_id, ob->visibility_for_tracing());
rtcSetGeometryMask(geom_id, ob->visibility);
rtcCommitGeometry(geom_id);
rtcAttachGeometryByID(scene, geom_id, i * 2);
@@ -727,12 +709,6 @@ void BVHEmbree::update_curve_vertex_buffer(RTCGeometry geom_id, const Hair *hair
num_keys += c.num_keys;
}
/* Catmull-Rom splines need extra CVs at the beginning and end of each curve. */
size_t num_keys_embree = num_keys;
if (use_curves) {
num_keys_embree += num_curves * 2;
}
/* Copy the CV data to Embree */
const int t_mid = (num_motion_steps - 1) / 2;
const float *curve_radius = &hair->curve_radius[0];
@@ -747,28 +723,42 @@ void BVHEmbree::update_curve_vertex_buffer(RTCGeometry geom_id, const Hair *hair
}
float4 *rtc_verts = (float4 *)rtcSetNewGeometryBuffer(
geom_id, RTC_BUFFER_TYPE_VERTEX, t, RTC_FORMAT_FLOAT4, sizeof(float) * 4, num_keys_embree);
geom_id, RTC_BUFFER_TYPE_VERTEX, t, RTC_FORMAT_FLOAT4, sizeof(float) * 4, num_keys);
float4 *rtc_tangents = NULL;
if (use_curves) {
rtc_tangents = (float4 *)rtcSetNewGeometryBuffer(
geom_id, RTC_BUFFER_TYPE_TANGENT, t, RTC_FORMAT_FLOAT4, sizeof(float) * 4, num_keys);
assert(rtc_tangents);
}
assert(rtc_verts);
if (rtc_verts) {
if (use_curves) {
if (use_curves && rtc_tangents) {
const size_t num_curves = hair->num_curves();
for (size_t j = 0; j < num_curves; ++j) {
Hair::Curve c = hair->get_curve(j);
int fk = c.first_key;
rtc_verts[0] = float3_to_float4(verts[fk]);
rtc_verts[0].w = curve_radius[fk];
rtc_tangents[0] = float3_to_float4(verts[fk + 1] - verts[fk]);
rtc_tangents[0].w = curve_radius[fk + 1] - curve_radius[fk];
++fk;
int k = 1;
for (; k < c.num_keys + 1; ++k, ++fk) {
for (; k < c.num_segments(); ++k, ++fk) {
rtc_verts[k] = float3_to_float4(verts[fk]);
rtc_verts[k].w = curve_radius[fk];
rtc_tangents[k] = float3_to_float4((verts[fk + 1] - verts[fk - 1]) * 0.5f);
rtc_tangents[k].w = (curve_radius[fk + 1] - curve_radius[fk - 1]) * 0.5f;
}
/* Duplicate Embree's Catmull-Rom spline CVs at the start and end of each curve. */
rtc_verts[0] = rtc_verts[1];
rtc_verts[k] = rtc_verts[k - 1];
rtc_verts += c.num_keys + 2;
rtc_verts[k] = float3_to_float4(verts[fk]);
rtc_verts[k].w = curve_radius[fk];
rtc_tangents[k] = float3_to_float4(verts[fk] - verts[fk - 1]);
rtc_tangents[k].w = curve_radius[fk] - curve_radius[fk - 1];
rtc_verts += c.num_keys;
rtc_tangents += c.num_keys;
}
}
else {
for (size_t j = 0; j < num_keys_embree; ++j) {
for (size_t j = 0; j < num_keys; ++j) {
rtc_verts[j] = float3_to_float4(verts[j]);
rtc_verts[j].w = curve_radius[j];
}
@@ -781,17 +771,14 @@ void BVHEmbree::add_curves(const Object *ob, const Hair *hair, int i)
{
size_t prim_offset = pack.prim_index.size();
const Attribute *attr_mP = NULL;
size_t num_geometry_motion_steps = 1;
size_t num_motion_steps = 1;
if (hair->has_motion_blur()) {
attr_mP = hair->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
if (attr_mP) {
num_geometry_motion_steps = hair->motion_steps;
num_motion_steps = hair->motion_steps;
}
}
const size_t num_motion_steps = min(num_geometry_motion_steps, RTC_MAX_TIME_STEP_COUNT);
assert(num_geometry_motion_steps <= RTC_MAX_TIME_STEP_COUNT);
const size_t num_curves = hair->num_curves();
size_t num_segments = 0;
for (size_t j = 0; j < num_curves; ++j) {
@@ -812,8 +799,8 @@ void BVHEmbree::add_curves(const Object *ob, const Hair *hair, int i)
enum RTCGeometryType type = (!use_curves) ?
RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE :
(use_ribbons ? RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE :
RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE);
(use_ribbons ? RTC_GEOMETRY_TYPE_FLAT_HERMITE_CURVE :
RTC_GEOMETRY_TYPE_ROUND_HERMITE_CURVE);
RTCGeometry geom_id = rtcNewGeometry(rtc_shared_device, type);
rtcSetGeometryTessellationRate(geom_id, curve_subdivisions);
@@ -824,10 +811,6 @@ void BVHEmbree::add_curves(const Object *ob, const Hair *hair, int i)
Hair::Curve c = hair->get_curve(j);
for (size_t k = 0; k < c.num_segments(); ++k) {
rtc_indices[rtc_index] = c.first_key + k;
if (use_curves) {
/* Room for extra CVs at Catmull-Rom splines. */
rtc_indices[rtc_index] += j * 2;
}
/* Cycles specific data. */
pack.prim_object[prim_object_size + rtc_index] = i;
pack.prim_type[prim_type_size + rtc_index] = (PRIMITIVE_PACK_SEGMENT(
@@ -847,7 +830,7 @@ void BVHEmbree::add_curves(const Object *ob, const Hair *hair, int i)
rtcSetGeometryUserData(geom_id, (void *)prim_offset);
rtcSetGeometryIntersectFilterFunction(geom_id, rtc_filter_func);
rtcSetGeometryOccludedFilterFunction(geom_id, rtc_filter_occluded_func);
rtcSetGeometryMask(geom_id, ob->visibility_for_tracing());
rtcSetGeometryMask(geom_id, ob->visibility);
rtcCommitGeometry(geom_id);
rtcAttachGeometryByID(scene, geom_id, i * 2 + 1);

View File

@@ -135,7 +135,7 @@ if(CYCLES_STANDALONE_REPOSITORY)
####
# embree
if(WITH_CYCLES_EMBREE)
find_package(embree 3.8.0 REQUIRED)
find_package(embree 3.2.4 REQUIRED)
endif()
####

View File

@@ -34,17 +34,13 @@ set(SRC
device_task.cpp
)
set(SRC_CUDA
cuda/device_cuda.h
cuda/device_cuda_impl.cpp
)
set(SRC_OPENCL
opencl/device_opencl.h
opencl/device_opencl_impl.cpp
opencl/opencl.h
opencl/memory_manager.h
opencl/memory_manager.cpp
opencl/opencl_split.cpp
opencl/opencl_util.cpp
opencl/memory_manager.cpp
)
if(WITH_CYCLES_NETWORK)
@@ -102,4 +98,4 @@ endif()
include_directories(${INC})
include_directories(SYSTEM ${INC_SYS})
cycles_add_library(cycles_device "${LIB}" ${SRC} ${SRC_CUDA} ${SRC_OPENCL} ${SRC_HEADERS})
cycles_add_library(cycles_device "${LIB}" ${SRC} ${SRC_OPENCL} ${SRC_HEADERS})

View File

@@ -1,265 +0,0 @@
/*
* Copyright 2011-2013 Blender Foundation
*
* 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.
*/
#ifdef WITH_CUDA
# include "device/device.h"
# include "device/device_denoising.h"
# include "device/device_split_kernel.h"
# include "util/util_map.h"
# ifdef WITH_CUDA_DYNLOAD
# include "cuew.h"
# else
# include "util/util_opengl.h"
# include <cuda.h>
# include <cudaGL.h>
# endif
CCL_NAMESPACE_BEGIN
class CUDASplitKernel;
class CUDADevice : public Device {
friend class CUDASplitKernelFunction;
friend class CUDASplitKernel;
friend class CUDAContextScope;
public:
DedicatedTaskPool task_pool;
CUdevice cuDevice;
CUcontext cuContext;
CUmodule cuModule, cuFilterModule;
size_t device_texture_headroom;
size_t device_working_headroom;
bool move_texture_to_host;
size_t map_host_used;
size_t map_host_limit;
int can_map_host;
int cuDevId;
int cuDevArchitecture;
bool first_error;
CUDASplitKernel *split_kernel;
struct CUDAMem {
CUDAMem() : texobject(0), array(0), use_mapped_host(false)
{
}
CUtexObject texobject;
CUarray array;
/* If true, a mapped host memory in shared_pointer is being used. */
bool use_mapped_host;
};
typedef map<device_memory *, CUDAMem> CUDAMemMap;
CUDAMemMap cuda_mem_map;
struct PixelMem {
GLuint cuPBO;
CUgraphicsResource cuPBOresource;
GLuint cuTexId;
int w, h;
};
map<device_ptr, PixelMem> pixel_mem_map;
/* Bindless Textures */
device_vector<TextureInfo> texture_info;
bool need_texture_info;
/* Kernels */
struct {
bool loaded;
CUfunction adaptive_stopping;
CUfunction adaptive_filter_x;
CUfunction adaptive_filter_y;
CUfunction adaptive_scale_samples;
int adaptive_num_threads_per_block;
} functions;
static bool have_precompiled_kernels();
virtual bool show_samples() const;
virtual BVHLayoutMask get_bvh_layout_mask() const;
void cuda_error_documentation();
bool cuda_error_(CUresult result, const string &stmt);
void cuda_error_message(const string &message);
CUDADevice(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background_);
virtual ~CUDADevice();
bool support_device(const DeviceRequestedFeatures & /*requested_features*/);
bool use_adaptive_compilation();
bool use_split_kernel();
virtual string compile_kernel_get_common_cflags(
const DeviceRequestedFeatures &requested_features, bool filter = false, bool split = false);
string compile_kernel(const DeviceRequestedFeatures &requested_features,
const char *name,
const char *base = "cuda",
bool force_ptx = false);
virtual bool load_kernels(const DeviceRequestedFeatures &requested_features);
void load_functions();
void reserve_local_memory(const DeviceRequestedFeatures &requested_features);
void init_host_memory();
void load_texture_info();
void move_textures_to_host(size_t size, bool for_texture);
CUDAMem *generic_alloc(device_memory &mem, size_t pitch_padding = 0);
void generic_copy_to(device_memory &mem);
void generic_free(device_memory &mem);
void mem_alloc(device_memory &mem);
void mem_copy_to(device_memory &mem);
void mem_copy_from(device_memory &mem, int y, int w, int h, int elem);
void mem_zero(device_memory &mem);
void mem_free(device_memory &mem);
device_ptr mem_alloc_sub_ptr(device_memory &mem, int offset, int /*size*/);
virtual void const_copy_to(const char *name, void *host, size_t size);
void tex_alloc(device_memory &mem);
void tex_free(device_memory &mem);
bool denoising_non_local_means(device_ptr image_ptr,
device_ptr guide_ptr,
device_ptr variance_ptr,
device_ptr out_ptr,
DenoisingTask *task);
bool denoising_construct_transform(DenoisingTask *task);
bool denoising_accumulate(device_ptr color_ptr,
device_ptr color_variance_ptr,
device_ptr scale_ptr,
int frame,
DenoisingTask *task);
bool denoising_solve(device_ptr output_ptr, DenoisingTask *task);
bool denoising_combine_halves(device_ptr a_ptr,
device_ptr b_ptr,
device_ptr mean_ptr,
device_ptr variance_ptr,
int r,
int4 rect,
DenoisingTask *task);
bool denoising_divide_shadow(device_ptr a_ptr,
device_ptr b_ptr,
device_ptr sample_variance_ptr,
device_ptr sv_variance_ptr,
device_ptr buffer_variance_ptr,
DenoisingTask *task);
bool denoising_get_feature(int mean_offset,
int variance_offset,
device_ptr mean_ptr,
device_ptr variance_ptr,
float scale,
DenoisingTask *task);
bool denoising_write_feature(int out_offset,
device_ptr from_ptr,
device_ptr buffer_ptr,
DenoisingTask *task);
bool denoising_detect_outliers(device_ptr image_ptr,
device_ptr variance_ptr,
device_ptr depth_ptr,
device_ptr output_ptr,
DenoisingTask *task);
void denoise(RenderTile &rtile, DenoisingTask &denoising);
void adaptive_sampling_filter(uint filter_sample,
WorkTile *wtile,
CUdeviceptr d_wtile,
CUstream stream = 0);
void adaptive_sampling_post(RenderTile &rtile,
WorkTile *wtile,
CUdeviceptr d_wtile,
CUstream stream = 0);
void path_trace(DeviceTask &task, RenderTile &rtile, device_vector<WorkTile> &work_tiles);
void film_convert(DeviceTask &task,
device_ptr buffer,
device_ptr rgba_byte,
device_ptr rgba_half);
void shader(DeviceTask &task);
CUdeviceptr map_pixels(device_ptr mem);
void unmap_pixels(device_ptr mem);
void pixels_alloc(device_memory &mem);
void pixels_copy_from(device_memory &mem, int y, int w, int h);
void pixels_free(device_memory &mem);
void draw_pixels(device_memory &mem,
int y,
int w,
int h,
int width,
int height,
int dx,
int dy,
int dw,
int dh,
bool transparent,
const DeviceDrawParams &draw_params);
void thread_run(DeviceTask *task);
virtual void task_add(DeviceTask &task);
virtual void task_wait();
virtual void task_cancel();
};
CCL_NAMESPACE_END
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -366,15 +366,6 @@ void Device::draw_pixels(device_memory &rgba,
Device *Device::create(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background)
{
#ifdef WITH_MULTI
if (!info.multi_devices.empty()) {
/* Always create a multi device when info contains multiple devices.
* This is done so that the type can still be e.g. DEVICE_CPU to indicate
* that it is a homogeneous collection of devices, which simplifies checks. */
return device_multi_create(info, stats, profiler, background);
}
#endif
Device *device;
switch (info.type) {
@@ -397,6 +388,11 @@ Device *Device::create(DeviceInfo &info, Stats &stats, Profiler &profiler, bool
device = NULL;
break;
#endif
#ifdef WITH_MULTI
case DEVICE_MULTI:
device = device_multi_create(info, stats, profiler, background);
break;
#endif
#ifdef WITH_NETWORK
case DEVICE_NETWORK:
device = device_network_create(info, stats, profiler, "127.0.0.1");
@@ -590,7 +586,7 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
}
DeviceInfo info;
info.type = subdevices.front().type;
info.type = DEVICE_MULTI;
info.id = "MULTI";
info.description = "Multi Device";
info.num = 0;
@@ -628,14 +624,6 @@ DeviceInfo Device::get_multi_device(const vector<DeviceInfo> &subdevices,
info.multi_devices.push_back(device);
}
/* Create unique ID for this combination of devices. */
info.id += device.id;
/* Set device type to MULTI if subdevices are not of a common type. */
if (device.type != info.type) {
info.type = DEVICE_MULTI;
}
/* Accumulate device info. */
info.has_half_images &= device.has_half_images;
info.has_volume_decoupled &= device.has_volume_decoupled;

View File

@@ -83,7 +83,6 @@ class DeviceInfo {
bool has_profiling; /* Supports runtime collection of profiling info. */
int cpu_threads;
vector<DeviceInfo> multi_devices;
vector<DeviceInfo> denoising_devices;
DeviceInfo()
{

View File

@@ -29,19 +29,16 @@
#include "device/device_intern.h"
#include "device/device_split_kernel.h"
// clang-format off
#include "kernel/kernel.h"
#include "kernel/kernel_compat_cpu.h"
#include "kernel/kernel_types.h"
#include "kernel/split/kernel_split_data.h"
#include "kernel/kernel_globals.h"
#include "kernel/kernel_adaptive_sampling.h"
#include "kernel/filter/filter.h"
#include "kernel/osl/osl_shader.h"
#include "kernel/osl/osl_globals.h"
// clang-format on
#include "render/buffers.h"
#include "render/coverage.h"
@@ -320,10 +317,6 @@ class CPUDevice : public Device {
REGISTER_SPLIT_KERNEL(next_iteration_setup);
REGISTER_SPLIT_KERNEL(indirect_subsurface);
REGISTER_SPLIT_KERNEL(buffer_update);
REGISTER_SPLIT_KERNEL(adaptive_stopping);
REGISTER_SPLIT_KERNEL(adaptive_filter_x);
REGISTER_SPLIT_KERNEL(adaptive_filter_y);
REGISTER_SPLIT_KERNEL(adaptive_adjust_samples);
#undef REGISTER_SPLIT_KERNEL
#undef KERNEL_FUNCTIONS
}
@@ -345,10 +338,7 @@ class CPUDevice : public Device {
if (DebugFlags().cpu.has_sse2() && system_cpu_support_sse2()) {
bvh_layout_mask |= BVH_LAYOUT_BVH4;
}
/* MSVC does not support the -march=native switch and you always end up */
/* with an sse2 kernel when you use WITH_KERNEL_NATIVE. We *cannot* feed */
/* that kernel BVH8 even if the CPU flags would allow for it. */
#if (defined(__x86_64__) || defined(_M_X64)) && !(defined(_MSC_VER) && defined(WITH_KERNEL_NATIVE))
#if defined(__x86_64__) || defined(_M_X64)
if (DebugFlags().cpu.has_avx2() && system_cpu_support_avx2()) {
bvh_layout_mask |= BVH_LAYOUT_BVH8;
}
@@ -518,14 +508,13 @@ class CPUDevice : public Device {
void thread_run(DeviceTask *task)
{
if (task->type == DeviceTask::RENDER)
if (task->type == DeviceTask::RENDER) {
thread_render(*task);
else if (task->type == DeviceTask::SHADER)
thread_shader(*task);
}
else if (task->type == DeviceTask::FILM_CONVERT)
thread_film_convert(*task);
else if (task->type == DeviceTask::DENOISE_BUFFER)
thread_denoise(*task);
else if (task->type == DeviceTask::SHADER)
thread_shader(*task);
}
class CPUDeviceTask : public DeviceTask {
@@ -830,49 +819,6 @@ class CPUDevice : public Device {
return true;
}
bool adaptive_sampling_filter(KernelGlobals *kg, RenderTile &tile)
{
WorkTile wtile;
wtile.x = tile.x;
wtile.y = tile.y;
wtile.w = tile.w;
wtile.h = tile.h;
wtile.offset = tile.offset;
wtile.stride = tile.stride;
wtile.buffer = (float *)tile.buffer;
bool any = false;
for (int y = tile.y; y < tile.y + tile.h; ++y) {
any |= kernel_do_adaptive_filter_x(kg, y, &wtile);
}
for (int x = tile.x; x < tile.x + tile.w; ++x) {
any |= kernel_do_adaptive_filter_y(kg, x, &wtile);
}
return (!any);
}
void adaptive_sampling_post(const RenderTile &tile, KernelGlobals *kg)
{
float *render_buffer = (float *)tile.buffer;
for (int y = tile.y; y < tile.y + tile.h; y++) {
for (int x = tile.x; x < tile.x + tile.w; x++) {
int index = tile.offset + x + y * tile.stride;
ccl_global float *buffer = render_buffer + index * kernel_data.film.pass_stride;
if (buffer[kernel_data.film.pass_sample_count] < 0.0f) {
buffer[kernel_data.film.pass_sample_count] = -buffer[kernel_data.film.pass_sample_count];
float sample_multiplier = tile.sample / max((float)tile.start_sample + 1.0f,
buffer[kernel_data.film.pass_sample_count]);
if (sample_multiplier != 1.0f) {
kernel_adaptive_post_adjust(kg, buffer, sample_multiplier);
}
}
else {
kernel_adaptive_post_adjust(kg, buffer, tile.sample / (tile.sample - 1.0f));
}
}
}
}
void path_trace(DeviceTask &task, RenderTile &tile, KernelGlobals *kg)
{
const bool use_coverage = kernel_data.film.cryptomatte_passes & CRYPT_ACCURATE;
@@ -905,27 +851,14 @@ class CPUDevice : public Device {
path_trace_kernel()(kg, render_buffer, sample, x, y, tile.offset, tile.stride);
}
}
tile.sample = sample + 1;
if (task.adaptive_sampling.use && task.adaptive_sampling.need_filter(sample)) {
const bool stop = adaptive_sampling_filter(kg, tile);
if (stop) {
const int num_progress_samples = end_sample - sample;
tile.sample = end_sample;
task.update_progress(&tile, tile.w * tile.h * num_progress_samples);
break;
}
}
tile.sample = sample + 1;
task.update_progress(&tile, tile.w * tile.h);
}
if (use_coverage) {
coverage.finalize();
}
if (task.adaptive_sampling.use) {
adaptive_sampling_post(tile, kg);
}
}
void denoise(DenoisingTask &denoising, RenderTile &tile)
@@ -990,7 +923,7 @@ class CPUDevice : public Device {
DenoisingTask denoising(this, task);
denoising.profiler = &kg->profiler;
while (task.acquire_tile(this, tile, task.tile_types)) {
while (task.acquire_tile(this, tile)) {
if (tile.task == RenderTile::PATH_TRACE) {
if (use_split_kernel) {
device_only_memory<uchar> void_buffer(this, "void_buffer");
@@ -1021,33 +954,6 @@ class CPUDevice : public Device {
delete split_kernel;
}
void thread_denoise(DeviceTask &task)
{
RenderTile tile;
tile.x = task.x;
tile.y = task.y;
tile.w = task.w;
tile.h = task.h;
tile.buffer = task.buffer;
tile.sample = task.sample + task.num_samples;
tile.num_samples = task.num_samples;
tile.start_sample = task.sample;
tile.offset = task.offset;
tile.stride = task.stride;
tile.buffers = task.buffers;
DenoisingTask denoising(this, task);
ProfilingState denoising_profiler_state;
profiler.add_state(&denoising_profiler_state);
denoising.profiler = &denoising_profiler_state;
denoise(denoising, tile);
task.update_progress(&tile, tile.w * tile.h);
profiler.remove_state(&denoising_profiler_state);
}
void thread_film_convert(DeviceTask &task)
{
float sample_scale = 1.0f / (task.sample + 1);

File diff suppressed because it is too large Load Diff

View File

@@ -17,15 +17,9 @@
#ifndef __DEVICE_INTERN_H__
#define __DEVICE_INTERN_H__
#include "util/util_string.h"
#include "util/util_vector.h"
CCL_NAMESPACE_BEGIN
class Device;
class DeviceInfo;
class Profiler;
class Stats;
Device *device_cpu_create(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background);
bool device_opencl_init();

View File

@@ -427,11 +427,6 @@ template<typename T> class device_vector : public device_memory {
device_copy_to();
}
void copy_from_device()
{
device_copy_from(0, data_width, data_height, sizeof(T));
}
void copy_from_device(int y, int w, int h)
{
device_copy_from(y, w, h, sizeof(T));

View File

@@ -42,7 +42,7 @@ class MultiDevice : public Device {
map<device_ptr, device_ptr> ptr_map;
};
list<SubDevice> devices, denoising_devices;
list<SubDevice> devices;
device_ptr unique_key;
MultiDevice(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background_)
@@ -61,12 +61,6 @@ class MultiDevice : public Device {
}
}
foreach (DeviceInfo &subinfo, info.denoising_devices) {
Device *device = Device::create(subinfo, sub_stats_, profiler, background);
denoising_devices.push_back(SubDevice(device));
}
#ifdef WITH_NETWORK
/* try to add network devices */
ServerDiscovery discovery(true);
@@ -86,18 +80,17 @@ class MultiDevice : public Device {
{
foreach (SubDevice &sub, devices)
delete sub.device;
foreach (SubDevice &sub, denoising_devices)
delete sub.device;
}
const string &error_message()
{
error_msg.clear();
foreach (SubDevice &sub, devices)
error_msg += sub.device->error_message();
foreach (SubDevice &sub, denoising_devices)
error_msg += sub.device->error_message();
foreach (SubDevice &sub, devices) {
if (sub.device->error_message() != "") {
if (error_msg == "")
error_msg = sub.device->error_message();
break;
}
}
return error_msg;
}
@@ -125,12 +118,6 @@ class MultiDevice : public Device {
if (!sub.device->load_kernels(requested_features))
return false;
if (requested_features.use_denoising) {
foreach (SubDevice &sub, denoising_devices)
if (!sub.device->load_kernels(requested_features))
return false;
}
return true;
}
@@ -140,12 +127,6 @@ class MultiDevice : public Device {
if (!sub.device->wait_for_availability(requested_features))
return false;
if (requested_features.use_denoising) {
foreach (SubDevice &sub, denoising_devices)
if (!sub.device->wait_for_availability(requested_features))
return false;
}
return true;
}
@@ -169,26 +150,17 @@ class MultiDevice : public Device {
break;
}
}
return result;
}
bool build_optix_bvh(BVH *bvh)
{
// Broadcast acceleration structure build to all render devices
foreach (SubDevice &sub, devices)
// Broadcast acceleration structure build to all devices
foreach (SubDevice &sub, devices) {
if (!sub.device->build_optix_bvh(bvh))
return false;
return true;
}
virtual void *osl_memory()
{
if (devices.size() > 1) {
return NULL;
}
return devices.front().device->osl_memory();
return true;
}
void mem_alloc(device_memory &mem)
@@ -264,17 +236,6 @@ class MultiDevice : public Device {
sub.ptr_map[key] = mem.device_pointer;
}
if (strcmp(mem.name, "RenderBuffers") == 0) {
foreach (SubDevice &sub, denoising_devices) {
mem.device = sub.device;
mem.device_pointer = (existing_key) ? sub.ptr_map[existing_key] : 0;
mem.device_size = existing_size;
sub.device->mem_zero(mem);
sub.ptr_map[key] = mem.device_pointer;
}
}
mem.device = this;
mem.device_pointer = key;
stats.mem_alloc(mem.device_size - existing_size);
@@ -294,17 +255,6 @@ class MultiDevice : public Device {
sub.ptr_map.erase(sub.ptr_map.find(key));
}
if (strcmp(mem.name, "RenderBuffers") == 0) {
foreach (SubDevice &sub, denoising_devices) {
mem.device = sub.device;
mem.device_pointer = sub.ptr_map[key];
mem.device_size = existing_size;
sub.device->mem_free(mem);
sub.ptr_map.erase(sub.ptr_map.find(key));
}
}
mem.device = this;
mem.device_pointer = 0;
mem.device_size = 0;
@@ -352,21 +302,10 @@ class MultiDevice : public Device {
void map_tile(Device *sub_device, RenderTile &tile)
{
if (!tile.buffer) {
return;
}
foreach (SubDevice &sub, devices) {
if (sub.device == sub_device) {
tile.buffer = sub.ptr_map[tile.buffer];
return;
}
}
foreach (SubDevice &sub, denoising_devices) {
if (sub.device == sub_device) {
tile.buffer = sub.ptr_map[tile.buffer];
return;
if (tile.buffer)
tile.buffer = sub.ptr_map[tile.buffer];
}
}
}
@@ -381,12 +320,6 @@ class MultiDevice : public Device {
i++;
}
foreach (SubDevice &sub, denoising_devices) {
if (sub.device == sub_device)
return i;
i++;
}
return -1;
}
@@ -397,41 +330,24 @@ class MultiDevice : public Device {
continue;
}
device_vector<float> &mem = tiles[i].buffers->buffer;
tiles[i].buffer = mem.device_pointer;
if (mem.device == this && denoising_devices.empty()) {
/* Skip unnecessary copies in viewport mode (buffer covers the
* whole image), but still need to fix up the tile device pointer. */
map_tile(sub_device, tiles[i]);
continue;
}
/* If the tile was rendered on another device, copy its memory to
* to the current device now, for the duration of the denoising task.
* Note that this temporarily modifies the RenderBuffers and calls
* the device, so this function is not thread safe. */
device_vector<float> &mem = tiles[i].buffers->buffer;
if (mem.device != sub_device) {
/* Only copy from device to host once. This is faster, but
* also required for the case where a CPU thread is denoising
* a tile rendered on the GPU. In that case we have to avoid
* overwriting the buffer being de-noised by the CPU thread. */
* overwriting the buffer being denoised by the CPU thread. */
if (!tiles[i].buffers->map_neighbor_copied) {
tiles[i].buffers->map_neighbor_copied = true;
mem.copy_from_device();
mem.copy_from_device(0, mem.data_size, 1);
}
if (mem.device == this) {
/* Can re-use memory if tile is already allocated on the sub device. */
map_tile(sub_device, tiles[i]);
mem.swap_device(sub_device, mem.device_size, tiles[i].buffer);
}
else {
mem.swap_device(sub_device, 0, 0);
}
mem.swap_device(sub_device, 0, 0);
mem.copy_to_device();
tiles[i].buffer = mem.device_pointer;
tiles[i].device_size = mem.device_size;
@@ -442,17 +358,11 @@ class MultiDevice : public Device {
void unmap_neighbor_tiles(Device *sub_device, RenderTile *tiles)
{
device_vector<float> &mem = tiles[9].buffers->buffer;
if (mem.device == this && denoising_devices.empty()) {
return;
}
/* Copy denoised result back to the host. */
device_vector<float> &mem = tiles[9].buffers->buffer;
mem.swap_device(sub_device, tiles[9].device_size, tiles[9].buffer);
mem.copy_from_device();
mem.copy_from_device(0, mem.data_size, 1);
mem.restore_device();
/* Copy denoised result to the original device. */
mem.copy_to_device();
@@ -462,9 +372,7 @@ class MultiDevice : public Device {
}
device_vector<float> &mem = tiles[i].buffers->buffer;
if (mem.device != sub_device && mem.device != this) {
/* Free up memory again if it was allocated for the copy above. */
if (mem.device != sub_device) {
mem.swap_device(sub_device, tiles[i].device_size, tiles[i].buffer);
sub_device->mem_free(mem);
mem.restore_device();
@@ -490,29 +398,10 @@ class MultiDevice : public Device {
void task_add(DeviceTask &task)
{
list<SubDevice> task_devices = devices;
if (!denoising_devices.empty()) {
if (task.type == DeviceTask::DENOISE_BUFFER) {
/* Denoising tasks should be redirected to the denoising devices entirely. */
task_devices = denoising_devices;
}
else if (task.type == DeviceTask::RENDER && (task.tile_types & RenderTile::DENOISE)) {
const uint tile_types = task.tile_types;
/* For normal rendering tasks only redirect the denoising part to the denoising devices.
* Do not need to split the task here, since they all run through 'acquire_tile'. */
task.tile_types = RenderTile::DENOISE;
foreach (SubDevice &sub, denoising_devices) {
sub.device->task_add(task);
}
/* Rendering itself should still be executed on the rendering devices. */
task.tile_types = tile_types ^ RenderTile::DENOISE;
}
}
list<DeviceTask> tasks;
task.split(tasks, task_devices.size());
task.split(tasks, devices.size());
foreach (SubDevice &sub, task_devices) {
foreach (SubDevice &sub, devices) {
if (!tasks.empty()) {
DeviceTask subtask = tasks.front();
tasks.pop_front();
@@ -537,16 +426,12 @@ class MultiDevice : public Device {
{
foreach (SubDevice &sub, devices)
sub.device->task_wait();
foreach (SubDevice &sub, denoising_devices)
sub.device->task_wait();
}
void task_cancel()
{
foreach (SubDevice &sub, devices)
sub.device->task_cancel();
foreach (SubDevice &sub, denoising_devices)
sub.device->task_cancel();
}
protected:

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