zink: emulate latc formats with rgtc

util_format_luminance_to_red returns PIPE_FORMAT_NONE for LATC formats,
because there's no red-alpha variant of it, only red-green.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18596>
This commit is contained in:
Erik Faye-Lund 2022-09-14 10:36:21 +02:00 committed by Marge Bot
parent 88ed8245a8
commit 21ec469a2f
2 changed files with 10 additions and 2 deletions

View file

@ -117,7 +117,7 @@ traces:
freedreno-a630:
checksum: 730692659fbb9eefa44d6b1a2df2fa8e
zink-a630:
checksum: 165d3c13c8143fbc2265a55758afc04c
checksum: 2a31ee1a56b755dcf5975b31eacbec32
behdad-glyphy/glyphy-v2.trace:
freedreno-a306:

View file

@ -302,8 +302,16 @@ zink_format_get_emulated_alpha(enum pipe_format format)
{
if (util_format_is_alpha(format))
return emulate_alpha(format);
if (util_format_is_luminance(format) || util_format_is_luminance_alpha(format))
if (util_format_is_luminance(format))
return util_format_luminance_to_red(format);
if (util_format_is_luminance_alpha(format)) {
if (format == PIPE_FORMAT_LATC2_UNORM)
return PIPE_FORMAT_RGTC2_UNORM;
if (format == PIPE_FORMAT_LATC2_SNORM)
return PIPE_FORMAT_RGTC2_SNORM;
return util_format_luminance_to_red(format);
}
return emulate_red_alpha(format);
}