unref const buffers during context destroy
authorBrian <brian.paul@tungstengraphics.com>
Wed, 26 Dec 2007 14:16:41 +0000 (07:16 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Tue, 1 Jan 2008 17:21:21 +0000 (10:21 -0700)
src/mesa/pipe/softpipe/sp_context.c

index 52672a9b2920b09e24a19a94736748ba792f891a..c7af63cc2d3cc4cfa8f458705758c1f4c04b6e94 100644 (file)
@@ -127,6 +127,7 @@ softpipe_unmap_surfaces(struct softpipe_context *sp)
 static void softpipe_destroy( struct pipe_context *pipe )
 {
    struct softpipe_context *softpipe = softpipe_context( pipe );
+   struct pipe_winsys *ws = pipe->winsys;
    uint i;
 
    draw_destroy( softpipe->draw );
@@ -152,6 +153,12 @@ static void softpipe_destroy( struct pipe_context *pipe )
    for (i = 0; i < PIPE_MAX_SAMPLERS; i++)
       sp_destroy_tile_cache(softpipe->tex_cache[i]);
 
+   for (i = 0; i < Elements(softpipe->constants); i++) {
+      if (softpipe->constants[i].buffer) {
+         ws->buffer_reference(ws, &softpipe->constants[i].buffer, NULL);
+      }
+   }
+
    FREE( softpipe );
 }