From c50bbfa0ab513a771167b3885fdbb2b5c75d2384 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michel=20D=C3=A4nzer?= Date: Fri, 24 Apr 2020 11:40:14 +0200 Subject: [PATCH] mesa: Skip 3-byte array formats in _mesa_array_format_flip_channels MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Byte swapping makes no sense for 3-byte formats: Swapping the order of 2 or 4 bytes at a time would inevitably result in bytes getting mixed up between neighbouring pixels. Fixes crash with a debugging build on a big endian machine due hitting the unreachable() at the end of the function. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2665 Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/formats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 114ea5218be..0bca52fde50 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -404,7 +404,7 @@ _mesa_array_format_flip_channels(mesa_array_format format) num_channels = _mesa_array_format_get_num_channels(format); _mesa_array_format_get_swizzle(format, swizzle); - if (num_channels == 1) + if (num_channels == 1 || num_channels == 3) return format; if (num_channels == 2) { -- 2.30.2