Mesa (master): mesa: Add a comment explaining my thoughts on glBindBufferBase().

Eric Anholt anholt at kemper.freedesktop.org
Thu Jun 21 18:06:53 UTC 2012


Module: Mesa
Branch: master
Commit: cb9f35d16f9337b34ebfe412b060ff9cad933d79
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb9f35d16f9337b34ebfe412b060ff9cad933d79

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Jun 18 16:20:11 2012 -0700

mesa: Add a comment explaining my thoughts on glBindBufferBase().

Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/bufferobj.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index d0d9802..5f724ac 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2138,6 +2138,32 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
       return;
    }
 
+   /* Note that there's some oddness in the GL 3.1-GL 3.3 specifications with
+    * regards to BindBufferBase.  It says (GL 3.1 core spec, page 63):
+    *
+    *     "BindBufferBase is equivalent to calling BindBufferRange with offset
+    *      zero and size equal to the size of buffer."
+    *
+    * but it says for glGetIntegeri_v (GL 3.1 core spec, page 230):
+    *
+    *     "If the parameter (starting offset or size) was not specified when the
+    *      buffer object was bound, zero is returned."
+    *
+    * What happens if the size of the buffer changes?  Does the size of the
+    * buffer at the moment glBindBufferBase was called still play a role, like
+    * the first quote would imply, or is the size meaningless in the
+    * glBindBufferBase case like the second quote would suggest?  The GL 4.1
+    * core spec page 45 says:
+    *
+    *     "It is equivalent to calling BindBufferRange with offset zero, while
+    *      size is determined by the size of the bound buffer at the time the
+    *      binding is used."
+    *
+    * My interpretation is that the GL 4.1 spec was a clarification of the
+    * behavior, not a change.  In particular, this choice will only make
+    * rendering work in cases where it would have had undefined results.
+    */
+
    switch (target) {
    case GL_TRANSFORM_FEEDBACK_BUFFER:
       _mesa_bind_buffer_base_transform_feedback(ctx, index, bufObj);




More information about the mesa-commit mailing list