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 <dylanx.c.baker@intel.com>
$(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)
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
# 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 += \
# IN THE SOFTWARE.
#
-import sys
+import argparse
import textwrap
import xml.etree.ElementTree as et
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
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
# 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 {"