MCPcopy Create free account
hub / github.com/csyonghe/Spire / wmain

Function wmain

Source/SpireCompiler/ShaderCompilerShell.cpp:23–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23int wmain(int argc, wchar_t* argv[])
24{
25 int returnValue = -1;
26 {
27 // We need to parse any command-line arguments.
28 String outputDir;
29 CompileOptions options;
30
31 // As we parse the command line, we will rewrite the
32 // entries in `argv` to collect any "ordinary" arguments.
33 wchar_t const** inputPaths = (wchar_t const**)&argv[1];
34 wchar_t const** inputPathCursor = inputPaths;
35
36 wchar_t** argCursor = &argv[1];
37 wchar_t** argEnd = &argv[argc];
38 while (argCursor != argEnd)
39 {
40 wchar_t const* arg = *argCursor++;
41 if (arg[0] == '-')
42 {
43 String argStr = String::FromWString(arg);
44
45 // The argument looks like an option, so try to parse it.
46 if (argStr == "-out")
47 outputDir = tryReadCommandLineArgument(arg, &argCursor, argEnd);
48 else if (argStr == "-symbo")
49 options.SymbolToCompile = tryReadCommandLineArgument(arg, &argCursor, argEnd);
50 else if (argStr == "-schedule")
51 options.ScheduleFileName = tryReadCommandLineArgument(arg, &argCursor, argEnd);
52 else if (argStr == "-backend")
53 {
54 String name = tryReadCommandLineArgument(arg, &argCursor, argEnd);
55 if (name == "glsl")
56 {
57 options.Target = CodeGenTarget::GLSL;
58 }
59 else if (name == "glsl_vk")
60 {
61 options.Target = CodeGenTarget::GLSL_Vulkan;
62 }
63 else if (name == "glsl_vk_onedesc")
64 {
65 options.Target = CodeGenTarget::GLSL_Vulkan_OneDesc;
66 }
67 else if (name == "hlsl")
68 {
69 options.Target = CodeGenTarget::HLSL;
70 }
71 else if (name == "spriv")
72 {
73 options.Target = CodeGenTarget::SPIRV;
74 }
75 else
76 {
77 fprintf(stderr, "unknown code generation target '%S'\n", name.ToWString());
78 }
79 }
80 else if (argStr == "-genchoice")

Callers

nothing calls this directly

Calls 10

CodePositionClass · 0.85
ToWStringMethod · 0.80
SaveToFileMethod · 0.80
diagnoseMethod · 0.80
GetErrorWriterMethod · 0.80
PrintDiagnosticsMethod · 0.80
LengthMethod · 0.45
GetErrorCountMethod · 0.45

Tested by

no test coverage detected