zink: set VK_IMAGE_LAYOUT_PRESENT_SRC_KHR on fb resources at eof flush
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 8 Oct 2020 19:19:02 +0000 (15:19 -0400)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 25 Feb 2021 02:09:52 +0000 (21:09 -0500)
this should maybe fix garbled images on amd?

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9243>

src/gallium/drivers/zink/zink_context.c

index effeb05..684939d 100644 (file)
@@ -1361,6 +1361,14 @@ zink_flush(struct pipe_context *pctx,
    if (deferred)
       batch->fence->deferred_ctx = pctx;
    else if (batch->has_work) {
+      if (flags & PIPE_FLUSH_END_OF_FRAME) {
+         if (ctx->fb_state.nr_cbufs)
+            zink_end_render_pass(ctx, batch);
+         for (int i = 0; i < ctx->fb_state.nr_cbufs; i++)
+            zink_resource_image_barrier(ctx, batch,
+                                        ctx->fb_state.cbufs[i] ? zink_resource(ctx->fb_state.cbufs[i]->texture) : NULL,
+                                        VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, 0, 0);
+      }
       flush_batch(ctx);
 
       if (zink_screen(pctx->screen)->info.have_EXT_transform_feedback && ctx->num_so_targets)