summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texrender.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/texrender.c')
-rw-r--r--src/mesa/main/texrender.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c
index 9c21e03515a..a4efe640382 100644
--- a/src/mesa/main/texrender.c
+++ b/src/mesa/main/texrender.c
@@ -124,6 +124,7 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb,
static void
delete_texture_wrapper(struct gl_renderbuffer *rb)
{
+ ASSERT(rb->RefCount == 0);
_mesa_free(rb);
}
@@ -162,6 +163,7 @@ wrap_texture(GLcontext *ctx, struct gl_renderbuffer_attachment *att)
trb->Zoffset = att->Zoffset;
+ trb->Base.RefCount = 1;
trb->Base.Width = trb->TexImage->Width;
trb->Base.Height = trb->TexImage->Height;
trb->Base.InternalFormat = trb->TexImage->InternalFormat; /* XXX fix? */
@@ -213,8 +215,8 @@ _mesa_renderbuffer_texture(GLcontext *ctx,
if (texObj) {
_mesa_set_texture_attachment(ctx, att, texObj,
texTarget, level, zoffset);
-
- wrap_texture(ctx, att);
+ if (!att->Renderbuffer)
+ wrap_texture(ctx, att);
}
else {
_mesa_remove_attachment(ctx, att);