Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-10-09 17:27:04 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-10-10 18:36:12 +0300
commit6c302d6529ec5283334e5ef40d07cc46534f5020 (patch)
treef54712920f8ea8a108f456a8279433c6a1d564a3 /source/blender/blenkernel/BKE_pbvh.h
parent86042b7ced948cda215f002c125c8d850887eff0 (diff)
Sculpt: use TBB instead of BLI_task for multithreading
This solves performance issues on some computers where there is significant threading overhead. Rather than doing the complicated work of optimizing our own task scheduler, use TBB which appears to work well. The downside is that we have another thread pool, but it is already there when using OpenVDB voxel remesh. For future releases we can switch to using TBB to replace our task scheduler implementation entirely, and use the same thread pool for BLI_task, Cycles, Mantaflow, etc. Differential Revision: https://developer.blender.org/D6030
Diffstat (limited to 'source/blender/blenkernel/BKE_pbvh.h')
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 042b78cd06e..13adb868c01 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -28,6 +28,10 @@
/* For embedding CCGKey in iterator. */
#include "BKE_ccg.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct BMLog;
struct BMesh;
struct CCGElem;
@@ -45,6 +49,7 @@ struct PBVH;
struct PBVHNode;
struct SubdivCCG;
struct TaskParallelSettings;
+struct TaskParallelTLS;
typedef struct PBVH PBVH;
typedef struct PBVHNode PBVHNode;
@@ -432,14 +437,39 @@ void BKE_pbvh_node_get_bm_orco_data(PBVHNode *node,
bool BKE_pbvh_node_vert_update_check_any(PBVH *bvh, PBVHNode *node);
-void BKE_pbvh_parallel_range_settings(struct TaskParallelSettings *settings,
- bool use_threading,
- int totnode);
-
// void BKE_pbvh_node_BB_reset(PBVHNode *node);
// void BKE_pbvh_node_BB_expand(PBVHNode *node, float co[3]);
bool pbvh_has_mask(PBVH *bvh);
void pbvh_show_mask_set(PBVH *bvh, bool show_mask);
+/* Parallelization */
+typedef void (*PBVHParallelRangeFunc)(void *__restrict userdata,
+ const int iter,
+ const struct TaskParallelTLS *__restrict tls);
+typedef void (*PBVHParallelReduceFunc)(const void *__restrict userdata,
+ void *__restrict chunk_join,
+ void *__restrict chunk);
+
+typedef struct PBVHParallelSettings {
+ bool use_threading;
+ void *userdata_chunk;
+ size_t userdata_chunk_size;
+ PBVHParallelReduceFunc func_reduce;
+} PBVHParallelSettings;
+
+void BKE_pbvh_parallel_range_settings(struct PBVHParallelSettings *settings,
+ bool use_threading,
+ int totnode);
+
+void BKE_pbvh_parallel_range(const int start,
+ const int stop,
+ void *userdata,
+ PBVHParallelRangeFunc func,
+ const struct PBVHParallelSettings *settings);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __BKE_PBVH_H__ */