freedreno/a6xx: Allow z24s8 format casts

Allow UBWC format casts between z24s8/x24s8/z24x8.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8816
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22427>
This commit is contained in:
Rob Clark 2023-04-11 12:48:44 -07:00 committed by Marge Bot
parent fc5dd4035a
commit 87978c3933

View file

@ -118,6 +118,20 @@ is_norm(enum pipe_format format)
return desc->is_snorm || desc->is_unorm;
}
static bool
is_z24s8(enum pipe_format format)
{
switch (format) {
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
case PIPE_FORMAT_Z24X8_UNORM:
case PIPE_FORMAT_X24S8_UINT:
case PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8:
return true;
default:
return false;
}
}
static bool
valid_format_cast(struct fd_resource *rsc, enum pipe_format format)
{
@ -125,6 +139,13 @@ valid_format_cast(struct fd_resource *rsc, enum pipe_format format)
if (format == PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8)
return true;
/* If we support z24s8 ubwc then allow casts between the various
* permutations of z24s8:
*/
if (fd_screen(rsc->b.b.screen)->info->a6xx.has_z24uint_s8uint &&
(is_z24s8(format) == is_z24s8(rsc->b.b.format)))
return true;
/* For some color values (just "solid white") compression metadata maps to
* different pixel values for uint/sint vs unorm/snorm, so we can't reliably
* "cast" u/snorm to u/sint and visa versa: