summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>2019-07-19 15:10:25 +0300
committerYevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>2019-12-30 12:41:52 +0200
commitb318bc2072d42a58b491dac3aa6118012d92e5bb (patch)
treea883feab02909694eae71b244404e733a471523e
parent7040d6c1972222ae3904d32d79a13c8f53824fed (diff)
meta: Cleanup function for DrawTex
Buffer object was never freed, causing memory leaks. Fixes: 76cfe2bc443 ("meta: Don't pollute the buffer object namespace in _mesa_meta_DrawTex") CC: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1390> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1390>
-rw-r--r--src/mesa/drivers/common/meta.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 8010618af7c..c636cb923d8 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -110,6 +110,8 @@ static void meta_decompress_cleanup(struct gl_context *ctx,
struct decompress_state *decompress);
static void meta_drawpix_cleanup(struct gl_context *ctx,
struct drawpix_state *drawpix);
+static void meta_drawtex_cleanup(struct gl_context *ctx,
+ struct drawtex_state *drawtex);
void
_mesa_meta_framebuffer_texture_image(struct gl_context *ctx,
@@ -429,6 +431,7 @@ _mesa_meta_free(struct gl_context *ctx)
cleanup_temp_texture(ctx, &ctx->Meta->TempTex);
meta_decompress_cleanup(ctx, &ctx->Meta->Decompress);
meta_drawpix_cleanup(ctx, &ctx->Meta->DrawPix);
+ meta_drawtex_cleanup(ctx, &ctx->Meta->DrawTex);
if (old_context)
_mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer);
else
@@ -1970,6 +1973,17 @@ meta_drawpix_cleanup(struct gl_context *ctx, struct drawpix_state *drawpix)
}
}
+static void
+meta_drawtex_cleanup(struct gl_context *ctx, struct drawtex_state *drawtex)
+{
+ if (drawtex->VAO != 0) {
+ _mesa_DeleteVertexArrays(1, &drawtex->VAO);
+ drawtex->VAO = 0;
+
+ _mesa_reference_buffer_object(ctx, &drawtex->buf_obj, NULL);
+ }
+}
+
/**
* When the glDrawPixels() image size is greater than the max rectangle
* texture size we use this function to break the glDrawPixels() image