diff options
author | Brian Paul <[email protected]> | 2009-06-03 15:38:57 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-06-03 17:16:00 -0600 |
commit | e7927626c13b8cd3743ba52a407b8f3736eae8a1 (patch) | |
tree | 4e41f0b5c13db6463a6f2522d9ddec6b52849579 /src/mesa | |
parent | 4f4280b4356210e503aa5756db0a13dfb8253661 (diff) |
mesa: added buffer object debug code (disabled)
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/bufferobj.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 5fa13d9b542..3e011ef5b23 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1014,6 +1014,11 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, bufObj->Written = GL_TRUE; +#ifdef VBO_DEBUG + _mesa_printf("glBufferDataARB(%u, sz %ld, from %p, usage 0x%x)\n", + bufObj->Name, size, data, usage); +#endif + /* Give the buffer object to the driver! <data> may be null! */ ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj ); } @@ -1103,6 +1108,17 @@ _mesa_MapBufferARB(GLenum target, GLenum access) if (access == GL_WRITE_ONLY_ARB || access == GL_READ_WRITE_ARB) bufObj->Written = GL_TRUE; +#ifdef VBO_DEBUG + _mesa_printf("glMapBufferARB(%u, sz %ld, access 0x%x)\n", + bufObj->Name, bufObj->Size, access); + if (access == GL_WRITE_ONLY_ARB) { + GLuint i; + GLubyte *b = (GLubyte *) bufObj->Pointer; + for (i = 0; i < bufObj->Size; i++) + b[i] = i & 0xff; + } +#endif + return bufObj->Pointer; } @@ -1129,6 +1145,26 @@ _mesa_UnmapBufferARB(GLenum target) return GL_FALSE; } +#ifdef VBO_DEBUG + if (bufObj->Access == GL_WRITE_ONLY_ARB) { + GLuint i, unchanged = 0; + GLubyte *b = (GLubyte *) bufObj->Pointer; + GLint pos = -1; + /* check which bytes changed */ + for (i = 0; i < bufObj->Size - 1; i++) { + if (b[i] == (i & 0xff) && b[i+1] == ((i+1) & 0xff)) { + unchanged++; + if (pos == -1) + pos = i; + } + } + if (unchanged) { + _mesa_printf("glUnmapBufferARB(%u): %u of %ld unchanged, starting at %d\n", + bufObj->Name, unchanged, bufObj->Size, pos); + } + } +#endif + status = ctx->Driver.UnmapBuffer( ctx, target, bufObj ); bufObj->Access = DEFAULT_ACCESS; bufObj->Pointer = NULL; |