diff options
author | Jacques Lucke <jacques@blender.org> | 2020-10-09 12:56:12 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-10-09 12:56:12 +0300 |
commit | 309c919ee97e272c08f88ebd8341fe962e71e64d (patch) | |
tree | 9543df8455354a0e9370fbca255314a1181d1dd5 /source/blender/blenkernel/CMakeLists.txt | |
parent | 963b45f57494677aefb2c4ae7f4bb60e06a05dbd (diff) |
BKE: parallelize BKE_mesh_calc_edges
`BKE_mesh_calc_edges` was the main performance bottleneck in D9141.
While openvdb only needed ~115ms, calculating the edges afterwards
took ~960ms. Now with some parallelization this is reduced to ~210ms.
Parallelizing `BKE_mesh_calc_edges` is not entirely trivial, because it
has to perform deduplication and some other things that have to happen
in a certain order. Even though the multithreading improves performance
with more threads, there are diminishing returns when too many threads
are used in this function.
The speedup is mainly achieved by having multiple hash tables that are
filled in parallel. The distribution of the edges to hash tables is based on
a hash (that is different from the hash used in the actual hash tables).
I moved the function to C++, because that made it easier for me to
optimize it. Furthermore, I added `BLI_task.hh` which contains some
light tbb wrappers for parallelization.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D9151
Diffstat (limited to 'source/blender/blenkernel/CMakeLists.txt')
-rw-r--r-- | source/blender/blenkernel/CMakeLists.txt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 63e98b94852..0fbc8c4c229 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -175,6 +175,7 @@ set(SRC intern/mesh_runtime.c intern/mesh_tangent.c intern/mesh_validate.c + intern/mesh_validate.cc intern/mesh_wrapper.c intern/modifier.c intern/movieclip.c @@ -690,6 +691,18 @@ if(WITH_XR_OPENXR) add_definitions(-DWITH_XR_OPENXR) endif() +if(WITH_TBB) + add_definitions(-DWITH_TBB) + + list(APPEND INC_SYS + ${TBB_INCLUDE_DIRS} + ) + + list(APPEND LIB + ${TBB_LIBRARIES} + ) +endif() + # # Warnings as errors, this is too strict! # if(MSVC) # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") |