Mesa (master): mesa: additional assertions for ctx->Driver.UnmapBuffer()

Brian Paul brianp at kemper.freedesktop.org
Mon Aug 31 15:02:50 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Aug 31 08:59:38 2009 -0600

mesa: additional assertions for ctx->Driver.UnmapBuffer()

The Pointer, Offset and Lenght fields should be cleared by the driver function
since ctx->Driver.Unmap() may be called from VBO code, etc.

---

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

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 715a6e6..3fd1d17 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -484,6 +484,9 @@ _mesa_buffer_unmap( GLcontext *ctx, GLenum target,
    (void) target;
    /* XXX we might assert here that bufObj->Pointer is non-null */
    bufObj->Pointer = NULL;
+   bufObj->Length = 0;
+   bufObj->Offset = 0;
+   bufObj->AccessFlags = 0x0;
    return GL_TRUE;
 }
 
@@ -1095,7 +1098,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
       /* Unmap the existing buffer.  We'll replace it now.  Not an error. */
       ctx->Driver.UnmapBuffer(ctx, target, bufObj);
       bufObj->AccessFlags = DEFAULT_ACCESS;
-      bufObj->Pointer = NULL;
+      ASSERT(bufObj->Pointer == NULL);
    }  
 
    FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT);
@@ -1304,9 +1307,9 @@ _mesa_UnmapBufferARB(GLenum target)
 
    status = ctx->Driver.UnmapBuffer( ctx, target, bufObj );
    bufObj->AccessFlags = DEFAULT_ACCESS;
-   bufObj->Pointer = NULL;
-   bufObj->Offset = 0;
-   bufObj->Length = 0;
+   ASSERT(bufObj->Pointer == NULL);
+   ASSERT(bufObj->Offset == 0);
+   ASSERT(bufObj->Length == 0);
 
    return status;
 }




More information about the mesa-commit mailing list