zink: fix queue transition check in check_for_layout_update()

this only applies if the resource has active binds, otherwise it triggers crashes

Fixes: 18d206d67c ("zink: Check queue families when binding image resources")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35234>
(cherry picked from commit 44bff7eb05)
This commit is contained in:
Mike Blumenkrantz 2025-05-29 12:19:47 -04:00 committed by Eric Engestrom
parent af3a5a15d2
commit 6eb10b69a4
2 changed files with 4 additions and 5 deletions

View file

@ -1904,7 +1904,7 @@
"description": "zink: fix queue transition check in check_for_layout_update()",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "18d206d67ca485ef2f8b17ea1c0e0c08b63d3562",
"notes": null

View file

@ -1853,11 +1853,10 @@ check_for_layout_update(struct zink_context *ctx, struct zink_resource *res, boo
if (!is_compute && res->fb_binds && !(ctx->feedback_loops & res->fb_binds)) {
/* always double check feedback loops */
ret = !!_mesa_set_add(ctx->need_barriers[0], res);
} else if (res->queue != zink_screen(ctx->base.screen)->gfx_queue && res->queue != VK_QUEUE_FAMILY_IGNORED) {
/* Check if we need a queue family transfer */
ret = !!_mesa_set_add(ctx->need_barriers[0], res);
} else {
if (res->bind_count[is_compute] && layout && res->layout != layout)
if (res->bind_count[is_compute] && ((layout && res->layout != layout) ||
/* Check if we need a queue family transfer */
(res->queue != zink_screen(ctx->base.screen)->gfx_queue && res->queue != VK_QUEUE_FAMILY_IGNORED)))
ret = !!_mesa_set_add(ctx->need_barriers[is_compute], res);
if (res->bind_count[!is_compute] && other_layout && (layout != other_layout || res->layout != other_layout))
ret = !!_mesa_set_add(ctx->need_barriers[!is_compute], res);