diff options
-rw-r--r-- | src/mesa/main/fbobject.c | 18 | ||||
-rw-r--r-- | src/mesa/main/framebuffer.c | 4 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index f0e413bc741..11cdaa082ef 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -185,10 +185,13 @@ _mesa_set_texture_attachment(GLcontext *ctx, } else { /* new attachment */ + char s[100]; _mesa_remove_attachment(ctx, att); att->Type = GL_TEXTURE; assert(!att->Texture); - MESA_REF_TEXOBJ(&att->Texture, texObj); + sprintf(s, "_mesa_set_texture_attachment(fb=%u tex=%u)\n", + fb->Name, texObj->Name); + _mesa_reference_texobj(&att->Texture, texObj, s); } /* always update these fields */ @@ -979,6 +982,7 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) return; } _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newFb); + ASSERT(newFb->RefCount == 1); } } else { @@ -988,6 +992,10 @@ _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); @@ -1002,8 +1010,10 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) if (bindDrawBuf) { /* check if old FB had any texture attachments */ check_end_texture_render(ctx, ctx->DrawBuffer); - /* check if time to delete this framebuffer */ + + /* bind new drawing buffer */ _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb); + if (newFb->Name != 0) { /* check if newly bound framebuffer has any texture attachments */ check_begin_texture_render(ctx, newFb); @@ -1035,6 +1045,10 @@ _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 5eb45f6e4a3..7a246f1aec7 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -165,6 +165,10 @@ 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); } |