Mesa (10.6): mesa: clear existing swizzle info before bitwise-OR

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


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

Author: Oded Gabbay <oded.gabbay at gmail.com>
Date:   Tue Aug  4 21:39:32 2015 +0300

mesa: clear existing swizzle info before bitwise-OR

This patch fixes a bug in big-endian treatment, where the previous
swizzle info wasn't cleared before a new swizzle info was inserted into
the format field using a bitwise-OR operation.

v2: use MESA_ARRAY_FORMAT_SWIZZLE_*_MASK instead of numeric constants
v3: align according to coding style

Signed-off-by: Oded Gabbay <oded.gabbay at gmail.com>
CC: "10.5 10.6" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
(cherry picked from commit 2ac171a7db4e4ad2fa902e62bf18bc1f67e91643)

---

 src/mesa/main/formats.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 7e451ca..d938e6a 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -191,6 +191,11 @@ static inline void
 _mesa_array_format_set_swizzle(mesa_array_format *f,
                                int32_t x, int32_t y, int32_t z, int32_t w)
 {
+   *f &= ~(MESA_ARRAY_FORMAT_SWIZZLE_X_MASK |
+           MESA_ARRAY_FORMAT_SWIZZLE_Y_MASK |
+           MESA_ARRAY_FORMAT_SWIZZLE_Z_MASK |
+           MESA_ARRAY_FORMAT_SWIZZLE_W_MASK);
+
    *f |= ((x << 8 ) & MESA_ARRAY_FORMAT_SWIZZLE_X_MASK) |
          ((y << 11) & MESA_ARRAY_FORMAT_SWIZZLE_Y_MASK) |
          ((z << 14) & MESA_ARRAY_FORMAT_SWIZZLE_Z_MASK) |




More information about the mesa-commit mailing list