vulkan: Move vk_format_is_alpha and vk_format_is_alpha_on_msb into vk_format.h from pvr
The vk_format_description moved to front because it's referenced by vk_format_is_alpha_on_msb Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Matt Coster <matt.coster@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28266>
This commit is contained in:
@@ -39,19 +39,6 @@
|
||||
|
||||
#include "util/u_endian.h"
|
||||
|
||||
static inline bool vk_format_is_alpha_on_msb(VkFormat vk_format)
|
||||
{
|
||||
const struct util_format_description *desc =
|
||||
vk_format_description(vk_format);
|
||||
|
||||
return (desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
|
||||
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
|
||||
#if UTIL_ARCH_BIG_ENDIAN
|
||||
desc->swizzle[3] == PIPE_SWIZZLE_X;
|
||||
#else
|
||||
desc->swizzle[3] == PIPE_SWIZZLE_W;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline uint vk_format_get_channel_width(VkFormat vk_format,
|
||||
uint32_t channel)
|
||||
@@ -124,9 +111,4 @@ vk_format_get_common_color_channel_count(VkFormat src_format,
|
||||
return count;
|
||||
}
|
||||
|
||||
static inline bool vk_format_is_alpha(VkFormat format)
|
||||
{
|
||||
return util_format_is_alpha(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
#endif /* VK_FORMAT_H */
|
||||
|
||||
@@ -44,6 +44,12 @@ vk_format_from_pipe_format(enum pipe_format format);
|
||||
VkImageAspectFlags
|
||||
vk_format_aspects(VkFormat format);
|
||||
|
||||
static inline const struct util_format_description *
|
||||
vk_format_description(VkFormat format)
|
||||
{
|
||||
return util_format_description(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
static inline bool
|
||||
vk_format_is_color(VkFormat format)
|
||||
{
|
||||
@@ -139,6 +145,25 @@ vk_format_is_srgb(VkFormat format)
|
||||
return util_format_is_srgb(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
static inline bool vk_format_is_alpha(VkFormat format)
|
||||
{
|
||||
return util_format_is_alpha(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
static inline bool vk_format_is_alpha_on_msb(VkFormat vk_format)
|
||||
{
|
||||
const struct util_format_description *desc =
|
||||
vk_format_description(vk_format);
|
||||
|
||||
return (desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
|
||||
desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) &&
|
||||
#if UTIL_ARCH_BIG_ENDIAN
|
||||
desc->swizzle[3] == PIPE_SWIZZLE_X;
|
||||
#else
|
||||
desc->swizzle[3] == PIPE_SWIZZLE_W;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
vk_format_get_blocksize(VkFormat format)
|
||||
{
|
||||
@@ -170,12 +195,6 @@ vk_format_is_block_compressed(VkFormat format)
|
||||
return util_format_is_compressed(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
static inline const struct util_format_description *
|
||||
vk_format_description(VkFormat format)
|
||||
{
|
||||
return util_format_description(vk_format_to_pipe_format(format));
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
vk_format_get_component_bits(VkFormat format, enum util_format_colorspace colorspace,
|
||||
unsigned component)
|
||||
|
||||
Reference in New Issue
Block a user