We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I want to use glMapBufferRange to modify the contents of a sub-buffer, which may currently be in use by the GPU。
Which flags should be used for marking? Would GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_WRITE_BIT be appropriate?
Additionally, could you provide a more detailed explanation of the purpose of GL_MAP_INVALIDATE_RANGE_BIT?
Ref: registry.khronos.org/.../glMapBufferRange.xhtml
Togchen said:to modify the contents of a sub-buffer, which may currently be in use by the GPU
Note that you can have concurrent use of the buffer, but cannot have concurrent use of the subrange within in by CPU and GPU - this is not allowed and is impossible to synchronize safely.
Togchen said:Which flags should be used for marking? Would GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_WRITE_BIT be appropriate?
Yes.
Togchen said:could you provide a more detailed explanation of the purpose of GL_MAP_INVALIDATE_RANGE_BIT
It's a hint to the implementation that you don't need to keep the existing content of that range, so could e.g. use a cache invalidate rather than a cache clean+invalidate on the range to make it coherent with the CPU. What it actually does is implementation-defined, and it may well be a no-op on some.
HTH, Pete