From 534436f8635e63a30e4d7af4837dad35cfa361ad Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 25 Feb 2025 14:12:31 -0500 Subject: [PATCH] zink: explicitly check usage in buffer barriers it's technically possible for a resource to have no usage but for batch usage to be set; this can occur if a resource is used, its cmdbuf completes, but the batch state is not reset before the resource is used again cc: mesa-stable Part-of: --- src/gallium/drivers/zink/zink_synchronization.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_synchronization.cpp b/src/gallium/drivers/zink/zink_synchronization.cpp index d68ec549f1b..a91d80e7a10 100644 --- a/src/gallium/drivers/zink/zink_synchronization.cpp +++ b/src/gallium/drivers/zink/zink_synchronization.cpp @@ -698,11 +698,12 @@ zink_resource_buffer_barrier(struct zink_context *ctx, struct zink_resource *res bool is_write = zink_resource_access_is_write(flags); enum zink_resource_access rw = is_write ? ZINK_RESOURCE_ACCESS_RW : ZINK_RESOURCE_ACCESS_WRITE; - bool completed = zink_resource_usage_check_completion_fast(zink_screen(ctx->base.screen), res, rw); + bool has_usage = zink_resource_has_usage(res); + bool completed = !has_usage || zink_resource_usage_check_completion_fast(zink_screen(ctx->base.screen), res, rw); bool usage_matches = !completed && zink_resource_usage_matches(res, ctx->bs); if (!usage_matches) { res->obj->unordered_write = true; - if (is_write || zink_resource_usage_check_completion_fast(zink_screen(ctx->base.screen), res, ZINK_RESOURCE_ACCESS_RW)) + if (is_write || !has_usage || zink_resource_usage_check_completion_fast(zink_screen(ctx->base.screen), res, ZINK_RESOURCE_ACCESS_RW)) res->obj->unordered_read = true; } bool unordered_usage_matches = res->obj->unordered_access && usage_matches;