summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-12-14 11:58:45 -0800
committerIan Romanick <[email protected]>2014-02-02 16:49:08 +0100
commitfcb498302bff912ca4f3169d37cc04b58e77d0fa (patch)
treef0dae899268560bf7b731a168245d24899fc4fae /src/mesa/drivers
parent2d3f92e881dbd9d1aff17bba0d182c8ef645a2ca (diff)
meta: Release resources used by _mesa_meta_DrawPixels
_mesa_meta_DrawPixels creates a VAO and (potentially) two fragment programs, but none of them are ever released. Leaking piles of memory is generally frowned upon. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Cc: "9.1 9.2 10.0" <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/common/meta.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 2ef27dec9d4..6185e807c61 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -356,6 +356,7 @@ static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *
static void meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx,
struct gen_mipmap_state *mipmap);
static void meta_decompress_cleanup(struct decompress_state *decompress);
+static void meta_drawpix_cleanup(struct drawpix_state *drawpix);
static GLuint
compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source)
@@ -451,6 +452,7 @@ _mesa_meta_free(struct gl_context *ctx)
meta_glsl_generate_mipmap_cleanup(ctx, &ctx->Meta->Mipmap);
cleanup_temp_texture(ctx, &ctx->Meta->TempTex);
meta_decompress_cleanup(&ctx->Meta->Decompress);
+ meta_drawpix_cleanup(&ctx->Meta->DrawPix);
if (old_context)
_mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer);
else
@@ -2545,7 +2547,24 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY,
_mesa_meta_end(ctx);
}
+static void
+meta_drawpix_cleanup(struct drawpix_state *drawpix)
+{
+ if (drawpix->ArrayObj != 0) {
+ _mesa_DeleteVertexArrays(1, &drawpix->ArrayObj);
+ drawpix->ArrayObj = 0;
+ }
+ if (drawpix->StencilFP != 0) {
+ _mesa_DeleteProgramsARB(1, &drawpix->StencilFP);
+ drawpix->StencilFP = 0;
+ }
+
+ if (drawpix->DepthFP != 0) {
+ _mesa_DeleteProgramsARB(1, &drawpix->DepthFP);
+ drawpix->DepthFP = 0;
+ }
+}
/**
* When the glDrawPixels() image size is greater than the max rectangle