View Full Version : glBufferSubData use cases
09-15-2010, 03:12 AM
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.
09-15-2010, 03:27 AM
Oops! I forgot to mention that I am particularly interested in glBufferSubData use cases modifying indices arrays... :P
09-15-2010, 07:09 AM
A partial answer to your question was already answered at Post281020 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=281020#Post2810 20). 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.
09-16-2010, 01:01 AM
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 ;)
09-16-2010, 01:52 AM
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.
09-16-2010, 03:33 AM
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 :)
- 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?
09-16-2010, 05:13 AM
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 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=273141#Post2731 41) (see also here (http://www.opengl.org/wiki/Buffer_Object_Streaming)). For more discussion, see this thread (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=282902#Post2829 02).
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.