util: Make all 3 fetch_rgba functions occupy the same function slot.
authorEric Anholt <eric@anholt.net>
Thu, 13 Aug 2020 16:15:16 +0000 (09:15 -0700)
committerMarge Bot <eric+marge@anholt.net>
Sun, 16 Aug 2020 21:25:14 +0000 (21:25 +0000)
A single format either had the float, the sint, or the uint version.
Making the dst be void * lets us store them in the same slot and not have
logic in the callers to call the right one.

-6kb on gallium drivers

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

22 files changed:
src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
src/gallium/auxiliary/translate/translate_generic.c
src/gallium/drivers/llvmpipe/lp_test_format.c
src/gallium/tests/unit/translate_test.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 4d23047ada23ea6a12b961b213316ba6f721953a..aa99c2a7e2e11bf58b56e31eeb2b3b475a9a08e4 100644 (file)
@@ -897,7 +897,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm,
     * Fallback to util_format_description::fetch_rgba_float().
     */
 
-   if (unpack->fetch_rgba_float) {
+   if (unpack->fetch_rgba) {
       /*
        * Fallback to calling util_format_description::fetch_rgba_float.
        *
@@ -944,7 +944,7 @@ lp_build_fetch_rgba_aos(struct gallivm_state *gallivm,
          if (gallivm->cache)
             gallivm->cache->dont_cache = true;
          function = lp_build_const_func_pointer(gallivm,
-                                                func_to_pointer((func_pointer) unpack->fetch_rgba_float),
+                                                func_to_pointer((func_pointer) unpack->fetch_rgba),
                                                 ret_type,
                                                 arg_types, ARRAY_SIZE(arg_types),
                                                 format_desc->short_name);
index 22d8d90b8a3d43b0f78d2024ab81f5b4b8bc7053..311fc384ffe9f027939b4bbac763ed6da45df1d6 100644 (file)
@@ -814,19 +814,9 @@ translate_generic_create(const struct translate_key *key)
             FREE(tg);
             return NULL;
          }
-
-         if (format_desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
-            assert(unpack->fetch_rgba_sint);
-            tg->attrib[i].fetch = (fetch_func)unpack->fetch_rgba_sint;
-         } else {
-            assert(unpack->fetch_rgba_uint);
-            tg->attrib[i].fetch = (fetch_func)unpack->fetch_rgba_uint;
-         }
-      } else {
-         assert(unpack->fetch_rgba_float);
-         tg->attrib[i].fetch = (fetch_func)unpack->fetch_rgba_float;
       }
 
+      tg->attrib[i].fetch = (fetch_func)unpack->fetch_rgba;
       tg->attrib[i].buffer = key->element[i].input_buffer;
       tg->attrib[i].input_offset = key->element[i].input_offset;
       tg->attrib[i].instance_divisor = key->element[i].instance_divisor;
index 583e5fc0b4d974673bad111d2bda8635cfbcfc86..5facd85e3092a3bf2af72cbd50c56fde7e571f4b 100644 (file)
@@ -392,7 +392,7 @@ test_all(unsigned verbose, FILE *fp)
           * precompiled fetch func for any format before we write LLVM code to
           * fetch from it.
           */
-         if (!unpack->fetch_rgba_float)
+         if (!unpack->fetch_rgba)
             continue;
 
          /* only test twice with formats which can use cache */
index 49a9c968300222d7e55492859fa5aa1ad9f671e2..807995cd25610457767ac8aae5d4743d01cc380b 100644 (file)
@@ -178,7 +178,7 @@ int main(int argc, char** argv)
       unsigned output_normalized = 0;
 
       if (!output_format_desc
-            || !output_format_unpack->fetch_rgba_float
+            || !output_format_unpack->fetch_rgba
             || !output_format_pack->pack_rgba_float
             || output_format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB
             || output_format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN
@@ -206,7 +206,7 @@ int main(int argc, char** argv)
          boolean input_is_float = FALSE;
 
          if (!input_format_desc
-               || !input_format_unpack->fetch_rgba_float
+               || !input_format_unpack->fetch_rgba
                || !input_format_pack->pack_rgba_float
                || input_format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB
                || input_format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN
@@ -277,8 +277,8 @@ int main(int argc, char** argv)
          {
             float a[4];
             float b[4];
-            input_format_unpack->fetch_rgba_float(a, buffer[2] + i * input_format_size, 0, 0);
-            input_format_unpack->fetch_rgba_float(b, buffer[4] + i * input_format_size, 0, 0);
+            input_format_unpack->fetch_rgba(a, buffer[2] + i * input_format_size, 0, 0);
+            input_format_unpack->fetch_rgba(b, buffer[4] + i * input_format_size, 0, 0);
 
             for (j = 0; j < count; ++j)
             {
index 91198f653010c6b3aac0532dfc8c589b5d6df37e..41d795e7b3f67521dfa579df954d59c57073e9ee 100644 (file)
@@ -351,9 +351,7 @@ struct util_format_unpack_description {
     * Only defined for non-depth-stencil and non-integer formats.
     */
    void
-   (*fetch_rgba_float)(float *dst,
-                       const uint8_t *src,
-                       unsigned i, unsigned j);
+   (*fetch_rgba)(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
    /**
     * Unpack pixels to Z32_UNORM.
@@ -387,26 +385,6 @@ struct util_format_unpack_description {
    (*unpack_s_8uint)(uint8_t *dst, unsigned dst_stride,
                      const uint8_t *src, unsigned src_stride,
                      unsigned width, unsigned height);
-
-   /**
-    * Fetch a single pixel (i, j) from a block.
-    *
-    * Only defined for unsigned (pure) integer formats.
-    */
-   void
-   (*fetch_rgba_uint)(uint32_t *dst,
-                      const uint8_t *src,
-                      unsigned i, unsigned j);
-
-   /**
-    * Fetch a single pixel (i, j) from a block.
-    *
-    * Only defined for signed (pure) integer formats.
-    */
-   void
-   (*fetch_rgba_sint)(int32_t *dst,
-                      const uint8_t *src,
-                      unsigned i, unsigned j);
 };
 
 const struct util_format_description *
index 142e6c8cc28102bf203ba8d93638c44f35849330..5482da3b7ec69370ca2b978f8d27dd815eeac5ce 100644 (file)
@@ -86,7 +86,7 @@ util_format_bptc_rgba_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_strid
 }
 
 void
-util_format_bptc_rgba_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_bptc_rgba_unorm_fetch_rgba(void *dst, const uint8_t *src,
                                              unsigned width, unsigned height)
 {
    uint8_t temp_block[4];
@@ -149,7 +149,7 @@ util_format_bptc_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
 }
 
 void
-util_format_bptc_srgba_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_bptc_srgba_fetch_rgba(void *dst, const uint8_t *src,
                                         unsigned width, unsigned height)
 {
    uint8_t temp_block[4];
@@ -213,7 +213,7 @@ util_format_bptc_rgb_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride
 }
 
 void
-util_format_bptc_rgb_float_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_bptc_rgb_float_fetch_rgba(void *dst, const uint8_t *src,
                                             unsigned width, unsigned height)
 {
    fetch_rgb_float_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
@@ -271,7 +271,7 @@ util_format_bptc_rgb_ufloat_pack_rgba_float(uint8_t *dst_row, unsigned dst_strid
 }
 
 void
-util_format_bptc_rgb_ufloat_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_bptc_rgb_ufloat_fetch_rgba(void *dst, const uint8_t *src,
                                              unsigned width, unsigned height)
 {
    fetch_rgb_float_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
index e093ae3ce36c5d281a2da6e25a24125f30db2fd8..c98a54e902f828b253c08c382cc06f271e99626e 100644 (file)
@@ -53,7 +53,7 @@ util_format_bptc_rgba_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_strid
                                             const float *src_row, unsigned src_stride,
                                             unsigned width, unsigned height);
 void
-util_format_bptc_rgba_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_bptc_rgba_unorm_fetch_rgba(void *dst, const uint8_t *src,
                                              unsigned width, unsigned height);
 
 void
@@ -73,7 +73,7 @@ util_format_bptc_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
                                        const float *src_row, unsigned src_stride,
                                        unsigned width, unsigned height);
 void
-util_format_bptc_srgba_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_bptc_srgba_fetch_rgba(void *dst, const uint8_t *src,
                                         unsigned width, unsigned height);
 
 void
@@ -93,7 +93,7 @@ util_format_bptc_rgb_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride
                                            const float *src_row, unsigned src_stride,
                                            unsigned width, unsigned height);
 void
-util_format_bptc_rgb_float_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_bptc_rgb_float_fetch_rgba(void *dst, const uint8_t *src,
                                             unsigned width, unsigned height);
 
 void
@@ -113,7 +113,7 @@ util_format_bptc_rgb_ufloat_pack_rgba_float(uint8_t *dst_row, unsigned dst_strid
                                             const float *src_row, unsigned src_stride,
                                             unsigned width, unsigned height);
 void
-util_format_bptc_rgb_ufloat_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_bptc_rgb_ufloat_fetch_rgba(void *dst, const uint8_t *src,
                                              unsigned width, unsigned height);
 #ifdef __cplusplus
 }
index 8931242a52d34ad5ccaf8627dd31daeaa89e34a9..bde940e3ce275f9828a51a0de7e98466a35de93f 100644 (file)
@@ -67,8 +67,9 @@ util_format_etc1_rgb8_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned d
 }
 
 void
-util_format_etc1_rgb8_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_etc1_rgb8_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    struct etc1_block block;
    uint8_t tmp[3];
 
index 96795e1aec4f070552b8cbd1cea806908bd80ed3..7093552b5816169702cdf1dbed85095fd6770b9b 100644 (file)
@@ -41,6 +41,6 @@ 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);
 
 void
-util_format_etc1_rgb8_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_etc1_rgb8_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 #endif /* U_FORMAT_ETC1_H_ */
index f5b2a64978750f68e5ea5916a63e6862025fba06..7c96c6601bd8b20e01b9ec50a0b7234cf0980f13 100644 (file)
@@ -88,8 +88,9 @@ util_format_latc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
 }
 
 void
-util_format_latc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_latc1_unorm_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp_r;
 
    util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
@@ -155,8 +156,9 @@ util_format_latc1_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, co
 }
 
 void
