You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if I'm reading the builders correctly, they always allocate a new bvh instance when building. It would be nice to have the option of re-using allocations.
The text was updated successfully, but these errors were encountered:
It's unclear how to pass existing allocations/BVHs/buffers to the BVH builders. For instance, the mini tree builder needs to create mini-trees that require their own allocations of impredictable size, and other builders over-allocate in order to avoid allocating often when building the tree (they over-allocate, then shrink the resulting buffers). This design is very efficient and simple and I would like to keep it as it is.
While it is theoretically possible to pass an additional buffer for builders other than the mini-tree one, there's a good chance that it won't be large enough anyway (due to the over-allocation+shrinking design). That said, if your only concern is performance, you can just drop your old BVH right before building a new one with the same size, and the OS will likely re-use the blocks that were just freed.
If your concern is running this code in an embedded scenario, or some other application where allocations should be tightly controlled, the real solution here would be to use custom STL allocators (that would allow the builders to use a pool-based allocator, for instance). I am open to a PR tackling that problem, if you have the time.
Currently, if I'm reading the builders correctly, they always allocate a new
bvh
instance when building. It would be nice to have the option of re-using allocations.The text was updated successfully, but these errors were encountered: