Mesa (master): u_format: Fix z32_s8x24 s8 unpacking on big-endian.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 28 10:11:23 UTC 2021


Module: Mesa
Branch: master
Commit: 82c6f2ea32ade11aa3816930a582f1c28118d6d1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=82c6f2ea32ade11aa3816930a582f1c28118d6d1

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Apr 27 13:10:41 2021 -0700

u_format: Fix z32_s8x24 s8 unpacking on big-endian.

The s8x24 is a packed group in the format, and for packing we properly
write our s8 in the low bits of the 32, but for unpacking we tried
treating it as a byte array.

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7776>

---

 src/util/format/u_format_zs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/format/u_format_zs.c b/src/util/format/u_format_zs.c
index 2ebf0ca3af5..05f023c6c26 100644
--- a/src/util/format/u_format_zs.c
+++ b/src/util/format/u_format_zs.c
@@ -873,10 +873,10 @@ util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t *restrict dst_row, unsig
    unsigned x, y;
    for(y = 0; y < height; ++y) {
       uint8_t *dst = dst_row;
-      const uint8_t *src = src_row + 4;
+      const uint32_t *src = (uint32_t *)(src_row + 4);
       for(x = 0; x < width; ++x) {
          *dst = *src;
-         src += 8;
+         src += 2;
          dst += 1;
       }
       src_row += src_stride/sizeof(*src_row);



More information about the mesa-commit mailing list