aboutsummaryrefslogtreecommitdiff
path: root/tools/buildHeaders/bin/makeExtinstHeaders.py
blob: 9359747cc97f65d4a9001293ba93db9527b7b5e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python3
"""Generate C headers for certain extended instruction sets"""

import subprocess
import os

# Assume we are running from the tools/buildHeaders directory
os.chdir('../../include/spirv/unified1')

def mk_extinst(name, grammar_file):
  """Generate one C header from a grammar"""
  script = '../../../tools/buildHeaders/bin/generate_language_headers.py'
  subprocess.check_call(['python3',
                         script,
                         '--extinst-name=' + name,
                         '--extinst-grammar=' + grammar_file,
                         '--extinst-output-base=' + name])
  subprocess.check_call(['dos2unix', name + '.h'])


mk_extinst('DebugInfo', 'extinst.debuginfo.grammar.json')
mk_extinst('OpenCLDebugInfo100', 'extinst.opencl.debuginfo.100.grammar.json')
mk_extinst('AMD_gcn_shader', 'extinst.spv-amd-gcn-shader.grammar.json')
mk_extinst('AMD_shader_ballot', 'extinst.spv-amd-shader-ballot.grammar.json')
mk_extinst('AMD_shader_explicit_vertex_parameter', 'extinst.spv-amd-shader-explicit-vertex-parameter.grammar.json')
mk_extinst('AMD_shader_trinary_minmax', 'extinst.spv-amd-shader-trinary-minmax.grammar.json')
mk_extinst('NonSemanticDebugPrintf', 'extinst.nonsemantic.debugprintf.grammar.json')
mk_extinst('NonSemanticClspvReflection', 'extinst.nonsemantic.clspvreflection.grammar.json')