summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_atom_framebuffer.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-05-11 16:09:39 -0600
committerBrian Paul <brianp@vmware.com>2009-05-11 16:09:39 -0600
commitf104e4d666dfccda6f5ad817693216733ddede44 (patch)
treefc794ac5b7c03f37a40e15106fc6e768427f934a /src/mesa/state_tracker/st_atom_framebuffer.c
parentf5cf181c65293fd9097f63192c09f44b9c82c633 (diff)
st: do proper refcounting for framebuffer surfaces
Diffstat (limited to 'src/mesa/state_tracker/st_atom_framebuffer.c')
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index df0f0931ea..536293683e 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -98,8 +98,6 @@ update_framebuffer_state( struct st_context *st )
struct st_renderbuffer *strb;
GLuint i;
- memset(framebuffer, 0, sizeof(*framebuffer));
-
framebuffer->width = fb->Width;
framebuffer->height = fb->Height;
@@ -120,12 +118,19 @@ update_framebuffer_state( struct st_context *st )
}
if (strb->surface) {
- framebuffer->cbufs[framebuffer->nr_cbufs] = strb->surface;
+ pipe_surface_reference(&framebuffer->cbufs[framebuffer->nr_cbufs],
+ strb->surface);
framebuffer->nr_cbufs++;
}
}
}
+ for (i = framebuffer->nr_cbufs; i < PIPE_MAX_COLOR_BUFS; i++) {
+ pipe_surface_reference(&framebuffer->cbufs[i], NULL);
+ }
+ /*
+ * Depth/Stencil renderbuffer/surface.
+ */
strb = st_renderbuffer(fb->Attachment[BUFFER_DEPTH].Renderbuffer);
if (strb) {
strb = st_renderbuffer(strb->Base.Wrapped);
@@ -133,15 +138,14 @@ update_framebuffer_state( struct st_context *st )
/* rendering to a GL texture, may have to update surface */
update_renderbuffer_surface(st, strb);
}
-
- framebuffer->zsbuf = strb->surface;
+ pipe_surface_reference(&framebuffer->zsbuf, strb->surface);
}
else {
strb = st_renderbuffer(fb->Attachment[BUFFER_STENCIL].Renderbuffer);
if (strb) {
strb = st_renderbuffer(strb->Base.Wrapped);
assert(strb->surface);
- framebuffer->zsbuf = strb->surface;
+ pipe_surface_reference(&framebuffer->zsbuf, strb->surface);
}
}