From ac45bc2359393d92ddba0e6dc4f3833df4918f27 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 25 Mar 2019 14:29:50 +0100 Subject: [PATCH] zink: do not leak image-views Acked-by: Jordan Justen --- src/gallium/drivers/zink/zink_context.c | 4 +++- src/gallium/drivers/zink/zink_context.h | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 9c5167a..b437bd3 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -236,8 +236,10 @@ zink_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *pres, static void zink_destroy_sampler_view(struct pipe_context *pctx, - struct pipe_sampler_view *view) + struct pipe_sampler_view *pview) { + struct zink_sampler_view *view = zink_sampler_view(pview); + vkDestroyImageView(zink_screen(pctx->screen)->dev, view->image_view, NULL); FREE(view); } diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h index 69e2fdd..fdf6ed6 100644 --- a/src/gallium/drivers/zink/zink_context.h +++ b/src/gallium/drivers/zink/zink_context.h @@ -48,6 +48,12 @@ struct zink_sampler_view { VkImageView image_view; }; +static inline struct zink_sampler_view * +zink_sampler_view(struct pipe_sampler_view *pview) +{ + return (struct zink_sampler_view *)pview; +} + struct zink_context { struct pipe_context base; struct slab_child_pool transfer_pool; -- 2.7.4