Mesa (staging/22.1): zink: fix framebuffer attachment usage asserts for dummy attachments

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 15 16:22:55 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: d3e3483ec290fbdee61939e3bd1e52e51f5ee799
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3e3483ec290fbdee61939e3bd1e52e51f5ee799

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri May 27 10:04:05 2022 -0400

zink: fix framebuffer attachment usage asserts for dummy attachments

dummy attachments never overwrite existing attachments,
so they must be explicitly compared like this to avoid
erroneous crashing

Fixes: 3892c133811 ("zink: add an alternate path for EXT_color_write_enable usage")

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

---

 .pick_status.json                       |  2 +-
 src/gallium/drivers/zink/zink_context.c | 26 +++++++++++++++++---------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 0613af4af50..b82e0e401b6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4513,7 +4513,7 @@
         "description": "zink: fix framebuffer attachment usage asserts for dummy attachments",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 3,
         "main_sha": null,
         "because_sha": "3892c133811f71d7f9eefda34bf282ccd1e6859b"
     },
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index a97e3ea1faf..05445fd925f 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -2091,7 +2091,10 @@ get_render_pass(struct zink_context *ctx)
       state.num_rts++;
    }
    state.have_zsbuf = fb->zsbuf != NULL;
-   assert(clears == ctx->rp_clears_enabled);
+   if (zink_use_dummy_attachments(ctx))
+      assert(clears == (ctx->rp_clears_enabled & PIPE_CLEAR_DEPTHSTENCIL));
+   else
+      assert(clears == ctx->rp_clears_enabled);
    state.clears = clears;
    uint32_t hash = hash_render_pass_state(&state);
    struct hash_entry *entry = _mesa_hash_table_search_pre_hashed(ctx->render_pass_cache, hash,
@@ -2327,7 +2330,7 @@ begin_render_pass(struct zink_context *ctx)
    uint32_t clear_validate = 0;
    for (int i = 0; i < fb_state->nr_cbufs; i++) {
       /* these are no-ops */
-      if (!fb_state->cbufs[i] || !zink_fb_clear_enabled(ctx, i))
+      if (!fb_state->cbufs[i] || !zink_fb_clear_enabled(ctx, i) || zink_use_dummy_attachments(ctx))
          continue;
       /* these need actual clear calls inside the rp */
       struct zink_framebuffer_clear_data *clear = zink_fb_clear_element(&ctx->fb_clears[i], 0);
@@ -2380,13 +2383,18 @@ begin_render_pass(struct zink_context *ctx)
       for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
          if (ctx->fb_state.cbufs[i]) {
             struct zink_surface *surf = zink_csurface(ctx->fb_state.cbufs[i]);
-            struct zink_surface *transient = zink_transient_surface(ctx->fb_state.cbufs[i]);
-            if (surf->base.format == ctx->fb_state.cbufs[i]->format) {
-               if (transient) {
-                  assert(zink_resource(transient->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[i].usage);
-                  assert(zink_resource(surf->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[cresolve_offset].usage);
-               } else {
-                  assert(zink_resource(surf->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[i].usage);
+            if (zink_use_dummy_attachments(ctx)) {
+               surf = zink_csurface(ctx->dummy_surface[util_logbase2_ceil(ctx->fb_state.samples)]);
+               assert(zink_resource(surf->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[i].usage);
+            } else {
+               struct zink_surface *transient = zink_transient_surface(&surf->base);
+               if (surf->base.format == ctx->fb_state.cbufs[i]->format) {
+                  if (transient) {
+                     assert(zink_resource(transient->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[i].usage);
+                     assert(zink_resource(surf->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[cresolve_offset].usage);
+                  } else {
+                     assert(zink_resource(surf->base.texture)->obj->vkusage == ctx->framebuffer->state.infos[i].usage);
+                  }
                }
             }
          }



More information about the mesa-commit mailing list