Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu>
---
 src/gallium/drivers/freedreno/freedreno_context.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_context.c 
b/src/gallium/drivers/freedreno/freedreno_context.c
index 5b7c32f..9dc918d 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -145,7 +145,7 @@ void
 fd_context_destroy(struct pipe_context *pctx)
 {
        struct fd_context *ctx = fd_context(pctx);
-       unsigned i;
+       unsigned i, j;
 
        DBG("");
 
@@ -162,6 +162,23 @@ fd_context_destroy(struct pipe_context *pctx)
 
        util_unreference_framebuffer_state(&ctx->framebuffer);
 
+       for (i = 0; i < PIPE_SHADER_TYPES; i++)
+               for (j = 0; j < PIPE_MAX_CONSTANT_BUFFERS; j++)
+                       pipe_resource_reference(&ctx->constbuf[i].cb[j].buffer, 
NULL);
+
+       for (i = 0; i < PIPE_MAX_ATTRIBS; i++)
+               pipe_resource_reference(&ctx->vtx.vertexbuf.vb[i].buffer, NULL);
+
+       pipe_resource_reference(&ctx->indexbuf.buffer, NULL);
+
+       for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+               pipe_sampler_view_reference(&ctx->verttex.textures[i], NULL);
+               pipe_sampler_view_reference(&ctx->fragtex.textures[i], NULL);
+       }
+
+       for (i = 0; i < PIPE_MAX_SO_BUFFERS; i++)
+               pipe_so_target_reference(&ctx->streamout.targets[i], NULL);
+
        util_slab_destroy(&ctx->transfer_pool);
 
        fd_ringmarker_del(ctx->draw_start);
-- 
2.4.9

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to