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
sg_update_buffer lets you replace the entire buffer, but there are times you only want to e.g. update one row or one section of a buffer or texture between frames.
sg_append_buffer is close by letting you update parts of the buffer at a time, but uses buf->cmn.append_pos so you can only update in small parts sequentially from the buffer start to finish
Possible solutions:
provide a method to increment or set buf->cmn.append_pos to an arbitrary offset (helps buffers only, not images)
maybe: in sg_append_buffer, if the passed sg_range has a non-zero .size but a null .ptr, then interpret this as "move append_pos forward but don't update the buffer"
add functions like sg_sub_buffer(), sg_sub_image()
add extra args to sg_update_buffer() and sg_update_image (breaking change)
The text was updated successfully, but these errors were encountered:
I have a complete rewrite of the resource update functions in mind that would basically look like the WebGPU update functions (e.g. write from CPU to GPU memory, copy between two GPU resources, and possibly copy from GPU memory to CPU memory) - no ETA for that yet though.
Main problem is that this orthogonal resource update API would almost definitely introduce lock-stalls on the OpenGL backends (GL is the main reason for the currently very restricted update and append APIs - end even sg_append_buffer() is making trouble on WebGL, so it's not recommended to use).
Until then the currently recommended workaround is to keep a shadow copy of the resource content in CPU memory, apply partial updates to this shadow copy, and then update the entire resource from the shadow copy - this might even be the best solution after the above mentioned API change in order to avoid lock-stalls on GL backends.
sg_update_buffer
lets you replace the entire buffer, but there are times you only want to e.g. update one row or one section of a buffer or texture between frames.sg_append_buffer
is close by letting you update parts of the buffer at a time, but usesbuf->cmn.append_pos
so you can only update in small parts sequentially from the buffer start to finishPossible solutions:
buf->cmn.append_pos
to an arbitrary offset (helps buffers only, not images)sg_append_buffer
, if the passedsg_range
has a non-zero.size
but a null.ptr
, then interpret this as "move append_pos forward but don't update the buffer"sg_sub_buffer()
,sg_sub_image()
sg_update_buffer()
andsg_update_image
(breaking change)The text was updated successfully, but these errors were encountered: