If I use glMapBuffer() everything works, but if I use glBufferSubData() , some batches I upload don’t render. What could be the cause? No errors are reported by the GL. The traces also make sense. The bug occurs both on Windows and Linux. But I tested on 1 card/driver combo only.
Maybe the reason is my use of a caching VBO? Specifically, the batches are processed like this:
load batch into VBO if not already there
Maybe GL is freaked by me trying to update a VBO that something is already being rendered from?
If I add the following check after glBufferSubData():
I try to use SubData(), as I have benched that it loaded the caching VBO about a whole millisecond faster on my system than MapBuffer() when cache misses occurred on my nvidia system ( now it’s broken down). Usually, this is not an issue though, as the caching VBO approach works great most of the time, i.e. in most cases the difference between the two approaches is not significant. Still, both approaches ought to work. Interestingly, I’ve noticed this text about SubData():
Consider using multiple buffer objects to avoid stalling the rendering pipeline during data store updates. If any rendering in the pipeline makes reference to data in the buffer object being updated by glBufferSubData, especially from the specific region being updated, that rendering must drain from the pipeline before the data store can be updated.
It is from the GL 2 man pages. Maybe this means, that only MapBuffer() is suitable for VBO caching. I haven’t noticed anything such for MapBuffer(). On the other hand, the driver this fails with is the latest ATI beta for windows and linux…