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: 45a37ace28 ("u_transfer_helper: Handle Z24X8 for drivers that don't use the interleaved transfer_map")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18651>
This commit is contained in:
Alyssa Rosenzweig 2022-09-18 10:54:29 -04:00 committed by Marge Bot
parent 78adf44839
commit 87bc306605

View file

@ -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;