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

Author: Mike Blumenkrantz <[email protected]>
Date:   Sat Mar 18 08:41:00 2023 -0400

zink: double check layouts for possible feedback loop images

if a feedback loop hasn't yet been added for an image with both
descriptor and fb binds, queue a check for that to avoid mismatch

affects godot-tps-gles3-high.trace

cc: mesa-stable

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

---

 src/gallium/drivers/zink/zink_context.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_context.c 
b/src/gallium/drivers/zink/zink_context.c
index fb9a6f545ea..463065f00d0 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1655,10 +1655,15 @@ check_for_layout_update(struct zink_context *ctx, 
struct zink_resource *res, boo
 {
    VkImageLayout layout = res->bind_count[is_compute] ? 
zink_descriptor_util_image_layout_eval(ctx, res, is_compute) : 
VK_IMAGE_LAYOUT_UNDEFINED;
    VkImageLayout other_layout = res->bind_count[!is_compute] ? 
zink_descriptor_util_image_layout_eval(ctx, res, !is_compute) : 
VK_IMAGE_LAYOUT_UNDEFINED;
-   if (res->bind_count[is_compute] && layout && res->layout != layout)
-      _mesa_set_add(ctx->need_barriers[is_compute], res);
-   if (res->bind_count[!is_compute] && other_layout && (layout != other_layout 
|| res->layout != other_layout))
-      _mesa_set_add(ctx->need_barriers[!is_compute], res);
+   if (!is_compute && res->fb_binds && !(ctx->feedback_loops & res->fb_binds)) 
{
+      /* always double check feedback loops */
+      _mesa_set_add(ctx->need_barriers[0], res);
+   } else {
+      if (res->bind_count[is_compute] && layout && res->layout != layout)
+         _mesa_set_add(ctx->need_barriers[is_compute], res);
+      if (res->bind_count[!is_compute] && other_layout && (layout != 
other_layout || res->layout != other_layout))
+         _mesa_set_add(ctx->need_barriers[!is_compute], res);
+   }
 }
 
 static void

Reply via email to