From d772419dab6e2c335a63f7093f127f78d3134b69 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 2 Sep 2021 17:16:56 -0400 Subject: [PATCH] zink: add a batch ref when replacing a buffer that has binds and usage any resource with active binds will have exactly 1 ref for the bind, so if it also has usage, it needs to be destroyed on the batch to avoid early deletion while it's in use Reviewed-by: Dave Airlie Part-of: --- src/gallium/drivers/zink/zink_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 842b1aa..6ee3be7 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -3446,7 +3446,8 @@ zink_context_replace_buffer_storage(struct pipe_context *pctx, struct pipe_resou assert(d->obj); assert(s->obj); util_idalloc_mt_free(&zink_screen(pctx->screen)->buffer_ids, delete_buffer_id); - if (zink_resource_has_unflushed_usage(d)) + if (zink_resource_has_unflushed_usage(d) || + (zink_resource_has_usage(d) && zink_resource_has_binds(d))) zink_batch_reference_resource(&ctx->batch, d); zink_resource_object_reference(zink_screen(pctx->screen), &d->obj, s->obj); d->access = s->access; -- 2.7.4