[Mesa-dev] [PATCH] mesa: Ignore size and offset parameters for BindBufferRange when buffer is 0

Matt Turner mattst88 at gmail.com
Tue Dec 4 19:17:16 PST 2012


The ES 3 conformance suite unbinds buffers (by binding buffer 0) and
passes zero for the size and offset, which the spec explicitly
disallows. Otherwise, this seems like a reasonable thing to do.

Khronos will be changing the spec to allow this (bug 9765). Fixes
es3conform's transform_feedback_init_defaults test.
---
 src/mesa/main/bufferobj.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index f173206..bbfcab8 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2157,17 +2157,19 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
       return;
    }
 
-   if (size <= 0) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)",
-		  (int) size);
-      return;
-   }
+   if (buffer != 0) {
+      if (size <= 0) {
+         _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)",
+                     (int) size);
+         return;
+      }
 
-   if (offset + size > bufObj->Size) {
-      _mesa_error(ctx, GL_INVALID_VALUE,
-                  "glBindBufferRange(offset + size %d > buffer size %d)",
-		  (int) (offset + size), (int) (bufObj->Size));
-      return;
+      if (offset + size > bufObj->Size) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glBindBufferRange(offset + size %d > buffer size %d)",
+                     (int) (offset + size), (int) (bufObj->Size));
+         return;
+      }
    }
 
    switch (target) {
-- 
1.7.8.6



More information about the mesa-dev mailing list