From 45d49bcd51046ecf33711b2bc6822634d68b2da6 Mon Sep 17 00:00:00 2001 From: dankbaker Date: Mon, 8 Aug 2016 21:43:07 -0400 Subject: [PATCH 1/4] Allowing explicit specification of shader compiltion type via -T option, rather then looking at file extension. For HLSL files, this is nice because .hlsl extension is natively udnerstood by visual studio, likely to be used with the -e option. --- StandAlone/StandAlone.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index c014be20..151141f0 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -155,6 +155,7 @@ int Options = 0; const char* ExecutableName = nullptr; const char* binaryFileName = nullptr; const char* entryPointName = nullptr; +const char* shaderTargetName = nullptr; // // Create the default name for saving a binary if -o is not provided. @@ -236,6 +237,15 @@ void ProcessArguments(int argc, char* argv[]) Options |= EOptionVulkanRules; Options |= EOptionLinkProgram; break; + case 'T': + shaderTargetName = argv[1]; + if (argc > 0) { + argc--; + argv++; + } + else + Error("no specified for -T"); + break; case 'G': Options |= EOptionSpv; Options |= EOptionLinkProgram; @@ -260,6 +270,7 @@ void ProcessArguments(int argc, char* argv[]) case 'e': // HLSL todo: entry point handle needs much more sophistication. // This is okay for one compilation unit with one entry point. + // dankbaker - not sure it needs to be, fxc has no more sophistication then this entryPointName = argv[1]; if (argc > 0) { argc--; @@ -685,6 +696,9 @@ EShLanguage FindLanguage(const std::string& name) } std::string suffix = name.substr(ext + 1, std::string::npos); + if (shaderTargetName) + suffix = shaderTargetName; + if (suffix == "vert") return EShLangVertex; else if (suffix == "tesc") @@ -778,6 +792,8 @@ void usage() " -H print human readable form of SPIR-V; turns on -V\n" " -E print pre-processed GLSL; cannot be used with -l;\n" " errors will appear on stderr.\n" + " -T uses explicit target specified, rather then the file extension.\n" + " valid choices are vert,tesc, tese,geom, rag,comp\n" " -c configuration dump;\n" " creates the default configuration file (redirect to a .conf file)\n" " -C cascading errors; risks crashes from accumulation of error recoveries\n" From c6ede8938a0964671b34a2aab0b4abbd0c2c1f40 Mon Sep 17 00:00:00 2001 From: Dan Baker Date: Thu, 11 Aug 2016 14:06:06 -0400 Subject: [PATCH 2/4] Changing target to stage --- StandAlone/StandAlone.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index 151141f0..f560847a 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -155,7 +155,7 @@ int Options = 0; const char* ExecutableName = nullptr; const char* binaryFileName = nullptr; const char* entryPointName = nullptr; -const char* shaderTargetName = nullptr; +const char* shaderStageName = nullptr; // // Create the default name for saving a binary if -o is not provided. @@ -238,7 +238,7 @@ void ProcessArguments(int argc, char* argv[]) Options |= EOptionLinkProgram; break; case 'T': - shaderTargetName = argv[1]; + shaderStageName = argv[1]; if (argc > 0) { argc--; argv++; @@ -696,8 +696,8 @@ EShLanguage FindLanguage(const std::string& name) } std::string suffix = name.substr(ext + 1, std::string::npos); - if (shaderTargetName) - suffix = shaderTargetName; + if (shaderStageName) + suffix = shaderStageName; if (suffix == "vert") return EShLangVertex; @@ -792,7 +792,7 @@ void usage() " -H print human readable form of SPIR-V; turns on -V\n" " -E print pre-processed GLSL; cannot be used with -l;\n" " errors will appear on stderr.\n" - " -T uses explicit target specified, rather then the file extension.\n" + " -S uses explicit stage specified, rather then the file extension.\n" " valid choices are vert,tesc, tese,geom, rag,comp\n" " -c configuration dump;\n" " creates the default configuration file (redirect to a .conf file)\n" From 895275e35790656aae3b97d0547a78b96a7648aa Mon Sep 17 00:00:00 2001 From: Dan Baker Date: Thu, 11 Aug 2016 14:55:49 -0400 Subject: [PATCH 3/4] Standalone: Changing some comments and user strings --- StandAlone/StandAlone.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index f560847a..da12e9c4 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -244,7 +244,7 @@ void ProcessArguments(int argc, char* argv[]) argv++; } else - Error("no specified for -T"); + Error("no specified for -T"); break; case 'G': Options |= EOptionSpv; @@ -270,7 +270,6 @@ void ProcessArguments(int argc, char* argv[]) case 'e': // HLSL todo: entry point handle needs much more sophistication. // This is okay for one compilation unit with one entry point. - // dankbaker - not sure it needs to be, fxc has no more sophistication then this entryPointName = argv[1]; if (argc > 0) { argc--; @@ -793,7 +792,7 @@ void usage() " -E print pre-processed GLSL; cannot be used with -l;\n" " errors will appear on stderr.\n" " -S uses explicit stage specified, rather then the file extension.\n" - " valid choices are vert,tesc, tese,geom, rag,comp\n" + " valid choices are vert, tesc, tese, geom, frag, or comp\n" " -c configuration dump;\n" " creates the default configuration file (redirect to a .conf file)\n" " -C cascading errors; risks crashes from accumulation of error recoveries\n" From 5afdd7813193425d0ca727966569596d7b7cfc04 Mon Sep 17 00:00:00 2001 From: Dan Baker Date: Thu, 11 Aug 2016 17:53:57 -0400 Subject: [PATCH 4/4] Standalong: Changing -T to -S since it's a stage now instead of a target --- StandAlone/StandAlone.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index da12e9c4..db3891b8 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -237,14 +237,14 @@ void ProcessArguments(int argc, char* argv[]) Options |= EOptionVulkanRules; Options |= EOptionLinkProgram; break; - case 'T': + case 'S': shaderStageName = argv[1]; if (argc > 0) { argc--; argv++; } else - Error("no specified for -T"); + Error("no specified for -S"); break; case 'G': Options |= EOptionSpv;