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

Author: Alyssa Rosenzweig <[email protected]>
Date:   Sun Sep 18 10:54:29 2022 -0400

u_transfer_helper: Handle Z24S8 with z24_in_z32f but no interleaving

First, the separate Z/S condition kicks in, splitting up Z24S8 into
Z24X8 + S8. But then the driver is asked to create a Z24X8 resource,
which it may not be able to do. We need to further lower at create
time to Z32F + S8, so the driver is only asked to create supported
formats. We can do this with an extra condition at create time.

The alternate approach would be recursing into
transfer_helper_resource_create, but this seemed more obvious.

Fixes assertion failure running neverball on Asahi.

Assertion failed: (templ->format != PIPE_FORMAT_Z24X8_UNORM &&
      templ->format != PIPE_FORMAT_Z24_UNORM_S8_UINT &&
      "u_transfer_helper should have lowered"), function
agx_resource_create, file agx_pipe.c, line 174.

Fixes: 45a37ace287 ("u_transfer_helper: Handle Z24X8 for drivers that don't use 
the interleaved transfer_map")
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Acked-by: Mike Blumenkrantz <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18651>

---

 src/gallium/auxiliary/util/u_transfer_helper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_transfer_helper.c 
b/src/gallium/auxiliary/util/u_transfer_helper.c
index af1ffc35872..73e4f1b7742 100644
--- a/src/gallium/auxiliary/util/u_transfer_helper.c
+++ b/src/gallium/auxiliary/util/u_transfer_helper.c
@@ -112,6 +112,9 @@ u_transfer_helper_resource_create(struct pipe_screen 
*pscreen,
 
       t.format = util_format_get_depth_only(format);
 
+      if (t.format == PIPE_FORMAT_Z24X8_UNORM && helper->z24_in_z32f)
+         t.format = PIPE_FORMAT_Z32_FLOAT;
+
       prsc = helper->vtbl->resource_create(pscreen, &t);
       if (!prsc)
          return NULL;

Reply via email to