[Mesa-dev] [RFC v2 06/23] anv: Add func anv_get_raw_format()

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Thu Aug 31 04:24:04 UTC 2017


From: Chad Versace <chadversary at chromium.org>

Like anv_get_format(), but the returned format is not adjusted, not even
for the aspect.

Add anv_get_raw_isl_format() too, to match anv_get_isl_format().
---
 src/intel/vulkan/anv_formats.c | 7 +++++++
 src/intel/vulkan/anv_private.h | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 9808508523..57202f4aca 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -250,6 +250,13 @@ static const struct anv_format anv_formats[] = {
 
 #undef fmt
 
+/** Like anv_get_format(), except the returned format is not adjusted. */
+struct anv_format
+anv_get_raw_format(const struct gen_device_info *devinfo, VkFormat vk_format)
+{
+   return anv_formats[vk_format];
+}
+
 /**
  * Exactly one bit must be set in \a aspect.
  */
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index b30b71f336..7b4e9dfbe0 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -2030,10 +2030,18 @@ struct anv_format {
    struct isl_swizzle swizzle;
 };
 
+struct anv_format ATTRIBUTE_PURE
+anv_get_raw_format(const struct gen_device_info *devinfo, VkFormat vk_format);
+
 struct anv_format
 anv_get_format(const struct gen_device_info *devinfo, VkFormat format,
                VkImageAspectFlags aspect, VkImageTiling tiling);
 
+static inline enum isl_format ATTRIBUTE_PURE
+anv_get_raw_isl_format(const struct gen_device_info *devinfo, VkFormat vk_format) {
+   return anv_get_raw_format(devinfo, vk_format).isl_format;
+}
+
 static inline enum isl_format
 anv_get_isl_format(const struct gen_device_info *devinfo, VkFormat vk_format,
                    VkImageAspectFlags aspect, VkImageTiling tiling)
-- 
2.13.0



More information about the mesa-dev mailing list