-util_format_latc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_latc1_snorm_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    int8_t tmp_r;
 
    util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
@@ -222,8 +224,9 @@ util_format_latc2_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, co
 }
 
 void
-util_format_latc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_latc2_unorm_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp_r, tmp_g;
 
    util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 2);
@@ -292,8 +295,9 @@ util_format_latc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
 }
 
 void
-util_format_latc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_latc2_snorm_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    int8_t tmp_r, tmp_g;
 
    util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
index 1328df6496a5e162c1bd232601e5f2af1699f0a0..d28bb844842347c098671a57544b0277727bf326 100644 (file)
@@ -44,7 +44,7 @@ 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);
 
 void
-util_format_latc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_latc1_unorm_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 
 
@@ -64,7 +64,7 @@ void
 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);
+util_format_latc1_snorm_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 
 void
@@ -83,7 +83,7 @@ void
 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);
+util_format_latc2_unorm_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 
 void
@@ -102,7 +102,7 @@ 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);
 
 void
-util_format_latc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_latc2_snorm_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 
 #endif
index 6dd66c7d346d87eadb7150104ccb8cbf9a8ffc86..bd68966a580f8df013232e51b67be676bd413f08 100644 (file)
@@ -74,9 +74,10 @@ util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride
 }
 
 void
