radv: Disable depth & stencil tests when the depthbuffer doesn't support it.
[mesa.git] / src / amd / vulkan / vk_format.h
index 58ee3f71f06e6dbc1535ef54d1a16e9808d62793..c2c7ca4ce249c8bb987ed3628832dd913ade661e 100644 (file)
  * IN THE SOFTWARE.
  */
 
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef VK_FORMAT_H
+#define VK_FORMAT_H
 
 #include <assert.h>
 #include <vulkan/vulkan.h>
 #include <util/macros.h>
+
 enum vk_format_layout {
        /**
         * Formats with vk_format_block::width == vk_format_block::height == 1
@@ -368,6 +366,19 @@ vk_format_is_depth(VkFormat format)
        return vk_format_has_depth(desc);
 }
 
+static inline bool
+vk_format_is_stencil(VkFormat format)
+{
+       const struct vk_format_description *desc = vk_format_description(format);
+
+       assert(desc);
+       if (!desc) {
+               return false;
+       }
+
+       return vk_format_has_stencil(desc);
+}
+
 static inline bool
 vk_format_is_color(VkFormat format)
 {
@@ -398,6 +409,13 @@ vk_format_is_int(VkFormat format)
        return channel >= 0 && desc->channel[channel].pure_integer;
 }
 
+static inline bool
+vk_format_is_srgb(VkFormat format)
+{
+       const struct vk_format_description *desc = vk_format_description(format);
+       return desc->colorspace == VK_FORMAT_COLORSPACE_SRGB;
+}
+
 static inline VkFormat
 vk_format_stencil_only(VkFormat format)
 {
@@ -446,6 +464,5 @@ vk_format_get_component_bits(VkFormat format,
                return 0;
        }
 }
-#ifdef __cplusplus
-} // extern "C" {
-#endif
+
+#endif /* VK_FORMAT_H */