zink: delete samplers after the current cmdbuf

This makes them zombies for a little while.

Acked-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
Erik Faye-Lund 2019-03-26 22:22:41 +01:00
parent 2e2ad61ef1
commit 4ae362c0ef
3 changed files with 14 additions and 2 deletions

View file

@ -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 *

View file

@ -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 *

View file

@ -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[] = {