[Mesa-dev] [PATCH] fixup! radv: Integrate with common generators.
Emil Velikov
emil.l.velikov at gmail.com
Thu Aug 16 14:47:23 UTC 2018
---
src/amd/vulkan/Android.mk | 4 ++--
src/amd/vulkan/Makefile.am | 16 ++++++++--------
src/amd/vulkan/meson.build | 26 ++++++++++++++++----------
src/amd/vulkan/radv_entrypoints_gen.py | 9 ++++++---
src/amd/vulkan/radv_extensions_gen.py | 9 ++++++---
src/amd/vulkan/radv_icd.py | 7 +++++--
6 files changed, 43 insertions(+), 28 deletions(-)
diff --git a/src/amd/vulkan/Android.mk b/src/amd/vulkan/Android.mk
index 8792b7ade7f..9e9c3dea342 100644
--- a/src/amd/vulkan/Android.mk
+++ b/src/amd/vulkan/Android.mk
@@ -101,8 +101,8 @@ $(intermediates)/radv_entrypoints.c: $(RADV_ENTRYPOINTS_SCRIPT) \
$(vulkan_api_xml) \
$(vulkan_api_generators_py)
@mkdir -p $(dir $@)
- PYTHONPATH=$(MESA_TOP)/src/vulkan/util \
$(MESA_PYTHON2) $(RADV_ENTRYPOINTS_SCRIPT) \
+ --import-path=$(MESA_TOP)/src/vulkan/util \
--xml $(vulkan_api_xml) \
--outdir $(dir $@)
@@ -111,8 +111,8 @@ $(intermediates)/radv_entrypoints.h: $(intermediates)/radv_entrypoints.c
$(intermediates)/radv_extensions.c: $(RADV_EXTENSIONS_GEN_SCRIPT) $(RADV_EXTENSIONS_SCRIPT) \
$(vulkan_api_xml) $(vulkan_api_generators_py)
@mkdir -p $(dir $@)\
- PYTHONPATH=$(MESA_TOP)/src/vulkan/util \
$(MESA_PYTHON2) $(RADV_EXTENSIONS_SCRIPT) \
+ --import-path=$(MESA_TOP)/src/vulkan/util \
--xml $(vulkan_api_xml) \
--out-c $@ \
--out-h $(addsuffix .h,$(basename $@))
diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
index f571903f1a6..84722fbd59d 100644
--- a/src/amd/vulkan/Makefile.am
+++ b/src/amd/vulkan/Makefile.am
@@ -146,8 +146,8 @@ vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml
radv_entrypoints.c: radv_entrypoints_gen.py radv_extensions.py $(vulkan_api_xml) \
$(vulkan_api_generators_py)
$(MKDIR_GEN)
- $(AM_V_GEN) PYTHONPATH=$(top_srcdir)/src/vulkan/util \
- $(PYTHON2) $(srcdir)/radv_entrypoints_gen.py \
+ $(AM_V_GEN) $(PYTHON2) $(srcdir)/radv_entrypoints_gen.py \
+ --import-path=$(top_srcdir)/src/vulkan/util \
--xml $(vulkan_api_xml) \
--outdir $(builddir)
radv_entrypoints.h: radv_entrypoints.c
@@ -155,8 +155,8 @@ radv_entrypoints.h: radv_entrypoints.c
radv_extensions.c: radv_extensions_gen.py radv_extensions.py \
$(vulkan_api_xml) $(vulkan_api_generators_py)
$(MKDIR_GEN)
- $(AM_V_GEN) PYTHONPATH=$(top_srcdir)/src/vulkan/util \
- $(PYTHON2) $(srcdir)/radv_extensions_gen.py \
+ $(AM_V_GEN) $(PYTHON2) $(srcdir)/radv_extensions_gen.py \
+ --import-path=$(top_srcdir)/src/vulkan/util \
--xml $(vulkan_api_xml) \
--out-c radv_extensions.c \
--out-h radv_extensions.h
@@ -199,13 +199,13 @@ icdconf_DATA = radeon_icd. at host_cpu@.json
noinst_DATA = dev_icd.json
dev_icd.json : radv_extensions.py radv_icd.py $(vulkan_api_generators_py)
- $(AM_V_GEN) PYTHONPATH=$(top_srcdir)/src/vulkan/util \
- $(PYTHON2) $(srcdir)/radv_icd.py \
+ $(AM_V_GEN) $(PYTHON2) $(srcdir)/radv_icd.py \
+ --import-path=$(top_srcdir)/src/vulkan/util \
--lib-path="${abs_top_builddir}/${LIB_DIR}" --out $@
radeon_icd. at host_cpu@.json : radv_extensions.py radv_icd.py $(vulkan_api_generators_py)
- $(AM_V_GEN) PYTHONPATH=$(top_srcdir)/src/vulkan/util \
- $(PYTHON2) $(srcdir)/radv_icd.py \
+ $(AM_V_GEN) $(PYTHON2) $(srcdir)/radv_icd.py \
+ --import-path=$(top_srcdir)/src/vulkan/util \
--lib-path="${libdir}" --out $@
include $(top_srcdir)/install-lib-links.mk
diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build
index 0f2a29752da..0f46663257a 100644
--- a/src/amd/vulkan/meson.build
+++ b/src/amd/vulkan/meson.build
@@ -25,9 +25,10 @@ radv_entrypoints = custom_target(
input : ['radv_entrypoints_gen.py', vk_api_xml],
output : ['radv_entrypoints.h', 'radv_entrypoints.c'],
command : [
- 'env', 'PYTHONPATH=@0@'.format(join_paths(meson.source_root(), 'src/vulkan/util/')),
- prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--outdir',
- meson.current_build_dir()
+ prog_python, '@INPUT0@',
+ '--import-path' join_paths(meson.source_root(), 'src/vulkan/util/'),
+ '--xml', '@INPUT1@',
+ '--outdir', meson.current_build_dir()
],
depend_files : [radv_extensions_py, vk_api_generators_py],
)
@@ -37,8 +38,10 @@ radv_extensions_c = custom_target(
input : ['radv_extensions_gen_.py', vk_api_xml],
output : ['radv_extensions.c'],
command : [
- 'env', 'PYTHONPATH=@0@'.format(join_paths(meson.source_root(), 'src/vulkan/util/')),
- prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--out-c', '@OUTPUT@'
+ prog_python, '@INPUT0@',
+ '--import-path' join_paths(meson.source_root(), 'src/vulkan/util/'),
+ '--xml', '@INPUT1@',
+ '--out-c', '@OUTPUT@'
],
depend_files : [radv_extensions_py, vk_api_generators_py],
)
@@ -48,8 +51,10 @@ radv_extensions_h = custom_target(
input : ['radv_extensions_gen_.py', vk_api_xml],
output : ['radv_extensions.h'],
command : [
- 'env', 'PYTHONPATH=@0@'.format(join_paths(meson.source_root(), 'src/vulkan/util/')),
- prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--out-h', '@OUTPUT@'
+ prog_python, '@INPUT0@',
+ '--import-path' join_paths(meson.source_root(), 'src/vulkan/util/'),
+ '--xml', '@INPUT1@',
+ '--out-h', '@OUTPUT@'
],
depend_files : [radv_extensions_py, vk_api_generators_py],
)
@@ -168,8 +173,8 @@ radeon_icd = custom_target(
input : 'radv_icd.py',
output : 'radeon_icd. at 0@.json'.format(host_machine.cpu()),
command : [
- 'env', 'PYTHONPATH=@0@'.format(join_paths(meson.source_root(), 'src/vulkan/util/')),
prog_python, '@INPUT@',
+ '--import-path' join_paths(meson.source_root(), 'src/vulkan/util/'),
'--lib-path', join_paths(get_option('prefix'), get_option('libdir')),
'--out', '@OUTPUT@',
],
@@ -184,8 +189,9 @@ radv_dev_icd = custom_target(
input : 'radv_icd.py',
output : 'dev_icd.json',
command : [
- 'env', 'PYTHONPATH=@0@'.format(join_paths(meson.source_root(), 'src/vulkan/util/')),
- prog_python, '@INPUT@', '--lib-path', meson.current_build_dir(),
+ prog_python, '@INPUT@',
+ '--import-path' join_paths(meson.source_root(), 'src/vulkan/util/'),
+ '--lib-path', meson.current_build_dir(),
'--out', '@OUTPUT@'
],
depend_files : [radv_extensions_py, vk_api_generators_py],
diff --git a/src/amd/vulkan/radv_entrypoints_gen.py b/src/amd/vulkan/radv_entrypoints_gen.py
index 46a12c50e75..ee1f7f79bc0 100644
--- a/src/amd/vulkan/radv_entrypoints_gen.py
+++ b/src/amd/vulkan/radv_entrypoints_gen.py
@@ -24,9 +24,7 @@
import argparse
import os
-
-from radv_extensions import MAX_API_VERSION, EXTENSIONS
-import vk_entrypoints_gen
+import sys
# We generate a static hash table for entry point lookup
# (vkGetProcAddress). We use a linear congruential generator for our hash
@@ -39,6 +37,7 @@ LAYERS = [
def main():
parser = argparse.ArgumentParser()
+ parser.add_argument('--import-path', required=True)
parser.add_argument('--outdir', help='Where to write the files.',
required=True)
parser.add_argument('--xml',
@@ -47,6 +46,10 @@ def main():
action='append',
dest='xml_files')
args = parser.parse_args()
+ sys.path.insert(0, args.import_path)
+
+ from radv_extensions import MAX_API_VERSION, EXTENSIONS
+ import vk_entrypoints_gen
vk_entrypoints_gen.generate_entrypoints(MAX_API_VERSION, EXTENSIONS, LAYERS, 'radv', args.xml_files,
os.path.join(args.outdir, 'radv_entrypoints.c'),
diff --git a/src/amd/vulkan/radv_extensions_gen.py b/src/amd/vulkan/radv_extensions_gen.py
index 071e175ad9e..cbc532592a2 100644
--- a/src/amd/vulkan/radv_extensions_gen.py
+++ b/src/amd/vulkan/radv_extensions_gen.py
@@ -25,12 +25,11 @@ COPYRIGHT = """\
"""
import argparse
-
-from radv_extensions import *
-import vk_extensions_gen
+import sys
if __name__ == '__main__':
parser = argparse.ArgumentParser()
+ parser.add_argument('--import-path', required=True)
parser.add_argument('--out-c', help='Output C file.')
parser.add_argument('--out-h', help='Output H file.')
parser.add_argument('--xml',
@@ -39,6 +38,10 @@ if __name__ == '__main__':
action='append',
dest='xml_files')
args = parser.parse_args()
+ sys.path.insert(0, args.import_path)
+
+ from radv_extensions import *
+ import vk_extensions_gen
vk_extensions_gen.generate_extensions(MAX_API_VERSION, API_VERSIONS, EXTENSIONS, 'radv',
args.xml_files, args.out_c, args.out_h)
diff --git a/src/amd/vulkan/radv_icd.py b/src/amd/vulkan/radv_icd.py
index 5b1a0237d09..c9b569cc2a4 100644
--- a/src/amd/vulkan/radv_icd.py
+++ b/src/amd/vulkan/radv_icd.py
@@ -23,14 +23,17 @@
import argparse
import json
import os.path
-
-from radv_extensions import *
+import sys
if __name__ == '__main__':
parser = argparse.ArgumentParser()
+ parser.add_argument('--import-path', required=True)
parser.add_argument('--out', help='Output json file.', required=True)
parser.add_argument('--lib-path', help='Path to libvulkan_radeon.so')
args = parser.parse_args()
+ sys.path.insert(0, args.import_path)
+
+ from radv_extensions import *
path = 'libvulkan_radeon.so'
if args.lib_path:
--
2.18.0
More information about the mesa-dev
mailing list