turnip: add format_is_uint/format_is_sint

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
This commit is contained in:
Jonathan Marek 2019-10-05 12:05:52 -04:00
parent 12ede7565f
commit eb67d9f0f3

View file

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