-
Notifications
You must be signed in to change notification settings - Fork 523
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
sokol_gfx.h: Partial buffer/image update #323
Comments
I haven't come up with a good way to do partial image updates yet, currently the only solution is to maintain a complete copy of the image data in memory, accumulate partial updates into this with the CPU, and then do a complete sg_update_image(). This is basically what fontstash is doing to dynamically update the font atlas, it maintains a complete CPU-side copy of the font atlas, and sets a dirty flag to tell the backend API to update the font texture: Lines 1000 to 1011 in 57515a1
For buffers, there's an "append API" (sg_append_buffer), this allows to append new data to a buffer and interleave the data updates with draw calls using that newly appended data. This is only useful for per-frame updated data though (it uses the MAP_WRITE_DISCARD strategy in D3D11). Long term I've got some ideas how to clean up the data update functions (add a map/unmap API for transient per-frame data, and a copy/blit API for "persistent" uploads into buffers and images), but not today or tomorrow. |
Currently, I'm not aware if there is a way to do partial updates with an image or buffer. What I'm looking for is something like the following:
My use case is I have a large 2d texture like a texture atlas or tiled map which I only want to update a sub-region once per frame.
Is there already a way to do what I want with the current API?
The text was updated successfully, but these errors were encountered: