Mesa (master): mesa: fix incorrect error handling in glBufferDataARB()

Brian Paul brianp at kemper.freedesktop.org
Fri Feb 27 19:56:19 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Feb 27 12:30:21 2009 -0700

mesa: fix incorrect error handling in glBufferDataARB()

If glBufferDataARB() is called while a buffer object is currently mapped
we're supposed to unmap the current buffer, then replace it.  Don't generate
an error.

---

 src/mesa/main/bufferobj.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 016543d..e4bdc6f 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -951,8 +951,10 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
    }
    
    if (bufObj->Pointer) {
-      _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer is mapped)" );
-      return;
+      /* Unmap the existing buffer.  We'll replace it now.  Not an error. */
+      ctx->Driver.UnmapBuffer(ctx, target, bufObj);
+      bufObj->Access = DEFAULT_ACCESS;
+      bufObj->Pointer = NULL;
    }  
 
    ASSERT(ctx->Driver.BufferData);




More information about the mesa-commit mailing list