-util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_r9g9b9e5_float_fetch_rgba(void *in_dst, const uint8_t *src,
                                        UNUSED unsigned i, UNUSED unsigned j)
 {
+   float *dst = in_dst;
    uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
    rgb9e5_to_float3(value, dst);
    dst[3] = 1; /* a */
@@ -177,9 +178,10 @@ util_format_r11g11b10_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_strid
 }
 
 void
-util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_r11g11b10_float_fetch_rgba(void *in_dst, const uint8_t *src,
                                         UNUSED unsigned i, UNUSED unsigned j)
 {
+   float *dst = in_dst;
    uint32_t value = util_cpu_to_le32(*(const uint32_t *)src);
    r11g11b10f_to_float3(value, dst);
    dst[3] = 1; /* a */
@@ -362,9 +364,10 @@ util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
 
 
 void
-util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_r8g8bx_snorm_fetch_rgba(void *in_dst, const uint8_t *src,
                                      UNUSED unsigned i, UNUSED unsigned j)
 {
+   float *dst = in_dst;
    uint16_t value = util_cpu_to_le16(*(const uint16_t *)src);
    int16_t r, g;
 
index df9d057754f789064671382db1269c2123743fcb..c02b38a124b06c90baa84954f2271e2acdac459e 100644 (file)
@@ -44,7 +44,7 @@ util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride
                                       unsigned width, unsigned height);
 
 void
-util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_r9g9b9e5_float_fetch_rgba(void *dst, const uint8_t *src,
                                        unsigned i, unsigned j);
 
 void
@@ -69,7 +69,7 @@ util_format_r11g11b10_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_strid
                                       unsigned width, unsigned height);
 
 void
-util_format_r11g11b10_float_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_r11g11b10_float_fetch_rgba(void *dst, const uint8_t *src,
                                        unsigned i, unsigned j);
 
 void
