Mesa (10.6): mesa/formats: Don't flip channels of null array formats

Emil Velikov evelikov at kemper.freedesktop.org
Thu Aug 20 12:52:56 UTC 2015


Module: Mesa
Branch: 10.6
Commit: d18593b4160d75d21e8e5849aeb021514bd77b35
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d18593b4160d75d21e8e5849aeb021514bd77b35

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Mon Aug 10 01:32:23 2015 -0700

mesa/formats: Don't flip channels of null array formats

Before, if we encountered an array format of 0 on a BE system, we would
flip all the channels even though it's an invalid format.  This would
result in a mostly invalid format with a swizzle of yyyy or wwww.  Instead,
we should just return 0 if the array format stashed in the format info is
invalid.

Cc: "10.6 10.5" <mesa-stable at lists.freedesktop.org>
(cherry picked from commit e3eb91af804f449005a2ff535c805eaa1d579d99)

---

 src/mesa/main/formats.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index a20a41d..bedab99 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -380,7 +380,8 @@ uint32_t
 _mesa_format_to_array_format(mesa_format format)
 {
    const struct gl_format_info *info = _mesa_get_format_info(format);
-   if (!_mesa_little_endian() && info->Layout == MESA_FORMAT_LAYOUT_PACKED)
+   if (info->ArrayFormat && !_mesa_little_endian() &&
+       info->Layout == MESA_FORMAT_LAYOUT_PACKED)
       return _mesa_array_format_flip_channels(info->ArrayFormat);
    else
       return info->ArrayFormat;




More information about the mesa-commit mailing list