freedreno/a6xx: pre-calculate userconst stateobj size
[mesa.git] / src / freedreno / vulkan / vk_format.h
index 01e116575a39f9a59a07338e562d9812d5715751..4e13bc9c02d18798d599e40c3bc4a2d89cfd0f84 100644 (file)
@@ -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)
 {