[Bf-blender-cvs] [025d13045ab] master: BLI_bvhtree_overlap: Make sure the number of nodes matches the number of threads

mano-wii noreply at git.blender.org
Sat Jan 4 03:06:29 CET 2020


Commit: 025d13045abec142528f44576bfdcce9ef0da90a
Author: mano-wii
Date:   Fri Jan 3 23:06:07 2020 -0300
Branches: master
https://developer.blender.org/rB025d13045abec142528f44576bfdcce9ef0da90a

BLI_bvhtree_overlap: Make sure the number of nodes matches the number of threads

===================================================================

M	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 994fd510ac8..2674e6c61dc 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -1302,7 +1302,8 @@ BVHTreeOverlap *BLI_bvhtree_overlap_ex(
   /* `RETURN_PAIRS` was not implemented without `max_interations`. */
   BLI_assert(overlap_pairs || max_interactions);
 
-  const int thread_num = use_threading ? BLI_bvhtree_overlap_thread_num(tree1) : 1;
+  const int root_node_len = BLI_bvhtree_overlap_thread_num(tree1);
+  const int thread_num = use_threading ? root_node_len : 1;
   int j;
   size_t total = 0;
   BVHTreeOverlap *overlap = NULL, *to = NULL;
@@ -1352,7 +1353,7 @@ BVHTreeOverlap *BLI_bvhtree_overlap_ex(
   BLI_parallel_range_settings_defaults(&settings);
   settings.use_threading = use_threading;
   BLI_task_parallel_range(0,
-                          root1->totnode,
+                          root_node_len,
                           data,
                           max_interactions ? bvhtree_overlap_num_task_cb : bvhtree_overlap_task_cb,
                           &settings);



More information about the Bf-blender-cvs mailing list