summaryrefslogtreecommitdiffstats
path: root/src/freedreno/vulkan/vk_format.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/freedreno/vulkan/vk_format.h')
-rw-r--r--src/freedreno/vulkan/vk_format.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/freedreno/vulkan/vk_format.h b/src/freedreno/vulkan/vk_format.h
index 01e116575a3..4e13bc9c02d 100644
--- a/src/freedreno/vulkan/vk_format.h
+++ b/src/freedreno/vulkan/vk_format.h
@@ -414,6 +414,16 @@ vk_format_is_color(VkFormat format)
return !vk_format_is_depth_or_stencil(format);
}
+static inline bool
+vk_format_has_alpha(VkFormat format)
+{
+ const struct vk_format_description *desc = vk_format_description(format);
+
+ return (desc->colorspace == VK_FORMAT_COLORSPACE_RGB ||
+ desc->colorspace == VK_FORMAT_COLORSPACE_SRGB) &&
+ desc->swizzle[3] != VK_SWIZZLE_1;
+}
+
static inline VkFormat
vk_format_depth_only(VkFormat format)
{