From 4c4a7e84c64472e38811933646f3fefeb071b0b4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 8 Jan 2018 11:35:48 +0100 Subject: Task scheduler: Use single parallel range function with more flexible function Now all the fine-tuning is happening using parallel range settings structure, which avoid passing long lists of arguments, allows extend fine-tuning further, avoid having lots of various functions which basically does the same thing. --- source/blender/blenlib/intern/BLI_kdopbvh.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'source/blender/blenlib/intern/BLI_kdopbvh.c') diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 6e33f75fe69..03784e31eee 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -923,9 +923,14 @@ static void non_recursive_bvh_div_nodes( cb_data.depth = depth; if (true) { + ParallelRangeSettings settings; + BLI_parallel_range_settings_defaults(&settings); + settings.use_threading = (num_leafs > KDOPBVH_THREAD_LEAF_THRESHOLD); BLI_task_parallel_range( - i, i_stop, &cb_data, non_recursive_bvh_div_nodes_task_cb, - num_leafs > KDOPBVH_THREAD_LEAF_THRESHOLD); + i, i_stop, + &cb_data, + non_recursive_bvh_div_nodes_task_cb, + &settings); } else { /* Less hassle for debugging. */ @@ -1342,9 +1347,14 @@ BVHTreeOverlap *BLI_bvhtree_overlap( data[j].thread = j; } + ParallelRangeSettings settings; + BLI_parallel_range_settings_defaults(&settings); + settings.use_threading = (tree1->totleaf > KDOPBVH_THREAD_LEAF_THRESHOLD); BLI_task_parallel_range( - 0, thread_num, data, bvhtree_overlap_task_cb, - tree1->totleaf > KDOPBVH_THREAD_LEAF_THRESHOLD); + 0, thread_num, + data, + bvhtree_overlap_task_cb, + &settings); for (j = 0; j < thread_num; j++) total += BLI_stack_count(data[j].overlap); -- cgit v1.2.3