mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 12:50:10 +01:00
util: Share a single function pointer for the 4-byte rgba unpack function.
Everyone wants the same behavior, and this helps shrink the size of our format description tables. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>
This commit is contained in:
parent
a8e7004dc5
commit
b7418270c3
20 changed files with 116 additions and 147 deletions
|
|
@ -47,7 +47,7 @@ nv30_emit_vtxattr(struct nv30_context *nv30, struct pipe_vertex_buffer *vb,
|
|||
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:
|
||||
|
|
|
|||
|
|
@ -341,12 +341,7 @@ util_format_read_4(enum pipe_format format,
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -695,8 +690,8 @@ util_format_translate(enum pipe_format dst_format,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -706,7 +701,7 @@ util_format_translate(enum pipe_format dst_format,
|
|||
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;
|
||||
|
|
@ -715,7 +710,7 @@ util_format_translate(enum pipe_format dst_format,
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -726,7 +721,7 @@ util_format_translate(enum pipe_format dst_format,
|
|||
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;
|
||||
}
|
||||
|
|
@ -737,7 +732,7 @@ util_format_translate(enum pipe_format dst_format,
|
|||
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;
|
||||
|
|
@ -746,7 +741,7 @@ util_format_translate(enum pipe_format dst_format,
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -756,7 +751,7 @@ util_format_translate(enum pipe_format dst_format,
|
|||
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;
|
||||
}
|
||||
|
|
@ -767,7 +762,7 @@ util_format_translate(enum pipe_format dst_format,
|
|||
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;
|
||||
|
|
@ -776,7 +771,7 @@ util_format_translate(enum pipe_format dst_format,
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -274,15 +274,17 @@ struct util_format_description
|
|||
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.
|
||||
|
|
@ -371,33 +373,11 @@ struct util_format_description
|
|||
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,
|
||||
|
|
@ -1473,15 +1453,6 @@ util_format_unpack_s_8uint(enum pipe_format format, uint8_t *dst,
|
|||
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.
|
||||
|
|
@ -1492,12 +1463,7 @@ util_format_unpack_rgba(enum pipe_format format, void *dst,
|
|||
{
|
||||
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
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -121,7 +121,7 @@ util_format_bptc_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -191,7 +191,7 @@ util_format_bptc_rgb_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_strid
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -249,7 +249,7 @@ util_format_bptc_rgb_ufloat_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ util_format_bptc_rgba_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
|
|||
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
|
||||
|
|
@ -65,7 +65,7 @@ util_format_bptc_srgba_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_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
|
||||
|
|
@ -85,7 +85,7 @@ util_format_bptc_rgb_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_strid
|
|||
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
|
||||
|
|
@ -105,7 +105,7 @@ util_format_bptc_rgb_ufloat_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
|
|||
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
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ util_format_etc1_rgb8_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -38,7 +38,7 @@ util_format_etc1_rgb8_unpack_rgba_float(float *dst_row, unsigned dst_stride, con
|
|||
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++) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ void
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ util_format_latc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -66,7 +66,7 @@ util_format_latc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
|
|||
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] =
|
||||
|
|
@ -129,7 +129,7 @@ util_format_latc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -139,7 +139,7 @@ util_format_latc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
|
|||
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] =
|
||||
|
|
@ -195,7 +195,7 @@ util_format_latc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -205,7 +205,7 @@ util_format_latc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
|
|||
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);
|
||||
|
|
@ -259,7 +259,7 @@ util_format_latc2_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigne
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -269,7 +269,7 @@ util_format_latc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ void
|
|||
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);
|
||||
|
|
@ -61,7 +61,7 @@ void
|
|||
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);
|
||||
|
|
@ -80,7 +80,7 @@ void
|
|||
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);
|
||||
|
|
@ -96,7 +96,7 @@ void
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -49,7 +49,7 @@ util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride
|
|||
dst += 4;
|
||||
}
|
||||
src_row += src_stride;
|
||||
dst_row += dst_stride/sizeof(*dst_row);
|
||||
dst_row = (uint8_t *)dst_row + dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_strid
|
|||
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -152,7 +152,7 @@ util_format_r11g11b10_float_unpack_rgba_float(float *dst_row, unsigned dst_strid
|
|||
dst += 4;
|
||||
}
|
||||
src_row += src_stride;
|
||||
dst_row += dst_stride/sizeof(*dst_row);
|
||||
dst_row = (uint8_t *)dst_row + dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
|
|||
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -298,7 +298,7 @@ r8g8bx_derive(int16_t r, int16_t g)
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -321,7 +321,7 @@ util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||
dst += 4;
|
||||
}
|
||||
src_row += src_stride;
|
||||
dst_row += dst_stride/sizeof(*dst_row);
|
||||
dst_row = (uint8_t *)dst_row + dst_stride;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
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);
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_strid
|
|||
|
||||
|
||||
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);
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ util_format_r11g11b10_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stri
|
|||
|
||||
|
||||
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);
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ util_format_r1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -624,8 +624,13 @@ def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
|
|||
|
||||
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):
|
||||
|
|
@ -641,7 +646,7 @@ def generate_format_unpack(format, dst_channel, dst_native_type, dst_suffix):
|
|||
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('}')
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -95,7 +95,7 @@ util_format_rgtc1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
|
|||
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);
|
||||
|
|
@ -189,7 +189,7 @@ util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -198,7 +198,7 @@ util_format_rgtc1_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
|
|||
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);
|
||||
|
|
@ -316,7 +316,7 @@ util_format_rgtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -325,7 +325,7 @@ util_format_rgtc2_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
|
|||
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);
|
||||
|
|
@ -378,7 +378,7 @@ util_format_rgtc2_snorm_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigne
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -387,7 +387,7 @@ util_format_rgtc2_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, c
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ void
|
|||
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);
|
||||
|
|
@ -61,7 +61,7 @@ void
|
|||
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);
|
||||
|
|
@ -83,7 +83,7 @@ void
|
|||
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);
|
||||
|
|
@ -99,7 +99,7 @@ void
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ util_format_dxtn_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -240,7 +240,7 @@ util_format_dxt1_rgb_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -252,7 +252,7 @@ util_format_dxt1_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -264,7 +264,7 @@ util_format_dxt3_rgba_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -568,7 +568,7 @@ util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
|
|||
}
|
||||
|
||||
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,
|
||||
|
|
@ -578,7 +578,7 @@ util_format_dxt1_srgb_unpack_rgba_float(float *dst_row, unsigned dst_stride, con
|
|||
}
|
||||
|
||||
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,
|
||||
|
|
@ -588,7 +588,7 @@ util_format_dxt1_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, co
|
|||
}
|
||||
|
||||
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,
|
||||
|
|
@ -598,7 +598,7 @@ util_format_dxt3_srgba_unpack_rgba_float(float *dst_row, unsigned dst_stride, co
|
|||
}
|
||||
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsig
|
|||
|
||||
|
||||
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);
|
||||
|
|
@ -149,7 +149,7 @@ void
|
|||
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);
|
||||
|
|
@ -158,7 +158,7 @@ void
|
|||
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);
|
||||
|
|
@ -167,7 +167,7 @@ void
|
|||
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);
|
||||
|
|
@ -176,7 +176,7 @@ void
|
|||
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);
|
||||
|
|
@ -185,7 +185,7 @@ void
|
|||
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);
|
||||
|
|
@ -194,7 +194,7 @@ void
|
|||
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);
|
||||
|
|
@ -203,7 +203,7 @@ void
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ def write_format_table(formats):
|
|||
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)
|
||||
|
||||
|
|
@ -194,13 +194,13 @@ def write_format_table(formats):
|
|||
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("};")
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -86,8 +86,8 @@ util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_strid
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
|
|||
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -306,8 +306,8 @@ util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_strid
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -479,7 +479,7 @@ util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
|
|||
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -520,8 +520,8 @@ util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -700,7 +700,7 @@ util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
|
|||
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -741,8 +741,8 @@ util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ util_format_yuv_to_rgb_8unorm(uint8_t y, uint8_t u, uint8_t v,
|
|||
|
||||
|
||||
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);
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src,
|
|||
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);
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src,
|
|||
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);
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src,
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -235,16 +235,16 @@ test_format_fetch_rgba_float(const struct util_format_description *format_desc,
|
|||
|
||||
|
||||
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) {
|
||||
|
|
@ -359,6 +359,9 @@ test_format_unpack_rgba_8unorm(const struct util_format_description *format_desc
|
|||
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);
|
||||
|
|
@ -788,7 +791,7 @@ test_all(void)
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue