From 88273e08b420c3c56579e753a522773b5c581461 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 15 Aug 2007 08:55:03 +0100 Subject: [PATCH] more tex obj ref count debugging (temporary) --- src/mesa/main/attrib.c | 7 +++++++ src/mesa/main/context.c | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 308a25ba575..70c93c5986e 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -342,6 +342,10 @@ _mesa_PushAttrib(GLbitfield mask) /* Bump the texture object reference counts so that they don't * inadvertantly get deleted. */ +#ifdef DEBUG + printf("MESA PUSH TEX ATTRIB, INCR REF COUNT BY %d\n", ctx->Const.MaxTextureUnits); +#endif + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { ctx->Texture.Unit[u].Current1D->RefCount++; ctx->Texture.Unit[u].Current2D->RefCount++; @@ -793,6 +797,9 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) * wouldn't inadvertantly get deleted while they were still referenced * inside the attribute state stack. */ +#ifdef DEBUG + printf("MESA POP TEX ATTRIB, DECR REF COUNT BY %d\n", ctx->Const.MaxTextureUnits); +#endif for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { ctx->Texture.Unit[u].Current1D->RefCount--; ctx->Texture.Unit[u].Current2D->RefCount--; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index e8f54d008c5..75ca54f20fe 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -562,7 +562,8 @@ delete_texture_cb(GLuint id, void *data, void *userData) struct gl_texture_object *texObj = (struct gl_texture_object *) data; GLcontext *ctx = (GLcontext *) userData; #ifdef DEBUG - printf("MESA TEX DELETE %p (%u) from DestroyContext\n", texObj, texObj->Name); + printf("MESA TEX DELETE %p (%u) from DestroyContext\n", + (void *) texObj, texObj->Name); #endif ctx->Driver.DeleteTexture(ctx, texObj); } @@ -1191,6 +1192,12 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_make_current(ctx, NULL, NULL); } + if (ctx->AttribStackDepth > 0) { +#ifdef DEBUG + printf("MESA: DESTROY CONTEXT WITH NON-EMPTRY ATTRIB STACK!\n"); +#endif + } + /* unreference WinSysDraw/Read buffers */ _mesa_unreference_framebuffer(&ctx->WinSysDrawBuffer); _mesa_unreference_framebuffer(&ctx->WinSysReadBuffer);