[Mesa-dev] [PATCH 2/6] vulkan: enum generator: sort enums by names

Jason Ekstrand jason at jlekstrand.net
Thu Sep 21 15:32:19 UTC 2017


From: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
 src/vulkan/util/gen_enum_to_str.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/vulkan/util/gen_enum_to_str.py b/src/vulkan/util/gen_enum_to_str.py
index aa7001e..efe5d4f 100644
--- a/src/vulkan/util/gen_enum_to_str.py
+++ b/src/vulkan/util/gen_enum_to_str.py
@@ -185,13 +185,14 @@ def main():
     efactory = EnumFactory(VkEnum)
     for filename in args.xml_files:
         parse_xml(efactory, filename)
+    enums=sorted(efactory.registry.values(), key=lambda e: e.name)
 
     for template, file_ in [(C_TEMPLATE, os.path.join(args.outdir, 'vk_enum_to_str.c')),
                             (H_TEMPLATE, os.path.join(args.outdir, 'vk_enum_to_str.h'))]:
         with open(file_, 'wb') as f:
             f.write(template.render(
                 file=os.path.basename(__file__),
-                enums=efactory.registry.values(),
+                enums=enums,
                 copyright=COPYRIGHT,
                 FOREIGN_ENUM_VALUES=FOREIGN_ENUM_VALUES))
 
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list