Khronos public bugtracker – Bug 768
glDeleteBuffers and glTexBuffer
Last modified: 2013-09-11 20:46:42 PDT
Section 5.1.3 of the GL 4.3 specification states:
"A buffer, texture, or renderbuffer object is in use while it is attached to any container object or bound to a context bind point in any context."
So if a buffer object is attached to a VAO with `glVertexAttribPointer`, the buffer will continue to exist so long as the VAO attachment is not changed. Similarly, if it is bound to an indexed target of the current context, it will remain bound, per various rules.
However, the text above only specifies what happens if a buffer is bound to a container object or to the context. Textures are not container objects. So what happens to a buffer texture if the buffer object attached to it is deleted? Does it still count as "in use"?
That's a good catch. The model underlying this is reference counting,
although we don't say so in so many terms, because people's implementations
can differ. A buffer texture certainly counts as a reference on the
buffer; in fact issue (5) in ARB_texture_buffer_object says so explicitly,
but we need a bit more language in the spec about it. I will put it on
the agenda for clarification.
We did add some language to 4.4 (at the last minute before SIGGRAPH
release) which added views of an object's data store as an "in use" /
reference count. Hopefully that adequately addressed this issue.