x32_s8_get_tile_rgba((unsigned *) packed, w, h, dst, dst_stride);
break;
default:
- if (util_format_is_pure_uint(format)) {
- util_format_read_4ui(format,
- dst, dst_stride * sizeof(float),
- packed, util_format_get_stride(format, w),
- 0, 0, w, h);
- } else if (util_format_is_pure_sint(format)) {
- util_format_read_4i(format,
- dst, dst_stride * sizeof(float),
- packed, util_format_get_stride(format, w),
- 0, 0, w, h);
- } else {
- util_format_read_4f(format,
- dst, dst_stride * sizeof(float),
- packed, util_format_get_stride(format, w),
- 0, 0, w, h);
- }
+ util_format_read_4(format,
+ dst, dst_stride * sizeof(float),
+ packed, util_format_get_stride(format, w),
+ 0, 0, w, h);
}
FREE(packed);
offset = get_image_offset(spr, iview, params->format, r_coord);
data_ptr = (char *)spr->data + offset;
- if (util_format_is_pure_sint(params->format)) {
- int32_t sdata[4];
-
- util_format_read_4i(params->format,
- sdata, 0,
- data_ptr, stride,
- s_coord, t_coord, 1, 1);
- for (c = 0; c < 4; c++)
- ((int32_t *)rgba[c])[j] = sdata[c];
- } else if (util_format_is_pure_uint(params->format)) {
- uint32_t sdata[4];
- util_format_read_4ui(params->format,
- sdata, 0,
- data_ptr, stride,
- s_coord, t_coord, 1, 1);
- for (c = 0; c < 4; c++)
- ((uint32_t *)rgba[c])[j] = sdata[c];
- } else {
- float sdata[4];
- util_format_read_4f(params->format,
- sdata, 0,
- data_ptr, stride,
- s_coord, t_coord, 1, 1);
- for (c = 0; c < 4; c++)
- rgba[c][j] = sdata[c];
- }
+ uint32_t sdata[4];
+ util_format_read_4(params->format,
+ sdata, 0,
+ data_ptr, stride,
+ s_coord, t_coord, 1, 1);
+ for (c = 0; c < 4; c++)
+ ((uint32_t *)rgba[c])[j] = sdata[c];
}
return;
fail_write_all_zero:
int nc = util_format_get_nr_components(params->format);
unsigned sdata[4];
- util_format_read_4ui(params->format,
- sdata, 0,
- data_ptr, stride,
- s, t, 1, 1);
+ util_format_read_4(params->format,
+ sdata, 0,
+ data_ptr, stride,
+ s, t, 1, 1);
if (just_read) {
for (c = 0; c < nc; c++) {
uint c;
int nc = util_format_get_nr_components(params->format);
int sdata[4];
- util_format_read_4i(params->format,
- sdata, 0,
- data_ptr, stride,
- s, t, 1, 1);
+ util_format_read_4(params->format,
+ sdata, 0,
+ data_ptr, stride,
+ s, t, 1, 1);
if (just_read) {
for (c = 0; c < nc; c++) {
float sdata[4];
uint c;
int nc = 1;
- util_format_read_4f(params->format,
- sdata, 0,
- data_ptr, stride,
- s, t, 1, 1);
+ util_format_read_4(params->format,
+ sdata, 0,
+ data_ptr, stride,
+ s, t, 1, 1);
if (just_read) {
for (c = 0; c < nc; c++) {
((int32_t *)rgba[c])[qi] = sdata[c];
void
-util_format_read_4f(enum pipe_format format,
- float *dst, unsigned dst_stride,
- const void *src, unsigned src_stride,
- unsigned x, unsigned y, unsigned w, unsigned h)
+util_format_read_4(enum pipe_format format,
+ void *dst, unsigned dst_stride,
+ const void *src, unsigned src_stride,
+ unsigned x, unsigned y, unsigned w, unsigned h)
{
const struct util_format_description *format_desc;
const uint8_t *src_row;
- float *dst_row;
format_desc = util_format_description(format);
assert(y % format_desc->block.height == 0);
src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
- dst_row = dst;
- format_desc->unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, w, h);
+ 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->pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, w, h);
}
-void
-util_format_read_4ui(enum pipe_format format,
- unsigned *dst, unsigned dst_stride,
- const void *src, unsigned src_stride,
- unsigned x, unsigned y, unsigned w, unsigned h)
-{
- const struct util_format_description *format_desc;
- const uint8_t *src_row;
- uint32_t *dst_row;
-
- format_desc = util_format_description(format);
-
- assert(x % format_desc->block.width == 0);
- assert(y % format_desc->block.height == 0);
-
- src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
- dst_row = dst;
-
- format_desc->unpack_rgba_uint(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
-void
-util_format_read_4i(enum pipe_format format,
- int *dst, unsigned dst_stride,
- const void *src, unsigned src_stride,
- unsigned x, unsigned y, unsigned w, unsigned h)
-{
- const struct util_format_description *format_desc;
- const uint8_t *src_row;
- int32_t *dst_row;
-
- format_desc = util_format_description(format);
-
- assert(x % format_desc->block.width == 0);
- assert(y % format_desc->block.height == 0);
-
- src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8);
- dst_row = dst;
-
- format_desc->unpack_rgba_sint(dst_row, dst_stride, src_row, src_stride, w, h);
-}
-
/**
* Check if we can safely memcopy from the source format to the dest format.
* This basically covers the cases of a "used" channel copied to a typeless
*/
void
-util_format_read_4f(enum pipe_format format,
- float *dst, unsigned dst_stride,
- const void *src, unsigned src_stride,
- unsigned x, unsigned y, unsigned w, unsigned h);
+util_format_read_4(enum pipe_format format,
+ void *dst, unsigned dst_stride,
+ const void *src, unsigned src_stride,
+ unsigned x, unsigned y, unsigned w, unsigned h);
void
util_format_write_4(enum pipe_format format,
void *dst, unsigned dst_stride,
unsigned x, unsigned y, unsigned w, unsigned h);
-void
-util_format_read_4ui(enum pipe_format format,
- unsigned *dst, unsigned dst_stride,
- const void *src, unsigned src_stride,
- unsigned x, unsigned y, unsigned w, unsigned h);
-
-void
-util_format_read_4i(enum pipe_format format,
- int *dst, unsigned dst_stride,
- const void *src, unsigned src_stride,
- unsigned x, unsigned y, unsigned w, unsigned h);
-
/*
* Generic format conversion;
*/
decompress_rgba_unorm(width, height,
src_row, src_stride,
temp_block, width * 4 * sizeof(uint8_t));
- util_format_read_4f(PIPE_FORMAT_R8G8B8A8_UNORM,
- dst_row, dst_stride,
- temp_block, width * 4 * sizeof(uint8_t),
- 0, 0, width, height);
+ util_format_read_4(PIPE_FORMAT_R8G8B8A8_UNORM,
+ dst_row, dst_stride,
+ temp_block, width * 4 * sizeof(uint8_t),
+ 0, 0, width, height);
free((void *) temp_block);
}
fetch_rgba_unorm_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
temp_block, (width % 4) + (height % 4) * 4);
- util_format_read_4f(PIPE_FORMAT_R8G8B8A8_UNORM,
- dst, 4 * sizeof(float),
- temp_block, 4 * sizeof(uint8_t),
- 0, 0, 1, 1);
+ util_format_read_4(PIPE_FORMAT_R8G8B8A8_UNORM,
+ dst, 4 * sizeof(float),
+ temp_block, 4 * sizeof(uint8_t),
+ 0, 0, 1, 1);
}
void
decompress_rgba_unorm(width, height,
src_row, src_stride,
temp_block, width * 4 * sizeof(uint8_t));
- util_format_read_4f(PIPE_FORMAT_R8G8B8A8_SRGB,
- dst_row, dst_stride,
- temp_block, width * 4 * sizeof(uint8_t),
- 0, 0, width, height);
+ util_format_read_4(PIPE_FORMAT_R8G8B8A8_SRGB,
+ dst_row, dst_stride,
+ temp_block, width * 4 * sizeof(uint8_t),
+ 0, 0, width, height);
free((void *) temp_block);
}
fetch_rgba_unorm_from_block(src + ((width * sizeof(uint8_t)) * (height / 4) + (width / 4)) * 16,
temp_block, (width % 4) + (height % 4) * 4);
- util_format_read_4f(PIPE_FORMAT_R8G8B8A8_SRGB,
- dst, 4 * sizeof(float),
- temp_block, width * 4 * sizeof(uint8_t),
- 0, 0, 1, 1);
+ util_format_read_4(PIPE_FORMAT_R8G8B8A8_SRGB,
+ dst, 4 * sizeof(float),
+ temp_block, width * 4 * sizeof(uint8_t),
+ 0, 0, 1, 1);
}
void