summaryrefslogtreecommitdiff
path: root/src/mesa/main/fbobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r--src/mesa/main/fbobject.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 6f7effcce7..fcb620b39d 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -151,22 +151,18 @@ _mesa_remove_attachment(GLcontext *ctx, struct gl_renderbuffer_attachment *att)
{
if (att->Type == GL_TEXTURE) {
ASSERT(att->Texture);
- att->Texture->RefCount--;
- if (att->Texture->RefCount == 0) {
- ctx->Driver.DeleteTexture(ctx, att->Texture);
+ if (ctx->Driver.FinishRenderTexture) {
+ /* tell driver we're done rendering to this texobj */
+ ctx->Driver.FinishRenderTexture(ctx, att);
}
- else {
- /* tell driver that we're done rendering to this texture. */
- if (ctx->Driver.FinishRenderTexture) {
- ctx->Driver.FinishRenderTexture(ctx, att);
- }
- }
- att->Texture = NULL;
+ _mesa_reference_texobj(&att->Texture, NULL); /* unbind */
+ ASSERT(!att->Texture);
}
if (att->Type == GL_TEXTURE || att->Type == GL_RENDERBUFFER_EXT) {
ASSERT(att->Renderbuffer);
ASSERT(!att->Texture);
- _mesa_reference_renderbuffer(&att->Renderbuffer, NULL);
+ _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); /* unbind */
+ ASSERT(!att->Renderbuffer);
}
att->Type = GL_NONE;
att->Complete = GL_TRUE;
@@ -192,8 +188,8 @@ _mesa_set_texture_attachment(GLcontext *ctx,
/* new attachment */
_mesa_remove_attachment(ctx, att);
att->Type = GL_TEXTURE;
- att->Texture = texObj;
- texObj->RefCount++;
+ assert(!att->Texture);
+ _mesa_reference_texobj(&att->Texture, texObj);
}
/* always update these fields */