Module: Mesa
Branch: master
Commit: 4f144dc92ce221e0c7106436a1c2a43da2e9f733
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f144dc92ce221e0c7106436a1c2a43da2e9f733

Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Jul  3 13:34:34 2020 -0400

zink: don't leak sampler view textures

by adding a batch reference for these textures during draw, we can successfully
destroy the resources without crashing

Reviewed-by: Erik Faye-Lun <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6924>

---

 src/gallium/drivers/zink/zink_context.c | 1 +
 src/gallium/drivers/zink/zink_draw.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_context.c 
b/src/gallium/drivers/zink/zink_context.c
index 0ea5a5066b1..0b224ff24b8 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -290,6 +290,7 @@ zink_sampler_view_destroy(struct pipe_context *pctx,
 {
    struct zink_sampler_view *view = zink_sampler_view(pview);
    vkDestroyImageView(zink_screen(pctx->screen)->dev, view->image_view, NULL);
+   pipe_resource_reference(&pview->texture, NULL);
    FREE(view);
 }
 
diff --git a/src/gallium/drivers/zink/zink_draw.c 
b/src/gallium/drivers/zink/zink_draw.c
index 5877ba0ed02..63024369a37 100644
--- a/src/gallium/drivers/zink/zink_draw.c
+++ b/src/gallium/drivers/zink/zink_draw.c
@@ -390,6 +390,7 @@ zink_draw_vbo(struct pipe_context *pctx,
          } else {
             struct zink_sampler_view *sampler_view = 
zink_sampler_view(ctx->image_views[i][index]);
             zink_batch_reference_sampler_view(batch, sampler_view);
+            zink_batch_reference_resource_rw(batch, 
zink_resource(ctx->image_views[i][index]->texture), false);
          }
       }
    }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to