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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-12-30 22:39:56 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-12-30 22:39:56 +0300
commit511e3c5d9d503b47cd5fb6fe48abeafde9fbff2d (patch)
tree5777460ffb9b9178d9d46c9db74c5c6d8c60b5e0 /source/blender/blenlib/intern/BLI_kdopbvh.c
parentd9bb4a200c6e41baaa399993e27944f40c14bca3 (diff)
BLI_task: change BLI_task_parallel_range_ex() to just take a bool whether to use threading or not, instead of threshold.
From recent experience, turns out we often do want to use something else than basic range of parallelized forloop as control parameter over threads usage, so now BLI func only takes a boolean, and caller defines best check for its own case.
Diffstat (limited to 'source/blender/blenlib/intern/BLI_kdopbvh.c')
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index d2fc5c7b72b..10e29e09827 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -874,14 +874,9 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
cb_data.i = i;
cb_data.depth = depth;
- if (num_leafs > KDOPBVH_THREAD_LEAF_THRESHOLD) {
- BLI_task_parallel_range_ex(i, end_j, &cb_data, NULL, 0, non_recursive_bvh_div_nodes_task_cb, 0, false);
- }
- else {
- for (j = i; j < end_j; j++) {
- non_recursive_bvh_div_nodes_task_cb(&cb_data, NULL, j);
- }
- }
+ BLI_task_parallel_range_ex(
+ i, end_j, &cb_data, NULL, 0, non_recursive_bvh_div_nodes_task_cb,
+ num_leafs > KDOPBVH_THREAD_LEAF_THRESHOLD, false);
}
}
@@ -1266,14 +1261,9 @@ BVHTreeOverlap *BLI_bvhtree_overlap(
data[j].thread = j;
}
- if (tree1->totleaf > KDOPBVH_THREAD_LEAF_THRESHOLD) {
- BLI_task_parallel_range_ex(0, thread_num, data, NULL, 0, bvhtree_overlap_task_cb, 0, false);
- }
- else {
- for (j = 0; j < thread_num; j++) {
- bvhtree_overlap_task_cb(data, NULL, j);
- }
- }
+ BLI_task_parallel_range_ex(
+ 0, thread_num, data, NULL, 0, bvhtree_overlap_task_cb,
+ tree1->totleaf > KDOPBVH_THREAD_LEAF_THRESHOLD, false);
for (j = 0; j < thread_num; j++)
total += BLI_stack_count(data[j].overlap);