-
Notifications
You must be signed in to change notification settings - Fork 2
/
_build_assets.py
91 lines (63 loc) · 2.58 KB
/
_build_assets.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/python
import os
import sys
import time
import subprocess
import urllib
G_ROOT_DIR = "R:/SummerTraining";
G_BUILD_DIR = "../.Build/";
G_DEMOS_DIR = "../_Demos/";
G_ENGINE_DIR = "../_Engine/";
G_BINARIES_DIR = "../_Binaries/";
#shaderc_exe = os.path.join( G_ROOT_DIR, 'shaderc.exe' )
shaderc_exe = 'shaderc.exe'
input_folder = "R:/SummerTraining/_Demos/";
output_folder = "R:/SummerTraining/_Demos/runtime/shaders";
def quote( s ):
return '"%s"' % s
def CompileShaderD3D11( folder, filename ):
if filename.startswith('fs_'):
shaderType = '"f"'
shaderProfile = '"ps_4_0"'
if filename.startswith('vs_'):
shaderType = '"v"'
shaderProfile = '"vs_4_0"'
#print( 'Compiling ' + filename + ' in ' + folder )
filebase, fileext = os.path.splitext( filename )
input_path = os.path.join( folder, filename )
input_path = os.path.normpath( input_path )
output_filename = filebase + '.bin'
output_path = os.path.join( output_folder, 'dx11', output_filename )
output_path = os.path.normpath( output_path )
#print( 'input_path = ' + input_path + ', output_path = ' + output_path )
args = [ shaderc_exe,
'-f', quote(input_path),
'-o', quote(output_path), '--type', shaderType,
'-i', '"bgfx/src;bgfx/examples/common"',
'--platform', '"windows"',
'--profile', shaderProfile,
'-o3'
]
cmd = ''
for arg in args:
cmd += ' ' + arg
print( cmd )
os.chdir(G_ROOT_DIR);
subprocess.call( args )
#subprocess.call( shaderc_exe, '-f', input_path, '-o', output_path, '--type', shaderType, '-i', "bgfx/src;bgfx/examples/common", '--platform', "windows", '--profile', shaderProfile, '-o3' )
#status = os.system( cmd )
#print( "Status: ", status )
#subprocess.call( cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
#subprocess.call( cmd )
#process = subprocess.Popen( cmd )
#process.wait()
#from subprocess import call
#call( cmd )
#time.sleep(3)
#input("Press Enter to continue...")
return
#os.system('"C:/Windows/System32/notepad.exe"')
for folder, subs, files in os.walk( "R:/SummerTraining/_Demos" ):
for filename in files:
if (not filename.startswith('varying.def')) and filename.endswith('sc'):
CompileShaderD3D11( folder, filename )