amd: Use common u_format.h implementation for vk_format_get_component_bits.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15696>
This commit is contained in:
Rajnesh Kanwal 2022-03-31 15:16:48 +01:00 committed by Marge Bot
parent 0d25db406b
commit 9f6571e80a
1 changed files with 3 additions and 36 deletions

View File

@ -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