vulkan: enum generator: sort enums by names
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fri, 15 Sep 2017 14:10:55 +0000 (15:10 +0100)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 22 Sep 2017 14:47:34 +0000 (07:47 -0700)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
src/vulkan/util/gen_enum_to_str.py

index aa7001ef13fc86843dd53ef5befff2dc1eae1c3c..c615ed08c48d57d58e554ef3fc472fa2b1ddb56c 100644 (file)
@@ -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))