NouVeL/ADVect/shader.py

33 lines
1.2 KiB
Python
Raw Normal View History

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 }
2022-08-21 16:24:13 -04:00
plats = [
P('glsl', '140', '140'),
P('dx11', 'ps_5_0', 'vs_5_0'),
P('spirv', 'spirv', 'spirv')
2022-08-21 16:24:13 -04:00
]
for root, dirs, _ in os.walk('shaders'):
for name in dirs:
2022-08-21 16:24:13 -04:00
for config in plats:
subprocess.run([SHADERC, "-f", os.path.join(root, name, name + '.frag'),
2022-08-21 16:24:13 -04:00
"--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'),
2022-08-21 16:24:13 -04:00
"--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"])
2022-08-21 16:24:13 -04:00