@@ -94,7 +94,7 @@ util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
                                     unsigned width, unsigned height);
 
 void
-util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_r8g8bx_snorm_fetch_rgba(void *dst, const uint8_t *src,
                                      unsigned i, unsigned j);
 
 void
index e2fbc4cce919d045be44ae090c6c7adf36d0b528..7792f44ffde5510acb0956b5fde6f5f4312695cc 100644 (file)
@@ -683,14 +683,15 @@ def generate_format_pack(format, src_channel, src_native_type, src_suffix):
     print()
     
 
-def generate_format_fetch(format, dst_channel, dst_native_type, dst_suffix):
+def generate_format_fetch(format, dst_channel, dst_native_type):
     '''Generate the function to unpack pixels from a particular format'''
 
     name = format.short_name()
 
     print('static inline void')
-    print('util_format_%s_fetch_%s(%s *dst, const uint8_t *src, UNUSED unsigned i, UNUSED unsigned j)' % (name, dst_suffix, dst_native_type))
+    print('util_format_%s_fetch_rgba(void *in_dst, const uint8_t *src, UNUSED unsigned i, UNUSED unsigned j)' % (name))
     print('{')
+    print('   %s *dst = in_dst;' % dst_native_type)
 
     if is_format_supported(format):
         generate_unpack_kernel(format, dst_channel, dst_native_type)
@@ -729,7 +730,7 @@ def generate(formats):
 
                 generate_format_unpack(format, channel, native_type, suffix)
                 generate_format_pack(format, channel, native_type, suffix)
-                generate_format_fetch(format, channel, native_type, suffix)
+                generate_format_fetch(format, channel, native_type)
 
                 channel = Channel(SIGNED, False, True, 32)
                 native_type = 'int'
@@ -742,7 +743,7 @@ def generate(formats):
 
                 generate_format_unpack(format, channel, native_type, suffix)
                 generate_format_pack(format, channel, native_type, suffix)   
-                generate_format_fetch(format, channel, native_type, suffix)
+                generate_format_fetch(format, channel, native_type)
 
                 native_type = 'unsigned'
                 suffix = 'unsigned'
@@ -755,7 +756,7 @@ def generate(formats):
 
                 generate_format_unpack(format, channel, native_type, suffix)
                 generate_format_pack(format, channel, native_type, suffix)
-                generate_format_fetch(format, channel, native_type, suffix)
+                generate_format_fetch(format, channel, native_type)
 
                 channel = Channel(UNSIGNED, True, False, 8)
                 native_type = 'uint8_t'
index 1839dc55e70d95b76c2db3eccba7cedb7f735f1b..fa65a71cd4aec20ab775b6d1df6115ac44effe27 100644 (file)
@@ -133,8 +133,9 @@ util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
 }
 
 void
-util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_rgtc1_unorm_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp_r;
    util_format_unsigned_fetch_texel_rgtc(0, src, i, j, &tmp_r, 1);
    dst[0] = ubyte_to_float(tmp_r);
@@ -214,8 +215,9 @@ util_format_rgtc1_snorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, co
 }
 
 void
-util_format_rgtc1_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_rgtc1_snorm_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    int8_t tmp_r;
    util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 1);
    dst[0] = byte_to_float_tex(tmp_r);
@@ -342,8 +344,9 @@ util_format_rgtc2_unorm_unpack_rgba_float(void *dst_row, unsigned dst_stride, co
 }
 
 void
-util_format_rgtc2_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_rgtc2_unorm_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    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);
@@ -435,8 +438,9 @@ util_format_rgtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
 }
 
 void
-util_format_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_rgtc2_snorm_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    int8_t tmp_r, tmp_g;
    util_format_signed_fetch_texel_rgtc(0, (int8_t *)src, i, j, &tmp_r, 2);
    util_format_signed_fetch_texel_rgtc(0, (int8_t *)src + 8, i, j, &tmp_g, 2);
index 5f5f8151278594ea9151df22a11722a6b4ee4001..1c600428fbf5f0ba99d962fc0efdbeb917271ee7 100644 (file)
@@ -44,7 +44,7 @@ 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);
 
 void
-util_format_rgtc1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_rgtc1_unorm_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 
 
@@ -64,7 +64,7 @@ void
 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);
+util_format_rgtc1_snorm_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 
 void
@@ -86,7 +86,7 @@ void
 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);
+util_format_rgtc2_unorm_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 
 void
