diff options
author | Erik Faye-Lund <[email protected]> | 2019-06-20 11:41:02 +0200 |
---|---|---|
committer | Erik Faye-Lund <[email protected]> | 2019-10-28 08:51:45 +0000 |
commit | 2a7302075df61734c89f01ddfc84ead39dfdd6fc (patch) | |
tree | d23db8a1dbddce02c87664bd7b7dec73620b7840 /src/gallium/drivers/zink/zink_batch.c | |
parent | 09e20d88e73a63466758e06b708e1fd7f058b450 (diff) |
zink: ensure sampler-views survive a batch
we don't need to track the resources for the samplers any longer, as
the sampler view holds a reference instead.
Acked-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/gallium/drivers/zink/zink_batch.c')
-rw-r--r-- | src/gallium/drivers/zink/zink_batch.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/drivers/zink/zink_batch.c b/src/gallium/drivers/zink/zink_batch.c index 0db58c6a881..45466af5699 100644 --- a/src/gallium/drivers/zink/zink_batch.c +++ b/src/gallium/drivers/zink/zink_batch.c @@ -30,6 +30,13 @@ reset_batch(struct zink_screen *screen, struct zink_batch *batch) } _mesa_set_clear(batch->resources, NULL); + /* unref all used sampler-views */ + set_foreach(batch->sampler_views, entry) { + struct pipe_sampler_view *pres = (struct pipe_sampler_view *)entry->key; + pipe_sampler_view_reference(&pres, NULL); + } + _mesa_set_clear(batch->sampler_views, NULL); + util_dynarray_foreach(&batch->zombie_samplers, VkSampler, samp) { vkDestroySampler(screen->dev, *samp, NULL); } @@ -97,3 +104,15 @@ zink_batch_reference_resoure(struct zink_batch *batch, pipe_resource_reference(&tmp, &res->base); } } + +void +zink_batch_reference_sampler_view(struct zink_batch *batch, + struct zink_sampler_view *sv) +{ + struct set_entry *entry = _mesa_set_search(batch->sampler_views, sv); + if (!entry) { + struct pipe_sampler_view *tmp = NULL; + entry = _mesa_set_add(batch->sampler_views, sv); + pipe_sampler_view_reference(&tmp, &sv->base); + } +} |