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>
* 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.
*
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);
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;
* 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 */
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
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
{
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)
{
* 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.
(*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 *
}
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];
}
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];
}
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,
}
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,
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
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
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
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
}
}
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];
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_ */
}
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);
}
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);
}
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);
}
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);
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);
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
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
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
}
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 */
}
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 */
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;
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
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
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
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)
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'
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'
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'
}
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);
}
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);
}
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);
}
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);
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);
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
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
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
}
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]);
}
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]);
}
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]);
}
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]);
}
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]);
}
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]);
}
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]);
}
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]);
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);
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);
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);
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);
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);
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);
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);
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
}
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)
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()
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);
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);
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);
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);
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
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
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
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_ */
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 =
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;
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);