From eb67d9f0f3e8faf7015ed8884d36f94e6749aabb Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Sat, 5 Oct 2019 12:05:52 -0400 Subject: [PATCH] turnip: add format_is_uint/format_is_sint Signed-off-by: Jonathan Marek Reviewed-by: Kristian H. Kristensen --- src/freedreno/vulkan/vk_format.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/freedreno/vulkan/vk_format.h b/src/freedreno/vulkan/vk_format.h index 4e13bc9c02d..bbf7a5d81b9 100644 --- a/src/freedreno/vulkan/vk_format.h +++ b/src/freedreno/vulkan/vk_format.h @@ -448,6 +448,28 @@ vk_format_is_int(VkFormat format) return channel >= 0 && desc->channel[channel].pure_integer; } +static inline bool +vk_format_is_uint(VkFormat format) +{ + const struct vk_format_description *desc = vk_format_description(format); + int channel = vk_format_get_first_non_void_channel(format); + + return channel >= 0 && + desc->channel[channel].pure_integer && + desc->channel[channel].type != VK_FORMAT_TYPE_SIGNED; +} + +static inline bool +vk_format_is_sint(VkFormat format) +{ + const struct vk_format_description *desc = vk_format_description(format); + int channel = vk_format_get_first_non_void_channel(format); + + return channel >= 0 && + desc->channel[channel].pure_integer && + desc->channel[channel].type == VK_FORMAT_TYPE_SIGNED; +} + static inline bool vk_format_is_srgb(VkFormat format) { -- 2.30.2