Mesa (10.6): mesa/formats: don't byteswap when building array formats

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


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

Author: Oded Gabbay <oded.gabbay at gmail.com>
Date:   Wed Aug 12 18:22:53 2015 +0300

mesa/formats: don't byteswap when building array formats

Because we build here an array format, we don't need to swap the
bytes for big endian.
If it isn't an array format, the bytes will be swapped in
_mesa_format_convert.

v2: remove temp variable

Signed-off-by: Oded Gabbay <oded.gabbay at gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
Cc: "10.5 10.6" <mesa-stable at lists.freedesktop.org>
(cherry picked from commit 5f1d5b1c7857f8680b47a7a450ee9e4530e22c6f)

---

 src/mesa/main/glformats.c |   14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 8ced579..4fc85ab 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2570,8 +2570,6 @@ get_swizzle_from_gl_format(GLenum format, uint8_t *swizzle)
 uint32_t
 _mesa_format_from_format_and_type(GLenum format, GLenum type)
 {
-   mesa_array_format array_format;
-
    bool is_array_format = true;
    uint8_t swizzle[4];
    bool normalized = false, is_float = false, is_signed = false;
@@ -2627,15 +2625,9 @@ _mesa_format_from_format_and_type(GLenum format, GLenum type)
       normalized = !_mesa_is_enum_format_integer(format);
       num_channels = _mesa_components_in_format(format);
 
-      array_format =
-         MESA_ARRAY_FORMAT(type_size, is_signed, is_float,
-                           normalized, num_channels,
-                           swizzle[0], swizzle[1], swizzle[2], swizzle[3]);
-
-      if (!_mesa_little_endian())
-         array_format = _mesa_array_format_flip_channels(array_format);
-
-      return array_format;
+      return MESA_ARRAY_FORMAT(type_size, is_signed, is_float,
+                               normalized, num_channels,
+                               swizzle[0], swizzle[1], swizzle[2], swizzle[3]);
    }
 
    /* Otherwise this is not an array format, so return the mesa_format




More information about the mesa-commit mailing list