diff options
author | Eric Anholt <[email protected]> | 2019-07-01 16:27:24 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-07-16 12:51:13 -0700 |
commit | 5956b46e1680059c2ee5e0d11cd45b44e46ed607 (patch) | |
tree | af025c6483604feb48df8bbee62e9b2fae6d92cf /src/mesa | |
parent | 3e186af5e2a386173569de64b16c4fd859762ab4 (diff) |
mesa: Convert format_pack/unpack off of GL types.
Reviewed-by: Rob Clark <[email protected]>
Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/format_pack.h | 56 | ||||
-rw-r--r-- | src/mesa/main/format_pack.py | 333 | ||||
-rw-r--r-- | src/mesa/main/format_unpack.h | 42 | ||||
-rw-r--r-- | src/mesa/main/format_unpack.py | 274 |
4 files changed, 352 insertions, 353 deletions
diff --git a/src/mesa/main/format_pack.h b/src/mesa/main/format_pack.h index 95dd0fc0142..8859c17a0d3 100644 --- a/src/mesa/main/format_pack.h +++ b/src/mesa/main/format_pack.h @@ -30,20 +30,20 @@ #include "formats.h" -/** Pack a GLubyte rgba[4] color to dest address */ -typedef void (*mesa_pack_ubyte_rgba_func)(const GLubyte src[4], void *dst); +/** Pack a uint8_t rgba[4] color to dest address */ +typedef void (*mesa_pack_ubyte_rgba_func)(const uint8_t src[4], void *dst); -/** Pack a GLfloat rgba[4] color to dest address */ -typedef void (*mesa_pack_float_rgba_func)(const GLfloat src[4], void *dst); +/** Pack a float rgba[4] color to dest address */ +typedef void (*mesa_pack_float_rgba_func)(const float src[4], void *dst); -/** Pack a GLfloat Z value to dest address */ -typedef void (*mesa_pack_float_z_func)(const GLfloat *src, void *dst); +/** Pack a float Z value to dest address */ +typedef void (*mesa_pack_float_z_func)(const float *src, void *dst); -/** Pack a GLuint Z value to dest address */ -typedef void (*mesa_pack_uint_z_func)(const GLuint *src, void *dst); +/** Pack a uint32_t Z value to dest address */ +typedef void (*mesa_pack_uint_z_func)(const uint32_t *src, void *dst); -/** Pack a GLubyte stencil value to dest address */ -typedef void (*mesa_pack_ubyte_stencil_func)(const GLubyte *src, void *dst); +/** Pack a uint8_t stencil value to dest address */ +typedef void (*mesa_pack_ubyte_stencil_func)(const uint8_t *src, void *dst); @@ -69,40 +69,40 @@ _mesa_get_pack_ubyte_stencil_func(mesa_format format); extern void -_mesa_pack_float_rgba_row(mesa_format format, GLuint n, - const GLfloat src[][4], void *dst); +_mesa_pack_float_rgba_row(mesa_format format, uint32_t n, + const float src[][4], void *dst); extern void -_mesa_pack_ubyte_rgba_row(mesa_format format, GLuint n, - const GLubyte src[][4], void *dst); +_mesa_pack_ubyte_rgba_row(mesa_format format, uint32_t n, + const uint8_t src[][4], void *dst); extern void -_mesa_pack_uint_rgba_row(mesa_format format, GLuint n, - const GLuint src[][4], void *dst); +_mesa_pack_uint_rgba_row(mesa_format format, uint32_t n, + const uint32_t src[][4], void *dst); extern void -_mesa_pack_ubyte_rgba_rect(mesa_format format, GLuint width, GLuint height, - const GLubyte *src, GLint srcRowStride, - void *dst, GLint dstRowStride); +_mesa_pack_ubyte_rgba_rect(mesa_format format, uint32_t width, uint32_t height, + const uint8_t *src, int32_t srcRowStride, + void *dst, int32_t dstRowStride); extern void -_mesa_pack_float_z_row(mesa_format format, GLuint n, - const GLfloat *src, void *dst); +_mesa_pack_float_z_row(mesa_format format, uint32_t n, + const float *src, void *dst); extern void -_mesa_pack_uint_z_row(mesa_format format, GLuint n, - const GLuint *src, void *dst); +_mesa_pack_uint_z_row(mesa_format format, uint32_t n, + const uint32_t *src, void *dst); extern void -_mesa_pack_ubyte_stencil_row(mesa_format format, GLuint n, - const GLubyte *src, void *dst); +_mesa_pack_ubyte_stencil_row(mesa_format format, uint32_t n, + const uint8_t *src, void *dst); extern void -_mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, - const GLuint *src, void *dst); +_mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n, + const uint32_t *src, void *dst); extern void -_mesa_pack_colormask(mesa_format format, const GLubyte colorMask[4], void *dst); +_mesa_pack_colormask(mesa_format format, const uint8_t colorMask[4], void *dst); #endif diff --git a/src/mesa/main/format_pack.py b/src/mesa/main/format_pack.py index 893a0647f27..f5a165a94e8 100644 --- a/src/mesa/main/format_pack.py +++ b/src/mesa/main/format_pack.py @@ -43,7 +43,6 @@ string = """/* #include <stdint.h> -#include "config.h" #include "format_pack.h" #include "format_utils.h" #include "macros.h" @@ -79,7 +78,7 @@ for f in formats: %endif static inline void -pack_ubyte_${f.short_name()}(const GLubyte src[4], void *dst) +pack_ubyte_${f.short_name()}(const uint8_t src[4], void *dst) { %for (i, c) in enumerate(f.channels): <% i = f.swizzle.inverse()[i] %> @@ -140,24 +139,24 @@ pack_ubyte_${f.short_name()}(const GLubyte src[4], void *dst) %endfor static inline void -pack_ubyte_r9g9b9e5_float(const GLubyte src[4], void *dst) +pack_ubyte_r9g9b9e5_float(const uint8_t src[4], void *dst) { - GLuint *d = (GLuint *) dst; - GLfloat rgb[3]; - rgb[0] = _mesa_unorm_to_float(src[RCOMP], 8); - rgb[1] = _mesa_unorm_to_float(src[GCOMP], 8); - rgb[2] = _mesa_unorm_to_float(src[BCOMP], 8); + uint32_t *d = (uint32_t *) dst; + float rgb[3]; + rgb[0] = _mesa_unorm_to_float(src[0], 8); + rgb[1] = _mesa_unorm_to_float(src[1], 8); + rgb[2] = _mesa_unorm_to_float(src[2], 8); *d = float3_to_rgb9e5(rgb); } static inline void -pack_ubyte_r11g11b10_float(const GLubyte src[4], void *dst) +pack_ubyte_r11g11b10_float(const uint8_t src[4], void *dst) { - GLuint *d = (GLuint *) dst; - GLfloat rgb[3]; - rgb[0] = _mesa_unorm_to_float(src[RCOMP], 8); - rgb[1] = _mesa_unorm_to_float(src[GCOMP], 8); - rgb[2] = _mesa_unorm_to_float(src[BCOMP], 8); + uint32_t *d = (uint32_t *) dst; + float rgb[3]; + rgb[0] = _mesa_unorm_to_float(src[0], 8); + rgb[1] = _mesa_unorm_to_float(src[1], 8); + rgb[2] = _mesa_unorm_to_float(src[2], 8); *d = float3_to_r11g11b10f(rgb); } @@ -173,7 +172,7 @@ pack_ubyte_r11g11b10_float(const GLubyte src[4], void *dst) %endif static inline void -pack_uint_${f.short_name()}(const GLuint src[4], void *dst) +pack_uint_${f.short_name()}(const uint32_t src[4], void *dst) { %for (i, c) in enumerate(f.channels): <% i = f.swizzle.inverse()[i] %> @@ -226,7 +225,7 @@ pack_uint_${f.short_name()}(const GLuint src[4], void *dst) %endif static inline void -pack_float_${f.short_name()}(const GLfloat src[4], void *dst) +pack_float_${f.short_name()}(const float src[4], void *dst) { %for (i, c) in enumerate(f.channels): <% i = f.swizzle.inverse()[i] %> @@ -281,21 +280,21 @@ pack_float_${f.short_name()}(const GLfloat src[4], void *dst) %endfor static inline void -pack_float_r9g9b9e5_float(const GLfloat src[4], void *dst) +pack_float_r9g9b9e5_float(const float src[4], void *dst) { - GLuint *d = (GLuint *) dst; + uint32_t *d = (uint32_t *) dst; *d = float3_to_rgb9e5(src); } static inline void -pack_float_r11g11b10_float(const GLfloat src[4], void *dst) +pack_float_r11g11b10_float(const float src[4], void *dst) { - GLuint *d = (GLuint *) dst; + uint32_t *d = (uint32_t *) dst; *d = float3_to_r11g11b10f(src); } /** - * Return a function that can pack a GLubyte rgba[4] color. + * Return a function that can pack a uint8_t rgba[4] color. */ mesa_pack_ubyte_rgba_func _mesa_get_pack_ubyte_rgba_function(mesa_format format) @@ -315,7 +314,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) } /** - * Return a function that can pack a GLfloat rgba[4] color. + * Return a function that can pack a float rgba[4] color. */ mesa_pack_float_rgba_func _mesa_get_pack_float_rgba_function(mesa_format format) @@ -337,14 +336,14 @@ _mesa_get_pack_float_rgba_function(mesa_format format) } /** - * Pack a row of GLubyte rgba[4] values to the destination. + * Pack a row of uint8_t rgba[4] values to the destination. */ void -_mesa_pack_ubyte_rgba_row(mesa_format format, GLuint n, - const GLubyte src[][4], void *dst) +_mesa_pack_ubyte_rgba_row(mesa_format format, uint32_t n, + const uint8_t src[][4], void *dst) { - GLuint i; - GLubyte *d = dst; + uint32_t i; + uint8_t *d = dst; switch (format) { %for f in rgb_formats: @@ -365,14 +364,14 @@ _mesa_pack_ubyte_rgba_row(mesa_format format, GLuint n, } /** - * Pack a row of GLuint rgba[4] values to the destination. + * Pack a row of uint32_t rgba[4] values to the destination. */ void -_mesa_pack_uint_rgba_row(mesa_format format, GLuint n, - const GLuint src[][4], void *dst) +_mesa_pack_uint_rgba_row(mesa_format format, uint32_t n, + const uint32_t src[][4], void *dst) { - GLuint i; - GLubyte *d = dst; + uint32_t i; + uint8_t *d = dst; switch (format) { %for f in rgb_formats: @@ -397,14 +396,14 @@ _mesa_pack_uint_rgba_row(mesa_format format, GLuint n, } /** - * Pack a row of GLfloat rgba[4] values to the destination. + * Pack a row of float rgba[4] values to the destination. */ void -_mesa_pack_float_rgba_row(mesa_format format, GLuint n, - const GLfloat src[][4], void *dst) +_mesa_pack_float_rgba_row(mesa_format format, uint32_t n, + const float src[][4], void *dst) { - GLuint i; - GLubyte *d = dst; + uint32_t i; + uint8_t *d = dst; switch (format) { %for f in rgb_formats: @@ -432,24 +431,24 @@ _mesa_pack_float_rgba_row(mesa_format format, GLuint n, * \param dstRowStride destination image row stride in bytes */ void -_mesa_pack_ubyte_rgba_rect(mesa_format format, GLuint width, GLuint height, - const GLubyte *src, GLint srcRowStride, - void *dst, GLint dstRowStride) +_mesa_pack_ubyte_rgba_rect(mesa_format format, uint32_t width, uint32_t height, + const uint8_t *src, int32_t srcRowStride, + void *dst, int32_t dstRowStride) { - GLubyte *dstUB = dst; - GLuint i; + uint8_t *dstUB = dst; + uint32_t i; - if (srcRowStride == width * 4 * sizeof(GLubyte) && + if (srcRowStride == width * 4 * sizeof(uint8_t) && dstRowStride == _mesa_format_row_stride(format, width)) { /* do whole image at once */ _mesa_pack_ubyte_rgba_row(format, width * height, - (const GLubyte (*)[4]) src, dst); + (const uint8_t (*)[4]) src, dst); } else { /* row by row */ for (i = 0; i < height; i++) { _mesa_pack_ubyte_rgba_row(format, width, - (const GLubyte (*)[4]) src, dstUB); + (const uint8_t (*)[4]) src, dstUB); src += srcRowStride; dstUB += dstRowStride; } @@ -470,43 +469,43 @@ struct z32f_x24s8 **/ static void -pack_float_S8_UINT_Z24_UNORM(const GLfloat *src, void *dst) +pack_float_S8_UINT_Z24_UNORM(const float *src, void *dst) { /* don't disturb the stencil values */ - GLuint *d = ((GLuint *) dst); - const GLdouble scale = (GLdouble) 0xffffff; - GLuint s = *d & 0xff; - GLuint z = (GLuint) (*src * scale); + uint32_t *d = ((uint32_t *) dst); + const double scale = (double) 0xffffff; + uint32_t s = *d & 0xff; + uint32_t z = (uint32_t) (*src * scale); assert(z <= 0xffffff); *d = (z << 8) | s; } static void -pack_float_Z24_UNORM_S8_UINT(const GLfloat *src, void *dst) +pack_float_Z24_UNORM_S8_UINT(const float *src, void *dst) { /* don't disturb the stencil values */ - GLuint *d = ((GLuint *) dst); - const GLdouble scale = (GLdouble) 0xffffff; - GLuint s = *d & 0xff000000; - GLuint z = (GLuint) (*src * scale); + uint32_t *d = ((uint32_t *) dst); + const double scale = (double) 0xffffff; + uint32_t s = *d & 0xff000000; + uint32_t z = (uint32_t) (*src * scale); assert(z <= 0xffffff); *d = s | z; } static void -pack_float_Z_UNORM16(const GLfloat *src, void *dst) +pack_float_Z_UNORM16(const float *src, void *dst) { - GLushort *d = ((GLushort *) dst); - const GLfloat scale = (GLfloat) 0xffff; - *d = (GLushort) (*src * scale); + uint16_t *d = ((uint16_t *) dst); + const float scale = (float) 0xffff; + *d = (uint16_t) (*src * scale); } static void -pack_float_Z_UNORM32(const GLfloat *src, void *dst) +pack_float_Z_UNORM32(const float *src, void *dst) { - GLuint *d = ((GLuint *) dst); - const GLdouble scale = (GLdouble) 0xffffffff; - *d = (GLuint) (*src * scale); + uint32_t *d = ((uint32_t *) dst); + const double scale = (double) 0xffffffff; + *d = (uint32_t) (*src * scale); } /** @@ -514,9 +513,9 @@ pack_float_Z_UNORM32(const GLfloat *src, void *dst) **/ static void -pack_float_Z_FLOAT32(const GLfloat *src, void *dst) +pack_float_Z_FLOAT32(const float *src, void *dst) { - GLfloat *d = (GLfloat *) dst; + float *d = (float *) dst; *d = *src; } @@ -550,36 +549,36 @@ _mesa_get_pack_float_z_func(mesa_format format) **/ static void -pack_uint_S8_UINT_Z24_UNORM(const GLuint *src, void *dst) +pack_uint_S8_UINT_Z24_UNORM(const uint32_t *src, void *dst) { /* don't disturb the stencil values */ - GLuint *d = ((GLuint *) dst); - GLuint s = *d & 0xff; - GLuint z = *src & 0xffffff00; + uint32_t *d = ((uint32_t *) dst); + uint32_t s = *d & 0xff; + uint32_t z = *src & 0xffffff00; *d = z | s; } static void -pack_uint_Z24_UNORM_S8_UINT(const GLuint *src, void *dst) +pack_uint_Z24_UNORM_S8_UINT(const uint32_t *src, void *dst) { /* don't disturb the stencil values */ - GLuint *d = ((GLuint *) dst); - GLuint s = *d & 0xff000000; - GLuint z = *src >> 8; + uint32_t *d = ((uint32_t *) dst); + uint32_t s = *d & 0xff000000; + uint32_t z = *src >> 8; *d = s | z; } static void -pack_uint_Z_UNORM16(const GLuint *src, void *dst) +pack_uint_Z_UNORM16(const uint32_t *src, void *dst) { - GLushort *d = ((GLushort *) dst); + uint16_t *d = ((uint16_t *) dst); *d = *src >> 16; } static void -pack_uint_Z_UNORM32(const GLuint *src, void *dst) +pack_uint_Z_UNORM32(const uint32_t *src, void *dst) { - GLuint *d = ((GLuint *) dst); + uint32_t *d = ((uint32_t *) dst); *d = *src; } @@ -588,11 +587,11 @@ pack_uint_Z_UNORM32(const GLuint *src, void *dst) **/ static void -pack_uint_Z_FLOAT32(const GLuint *src, void *dst) +pack_uint_Z_FLOAT32(const uint32_t *src, void *dst) { - GLfloat *d = ((GLfloat *) dst); - const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; - *d = (GLfloat) (*src * scale); + float *d = ((float *) dst); + const double scale = 1.0 / (double) 0xffffffff; + *d = (float) (*src * scale); assert(*d >= 0.0f); assert(*d <= 1.0f); } @@ -625,36 +624,36 @@ _mesa_get_pack_uint_z_func(mesa_format format) **/ static void -pack_ubyte_stencil_Z24_S8(const GLubyte *src, void *dst) +pack_ubyte_stencil_Z24_S8(const uint8_t *src, void *dst) { /* don't disturb the Z values */ - GLuint *d = ((GLuint *) dst); - GLuint s = *src; - GLuint z = *d & 0xffffff00; + uint32_t *d = ((uint32_t *) dst); + uint32_t s = *src; + uint32_t z = *d & 0xffffff00; *d = z | s; } static void -pack_ubyte_stencil_S8_Z24(const GLubyte *src, void *dst) +pack_ubyte_stencil_S8_Z24(const uint8_t *src, void *dst) { /* don't disturb the Z values */ - GLuint *d = ((GLuint *) dst); - GLuint s = *src << 24; - GLuint z = *d & 0xffffff; + uint32_t *d = ((uint32_t *) dst); + uint32_t s = *src << 24; + uint32_t z = *d & 0xffffff; *d = s | z; } static void -pack_ubyte_stencil_S8(const GLubyte *src, void *dst) +pack_ubyte_stencil_S8(const uint8_t *src, void *dst) { - GLubyte *d = (GLubyte *) dst; + uint8_t *d = (uint8_t *) dst; *d = *src; } static void -pack_ubyte_stencil_Z32_FLOAT_X24S8(const GLubyte *src, void *dst) +pack_ubyte_stencil_Z32_FLOAT_X24S8(const uint8_t *src, void *dst) { - GLfloat *d = ((GLfloat *) dst); + float *d = ((float *) dst); d[1] = *src; } @@ -679,20 +678,20 @@ _mesa_get_pack_ubyte_stencil_func(mesa_format format) void -_mesa_pack_float_z_row(mesa_format format, GLuint n, - const GLfloat *src, void *dst) +_mesa_pack_float_z_row(mesa_format format, uint32_t n, + const float *src, void *dst) { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: case MESA_FORMAT_X8_UINT_Z24_UNORM: { /* don't disturb the stencil values */ - GLuint *d = ((GLuint *) dst); - const GLdouble scale = (GLdouble) 0xffffff; - GLuint i; + uint32_t *d = ((uint32_t *) dst); + const double scale = (double) 0xffffff; + uint32_t i; for (i = 0; i < n; i++) { - GLuint s = d[i] & 0xff; - GLuint z = (GLuint) (src[i] * scale); + uint32_t s = d[i] & 0xff; + uint32_t z = (uint32_t) (src[i] * scale); assert(z <= 0xffffff); d[i] = (z << 8) | s; } @@ -702,12 +701,12 @@ _mesa_pack_float_z_row(mesa_format format, GLuint n, case MESA_FORMAT_Z24_UNORM_X8_UINT: { /* don't disturb the stencil values */ - GLuint *d = ((GLuint *) dst); - const GLdouble scale = (GLdouble) 0xffffff; - GLuint i; + uint32_t *d = ((uint32_t *) dst); + const double scale = (double) 0xffffff; + uint32_t i; for (i = 0; i < n; i++) { - GLuint s = d[i] & 0xff000000; - GLuint z = (GLuint) (src[i] * scale); + uint32_t s = d[i] & 0xff000000; + uint32_t z = (uint32_t) (src[i] * scale); assert(z <= 0xffffff); d[i] = s | z; } @@ -715,31 +714,31 @@ _mesa_pack_float_z_row(mesa_format format, GLuint n, break; case MESA_FORMAT_Z_UNORM16: { - GLushort *d = ((GLushort *) dst); - const GLfloat scale = (GLfloat) 0xffff; - GLuint i; + uint16_t *d = ((uint16_t *) dst); + const float scale = (float) 0xffff; + uint32_t i; for (i = 0; i < n; i++) { - d[i] = (GLushort) (src[i] * scale); + d[i] = (uint16_t) (src[i] * scale); } } break; case MESA_FORMAT_Z_UNORM32: { - GLuint *d = ((GLuint *) dst); - const GLdouble scale = (GLdouble) 0xffffffff; - GLuint i; + uint32_t *d = ((uint32_t *) dst); + const double scale = (double) 0xffffffff; + uint32_t i; for (i = 0; i < n; i++) { - d[i] = (GLuint) (src[i] * scale); + d[i] = (uint32_t) (src[i] * scale); } } break; case MESA_FORMAT_Z_FLOAT32: - memcpy(dst, src, n * sizeof(GLfloat)); + memcpy(dst, src, n * sizeof(float)); break; case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: { struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; - GLuint i; + uint32_t i; for (i = 0; i < n; i++) { d[i].z = src[i]; } @@ -755,19 +754,19 @@ _mesa_pack_float_z_row(mesa_format format, GLuint n, * The incoming Z values are always in the range [0, 0xffffffff]. */ void -_mesa_pack_uint_z_row(mesa_format format, GLuint n, - const GLuint *src, void *dst) +_mesa_pack_uint_z_row(mesa_format format, uint32_t n, + const uint32_t *src, void *dst) { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: case MESA_FORMAT_X8_UINT_Z24_UNORM: { /* don't disturb the stencil values */ - GLuint *d = ((GLuint *) dst); - GLuint i; + uint32_t *d = ((uint32_t *) dst); + uint32_t i; for (i = 0; i < n; i++) { - GLuint s = d[i] & 0xff; - GLuint z = src[i] & 0xffffff00; + uint32_t s = d[i] & 0xff; + uint32_t z = src[i] & 0xffffff00; d[i] = z | s; } } @@ -776,34 +775,34 @@ _mesa_pack_uint_z_row(mesa_format format, GLuint n, case MESA_FORMAT_Z24_UNORM_X8_UINT: { /* don't disturb the stencil values */ - GLuint *d = ((GLuint *) dst); - GLuint i; + uint32_t *d = ((uint32_t *) dst); + uint32_t i; for (i = 0; i < n; i++) { - GLuint s = d[i] & 0xff000000; - GLuint z = src[i] >> 8; + uint32_t s = d[i] & 0xff000000; + uint32_t z = src[i] >> 8; d[i] = s | z; } } break; case MESA_FORMAT_Z_UNORM16: { - GLushort *d = ((GLushort *) dst); - GLuint i; + uint16_t *d = ((uint16_t *) dst); + uint32_t i; for (i = 0; i < n; i++) { d[i] = src[i] >> 16; } } break; case MESA_FORMAT_Z_UNORM32: - memcpy(dst, src, n * sizeof(GLfloat)); + memcpy(dst, src, n * sizeof(float)); break; case MESA_FORMAT_Z_FLOAT32: { - GLuint *d = ((GLuint *) dst); - const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; - GLuint i; + uint32_t *d = ((uint32_t *) dst); + const double scale = 1.0 / (double) 0xffffffff; + uint32_t i; for (i = 0; i < n; i++) { - d[i] = (GLuint) (src[i] * scale); + d[i] = (uint32_t) (src[i] * scale); assert(d[i] >= 0.0f); assert(d[i] <= 1.0f); } @@ -812,10 +811,10 @@ _mesa_pack_uint_z_row(mesa_format format, GLuint n, case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: { struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; - const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; - GLuint i; + const double scale = 1.0 / (double) 0xffffffff; + uint32_t i; for (i = 0; i < n; i++) { - d[i].z = (GLfloat) (src[i] * scale); + d[i].z = (float) (src[i] * scale); assert(d[i].z >= 0.0f); assert(d[i].z <= 1.0f); } @@ -828,18 +827,18 @@ _mesa_pack_uint_z_row(mesa_format format, GLuint n, void -_mesa_pack_ubyte_stencil_row(mesa_format format, GLuint n, - const GLubyte *src, void *dst) +_mesa_pack_ubyte_stencil_row(mesa_format format, uint32_t n, + const uint8_t *src, void *dst) { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: { /* don't disturb the Z values */ - GLuint *d = ((GLuint *) dst); - GLuint i; + uint32_t *d = ((uint32_t *) dst); + uint32_t i; for (i = 0; i < n; i++) { - GLuint s = src[i]; - GLuint z = d[i] & 0xffffff00; + uint32_t s = src[i]; + uint32_t z = d[i] & 0xffffff00; d[i] = z | s; } } @@ -847,22 +846,22 @@ _mesa_pack_ubyte_stencil_row(mesa_format format, GLuint n, case MESA_FORMAT_Z24_UNORM_S8_UINT: { /* don't disturb the Z values */ - GLuint *d = ((GLuint *) dst); - GLuint i; + uint32_t *d = ((uint32_t *) dst); + uint32_t i; for (i = 0; i < n; i++) { - GLuint s = src[i] << 24; - GLuint z = d[i] & 0xffffff; + uint32_t s = src[i] << 24; + uint32_t z = d[i] & 0xffffff; d[i] = s | z; } } break; case MESA_FORMAT_S_UINT8: - memcpy(dst, src, n * sizeof(GLubyte)); + memcpy(dst, src, n * sizeof(uint8_t)); break; case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: { struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; - GLuint i; + uint32_t i; for (i = 0; i < n; i++) { d[i].x24s8 = src[i]; } @@ -878,31 +877,31 @@ _mesa_pack_ubyte_stencil_row(mesa_format format, GLuint n, * Incoming Z/stencil values are always in uint_24_8 format. */ void -_mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, - const GLuint *src, void *dst) +_mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n, + const uint32_t *src, void *dst) { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - memcpy(dst, src, n * sizeof(GLuint)); + memcpy(dst, src, n * sizeof(uint32_t)); break; case MESA_FORMAT_Z24_UNORM_S8_UINT: { - GLuint *d = ((GLuint *) dst); - GLuint i; + uint32_t *d = ((uint32_t *) dst); + uint32_t i; for (i = 0; i < n; i++) { - GLuint s = src[i] << 24; - GLuint z = src[i] >> 8; + uint32_t s = src[i] << 24; + uint32_t z = src[i] >> 8; d[i] = s | z; } } break; case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: { - const GLdouble scale = 1.0 / (GLdouble) 0xffffff; + const double scale = 1.0 / (double) 0xffffff; struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; - GLuint i; + uint32_t i; for (i = 0; i < n; i++) { - GLfloat z = (GLfloat) ((src[i] >> 8) * scale); + float z = (float) ((src[i] >> 8) * scale); d[i].z = z; d[i].x24s8 = src[i]; } @@ -920,9 +919,9 @@ _mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, * the packed value at dst will be 0 or ~0 depending on the colorMask. */ void -_mesa_pack_colormask(mesa_format format, const GLubyte colorMask[4], void *dst) +_mesa_pack_colormask(mesa_format format, const uint8_t colorMask[4], void *dst) { - GLfloat maskColor[4]; + float maskColor[4]; switch (_mesa_get_format_datatype(format)) { case GL_UNSIGNED_NORMALIZED: @@ -932,7 +931,7 @@ _mesa_pack_colormask(mesa_format format, const GLubyte colorMask[4], void *dst) maskColor[2] = colorMask[2] ? 1.0f : 0.0f; maskColor[3] = colorMask[3] ? 1.0f : 0.0f; _mesa_pack_float_rgba_row(format, 1, - (const GLfloat (*)[4]) maskColor, dst); + (const float (*)[4]) maskColor, dst); break; case GL_SIGNED_NORMALIZED: case GL_FLOAT: @@ -945,9 +944,9 @@ _mesa_pack_colormask(mesa_format format, const GLubyte colorMask[4], void *dst) * We issue a warning below for channel sizes other than 8,16,32. */ { - GLuint bits = _mesa_get_format_max_bits(format); /* bits per chan */ - GLuint bytes = _mesa_get_format_bytes(format); - GLuint i; + uint32_t bits = _mesa_get_format_max_bits(format); /* bits per chan */ + uint32_t bytes = _mesa_get_format_bytes(format); + uint32_t i; /* this should put non-zero values into the channels of dst */ maskColor[0] = colorMask[0] ? -1.0f : 0.0f; @@ -955,23 +954,23 @@ _mesa_pack_colormask(mesa_format format, const GLubyte colorMask[4], void *dst) maskColor[2] = colorMask[2] ? -1.0f : 0.0f; maskColor[3] = colorMask[3] ? -1.0f : 0.0f; _mesa_pack_float_rgba_row(format, 1, - (const GLfloat (*)[4]) maskColor, dst); + (const float (*)[4]) maskColor, dst); /* fix-up the dst channels by converting non-zero values to ~0 */ if (bits == 8) { - GLubyte *d = (GLubyte *) dst; + uint8_t *d = (uint8_t *) dst; for (i = 0; i < bytes; i++) { d[i] = d[i] ? 0xff : 0x0; } } else if (bits == 16) { - GLushort *d = (GLushort *) dst; + uint16_t *d = (uint16_t *) dst; for (i = 0; i < bytes / 2; i++) { d[i] = d[i] ? 0xffff : 0x0; } } else if (bits == 32) { - GLuint *d = (GLuint *) dst; + uint32_t *d = (uint32_t *) dst; for (i = 0; i < bytes / 4; i++) { d[i] = d[i] ? 0xffffffffU : 0x0; } diff --git a/src/mesa/main/format_unpack.h b/src/mesa/main/format_unpack.h index 964c6077af2..4d09c767822 100644 --- a/src/mesa/main/format_unpack.h +++ b/src/mesa/main/format_unpack.h @@ -28,47 +28,47 @@ #include "formats.h" extern void -_mesa_unpack_rgba_row(mesa_format format, GLuint n, - const void *src, GLfloat dst[][4]); +_mesa_unpack_rgba_row(mesa_format format, uint32_t n, + const void *src, float dst[][4]); extern void -_mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, - const void *src, GLubyte dst[][4]); +_mesa_unpack_ubyte_rgba_row(mesa_format format, uint32_t n, + const void *src, uint8_t dst[][4]); void -_mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, - const void *src, GLuint dst[][4]); +_mesa_unpack_uint_rgba_row(mesa_format format, uint32_t n, + const void *src, uint32_t dst[][4]); extern void _mesa_unpack_rgba_block(mesa_format format, - const void *src, GLint srcRowStride, - GLfloat dst[][4], GLint dstRowStride, - GLuint x, GLuint y, GLuint width, GLuint height); + const void *src, int32_t srcRowStride, + float dst[][4], int32_t dstRowStride, + uint32_t x, uint32_t y, uint32_t width, uint32_t height); extern void -_mesa_unpack_float_z_row(mesa_format format, GLuint n, - const void *src, GLfloat *dst); +_mesa_unpack_float_z_row(mesa_format format, uint32_t n, + const void *src, float *dst); void -_mesa_unpack_uint_z_row(mesa_format format, GLuint n, - const void *src, GLuint *dst); +_mesa_unpack_uint_z_row(mesa_format format, uint32_t n, + const void *src, uint32_t *dst); void -_mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n, - const void *src, GLubyte *dst); +_mesa_unpack_ubyte_stencil_row(mesa_format format, uint32_t n, + const void *src, uint8_t *dst); void -_mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, - const void *src, GLuint *dst); +_mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n, + const void *src, uint32_t *dst); void _mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, - GLuint n, + uint32_t n, const void *src, - GLuint *dst); + uint32_t *dst); void -_mesa_unpack_depth_stencil_row(mesa_format format, GLuint n, +_mesa_unpack_depth_stencil_row(mesa_format format, uint32_t n, const void *src, GLenum type, - GLuint *dst); + uint32_t *dst); #endif /* FORMAT_UNPACK_H */ diff --git a/src/mesa/main/format_unpack.py b/src/mesa/main/format_unpack.py index d99cedb7907..54df8efb7ce 100644 --- a/src/mesa/main/format_unpack.py +++ b/src/mesa/main/format_unpack.py @@ -79,7 +79,7 @@ for f in formats: %endif static inline void -unpack_float_${f.short_name()}(const void *void_src, GLfloat dst[4]) +unpack_float_${f.short_name()}(const void *void_src, float dst[4]) { ${f.datatype()} *src = (${f.datatype()} *)void_src; %if f.layout == parser.PACKED: @@ -134,34 +134,34 @@ unpack_float_${f.short_name()}(const void *void_src, GLfloat dst[4]) %endfor static void -unpack_float_r9g9b9e5_float(const void *src, GLfloat dst[4]) +unpack_float_r9g9b9e5_float(const void *src, float dst[4]) { - rgb9e5_to_float3(*(const GLuint *)src, dst); + rgb9e5_to_float3(*(const uint32_t *)src, dst); dst[3] = 1.0f; } static void -unpack_float_r11g11b10_float(const void *src, GLfloat dst[4]) +unpack_float_r11g11b10_float(const void *src, float dst[4]) { - r11g11b10f_to_float3(*(const GLuint *)src, dst); + r11g11b10f_to_float3(*(const uint32_t *)src, dst); dst[3] = 1.0f; } static void -unpack_float_ycbcr(const void *src, GLfloat dst[][4], GLuint n) +unpack_float_ycbcr(const void *src, float dst[][4], uint32_t n) { - GLuint i; + uint32_t i; for (i = 0; i < n; i++) { - const GLushort *src0 = ((const GLushort *) src) + i * 2; /* even */ - const GLushort *src1 = src0 + 1; /* odd */ - const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */ - const GLubyte cb = *src0 & 0xff; /* chroma U */ - const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */ - const GLubyte cr = *src1 & 0xff; /* chroma V */ - const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ - GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128); - GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); - GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128); + const uint16_t *src0 = ((const uint16_t *) src) + i * 2; /* even */ + const uint16_t *src1 = src0 + 1; /* odd */ + const uint8_t y0 = (*src0 >> 8) & 0xff; /* luminance */ + const uint8_t cb = *src0 & 0xff; /* chroma U */ + const uint8_t y1 = (*src1 >> 8) & 0xff; /* luminance */ + const uint8_t cr = *src1 & 0xff; /* chroma V */ + const uint8_t y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ + float r = 1.164F * (y - 16) + 1.596F * (cr - 128); + float g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); + float b = 1.164F * (y - 16) + 2.018F * (cb - 128); r *= (1.0F / 255.0F); g *= (1.0F / 255.0F); b *= (1.0F / 255.0F); @@ -173,20 +173,20 @@ unpack_float_ycbcr(const void *src, GLfloat dst[][4], GLuint n) } static void -unpack_float_ycbcr_rev(const void *src, GLfloat dst[][4], GLuint n) +unpack_float_ycbcr_rev(const void *src, float dst[][4], uint32_t n) { - GLuint i; + uint32_t i; for (i = 0; i < n; i++) { - const GLushort *src0 = ((const GLushort *) src) + i * 2; /* even */ - const GLushort *src1 = src0 + 1; /* odd */ - const GLubyte y0 = *src0 & 0xff; /* luminance */ - const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */ - const GLubyte y1 = *src1 & 0xff; /* luminance */ - const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */ - const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ - GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128); - GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); - GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128); + const uint16_t *src0 = ((const uint16_t *) src) + i * 2; /* even */ + const uint16_t *src1 = src0 + 1; /* odd */ + const uint8_t y0 = *src0 & 0xff; /* luminance */ + const uint8_t cr = (*src0 >> 8) & 0xff; /* chroma V */ + const uint8_t y1 = *src1 & 0xff; /* luminance */ + const uint8_t cb = (*src1 >> 8) & 0xff; /* chroma U */ + const uint8_t y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ + float r = 1.164F * (y - 16) + 1.596F * (cr - 128); + float g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); + float b = 1.164F * (y - 16) + 2.018F * (cb - 128); r *= (1.0F / 255.0F); g *= (1.0F / 255.0F); b *= (1.0F / 255.0F); @@ -205,7 +205,7 @@ unpack_float_ycbcr_rev(const void *src, GLfloat dst[][4], GLuint n) %endif static inline void -unpack_ubyte_${f.short_name()}(const void *void_src, GLubyte dst[4]) +unpack_ubyte_${f.short_name()}(const void *void_src, uint8_t dst[4]) { ${f.datatype()} *src = (${f.datatype()} *)void_src; %if f.layout == parser.PACKED: @@ -269,7 +269,7 @@ unpack_ubyte_${f.short_name()}(const void *void_src, GLubyte dst[4]) %endif static inline void -unpack_int_${f.short_name()}(const void *void_src, GLuint dst[4]) +unpack_int_${f.short_name()}(const void *void_src, uint32_t dst[4]) { ${f.datatype()} *src = (${f.datatype()} *)void_src; %if f.layout == parser.PACKED: @@ -305,11 +305,11 @@ unpack_int_${f.short_name()}(const void *void_src, GLuint dst[4]) void -_mesa_unpack_rgba_row(mesa_format format, GLuint n, - const void *src, GLfloat dst[][4]) +_mesa_unpack_rgba_row(mesa_format format, uint32_t n, + const void *src, float dst[][4]) { - GLubyte *s = (GLubyte *)src; - GLuint i; + uint8_t *s = (uint8_t *)src; + uint32_t i; switch (format) { %for f in rgb_formats: @@ -337,11 +337,11 @@ _mesa_unpack_rgba_row(mesa_format format, GLuint n, } void -_mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, - const void *src, GLubyte dst[][4]) +_mesa_unpack_ubyte_rgba_row(mesa_format format, uint32_t n, + const void *src, uint8_t dst[][4]) { - GLubyte *s = (GLubyte *)src; - GLuint i; + uint8_t *s = (uint8_t *)src; + uint32_t i; switch (format) { %for f in rgb_formats: @@ -359,10 +359,10 @@ _mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, default: /* get float values, convert to ubyte */ { - GLfloat *tmp = malloc(n * 4 * sizeof(GLfloat)); + float *tmp = malloc(n * 4 * sizeof(float)); if (tmp) { - GLuint i; - _mesa_unpack_rgba_row(format, n, src, (GLfloat (*)[4]) tmp); + uint32_t i; + _mesa_unpack_rgba_row(format, n, src, (float (*)[4]) tmp); for (i = 0; i < n; i++) { dst[i][0] = _mesa_float_to_unorm(tmp[i*4+0], 8); dst[i][1] = _mesa_float_to_unorm(tmp[i*4+1], 8); @@ -377,11 +377,11 @@ _mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, } void -_mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, - const void *src, GLuint dst[][4]) +_mesa_unpack_uint_rgba_row(mesa_format format, uint32_t n, + const void *src, uint32_t dst[][4]) { - GLubyte *s = (GLubyte *)src; - GLuint i; + uint8_t *s = (uint8_t *)src; + uint32_t i; switch (format) { %for f in rgb_formats: @@ -417,23 +417,23 @@ _mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, */ void _mesa_unpack_rgba_block(mesa_format format, - const void *src, GLint srcRowStride, - GLfloat dst[][4], GLint dstRowStride, - GLuint x, GLuint y, GLuint width, GLuint height) + const void *src, int32_t srcRowStride, + float dst[][4], int32_t dstRowStride, + uint32_t x, uint32_t y, uint32_t width, uint32_t height) { - const GLuint srcPixStride = _mesa_get_format_bytes(format); - const GLuint dstPixStride = 4 * sizeof(GLfloat); - const GLubyte *srcRow; - GLubyte *dstRow; - GLuint i; + const uint32_t srcPixStride = _mesa_get_format_bytes(format); + const uint32_t dstPixStride = 4 * sizeof(float); + const uint8_t *srcRow; + uint8_t *dstRow; + uint32_t i; /* XXX needs to be fixed for compressed formats */ - srcRow = ((const GLubyte *) src) + srcRowStride * y + srcPixStride * x; - dstRow = ((GLubyte *) dst) + dstRowStride * y + dstPixStride * x; + srcRow = ((const uint8_t *) src) + srcRowStride * y + srcPixStride * x; + dstRow = ((uint8_t *) dst) + dstRowStride * y + dstPixStride * x; for (i = 0; i < height; i++) { - _mesa_unpack_rgba_row(format, width, srcRow, (GLfloat (*)[4]) dstRow); + _mesa_unpack_rgba_row(format, width, srcRow, (float (*)[4]) dstRow); dstRow += dstRowStride; srcRow += srcRowStride; @@ -447,67 +447,67 @@ struct z32f_x24s8 uint32_t x24s8; }; -typedef void (*unpack_float_z_func)(GLuint n, const void *src, GLfloat *dst); +typedef void (*unpack_float_z_func)(uint32_t n, const void *src, float *dst); static void -unpack_float_z_X8_UINT_Z24_UNORM(GLuint n, const void *src, GLfloat *dst) +unpack_float_z_X8_UINT_Z24_UNORM(uint32_t n, const void *src, float *dst) { /* only return Z, not stencil data */ - const GLuint *s = ((const GLuint *) src); - const GLdouble scale = 1.0 / (GLdouble) 0xffffff; - GLuint i; + const uint32_t *s = ((const uint32_t *) src); + const double scale = 1.0 / (double) 0xffffff; + uint32_t i; for (i = 0; i < n; i++) { - dst[i] = (GLfloat) ((s[i] >> 8) * scale); + dst[i] = (float) ((s[i] >> 8) * scale); assert(dst[i] >= 0.0F); assert(dst[i] <= 1.0F); } } static void -unpack_float_z_Z24_UNORM_X8_UINT(GLuint n, const void *src, GLfloat *dst) +unpack_float_z_Z24_UNORM_X8_UINT(uint32_t n, const void *src, float *dst) { /* only return Z, not stencil data */ - const GLuint *s = ((const GLuint *) src); - const GLdouble scale = 1.0 / (GLdouble) 0xffffff; - GLuint i; + const uint32_t *s = ((const uint32_t *) src); + const double scale = 1.0 / (double) 0xffffff; + uint32_t i; for (i = 0; i < n; i++) { - dst[i] = (GLfloat) ((s[i] & 0x00ffffff) * scale); + dst[i] = (float) ((s[i] & 0x00ffffff) * scale); assert(dst[i] >= 0.0F); assert(dst[i] <= 1.0F); } } static void -unpack_float_Z_UNORM16(GLuint n, const void *src, GLfloat *dst) +unpack_float_Z_UNORM16(uint32_t n, const void *src, float *dst) { - const GLushort *s = ((const GLushort *) src); - GLuint i; + const uint16_t *s = ((const uint16_t *) src); + uint32_t i; for (i = 0; i < n; i++) { dst[i] = s[i] * (1.0F / 65535.0F); } } static void -unpack_float_Z_UNORM32(GLuint n, const void *src, GLfloat *dst) +unpack_float_Z_UNORM32(uint32_t n, const void *src, float *dst) { - const GLuint *s = ((const GLuint *) src); - GLuint i; + const uint32_t *s = ((const uint32_t *) src); + uint32_t i; for (i = 0; i < n; i++) { dst[i] = s[i] * (1.0F / 0xffffffff); } } static void -unpack_float_Z_FLOAT32(GLuint n, const void *src, GLfloat *dst) +unpack_float_Z_FLOAT32(uint32_t n, const void *src, float *dst) { memcpy(dst, src, n * sizeof(float)); } static void -unpack_float_z_Z32X24S8(GLuint n, const void *src, GLfloat *dst) +unpack_float_z_Z32X24S8(uint32_t n, const void *src, float *dst) { const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; - GLuint i; + uint32_t i; for (i = 0; i < n; i++) { dst[i] = s[i].z; } @@ -520,8 +520,8 @@ unpack_float_z_Z32X24S8(GLuint n, const void *src, GLfloat *dst) * The returned values will always be in the range [0.0, 1.0]. */ void -_mesa_unpack_float_z_row(mesa_format format, GLuint n, - const void *src, GLfloat *dst) +_mesa_unpack_float_z_row(mesa_format format, uint32_t n, + const void *src, float *dst) { unpack_float_z_func unpack; @@ -555,61 +555,61 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n, -typedef void (*unpack_uint_z_func)(const void *src, GLuint *dst, GLuint n); +typedef void (*unpack_uint_z_func)(const void *src, uint32_t *dst, uint32_t n); static void -unpack_uint_z_X8_UINT_Z24_UNORM(const void *src, GLuint *dst, GLuint n) +unpack_uint_z_X8_UINT_Z24_UNORM(const void *src, uint32_t *dst, uint32_t n) { /* only return Z, not stencil data */ - const GLuint *s = ((const GLuint *) src); - GLuint i; + const uint32_t *s = ((const uint32_t *) src); + uint32_t i; for (i = 0; i < n; i++) { dst[i] = (s[i] & 0xffffff00) | (s[i] >> 24); } } static void -unpack_uint_z_Z24_UNORM_X8_UINT(const void *src, GLuint *dst, GLuint n) +unpack_uint_z_Z24_UNORM_X8_UINT(const void *src, uint32_t *dst, uint32_t n) { /* only return Z, not stencil data */ - const GLuint *s = ((const GLuint *) src); - GLuint i; + const uint32_t *s = ((const uint32_t *) src); + uint32_t i; for (i = 0; i < n; i++) { dst[i] = (s[i] << 8) | ((s[i] >> 16) & 0xff); } } static void -unpack_uint_Z_UNORM16(const void *src, GLuint *dst, GLuint n) +unpack_uint_Z_UNORM16(const void *src, uint32_t *dst, uint32_t n) { - const GLushort *s = ((const GLushort *)src); - GLuint i; + const uint16_t *s = ((const uint16_t *)src); + uint32_t i; for (i = 0; i < n; i++) { dst[i] = (s[i] << 16) | s[i]; } } static void -unpack_uint_Z_UNORM32(const void *src, GLuint *dst, GLuint n) +unpack_uint_Z_UNORM32(const void *src, uint32_t *dst, uint32_t n) { - memcpy(dst, src, n * sizeof(GLuint)); + memcpy(dst, src, n * sizeof(uint32_t)); } static void -unpack_uint_Z_FLOAT32(const void *src, GLuint *dst, GLuint n) +unpack_uint_Z_FLOAT32(const void *src, uint32_t *dst, uint32_t n) { const float *s = (const float *)src; - GLuint i; + uint32_t i; for (i = 0; i < n; i++) { dst[i] = FLOAT_TO_UINT(CLAMP(s[i], 0.0F, 1.0F)); } } static void -unpack_uint_Z_FLOAT32_X24S8(const void *src, GLuint *dst, GLuint n) +unpack_uint_Z_FLOAT32_X24S8(const void *src, uint32_t *dst, uint32_t n) { const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; - GLuint i; + uint32_t i; for (i = 0; i < n; i++) { dst[i] = FLOAT_TO_UINT(CLAMP(s[i].z, 0.0F, 1.0F)); @@ -622,11 +622,11 @@ unpack_uint_Z_FLOAT32_X24S8(const void *src, GLuint *dst, GLuint n) * The returned values will always be in the range [0, 0xffffffff]. */ void -_mesa_unpack_uint_z_row(mesa_format format, GLuint n, - const void *src, GLuint *dst) +_mesa_unpack_uint_z_row(mesa_format format, uint32_t n, + const void *src, uint32_t *dst) { unpack_uint_z_func unpack; - const GLubyte *srcPtr = (GLubyte *) src; + const uint8_t *srcPtr = (uint8_t *) src; switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: @@ -658,35 +658,35 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n, static void -unpack_ubyte_s_S_UINT8(const void *src, GLubyte *dst, GLuint n) +unpack_ubyte_s_S_UINT8(const void *src, uint8_t *dst, uint32_t n) { memcpy(dst, src, n); } static void -unpack_ubyte_s_S8_UINT_Z24_UNORM(const void *src, GLubyte *dst, GLuint n) +unpack_ubyte_s_S8_UINT_Z24_UNORM(const void *src, uint8_t *dst, uint32_t n) { - GLuint i; - const GLuint *src32 = src; + uint32_t i; + const uint32_t *src32 = src; for (i = 0; i < n; i++) dst[i] = src32[i] & 0xff; } static void -unpack_ubyte_s_Z24_UNORM_S8_UINT(const void *src, GLubyte *dst, GLuint n) +unpack_ubyte_s_Z24_UNORM_S8_UINT(const void *src, uint8_t *dst, uint32_t n) { - GLuint i; - const GLuint *src32 = src; + uint32_t i; + const uint32_t *src32 = src; for (i = 0; i < n; i++) dst[i] = src32[i] >> 24; } static void -unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(const void *src, GLubyte *dst, GLuint n) +unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(const void *src, uint8_t *dst, uint32_t n) { - GLuint i; + uint32_t i; const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src; for (i = 0; i < n; i++) @@ -694,8 +694,8 @@ unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(const void *src, GLubyte *dst, GLuint n) } void -_mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n, - const void *src, GLubyte *dst) +_mesa_unpack_ubyte_stencil_row(mesa_format format, uint32_t n, + const void *src, uint8_t *dst) { switch (format) { case MESA_FORMAT_S_UINT8: @@ -716,33 +716,33 @@ _mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n, } static void -unpack_uint_24_8_depth_stencil_Z24_UNORM_S8_UINT(const GLuint *src, GLuint *dst, GLuint n) +unpack_uint_24_8_depth_stencil_Z24_UNORM_S8_UINT(const uint32_t *src, uint32_t *dst, uint32_t n) { - GLuint i; + uint32_t i; for (i = 0; i < n; i++) { - GLuint val = src[i]; + uint32_t val = src[i]; dst[i] = val >> 24 | val << 8; } } static void -unpack_uint_24_8_depth_stencil_Z32_S8X24(const GLuint *src, - GLuint *dst, GLuint n) +unpack_uint_24_8_depth_stencil_Z32_S8X24(const uint32_t *src, + uint32_t *dst, uint32_t n) { - GLuint i; + uint32_t i; for (i = 0; i < n; i++) { /* 8 bytes per pixel (float + uint32) */ - GLfloat zf = ((GLfloat *) src)[i * 2 + 0]; - GLuint z24 = (GLuint) (zf * (GLfloat) 0xffffff); - GLuint s = src[i * 2 + 1] & 0xff; + float zf = ((float *) src)[i * 2 + 0]; + uint32_t z24 = (uint32_t) (zf * (float) 0xffffff); + uint32_t s = src[i * 2 + 1] & 0xff; dst[i] = (z24 << 8) | s; } } static void -unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(const GLuint *src, GLuint *dst, GLuint n) +unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(const uint32_t *src, uint32_t *dst, uint32_t n) { memcpy(dst, src, n * 4); } @@ -752,8 +752,8 @@ unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(const GLuint *src, GLuint *dst, * \param format the source data format */ void -_mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, - const void *src, GLuint *dst) +_mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n, + const void *src, uint32_t *dst) { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: @@ -771,15 +771,15 @@ _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, } static void -unpack_float_32_uint_24_8_Z24_UNORM_S8_UINT(const GLuint *src, - GLuint *dst, GLuint n) +unpack_float_32_uint_24_8_Z24_UNORM_S8_UINT(const uint32_t *src, + uint32_t *dst, uint32_t n) { - GLuint i; + uint32_t i; struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; - const GLdouble scale = 1.0 / (GLdouble) 0xffffff; + const double scale = 1.0 / (double) 0xffffff; for (i = 0; i < n; i++) { - const GLuint z24 = src[i] & 0xffffff; + const uint32_t z24 = src[i] & 0xffffff; d[i].z = z24 * scale; d[i].x24s8 = src[i] >> 24; assert(d[i].z >= 0.0f); @@ -788,22 +788,22 @@ unpack_float_32_uint_24_8_Z24_UNORM_S8_UINT(const GLuint *src, } static void -unpack_float_32_uint_24_8_Z32_FLOAT_S8X24_UINT(const GLuint *src, - GLuint *dst, GLuint n) +unpack_float_32_uint_24_8_Z32_FLOAT_S8X24_UINT(const uint32_t *src, + uint32_t *dst, uint32_t n) { memcpy(dst, src, n * sizeof(struct z32f_x24s8)); } static void -unpack_float_32_uint_24_8_S8_UINT_Z24_UNORM(const GLuint *src, - GLuint *dst, GLuint n) +unpack_float_32_uint_24_8_S8_UINT_Z24_UNORM(const uint32_t *src, + uint32_t *dst, uint32_t n) { - GLuint i; + uint32_t i; struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; - const GLdouble scale = 1.0 / (GLdouble) 0xffffff; + const double scale = 1.0 / (double) 0xffffff; for (i = 0; i < n; i++) { - const GLuint z24 = src[i] >> 8; + const uint32_t z24 = src[i] >> 8; d[i].z = z24 * scale; d[i].x24s8 = src[i] & 0xff; assert(d[i].z >= 0.0f); @@ -826,8 +826,8 @@ unpack_float_32_uint_24_8_S8_UINT_Z24_UNORM(const GLuint *src, * lower 4 bytes higher 4 bytes */ void -_mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, - const void *src, GLuint *dst) +_mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n, + const void *src, uint32_t *dst) { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: @@ -850,9 +850,9 @@ _mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, * \param type the destination data type */ void -_mesa_unpack_depth_stencil_row(mesa_format format, GLuint n, +_mesa_unpack_depth_stencil_row(mesa_format format, uint32_t n, const void *src, GLenum type, - GLuint *dst) + uint32_t *dst) { assert(type == GL_UNSIGNED_INT_24_8 || type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV); |