zink: only add deferred barrier on fb unbind when layout needs to change
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 6 Mar 2023 13:25:00 +0000 (08:25 -0500)
committerMarge Bot <emma+marge@anholt.net>
Tue, 7 Mar 2023 01:57:41 +0000 (01:57 +0000)
this otherwise may have been a surface that was never drawn to or
already had its layout corrected, in which case a deferred barrier
is not only unnecessary, it might be broken

cc: mesa-stable

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

src/gallium/drivers/zink/zink_context.c

index fa71aa7..cbea68f 100644 (file)
@@ -3177,7 +3177,8 @@ unbind_fb_surface(struct zink_context *ctx, struct pipe_surface *surf, unsigned
       check_resource_for_batch_ref(ctx, res);
       if (res->sampler_bind_count[0]) {
          update_res_sampler_layouts(ctx, res);
-         _mesa_set_add(ctx->need_barriers[0], res);
+         if (res->layout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
+            _mesa_set_add(ctx->need_barriers[0], res);
       }
    }
 }