summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-03-26 22:22:41 +0100
committerErik Faye-Lund <[email protected]>2019-10-28 08:51:44 +0000
commit4ae362c0efa660242d79ac6df772649e1469d986 (patch)
tree52cfcb7a95e469ce443f25cf40389065ff2c5d79 /src/gallium
parent2e2ad61ef1b085642bbb49297b4308758d9b892a (diff)
zink: delete samplers after the current cmdbuf
This makes them zombies for a little while. Acked-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/zink/zink_cmdbuf.c5
-rw-r--r--src/gallium/drivers/zink/zink_cmdbuf.h4
-rw-r--r--src/gallium/drivers/zink/zink_context.c7
3 files changed, 14 insertions, 2 deletions
diff --git a/src/gallium/drivers/zink/zink_cmdbuf.c b/src/gallium/drivers/zink/zink_cmdbuf.c
index 44c4d941b8d..5928254cc0f 100644
--- a/src/gallium/drivers/zink/zink_cmdbuf.c
+++ b/src/gallium/drivers/zink/zink_cmdbuf.c
@@ -29,6 +29,11 @@ reset_cmdbuf(struct zink_screen *screen, struct zink_cmdbuf *cmdbuf)
pipe_resource_reference(&pres, NULL);
}
_mesa_set_clear(cmdbuf->resources, NULL);
+
+ util_dynarray_foreach(&cmdbuf->zombie_samplers, VkSampler, samp) {
+ vkDestroySampler(screen->dev, *samp, NULL);
+ }
+ util_dynarray_clear(&cmdbuf->zombie_samplers);
}
struct zink_cmdbuf *
diff --git a/src/gallium/drivers/zink/zink_cmdbuf.h b/src/gallium/drivers/zink/zink_cmdbuf.h
index f0159d91120..ffc6e29757d 100644
--- a/src/gallium/drivers/zink/zink_cmdbuf.h
+++ b/src/gallium/drivers/zink/zink_cmdbuf.h
@@ -26,6 +26,8 @@
#include <vulkan/vulkan.h>
+#include "util/u_dynarray.h"
+
struct zink_context;
struct zink_fence;
struct zink_framebuffer;
@@ -40,6 +42,8 @@ struct zink_cmdbuf {
struct zink_framebuffer *fb;
struct set *resources;
+
+ struct util_dynarray zombie_samplers;
};
struct zink_cmdbuf *
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 13e630ca65b..fd9cd6e3717 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -164,8 +164,9 @@ static void
zink_delete_sampler_state(struct pipe_context *pctx,
void *sampler_state)
{
- struct zink_screen *screen = zink_screen(pctx->screen);
- vkDestroySampler(screen->dev, sampler_state, NULL);
+ struct zink_cmdbuf *cmdbuf = zink_context_curr_cmdbuf(zink_context(pctx));
+ util_dynarray_append(&cmdbuf->zombie_samplers,
+ VkSampler, sampler_state);
}
@@ -1271,6 +1272,8 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
_mesa_key_pointer_equal);
if (!ctx->cmdbufs[i].resources)
goto fail;
+
+ util_dynarray_init(&ctx->cmdbufs[i].zombie_samplers, NULL);
}
VkDescriptorPoolSize sizes[] = {