From dcca97a3e3c1d8f5d27e1177257964eddb9effd3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 6 May 2009 15:23:09 -0600 Subject: mesa: added gl_buffer_object::Written flag (for debug purposes) The flag is set when we data has been written into the buffer object. --- src/mesa/main/bufferobj.c | 6 ++++++ src/mesa/main/mtypes.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 49f690ddd2e..43a8d2ba666 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -962,6 +962,8 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, ASSERT(ctx->Driver.BufferData); + bufObj->Written = GL_TRUE; + /* Give the buffer object to the driver! may be null! */ ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj ); } @@ -982,6 +984,8 @@ _mesa_BufferSubDataARB(GLenum target, GLintptrARB offset, return; } + bufObj->Written = GL_TRUE; + ASSERT(ctx->Driver.BufferSubData); ctx->Driver.BufferSubData( ctx, target, offset, size, data, bufObj ); } @@ -1046,6 +1050,8 @@ _mesa_MapBufferARB(GLenum target, GLenum access) } bufObj->Access = access; + if (access == GL_WRITE_ONLY_ARB || access == GL_READ_WRITE_ARB) + bufObj->Written = GL_TRUE; return bufObj->Pointer; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 368acde7a19..276bc42ebaa 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1506,6 +1506,7 @@ struct gl_buffer_object GLsizeiptrARB Size; /**< Size of storage in bytes */ GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ GLboolean OnCard; /**< Is buffer in VRAM? (hardware drivers) */ + GLboolean Written; /**< Ever written to? (for debugging) */ }; -- cgit v1.2.3