blob: 039c47256ea60e062669fb655aa660da8f67a6b8 [file] [log] [blame]
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -04001import("../third_party.gni")
2
3template("spirv_core_tables") {
4 version = invoker.version
5 action("spirv_core_tables_" + target_name) {
6 script = "../externals/spirv-tools/utils/generate_grammar_tables.py"
7 sources = [
8 "../externals/spirv-headers/include/spirv/$version/spirv.core.grammar.json",
9 ]
10 outputs = [
11 "$root_out_dir/spirv-tools/core.insts-$version.inc",
12 "$root_out_dir/spirv-tools/operand.kinds-$version.inc",
13 ]
14 args = [
15 "--spirv-core-grammar=" + rebase_path(
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070016 "../externals/spirv-headers/include/spirv/$version/spirv.core.grammar.json",
17 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040018 "--core-insts-output=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070019 rebase_path("$root_out_dir/spirv-tools/core.insts-$version.inc",
20 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040021 "--operand-kinds-output=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070022 rebase_path("$root_out_dir/spirv-tools/operand.kinds-$version.inc",
23 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040024 ]
25 }
26}
27
28spirv_core_tables("1.0") {
29 version = "1.0"
30}
Ethan Nicholas0d67faf2017-07-20 10:26:28 -040031
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040032spirv_core_tables("1.1") {
33 version = "1.1"
34}
35
Ethan Nicholas0d67faf2017-07-20 10:26:28 -040036spirv_core_tables("1.2") {
37 version = "1.2"
38}
39
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040040action("spirv_glsl_tables") {
41 script = "../externals/spirv-tools/utils/generate_grammar_tables.py"
42 sources = [
43 "../externals/spirv-headers/include/spirv/1.0/extinst.glsl.std.450.grammar.json",
44 "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json",
45 ]
46 outputs = [
47 "$root_out_dir/spirv-tools/glsl.std.450.insts-1.0.inc",
48 ]
49 args = [
50 "--spirv-core-grammar=" + rebase_path(
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070051 "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json",
52 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040053 "--extinst-glsl-grammar=" +
54 rebase_path("../externals/spirv-headers/include/spirv/1.0/" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070055 "extinst.glsl.std.450.grammar.json",
56 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040057 "--glsl-insts-output=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070058 rebase_path("$root_out_dir/spirv-tools/glsl.std.450.insts-1.0.inc",
59 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040060 ]
61}
62
Ethan Nicholas0d67faf2017-07-20 10:26:28 -040063action("spirv_extension_enum") {
64 script = "../externals/spirv-tools/utils/generate_grammar_tables.py"
65 sources = [
66 "../externals/spirv-headers/include/spirv/1.0/extinst.glsl.std.450.grammar.json",
67 "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json",
68 ]
69 outputs = [
70 "$root_out_dir/spirv-tools/extension_enum.inc",
71 ]
72 args = [
73 "--spirv-core-grammar=" + rebase_path(
74 "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json",
75 root_build_dir),
76 "--extension-enum-output=" +
77 rebase_path("$root_out_dir/spirv-tools/extension_enum.inc",
78 root_build_dir),
79 "--enum-string-mapping-output=" +
80 rebase_path("$root_out_dir/spirv-tools/enum_string_mapping.inc",
81 root_build_dir),
82 ]
83}
84
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040085action("spirv_opencl_tables") {
86 script = "../externals/spirv-tools/utils/generate_grammar_tables.py"
87 sources = [
88 "../externals/spirv-headers/include/spirv/1.0/extinst.opencl.std.100.grammar.json",
89 "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json",
90 ]
91 outputs = [
92 "$root_out_dir/spirv-tools/opencl.std.insts-1.0.inc",
93 ]
94 args = [
95 "--spirv-core-grammar=" + rebase_path(
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -070096 "../externals/spirv-headers/include/spirv/1.0/spirv.core.grammar.json",
97 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -040098 "--extinst-opencl-grammar=" +
99 rebase_path("../externals/spirv-headers/include/spirv/1.0/" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -0700100 "extinst.glsl.std.450.grammar.json",
101 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400102 "--opencl-insts-output=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -0700103 rebase_path("$root_out_dir/spirv-tools/opencl.std.insts-1.0.inc",
104 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400105 ]
106}
107
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400108template("spirv_vendor_tables") {
109 vendor_table = invoker.vendor_table
110 action("spirv_vendor_tables_" + target_name) {
111 script = "../externals/spirv-tools/utils/generate_grammar_tables.py"
112 sources = [
113 "../externals/spirv-tools/source/extinst.$vendor_table.grammar.json",
114 ]
115 outputs = [
116 "$root_out_dir/spirv-tools/$vendor_table.insts.inc",
117 ]
118 args = [
119 "--extinst-vendor-grammar=" + rebase_path(
120 "../externals/spirv-tools/source/extinst.$vendor_table.grammar.json",
121 root_build_dir),
122 "--vendor-insts-output=" +
123 rebase_path("$root_out_dir/spirv-tools/$vendor_table.insts.inc",
124 root_build_dir),
125 ]
126 }
127}
128
129spirv_vendor_tables("amd_shader_explicit_vertex_parameter") {
130 vendor_table = "spv-amd-shader-explicit-vertex-parameter"
131}
132
133spirv_vendor_tables("amd_shader_trinary_minmax") {
134 vendor_table = "spv-amd-shader-trinary-minmax"
135}
136
137spirv_vendor_tables("amd_shader_gcn_shader") {
138 vendor_table = "spv-amd-gcn-shader"
139}
140
141spirv_vendor_tables("amd_shader_ballot") {
142 vendor_table = "spv-amd-shader-ballot"
143}
144
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400145action("spirv_build_version") {
146 script = "../externals/spirv-tools/utils/update_build_version.py"
147 sources = [
148 "../externals/spirv-tools/CHANGES",
149 ]
150 outputs = [
Ethan Nicholas0e4e4102017-09-22 17:06:35 -0400151 "$root_out_dir/spirv-tools/build-version.inc",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400152 ]
153 args = [
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -0700154 rebase_path("../externals/spirv-tools", root_build_dir),
155 rebase_path("$root_out_dir/spirv-tools/build-version.inc", root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400156 ]
157}
158
159action("spirv_generators") {
160 script = "../externals/spirv-tools/utils/generate_registry_tables.py"
161 sources = [
162 "../externals/spirv-headers/include/spirv/spir-v.xml",
163 ]
164 outputs = [
165 "$root_out_dir/spirv-tools/generators.inc",
166 ]
167 args = [
168 "--xml=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -0700169 rebase_path("../externals/spirv-headers/include/spirv/spir-v.xml",
170 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400171 "--generator-output=" +
Wei-Yin Chen (陳威尹)56a1e6a2017-05-24 00:59:19 -0700172 rebase_path("$root_out_dir/spirv-tools/generators.inc",
173 root_build_dir,
174 root_build_dir),
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400175 ]
176}
177
178third_party("spirv-tools") {
179 public_include_dirs = [
180 "../externals/spirv-tools/include",
181 "../externals/spirv-tools/source",
182 "$root_out_dir/spirv-tools",
183 ]
184 deps = [
185 ":spirv_build_version",
186 ":spirv_core_tables_1.0",
187 ":spirv_core_tables_1.1",
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400188 ":spirv_core_tables_1.2",
189 ":spirv_extension_enum",
Ethan Nicholasdc3c3362017-03-16 12:16:20 -0400190 ":spirv_generators",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400191 ":spirv_glsl_tables",
192 ":spirv_opencl_tables",
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400193 ":spirv_vendor_tables_amd_shader_ballot",
194 ":spirv_vendor_tables_amd_shader_explicit_vertex_parameter",
195 ":spirv_vendor_tables_amd_shader_gcn_shader",
196 ":spirv_vendor_tables_amd_shader_trinary_minmax",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400197 "//third_party/spirv-headers",
198 ]
199 sources = [
200 "../externals/spirv-tools/source/assembly_grammar.cpp",
201 "../externals/spirv-tools/source/binary.cpp",
202 "../externals/spirv-tools/source/diagnostic.cpp",
203 "../externals/spirv-tools/source/disassemble.cpp",
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400204 "../externals/spirv-tools/source/enum_string_mapping.cpp",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400205 "../externals/spirv-tools/source/ext_inst.cpp",
206 "../externals/spirv-tools/source/extensions.cpp",
207 "../externals/spirv-tools/source/libspirv.cpp",
208 "../externals/spirv-tools/source/message.cpp",
209 "../externals/spirv-tools/source/name_mapper.cpp",
210 "../externals/spirv-tools/source/opcode.cpp",
211 "../externals/spirv-tools/source/operand.cpp",
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400212 "../externals/spirv-tools/source/opt/aggressive_dead_code_elim_pass.cpp",
213 "../externals/spirv-tools/source/opt/basic_block.cpp",
214 "../externals/spirv-tools/source/opt/block_merge_pass.cpp",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400215 "../externals/spirv-tools/source/opt/build_module.cpp",
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400216 "../externals/spirv-tools/source/opt/compact_ids_pass.cpp",
217 "../externals/spirv-tools/source/opt/dead_branch_elim_pass.cpp",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400218 "../externals/spirv-tools/source/opt/def_use_manager.cpp",
219 "../externals/spirv-tools/source/opt/eliminate_dead_constant_pass.cpp",
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400220 "../externals/spirv-tools/source/opt/flatten_decoration_pass.cpp",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400221 "../externals/spirv-tools/source/opt/fold_spec_constant_op_and_composite_pass.cpp",
222 "../externals/spirv-tools/source/opt/freeze_spec_constant_value_pass.cpp",
223 "../externals/spirv-tools/source/opt/function.cpp",
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400224 "../externals/spirv-tools/source/opt/inline_pass.cpp",
225 "../externals/spirv-tools/source/opt/insert_extract_elim.cpp",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400226 "../externals/spirv-tools/source/opt/instruction.cpp",
227 "../externals/spirv-tools/source/opt/ir_loader.cpp",
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400228 "../externals/spirv-tools/source/opt/local_access_chain_convert_pass.cpp",
229 "../externals/spirv-tools/source/opt/local_single_block_elim_pass.cpp",
230 "../externals/spirv-tools/source/opt/local_single_store_elim_pass.cpp",
231 "../externals/spirv-tools/source/opt/local_ssa_elim_pass.cpp",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400232 "../externals/spirv-tools/source/opt/module.cpp",
233 "../externals/spirv-tools/source/opt/optimizer.cpp",
234 "../externals/spirv-tools/source/opt/pass_manager.cpp",
235 "../externals/spirv-tools/source/opt/set_spec_constant_default_value_pass.cpp",
236 "../externals/spirv-tools/source/opt/strip_debug_info_pass.cpp",
237 "../externals/spirv-tools/source/opt/type_manager.cpp",
238 "../externals/spirv-tools/source/opt/types.cpp",
239 "../externals/spirv-tools/source/opt/unify_const_pass.cpp",
240 "../externals/spirv-tools/source/parsed_operand.cpp",
241 "../externals/spirv-tools/source/print.cpp",
242 "../externals/spirv-tools/source/software_version.cpp",
243 "../externals/spirv-tools/source/spirv_endian.cpp",
244 "../externals/spirv-tools/source/spirv_target_env.cpp",
245 "../externals/spirv-tools/source/spirv_validator_options.cpp",
246 "../externals/spirv-tools/source/table.cpp",
247 "../externals/spirv-tools/source/text.cpp",
248 "../externals/spirv-tools/source/text_handler.cpp",
249 "../externals/spirv-tools/source/util/parse_number.cpp",
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400250 "../externals/spirv-tools/source/util/string_utils.cpp",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400251 "../externals/spirv-tools/source/val/basic_block.cpp",
252 "../externals/spirv-tools/source/val/construct.cpp",
253 "../externals/spirv-tools/source/val/function.cpp",
254 "../externals/spirv-tools/source/val/instruction.cpp",
255 "../externals/spirv-tools/source/val/validation_state.cpp",
256 "../externals/spirv-tools/source/validate.cpp",
Ethan Nicholas0d67faf2017-07-20 10:26:28 -0400257 "../externals/spirv-tools/source/validate_capability.cpp",
Ethan Nicholasa6ae1f72017-03-16 09:56:54 -0400258 "../externals/spirv-tools/source/validate_cfg.cpp",
259 "../externals/spirv-tools/source/validate_datarules.cpp",
260 "../externals/spirv-tools/source/validate_decorations.cpp",
261 "../externals/spirv-tools/source/validate_id.cpp",
262 "../externals/spirv-tools/source/validate_instruction.cpp",
263 "../externals/spirv-tools/source/validate_layout.cpp",
264 "../externals/spirv-tools/source/validate_type_unique.cpp",
265 ]
266}