The title actually covers it all, This commit exploits all the work
being done in previous changes to make it possible to build spatial
splits in threads.
Works quite nicely, but has a downside of some extra memory usage.
This extra memory usage is partially solvable, but partially it's
something we'll have to simply accept.
Things to take care about before it could be considered final and
merged:
- Thread tasks do have a coy of BVHRange now, which makes it so builder uses more memory, even comparing with the regular BVH builder.
Idea here would be to limit amount of tasks which do exist in the scheduling queue. Implementing this is quite tricky tho.
- Leaf creating uses quite bad policy of reserving memory now. Need to think of something smarter to approximate overall count of leaves more accurate.
We really should minimize amount of re-allocations here, so being not really accurate on approximation has performance benefits here.
- Progress update is done differently from the regular BVH builder so far. We can make it to match tho.