added shadercompile for spir-v

This commit is contained in:
Turanszki Janos
2018-02-23 22:12:37 +00:00
parent 3a3548ebee
commit 6be3490ca5
3 changed files with 49 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
import os
import xml.etree.ElementTree as ET
tree = ET.parse('WickedEngine/WickedEngine_SHADERS.vcxproj')
root = tree.getroot()
## Hardcode visual studio namespace for now...
namespace = "{http://schemas.microsoft.com/developer/msbuild/2003}"
file = open("build_SPIRV.bat", "w")
outputdir = "spirv"
## First, ensure that we have the optuput directory:
file.write("cd WickedEngine\shaders \n")
file.write("mkdir " + outputdir + "\n")
file.write("cd .. \n")
## Then we parse the default shader project and generate build task for an other shader compiler:
for shader in root.iter(namespace + "FxCompile"):
for shaderprofile in shader.iter(namespace + "ShaderType"):
profile = shaderprofile.text
name = shader.attrib["Include"]
print profile + ": " + name
file.write("..\shadercompilers\dxc " + name + " -T ")
if profile == "Vertex":
file.write("vs")
if profile == "Pixel":
file.write("ps")
if profile == "Geometry":
file.write("gs")
if profile == "Hull":
file.write("hs")
if profile == "Domain":
file.write("ds")
if profile == "Compute":
file.write("cs")
file.write("_6_0 ")
file.write(" -spirv -flegacy-macro-expansion -Fo " + "shaders/" + outputdir + "/" + os.path.splitext(name)[0] + ".cso \n")
file.close()
Binary file not shown.
Binary file not shown.