Page MenuHome

BLI_bvhtree_overlap: Improve non-multithreaded usage
ClosedPublic

Authored by Germano Cavalcante (mano-wii) on Thu, Jan 2, 2:46 PM.

Details

Summary

Although not using multithreading, the thread parameter in the BVHTree_OverlapCallback callback always returned a value between the "number of threads".
This can get in the way, as this parameter should always be 0 in such cases.

Also a BLI_Stack was created for each "thread" and used.
This is a small overhead that can be avoided.

This patch fixes these cases.

Diff Detail

Repository
rB Blender

Event Timeline

Germano Cavalcante (mano-wii) retitled this revision from BLI_kdopbvh: Fix inconsistency between threads and nodes to BLI_bvhtree_overlap: Fix inconsistency between threads and nodes.Thu, Jan 2, 2:48 PM

Is always good idea to provide case which was broken to help verifying the patch.

From just reading it seems fine though.

This revision is now accepted and ready to land.Thu, Jan 2, 3:13 PM

Testing again, I realize it was a mess with the BVH_OVERLAP_USE_THREADING flag.
The problem occurred because I made this change on a local branch:

-  const int thread_num = BLI_bvhtree_overlap_thread_num(tree1);
+  const int thread_num = use_threading ? BLI_bvhtree_overlap_thread_num(tree1) : 1;

I expected that since I was not using multithread, this value should be 1.
But then came the problem described in the patch.
Maybe I need to rephrase.

Germano Cavalcante (mano-wii) planned changes to this revision.Thu, Jan 2, 4:56 PM
Germano Cavalcante (mano-wii) retitled this revision from BLI_bvhtree_overlap: Fix inconsistency between threads and nodes to BLI_bvhtree_overlap: Improve non-multithreaded usage.Sat, Jan 4, 2:44 AM
Germano Cavalcante (mano-wii) edited the summary of this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Changes Planned.Sat, Jan 4, 2:55 AM
This revision was automatically updated to reflect the committed changes.