vulkan/util: Add a vk_format_srgb_to_linear() helper

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38094>
This commit is contained in:
Faith Ekstrand 2025-10-27 11:15:50 -04:00
parent 3955787ab2
commit 127de27015

View file

@ -196,6 +196,16 @@ vk_format_is_srgb(VkFormat format)
return util_format_is_srgb(vk_format_to_pipe_format(format));
}
static inline VkFormat
vk_format_srgb_to_linear(VkFormat format)
{
if (!vk_format_is_srgb(format))
return format;
return vk_format_from_pipe_format(
util_format_linear(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));