19input_root_dir = sys.argv[4]
20output_root_dir = sys.argv[5]
22input_file = sys.argv[6]
23with open(input_file,
'r')
as reader:
24 inputs = shlex.split(reader.read())
30 output = subprocess.check_output([
31 skslc, worklist.name], stderr=subprocess.STDOUT).
decode(
'utf-8', errors=
'ignore')
32 except subprocess.CalledProcessError
as err:
33 if err.returncode != 1:
34 print(
"### " + input +
" skslc error:\n")
36 print(
"\n".
join(err.output.decode(
'utf-8', errors=
'ignore').splitlines()))
37 sys.exit(err.returncode)
41 os.remove(worklist.name)
44 if (ext ==
'.compute'):
46 return ext
if (ext ==
'.frag' or ext ==
'.vert')
else '.frag'
48if settings !=
"--settings" and settings !=
"--nosettings":
49 sys.exit(
"### Expected --settings or --nosettings, got " + settings)
51worklist = tempfile.NamedTemporaryFile(suffix=
'.worklist', delete=
False, mode=
'w')
57 target = input.replace(input_root_dir, output_root_dir)
58 target = os.path.splitext(target)[0]
59 target_dir = os.path.dirname(target)
60 if not os.path.isdir(target_dir):
63 noExt, ext = os.path.splitext(input)
64 head, tail = os.path.split(noExt)
66 if settings ==
"--nosettings":
67 target +=
"StandaloneSettings"
70 worklist.write(input +
"\n")
71 worklist.write(target +
".glsl\n")
72 worklist.write(settings +
"\n\n")
73 elif lang ==
"--metal":
74 worklist.write(input +
"\n")
75 worklist.write(target +
".metal\n")
76 worklist.write(settings +
"\n\n")
77 elif lang ==
"--hlsl":
78 worklist.write(input +
"\n")
79 worklist.write(target +
".hlsl\n")
80 worklist.write(settings +
"\n\n")
81 elif lang ==
"--spirv":
82 worklist.write(input +
"\n")
84 worklist.write(settings +
"\n\n")
85 elif lang ==
"--skrp":
86 worklist.write(input +
"\n")
87 worklist.write(target +
".skrp\n")
88 worklist.write(settings +
"\n\n")
89 elif lang ==
"--stage":
90 worklist.write(input +
"\n")
91 worklist.write(target +
".stage\n")
92 worklist.write(settings +
"\n\n")
93 elif lang ==
"--wgsl":
94 worklist.write(input +
"\n")
95 worklist.write(target +
".wgsl\n")
96 worklist.write(settings +
"\n\n")
98 sys.exit(
"### Expected one of: --glsl --metal --hlsl --spirv --skrp " +
99 "--stage --wgsl, got " + lang)
104 worklist = tempfile.NamedTemporaryFile(suffix=
'.worklist', delete=
False, mode=
'w')
111 os.remove(worklist.name)
def extensionForSpirvAsm(ext)
def executeWorklist(input, worklist)
def print(*args, **kwargs)
static DecodeResult decode(std::string path)
static SkString join(const CommandLineFlags::StringArray &)