diff --git a/src/mesa/main/format_unpack.h b/src/mesa/main/format_unpack.h index 829505314dd..8b2813fd675 100644 --- a/src/mesa/main/format_unpack.h +++ b/src/mesa/main/format_unpack.h @@ -43,9 +43,12 @@ extern void _mesa_unpack_ubyte_rgba_row(mesa_format format, uint32_t n, const void *src, uint8_t dst[][4]); -void +static inline void _mesa_unpack_uint_rgba_row(mesa_format format, uint32_t n, - const void *src, uint32_t dst[][4]); + const void *src, uint32_t dst[][4]) +{ + util_format_unpack_rgba(format, dst, src, n); +} extern void _mesa_unpack_rgba_block(mesa_format format, diff --git a/src/mesa/main/format_unpack.py b/src/mesa/main/format_unpack.py index 3cae58d0078..2b3acf81819 100644 --- a/src/mesa/main/format_unpack.py +++ b/src/mesa/main/format_unpack.py @@ -68,78 +68,6 @@ for f in formats: rgb_formats.append(f) %> -/* integer packing functions */ - -%for f in rgb_formats: - %if not f.is_int(): - <% continue %> - %elif f.is_normalized(): - <% continue %> - %endif - -static inline void -unpack_int_${f.short_name()}(const void *void_src, uint32_t dst[4]) -{ - ${f.datatype()} *src = (${f.datatype()} *)void_src; - %if f.layout == parser.PACKED: - %for c in f.channels: - %if c.type != 'x': - ${c.datatype()} ${c.name} = UNPACK(*src, ${c.shift}, ${c.size}); - %endif - %endfor - %elif f.layout == parser.ARRAY: - %for (i, c) in enumerate(f.channels): - %if c.type != 'x': - ${c.datatype()} ${c.name} = src[${i}]; - %endif - %endfor - %else: - <% assert False %> - %endif - - %for i in range(4): - <% s = f.swizzle[i] %> - %if 0 <= s and s <= parser.Swizzle.SWIZZLE_W: - dst[${i}] = ${f.channels[s].name}; - %elif s == parser.Swizzle.SWIZZLE_ZERO: - dst[${i}] = 0; - %elif s == parser.Swizzle.SWIZZLE_ONE: - dst[${i}] = 1; - %else: - <% assert False %> - %endif - %endfor -} -%endfor - - -void -_mesa_unpack_uint_rgba_row(mesa_format format, uint32_t n, - const void *src, uint32_t dst[][4]) -{ - uint8_t *s = (uint8_t *)src; - uint32_t i; - - switch (format) { -%for f in rgb_formats: - %if not f.is_int(): - <% continue %> - %elif f.is_normalized(): - <% continue %> - %endif - - case ${f.name}: - for (i = 0; i < n; ++i) { - unpack_int_${f.short_name()}(s, dst[i]); - s += ${f.block_size() // 8}; - } - break; -%endfor - default: - unreachable("bad format"); - } -} - /** Helper struct for MESA_FORMAT_Z32_FLOAT_S8X24_UINT */ struct z32f_x24s8