Jump to content

  • Log In with Google      Sign In   
  • Create Account


Invalidating Buffers


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 EarthBanana   Members   -  Reputation: 849

Like
0Likes
Like

Posted 09 November 2013 - 03:03 PM

There are a lot of cool new tools with opengl 4.4 - like immutable storage for buffer objects - but reading about all of these things from the opengl wiki leaves me wondering...

 

Should I be invalidating buffer objects before doing reallocation?

 

The wiki says that on invalidating a buffer object, pending draw calls and other operations will complete using the old data in the buffer, which is what I would hope for since opengl can draw things whenever the best time to draw them might be.

 

My question is this, if I call glBufferData() and fill the buffer with some other data, will pending draw calls that opengl has not executed yet use the old data as it would if I invalidated the buffer? Or should I invalidate the buffer before I call glBufferData with new data?



Sponsor:

#2 N.I.B.   Members   -  Reputation: 1101

Like
1Likes
Like

Posted 09 November 2013 - 03:32 PM


My question is this, if I call glBufferData() and fill the buffer with some other data, will pending draw calls that opengl has not executed yet use the old data as it would if I invalidated the buffer? Or should I invalidate the buffer before I call glBufferData with new data?

 

No need to invalidate. The draw call will use the buffer data that was present when the draw call was made.

 

glInvalidateBufferData() and friends are basically a performance hint for the driver, indicating you don't need the content of the buffer anymore. This allows the driver to optimize some stuff internally (avoiding clears, release internal memory, clearing texture cache). It makes no guarantee as to what will actually happen - for all you know the driver can completely ignore those calls.

 

The ARB definition has a very good explanation and examples on how to use it. You can also check G-Truc OGL 4.4 overview.

 

[EDIT] BTW, you can't call glBufferData() on an immutable buffer object.


Edited by N.I.B., 09 November 2013 - 03:38 PM.


#3 EarthBanana   Members   -  Reputation: 849

Like
0Likes
Like

Posted 09 November 2013 - 03:37 PM

thanks that explains it!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS