Module: Mesa Branch: main Commit: 284151262fde82ca88a349de6ce7cae318b42bc6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=284151262fde82ca88a349de6ce7cae318b42bc6
Author: Erik Faye-Lund <[email protected]> Date: Mon Jun 26 10:31:37 2023 +0200 aux/util: use stdint.h types Reviewed-by: Yonggang Luo <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002> --- src/gallium/auxiliary/util/u_pack_color.h | 32 +++++++++++++++---------------- src/gallium/auxiliary/util/u_pwr8.h | 4 ++-- src/gallium/auxiliary/util/u_sse.h | 2 +- src/gallium/auxiliary/util/u_tile.c | 26 ++++++++++++------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index 7aea01d40c0..bd9b5c32eaa 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -50,14 +50,14 @@ union util_color { uint8_t ub; uint16_t us; - uint ui[4]; + uint32_t ui[4]; uint16_t h[4]; /* half float */ float f[4]; double d[4]; }; /** - * Pack ubyte R,G,B,A into dest pixel. + * Pack uint8 R,G,B,A into dest pixel. */ static inline void util_pack_color_ub(uint8_t r, uint8_t g, uint8_t b, uint8_t a, @@ -158,7 +158,7 @@ util_pack_color_ub(uint8_t r, uint8_t g, uint8_t b, uint8_t a, /** - * Unpack RGBA from a packed pixel, returning values as ubytes in [0,255]. + * Unpack RGBA from a packed pixel, returning values as uint8_ts in [0,255]. */ static inline void util_unpack_color_ub(enum pipe_format format, union util_color *uc, @@ -167,7 +167,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc, switch (format) { case PIPE_FORMAT_ABGR8888_UNORM: { - uint p = uc->ui[0]; + uint32_t p = uc->ui[0]; *r = (uint8_t) ((p >> 24) & 0xff); *g = (uint8_t) ((p >> 16) & 0xff); *b = (uint8_t) ((p >> 8) & 0xff); @@ -176,7 +176,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc, return; case PIPE_FORMAT_XBGR8888_UNORM: { - uint p = uc->ui[0]; + uint32_t p = uc->ui[0]; *r = (uint8_t) ((p >> 24) & 0xff); *g = (uint8_t) ((p >> 16) & 0xff); *b = (uint8_t) ((p >> 8) & 0xff); @@ -185,7 +185,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc, return; case PIPE_FORMAT_BGRA8888_UNORM: { - uint p = uc->ui[0]; + uint32_t p = uc->ui[0]; *r = (uint8_t) ((p >> 16) & 0xff); *g = (uint8_t) ((p >> 8) & 0xff); *b = (uint8_t) ((p >> 0) & 0xff); @@ -194,7 +194,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc, return; case PIPE_FORMAT_BGRX8888_UNORM: { - uint p = uc->ui[0]; + uint32_t p = uc->ui[0]; *r = (uint8_t) ((p >> 16) & 0xff); *g = (uint8_t) ((p >> 8) & 0xff); *b = (uint8_t) ((p >> 0) & 0xff); @@ -203,7 +203,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc, return; case PIPE_FORMAT_ARGB8888_UNORM: { - uint p = uc->ui[0]; + uint32_t p = uc->ui[0]; *r = (uint8_t) ((p >> 8) & 0xff); *g = (uint8_t) ((p >> 16) & 0xff); *b = (uint8_t) ((p >> 24) & 0xff); @@ -212,7 +212,7 @@ util_unpack_color_ub(enum pipe_format format, union util_color *uc, return; case PIPE_FORMAT_XRGB8888_UNORM: { - uint p = uc->ui[0]; + uint32_t p = uc->ui[0]; *r = (uint8_t) ((p >> 8) & 0xff); *g = (uint8_t) ((p >> 16) & 0xff); *b = (uint8_t) ((p >> 24) & 0xff); @@ -633,22 +633,22 @@ util_pack64_z_stencil(enum pipe_format format, double z, uint8_t s) /** - * Pack 4 ubytes into a 4-byte word + * Pack 4 uint8_ts into a 4-byte word */ -static inline unsigned +static inline uint32_t pack_ub4(uint8_t b0, uint8_t b1, uint8_t b2, uint8_t b3) { - return ((((unsigned int)b0) << 0) | - (((unsigned int)b1) << 8) | - (((unsigned int)b2) << 16) | - (((unsigned int)b3) << 24)); + return ((((uint32_t)b0) << 0) | + (((uint32_t)b1) << 8) | + (((uint32_t)b2) << 16) | + (((uint32_t)b3) << 24)); } /** * Pack/convert 4 floats into one 4-byte word. */ -static inline unsigned +static inline uint32_t pack_ui32_float4(float a, float b, float c, float d) { return pack_ub4( float_to_ubyte(a), diff --git a/src/gallium/auxiliary/util/u_pwr8.h b/src/gallium/auxiliary/util/u_pwr8.h index fbcf5776740..da4ceaac40e 100644 --- a/src/gallium/auxiliary/util/u_pwr8.h +++ b/src/gallium/auxiliary/util/u_pwr8.h @@ -44,8 +44,8 @@ typedef VECTOR_ALIGN_16 union m128i { vector unsigned int m128ui; uint8_t ub[16]; uint16_t us[8]; - int i[4]; - uint ui[4]; + int32_t i[4]; + uint32_t ui[4]; } __m128i_union; static inline __m128i diff --git a/src/gallium/auxiliary/util/u_sse.h b/src/gallium/auxiliary/util/u_sse.h index 5d1eecc3801..03f9de93ba6 100644 --- a/src/gallium/auxiliary/util/u_sse.h +++ b/src/gallium/auxiliary/util/u_sse.h @@ -50,7 +50,7 @@ union m128i { __m128i m; uint8_t ub[16]; uint16_t us[8]; - uint ui[4]; + uint32_t ui[4]; }; /* diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 64fa427fc5e..75195413c93 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -127,7 +127,7 @@ z16_get_tile_rgba(const uint16_t *src, * Return each Z value as four floats in [0,1]. */ static void -z32_get_tile_rgba(const unsigned *src, +z32_get_tile_rgba(const uint32_t *src, unsigned w, unsigned h, float *p, unsigned dst_stride) @@ -154,7 +154,7 @@ z32_get_tile_rgba(const unsigned *src, * Return Z component as four float in [0,1]. Stencil part ignored. */ static void -s8z24_get_tile_rgba(const unsigned *src, +s8z24_get_tile_rgba(const uint32_t *src, unsigned w, unsigned h, float *p, unsigned dst_stride) @@ -181,7 +181,7 @@ s8z24_get_tile_rgba(const unsigned *src, * Return Z component as four float in [0,1]. Stencil part ignored. */ static void -z24s8_get_tile_rgba(const unsigned *src, +z24s8_get_tile_rgba(const uint32_t *src, unsigned w, unsigned h, float *p, unsigned dst_stride) @@ -207,7 +207,7 @@ z24s8_get_tile_rgba(const unsigned *src, * Return S component as four uint32_t in [0..255]. Z part ignored. */ static void -s8x24_get_tile_rgba(const unsigned *src, +s8x24_get_tile_rgba(const uint32_t *src, unsigned w, unsigned h, float *p, unsigned dst_stride) @@ -234,7 +234,7 @@ s8x24_get_tile_rgba(const unsigned *src, * Return S component as four uint32_t in [0..255]. Z part ignored. */ static void -x24s8_get_tile_rgba(const unsigned *src, +x24s8_get_tile_rgba(const uint32_t *src, unsigned w, unsigned h, float *p, unsigned dst_stride) @@ -334,7 +334,7 @@ z32f_x24s8_get_tile_rgba(const float *src, * Return S component as four uint32_t in [0..255]. Z part ignored. */ static void -x32_s8_get_tile_rgba(const unsigned *src, +x32_s8_get_tile_rgba(const uint32_t *src, unsigned w, unsigned h, float *p, unsigned dst_stride) @@ -407,24 +407,24 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, z16_get_tile_rgba((uint16_t *) packed, w, h, dst, dst_stride); break; case PIPE_FORMAT_Z32_UNORM: - z32_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + z32_get_tile_rgba((uint32_t *) packed, w, h, dst, dst_stride); break; case PIPE_FORMAT_Z24_UNORM_S8_UINT: case PIPE_FORMAT_Z24X8_UNORM: - s8z24_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + s8z24_get_tile_rgba((uint32_t *) packed, w, h, dst, dst_stride); break; case PIPE_FORMAT_S8_UINT: - s8_get_tile_rgba((unsigned char *) packed, w, h, dst, dst_stride); + s8_get_tile_rgba((uint8_t *) packed, w, h, dst, dst_stride); break; case PIPE_FORMAT_X24S8_UINT: - s8x24_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + s8x24_get_tile_rgba((uint32_t *) packed, w, h, dst, dst_stride); break; case PIPE_FORMAT_S8_UINT_Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: - z24s8_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + z24s8_get_tile_rgba((uint32_t *) packed, w, h, dst, dst_stride); break; case PIPE_FORMAT_S8X24_UINT: - x24s8_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + x24s8_get_tile_rgba((uint32_t *) packed, w, h, dst, dst_stride); break; case PIPE_FORMAT_Z32_FLOAT: z32f_get_tile_rgba((float *) packed, w, h, dst, dst_stride); @@ -433,7 +433,7 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, z32f_x24s8_get_tile_rgba((float *) packed, w, h, dst, dst_stride); break; case PIPE_FORMAT_X32_S8X24_UINT: - x32_s8_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride); + x32_s8_get_tile_rgba((uint32_t *) packed, w, h, dst, dst_stride); break; default: util_format_read_4(format,
