diff options
author | Ilia Mirkin <[email protected]> | 2015-05-24 02:23:16 -0400 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2015-06-03 11:52:10 +0100 |
commit | ece96b4954d4b44cea19926c46f9f91fad4ca35e (patch) | |
tree | 7ab278a13b67fd5d80ac066b12cf1ac901c31af8 /src | |
parent | e692b6428cdeac5a16c5a5d7c3326e7550116970 (diff) |
nv30: avoid leaking render state and draw shaders
Signed-off-by: Ilia Mirkin <[email protected]>
Cc: "10.5 10.6" <[email protected]>
(cherry picked from commit 9870ed05dd333a20662479b9b1e3a8db542924c4)
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_draw.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_fragprog.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nv30_vertprog.c | 5 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c b/src/gallium/drivers/nouveau/nv30/nv30_draw.c index 3575c3d29fa..13aad7a4e09 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c @@ -103,6 +103,7 @@ nv30_render_unmap_vertices(struct vbuf_render *render, { struct nv30_render *r = nv30_render(render); pipe_buffer_unmap(&r->nv30->base.pipe, r->transfer); + r->transfer = NULL; } static void @@ -444,6 +445,12 @@ nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) static void nv30_render_destroy(struct vbuf_render *render) { + struct nv30_render *r = nv30_render(render); + + if (r->transfer) + pipe_buffer_unmap(&r->nv30->base.pipe, r->transfer); + pipe_resource_reference(&r->buffer, NULL); + nouveau_heap_free(&r->vertprog); FREE(render); } diff --git a/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c b/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c index ee669b1c1fc..7f227868f73 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_fragprog.c @@ -23,6 +23,7 @@ * */ +#include "draw/draw_context.h" #include "tgsi/tgsi_parse.h" #include "nv_object.xml.h" @@ -147,6 +148,9 @@ nv30_fp_state_delete(struct pipe_context *pipe, void *hwcso) pipe_resource_reference(&fp->buffer, NULL); + if (fp->draw) + draw_delete_fragment_shader(nv30_context(pipe)->draw, fp->draw); + FREE((void *)fp->pipe.tokens); FREE(fp->insn); FREE(fp->consts); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_vertprog.c b/src/gallium/drivers/nouveau/nv30/nv30_vertprog.c index 3c1b7e714ea..4d4145d10b5 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_vertprog.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_vertprog.c @@ -23,6 +23,7 @@ * */ +#include "draw/draw_context.h" #include "util/u_dynarray.h" #include "tgsi/tgsi_parse.h" @@ -237,6 +238,10 @@ nv30_vp_state_delete(struct pipe_context *pipe, void *hwcso) if (vp->translated) nv30_vertprog_destroy(vp); + + if (vp->draw) + draw_delete_vertex_shader(nv30_context(pipe)->draw, vp->draw); + FREE((void *)vp->pipe.tokens); FREE(vp); } |