Mesa (master): vulkan: util: add macros to extract extension/ offset number from enums
Lionel Landwerlin
llandwerlin at kemper.freedesktop.org
Fri Oct 6 16:14:03 UTC 2017
Module: Mesa
Branch: master
Commit: c90e50f3a07867f3ce3a425c8b0b6d57a1c5ade5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c90e50f3a07867f3ce3a425c8b0b6d57a1c5ade5
Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date: Tue Mar 14 17:17:12 2017 +0000
vulkan: util: add macros to extract extension/offset number from enums
v2: Simplify offset enum computation (Jason)
v3: capitalize macros (Chad)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/vulkan/util/vk_util.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/vulkan/util/vk_util.h b/src/vulkan/util/vk_util.h
index 2ed601f881..4c18a196b7 100644
--- a/src/vulkan/util/vk_util.h
+++ b/src/vulkan/util/vk_util.h
@@ -199,4 +199,10 @@ __vk_find_struct(void *start, VkStructureType sType)
uint32_t vk_get_driver_version(void);
+#define VK_EXT_OFFSET (1000000000UL)
+#define VK_ENUM_EXTENSION(__enum) \
+ ((__enum) >= VK_EXT_OFFSET ? ((((__enum) - VK_EXT_OFFSET) / 1000UL) + 1) : 0)
+#define VK_ENUM_OFFSET(__enum) \
+ ((__enum) >= VK_EXT_OFFSET ? ((__enum) % 1000) : (__enum))
+
#endif /* VK_UTIL_H */
More information about the mesa-commit
mailing list