Mesa (master): util: clean the 24-bit unused field to avoid an issues

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 5 21:34:04 UTC 2019


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

Author: Andrii Simiklit <andrii.simiklit at globallogic.com>
Date:   Wed Apr  3 16:51:14 2019 +0300

util: clean the 24-bit unused field to avoid an issues

This is a field of FLOAT_32_UNSIGNED_INT_24_8_REV texture pixel.
OpenGL spec "8.4.4.2 Special Interpretations" is saying:
   "the second word contains a packed 24-bit unused field,
    followed by an 8-bit index"
The spec doesn't require us to clear this unused field
however it make sense to do it to avoid some
undefined behavior in some apps.

Suggested-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110305
Signed-off-by: Andrii Simiklit <andrii.simiklit at globallogic.com>

---

 src/gallium/auxiliary/util/u_format_zs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format_zs.c b/src/gallium/auxiliary/util/u_format_zs.c
index ff584769d12..4c977172b1b 100644
--- a/src/gallium/auxiliary/util/u_format_zs.c
+++ b/src/gallium/auxiliary/util/u_format_zs.c
@@ -830,11 +830,11 @@ util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_str
    unsigned x, y;
    for(y = 0; y < height; ++y) {
       const uint8_t *src = src_row;
-      uint8_t *dst = dst_row + 4;
+      uint32_t *dst = ((uint32_t *)dst_row) + 1;
       for(x = 0; x < width; ++x) {
-         *dst = *src;
+         *dst = util_cpu_to_le32(*src);
          src += 1;
-         dst += 8;
+         dst += 2;
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);




More information about the mesa-commit mailing list