summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_formats.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2015-12-04 16:18:35 -0800
committerChad Versace <[email protected]>2015-12-04 16:37:05 -0800
commita09b4c298ceed529ffc6dc5f48b1721aeb1d08a0 (patch)
treeb67d35f2b94030f093e1489ab811bad88106e24c /src/vulkan/anv_formats.c
parent8b9ceda9f17a0f5def5319210bbe5cfec2f69ed2 (diff)
anv: Add func anv_get_isl_format()
Diffstat (limited to 'src/vulkan/anv_formats.c')
-rw-r--r--src/vulkan/anv_formats.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/vulkan/anv_formats.c b/src/vulkan/anv_formats.c
index abbf667a079..19de40b52c2 100644
--- a/src/vulkan/anv_formats.c
+++ b/src/vulkan/anv_formats.c
@@ -221,6 +221,29 @@ anv_format_for_vk_format(VkFormat format)
return &anv_formats[format];
}
+/**
+ * Exactly one bit must be set in \a aspect.
+ */
+enum isl_format
+anv_get_isl_format(VkFormat format, VkImageAspectFlags aspect)
+{
+ const struct anv_format *anv_fmt = &anv_formats[format];
+
+ switch (aspect) {
+ case VK_IMAGE_ASPECT_COLOR_BIT:
+ return anv_fmt->surface_format;
+ case VK_IMAGE_ASPECT_DEPTH_BIT:
+ assert(anv_fmt->depth_format != 0);
+ return anv_fmt->surface_format;
+ case VK_IMAGE_ASPECT_STENCIL_BIT:
+ assert(anv_fmt->has_stencil);
+ return ISL_FORMAT_R8_UINT;
+ default:
+ unreachable("bad VkImageAspect");
+ return ISL_FORMAT_UNSUPPORTED;
+ }
+}
+
// Format capabilities
void anv_validate_GetPhysicalDeviceFormatProperties(