glBufferSubData use cases

Hi there!
I am currently working on the implementation of the VBOs for an OpenGL ES driver and I was wondering about the usage of glBufferSubData. Do you guys use it in your applications? If so, how? What is your use case? That would help me decide what’s the best way to implement the buffers.

Thanks! :slight_smile:

Oops! I forgot to mention that I am particularly interested in glBufferSubData use cases modifying indices arrays:stuck_out_tongue:

A partial answer to your question was already answered at Post281020. If you are changing the elements of the buffer and not the total number of elements then glBufferSubData makes the most sense. If you are hoping to update buffer values on the GPU you may want to look into Transform Feedback to avoid even needing glBufferSubData. It really depends on the exact problem you are trying to solve and whether you have to use the CPU directly or not.

Thanks marshats, but I was not asking about how to use glBufferSubData. I was asking about use cases. How do you guys use it in your applications? I am implementing the drivers not the app :wink:

How do you guys use it in your applications?

I’m not sure what kind of answer you’re looking for. It might be better to phrase the question in terms of particular optimizations you might be thinking about implementing and what usage patterns these optimizations would or would not help.

I’m trying to find the best way to cache the draw call index ranges from index buffers. I may have to invalidate parts of the cache on BufferSubData. That’s why I was asking about the most common use cases, to decide on the data structures and such…
Let’s put it another way. I would be very happy if you could give any answers to the following questions :slight_smile:

  • What do you use BufferSubData for on arrays of indices?
  • What parts of the array are you modifying?
  • Are you using several times the same drawcall on that array or how often does it change?

Thank you!

Last time I benched SubData, it came in about dead last. That’s just a data point. May have been an oddity of my test cases.

For index list and vtx attrib data, currently using the MapBufferRange buffer object streaming technique Rob describes here (see also here). For more discussion, see this thread.