summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2013-12-13 14:36:17 -0800
committerCarl Worth <cworth@cworth.org>2014-03-04 12:56:23 -0800
commitc1bcdcde1c7e0c369f2cc4b4d7e56e9c3ea6707f (patch)
tree89f8d2e7525ef35564c55e1239eadea65d10e5dd
parentd18b18213416ba891885332e17eca523fafa6d6b (diff)
downloadmesa-c1bcdcde1c7e0c369f2cc4b4d7e56e9c3ea6707f.tar.gz
meta: Release resources used by decompress_texture_image
decompress_texture_image creates an FBO, an RBO, a VBO, a VAO, and a sampler object, but none of them are ever released. Later patches will add program objects, exacerbating the problem. Leaking piles of memory is generally frowned upon. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Cc: "9.1 9.2 10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 2d3f92e881dbd9d1aff17bba0d182c8ef645a2ca)
-rw-r--r--src/mesa/drivers/common/meta.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 99b02baadc5..5bdc402d37a 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -355,6 +355,7 @@ static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *te
static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear);
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 GLuint
compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source)
@@ -449,6 +450,7 @@ _mesa_meta_free(struct gl_context *ctx)
meta_glsl_clear_cleanup(ctx, &ctx->Meta->Clear);
meta_glsl_generate_mipmap_cleanup(ctx, &ctx->Meta->Mipmap);
cleanup_temp_texture(ctx, &ctx->Meta->TempTex);
+ meta_decompress_cleanup(&ctx->Meta->Decompress);
if (old_context)
_mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer);
else
@@ -3891,6 +3893,25 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
}
+static void
+meta_decompress_cleanup(struct decompress_state *decompress)
+{
+ if (decompress->FBO != 0) {
+ _mesa_DeleteFramebuffers(1, &decompress->FBO);
+ _mesa_DeleteRenderbuffers(1, &decompress->RBO);
+ }
+
+ if (decompress->ArrayObj != 0) {
+ _mesa_DeleteVertexArrays(1, &decompress->ArrayObj);
+ _mesa_DeleteBuffers(1, &decompress->VBO);
+ }
+
+ if (decompress->Sampler != 0)
+ _mesa_DeleteSamplers(1, &decompress->Sampler);
+
+ memset(decompress, 0, sizeof(*decompress));
+}
+
/**
* Decompress a texture image by drawing a quad with the compressed
* texture and reading the pixels out of the color buffer.