From a9c36daa83ce2305ea8e310306699dee4a3d5c19 Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Mon, 17 Aug 2015 13:49:35 -0700 Subject: [PATCH] vk/formats: Add global pointer to anv_format for S8_UINT Stencil formats are often a special case. To reduce the number of lookups into the VkFormat-to-anv_format translation table when working with stencil, expose the table's entry for VK_FORMAT_S8_UINT as global variable anv_format_s8_uint. --- src/vulkan/anv_formats.c | 3 +++ src/vulkan/anv_private.h | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/vulkan/anv_formats.c b/src/vulkan/anv_formats.c index 1d1d1bbe135..9b971a18ac2 100644 --- a/src/vulkan/anv_formats.c +++ b/src/vulkan/anv_formats.c @@ -209,6 +209,9 @@ static const struct anv_format anv_formats[] = { #undef fmt +const struct anv_format *const +anv_format_s8_uint = &anv_formats[VK_FORMAT_S8_UINT]; + const struct anv_format * anv_format_for_vk_format(VkFormat format) { diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 725f8d88566..ee2700254cd 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -879,6 +879,13 @@ struct anv_format { bool has_stencil; }; +/** + * Stencil formats are often a special case. To reduce the number of lookups + * into the VkFormat-to-anv_format translation table when working with + * stencil, here is the handle to the table's entry for VK_FORMAT_S8_UINT. + */ +extern const struct anv_format *const anv_format_s8_uint; + const struct anv_format * anv_format_for_vk_format(VkFormat format); bool anv_is_vk_format_depth_or_stencil(VkFormat format); -- 2.30.2