From 273ead81f1a219b39a93abbed4db548d8eeb0e5f Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Sun, 24 May 2020 19:11:16 +0200 Subject: [PATCH] util/format: Add VK_FORMAT_D16_UNORM_S8_UINT. Not participating in packing/unpacking/stencil-only/depth-only, because it doesn't mix well in a single plane. Reviewed-by: Eric Anholt Part-of: --- src/gallium/include/pipe/p_format.h | 1 + src/util/format/u_format.csv | 1 + src/util/format/u_format_zs.c | 48 +++++++++++++++++++++++++++++ src/util/format/u_format_zs.h | 23 ++++++++++++++ src/vulkan/util/vk_format.c | 2 +- 5 files changed, 74 insertions(+), 1 deletion(-) diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index a51843caa20..8b10aae40a6 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -58,6 +58,7 @@ enum pipe_format { PIPE_FORMAT_UYVY, PIPE_FORMAT_YUYV, PIPE_FORMAT_Z16_UNORM, + PIPE_FORMAT_Z16_UNORM_S8_UINT, PIPE_FORMAT_Z32_UNORM, PIPE_FORMAT_Z32_FLOAT, PIPE_FORMAT_Z24_UNORM_S8_UINT, diff --git a/src/util/format/u_format.csv b/src/util/format/u_format.csv index 17c3566ec3e..97c76a92880 100644 --- a/src/util/format/u_format.csv +++ b/src/util/format/u_format.csv @@ -144,6 +144,7 @@ PIPE_FORMAT_R5SG5SB6U_NORM , plain, 1, 1, 1, sn5 , sn5 , un6 , , xy # Depth-stencil formats PIPE_FORMAT_S8_UINT , plain, 1, 1, 1, up8 , , , , _x__, zs PIPE_FORMAT_Z16_UNORM , plain, 1, 1, 1, un16, , , , x___, zs +PIPE_FORMAT_Z16_UNORM_S8_UINT , plain, 1, 1, 1, un16, up8 , , , xy__, zs PIPE_FORMAT_Z32_UNORM , plain, 1, 1, 1, un32, , , , x___, zs PIPE_FORMAT_Z32_FLOAT , plain, 1, 1, 1, f32 , , , , x___, zs PIPE_FORMAT_Z24_UNORM_S8_UINT , plain, 1, 1, 1, un24, up8 , , , xy__, zs, up8 , un24, , , yx__ diff --git a/src/util/format/u_format_zs.c b/src/util/format/u_format_zs.c index d37baab8744..bbd7e02e563 100644 --- a/src/util/format/u_format_zs.c +++ b/src/util/format/u_format_zs.c @@ -333,6 +333,54 @@ util_format_z32_float_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, } } +void +util_format_z16_unorm_s8_uint_unpack_z_float(float *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unreachable("z16_s8 packing/unpacking is not implemented."); +} + +void +util_format_z16_unorm_s8_uint_pack_z_float(uint8_t *dst_row, unsigned dst_stride, + const float *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unreachable("z16_s8 packing/unpacking is not implemented."); +} + +void +util_format_z16_unorm_s8_uint_unpack_z_32unorm(uint32_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unreachable("z16_s8 packing/unpacking is not implemented."); +} + +void +util_format_z16_unorm_s8_uint_pack_z_32unorm(uint8_t *dst_row, unsigned dst_stride, + const uint32_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unreachable("z16_s8 packing/unpacking is not implemented."); +} + +void +util_format_z16_unorm_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unreachable("z16_s8 packing/unpacking is not implemented."); +} + +void +util_format_z16_unorm_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, + const uint8_t *src_row, unsigned src_stride, + unsigned width, unsigned height) +{ + unreachable("z16_s8 packing/unpacking is not implemented."); +} + void util_format_z24_unorm_s8_uint_unpack_z_float(float *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, diff --git a/src/util/format/u_format_zs.h b/src/util/format/u_format_zs.h index bed3c5198e8..61fb960f9c1 100644 --- a/src/util/format/u_format_zs.h +++ b/src/util/format/u_format_zs.h @@ -194,6 +194,29 @@ util_format_z32_float_s8x24_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_s void util_format_z32_float_s8x24_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); +void +util_format_z16_unorm_s8_uint_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_s8_uint_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_s8_uint_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_s8_uint_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_z16_unorm_s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + + +void +util_format_z16_unorm_s8_uint_pack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); + void util_format_x24s8_uint_unpack_s_8uint(uint8_t *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height); diff --git a/src/vulkan/util/vk_format.c b/src/vulkan/util/vk_format.c index 9afe89f7f20..c74e2047a73 100644 --- a/src/vulkan/util/vk_format.c +++ b/src/vulkan/util/vk_format.c @@ -171,7 +171,7 @@ static const enum pipe_format vk_format_map[] = { [VK_FORMAT_X8_D24_UNORM_PACK32] = PIPE_FORMAT_Z24X8_UNORM, [VK_FORMAT_D32_SFLOAT] = PIPE_FORMAT_Z32_FLOAT, [VK_FORMAT_S8_UINT] = PIPE_FORMAT_S8_UINT, - /* Missing D16_UNORM_S8_UINT */ + [VK_FORMAT_D16_UNORM_S8_UINT] = PIPE_FORMAT_Z16_UNORM_S8_UINT, [VK_FORMAT_D24_UNORM_S8_UINT] = PIPE_FORMAT_Z24_UNORM_S8_UINT, [VK_FORMAT_D32_SFLOAT_S8_UINT] = PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, -- 2.30.2