summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/swr_context.cpp
diff options
context:
space:
mode:
authorTim Rowley <timothy.o.rowley@intel.com>2016-04-18 15:09:17 -0500
committerTim Rowley <timothy.o.rowley@intel.com>2016-04-18 15:52:26 -0500
commit3227c10270f8b7e8bb66bb7d50531fec8be75adb (patch)
tree93ac42649f8fe7c1bf52616b16cf36eab84c73b5 /src/gallium/drivers/swr/swr_context.cpp
parent77a9107bf299faa738737ed105c1b5e5ac06d1ca (diff)
downloadexternal_mesa3d-3227c10270f8b7e8bb66bb7d50531fec8be75adb.zip
external_mesa3d-3227c10270f8b7e8bb66bb7d50531fec8be75adb.tar.gz
external_mesa3d-3227c10270f8b7e8bb66bb7d50531fec8be75adb.tar.bz2
swr: dereference cbuf/zbuf/views on context destroy
Fixes resource memory leaks. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Diffstat (limited to 'src/gallium/drivers/swr/swr_context.cpp')
-rw-r--r--src/gallium/drivers/swr/swr_context.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp
index 46c79a1..5d311dd 100644
--- a/src/gallium/drivers/swr/swr_context.cpp
+++ b/src/gallium/drivers/swr/swr_context.cpp
@@ -300,6 +300,21 @@ swr_destroy(struct pipe_context *pipe)
/* Idle core before deleting context */
SwrWaitForIdle(ctx->swrContext);
+
+ for (unsigned i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
+ pipe_surface_reference(&ctx->framebuffer.cbufs[i], NULL);
+ }
+
+ pipe_surface_reference(&ctx->framebuffer.zsbuf, NULL);
+
+ for (unsigned i = 0; i < Elements(ctx->sampler_views[0]); i++) {
+ pipe_sampler_view_reference(&ctx->sampler_views[PIPE_SHADER_FRAGMENT][i], NULL);
+ }
+
+ for (unsigned i = 0; i < Elements(ctx->sampler_views[0]); i++) {
+ pipe_sampler_view_reference(&ctx->sampler_views[PIPE_SHADER_VERTEX][i], NULL);
+ }
+
if (ctx->swrContext)
SwrDestroyContext(ctx->swrContext);