aux/util: use stdint.h types
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24002>
This commit is contained in:
committed by
Marge Bot
parent
3f79b51dcd
commit
284151262f
@@ -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),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -50,7 +50,7 @@ union m128i {
|
||||
__m128i m;
|
||||
uint8_t ub[16];
|
||||
uint16_t us[8];
|
||||
uint ui[4];
|
||||
uint32_t ui[4];
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user