spirv: Generate spirv_info.c

The old table based spirv_*_to_string functions would return NULL for
any values "inside" the table that didn't have entries.  The tables also
needed to be updated by hand each time a new spirv.h was imported.
Generate the file instead.

v2: Make this script work more like src/mesa/main/format_fallback.py.
Suggested by Jason.  Remove SCons supports.  Suggested by Jason and
Emil.  Put all the build work in Makefile.nir.am in lieu of adding a new
Makefile.spirv.am.  Suggested by Emil.  Add support for Android builds
based on code provided by Emil.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
Ian Romanick
2017-07-17 12:31:06 -07:00
committed by Jason Ekstrand
parent de765ec9dc
commit 2dd4e2ece3
5 changed files with 106 additions and 159 deletions
+14 -2
View File
@@ -29,6 +29,7 @@ nir_libnir_la_LIBADD = \
nir_libnir_la_SOURCES = \
$(NIR_FILES) \
$(SPIRV_FILES) \
$(SPIRV_GENERATED_FILES) \
$(NIR_GENERATED_FILES)
nir/nir_builder_opcodes.h: nir/nir_opcodes.py nir/nir_builder_opcodes_h.py
@@ -51,6 +52,10 @@ nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py
$(MKDIR_GEN)
$(PYTHON_GEN) $(srcdir)/nir/nir_opt_algebraic.py > $@ || ($(RM) $@; false)
spirv/spirv_info.c: spirv/spirv_info_c.py spirv/spirv.core.grammar.json
$(MKDIR_GEN)
$(PYTHON_GEN) $(srcdir)/spirv/spirv_info_c.py $(srcdir)/spirv/spirv.core.grammar.json $@ || ($(RM) $@; false)
noinst_PROGRAMS += spirv2nir
spirv2nir_SOURCES = \
@@ -91,8 +96,13 @@ nir_tests_control_flow_tests_LDADD = \
TESTS += nir/tests/control_flow_tests
BUILT_SOURCES += $(NIR_GENERATED_FILES)
CLEANFILES += $(NIR_GENERATED_FILES)
BUILT_SOURCES += \
$(NIR_GENERATED_FILES) \
$(SPIRV_GENERATED_FILES)
CLEANFILES += \
$(NIR_GENERATED_FILES) \
$(SPIRV_GENERATED_FILES)
EXTRA_DIST += \
nir/nir_algebraic.py \
@@ -104,4 +114,6 @@ EXTRA_DIST += \
nir/nir_opt_algebraic.py \
nir/tests \
nir/README \
spirv/spirv_info_c.py \
spirv/spirv.core.grammar.json \
SConscript.nir