diff options
author | Dylan Baker <[email protected]> | 2017-02-17 11:41:03 -0800 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2017-03-22 16:22:00 -0700 |
commit | 1610b3dede1d0d3246bd803f80ec5f2843668cda (patch) | |
tree | 652a5a84c5f7882b33f354d61c6b83e619dd626d /src/intel | |
parent | 8017da8dd20e1b58573f5357730900d6ab0e1427 (diff) |
anv: don't pass xmlfile via stdin anv_entrypoints_gen.py
It's slow, and has the potential for encoding issues.
v2: - pass xml file location via argument
- update Android.mk
Signed-off-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/Android.vulkan.mk | 6 | ||||
-rw-r--r-- | src/intel/Makefile.vulkan.am | 14 | ||||
-rw-r--r-- | src/intel/vulkan/anv_entrypoints_gen.py | 19 |
3 files changed, 16 insertions, 23 deletions
diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk index d2e1348644f..0b6462e322e 100644 --- a/src/intel/Android.vulkan.mk +++ b/src/intel/Android.vulkan.mk @@ -59,8 +59,7 @@ $(intermediates)/vulkan/dummy.c: $(hide) touch $@ $(intermediates)/vulkan/anv_entrypoints.h: - @mkdir -p $(dir $@) - $(hide) cat $(MESA_TOP)/src/vulkan/registry/vk.xml | $(VK_ENTRYPOINTS_SCRIPT) header > $@ + $(VK_ENTRYPOINTS_SCRIPT) header --xml $(MESA_TOP)/src/vulkan/registry/vk.xml > $@ LOCAL_EXPORT_C_INCLUDE_DIRS := \ $(intermediates) @@ -180,8 +179,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \ LOCAL_GENERATED_SOURCES += $(intermediates)/vulkan/anv_entrypoints.c $(intermediates)/vulkan/anv_entrypoints.c: - @mkdir -p $(dir $@) - $(hide) cat $(MESA_TOP)/src/vulkan/registry/vk.xml | $(VK_ENTRYPOINTS_SCRIPT) code > $@ + $(VK_ENTRYPOINTS_SCRIPT) code --xml $(MESA_TOP)/src/vulkan/registry/vk.xml > $@ LOCAL_SHARED_LIBRARIES := libdrm_intel diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am index 28150098769..bf6b25b4580 100644 --- a/src/intel/Makefile.vulkan.am +++ b/src/intel/Makefile.vulkan.am @@ -24,15 +24,11 @@ # out and we'll fail at `make dist' vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml -vulkan/anv_entrypoints.h: vulkan/anv_entrypoints_gen.py $(vulkan_api_xml) - $(MKDIR_GEN) - $(AM_V_GEN) cat $(vulkan_api_xml) |\ - $(PYTHON2) $(srcdir)/vulkan/anv_entrypoints_gen.py header > $@ - -vulkan/anv_entrypoints.c: vulkan/anv_entrypoints_gen.py $(vulkan_api_xml) - $(MKDIR_GEN) - $(AM_V_GEN) cat $(vulkan_api_xml) |\ - $(PYTHON2) $(srcdir)/vulkan/anv_entrypoints_gen.py code > $@ +vulkan/anv_entrypoints.h : vulkan/anv_entrypoints_gen.py $(vulkan_api_xml) + $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_entrypoints_gen.py header --xml $(vulkan_api_xml) > $@ + +vulkan/anv_entrypoints.c : vulkan/anv_entrypoints_gen.py $(vulkan_api_xml) + $(AM_V_GEN)$(PYTHON2) $(srcdir)/vulkan/anv_entrypoints_gen.py code --xml $(vulkan_api_xml) > $@ BUILT_SOURCES += $(VULKAN_GENERATED_FILES) CLEANFILES += \ diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index 47df4ce2c48..12ee7350fc9 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -22,7 +22,7 @@ # IN THE SOFTWARE. # -import sys +import argparse import textwrap import xml.etree.ElementTree as et @@ -58,13 +58,6 @@ PRIME_STEP = 19 opt_header = False opt_code = False -if sys.argv[1] == "header": - opt_header = True - sys.argv.pop() -elif sys.argv[1] == "code": - opt_code = True - sys.argv.pop() - def hash(name): h = 0 @@ -140,7 +133,13 @@ def get_entrypoints_defines(doc): def main(): - doc = et.parse(sys.stdin) + parser = argparse.ArgumentParser() + parser.add_argument('target', choices=['header', 'code'], + help='Which file to generate.') + parser.add_argument('--xml', help='Vulkan API XML file.') + args = parser.parse_args() + + doc = et.parse(args.xml) entrypoints = get_entrypoints(doc, get_entrypoints_defines(doc)) # Manually add CreateDmaBufImageINTEL for which we don't have an extension @@ -156,7 +155,7 @@ def main(): # For outputting entrypoints.h we generate a anv_EntryPoint() prototype # per entry point. - if opt_header: + if args.target == 'header': print "/* This file generated from vk_gen.py, don't edit directly. */\n" print "struct anv_dispatch_table {" |