zink: explicitly eliminate feedback loops for unused zsbufs
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 17 Mar 2023 13:51:53 +0000 (09:51 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 20 Mar 2023 18:24:07 +0000 (18:24 +0000)
this avoids a GENERAL/FEEDBACK_LOOP layout transition where possible

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21988>

src/gallium/drivers/zink/zink_context.c

index b531161..290a7dd 100644 (file)
@@ -5651,6 +5651,9 @@ add_implicit_feedback_loop(struct zink_context *ctx, struct zink_resource *res)
    /* can only feedback loop with fb+sampler bind; image bind must be GENERAL */
    if (!res->fb_bind_count || !res->sampler_bind_count[0] || res->image_bind_count[0])
       return false;
+   /* if zsbuf isn't used then it effectively has no fb binds */
+   if (!(res->aspect & VK_IMAGE_ASPECT_COLOR_BIT) && !zink_is_zsbuf_used(ctx))
+      return false;
    bool is_feedback = false;
    /* avoid false positives when a texture is bound but not used */
    u_foreach_bit(vkstage, res->gfx_barrier) {