diff options
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index c17c28fa110..79586c71673 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -51,8 +51,6 @@ #define STACK_FIXED_DEPTH 100 -#define PBVH_THREADED_LIMIT 4 - typedef struct PBVHStack { PBVHNode *node; bool revisiting; @@ -1095,8 +1093,7 @@ static void pbvh_faces_update_normals(PBVH *bvh, PBVHNode **nodes, int totnode) }; TaskParallelSettings settings; - BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = (totnode > PBVH_THREADED_LIMIT); + BKE_pbvh_parallel_range_settings(&settings, true, totnode); BLI_task_parallel_range(0, totnode, &data, pbvh_update_normals_accum_task_cb, &settings); @@ -1139,8 +1136,7 @@ void pbvh_update_BB_redraw(PBVH *bvh, PBVHNode **nodes, int totnode, int flag) }; TaskParallelSettings settings; - BLI_parallel_range_settings_defaults(&settings); - settings.use_threading = (totnode > PBVH_THREADED_LIMIT); + BKE_pbvh_parallel_range_settings(&settings, true, totnode); BLI_task_parallel_range(0, totnode, &data, pbvh_update_BB_redraw_task_cb, &settings); } @@ -2549,3 +2545,12 @@ void pbvh_show_mask_set(PBVH *bvh, bool show_mask) { bvh->show_mask = show_mask; } + +void BKE_pbvh_parallel_range_settings(TaskParallelSettings *settings, + bool use_threading, + int totnode) +{ + const int threaded_limit = 4; + BLI_parallel_range_settings_defaults(settings); + settings->use_threading = use_threading && (totnode > threaded_limit); +} |