zink: do not leak image-views
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 25 Mar 2019 13:29:50 +0000 (14:29 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Mon, 28 Oct 2019 08:51:44 +0000 (08:51 +0000)
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/zink/zink_context.c
src/gallium/drivers/zink/zink_context.h

index 9c5167a..b437bd3 100644 (file)
@@ -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);
 }
 
index 69e2fdd..fdf6ed6 100644 (file)
@@ -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;