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:
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);
}
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;
}
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;
}
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);
}
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;
}
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;
}
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);
}
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;
}
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;
}
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);
}
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.
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,
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.
{
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
}
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
-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
-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
-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)
{
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
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
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
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
}
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;
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++) {
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);
}
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;
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] =
}
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;
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] =
}
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;
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);
}
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;
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);
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);
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);
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);
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);
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)
{
dst += 4;
}
src_row += src_stride;
- dst_row += dst_stride/sizeof(*dst_row);
+ dst_row = (uint8_t *)dst_row + dst_stride;
}
}
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)
{
dst += 4;
}
src_row += src_stride;
- dst_row += dst_stride/sizeof(*dst_row);
+ dst_row = (uint8_t *)dst_row + dst_stride;
}
}
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)
{
}
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)
{
dst += 4;
}
src_row += src_stride;
- dst_row += dst_stride/sizeof(*dst_row);
+ dst_row = (uint8_t *)dst_row + dst_stride;
}
}
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);
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);
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);
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);
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):
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('}')
}
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;
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);
}
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;
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);
}
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;
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);
}
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;
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);
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);
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);
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);
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);
}
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)
{
}
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)
{
}
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)
{
}
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)
{
}
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,
}
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,
}
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,
}
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,
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);
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);
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);
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);
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);
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);
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);
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);
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)
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("};")
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)
{
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;
}
}
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)
{
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;
}
}
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)
{
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;
}
}
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)
{
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;
}
}
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);
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);
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);
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);
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) {
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);
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);