From 9f6571e80a6eb4dd1e1884f72cea65591c4aba7f Mon Sep 17 00:00:00 2001 From: Rajnesh Kanwal Date: Thu, 31 Mar 2022 15:16:48 +0100 Subject: [PATCH] amd: Use common u_format.h implementation for vk_format_get_component_bits. Signed-off-by: Rajnesh Kanwal Reviewed-by: Jason Ekstrand Part-of: --- src/amd/vulkan/vk_format.h | 39 +++----------------------------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/src/amd/vulkan/vk_format.h b/src/amd/vulkan/vk_format.h index 517fba00388..9f90941bf93 100644 --- a/src/amd/vulkan/vk_format.h +++ b/src/amd/vulkan/vk_format.h @@ -132,42 +132,9 @@ static inline unsigned vk_format_get_component_bits(VkFormat format, enum util_format_colorspace colorspace, unsigned component) { - const struct util_format_description *desc = vk_format_description(format); - enum util_format_colorspace desc_colorspace; - - assert(format); - if (!format) { - return 0; - } - - assert(component < 4); - - /* Treat RGB and SRGB as equivalent. */ - if (colorspace == UTIL_FORMAT_COLORSPACE_SRGB) { - colorspace = UTIL_FORMAT_COLORSPACE_RGB; - } - if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) { - desc_colorspace = UTIL_FORMAT_COLORSPACE_RGB; - } else { - desc_colorspace = desc->colorspace; - } - - if (desc_colorspace != colorspace) { - return 0; - } - - switch (desc->swizzle[component]) { - case PIPE_SWIZZLE_X: - return desc->channel[0].size; - case PIPE_SWIZZLE_Y: - return desc->channel[1].size; - case PIPE_SWIZZLE_Z: - return desc->channel[2].size; - case PIPE_SWIZZLE_W: - return desc->channel[3].size; - default: - return 0; - } + return util_format_get_component_bits(vk_format_to_pipe_format(format), + colorspace, + component); } static inline VkFormat