From bfb8c849cb3b5712d980e0e7ea47efcaaf13355a Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 16 Aug 2007 09:11:11 +0100 Subject: Remove recent texobj refcount debug/logging code. --- src/mesa/main/attrib.c | 57 ++++++++++++--------------------------------- src/mesa/main/context.c | 20 ---------------- src/mesa/main/fbobject.c | 15 ++---------- src/mesa/main/framebuffer.c | 8 +------ src/mesa/main/texobj.c | 43 ++++++++++------------------------ src/mesa/main/texobj.h | 6 +---- src/mesa/main/texstate.c | 30 ++++++++++++------------ 7 files changed, 46 insertions(+), 133 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 4b49fdc0131..427a6b0901c 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -369,11 +369,6 @@ _mesa_PushAttrib(GLbitfield mask) goto end; } -#ifdef DEBUG - printf("%lu: MESA BEGIN PUSH TEX ATTRIB\n", - _glthread_GetID()); -#endif - _mesa_lock_context_textures(ctx); /* copy/save the bulk of texture state here */ @@ -383,11 +378,11 @@ _mesa_PushAttrib(GLbitfield mask) * accidentally get deleted while referenced in the attribute stack. */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - MESA_REF_TEXOBJ(&texstate->SavedRef1D[u], ctx->Texture.Unit[u].Current1D); - MESA_REF_TEXOBJ(&texstate->SavedRef2D[u], ctx->Texture.Unit[u].Current2D); - MESA_REF_TEXOBJ(&texstate->SavedRef3D[u], ctx->Texture.Unit[u].Current3D); - MESA_REF_TEXOBJ(&texstate->SavedRefCube[u], ctx->Texture.Unit[u].CurrentCubeMap); - MESA_REF_TEXOBJ(&texstate->SavedRefRect[u], ctx->Texture.Unit[u].CurrentRect); + _mesa_reference_texobj(&texstate->SavedRef1D[u], ctx->Texture.Unit[u].Current1D); + _mesa_reference_texobj(&texstate->SavedRef2D[u], ctx->Texture.Unit[u].Current2D); + _mesa_reference_texobj(&texstate->SavedRef3D[u], ctx->Texture.Unit[u].Current3D); + _mesa_reference_texobj(&texstate->SavedRefCube[u], ctx->Texture.Unit[u].CurrentCubeMap); + _mesa_reference_texobj(&texstate->SavedRefRect[u], ctx->Texture.Unit[u].CurrentRect); } /* copy state/contents of the currently bound texture objects */ @@ -406,10 +401,6 @@ _mesa_PushAttrib(GLbitfield mask) _mesa_unlock_context_textures(ctx); -#ifdef DEBUG - printf("%lu: MESA END PUSH TEX ATTRIB\n", - _glthread_GetID()); -#endif newnode = new_attrib_node( GL_TEXTURE_BIT ); newnode->data = texstate; newnode->next = head; @@ -665,11 +656,6 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate) { GLuint u; -#ifdef DEBUG - printf("%lu: MESA BEGIN POP TEX ATTRIB\n", - _glthread_GetID()); -#endif - _mesa_lock_context_textures(ctx); for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { @@ -842,21 +828,16 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate) } /* remove saved references to the texture objects */ - MESA_REF_TEXOBJ(&texstate->SavedRef1D[u], NULL); - MESA_REF_TEXOBJ(&texstate->SavedRef2D[u], NULL); - MESA_REF_TEXOBJ(&texstate->SavedRef3D[u], NULL); - MESA_REF_TEXOBJ(&texstate->SavedRefCube[u], NULL); - MESA_REF_TEXOBJ(&texstate->SavedRefRect[u], NULL); + _mesa_reference_texobj(&texstate->SavedRef1D[u], NULL); + _mesa_reference_texobj(&texstate->SavedRef2D[u], NULL); + _mesa_reference_texobj(&texstate->SavedRef3D[u], NULL); + _mesa_reference_texobj(&texstate->SavedRefCube[u], NULL); + _mesa_reference_texobj(&texstate->SavedRefRect[u], NULL); } _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + texstate->Texture.CurrentUnit); _mesa_unlock_context_textures(ctx); - -#ifdef DEBUG - printf("%lu: MESA END POP TEX ATTRIB\n", - _glthread_GetID()); -#endif } @@ -1462,10 +1443,6 @@ _mesa_PopClientAttrib(void) void _mesa_free_attrib_data(GLcontext *ctx) { -#ifdef DEBUG - printf("%lu: MESA FREEING ATTRIB STACK DATA\n", - _glthread_GetID()); -#endif while (ctx->AttribStackDepth > 0) { struct gl_attrib_node *attr, *next; @@ -1478,11 +1455,11 @@ _mesa_free_attrib_data(GLcontext *ctx) GLuint u; /* clear references to the saved texture objects */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - MESA_REF_TEXOBJ(&texstate->SavedRef1D[u], NULL); - MESA_REF_TEXOBJ(&texstate->SavedRef2D[u], NULL); - MESA_REF_TEXOBJ(&texstate->SavedRef3D[u], NULL); - MESA_REF_TEXOBJ(&texstate->SavedRefCube[u], NULL); - MESA_REF_TEXOBJ(&texstate->SavedRefRect[u], NULL); + _mesa_reference_texobj(&texstate->SavedRef1D[u], NULL); + _mesa_reference_texobj(&texstate->SavedRef2D[u], NULL); + _mesa_reference_texobj(&texstate->SavedRef3D[u], NULL); + _mesa_reference_texobj(&texstate->SavedRefCube[u], NULL); + _mesa_reference_texobj(&texstate->SavedRefRect[u], NULL); } } else { @@ -1495,10 +1472,6 @@ _mesa_free_attrib_data(GLcontext *ctx) attr = next; } } -#ifdef DEBUG - printf("%lu: MESA DONE FREEING ATTRIB STACK DATA\n", - _glthread_GetID()); -#endif } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index bfae5d17091..4f3e22dbb2b 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -561,10 +561,6 @@ 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", - (void *) texObj, texObj->Name); -#endif ctx->Driver.DeleteTexture(ctx, texObj); } @@ -1192,17 +1188,6 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_make_current(ctx, NULL, NULL); } -#if DEBUG - printf("%lu: MESA: BEGIN DESTROY CONTEXT %p\n", - _glthread_GetID(), (void*) ctx); -#endif - if (ctx->AttribStackDepth > 0) { -#ifdef DEBUG - printf("%lu: MESA: DESTROY CONTEXT WITH NON-EMPTRY ATTRIB STACK!\n", - _glthread_GetID()); -#endif - } - /* unreference WinSysDraw/Read buffers */ _mesa_unreference_framebuffer(&ctx->WinSysDrawBuffer); _mesa_unreference_framebuffer(&ctx->WinSysReadBuffer); @@ -1246,11 +1231,6 @@ _mesa_free_context_data( GLcontext *ctx ) if (ctx == _mesa_get_current_context()) { _mesa_make_current(NULL, NULL, NULL); } - -#if DEBUG - printf("%lu: MESA: END DESTROY CONTEXT %p\n", - _glthread_GetID(), (void*) ctx); -#endif } diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 11cdaa082ef..8e7d66cb9c9 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -154,7 +154,7 @@ _mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att) /* tell driver we're done rendering to this texobj */ ctx->Driver.FinishRenderTexture(ctx, att); } - MESA_REF_TEXOBJ(&att->Texture, NULL); /* unbind */ + _mesa_reference_texobj(&att->Texture, NULL); /* unbind */ ASSERT(!att->Texture); } if (att->Type == GL_TEXTURE || att->Type == GL_RENDERBUFFER_EXT) { @@ -185,13 +185,10 @@ _mesa_set_texture_attachment(GLcontext *ctx, } else { /* new attachment */ - char s[100]; _mesa_remove_attachment(ctx, att); att->Type = GL_TEXTURE; assert(!att->Texture); - sprintf(s, "_mesa_set_texture_attachment(fb=%u tex=%u)\n", - fb->Name, texObj->Name); - _mesa_reference_texobj(&att->Texture, texObj, s); + _mesa_reference_texobj(&att->Texture, texObj); } /* always update these fields */ @@ -992,10 +989,6 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) newFb = ctx->WinSysDrawBuffer; } -#ifdef DEBUG - printf("MESA BIND FRAMEBUFFER %u\n", newFb->Name); -#endif - ASSERT(newFb); ASSERT(newFb != &DummyFramebuffer); @@ -1045,10 +1038,6 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) struct gl_framebuffer *fb; fb = _mesa_lookup_framebuffer(ctx, framebuffers[i]); if (fb) { -#ifdef DEBUG - printf("%lu: MESA DELETE FRAMEBUFFER %u refcount = %d\n", - _glthread_GetID(), fb->Name, fb->RefCount); -#endif ASSERT(fb == &DummyFramebuffer || fb->Name == framebuffers[i]); /* check if deleting currently bound framebuffer object */ diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 7a246f1aec7..8aeb3695088 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -165,10 +165,6 @@ void _mesa_destroy_framebuffer(struct gl_framebuffer *fb) { if (fb) { -#ifdef DEBUG - printf("%lu: MESA DESTROY FRAMEBUFFER %u\n", - _glthread_GetID(), fb->Name); -#endif _mesa_free_framebuffer_data(fb); _mesa_free(fb); } @@ -195,9 +191,7 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb) _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); } if (att->Texture) { - char s[100]; - sprintf(s, "_mesa_free_framebuffer_data (fb=%d)", fb->Name); - _mesa_reference_texobj(&att->Texture, NULL, s); + _mesa_reference_texobj(&att->Texture, NULL); } ASSERT(!att->Renderbuffer); ASSERT(!att->Texture); diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 9949daf1fdd..7b36154a5e5 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -154,11 +154,6 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) { GLuint i, face; -#ifdef DEBUG - printf("%lu: MESA TEX DELETE %p (%u) REF COUNT = %d\n", - _glthread_GetID(), - (void*) texObj, texObj->Name, texObj->RefCount); -#endif (void) ctx; /* Set Target to an invalid value. With some assertions elsewhere @@ -262,8 +257,7 @@ valid_texture_object(const struct gl_texture_object *tex) */ void _mesa_reference_texobj(struct gl_texture_object **ptr, - struct gl_texture_object *tex, - const char *where) + struct gl_texture_object *tex) { assert(ptr); if (*ptr == tex) { @@ -282,12 +276,6 @@ _mesa_reference_texobj(struct gl_texture_object **ptr, ASSERT(oldTex->RefCount > 0); oldTex->RefCount--; -#ifdef DEBUG - printf("%lu: MESA TEX REF DECR %p (%u) to %d from %s\n", - _glthread_GetID(), - (void*) oldTex, oldTex->Name, oldTex->RefCount, where); -#endif - deleteFlag = (oldTex->RefCount == 0); _glthread_UNLOCK_MUTEX(oldTex->Mutex); @@ -315,13 +303,6 @@ _mesa_reference_texobj(struct gl_texture_object **ptr, } else { tex->RefCount++; - -#ifdef DEBUG - printf("%lu: MESA TEX REF INCR %p (%u) to %d from %s\n", - _glthread_GetID(), - (void*) tex, tex->Name, tex->RefCount, where); -#endif - *ptr = tex; } _glthread_UNLOCK_MUTEX(tex->Mutex); @@ -741,19 +722,19 @@ unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj) for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { struct gl_texture_unit *unit = &ctx->Texture.Unit[u]; if (texObj == unit->Current1D) { - MESA_REF_TEXOBJ(&unit->Current1D, ctx->Shared->Default1D); + _mesa_reference_texobj(&unit->Current1D, ctx->Shared->Default1D); } else if (texObj == unit->Current2D) { - MESA_REF_TEXOBJ(&unit->Current2D, ctx->Shared->Default2D); + _mesa_reference_texobj(&unit->Current2D, ctx->Shared->Default2D); } else if (texObj == unit->Current3D) { - MESA_REF_TEXOBJ(&unit->Current3D, ctx->Shared->Default3D); + _mesa_reference_texobj(&unit->Current3D, ctx->Shared->Default3D); } else if (texObj == unit->CurrentCubeMap) { - MESA_REF_TEXOBJ(&unit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); + _mesa_reference_texobj(&unit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); } else if (texObj == unit->CurrentRect) { - MESA_REF_TEXOBJ(&unit->CurrentRect, ctx->Shared->DefaultRect); + _mesa_reference_texobj(&unit->CurrentRect, ctx->Shared->DefaultRect); } } } @@ -816,7 +797,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) /* Unreference the texobj. If refcount hits zero, the texture * will be deleted. */ - MESA_REF_TEXOBJ(&delObj, NULL); + _mesa_reference_texobj(&delObj, NULL); } } } @@ -930,19 +911,19 @@ _mesa_BindTexture( GLenum target, GLuint texName ) */ switch (target) { case GL_TEXTURE_1D: - MESA_REF_TEXOBJ(&texUnit->Current1D, newTexObj); + _mesa_reference_texobj(&texUnit->Current1D, newTexObj); break; case GL_TEXTURE_2D: - MESA_REF_TEXOBJ(&texUnit->Current2D, newTexObj); + _mesa_reference_texobj(&texUnit->Current2D, newTexObj); break; case GL_TEXTURE_3D: - MESA_REF_TEXOBJ(&texUnit->Current3D, newTexObj); + _mesa_reference_texobj(&texUnit->Current3D, newTexObj); break; case GL_TEXTURE_CUBE_MAP_ARB: - MESA_REF_TEXOBJ(&texUnit->CurrentCubeMap, newTexObj); + _mesa_reference_texobj(&texUnit->CurrentCubeMap, newTexObj); break; case GL_TEXTURE_RECTANGLE_NV: - MESA_REF_TEXOBJ(&texUnit->CurrentRect, newTexObj); + _mesa_reference_texobj(&texUnit->CurrentRect, newTexObj); break; default: _mesa_problem(ctx, "bad target in BindTexture"); diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index 78e793327ff..9577e5e4dba 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -57,13 +57,9 @@ extern void _mesa_copy_texture_object( struct gl_texture_object *dest, const struct gl_texture_object *src ); -#define MESA_REF_TEXOBJ(PTR, TEX) \ - _mesa_reference_texobj(PTR, TEX, __FUNCTION__) - extern void _mesa_reference_texobj(struct gl_texture_object **ptr, - struct gl_texture_object *tex, - const char *where); + struct gl_texture_object *tex); extern void _mesa_test_texobj_completeness( const GLcontext *ctx, diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index c4b678bf37d..a5966e7ecda 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -119,15 +119,15 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) /* copy texture object bindings, not contents of texture objects */ _mesa_lock_context_textures(dst); - MESA_REF_TEXOBJ(&dst->Texture.Unit[i].Current1D, + _mesa_reference_texobj(&dst->Texture.Unit[i].Current1D, src->Texture.Unit[i].Current1D); - MESA_REF_TEXOBJ(&dst->Texture.Unit[i].Current2D, + _mesa_reference_texobj(&dst->Texture.Unit[i].Current2D, src->Texture.Unit[i].Current2D); - MESA_REF_TEXOBJ(&dst->Texture.Unit[i].Current3D, + _mesa_reference_texobj(&dst->Texture.Unit[i].Current3D, src->Texture.Unit[i].Current3D); - MESA_REF_TEXOBJ(&dst->Texture.Unit[i].CurrentCubeMap, + _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentCubeMap, src->Texture.Unit[i].CurrentCubeMap); - MESA_REF_TEXOBJ(&dst->Texture.Unit[i].CurrentRect, + _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentRect, src->Texture.Unit[i].CurrentRect); _mesa_unlock_context_textures(dst); @@ -3065,11 +3065,11 @@ init_texture_unit( GLcontext *ctx, GLuint unit ) ASSIGN_4V( texUnit->EyePlaneQ, 0.0, 0.0, 0.0, 0.0 ); /* initialize current texture object ptrs to the shared default objects */ - MESA_REF_TEXOBJ(&texUnit->Current1D, ctx->Shared->Default1D); - MESA_REF_TEXOBJ(&texUnit->Current2D, ctx->Shared->Default2D); - MESA_REF_TEXOBJ(&texUnit->Current3D, ctx->Shared->Default3D); - MESA_REF_TEXOBJ(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); - MESA_REF_TEXOBJ(&texUnit->CurrentRect, ctx->Shared->DefaultRect); + _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->Default1D); + _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->Default2D); + _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->Default3D); + _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); + _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultRect); } @@ -3119,11 +3119,11 @@ _mesa_free_texture_data(GLcontext *ctx) /* unreference current textures */ for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { struct gl_texture_unit *unit = ctx->Texture.Unit + u; - MESA_REF_TEXOBJ(&unit->Current1D, NULL); - MESA_REF_TEXOBJ(&unit->Current2D, NULL); - MESA_REF_TEXOBJ(&unit->Current3D, NULL); - MESA_REF_TEXOBJ(&unit->CurrentCubeMap, NULL); - MESA_REF_TEXOBJ(&unit->CurrentRect, NULL); + _mesa_reference_texobj(&unit->Current1D, NULL); + _mesa_reference_texobj(&unit->Current2D, NULL); + _mesa_reference_texobj(&unit->Current3D, NULL); + _mesa_reference_texobj(&unit->CurrentCubeMap, NULL); + _mesa_reference_texobj(&unit->CurrentRect, NULL); } /* Free proxy texture objects */ -- cgit v1.2.3