From d3808b1b1f34dbb826b99102786d94e1baf9d667 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 9 Apr 2010 14:03:02 +0100 Subject: [PATCH] util: Add dedicated depth-stencil packing/unpacking functions. Depth-stencil manually written given that each one is very close to be a special case. u_format_zs.c's still untested. --- progs/gallium/unit/u_format_test.c | 40 +- src/gallium/auxiliary/Makefile | 1 + src/gallium/auxiliary/SConscript | 1 + .../auxiliary/gallivm/lp_bld_format_soa.c | 10 +- src/gallium/auxiliary/util/u_format.c | 24 +- src/gallium/auxiliary/util/u_format.h | 101 +- src/gallium/auxiliary/util/u_format_other.c | 30 +- src/gallium/auxiliary/util/u_format_other.h | 30 +- src/gallium/auxiliary/util/u_format_pack.py | 59 +- src/gallium/auxiliary/util/u_format_s3tc.c | 144 +-- src/gallium/auxiliary/util/u_format_s3tc.h | 96 +- src/gallium/auxiliary/util/u_format_table.py | 33 +- src/gallium/auxiliary/util/u_format_yuv.c | 40 +- src/gallium/auxiliary/util/u_format_yuv.h | 40 +- src/gallium/auxiliary/util/u_format_zs.c | 893 ++++++++++++++++++ src/gallium/auxiliary/util/u_format_zs.h | 196 ++++ 16 files changed, 1457 insertions(+), 281 deletions(-) create mode 100644 src/gallium/auxiliary/util/u_format_zs.c create mode 100644 src/gallium/auxiliary/util/u_format_zs.h diff --git a/progs/gallium/unit/u_format_test.c b/progs/gallium/unit/u_format_test.c index f4891720017..d404fb598bc 100644 --- a/progs/gallium/unit/u_format_test.c +++ b/progs/gallium/unit/u_format_test.c @@ -133,8 +133,8 @@ print_unpacked_8unorm(const struct util_format_description *format_desc, static boolean -test_format_fetch_float(const struct util_format_description *format_desc, - const struct util_format_test_case *test) +test_format_fetch_rgba_float(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; @@ -143,7 +143,7 @@ test_format_fetch_float(const struct util_format_description *format_desc, success = TRUE; for (i = 0; i < format_desc->block.height; ++i) { for (j = 0; j < format_desc->block.width; ++j) { - format_desc->fetch_float(unpacked[i][j], test->packed, j, i); + format_desc->fetch_rgba_float(unpacked[i][j], test->packed, j, i); for (k = 0; k < 4; ++k) { if (!compare_float(test->unpacked[i][j][k], unpacked[i][j][k])) { success = FALSE; @@ -162,14 +162,14 @@ test_format_fetch_float(const struct util_format_description *format_desc, static boolean -test_format_unpack_float(const struct util_format_description *format_desc, - const struct util_format_test_case *test) +test_format_unpack_rgba_float(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_float(&unpacked[0][0][0], sizeof unpacked[0], + format_desc->unpack_rgba_float(&unpacked[0][0][0], sizeof unpacked[0], test->packed, 0, format_desc->block.width, format_desc->block.height); @@ -195,8 +195,8 @@ test_format_unpack_float(const struct util_format_description *format_desc, static boolean -test_format_pack_float(const struct util_format_description *format_desc, - const struct util_format_test_case *test) +test_format_pack_rgba_float(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]; uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES]; @@ -221,7 +221,7 @@ test_format_pack_float(const struct util_format_description *format_desc, } } - format_desc->pack_float(packed, 0, + format_desc->pack_rgba_float(packed, 0, &unpacked[0][0][0], sizeof unpacked[0], format_desc->block.width, format_desc->block.height); @@ -264,15 +264,15 @@ convert_float_to_8unorm(uint8_t *dst, const double *src) static boolean -test_format_unpack_8unorm(const struct util_format_description *format_desc, - const struct util_format_test_case *test) +test_format_unpack_rgba_8unorm(const struct util_format_description *format_desc, + const struct util_format_test_case *test) { uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } }; uint8_t expected[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4] = { { { 0 } } }; unsigned i, j, k; boolean success; - format_desc->unpack_8unorm(&unpacked[0][0][0], sizeof unpacked[0], + format_desc->unpack_rgba_8unorm(&unpacked[0][0][0], sizeof unpacked[0], test->packed, 0, format_desc->block.width, format_desc->block.height); @@ -299,8 +299,8 @@ test_format_unpack_8unorm(const struct util_format_description *format_desc, static boolean -test_format_pack_8unorm(const struct util_format_description *format_desc, - const struct util_format_test_case *test) +test_format_pack_rgba_8unorm(const struct util_format_description *format_desc, + const struct util_format_test_case *test) { uint8_t unpacked[UTIL_FORMAT_MAX_UNPACKED_HEIGHT][UTIL_FORMAT_MAX_UNPACKED_WIDTH][4]; uint8_t packed[UTIL_FORMAT_MAX_PACKED_BYTES]; @@ -325,7 +325,7 @@ test_format_pack_8unorm(const struct util_format_description *format_desc, memset(packed, 0, sizeof packed); - format_desc->pack_8unorm(packed, 0, + format_desc->pack_rgba_8unorm(packed, 0, &unpacked[0][0][0], sizeof unpacked[0], format_desc->block.width, format_desc->block.height); @@ -389,19 +389,19 @@ test_all(void) { bool success = TRUE; - if (!test_one(&test_format_fetch_float, "fetch_float")) + if (!test_one(&test_format_fetch_rgba_float, "fetch_rgba_float")) success = FALSE; - if (!test_one(&test_format_pack_float, "pack_float")) + if (!test_one(&test_format_pack_rgba_float, "pack_rgba_float")) success = FALSE; - if (!test_one(&test_format_unpack_float, "unpack_float")) + if (!test_one(&test_format_unpack_rgba_float, "unpack_rgba_float")) success = FALSE; - if (!test_one(&test_format_pack_8unorm, "pack_8unorm")) + if (!test_one(&test_format_pack_rgba_8unorm, "pack_rgba_8unorm")) success = FALSE; - if (!test_one(&test_format_unpack_8unorm, "unpack_8unorm")) + if (!test_one(&test_format_unpack_rgba_8unorm, "unpack_rgba_8unorm")) success = FALSE; return success; diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 8d0ed67d949..050c7043c39 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -112,6 +112,7 @@ C_SOURCES = \ util/u_format_table.c \ util/u_format_tests.c \ util/u_format_yuv.c \ + util/u_format_zs.c \ util/u_gen_mipmap.c \ util/u_half.c \ util/u_handle_table.c \ diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript index cadf2460586..c23fbdf70a5 100644 --- a/src/gallium/auxiliary/SConscript +++ b/src/gallium/auxiliary/SConscript @@ -161,6 +161,7 @@ source = [ 'util/u_format_table.c', 'util/u_format_tests.c', 'util/u_format_yuv.c', + 'util/u_format_zs.c', 'util/u_gen_mipmap.c', 'util/u_half.c', 'util/u_handle_table.c', diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c index 459a6bfe3fe..2b66162eb40 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c @@ -307,7 +307,7 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder, } else { /* - * Fallback to calling util_format_description::fetch_float for each + * Fallback to calling util_format_description::fetch_rgba_float for each * pixel. * * This is definitely not the most efficient way of fetching pixels, as @@ -324,10 +324,10 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder, assert(type.floating); - util_snprintf(name, sizeof name, "util_format_%s_fetch_float", format_desc->short_name); + util_snprintf(name, sizeof name, "util_format_%s_fetch_rgba_float", format_desc->short_name); /* - * Declare and bind format_desc->fetch_float(). + * Declare and bind format_desc->fetch_rgba_float(). */ function = LLVMGetNamedFunction(module, name); @@ -348,7 +348,7 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder, assert(LLVMIsDeclaration(function)); - LLVMAddGlobalMapping(lp_build_engine, function, format_desc->fetch_float); + LLVMAddGlobalMapping(lp_build_engine, function, format_desc->fetch_rgba_float); } for (chan = 0; chan < 4; ++chan) { @@ -361,7 +361,7 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder, ""); /* - * Invoke format_desc->fetch_float() for each pixel and insert the result + * Invoke format_desc->fetch_rgba_float() for each pixel and insert the result * in the SoA vectors. */ diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c index 418b354a964..663325764ea 100644 --- a/src/gallium/auxiliary/util/u_format.c +++ b/src/gallium/auxiliary/util/u_format.c @@ -56,7 +56,7 @@ util_format_read_4f(enum pipe_format format, src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8); dst_row = dst; - format_desc->unpack_float(dst_row, dst_stride, src_row, src_stride, w, h); + format_desc->unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, w, h); } @@ -78,7 +78,7 @@ util_format_write_4f(enum pipe_format format, dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8); src_row = src; - format_desc->pack_float(dst_row, dst_stride, src_row, src_stride, w, h); + format_desc->pack_rgba_float(dst_row, dst_stride, src_row, src_stride, w, h); } @@ -97,7 +97,7 @@ util_format_read_4ub(enum pipe_format format, uint8_t *dst, unsigned dst_stride, src_row = (const uint8_t *)src + y*src_stride + x*(format_desc->block.bits/8); dst_row = dst; - format_desc->unpack_8unorm(dst_row, dst_stride, src_row, src_stride, w, h); + format_desc->unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, w, h); } @@ -116,7 +116,7 @@ util_format_write_4ub(enum pipe_format format, const uint8_t *src, unsigned src_ dst_row = (uint8_t *)dst + y*dst_stride + x*(format_desc->block.bits/8); src_row = src; - format_desc->pack_8unorm(dst_row, dst_stride, src_row, src_stride, w, h); + format_desc->pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, w, h); } @@ -242,8 +242,8 @@ util_format_translate(enum pipe_format dst_format, return; while (height >= y_step) { - src_format_desc->unpack_8unorm(tmp_row, tmp_stride, src_row, src_stride, width, y_step); - dst_format_desc->pack_8unorm(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step); + src_format_desc->unpack_rgba_8unorm(tmp_row, tmp_stride, src_row, src_stride, width, y_step); + dst_format_desc->pack_rgba_8unorm(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step); dst_row += dst_step; src_row += src_step; @@ -251,8 +251,8 @@ util_format_translate(enum pipe_format dst_format, } if (height) { - src_format_desc->unpack_8unorm(tmp_row, tmp_stride, src_row, src_stride, width, height); - dst_format_desc->pack_8unorm(dst_row, dst_stride, tmp_row, tmp_stride, width, height); + src_format_desc->unpack_rgba_8unorm(tmp_row, tmp_stride, src_row, src_stride, width, height); + dst_format_desc->pack_rgba_8unorm(dst_row, dst_stride, tmp_row, tmp_stride, width, height); } FREE(tmp_row); @@ -267,8 +267,8 @@ util_format_translate(enum pipe_format dst_format, return; while (height >= y_step) { - src_format_desc->unpack_float(tmp_row, tmp_stride, src_row, src_stride, width, y_step); - dst_format_desc->pack_float(dst_row, dst_stride, tmp_row, tmp_stride, width, y_step); + src_format_desc->unpack_rgba_float(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; src_row += src_step; @@ -276,8 +276,8 @@ util_format_translate(enum pipe_format dst_format, } if (height) { - src_format_desc->unpack_float(tmp_row, tmp_stride, src_row, src_stride, width, height); - dst_format_desc->pack_float(dst_row, dst_stride, tmp_row, tmp_stride, width, height); + src_format_desc->unpack_rgba_float(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); } FREE(tmp_row); diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index a7c24f0c002..c96a39dc096 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -192,43 +192,114 @@ struct util_format_description /** * Unpack pixel blocks to R8G8B8A8_UNORM. + * + * Only defined for non-depth-stencil formats. */ void - (*unpack_8unorm)(uint8_t *dst, unsigned dst_stride, - const uint8_t *src, unsigned src_stride, - unsigned width, unsigned height); + (*unpack_rgba_8unorm)(uint8_t *dst, unsigned dst_stride, + const uint8_t *src, unsigned src_stride, + unsigned width, unsigned height); /** * Pack pixel blocks from R8G8B8A8_UNORM. + * + * Only defined for non-depth-stencil formats. */ void - (*pack_8unorm)(uint8_t *dst, unsigned dst_stride, - const uint8_t *src, unsigned src_stride, - unsigned width, unsigned height); + (*pack_rgba_8unorm)(uint8_t *dst, unsigned dst_stride, + const uint8_t *src, unsigned src_stride, + unsigned width, unsigned height); /** * Unpack pixel blocks to R32G32B32A32_FLOAT. + * + * Only defined for non-depth-stencil formats. */ void - (*unpack_float)(float *dst, unsigned dst_stride, - const uint8_t *src, unsigned src_stride, - unsigned width, unsigned height); + (*unpack_rgba_float)(float *dst, unsigned dst_stride, + const uint8_t *src, unsigned src_stride, + unsigned width, unsigned height); /** * Pack pixel blocks from R32G32B32A32_FLOAT. + * + * Only defined for non-depth-stencil formats. */ void - (*pack_float)(uint8_t *dst, unsigned dst_stride, - const float *src, unsigned src_stride, - unsigned width, unsigned height); + (*pack_rgba_float)(uint8_t *dst, unsigned dst_stride, + const float *src, unsigned src_stride, + unsigned width, unsigned height); /** * Fetch a single pixel (i, j) from a block. + * + * Only defined for non-depth-stencil formats. + */ + void + (*fetch_rgba_float)(float *dst, + const uint8_t *src, + unsigned i, unsigned j); + + /** + * Unpack pixels to Z32_UNORM. + * + * Only defined for depth formats. + */ + void + (*unpack_z_32unorm)(uint32_t *dst, unsigned dst_stride, + const uint8_t *src, unsigned src_stride, + unsigned width, unsigned height); + + /** + * Pack pixels from Z32_FLOAT. + * + * Only defined for depth formats. + */ + void + (*pack_z_32unorm)(uint8_t *dst, unsigned dst_stride, + const uint32_t *src, unsigned src_stride, + unsigned width, unsigned height); + + /** + * Unpack pixels to Z32_FLOAT. + * + * Only defined for depth formats. + */ + void + (*unpack_z_float)(float *dst, unsigned dst_stride, + const uint8_t *src, unsigned src_stride, + unsigned width, unsigned height); + + /** + * Pack pixels from Z32_FLOAT. + * + * Only defined for depth formats. + */ + void + (*pack_z_float)(uint8_t *dst, unsigned dst_stride, + const float *src, unsigned src_stride, + unsigned width, unsigned height); + + /** + * Unpack pixels to S8_USCALED. + * + * Only defined for stencil formats. + */ + void + (*unpack_s_32unorm)(uint8_t *dst, unsigned dst_stride, + const uint8_t *src, unsigned src_stride, + unsigned width, unsigned height); + + /** + * Pack pixels from S8_USCALED. + * + * Only defined for stencil formats. */ void - (*fetch_float)(float *dst, - const uint8_t *src, - unsigned i, unsigned j); + (*pack_s_8uscaled)(uint8_t *dst, unsigned dst_stride, + const uint8_t *src, unsigned src_stride, + unsigned width, unsigned height); + }; diff --git a/src/gallium/auxiliary/util/u_format_other.c b/src/gallium/auxiliary/util/u_format_other.c index cecbe5e5a12..723fa8c3bf9 100644 --- a/src/gallium/auxiliary/util/u_format_other.c +++ b/src/gallium/auxiliary/util/u_format_other.c @@ -31,7 +31,7 @@ void -util_format_r9g9b9e5_float_unpack_float(float *dst_row, unsigned dst_stride, +util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -39,7 +39,7 @@ util_format_r9g9b9e5_float_unpack_float(float *dst_row, unsigned dst_stride, } void -util_format_r9g9b9e5_float_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_r9g9b9e5_float_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -47,7 +47,7 @@ util_format_r9g9b9e5_float_pack_float(uint8_t *dst_row, unsigned dst_stride, } void -util_format_r9g9b9e5_float_fetch_float(float *dst, const uint8_t *src, +util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { @@ -55,7 +55,7 @@ util_format_r9g9b9e5_float_fetch_float(float *dst, const uint8_t *src, void -util_format_r9g9b9e5_float_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r9g9b9e5_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -64,7 +64,7 @@ util_format_r9g9b9e5_float_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_r9g9b9e5_float_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r9g9b9e5_float_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -73,7 +73,7 @@ util_format_r9g9b9e5_float_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_r1_unorm_unpack_float(float *dst_row, unsigned dst_stride, +util_format_r1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -82,7 +82,7 @@ util_format_r1_unorm_unpack_float(float *dst_row, unsigned dst_stride, void -util_format_r1_unorm_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_r1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -91,7 +91,7 @@ util_format_r1_unorm_pack_float(uint8_t *dst_row, unsigned dst_stride, void -util_format_r1_unorm_fetch_float(float *dst, const uint8_t *src, +util_format_r1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { @@ -99,7 +99,7 @@ util_format_r1_unorm_fetch_float(float *dst, const uint8_t *src, void -util_format_r1_unorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r1_unorm_unpack_rgba_8unorm(uint8_t *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_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_r1_unorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -123,7 +123,7 @@ util_format_r1_unorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_r8g8bx_snorm_unpack_float(float *dst_row, unsigned dst_stride, +util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -156,7 +156,7 @@ util_format_r8g8bx_snorm_unpack_float(float *dst_row, unsigned dst_stride, void -util_format_r8g8bx_snorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -188,7 +188,7 @@ util_format_r8g8bx_snorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_r8g8bx_snorm_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8bx_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -217,7 +217,7 @@ util_format_r8g8bx_snorm_pack_float(uint8_t *dst_row, unsigned dst_stride, void -util_format_r8g8bx_snorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -247,7 +247,7 @@ util_format_r8g8bx_snorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_r8g8bx_snorm_fetch_float(float *dst, const uint8_t *src, +util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { uint16_t value = *(const uint16_t *)src; diff --git a/src/gallium/auxiliary/util/u_format_other.h b/src/gallium/auxiliary/util/u_format_other.h index a46d698188c..98c97be33fa 100644 --- a/src/gallium/auxiliary/util/u_format_other.h +++ b/src/gallium/auxiliary/util/u_format_other.h @@ -34,74 +34,74 @@ void -util_format_r9g9b9e5_float_unpack_float(float *dst_row, unsigned dst_stride, +util_format_r9g9b9e5_float_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_r9g9b9e5_float_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_r9g9b9e5_float_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_fetch_float(float *dst, const uint8_t *src, +util_format_r9g9b9e5_float_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_r9g9b9e5_float_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r9g9b9e5_float_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_r9g9b9e5_float_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r9g9b9e5_float_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_r1_unorm_unpack_float(float *dst_row, unsigned dst_stride, +util_format_r1_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_r1_unorm_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_r1_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_r1_unorm_fetch_float(float *dst, const uint8_t *src, +util_format_r1_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_r1_unorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r1_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_r1_unorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r1_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_r8g8bx_snorm_unpack_float(float *dst_row, unsigned dst_stride, +util_format_r8g8bx_snorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_r8g8bx_snorm_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8bx_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_r8g8bx_snorm_fetch_float(float *dst, const uint8_t *src, +util_format_r8g8bx_snorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_r8g8bx_snorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8bx_snorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_r8g8bx_snorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8bx_snorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py index 06831d1e192..7c5fa9c00a1 100644 --- a/src/gallium/auxiliary/util/u_format_pack.py +++ b/src/gallium/auxiliary/util/u_format_pack.py @@ -46,12 +46,21 @@ from u_format_parse import * def generate_format_type(format): '''Generate a structure that describes the format.''' + assert format.layout == PLAIN + print 'union util_format_%s {' % format.short_name() - if format.is_bitmask() or format.short_name() == "r11g11b10_float": + + if format.block_size() in (8, 16, 32, 64): print ' uint%u_t value;' % (format.block_size(),) + + use_bitfields = False + for channel in format.channels: + if channel.size % 8 or not is_pot(channel.size): + use_bitfields = True + print ' struct {' for channel in format.channels: - if (format.is_bitmask() or format.is_mixed()) and not format.is_array() or format.short_name() == "r11g11b10_float": + if use_bitfields: if channel.type == VOID: if channel.size: print ' unsigned %s:%u;' % (channel.name, channel.size) @@ -60,7 +69,9 @@ def generate_format_type(format): elif channel.type in (SIGNED, FIXED): print ' int %s:%u;' % (channel.name, channel.size) elif channel.type == FLOAT: - if channel.size == 32: + if channel.size == 64: + print ' double %s;' % (channel.name) + elif channel.size == 32: print ' float %s;' % (channel.name) else: print ' unsigned %s:%u;' % (channel.name, channel.size) @@ -116,10 +127,6 @@ def is_format_supported(format): if channel.type == FLOAT and channel.size not in (16, 32, 64): return False - # We can only read a color from a depth/stencil format if the depth channel is present - if format.colorspace == 'zs' and format.swizzles[0] == SWIZZLE_NONE: - return False - return True @@ -442,11 +449,6 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type): value = '0' else: assert False - if format.colorspace == ZS: - if i == 3: - value = get_one(dst_channel) - elif i >= 1: - value = 'dst[0]' print ' dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i]) else: @@ -475,11 +477,6 @@ def generate_unpack_kernel(format, dst_channel, dst_native_type): value = '0' else: assert False - if format.colorspace == ZS: - if i == 3: - value = get_one(dst_channel) - elif i >= 1: - value = 'dst[0]' print ' dst[%u] = %s; /* %s */' % (i, value, 'rgba'[i]) @@ -511,11 +508,6 @@ def generate_pack_kernel(format, src_channel, src_native_type): dst_channel, dst_native_type, value, dst_colorspace = dst_colorspace) - if format.colorspace == ZS: - if i == 3: - value = get_one(dst_channel) - elif i >= 1: - value = '0' if dst_channel.type in (UNSIGNED, SIGNED): if shift + dst_channel.size < depth: value = '(%s) & 0x%x' % (value, (1 << dst_channel.size) - 1) @@ -555,11 +547,6 @@ def generate_pack_kernel(format, src_channel, src_native_type): dst_channel, dst_native_type, value, dst_colorspace = dst_colorspace) - if format.colorspace == ZS: - if i == 3: - value = get_one(dst_channel) - elif i >= 1: - value = '0' print ' pixel.chan.%s = %s;' % (dst_channel.name, value) bswap_format(format) @@ -641,27 +628,30 @@ def generate_format_fetch(format, dst_channel, dst_native_type, dst_suffix): def is_format_hand_written(format): - return format.layout in ('s3tc', 'subsampled', 'other') + return format.layout in ('s3tc', 'subsampled', 'other') or format.colorspace == ZS + def generate(formats): print print '#include "pipe/p_compiler.h"' print '#include "u_math.h"' + print '#include "u_half.h"' print '#include "u_format.h"' print '#include "u_format_other.h"' print '#include "u_format_srgb.h"' print '#include "u_format_yuv.h"' - print '#include "u_half.h"' + print '#include "u_format_zs.h"' print for format in formats: - if is_format_supported(format): - generate_format_type(format) - if not is_format_hand_written(format): + + if is_format_supported(format): + generate_format_type(format) + channel = Channel(FLOAT, False, 32) native_type = 'float' - suffix = 'float' + suffix = 'rgba_float' generate_format_unpack(format, channel, native_type, suffix) generate_format_pack(format, channel, native_type, suffix) @@ -669,7 +659,8 @@ def generate(formats): channel = Channel(UNSIGNED, True, 8) native_type = 'uint8_t' - suffix = '8unorm' + suffix = 'rgba_8unorm' generate_format_unpack(format, channel, native_type, suffix) generate_format_pack(format, channel, native_type, suffix) + diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c index 35950ee47a5..79dee2b4238 100644 --- a/src/gallium/auxiliary/util/u_format_s3tc.c +++ b/src/gallium/auxiliary/util/u_format_s3tc.c @@ -161,31 +161,31 @@ util_format_s3tc_init(void) */ void -util_format_dxt1_rgb_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { util_format_dxt1_rgb_fetch(0, src, i, j, dst); } void -util_format_dxt1_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { util_format_dxt1_rgba_fetch(0, src, i, j, dst); } void -util_format_dxt3_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { util_format_dxt3_rgba_fetch(0, src, i, j, dst); } void -util_format_dxt5_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { util_format_dxt5_rgba_fetch(0, src, i, j, dst); } void -util_format_dxt1_rgb_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { uint8_t tmp[4]; util_format_dxt1_rgb_fetch(0, src, i, j, tmp); @@ -196,7 +196,7 @@ util_format_dxt1_rgb_fetch_float(float *dst, const uint8_t *src, unsigned i, uns } void -util_format_dxt1_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { uint8_t tmp[4]; util_format_dxt1_rgba_fetch(0, src, i, j, tmp); @@ -207,7 +207,7 @@ util_format_dxt1_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, un } void -util_format_dxt3_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { uint8_t tmp[4]; util_format_dxt3_rgba_fetch(0, src, i, j, tmp); @@ -218,7 +218,7 @@ util_format_dxt3_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, un } void -util_format_dxt5_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { uint8_t tmp[4]; util_format_dxt5_rgba_fetch(0, src, i, j, tmp); @@ -234,7 +234,7 @@ util_format_dxt5_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, un */ void -util_format_dxt1_rgb_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j; for(y = 0; y < height; y += 4) { @@ -253,7 +253,7 @@ util_format_dxt1_rgb_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const } void -util_format_dxt1_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j; for(y = 0; y < height; y += 4) { @@ -272,7 +272,7 @@ util_format_dxt1_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const } void -util_format_dxt3_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j; for(y = 0; y < height; y += 4) { @@ -291,7 +291,7 @@ util_format_dxt3_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const } void -util_format_dxt5_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j; for(y = 0; y < height; y += 4) { @@ -310,7 +310,7 @@ util_format_dxt5_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const } void -util_format_dxt1_rgb_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j; for(y = 0; y < height; y += 4) { @@ -334,7 +334,7 @@ util_format_dxt1_rgb_unpack_float(float *dst_row, unsigned dst_stride, const uin } void -util_format_dxt1_rgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j; for(y = 0; y < height; y += 4) { @@ -358,7 +358,7 @@ util_format_dxt1_rgba_unpack_float(float *dst_row, unsigned dst_stride, const ui } void -util_format_dxt3_rgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j; for(y = 0; y < height; y += 4) { @@ -382,7 +382,7 @@ util_format_dxt3_rgba_unpack_float(float *dst_row, unsigned dst_stride, const ui } void -util_format_dxt5_rgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j; for(y = 0; y < height; y += 4) { @@ -411,7 +411,7 @@ util_format_dxt5_rgba_unpack_float(float *dst_row, unsigned dst_stride, const ui */ void -util_format_dxt1_rgb_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_rgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j, k; for(y = 0; y < height; y += 4) { @@ -436,7 +436,7 @@ util_format_dxt1_rgb_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const ui } void -util_format_dxt1_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j, k; for(y = 0; y < height; y += 4) { @@ -461,7 +461,7 @@ util_format_dxt1_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const u } void -util_format_dxt3_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt3_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j, k; for(y = 0; y < height; y += 4) { @@ -486,7 +486,7 @@ util_format_dxt3_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const u } void -util_format_dxt5_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt5_rgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j, k; for(y = 0; y < height; y += 4) { @@ -511,7 +511,7 @@ util_format_dxt5_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const u } void -util_format_dxt1_rgb_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) +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) { unsigned x, y, i, j, k; for(y = 0; y < height; y += 4) { @@ -536,7 +536,7 @@ util_format_dxt1_rgb_pack_float(uint8_t *dst_row, unsigned dst_stride, const flo } void -util_format_dxt1_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j, k; for(y = 0; y < height; y += 4) { @@ -561,7 +561,7 @@ util_format_dxt1_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const fl } void -util_format_dxt3_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j, k; for(y = 0; y < height; y += 4) { @@ -586,7 +586,7 @@ util_format_dxt3_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const fl } void -util_format_dxt5_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { unsigned x, y, i, j, k; for(y = 0; y < height; y += 4) { @@ -618,146 +618,146 @@ util_format_dxt5_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const fl */ void -util_format_dxt1_srgb_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt1_rgb_unpack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt1_rgb_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt1_srgb_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_srgb_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt1_rgb_pack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt1_rgb_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt1_srgb_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { - util_format_dxt1_rgb_fetch_8unorm(dst, src, i, j); + util_format_dxt1_rgb_fetch_rgba_8unorm(dst, src, i, j); } void -util_format_dxt1_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt1_rgba_unpack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt1_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt1_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt1_rgba_pack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt1_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt1_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { - util_format_dxt1_rgba_fetch_8unorm(dst, src, i, j); + util_format_dxt1_rgba_fetch_rgba_8unorm(dst, src, i, j); } void -util_format_dxt3_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt3_rgba_unpack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt3_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt3_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt3_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt3_rgba_pack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt3_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt3_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { - util_format_dxt3_rgba_fetch_8unorm(dst, src, i, j); + util_format_dxt3_rgba_fetch_rgba_8unorm(dst, src, i, j); } void -util_format_dxt5_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt5_rgba_unpack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt5_rgba_unpack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt5_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt5_srgba_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt5_rgba_pack_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt5_rgba_pack_rgba_8unorm(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt5_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j) { - util_format_dxt5_rgba_fetch_8unorm(dst, src, i, j); + util_format_dxt5_rgba_fetch_rgba_8unorm(dst, src, i, j); } void -util_format_dxt1_srgb_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt1_rgb_unpack_float(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt1_rgb_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt1_srgb_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt1_rgb_pack_float(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt1_rgb_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt1_srgb_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { - util_format_dxt1_rgb_fetch_float(dst, src, i, j); + util_format_dxt1_rgb_fetch_rgba_float(dst, src, i, j); } void -util_format_dxt1_srgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt1_rgba_unpack_float(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt1_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt1_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt1_rgba_pack_float(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt1_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt1_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { - util_format_dxt1_rgba_fetch_float(dst, src, i, j); + util_format_dxt1_rgba_fetch_rgba_float(dst, src, i, j); } void -util_format_dxt3_srgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt3_rgba_unpack_float(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt3_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt3_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt3_rgba_pack_float(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt3_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt3_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { - util_format_dxt3_rgba_fetch_float(dst, src, i, j); + util_format_dxt3_rgba_fetch_rgba_float(dst, src, i, j); } void -util_format_dxt5_srgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt5_rgba_unpack_float(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt5_rgba_unpack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt5_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) +util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { - util_format_dxt5_rgba_pack_float(dst_row, dst_stride, src_row, src_stride, width, height); + util_format_dxt5_rgba_pack_rgba_float(dst_row, dst_stride, src_row, src_stride, width, height); } void -util_format_dxt5_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j) +util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { - util_format_dxt5_rgba_fetch_float(dst, src, i, j); + util_format_dxt5_rgba_fetch_rgba_float(dst, src, i, j); } diff --git a/src/gallium/auxiliary/util/u_format_s3tc.h b/src/gallium/auxiliary/util/u_format_s3tc.h index 5c3a9dd22c7..97770abd422 100644 --- a/src/gallium/auxiliary/util/u_format_s3tc.h +++ b/src/gallium/auxiliary/util/u_format_s3tc.h @@ -70,149 +70,149 @@ util_format_s3tc_init(void); void -util_format_dxt1_rgb_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_rgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_rgb_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_rgb_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_dxt1_rgb_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt1_rgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt1_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_rgba_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_dxt1_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt1_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt3_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt3_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt3_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt3_rgba_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_dxt3_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt3_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt5_rgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt5_rgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt5_rgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt5_rgba_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_dxt5_rgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt5_rgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt1_srgb_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_srgb_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_srgb_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_srgb_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_dxt1_srgb_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt1_srgb_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt1_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_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_dxt1_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt1_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt3_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt3_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt3_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt3_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_dxt3_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt3_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt5_srgba_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt5_srgba_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt5_srgba_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt5_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_dxt5_srgba_fetch_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt5_srgba_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt1_rgb_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_rgb_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_rgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_rgb_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt1_rgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt1_rgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt1_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt3_rgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt3_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt3_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt3_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt3_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt5_rgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt5_rgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt5_rgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt5_rgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt5_rgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt1_srgb_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_srgb_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_srgb_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_srgb_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt1_srgb_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt1_srgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt1_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt1_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt1_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt3_srgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt3_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt3_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt3_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt3_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_dxt5_srgba_unpack_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(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt5_srgba_pack_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); +util_format_dxt5_srgba_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_dxt5_srgba_fetch_float(float *dst, const uint8_t *src, unsigned i, unsigned j); +util_format_dxt5_srgba_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); #endif /* U_FORMAT_S3TC_H_ */ diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py index 94a4331b15f..5440a8b7b8c 100755 --- a/src/gallium/auxiliary/util/u_format_table.py +++ b/src/gallium/auxiliary/util/u_format_table.py @@ -129,11 +129,34 @@ def write_format_table(formats): print " %s%s\t/* %s */" % (swizzle_map[swizzle], sep, comment) print " }," print " %s," % (colorspace_map(format.colorspace),) - print " &util_format_%s_unpack_8unorm," % format.short_name() - print " &util_format_%s_pack_8unorm," % format.short_name() - print " &util_format_%s_unpack_float," % format.short_name() - print " &util_format_%s_pack_float," % format.short_name() - print " &util_format_%s_fetch_float" % format.short_name() + if format.colorspace != ZS: + print " &util_format_%s_unpack_rgba_8unorm," % format.short_name() + print " &util_format_%s_pack_rgba_8unorm," % format.short_name() + print " &util_format_%s_unpack_rgba_float," % format.short_name() + print " &util_format_%s_pack_rgba_float," % format.short_name() + print " &util_format_%s_fetch_rgba_float," % format.short_name() + else: + print " NULL, /* unpack_rgba_8unorm */" + print " NULL, /* pack_rgba_8unorm */" + print " NULL, /* unpack_rgba_float */" + print " NULL, /* pack_rgba_float */" + print " NULL, /* fetch_rgba_float */" + if format.colorspace == ZS and format.swizzles[0] != SWIZZLE_NONE: + print " &util_format_%s_unpack_z_32unorm," % format.short_name() + print " &util_format_%s_pack_z_32unorm," % format.short_name() + print " &util_format_%s_unpack_z_float," % format.short_name() + print " &util_format_%s_pack_z_float," % format.short_name() + else: + print " NULL, /* unpack_z_32unorm */" + print " NULL, /* pack_z_32unorm */" + print " NULL, /* unpack_z_float */" + print " NULL, /* pack_z_float */" + if format.colorspace == ZS and format.swizzles[1] != SWIZZLE_NONE: + print " &util_format_%s_unpack_s_8uscaled," % format.short_name() + print " &util_format_%s_pack_s_8uscaled" % format.short_name() + else: + print " NULL, /* unpack_s_8uscaled */" + print " NULL /* pack_s_8uscaled */" print "};" print diff --git a/src/gallium/auxiliary/util/u_format_yuv.c b/src/gallium/auxiliary/util/u_format_yuv.c index 0847476e2e4..ab8bf29c97b 100644 --- a/src/gallium/auxiliary/util/u_format_yuv.c +++ b/src/gallium/auxiliary/util/u_format_yuv.c @@ -38,7 +38,7 @@ void -util_format_r8g8_b8g8_unorm_unpack_float(float *dst_row, unsigned dst_stride, +util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -100,7 +100,7 @@ util_format_r8g8_b8g8_unorm_unpack_float(float *dst_row, unsigned dst_stride, void -util_format_r8g8_b8g8_unorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -162,7 +162,7 @@ util_format_r8g8_b8g8_unorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_r8g8_b8g8_unorm_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8_b8g8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -219,7 +219,7 @@ util_format_r8g8_b8g8_unorm_pack_float(uint8_t *dst_row, unsigned dst_stride, void -util_format_r8g8_b8g8_unorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8_b8g8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -276,7 +276,7 @@ util_format_r8g8_b8g8_unorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_r8g8_b8g8_unorm_fetch_float(float *dst, const uint8_t *src, +util_format_r8g8_b8g8_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { assert(i < 2); @@ -290,7 +290,7 @@ util_format_r8g8_b8g8_unorm_fetch_float(float *dst, const uint8_t *src, void -util_format_g8r8_g8b8_unorm_unpack_float(float *dst_row, unsigned dst_stride, +util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -352,7 +352,7 @@ util_format_g8r8_g8b8_unorm_unpack_float(float *dst_row, unsigned dst_stride, void -util_format_g8r8_g8b8_unorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -414,7 +414,7 @@ util_format_g8r8_g8b8_unorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_g8r8_g8b8_unorm_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_g8r8_g8b8_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -471,7 +471,7 @@ util_format_g8r8_g8b8_unorm_pack_float(uint8_t *dst_row, unsigned dst_stride, void -util_format_g8r8_g8b8_unorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_g8r8_g8b8_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -528,7 +528,7 @@ util_format_g8r8_g8b8_unorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_g8r8_g8b8_unorm_fetch_float(float *dst, const uint8_t *src, +util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { assert(i < 2); @@ -542,7 +542,7 @@ util_format_g8r8_g8b8_unorm_fetch_float(float *dst, const uint8_t *src, void -util_format_uyvy_unpack_float(float *dst_row, unsigned dst_stride, +util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -598,7 +598,7 @@ util_format_uyvy_unpack_float(float *dst_row, unsigned dst_stride, void -util_format_uyvy_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_uyvy_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -654,7 +654,7 @@ util_format_uyvy_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_uyvy_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_uyvy_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -715,7 +715,7 @@ util_format_uyvy_pack_float(uint8_t *dst_row, unsigned dst_stride, void -util_format_uyvy_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_uyvy_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -776,7 +776,7 @@ util_format_uyvy_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_uyvy_fetch_float(float *dst, const uint8_t *src, +util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { uint8_t y, u, v; @@ -795,7 +795,7 @@ util_format_uyvy_fetch_float(float *dst, const uint8_t *src, void -util_format_yuyv_unpack_float(float *dst_row, unsigned dst_stride, +util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -851,7 +851,7 @@ util_format_yuyv_unpack_float(float *dst_row, unsigned dst_stride, void -util_format_yuyv_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_yuyv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -907,7 +907,7 @@ util_format_yuyv_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_yuyv_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_yuyv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -968,7 +968,7 @@ util_format_yuyv_pack_float(uint8_t *dst_row, unsigned dst_stride, void -util_format_yuyv_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_yuyv_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height) { @@ -1029,7 +1029,7 @@ util_format_yuyv_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, void -util_format_yuyv_fetch_float(float *dst, const uint8_t *src, +util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j) { uint8_t y, u, v; diff --git a/src/gallium/auxiliary/util/u_format_yuv.h b/src/gallium/auxiliary/util/u_format_yuv.h index 10cf6784805..dc9632346d1 100644 --- a/src/gallium/auxiliary/util/u_format_yuv.h +++ b/src/gallium/auxiliary/util/u_format_yuv.h @@ -122,100 +122,100 @@ util_format_yuv_to_rgb_8unorm(uint8_t y, uint8_t u, uint8_t v, void -util_format_uyvy_unpack_float(float *dst_row, unsigned dst_stride, +util_format_uyvy_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_uyvy_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_uyvy_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_uyvy_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_uyvy_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_uyvy_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_uyvy_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_uyvy_fetch_float(float *dst, const uint8_t *src, +util_format_uyvy_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_yuyv_unpack_float(float *dst_row, unsigned dst_stride, +util_format_yuyv_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_yuyv_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_yuyv_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_yuyv_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_yuyv_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_yuyv_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_yuyv_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_yuyv_fetch_float(float *dst, const uint8_t *src, +util_format_yuyv_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); void -util_format_r8g8_b8g8_unorm_unpack_float(float *dst_row, unsigned dst_stride, +util_format_r8g8_b8g8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_r8g8_b8g8_unorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8_b8g8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_r8g8_b8g8_unorm_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8_b8g8_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_r8g8_b8g8_unorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_r8g8_b8g8_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_r8g8_b8g8_unorm_fetch_float(float *dst, const uint8_t *src, +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_float(float *dst_row, unsigned dst_stride, +util_format_g8r8_g8b8_unorm_unpack_rgba_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_g8r8_g8b8_unorm_unpack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_g8r8_g8b8_unorm_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); void -util_format_g8r8_g8b8_unorm_pack_float(uint8_t *dst_row, unsigned dst_stride, +util_format_g8r8_g8b8_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_g8r8_g8b8_unorm_pack_8unorm(uint8_t *dst_row, unsigned dst_stride, +util_format_g8r8_g8b8_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_g8r8_g8b8_unorm_fetch_float(float *dst, const uint8_t *src, +util_format_g8r8_g8b8_unorm_fetch_rgba_float(float *dst, const uint8_t *src, unsigned i, unsigned j); diff --git a/src/gallium/auxiliary/util/u_format_zs.c b/src/gallium/auxiliary/util/u_format_zs.c new file mode 100644 index 00000000000..68c88e520c9 --- /dev/null +++ b/src/gallium/auxiliary/util/u_format_zs.c @@ -0,0 +1,893 @@ +/************************************************************************** + * + * Copyright 2010 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#include "u_debug.h" +#include "u_math.h" +#include "u_format_zs.h" + + +void +util_format_s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned y; + for(y = 0; y < height; ++y) { + memcpy(dst_row, src_row, width); + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned y; + for(y = 0; y < height; ++y) { + memcpy(dst_row, src_row, width); + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z16_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + float *dst = dst_row; + const uint16_t *src = (const uint16_t *)src_row; + for(x = 0; x < width; ++x) { + uint16_t value = *src++; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + dst[0] = (float)(value * (1.0f/0xffff)); + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z16_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const float *src = src_row; + uint16_t *dst = (uint16_t *)dst_row; + for(x = 0; x < width; ++x) { + uint16_t value; + value = (uint16_t)(*src * 0xffff); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *dst++ = value; + src += 1; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z16_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + uint32_t *dst = dst_row; + const uint16_t *src = (const uint16_t *)src_row; + for(x = 0; x < width; ++x) { + uint16_t value = *src++; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + /* value * 0xffffffff / 0xffff */ + *dst++ = (value << 16) | value; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z16_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, + const uint32_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const uint32_t *src = src_row; + uint16_t *dst = (uint16_t *)dst_row; + for(x = 0; x < width; ++x) { + uint16_t value; + value = (uint16_t)(*src++ >> 16); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap16(value); +#endif + *dst++ = value; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z32_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + float *dst = dst_row; + const uint32_t *src = (const uint32_t *)src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *src++; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *dst++ = (float)(value * (1.0/0xffffffff)); + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z32_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const float *src = src_row; + uint32_t *dst = (uint32_t *)dst_row; + for(x = 0; x < width; ++x) { + uint32_t value; + value = (uint32_t)(*src * (double)0xffffffff); +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *dst++ = value; + ++src; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z32_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned y; + for(y = 0; y < height; ++y) { + memcpy(dst_row, src_row, width * 4); + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z32_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, + const uint32_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned y; + for(y = 0; y < height; ++y) { + memcpy(dst_row, src_row, width * 4); + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z32_float_unpack_z_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned y; + for(y = 0; y < height; ++y) { + memcpy(dst_row, src_row, width * 4); + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z32_float_pack_z_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned y; + for(y = 0; y < height; ++y) { + memcpy(dst_row, src_row, width * 4); + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z32_float_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + uint32_t *dst = dst_row; + const float *src = (const float *)src_row; + for(x = 0; x < width; ++x) { + *dst++ = (uint32_t)(*src++ * (double)0xffffffff); + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z32_float_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, + const uint32_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const uint32_t *src = src_row; + float *dst = (float *)dst_row; + for(x = 0; x < width; ++x) { + *dst++ = (float)(*src++ * (1.0/0xffffffff)); + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z24_unorm_s8_uscaled_unpack_z_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + float *dst = dst_row; + const uint32_t *src = (const uint32_t *)src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *src++; + uint32_t z; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + z = (value) & 0xffffff; + *dst++ = (float)(z * (1.0/0xffffff)); + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z24_unorm_s8_uscaled_pack_z_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const float *src = src_row; + uint32_t *dst = (uint32_t *)dst_row; + for(x = 0; x < width; ++x) { + uint32_t value = *dst; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + value &= 0xff000000; + value |= ((uint32_t)(*src++ * (double)0xffffff)) & 0xffffff; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *dst++ = value; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z24_unorm_s8_uscaled_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + uint32_t *dst = dst_row; + const uint32_t *src = (const uint32_t *)src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *src++; + uint32_t z; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + z = value & 0xffffff; + *dst++ = (z << 8) | (z >> 16); /* z * 0xffffffff / 0xffffff */; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z24_unorm_s8_uscaled_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, + const uint32_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const uint32_t *src = src_row; + uint32_t *dst = (uint32_t *)dst_row; + for(x = 0; x < width; ++x) { + uint32_t value; + value = ((uint32_t)(*src >> 8)) & 0xffffff; + value = ((uint32_t)(((uint64_t)src[1]) * 0x1 / 0xffffffff)) << 24; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *dst++ = value; + src += 1; + dst += 4; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z24_unorm_s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + uint8_t *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *(const uint32_t *)src; + uint32_t z; + uint32_t s; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + z = (value) & 0xffffff; + s = value >> 24; + dst[1] = s; + src += 4; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z24_unorm_s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const uint8_t *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; ++x) { + uint32_t value; + value = ((uint32_t)(((uint32_t)MIN2(*src, 1)) * 0xffffff / 0x1)) & 0xffffff; + value = (src[1]) << 24; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 1; + dst += 4; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_s8_uscaled_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + float *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *(const uint32_t *)src; + uint32_t s; + uint32_t z; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + s = (value) & 0xff; + z = value >> 8; + dst[0] = (float)(z * (1.0/0xffffff)); + src += 4; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_s8_uscaled_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const float *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; ++x) { + uint32_t value; + value = ((uint32_t)CLAMP(src[1], 0, 255)) & 0xff; + value = ((uint32_t)(*src * (double)0xffffff)) << 8; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 1; + dst += 4; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_s8_uscaled_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + uint32_t *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *(const uint32_t *)src; + uint32_t s; + uint32_t z; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + s = (value) & 0xff; + z = value >> 8; + dst[0] = (uint32_t)(((uint64_t)z) * 0xffffffff / 0xffffff); + src += 4; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_s8_uscaled_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, + const uint32_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const uint32_t *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; ++x) { + uint32_t value; + value = ((uint32_t)(((uint64_t)src[1]) * 0x1 / 0xffffffff)) & 0xff; + value = ((uint32_t)(*src >> 8)) << 8; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 1; + dst += 4; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_s8_uscaled_z24_unorm_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + uint8_t *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *(const uint32_t *)src; + uint32_t s; + uint32_t z; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + s = (value) & 0xff; + z = value >> 8; + dst[1] = s; + src += 4; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_s8_uscaled_z24_unorm_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const uint8_t *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; ++x) { + uint32_t value; + value = (src[1]) & 0xff; + value = ((uint32_t)(((uint32_t)MIN2(*src, 1)) * 0xffffff / 0x1)) << 8; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 1; + dst += 4; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z24x8_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + float *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *(const uint32_t *)src; + uint32_t z; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + z = (value) & 0xffffff; + dst[0] = (float)(z * (1.0/0xffffff)); + src += 4; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z24x8_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const float *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; ++x) { + uint32_t value; + value = ((uint32_t)(*src * (double)0xffffff)) & 0xffffff; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 1; + dst += 4; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z24x8_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + uint32_t *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *(const uint32_t *)src; + uint32_t z; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + z = (value) & 0xffffff; + dst[0] = (uint32_t)(((uint64_t)z) * 0xffffffff / 0xffffff); + src += 4; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z24x8_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, + const uint32_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const uint32_t *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; ++x) { + uint32_t value; + value = ((uint32_t)(*src >> 8)) & 0xffffff; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 1; + dst += 4; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_x8z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + float *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *(const uint32_t *)src; + uint32_t z; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + z = value >> 8; + dst[0] = (float)(z * (1.0/0xffffff)); + src += 4; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_x8z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const float *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; ++x) { + uint32_t value; + value = ((uint32_t)(*src * (double)0xffffff)) << 8; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 1; + dst += 4; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_x8z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + uint32_t *dst = dst_row; + const uint8_t *src = src_row; + for(x = 0; x < width; ++x) { + uint32_t value = *(const uint32_t *)src; + uint32_t z; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + z = value >> 8; + dst[0] = (uint32_t)(((uint64_t)z) * 0xffffffff / 0xffffff); + src += 4; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_x8z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, + const uint32_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const uint32_t *src = src_row; + uint8_t *dst = dst_row; + for(x = 0; x < width; ++x) { + uint32_t value; + value = ((uint32_t)(*src >> 8)) << 8; +#ifdef PIPE_ARCH_BIG_ENDIAN + value = util_bswap32(value); +#endif + *(uint32_t *)dst = value; + src += 1; + dst += 4; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z32_float_s8x24_uscaled_unpack_z_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + float *dst = dst_row; + const float *src = (const float *)src_row; + for(x = 0; x < width; ++x) { + *dst = *src; + src += 2; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z32_float_s8x24_uscaled_pack_z_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const float *src = src_row; + float *dst = (float *)dst_row; + for(x = 0; x < width; ++x) { + *dst = *src; + src += 1; + dst += 2; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z32_float_s8x24_uscaled_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + uint32_t *dst = dst_row; + const float *src = (const float *)src_row; + for(x = 0; x < width; ++x) { + *dst = (uint32_t)(*src * (double)0xffffffff); + src += 2; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z32_float_s8x24_uscaled_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, + const uint32_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const uint32_t *src = src_row; + float *dst = (float *)dst_row; + for(x = 0; x < width; ++x) { + *dst = (float)(*src * (1.0/0xffffffff)); + src += 2; + dst += 1; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + +void +util_format_z32_float_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + uint8_t *dst = dst_row; + const uint8_t *src = src_row + 4; + for(x = 0; x < width; ++x) { + *dst = *src; + src += 8; + dst += 1; + } + src_row += src_stride/sizeof(*src_row); + dst_row += dst_stride/sizeof(*dst_row); + } +} + +void +util_format_z32_float_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unsigned x, y; + for(y = 0; y < height; ++y) { + const uint8_t *src = src_row; + uint8_t *dst = dst_row + 4; + for(x = 0; x < width; ++x) { + *dst = *src; + src += 1; + dst += 8; + } + dst_row += dst_stride/sizeof(*dst_row); + src_row += src_stride/sizeof(*src_row); + } +} + diff --git a/src/gallium/auxiliary/util/u_format_zs.h b/src/gallium/auxiliary/util/u_format_zs.h new file mode 100644 index 00000000000..650db4b95fd --- /dev/null +++ b/src/gallium/auxiliary/util/u_format_zs.h @@ -0,0 +1,196 @@ +/************************************************************************** + * + * Copyright 2010 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + **************************************************************************/ + + +#ifndef U_FORMAT_ZS_H_ +#define U_FORMAT_ZS_H_ + + +#include "pipe/p_compiler.h" + + +void +util_format_s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z16_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z16_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z16_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z16_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_float_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_float_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_float_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_float_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z24_unorm_s8_uscaled_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z24_unorm_s8_uscaled_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z24_unorm_s8_uscaled_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z24_unorm_s8_uscaled_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z24_unorm_s8_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z24_unorm_s8_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_s8_uscaled_z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_s8_uscaled_z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_s8_uscaled_z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_s8_uscaled_z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_s8_uscaled_z24_unorm_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_s8_uscaled_z24_unorm_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z24x8_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z24x8_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z24x8_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z24x8_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_x8z24_unorm_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_x8z24_unorm_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_x8z24_unorm_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_x8z24_unorm_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_float_s8x24_uscaled_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_float_s8x24_uscaled_pack_z_float(uint8_t *dst_row, unsigned dst_stride, const float *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_float_s8x24_uscaled_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_float_s8x24_uscaled_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, const uint32_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_float_s8x24_uscaled_unpack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z32_float_s8x24_uscaled_pack_s_8uscaled(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +#endif /* U_FORMAT_ZS_H_ */ -- 2.30.2