@@ -108,7 +108,7 @@ void
 util_format_rgtc2_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_rgtc2_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_rgtc2_snorm_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 
 #endif
index 4f61d614732046f20cd012d1cf68b7c51e384c78..05889a4cc16fce6d97598be3572f40b3b6fb38d3 100644 (file)
@@ -67,8 +67,9 @@ util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsign
 }
 
 void
-util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_dxt1_rgb_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp[4];
    util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
    dst[0] = ubyte_to_float(tmp[0]);
@@ -78,8 +79,9 @@ util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i
 }
 
 void
-util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_dxt1_rgba_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp[4];
    util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
    dst[0] = ubyte_to_float(tmp[0]);
@@ -89,8 +91,9 @@ util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned
 }
 
 void
-util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_dxt3_rgba_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp[4];
    util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
    dst[0] = ubyte_to_float(tmp[0]);
@@ -100,8 +103,9 @@ util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned
 }
 
 void
-util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_dxt5_rgba_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp[4];
    util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
    dst[0] = ubyte_to_float(tmp[0]);
@@ -484,8 +488,9 @@ util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsig
 }
 
 void
-util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_dxt1_srgb_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp[4];
    util_format_dxt1_rgb_fetch(0, src, i, j, tmp);
    dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
@@ -495,8 +500,9 @@ util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned
 }
 
 void
-util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_dxt1_srgba_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp[4];
    util_format_dxt1_rgba_fetch(0, src, i, j, tmp);
    dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
@@ -506,8 +512,9 @@ util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned
 }
 
 void
-util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_dxt3_srgba_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp[4];
    util_format_dxt3_rgba_fetch(0, src, i, j, tmp);
    dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
@@ -517,8 +524,9 @@ util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned
 }
 
 void
-util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j)
+util_format_dxt5_srgba_fetch_rgba(void *in_dst, const uint8_t *src, unsigned i, unsigned j)
 {
+   float *dst = in_dst;
    uint8_t tmp[4];
    util_format_dxt5_rgba_fetch(0, src, i, j, tmp);
    dst[0] = util_format_srgb_8unorm_to_linear_float(tmp[0]);
index c5cb7ad26daeb1d793dc903cf334b4f2ee059ff0..4fe58fb11865f9b903932ca0889dc8b1bb79fd90 100644 (file)
@@ -146,7 +146,7 @@ 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);
 
 void
-util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_dxt1_rgb_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
 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);
@@ -155,7 +155,7 @@ 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);
 
 void
-util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_dxt1_rgba_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
 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);
@@ -164,7 +164,7 @@ 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);
 
 void
-util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_dxt3_rgba_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
 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);
@@ -173,7 +173,7 @@ 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);
 
 void
-util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_dxt5_rgba_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
 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);
@@ -182,7 +182,7 @@ 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);
 
 void
-util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_dxt1_srgb_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
 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);
@@ -191,7 +191,7 @@ 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);
 
 void
-util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_dxt1_srgba_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
 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);
@@ -200,7 +200,7 @@ 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);
 
 void
-util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_dxt3_srgba_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 void
 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);
@@ -209,7 +209,7 @@ 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);
 
 void
-util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j);
+util_format_dxt5_srgba_fetch_rgba(void *dst, const uint8_t *src, unsigned i, unsigned j);
 
 #ifdef __cplusplus
 }
index 3699e025290da8a0abcd3e02b08ad3dec27148ed..7be1d4fdb5bc43afb15fe6998272d66029cd0bdd 100644 (file)
@@ -240,12 +240,14 @@ def write_format_table(formats):
             continue
 
         print("   [%s] = {" % (format.name,))
+        if format.colorspace != ZS:
+            print("      .fetch_rgba = &util_format_%s_fetch_rgba," % sn)
+
         if format.colorspace != ZS and not format.is_pure_color():
             print("      .unpack_rgba_8unorm = &util_format_%s_unpack_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 = &util_format_%s_unpack_rgba_float," % sn)
-            print("      .fetch_rgba_float = &util_format_%s_fetch_rgba_float," % sn)
 
         if format.has_depth():
             print("      .unpack_z_32unorm = &util_format_%s_unpack_z_32unorm," % sn)
@@ -256,10 +258,8 @@ def write_format_table(formats):
 
         if format.is_pure_unsigned():
             print("      .unpack_rgba = &util_format_%s_unpack_unsigned," % sn)
-            print("      .fetch_rgba_uint = &util_format_%s_fetch_unsigned," % sn)
         elif format.is_pure_signed():
             print("      .unpack_rgba = &util_format_%s_unpack_signed," % sn)
-            print("      .fetch_rgba_sint = &util_format_%s_fetch_signed," % sn)
         print("   },")
     print("};")
     print()
index 21d082548c65a3ff7edec55c1a67beabd1d6ef3d..b5f75bdc0cf6c37ce64905d696603c94216c47ee 100644 (file)
@@ -245,9 +245,11 @@ util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
 
 
 void
-util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_r8g8_b8g8_unorm_fetch_rgba(void *in_dst, const uint8_t *src,
                                         unsigned i, ASSERTED unsigned j)
 {
+   float *dst = in_dst;
+
    assert(i < 2);
    assert(j < 1);
 
@@ -465,9 +467,11 @@ util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
 
 
 void
-util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_g8r8_g8b8_unorm_fetch_rgba(void *in_dst, const uint8_t *src,
                                         unsigned i, ASSERTED unsigned j)
 {
+   float *dst = in_dst;
+
    assert(i < 2);
    assert(j < 1);
 
@@ -681,9 +685,10 @@ util_format_uyvy_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
 
 
 void
-util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_uyvy_fetch_rgba(void *in_dst, const uint8_t *src,
                              unsigned i, ASSERTED unsigned j)
 {
+   float *dst = in_dst;
    uint8_t y, u, v;
 
    assert(i < 2);
@@ -902,9 +907,10 @@ util_format_yuyv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
 
 
 void
-util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_yuyv_fetch_rgba(void *in_dst, const uint8_t *src,
                              unsigned i, ASSERTED unsigned j)
 {
+   float *dst = in_dst;
    uint8_t y, u, v;
 
    assert(i < 2);
index 229adac9b3941e8f429f44c60bc6b1c119aa6bc0..20c5176e8ddc9ca4c393e458e5fa0289bfffc658 100644 (file)
@@ -142,7 +142,7 @@ util_format_uyvy_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
                              unsigned width, unsigned height);
 
 void
-util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_uyvy_fetch_rgba(void *dst, const uint8_t *src,
                              unsigned i, unsigned j);
 
 void
@@ -166,7 +166,7 @@ util_format_yuyv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
                              unsigned width, unsigned height);
 
 void
-util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_yuyv_fetch_rgba(void *dst, const uint8_t *src,
                              unsigned i, unsigned j);
 
 void
@@ -190,7 +190,7 @@ util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
                                         unsigned width, unsigned height);
 
 void
-util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_r8g8_b8g8_unorm_fetch_rgba(void *dst, const uint8_t *src,
                                         unsigned i, unsigned j);
 
 void
@@ -214,7 +214,7 @@ util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
                                         unsigned width, unsigned height);
 
 void
-util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
+util_format_g8r8_g8b8_unorm_fetch_rgba(void *dst, const uint8_t *src,
                                         unsigned i, unsigned j);
 
 #endif /* U_FORMAT_YUV_H_ */
index c93199ebd02113a9beb8c16a8eae627eae1f3023..992bf5f3a9529914070357f58d835cb68d37ad52 100644 (file)
@@ -201,7 +201,7 @@ print_unpacked_s_8uint(const struct util_format_description *format_desc,
 
 
 static boolean
-test_format_fetch_rgba_float(const struct util_format_description *format_desc,
+test_format_fetch_rgba(const struct util_format_description *format_desc,
                              const struct util_format_test_case *test)
 {
    const struct util_format_unpack_description *unpack =
@@ -213,7 +213,7 @@ test_format_fetch_rgba_float(const struct util_format_description *format_desc,
    success = TRUE;
    for (i = 0; i < format_desc->block.height; ++i) {
       for (j = 0; j < format_desc->block.width; ++j) {
-         unpack->fetch_rgba_float(unpacked[i][j], test->packed, j, i);
+         unpack->fetch_rgba(unpacked[i][j], test->packed, j, i);
          for (k = 0; k < 4; ++k) {
             if (!compare_float(test->unpacked[i][j][k], unpacked[i][j][k])) {
                success = FALSE;
@@ -818,7 +818,7 @@ test_all(void)
          success = FALSE; \
       } \
 
-      TEST_ONE_UNPACK_FUNC(fetch_rgba_float);
+      TEST_ONE_UNPACK_FUNC(fetch_rgba);
       TEST_ONE_PACK_FUNC(pack_rgba_float);
       TEST_ONE_UNPACK_FUNC(unpack_rgba);
       TEST_ONE_PACK_FUNC(pack_rgba_8unorm);