[Mesa-dev] [PATCH] mesa: rename RGBA8888_* format constants to something appropriate.

Jason Ekstrand jason at jlekstrand.net
Tue Jan 13 06:34:37 PST 2015


Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
On Jan 12, 2015 11:34 PM, "Iago Toral Quiroga" <itoral at igalia.com> wrote:

> The 8888 suggests 8-bit components which is not correct, so
> replace that with the actual size of the components in each
> format.
> ---
>  src/mesa/main/format_utils.c           | 20 ++++++++++----------
>  src/mesa/main/format_utils.h           |  8 ++++----
>  src/mesa/main/readpix.c                |  6 +++---
>  src/mesa/main/texgetimage.c            |  4 ++--
>  src/mesa/state_tracker/st_cb_texture.c |  4 ++--
>  src/mesa/swrast/s_drawpix.c            |  2 +-
>  6 files changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
> index bebc974..eb650a2 100644
> --- a/src/mesa/main/format_utils.c
> +++ b/src/mesa/main/format_utils.c
> @@ -27,16 +27,16 @@
>  #include "format_pack.h"
>  #include "format_unpack.h"
>
> -const mesa_array_format RGBA8888_FLOAT =
> +const mesa_array_format RGBA32_FLOAT =
>     MESA_ARRAY_FORMAT(4, 1, 1, 1, 4, 0, 1, 2, 3);
>
> -const mesa_array_format RGBA8888_UBYTE =
> +const mesa_array_format RGBA8_UBYTE =
>     MESA_ARRAY_FORMAT(1, 0, 0, 1, 4, 0, 1, 2, 3);
>
> -const mesa_array_format RGBA8888_UINT =
> +const mesa_array_format RGBA32_UINT =
>     MESA_ARRAY_FORMAT(4, 0, 0, 0, 4, 0, 1, 2, 3);
>
> -const mesa_array_format RGBA8888_INT =
> +const mesa_array_format RGBA32_INT =
>     MESA_ARRAY_FORMAT(4, 1, 0, 0, 4, 0, 1, 2, 3);
>
>  static void
> @@ -257,7 +257,7 @@ _mesa_format_convert(void *void_dst, uint32_t
> dst_format, size_t dst_stride,
>     if (!rebase_swizzle) {
>        /* Handle the cases where we can directly unpack */
>        if (!src_format_is_mesa_array_format) {
> -         if (dst_array_format == RGBA8888_FLOAT) {
> +         if (dst_array_format == RGBA32_FLOAT) {
>              for (row = 0; row < height; ++row) {
>                 _mesa_unpack_rgba_row(src_format, width,
>                                       src, (float (*)[4])dst);
> @@ -265,7 +265,7 @@ _mesa_format_convert(void *void_dst, uint32_t
> dst_format, size_t dst_stride,
>                 dst += dst_stride;
>              }
>              return;
> -         } else if (dst_array_format == RGBA8888_UBYTE) {
> +         } else if (dst_array_format == RGBA8_UBYTE) {
>              assert(!_mesa_is_format_integer_color(src_format));
>              for (row = 0; row < height; ++row) {
>                 _mesa_unpack_ubyte_rgba_row(src_format, width,
> @@ -274,7 +274,7 @@ _mesa_format_convert(void *void_dst, uint32_t
> dst_format, size_t dst_stride,
>                 dst += dst_stride;
>              }
>              return;
> -         } else if (dst_array_format == RGBA8888_UINT &&
> +         } else if (dst_array_format == RGBA32_UINT &&
>                      _mesa_is_format_unsigned(src_format)) {
>              assert(_mesa_is_format_integer_color(src_format));
>              for (row = 0; row < height; ++row) {
> @@ -289,7 +289,7 @@ _mesa_format_convert(void *void_dst, uint32_t
> dst_format, size_t dst_stride,
>
>        /* Handle the cases where we can directly pack */
>        if (!dst_format_is_mesa_array_format) {
> -         if (src_array_format == RGBA8888_FLOAT) {
> +         if (src_array_format == RGBA32_FLOAT) {
>              for (row = 0; row < height; ++row) {
>                 _mesa_pack_float_rgba_row(dst_format, width,
>                                           (const float (*)[4])src, dst);
> @@ -297,7 +297,7 @@ _mesa_format_convert(void *void_dst, uint32_t
> dst_format, size_t dst_stride,
>                 dst += dst_stride;
>              }
>              return;
> -         } else if (src_array_format == RGBA8888_UBYTE) {
> +         } else if (src_array_format == RGBA8_UBYTE) {
>              assert(!_mesa_is_format_integer_color(dst_format));
>              for (row = 0; row < height; ++row) {
>                 _mesa_pack_ubyte_rgba_row(dst_format, width,
> @@ -306,7 +306,7 @@ _mesa_format_convert(void *void_dst, uint32_t
> dst_format, size_t dst_stride,
>                 dst += dst_stride;
>              }
>              return;
> -         } else if (src_array_format == RGBA8888_UINT &&
> +         } else if (src_array_format == RGBA32_UINT &&
>                      _mesa_is_format_unsigned(dst_format)) {
>              assert(_mesa_is_format_integer_color(dst_format));
>              for (row = 0; row < height; ++row) {
> diff --git a/src/mesa/main/format_utils.h b/src/mesa/main/format_utils.h
> index b588695..8f92a09 100644
> --- a/src/mesa/main/format_utils.h
> +++ b/src/mesa/main/format_utils.h
> @@ -34,10 +34,10 @@
>  #include "imports.h"
>  #include "macros.h"
>
> -extern const mesa_array_format RGBA8888_FLOAT;
> -extern const mesa_array_format RGBA8888_UBYTE;
> -extern const mesa_array_format RGBA8888_UINT;
> -extern const mesa_array_format RGBA8888_INT;
> +extern const mesa_array_format RGBA32_FLOAT;
> +extern const mesa_array_format RGBA8_UBYTE;
> +extern const mesa_array_format RGBA32_UINT;
> +extern const mesa_array_format RGBA32_INT;
>
>  /* Only guaranteed to work for BITS <= 32 */
>  #define MAX_UINT(BITS) ((BITS) == 32 ? UINT32_MAX : ((1u << (BITS)) - 1))
> diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
> index c589ca4..85f900d 100644
> --- a/src/mesa/main/readpix.c
> +++ b/src/mesa/main/readpix.c
> @@ -501,14 +501,14 @@ read_rgba_pixels( struct gl_context *ctx,
>        if (dst_is_integer) {
>           src_is_uint = _mesa_is_format_unsigned(rb_format);
>           if (src_is_uint) {
> -            rgba_format = RGBA8888_UINT;
> +            rgba_format = RGBA32_UINT;
>              rgba_stride = width * 4 * sizeof(GLuint);
>           } else {
> -            rgba_format = RGBA8888_INT;
> +            rgba_format = RGBA32_INT;
>              rgba_stride = width * 4 * sizeof(GLint);
>           }
>        } else {
> -         rgba_format = RGBA8888_FLOAT;
> +         rgba_format = RGBA32_FLOAT;
>           rgba_stride = width * 4 * sizeof(GLfloat);
>        }
>
> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
> index e45a45a..e4572e4 100644
> --- a/src/mesa/main/texgetimage.c
> +++ b/src/mesa/main/texgetimage.c
> @@ -314,7 +314,7 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint
> dimensions,
>                                         width, height, format, type,
>                                         slice, 0, 0);
>        _mesa_format_convert(dest, dstFormat, dstStride,
> -                           tempSlice, RGBA8888_FLOAT, srcStride,
> +                           tempSlice, RGBA32_FLOAT, srcStride,
>                             width, height,
>                             needsRebase ? rebaseSwizzle : NULL);
>        tempSlice += 4 * width * height;
> @@ -453,7 +453,7 @@ get_tex_rgba_uncompressed(struct gl_context *ctx,
> GLuint dimensions,
>           bool need_convert;
>
>           /* We will convert to RGBA float */
> -         rgba_format = RGBA8888_FLOAT;
> +         rgba_format = RGBA32_FLOAT;
>           rgba_stride = width * 4 * sizeof(GLfloat);
>
>           /* If we are lucky and the dst format matches the RGBA format we
> need
> diff --git a/src/mesa/state_tracker/st_cb_texture.c
> b/src/mesa/state_tracker/st_cb_texture.c
> index 1fb9db6..abc68c0 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -1170,7 +1170,7 @@ st_GetTexImage(struct gl_context * ctx,
>                                        dst_format, rgba);
>
>              _mesa_format_convert(dest, dstMesaFormat, dstStride,
> -                                 rgba, RGBA8888_FLOAT, srcStride,
> +                                 rgba, RGBA32_FLOAT, srcStride,
>                                   width, 1, NULL);
>           }
>           else {
> @@ -1184,7 +1184,7 @@ st_GetTexImage(struct gl_context * ctx,
>                                           dst_format, rgba);
>
>                 _mesa_format_convert(dest, dstMesaFormat, dstStride,
> -                                    rgba, RGBA8888_FLOAT, srcStride,
> +                                    rgba, RGBA32_FLOAT, srcStride,
>                                      width, 1, NULL);
>              }
>           }
> diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c
> index b30e389..c992519 100644
> --- a/src/mesa/swrast/s_drawpix.c
> +++ b/src/mesa/swrast/s_drawpix.c
> @@ -489,7 +489,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x,
> GLint y,
>           uint32_t srcMesaFormat =
> _mesa_format_from_format_and_type(format, type);
>           for (row = 0; row < height; row++) {
>              int dstRowStride = 4 * width * sizeof(float);
> -            _mesa_format_convert(rgba, RGBA8888_FLOAT, dstRowStride,
> +            _mesa_format_convert(rgba, RGBA32_FLOAT, dstRowStride,
>                                   (void*)source, srcMesaFormat, srcStride,
>                                   spanWidth, 1, NULL);
>              if (transferOps)
> --
> 1.9.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150113/187baac5/attachment.html>


More information about the mesa-dev mailing list