Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write out instance data in-place when forming batches #219

Open
kvark opened this issue Sep 27, 2018 · 0 comments
Open

Write out instance data in-place when forming batches #219

kvark opened this issue Sep 27, 2018 · 0 comments

Comments

@kvark
Copy link

kvark commented Sep 27, 2018

Currently, WR collects the instance data into Vec<> per batch, which is only copied to GPU-visible memory before the actual draw calls are made. Technically, there is no reason why WR couldn't be writing to the instance memory right when it fills out the batches.

The way I see it - we'd have a pool of allocated buffers (of the type required for instance data). Each batch reserves some pre-determined range in one of the buffers. The current batch can just write out data sequentially without a limited range. Batches that are outside of the lookup distance (i.e. we only look up to 10 batches back when adding an instance) have their ranges cut, so that the pools can re-use that memory. If a batch reaches the end of the allocated instance memory, it's simply closed, and a new one is started.

The benefit it gives us is, similar to #188, that more work is done beforehand (on the render backend side). Actually, this is a dependency of #188, since we can't record commands if the instance data isn't ready yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants