cegui
cegui copied to clipboard
Render: consider reusing geometry buffers with best matching allocated size
This would improve resource reuse, especially for GPU buffers. To do this, the following is required:
- Make an allocated size an attribute of the base GeometryBuffer
- In the Renderer, store pool sorted by allocated size ascending
- When requesting the new buffer a. If the pool is empty, create new buffer b. If allocated size of pool.back() is less than requested, return the pool from the back with O(1) and let the user code reallocate it c. Else find the best buffer in the pool with lower_bound, maybe with an interpolation search, i.e. hinted version, because we can predict distribution of buffers in a pool by size quite precisely and start searching from the most probable point.