diff options
Diffstat (limited to 'src/mesa/state_tracker/st_context.c')
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index f5351398474..0b353551da3 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -38,6 +38,7 @@ #include "program/prog_cache.h" #include "vbo/vbo.h" #include "glapi/glapi.h" +#include "st_manager.h" #include "st_context.h" #include "st_debug.h" #include "st_cb_bitmap.h" @@ -571,6 +572,9 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, _mesa_destroy_context(ctx); } + /* Initialize context's winsys buffers list */ + LIST_INITHEAD(&st->winsys_buffers); + return st; } @@ -591,6 +595,17 @@ destroy_tex_sampler_cb(GLuint id, void *data, void *userData) void st_destroy_context( struct st_context *st ) { struct gl_context *ctx = st->ctx; + struct st_framebuffer *stfb, *next; + + GET_CURRENT_CONTEXT(curctx); + if (curctx == NULL) { + + /* No current context, but we need one to release + * renderbuffer surface when we release framebuffer. + * So temporarily bind the context. + */ + _mesa_make_current(ctx, NULL, NULL); + } /* This must be called first so that glthread has a chance to finish */ _mesa_glthread_destroy(ctx); @@ -604,6 +619,11 @@ void st_destroy_context( struct st_context *st ) st_reference_prog(st, &st->tep, NULL); st_reference_compprog(st, &st->cp, NULL); + /* release framebuffer in the winsys buffers list */ + LIST_FOR_EACH_ENTRY_SAFE_REV(stfb, next, &st->winsys_buffers, head) { + st_framebuffer_reference(&stfb, NULL); + } + pipe_sampler_view_reference(&st->pixel_xfer.pixelmap_sampler_view, NULL); pipe_resource_reference(&st->pixel_xfer.pixelmap_texture, NULL); |