gallium/tests: Update UTIL_FORMAT_MAX_* defines.
[mesa.git] / src / gallium / auxiliary / util / u_format_zs.c
index 80081e22f7c88e3d0eb08e83d59ce96d93395bff..69f2f2971f7a939f072afad482fed83850804fda 100644 (file)
  * z32_unorm conversion functions
  */
 
-static INLINE uint16_t
+static inline uint16_t
 z32_unorm_to_z16_unorm(uint32_t z)
 {
    /* z * 0xffff / 0xffffffff */
    return z >> 16;
 }
 
-static INLINE uint32_t
+static inline uint32_t
 z16_unorm_to_z32_unorm(uint16_t z)
 {
    /* z * 0xffffffff / 0xffff */
    return (z << 16) | z;
 }
 
-static INLINE uint32_t
+static inline uint32_t
 z32_unorm_to_z24_unorm(uint32_t z)
 {
    /* z * 0xffffff / 0xffffffff */
    return z >> 8;
 }
 
-static INLINE uint32_t
+static inline uint32_t
 z24_unorm_to_z32_unorm(uint32_t z)
 {
    /* z * 0xffffffff / 0xffffff */
@@ -68,42 +68,42 @@ z24_unorm_to_z32_unorm(uint32_t z)
  * z32_float conversion functions
  */
 
-static INLINE uint16_t
+static inline uint16_t
 z32_float_to_z16_unorm(float z)
 {
    const float scale = 0xffff;
-   return (uint16_t)(z * scale);
+   return (uint16_t)(z * scale + 0.5f);
 }
 
-static INLINE float
+static inline float
 z16_unorm_to_z32_float(uint16_t z)
 {
    const float scale = 1.0 / 0xffff;
    return (float)(z * scale);
 }
 
-static INLINE uint32_t
+static inline uint32_t
 z32_float_to_z24_unorm(float z)
 {
    const double scale = 0xffffff;
    return (uint32_t)(z * scale) & 0xffffff;
 }
 
-static INLINE float
+static inline float
 z24_unorm_to_z32_float(uint32_t z)
 {
    const double scale = 1.0 / 0xffffff;
    return (float)(z * scale);
 }
 
-static INLINE uint32_t
+static inline uint32_t
 z32_float_to_z32_unorm(float z)
 {
    const double scale = 0xffffffff;
    return (uint32_t)(z * scale);
 }
 
-static INLINE float
+static inline float
 z32_unorm_to_z32_float(uint32_t z)
 {
    const double scale = 1.0 / 0xffffffff;
@@ -112,7 +112,7 @@ z32_unorm_to_z32_float(uint32_t z)
 
 
 void
-util_format_s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+util_format_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
                                          const uint8_t *src_row, unsigned src_stride,
                                          unsigned width, unsigned height)
 {
@@ -125,7 +125,7 @@ util_format_s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+util_format_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
                                        const uint8_t *src_row, unsigned src_stride,
                                        unsigned width, unsigned height)
 {
@@ -147,10 +147,7 @@ util_format_z16_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
       float *dst = dst_row;
       const uint16_t *src = (const uint16_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint16_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap16(value);
-#endif
+         uint16_t value = util_cpu_to_le16(*src++);
          *dst++ = z16_unorm_to_z32_float(value);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -170,10 +167,7 @@ util_format_z16_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
       for(x = 0; x < width; ++x) {
          uint16_t value;
          value = z32_float_to_z16_unorm(*src++);
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap16(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_le16_to_cpu(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -190,10 +184,7 @@ util_format_z16_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
       uint32_t *dst = dst_row;
       const uint16_t *src = (const uint16_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint16_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap16(value);
-#endif
+         uint16_t value = util_cpu_to_le16(*src++);
          *dst++ = z16_unorm_to_z32_unorm(value);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -213,10 +204,7 @@ util_format_z16_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
       for(x = 0; x < width; ++x) {
          uint16_t value;
          value = z32_unorm_to_z16_unorm(*src++);
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap16(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_le16_to_cpu(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -233,10 +221,7 @@ util_format_z32_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
       float *dst = dst_row;
       const uint32_t *src = (const uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_cpu_to_le32(*src++);
          *dst++ = z32_unorm_to_z32_float(value);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -256,10 +241,7 @@ util_format_z32_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
       for(x = 0; x < width; ++x) {
          uint32_t value;
          value = z32_float_to_z32_unorm(*src++);
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_le32_to_cpu(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -353,7 +335,7 @@ util_format_z32_float_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_z24_unorm_s8_uscaled_unpack_z_float(float *dst_row, unsigned dst_stride,
+util_format_z24_unorm_s8_uint_unpack_z_float(float *dst_row, unsigned dst_stride,
                                                 const uint8_t *src_row, unsigned src_stride,
                                                 unsigned width, unsigned height)
 {
@@ -362,10 +344,7 @@ util_format_z24_unorm_s8_uscaled_unpack_z_float(float *dst_row, unsigned dst_str
       float *dst = dst_row;
       const uint32_t *src = (const uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value =  util_cpu_to_le32(*src++);
          *dst++ = z24_unorm_to_z32_float(value & 0xffffff);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -374,7 +353,7 @@ util_format_z24_unorm_s8_uscaled_unpack_z_float(float *dst_row, unsigned dst_str
 }
 
 void
-util_format_z24_unorm_s8_uscaled_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+util_format_z24_unorm_s8_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
                                               const float *src_row, unsigned src_stride,
                                               unsigned width, unsigned height)
 {
@@ -383,16 +362,10 @@ util_format_z24_unorm_s8_uscaled_pack_z_float(uint8_t *dst_row, unsigned dst_str
       const float *src = src_row;
       uint32_t *dst = (uint32_t *)dst_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *dst;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_le32_to_cpu(*dst);
          value &= 0xff000000;
          value |= z32_float_to_z24_unorm(*src++);
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_cpu_to_le32(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -400,7 +373,7 @@ util_format_z24_unorm_s8_uscaled_pack_z_float(uint8_t *dst_row, unsigned dst_str
 }
 
 void
-util_format_z24_unorm_s8_uscaled_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+util_format_z24_unorm_s8_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
                                                   const uint8_t *src_row, unsigned src_stride,
                                                   unsigned width, unsigned height)
 {
@@ -409,10 +382,7 @@ util_format_z24_unorm_s8_uscaled_unpack_z_32unorm(uint32_t *dst_row, unsigned ds
       uint32_t *dst = dst_row;
       const uint32_t *src = (const uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_cpu_to_le32(*src++);
          *dst++ = z24_unorm_to_z32_unorm(value & 0xffffff);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -421,7 +391,7 @@ util_format_z24_unorm_s8_uscaled_unpack_z_32unorm(uint32_t *dst_row, unsigned ds
 }
 
 void
-util_format_z24_unorm_s8_uscaled_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+util_format_z24_unorm_s8_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
                                                 const uint32_t *src_row, unsigned src_stride,
                                                 unsigned width, unsigned height)
 {
@@ -430,16 +400,10 @@ util_format_z24_unorm_s8_uscaled_pack_z_32unorm(uint8_t *dst_row, unsigned dst_s
       const uint32_t *src = src_row;
       uint32_t *dst = (uint32_t *)dst_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value= *dst;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_le32_to_cpu(*dst);
          value &= 0xff000000;
          value |= z32_unorm_to_z24_unorm(*src++);
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_cpu_to_le32(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -447,7 +411,7 @@ util_format_z24_unorm_s8_uscaled_pack_z_32unorm(uint8_t *dst_row, unsigned dst_s
 }
 
 void
-util_format_z24_unorm_s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+util_format_z24_unorm_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
                                                    const uint8_t *src_row, unsigned src_stride,
                                                    unsigned width, unsigned height)
 {
@@ -456,10 +420,7 @@ util_format_z24_unorm_s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned ds
       uint8_t *dst = dst_row;
       const uint32_t *src = (const uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_cpu_to_le32(*src++);
          *dst++ = value >> 24;
       }
       src_row += src_stride/sizeof(*src_row);
@@ -468,7 +429,7 @@ util_format_z24_unorm_s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned ds
 }
 
 void
-util_format_z24_unorm_s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+util_format_z24_unorm_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
                                                  const uint8_t *src_row, unsigned src_stride,
                                                  unsigned width, unsigned height)
 {
@@ -477,16 +438,10 @@ util_format_z24_unorm_s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_
       const uint8_t *src = src_row;
       uint32_t *dst = (uint32_t *)dst_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *dst;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_le32_to_cpu(*dst);
          value &= 0x00ffffff;
          value |= *src++ << 24;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_cpu_to_le32(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -494,7 +449,7 @@ util_format_z24_unorm_s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_
 }
 
 void
-util_format_s8_uscaled_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
+util_format_s8_uint_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
                                                 const uint8_t *src_row, unsigned src_stride,
                                                 unsigned width, unsigned height)
 {
@@ -503,10 +458,7 @@ util_format_s8_uscaled_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_str
       float *dst = dst_row;
       const uint32_t *src = (const uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_cpu_to_le32(*src++);
          *dst++ = z24_unorm_to_z32_float(value >> 8);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -515,7 +467,7 @@ util_format_s8_uscaled_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_str
 }
 
 void
-util_format_s8_uscaled_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+util_format_s8_uint_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
                                               const float *src_row, unsigned src_stride,
                                               unsigned width, unsigned height)
 {
@@ -524,16 +476,10 @@ util_format_s8_uscaled_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_str
       const float *src = src_row;
       uint32_t *dst = (uint32_t *)dst_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *dst;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_le32_to_cpu(*dst);
          value &= 0x000000ff;
          value |= z32_float_to_z24_unorm(*src++) << 8;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_cpu_to_le32(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -541,7 +487,7 @@ util_format_s8_uscaled_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_str
 }
 
 void
-util_format_s8_uscaled_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+util_format_s8_uint_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
                                                   const uint8_t *src_row, unsigned src_stride,
                                                   unsigned width, unsigned height)
 {
@@ -550,10 +496,7 @@ util_format_s8_uscaled_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned ds
       uint32_t *dst = dst_row;
       const uint32_t *src = (const uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_cpu_to_le32(*src++);
          *dst++ = z24_unorm_to_z32_unorm(value >> 8);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -562,7 +505,7 @@ util_format_s8_uscaled_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned ds
 }
 
 void
-util_format_s8_uscaled_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+util_format_s8_uint_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
                                                 const uint32_t *src_row, unsigned src_stride,
                                                 unsigned width, unsigned height)
 {
@@ -571,16 +514,10 @@ util_format_s8_uscaled_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_s
       const uint32_t *src = src_row;
       uint32_t *dst = (uint32_t *)dst_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *dst;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_le32_to_cpu(*dst);
          value &= 0x000000ff;
          value |= *src++ & 0xffffff00;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_cpu_to_le32(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -588,7 +525,7 @@ util_format_s8_uscaled_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_s
 }
 
 void
-util_format_s8_uscaled_z24_unorm_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+util_format_s8_uint_z24_unorm_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
                                                    const uint8_t *src_row, unsigned src_stride,
                                                    unsigned width, unsigned height)
 {
@@ -597,10 +534,7 @@ util_format_s8_uscaled_z24_unorm_unpack_s_8uscaled(uint8_t *dst_row, unsigned ds
       uint8_t *dst = dst_row;
       const uint32_t *src = (const uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_cpu_to_le32(*src++);
          *dst++ = value & 0xff;
       }
       src_row += src_stride/sizeof(*src_row);
@@ -609,7 +543,7 @@ util_format_s8_uscaled_z24_unorm_unpack_s_8uscaled(uint8_t *dst_row, unsigned ds
 }
 
 void
-util_format_s8_uscaled_z24_unorm_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+util_format_s8_uint_z24_unorm_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
                                                  const uint8_t *src_row, unsigned src_stride,
                                                  unsigned width, unsigned height)
 {
@@ -618,16 +552,10 @@ util_format_s8_uscaled_z24_unorm_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_
       const uint8_t *src = src_row;
       uint32_t *dst = (uint32_t *)dst_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *dst;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_le32_to_cpu(*dst);
          value &= 0xffffff00;
          value |= *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_cpu_to_le32(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -644,10 +572,7 @@ util_format_z24x8_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
       float *dst = dst_row;
       const uint32_t *src = (const uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_cpu_to_le32(*src++);
          *dst++ = z24_unorm_to_z32_float(value & 0xffffff);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -667,10 +592,7 @@ util_format_z24x8_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
       for(x = 0; x < width; ++x) {
          uint32_t value;
          value = z32_float_to_z24_unorm(*src++);
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_le32_to_cpu(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -687,10 +609,7 @@ util_format_z24x8_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
       uint32_t *dst = dst_row;
       const uint32_t *src = (const uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_cpu_to_le32(*src++);
          *dst++ = z24_unorm_to_z32_unorm(value & 0xffffff);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -710,10 +629,7 @@ util_format_z24x8_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
       for(x = 0; x < width; ++x) {
          uint32_t value;
          value = z32_unorm_to_z24_unorm(*src++);
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_cpu_to_le32(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -730,10 +646,7 @@ util_format_x8z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride,
       float *dst = dst_row;
       const uint32_t *src = (uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_cpu_to_le32(*src++);
          *dst++ = z24_unorm_to_z32_float(value >> 8);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -753,10 +666,7 @@ util_format_x8z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
       for(x = 0; x < width; ++x) {
          uint32_t value;
          value = z32_float_to_z24_unorm(*src++) << 8;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_cpu_to_le32(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -773,10 +683,7 @@ util_format_x8z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
       uint32_t *dst = dst_row;
       const uint32_t *src = (const uint32_t *)src_row;
       for(x = 0; x < width; ++x) {
-         uint32_t value = *src++;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
+         uint32_t value = util_cpu_to_le32(*src++);
          *dst++ = z24_unorm_to_z32_unorm(value >> 8);
       }
       src_row += src_stride/sizeof(*src_row);
@@ -796,10 +703,7 @@ util_format_x8z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
       for(x = 0; x < width; ++x) {
          uint32_t value;
          value = z32_unorm_to_z24_unorm(*src++) << 8;
-#ifdef PIPE_ARCH_BIG_ENDIAN
-         value = util_bswap32(value);
-#endif
-         *dst++ = value;
+         *dst++ = util_cpu_to_le32(value);
       }
       dst_row += dst_stride/sizeof(*dst_row);
       src_row += src_stride/sizeof(*src_row);
@@ -807,7 +711,7 @@ util_format_x8z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_z32_float_s8x24_uscaled_unpack_z_float(float *dst_row, unsigned dst_stride,
+util_format_z32_float_s8x24_uint_unpack_z_float(float *dst_row, unsigned dst_stride,
                                                    const uint8_t *src_row, unsigned src_stride,
                                                    unsigned width, unsigned height)
 {
@@ -826,7 +730,7 @@ util_format_z32_float_s8x24_uscaled_unpack_z_float(float *dst_row, unsigned dst_
 }
 
 void
-util_format_z32_float_s8x24_uscaled_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
+util_format_z32_float_s8x24_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride,
                                                  const float *src_row, unsigned src_stride,
                                                  unsigned width, unsigned height)
 {
@@ -845,7 +749,7 @@ util_format_z32_float_s8x24_uscaled_pack_z_float(uint8_t *dst_row, unsigned dst_
 }
 
 void
-util_format_z32_float_s8x24_uscaled_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
+util_format_z32_float_s8x24_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride,
                                                      const uint8_t *src_row, unsigned src_stride,
                                                      unsigned width, unsigned height)
 {
@@ -864,7 +768,7 @@ util_format_z32_float_s8x24_uscaled_unpack_z_32unorm(uint32_t *dst_row, unsigned
 }
 
 void
-util_format_z32_float_s8x24_uscaled_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
+util_format_z32_float_s8x24_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride,
                                                    const uint32_t *src_row, unsigned src_stride,
                                                    unsigned width, unsigned height)
 {
@@ -881,7 +785,7 @@ util_format_z32_float_s8x24_uscaled_pack_z_32unorm(uint8_t *dst_row, unsigned ds
 }
 
 void
-util_format_z32_float_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
                                                       const uint8_t *src_row, unsigned src_stride,
                                                       unsigned width, unsigned height)
 {
@@ -900,7 +804,7 @@ util_format_z32_float_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned
 }
 
 void
-util_format_z32_float_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
                                                     const uint8_t *src_row, unsigned src_stride,
                                                     unsigned width, unsigned height)
 {
@@ -920,54 +824,54 @@ util_format_z32_float_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned d
 
 
 void
-util_format_x24s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_x24s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
-   util_format_z24_unorm_s8_uscaled_unpack_s_8uscaled(dst_row, dst_stride,
+   util_format_z24_unorm_s8_uint_unpack_s_8uint(dst_row, dst_stride,
                                                      src_row, src_stride,
                                                      width, height);
 }
 
 void
-util_format_x24s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_x24s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
-   util_format_z24_unorm_s8_uscaled_pack_s_8uscaled(dst_row, dst_stride,
+   util_format_z24_unorm_s8_uint_pack_s_8uint(dst_row, dst_stride,
                                                    src_row, src_stride,
                                                    width, height);
 }
 
 void
-util_format_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
-   util_format_s8_uscaled_z24_unorm_unpack_s_8uscaled(dst_row, dst_stride,
+   util_format_s8_uint_z24_unorm_unpack_s_8uint(dst_row, dst_stride,
                                                      src_row, src_stride,
                                                      width, height);
 }
 
 void
-util_format_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
-   util_format_s8_uscaled_z24_unorm_pack_s_8uscaled(dst_row, dst_stride,
+   util_format_s8_uint_z24_unorm_pack_s_8uint(dst_row, dst_stride,
                                                      src_row, src_stride,
                                                      width, height);
 }
 
 void
-util_format_x32_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+util_format_x32_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
                                                const uint8_t *src_row, unsigned src_stride,
                                                unsigned width, unsigned height)
 {
-   util_format_z32_float_s8x24_uscaled_unpack_s_8uscaled(dst_row, dst_stride,
+   util_format_z32_float_s8x24_uint_unpack_s_8uint(dst_row, dst_stride,
                                                         src_row, src_stride,
                                                         width, height);
 
 }
 
 void
-util_format_x32_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride,
+util_format_x32_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride,
                                              const uint8_t *src_row, unsigned src_stride,
                                              unsigned width, unsigned height)
 {
-   util_format_z32_float_s8x24_uscaled_pack_s_8uscaled(dst_row, dst_stride,
+   util_format_z32_float_s8x24_uint_pack_s_8uint(dst_row, dst_stride,
                                                        src_row, src_stride,
                                                       width, height);
 }