diff options
author | Brian Paul <brianp@vmware.com> | 2009-05-11 16:09:39 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-05-11 16:09:39 -0600 |
commit | f104e4d666dfccda6f5ad817693216733ddede44 (patch) | |
tree | fc794ac5b7c03f37a40e15106fc6e768427f934a /src/mesa/state_tracker/st_atom_framebuffer.c | |
parent | f5cf181c65293fd9097f63192c09f44b9c82c633 (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.c | 16 |
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); } } |