vulkan/util: fix typo in comment
[mesa.git] / src / vulkan / util / gen_enum_to_str.py
index 0564b8e02803686fec0194bd663cdbb4d2f068bb..ef37972c20d3a393c95a5dffe755a401a447f5e8 100644 (file)
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-"""Create enum to string functions for vulking using vk.xml."""
+"""Create enum to string functions for vulkan using vk.xml."""
 
 from __future__ import print_function
+import argparse
 import os
 import textwrap
 import xml.etree.cElementTree as et
 
 from mako.template import Template
 
-VK_XML = os.path.join(os.path.dirname(__file__), '..', 'registry', 'vk.xml')
-
 COPYRIGHT = textwrap.dedent(u"""\
     * Copyright © 2017 Intel Corporation
     *
@@ -158,9 +157,17 @@ def xml_parser(filename):
 
 
 def main():
-    enums = xml_parser(VK_XML)
-    for template, file_ in [(C_TEMPLATE, 'vk_enum_to_str.c'),
-                            (H_TEMPLATE, 'vk_enum_to_str.h')]:
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--xml', help='Vulkan API XML file.', required=True)
+    parser.add_argument('--outdir',
+                        help='Directory to put the generated files in',
+                        required=True)
+
+    args = parser.parse_args()
+
+    enums = xml_parser(args.xml)
+    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__),