Module: Mesa Branch: main Commit: 45a37ace28774ad33b1cf288ff863e00d008e9db URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=45a37ace28774ad33b1cf288ff863e00d008e9db
Author: Alyssa Rosenzweig <[email protected]> Date: Thu Aug 18 23:21:52 2022 -0400 u_transfer_helper: Handle Z24X8 for drivers that don't use the interleaved transfer_map Fixes dEQP-GLES3.functional.texture.format.sized.2d.depth_component24_pot on Asahi. Signed-off-by: Alyssa Rosenzweig <[email protected]> Acked-by: Mike Blumenkrantz <[email protected]> Acked-by: Dave Airlie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18136> --- src/gallium/auxiliary/util/u_transfer_helper.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gallium/auxiliary/util/u_transfer_helper.c b/src/gallium/auxiliary/util/u_transfer_helper.c index 6dc8afa63f7..1aaf2b382a7 100644 --- a/src/gallium/auxiliary/util/u_transfer_helper.c +++ b/src/gallium/auxiliary/util/u_transfer_helper.c @@ -134,6 +134,15 @@ u_transfer_helper_resource_create(struct pipe_screen *pscreen, struct pipe_resource t = *templ; t.format = PIPE_FORMAT_R8G8B8A8_UNORM; + prsc = helper->vtbl->resource_create(pscreen, &t); + if (!prsc) + return NULL; + + prsc->format = format; /* frob the format back to the "external" format */ + } else if (format == PIPE_FORMAT_Z24X8_UNORM && helper->z24_in_z32f) { + struct pipe_resource t = *templ; + t.format = PIPE_FORMAT_Z32_FLOAT; + prsc = helper->vtbl->resource_create(pscreen, &t); if (!prsc) return NULL; @@ -356,6 +365,11 @@ u_transfer_helper_transfer_map(struct pipe_context *pctx, break; } } + } else if (prsc->format == PIPE_FORMAT_Z24X8_UNORM) { + assert(helper->z24_in_z32f); + util_format_z24x8_unorm_pack_z_float(trans->staging, ptrans->stride, + trans->ptr, trans->trans->stride, + width, height); } else { unreachable("bleh"); }
