util: Share a single function pointer for the 4-byte rgba unpack function.
authorEric Anholt <eric@anholt.net>
Wed, 1 Jul 2020 20:33:21 +0000 (13:33 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 7 Jul 2020 18:19:23 +0000 (18:19 +0000)
Everyone wants the same behavior, and this helps shrink the size of our
format description tables.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>

20 files changed:
src/gallium/drivers/nouveau/nv30/nv30_vbo.c
src/util/format/u_format.c
src/util/format/u_format.h
src/util/format/u_format_bptc.c
src/util/format/u_format_bptc.h
src/util/format/u_format_etc.c
src/util/format/u_format_etc.h
src/util/format/u_format_latc.c
src/util/format/u_format_latc.h
src/util/format/u_format_other.c
src/util/format/u_format_other.h
src/util/format/u_format_pack.py
src/util/format/u_format_rgtc.c
src/util/format/u_format_rgtc.h
src/util/format/u_format_s3tc.c
src/util/format/u_format_s3tc.h
src/util/format/u_format_table.py
src/util/format/u_format_yuv.c
src/util/format/u_format_yuv.h
src/util/tests/format/u_format_test.c

index 99ceef774036a0cb9f8f9fd0480b35f7ea0f5f4e..b50157c3b1ad53e6fbf083377dea95f3977b08ad 100644 (file)
@@ -47,7 +47,7 @@ nv30_emit_vtxattr(struct nv30_context *nv30, struct pipe_vertex_buffer *vb,
    data = nouveau_resource_map_offset(&nv30->base, res, vb->buffer_offset +
                                       ve->src_offset, NOUVEAU_BO_RD);
 
-   util_format_unpack_rgba_float(ve->src_format, v, data, 1);
+   util_format_unpack_rgba(ve->src_format, v, data, 1);
 
    switch (nc) {
    case 4:
index 5bb4b0fdb00618593f741b416d448e81f0e1bc10..cd7326421549433c682e2ed6308c2a82aa6f8288 100644 (file)
@@ -341,12 +341,7 @@ util_format_read_4(enum pipe_format format,
 
    src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
 
-   if (util_format_is_pure_uint(format))
-      format_desc->unpack_rgba_sint(dst, dst_stride, src_row, src_stride, w, h);
-   else if (util_format_is_pure_uint(format))
-      format_desc->unpack_rgba_uint(dst, dst_stride, src_row, src_stride, w, h);
-   else
-      format_desc->unpack_rgba_float(dst, dst_stride, src_row, src_stride, w, h);
+   format_desc->unpack_rgba(dst, dst_stride, src_row, src_stride, w, h);
 }
 
 
@@ -695,8 +690,8 @@ util_format_translate(enum pipe_format dst_format,
       unsigned tmp_stride;
       int *tmp_row;
 
-      if (!src_format_desc->unpack_rgba_sint ||
-          !dst_format_desc->pack_rgba_sint) {
+      if (util_format_is_pure_sint(src_format) !=
+          util_format_is_pure_sint(dst_format)) {
          return FALSE;
       }
 
@@ -706,7 +701,7 @@ util_format_translate(enum pipe_format dst_format,
          return FALSE;
 
       while (height >= y_step) {
-         src_format_desc->unpack_rgba_sint(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
+         src_format_desc->unpack_rgba(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
          dst_format_desc->pack_rgba_sint(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
 
          dst_row += dst_step;
@@ -715,7 +710,7 @@ util_format_translate(enum pipe_format dst_format,
       }
 
       if (height) {
-         src_format_desc->unpack_rgba_sint(tmp_row, tmp_stride, src_row, src_stride, width, height);
+         src_format_desc->unpack_rgba(tmp_row, tmp_stride, src_row, src_stride, width, height);
          dst_format_desc->pack_rgba_sint(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
       }
 
@@ -726,7 +721,7 @@ util_format_translate(enum pipe_format dst_format,
       unsigned tmp_stride;
       unsigned int *tmp_row;
 
-      if (!src_format_desc->unpack_rgba_uint ||
+      if (!src_format_desc->unpack_rgba ||
           !dst_format_desc->pack_rgba_uint) {
          return FALSE;
       }
@@ -737,7 +732,7 @@ util_format_translate(enum pipe_format dst_format,
          return FALSE;
 
       while (height >= y_step) {
-         src_format_desc->unpack_rgba_uint(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
+         src_format_desc->unpack_rgba(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
          dst_format_desc->pack_rgba_uint(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
 
          dst_row += dst_step;
@@ -746,7 +741,7 @@ util_format_translate(enum pipe_format dst_format,
       }
 
       if (height) {
-         src_format_desc->unpack_rgba_uint(tmp_row, tmp_stride, src_row, src_stride, width, height);
+         src_format_desc->unpack_rgba(tmp_row, tmp_stride, src_row, src_stride, width, height);
          dst_format_desc->pack_rgba_uint(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
       }
 
@@ -756,7 +751,7 @@ util_format_translate(enum pipe_format dst_format,
       unsigned tmp_stride;
       float *tmp_row;
 
-      if (!src_format_desc->unpack_rgba_float ||
+      if (!src_format_desc->unpack_rgba ||
           !dst_format_desc->pack_rgba_float) {
          return FALSE;
       }
@@ -767,7 +762,7 @@ util_format_translate(enum pipe_format dst_format,
          return FALSE;
 
       while (height >= y_step) {
-         src_format_desc->unpack_rgba_float(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
+         src_format_desc->unpack_rgba(tmp_row, tmp_stride, src_row, src_stride, width, y_step);
          dst_format_desc->pack_rgba_float(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step);
 
          dst_row += dst_step;
@@ -776,7 +771,7 @@ util_format_translate(enum pipe_format dst_format,
       }
 
       if (height) {
-         src_format_desc->unpack_rgba_float(tmp_row, tmp_stride, src_row, src_stride, width, height);
+         src_format_desc->unpack_rgba(tmp_row, tmp_stride, src_row, src_stride, width, height);
          dst_format_desc->pack_rgba_float(dst_row, dst_stride, tmp_row, tmp_stride, width, height);
       }
 
index 4ce3b58bde22a262179b499e04b586a88adfd92e..4b182ff558d0e86cc481055afab88e6d37b3a8d2 100644 (file)
@@ -274,15 +274,17 @@ struct util_format_description
                         unsigned i, unsigned j);
 
    /**
-    * Unpack pixel blocks to R32G32B32A32_FLOAT.
+    * Unpack pixel blocks to R32G32B32A32_UINT/_INT_FLOAT based on whether the
+    * type is pure uint, int, or other.
+    *
     * Note: strides are in bytes.
     *
     * Only defined for non-depth-stencil formats.
     */
    void
-   (*unpack_rgba_float)(float *dst, unsigned dst_stride,
-                        const uint8_t *src, unsigned src_stride,
-                        unsigned width, unsigned height);
+   (*unpack_rgba)(void *dst, unsigned dst_stride,
+                  const uint8_t *src, unsigned src_stride,
+                  unsigned width, unsigned height);
 
    /**
     * Pack pixel blocks from R32G32B32A32_FLOAT.
@@ -371,33 +373,11 @@ struct util_format_description
                    const uint8_t *src, unsigned src_stride,
                    unsigned width, unsigned height);
 
-  /**
-    * Unpack pixel blocks to R32G32B32A32_UINT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for INT formats.
-    */
-   void
-   (*unpack_rgba_uint)(uint32_t *dst, unsigned dst_stride,
-                       const uint8_t *src, unsigned src_stride,
-                       unsigned width, unsigned height);
-
    void
    (*pack_rgba_uint)(uint8_t *dst, unsigned dst_stride,
                      const uint32_t *src, unsigned src_stride,
                      unsigned width, unsigned height);
 
-  /**
-    * Unpack pixel blocks to R32G32B32A32_SINT.
-    * Note: strides are in bytes.
-    *
-    * Only defined for INT formats.
-    */
-   void
-   (*unpack_rgba_sint)(int32_t *dst, unsigned dst_stride,
-                       const uint8_t *src, unsigned src_stride,
-                       unsigned width, unsigned height);
-
    void
    (*pack_rgba_sint)(uint8_t *dst, unsigned dst_stride,
                      const int32_t *src, unsigned src_stride,
@@ -1473,15 +1453,6 @@ util_format_unpack_s_8uint(enum pipe_format format, uint8_t *dst,
    desc->unpack_s_8uint(dst, 0, (const uint8_t *)src, 0, w, 1);
 }
 
-static inline void
-util_format_unpack_rgba_float(enum pipe_format format, float *dst,
-                              const void *src, unsigned w)
-{
-   const struct util_format_description *desc = util_format_description(format);
-
-   desc->unpack_rgba_float(dst, 0, (const uint8_t *)src, 0, w, 1);
-}
-
 /**
  * Unpacks a row of color data to 32-bit RGBA, either integers for pure
  * integer formats (sign-extended for signed data), or 32-bit floats.
@@ -1492,12 +1463,7 @@ util_format_unpack_rgba(enum pipe_format format, void *dst,
 {
    const struct util_format_description *desc = util_format_description(format);
 
-   if (util_format_is_pure_uint(format))
-      desc->unpack_rgba_uint((uint32_t *)dst, 0, (const uint8_t *)src, 0, w, 1);
-   else if (util_format_is_pure_sint(format))
-      desc->unpack_rgba_sint((int32_t *)dst, 0, (const uint8_t *)src, 0, w, 1);
-   else
-      desc->unpack_rgba_float((float *)dst, 0, (const uint8_t *)src, 0, w, 1);
+   desc->unpack_rgba(dst, 0, (const uint8_t *)src, 0, w, 1);
 }
 
 static inline void
index 60f789ce0e00203a34de947f734fa18869024d47..142e6c8cc28102bf203ba8d93638c44f35849330 100644 (file)
@@ -52,7 +52,7 @@ util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
 }
 
 void
-util_format_bptc_rgba_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_bptc_rgba_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                               const uint8_t *src_row, unsigned src_stride,
                                               unsigned width, unsigned height)
 {
@@ -121,7 +121,7 @@ util_format_bptc_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_bptc_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_bptc_srgba_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                          const uint8_t *src_row, unsigned src_stride,
                                          unsigned width, unsigned height)
 {
@@ -191,7 +191,7 @@ util_format_bptc_rgb_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_strid
 }
 
 void
-util_format_bptc_rgb_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_bptc_rgb_float_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                              const uint8_t *src_row, unsigned src_stride,
                                              unsigned width, unsigned height)
 {
@@ -249,7 +249,7 @@ util_format_bptc_rgb_ufloat_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
 }
 
 void
-util_format_bptc_rgb_ufloat_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_bptc_rgb_ufloat_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                               const uint8_t *src_row, unsigned src_stride,
                                               unsigned width, unsigned height)
 {
index eaf3ec396ab2db23858dbf356911edb04bc5fea2..e093ae3ce36c5d281a2da6e25a24125f30db2fd8 100644 (file)
@@ -45,7 +45,7 @@ util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
                                              const uint8_t *src_row, unsigned src_stride,
                                              unsigned width, unsigned height);
 void
-util_format_bptc_rgba_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_bptc_rgba_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                               const uint8_t *src_row, unsigned src_stride,
                                               unsigned width, unsigned height);
 void
@@ -65,7 +65,7 @@ util_format_bptc_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
                                         const uint8_t *src_row, unsigned src_stride,
                                         unsigned width, unsigned height);
 void
-util_format_bptc_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_bptc_srgba_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                          const uint8_t *src_row, unsigned src_stride,
                                          unsigned width, unsigned height);
 void
@@ -85,7 +85,7 @@ util_format_bptc_rgb_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_strid
                                             const uint8_t *src_row, unsigned src_stride,
                                             unsigned width, unsigned height);
 void
-util_format_bptc_rgb_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_bptc_rgb_float_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                              const uint8_t *src_row, unsigned src_stride,
                                              unsigned width, unsigned height);
 void
@@ -105,7 +105,7 @@ util_format_bptc_rgb_ufloat_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
                                              const uint8_t *src_row, unsigned src_stride,
                                              unsigned width, unsigned height);
 void
-util_format_bptc_rgb_ufloat_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_bptc_rgb_ufloat_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                               const uint8_t *src_row, unsigned src_stride,
                                               unsigned width, unsigned height);
 void
index 505e57b41f1f0dbc84adc4433e3ea6e32cb348de..8931242a52d34ad5ccaf8627dd31daeaa89e34a9 100644 (file)
@@ -25,7 +25,7 @@ util_format_etc1_rgb8_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned
 }
 
 void
-util_format_etc1_rgb8_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_etc1_rgb8_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    const unsigned bw = 4, bh = 4, bs = 8, comps = 4;
    struct etc1_block block;
@@ -38,7 +38,7 @@ util_format_etc1_rgb8_unpack_rgba_float(float *dst_row, unsigned dst_stride, con
          etc1_parse_block(&block, src);
 
          for (j = 0; j < bh; j++) {
-            float *dst = dst_row + (y + j) * dst_stride / sizeof(*dst_row) + x * comps;
+            float *dst = (float *)((uint8_t *)dst_row + (y + j) * dst_stride + x * comps * 4);
             uint8_t tmp[3];
 
             for (i = 0; i < bw; i++) {
index 30c3dcb920d726c8054f187114a25be8ea274612..96795e1aec4f070552b8cbd1cea806908bd80ed3 100644 (file)
@@ -35,7 +35,7 @@ void
 util_format_etc1_rgb8_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
-util_format_etc1_rgb8_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_etc1_rgb8_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_etc1_rgb8_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
index 1f26cb18f3afa6e28c982253663b1aaefd0408a5..f5b2a64978750f68e5ea5916a63e6862025fba06 100644 (file)
@@ -56,7 +56,7 @@ util_format_latc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_latc1_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    unsigned x, y, i, j;
    int block_size = 8;
@@ -66,7 +66,7 @@ util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
       for(x = 0; x < width; x += 4) {
          for(j = 0; j < 4; ++j) {
             for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               float *dst = (float *)((uint8_t *)dst_row + (y + j)*dst_stride + (x + i)*16);
                uint8_t tmp_r;
                util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
                dst[0] =
@@ -129,7 +129,7 @@ util_format_latc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
 }
 
 void
-util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_latc1_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    unsigned x, y, i, j;
    int block_size = 8;
@@ -139,7 +139,7 @@ util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
       for(x = 0; x < width; x += 4) {
          for(j = 0; j < 4; ++j) {
             for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               float *dst = (float *)((uint8_t *)dst_row + (y + j)*dst_stride + (x + i)*16);
                int8_t tmp_r;
                util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
                dst[0] =
@@ -195,7 +195,7 @@ util_format_latc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
 }
 
 void
-util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_latc2_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    unsigned x, y, i, j;
    int block_size = 16;
@@ -205,7 +205,7 @@ util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
       for(x = 0; x < width; x += 4) {
          for(j = 0; j < 4; ++j) {
             for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               float *dst = (float *)((uint8_t *)dst_row + (y + j)*dst_stride + (x + i)*16);
                uint8_t tmp_r, tmp_g;
                util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
                util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
@@ -259,7 +259,7 @@ util_format_latc2_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigne
 }
 
 void
-util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_latc2_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    unsigned x, y, i, j;
    int block_size = 16;
@@ -269,7 +269,7 @@ util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
       for(x = 0; x < width; x += 4) {
          for(j = 0; j < 4; ++j) {
             for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               float *dst = (float *)(uint8_t *)dst_row + (y + j)*dst_stride + (x + i)*16;
                int8_t tmp_r, tmp_g;
                util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
                util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
index 1f08887533d61ffe8aaa46d17a7277a6989f4f29..1328df6496a5e162c1bd232601e5f2af1699f0a0 100644 (file)
@@ -38,7 +38,7 @@ void
 util_format_latc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
-util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_latc1_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_latc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
@@ -61,7 +61,7 @@ void
 util_format_latc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
-util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_latc1_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
@@ -80,7 +80,7 @@ void
 util_format_latc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
-util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_latc2_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_latc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
@@ -96,7 +96,7 @@ void
 util_format_latc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
-util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_latc2_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_latc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
index 5599bfde3874b8d7533d9192c1de2b65e3db482b..4f304e001308d3eef79a51612c5d58a0fede41bd 100644 (file)
@@ -33,7 +33,7 @@
 
 
 void
-util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_r9g9b9e5_float_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                         const uint8_t *src_row, unsigned src_stride,
                                         unsigned width, unsigned height)
 {
@@ -49,7 +49,7 @@ util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride
          dst += 4;
       }
       src_row += src_stride;
-      dst_row += dst_stride/sizeof(*dst_row);
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
@@ -136,7 +136,7 @@ util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_strid
 
 
 void
-util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_r11g11b10_float_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                         const uint8_t *src_row, unsigned src_stride,
                                         unsigned width, unsigned height)
 {
@@ -152,7 +152,7 @@ util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_strid
          dst += 4;
       }
       src_row += src_stride;
-      dst_row += dst_stride/sizeof(*dst_row);
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
@@ -239,7 +239,7 @@ util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
 
 
 void
-util_format_r1_unorm_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
+util_format_r1_unorm_unpack_rgba_float(UNUSED void *dst_row, UNUSED unsigned dst_stride,
                                   UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
                                   UNUSED unsigned width, UNUSED unsigned height)
 {
@@ -298,7 +298,7 @@ r8g8bx_derive(int16_t r, int16_t g)
 }
 
 void
-util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_r8g8bx_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                       const uint8_t *src_row, unsigned src_stride,
                                       unsigned width, unsigned height)
 {
@@ -321,7 +321,7 @@ util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
          dst += 4;
       }
       src_row += src_stride;
-      dst_row += dst_stride/sizeof(*dst_row);
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
index 2f6a908bbe8aea462b1d8f1b36afa8cf6c213bba..8ca5d05bc8f0d89e59efb59ec87fef70e4da3e40 100644 (file)
@@ -34,7 +34,7 @@
 
 
 void
-util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_r9g9b9e5_float_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                         const uint8_t *src_row, unsigned src_stride,
                                         unsigned width, unsigned height);
 
@@ -59,7 +59,7 @@ util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_strid
 
 
 void
-util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_r11g11b10_float_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                         const uint8_t *src_row, unsigned src_stride,
                                         unsigned width, unsigned height);
 
@@ -84,7 +84,7 @@ util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
 
 
 void
-util_format_r1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_r1_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                   const uint8_t *src_row, unsigned src_stride,
                                   unsigned width, unsigned height);
 
@@ -108,7 +108,7 @@ util_format_r1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
                                  unsigned width, unsigned height);
 
 void
-util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_r8g8bx_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                       const uint8_t *src_row, unsigned src_stride,
                                       unsigned width, unsigned height);
 
index c8749a2c0474e7057a3bd9275434fd4daec0b3f8..3307027bbbd3c836ce427b7bd14fc83ffcd72b09 100644 (file)
@@ -624,8 +624,13 @@ def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
 
     name = format.short_name()
 
+    if "8unorm" in dst_suffix:
+        dst_proto_type = dst_native_type
+    else:
+        dst_proto_type = 'void'
+
     print('static inline void')
-    print('util_format_%s_unpack_%s(%s *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)' % (name, dst_suffix, dst_native_type))
+    print('util_format_%s_unpack_%s(%s *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)' % (name, dst_suffix, dst_proto_type))
     print('{')
 
     if is_format_supported(format):
@@ -641,7 +646,7 @@ def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
         print('         dst += 4;')
         print('      }')
         print('      src_row += src_stride;')
-        print('      dst_row += dst_stride/sizeof(*dst_row);')
+        print('      dst_row = (uint8_t *)dst_row + dst_stride;')
         print('   }')
 
     print('}')
index a663b8a75cc8c551b668f973039cca59c6e130d7..1839dc55e70d95b76c2db3eccba7cedb7f735f1b 100644 (file)
@@ -86,7 +86,7 @@ util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_rgtc1_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    unsigned x, y, i, j;
    int block_size = 8;
@@ -95,7 +95,7 @@ util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
       for(x = 0; x < width; x += 4) {
          for(j = 0; j < 4; ++j) {
             for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               float *dst = (float *)((uint8_t *)dst_row + (y + j)*dst_stride + (x + i)*16);
                uint8_t tmp_r;
                util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
                dst[0] = ubyte_to_float(tmp_r);
@@ -189,7 +189,7 @@ util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
 }
 
 void
-util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_rgtc1_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    unsigned x, y, i, j;
    int block_size = 8;
@@ -198,7 +198,7 @@ util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
       for(x = 0; x < width; x += 4) {
          for(j = 0; j < 4; ++j) {
             for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               float *dst = (float *)((uint8_t *)dst_row + (y + j)*dst_stride + (x + i)*16);
                int8_t tmp_r;
                util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
                dst[0] = byte_to_float_tex(tmp_r);
@@ -316,7 +316,7 @@ util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
 }
 
 void
-util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_rgtc2_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    unsigned x, y, i, j;
    int block_size = 16;
@@ -325,7 +325,7 @@ util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
       for(x = 0; x < width; x += 4) {
          for(j = 0; j < 4; ++j) {
             for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               float *dst = (float *)((uint8_t *)dst_row + (y + j)*dst_stride + (x + i)*16);
                uint8_t tmp_r, tmp_g;
                util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
                util_format_unsigned_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
@@ -378,7 +378,7 @@ util_format_rgtc2_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigne
 }
 
 void
-util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_rgtc2_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    unsigned x, y, i, j;
    int block_size = 16;
@@ -387,7 +387,7 @@ util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
       for(x = 0; x < width; x += 4) {
          for(j = 0; j < 4; ++j) {
             for(i = 0; i < 4; ++i) {
-               float *dst = dst_row + (y + j)*dst_stride/sizeof(*dst_row) + (x + i)*4;
+               float *dst = (float *)((uint8_t *)dst_row + (y + j)*dst_stride + (x + i)*16);
                int8_t tmp_r, tmp_g;
                util_format_signed_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
                util_format_signed_fetch_texel_rgtc(0, src + 8, i, j, &tmp_g, 2);
index 67ac4728e56a4dc9cb38a021cbf6e1cefa93859b..5f5f8151278594ea9151df22a11722a6b4ee4001 100644 (file)
@@ -38,7 +38,7 @@ void
 util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
-util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_rgtc1_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
@@ -61,7 +61,7 @@ void
 util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
-util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_rgtc1_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
@@ -83,7 +83,7 @@ void
 util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
-util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_rgtc2_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
@@ -99,7 +99,7 @@ void
 util_format_rgtc2_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
-util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_rgtc2_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height, unsigned chan2off);
index 498039841fbbaa915de7650fe2b363a3eae72f72..4f61d614732046f20cd012d1cf68b7c51e384c78 100644 (file)
@@ -228,7 +228,7 @@ util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_dxt1_rgb_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                        const uint8_t *src_row, unsigned src_stride,
                                        unsigned width, unsigned height)
 {
@@ -240,7 +240,7 @@ util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_dxt1_rgba_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                         const uint8_t *src_row, unsigned src_stride,
                                         unsigned width, unsigned height)
 {
@@ -252,7 +252,7 @@ util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_dxt3_rgba_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                         const uint8_t *src_row, unsigned src_stride,
                                         unsigned width, unsigned height)
 {
@@ -264,7 +264,7 @@ util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_dxt5_rgba_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                         const uint8_t *src_row, unsigned src_stride,
                                         unsigned width, unsigned height)
 {
@@ -568,7 +568,7 @@ util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_dxt1_srgb_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
                                           src_row, src_stride,
@@ -578,7 +578,7 @@ util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, con
 }
 
 void
-util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_dxt1_srgba_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
                                           src_row, src_stride,
@@ -588,7 +588,7 @@ util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, co
 }
 
 void
-util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_dxt3_srgba_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
                                           src_row, src_stride,
@@ -598,7 +598,7 @@ util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, co
 }
 
 void
-util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+util_format_dxt5_srgba_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
 {
    util_format_dxtn_rgb_unpack_rgba_float(dst_row, dst_stride,
                                           src_row, src_stride,
index 6f188c67f95091b9f32f4f42884d35af57ec5a34..c5cb7ad26daeb1d793dc903cf334b4f2ee059ff0 100644 (file)
@@ -140,7 +140,7 @@ util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsig
 
 
 void
-util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_dxt1_rgb_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
@@ -149,7 +149,7 @@ void
 util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
-util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_dxt1_rgba_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
@@ -158,7 +158,7 @@ void
 util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
-util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_dxt3_rgba_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
@@ -167,7 +167,7 @@ void
 util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
-util_format_dxt5_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_dxt5_rgba_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
@@ -176,7 +176,7 @@ void
 util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
-util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_dxt1_srgb_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
@@ -185,7 +185,7 @@ void
 util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
-util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_dxt1_srgba_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
@@ -194,7 +194,7 @@ void
 util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
-util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_dxt3_srgba_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
@@ -203,7 +203,7 @@ void
 util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
-util_format_dxt5_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
+util_format_dxt5_srgba_unpack_rgba_float(void *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height);
 
 void
 util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height);
index dc73f510391fc96df628b4a3ef007e3fa6b6bf0a..8ca8ec33cde4dd3f8d1e6205d3c9e88c3d7bdfac 100644 (file)
@@ -179,7 +179,7 @@ def write_format_table(formats):
             print("   .pack_rgba_8unorm = &util_format_%s_pack_rgba_8unorm," % sn)
             if format.layout == 's3tc' or format.layout == 'rgtc':
                 print("   .fetch_rgba_8unorm = &util_format_%s_fetch_rgba_8unorm," % sn)
-            print("   .unpack_rgba_float = &util_format_%s_unpack_rgba_float," % sn)
+            print("   .unpack_rgba = &util_format_%s_unpack_rgba_float," % sn)
             print("   .pack_rgba_float = &util_format_%s_pack_rgba_float," % sn)
             print("   .fetch_rgba_float = &util_format_%s_fetch_rgba_float," % sn)
 
@@ -194,13 +194,13 @@ def write_format_table(formats):
             print("   .pack_s_8uint = &util_format_%s_pack_s_8uint," % sn)
 
         if format.is_pure_unsigned():
-            print("   .unpack_rgba_uint = &util_format_%s_unpack_unsigned," % sn)
+            print("   .unpack_rgba = &util_format_%s_unpack_unsigned," % sn)
             print("   .pack_rgba_uint = &util_format_%s_pack_unsigned," % sn)
             print("   .pack_rgba_sint = &util_format_%s_pack_signed," % sn)
             print("   .fetch_rgba_uint = &util_format_%s_fetch_unsigned," % sn)
         elif format.is_pure_signed():
             print("   .pack_rgba_uint = &util_format_%s_pack_unsigned," % sn)
-            print("   .unpack_rgba_sint = &util_format_%s_unpack_signed," % sn)
+            print("   .unpack_rgba = &util_format_%s_unpack_signed," % sn)
             print("   .pack_rgba_sint = &util_format_%s_pack_signed," % sn)
             print("   .fetch_rgba_sint = &util_format_%s_fetch_signed," % sn)
         print("};")
index 0b2eb821d4df6673f3e66bc234527fda806dd433..21d082548c65a3ff7edec55c1a67beabd1d6ef3d 100644 (file)
@@ -39,7 +39,7 @@
 
 
 void
-util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_r8g8_b8g8_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                          const uint8_t *src_row, unsigned src_stride,
                                          unsigned width, unsigned height)
 {
@@ -86,8 +86,8 @@ util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_strid
          dst[3] = 1.0f; /* a */
       }
 
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
+      src_row = (uint8_t *)src_row + src_stride;
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
@@ -259,7 +259,7 @@ util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
 
 
 void
-util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_g8r8_g8b8_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                          const uint8_t *src_row, unsigned src_stride,
                                          unsigned width, unsigned height)
 {
@@ -306,8 +306,8 @@ util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_strid
          dst[3] = 1.0f; /* a */
       }
 
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
+      src_row = (uint8_t *)src_row + src_stride;
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
@@ -479,7 +479,7 @@ util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
 
 
 void
-util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_uyvy_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                               const uint8_t *src_row, unsigned src_stride,
                               unsigned width, unsigned height)
 {
@@ -520,8 +520,8 @@ util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
          dst[3] = 1.0f; /* a */
       }
 
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
+      src_row = (uint8_t *)src_row + src_stride;
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
@@ -700,7 +700,7 @@ util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
 
 
 void
-util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_yuyv_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                               const uint8_t *src_row, unsigned src_stride,
                               unsigned width, unsigned height)
 {
@@ -741,8 +741,8 @@ util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
          dst[3] = 1.0f; /* a */
       }
 
-      src_row += src_stride/sizeof(*src_row);
-      dst_row += dst_stride/sizeof(*dst_row);
+      src_row = (uint8_t *)src_row + src_stride;
+      dst_row = (uint8_t *)dst_row + dst_stride;
    }
 }
 
index 862744e8a30c140cecff2e233f29dc6e58d6e247..229adac9b3941e8f429f44c60bc6b1c119aa6bc0 100644 (file)
@@ -122,7 +122,7 @@ util_format_yuv_to_rgb_8unorm(uint8_t y, uint8_t u, uint8_t v,
 
 
 void
-util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_uyvy_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                               const uint8_t *src_row, unsigned src_stride,
                               unsigned width, unsigned height);
 
@@ -146,7 +146,7 @@ util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
                              unsigned i, unsigned j);
 
 void
-util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_yuyv_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                               const uint8_t *src_row, unsigned src_stride,
                               unsigned width, unsigned height);
 
@@ -170,7 +170,7 @@ util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
                              unsigned i, unsigned j);
 
 void
-util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_r8g8_b8g8_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                          const uint8_t *src_row, unsigned src_stride,
                                          unsigned width, unsigned height);
 
@@ -194,7 +194,7 @@ util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
                                         unsigned i, unsigned j);
 
 void
-util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
+util_format_g8r8_g8b8_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride,
                                          const uint8_t *src_row, unsigned src_stride,
                                          unsigned width, unsigned height);
 
index 69e3b5aebfde8e790becd164a90e5164c9a9f952..a6f1d608c848a69331bb71c8fb5cd8cb0d851874 100644 (file)
@@ -235,16 +235,16 @@ test_format_fetch_rgba_float(const struct util_format_description *format_desc,
 
 
 static boolean
-test_format_unpack_rgba_float(const struct util_format_description *format_desc,
-                              const struct util_format_test_case *test)
+test_format_unpack_rgba(const struct util_format_description *format_desc,
+                        const struct util_format_test_case *test)
 {
    float unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } };
    unsigned i, j, k;
    boolean success;
 
-   format_desc->unpack_rgba_float(&unpacked[0][0][0], sizeof unpacked[0],
-                             test->packed, 0,
-                             format_desc->block.width, format_desc->block.height);
+   format_desc->unpack_rgba(&unpacked[0][0][0], sizeof unpacked[0],
+                            test->packed, 0,
+                            format_desc->block.width, format_desc->block.height);
 
    success = TRUE;
    for (i = 0; i < format_desc->block.height; ++i) {
@@ -359,6 +359,9 @@ test_format_unpack_rgba_8unorm(const struct util_format_description *format_desc
    unsigned i, j, k;
    boolean success;
 
+   if (util_format_is_pure_integer(format_desc->format))
+      return FALSE;
+
    format_desc->unpack_rgba_8unorm(&unpacked[0][0][0], sizeof unpacked[0],
                               test->packed, 0,
                               format_desc->block.width, format_desc->block.height);
@@ -788,7 +791,7 @@ test_all(void)
 
       TEST_ONE_FUNC(fetch_rgba_float);
       TEST_ONE_FUNC(pack_rgba_float);
-      TEST_ONE_FUNC(unpack_rgba_float);
+      TEST_ONE_FUNC(unpack_rgba);
       TEST_ONE_FUNC(pack_rgba_8unorm);
       TEST_ONE_FUNC(unpack_rgba_8unorm);