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 <alyssa@rosenzweig.io>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18136>
This commit is contained in:
Alyssa Rosenzweig 2022-08-18 23:21:52 -04:00 committed by Marge Bot
parent b12cc5c4fe
commit 45a37ace28

View file

@ -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");
}