NouVeL/ADVect/shader.py

33 lines
No EOL
1.2 KiB
Python

import subprocess, os
SHADERC = "..\\out\\install\\x64-Debug\\bin\\shaderc"
OUT = "..\\out\\build\\x64-Debug\\ADVect\\shaders\\"
# OUT = "..\\build\\ADVect\\shaders\\"
P = lambda location, frag, vert: { 'location': location, 'frag': frag, 'vert': vert }
plats = [
P('glsl', '140', '140'),
P('dx11', 'ps_5_0', 'vs_5_0'),
P('spirv', 'spirv', 'spirv')
]
for root, dirs, _ in os.walk('shaders'):
for name in dirs:
for config in plats:
subprocess.run([SHADERC, "-f", os.path.join(root, name, name + '.frag'),
"--type", "fragment"
"--platform", "windows",
"--profile", config['frag'],
"--varyingdef", os.path.join(root, name, "varying.def.sc"),
"-i", "ext\\bgfx\\bgfx\\examples\\common",
"-i", "ext\\bgfx\\bgfx\\src",
"-o", OUT + config['location'] + "\\" + name + ".frag.bin"])
subprocess.run([SHADERC, "-f", os.path.join(root, name, name + '.vert'),
"--type", "vertex"
"--platform", "windows",
"--profile", config['vert'],
"--varyingdef", os.path.join(root, name, "varying.def.sc"),
"-i", "ext\\bgfx\\bgfx\\examples\\common",
"-i", "ext\\bgfx\\bgfx\\src",
"-o", OUT + config['location'] + "\\" + name + ".vert.bin"])