zink: skip implicit feedback loop layout changes if feedback loop not present

if a resource is bound as both a framebuffer attachment and a sampler but
isn't actually used as a sampler, it's just a framebuffer attachment, and it
should retain its layout as a framebuffer attachment without any barriers

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20674>
This commit is contained in:
Mike Blumenkrantz
2023-01-12 10:45:43 -05:00
committed by Marge Bot
parent 9ba0657903
commit e39bf3e6aa
2 changed files with 7 additions and 7 deletions
@@ -44,7 +44,6 @@ traces:
label: [skip, flakes]
checksum: 826f966a52bc956644bf41562aa9c686
text: |-
'WARNING: Incorrect rendering will happen because the Vulkan device doesn't support the 'EXT_attachment_feedback_loop_layout' feature.'
This trace is flaky on freedreno too.
SirYouAreBeingHunted/sir-f750-v2.trace:
gl-zink-anv-tgl:
+7 -6
View File
@@ -280,11 +280,11 @@ draw(struct zink_context *ctx,
}
}
static void
static bool
add_implicit_color_feedback_loop(struct zink_context *ctx, struct zink_resource *res)
{
if (!res->fb_bind_count || !res->sampler_bind_count[0] || ctx->feedback_loops & res->fb_binds)
return;
return false;
bool is_feedback = false;
/* avoid false positives when a texture is bound but not used */
u_foreach_bit(vkstage, res->gfx_barrier) {
@@ -297,7 +297,7 @@ add_implicit_color_feedback_loop(struct zink_context *ctx, struct zink_resource
is_feedback = true;
}
if (!is_feedback)
return;
return false;
/* new feedback loop detected */
if (res->aspect == VK_IMAGE_ASPECT_COLOR_BIT) {
if (!ctx->gfx_pipeline_state.feedback_loop)
@@ -316,6 +316,7 @@ add_implicit_color_feedback_loop(struct zink_context *ctx, struct zink_resource
else
ctx->dynamic_fb.attachments[idx].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
}
return true;
}
static void
@@ -334,10 +335,10 @@ update_barriers(struct zink_context *ctx, bool is_compute,
if (res->base.b.target == PIPE_BUFFER)
zink_screen(ctx->base.screen)->buffer_barrier(ctx, res, res->barrier_access[is_compute], pipeline);
else {
bool is_feedback = is_compute ? false : add_implicit_color_feedback_loop(ctx, res);
VkImageLayout layout = zink_descriptor_util_image_layout_eval(ctx, res, is_compute);
if (!is_compute)
add_implicit_color_feedback_loop(ctx, res);
if (layout != res->layout)
/* GENERAL is only used for feedback loops and storage image binds */
if (is_feedback || layout != VK_IMAGE_LAYOUT_GENERAL || res->image_bind_count[is_compute])
zink_screen(ctx->base.screen)->image_barrier(ctx, res, layout, res->barrier_access[is_compute], pipeline);
}
if (zink_resource_access_is_write(res->barrier_access[is_compute]))