opengl - Write-only `glMapBuffer`, what if I don't write it all? -
say i've got buffer object data in it.
i use glmapbuffer
gl_write_only
, write every second byte (think interleaved vertex attributes).
then glunmapbuffer
buffer.
are bytes didn't write preserved or undefined?
i'm wondering because main purpose of gl_write_only
seems to avoid transferring previous content of buffer card's memory main memory. driver, however, has no way of knowing bytes i've written in order update buffer partially.
so either driver transfers content main memory first, rendering gl_write_only
pointless on pretty every platform think of. or assumed write complete mapped area. yet no such obligation mentioned in man pages.
short answer: data preserved.
i'm wondering because main purpose of gl_write_only seems to avoid transferring previous content of buffer card's memory main memory.
well, implementation has many potential ways fullfill request, , access flags may in decision of path go. example, driver may decide direct i/o mapping of buffer in vram instead of using system ram mapping.
the issues see addressed more modern glmapbufferrange()
api introduced in gl_arb_map_buffer_range
extension. although name might suggest mapping parts of buffers, superseeds glmapbuffer()
function , allows finer control. example, gl_map_invalidate_range_bit
or gl_map_invalidate_buffer_bit
flags mark data invalid , enable optimizations had in mind general gl_write_only
case. without these, data preserved, , how done implementation's problem.
Comments
Post a Comment