Mesa (main): zink: force texture barriers when performing in-renderpass clears

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 11 01:21:29 UTC 2022


Module: Mesa
Branch: main
Commit: bcf5d2d8f4f91faadc7f3b39804243c10195f486
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bcf5d2d8f4f91faadc7f3b39804243c10195f486

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Apr  8 18:46:50 2022 -0400

zink: force texture barriers when performing in-renderpass clears

according to spec, a barrier is required any time the pixels of the
framebuffer are changed. since zink defers clears and runs them at
a later time, it must also be responsible for handling the required
synchronization for such operations

fixes (radv):
KHR-GL46.blend_equation_advanced.blend_all*

fixes #5572

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

---

 src/gallium/drivers/zink/zink_clear.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_clear.c b/src/gallium/drivers/zink/zink_clear.c
index 5e974b6ad77..5a7701ca049 100644
--- a/src/gallium/drivers/zink/zink_clear.c
+++ b/src/gallium/drivers/zink/zink_clear.c
@@ -120,6 +120,19 @@ clear_in_rp(struct pipe_context *pctx,
    struct zink_batch *batch = &ctx->batch;
    zink_batch_rp(ctx);
    VKCTX(CmdClearAttachments)(batch->state->cmdbuf, num_attachments, attachments, 1, &cr);
+   /*
+       Rendering within a subpass containing a feedback loop creates a data race, except in the following
+       cases:
+       • If a memory dependency is inserted between when the attachment is written and when it is
+       subsequently read by later fragments. Pipeline barriers expressing a subpass self-dependency
+       are the only way to achieve this, and one must be inserted every time a fragment will read
+       values at a particular sample (x, y, layer, sample) coordinate, if those values have been written
+       since the most recent pipeline barrier
+
+       VK 1.3.211, Chapter 8: Render Pass
+    */
+   if (ctx->fbfetch_outputs)
+      ctx->base.texture_barrier(&ctx->base, PIPE_TEXTURE_BARRIER_FRAMEBUFFER);
 }
 
 static void



More information about the mesa-commit mailing list