From: Alexandros Frantzis <[email protected]>
The table allows iterating over all available format descriptions.
---
src/vulkan/util/vk_format.h | 3 ++-
src/vulkan/util/vk_format_table.py | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/vulkan/util/vk_format.h b/src/vulkan/util/vk_format.h
index 96dac8cfad..182acdeffa 100644
--- a/src/vulkan/util/vk_format.h
+++ b/src/vulkan/util/vk_format.h
@@ -136,7 +136,8 @@ struct vk_format_description
enum vk_format_colorspace colorspace;
};
-extern const struct vk_format_description vk_format_description_table[];
+/* NULL-terminated array with pointers to all format descriptions */
+extern const struct vk_format_description *vk_format_description_table[];
const struct vk_format_description *vk_format_description(VkFormat format);
diff --git a/src/vulkan/util/vk_format_table.py
b/src/vulkan/util/vk_format_table.py
index 36352b108d..936666b23b 100644
--- a/src/vulkan/util/vk_format_table.py
+++ b/src/vulkan/util/vk_format_table.py
@@ -142,6 +142,12 @@ def write_format_table(formats):
print "};"
print
+ print "const struct vk_format_description *vk_format_description_table[] =
{"
+ for format in formats:
+ print " &vk_format_%s_description," % (format.short_name(),)
+ print " NULL};"
+ print
+
print "const struct vk_format_description *"
print "vk_format_description(VkFormat format)"
print "{"
--
2.13.2
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev