From d3808b1b1f34dbb826b99102786d94e1baf9d667 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 9 Apr 2010 14:03:02 +0100 Subject: 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. --- src/gallium/auxiliary/util/u_format.h | 101 +++++++++++++++++++++++++++++----- 1 file changed, 86 insertions(+), 15 deletions(-) (limited to 'src/gallium/auxiliary/util/u_format.h') diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index a7c24f0c00..c96a39dc09 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); + }; -- cgit v1.2.3