mirror of
https://github.com/RPCS3/glslang.git
synced 2025-02-16 08:59:16 +00:00
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.
This commit is contained in:
parent
349ac3df86
commit
45d49bcd51
@ -155,6 +155,7 @@ int Options = 0;
|
|||||||
const char* ExecutableName = nullptr;
|
const char* ExecutableName = nullptr;
|
||||||
const char* binaryFileName = nullptr;
|
const char* binaryFileName = nullptr;
|
||||||
const char* entryPointName = nullptr;
|
const char* entryPointName = nullptr;
|
||||||
|
const char* shaderTargetName = nullptr;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create the default name for saving a binary if -o is not provided.
|
// 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 |= EOptionVulkanRules;
|
||||||
Options |= EOptionLinkProgram;
|
Options |= EOptionLinkProgram;
|
||||||
break;
|
break;
|
||||||
|
case 'T':
|
||||||
|
shaderTargetName = argv[1];
|
||||||
|
if (argc > 0) {
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Error("no <target> specified for -T");
|
||||||
|
break;
|
||||||
case 'G':
|
case 'G':
|
||||||
Options |= EOptionSpv;
|
Options |= EOptionSpv;
|
||||||
Options |= EOptionLinkProgram;
|
Options |= EOptionLinkProgram;
|
||||||
@ -260,6 +270,7 @@ void ProcessArguments(int argc, char* argv[])
|
|||||||
case 'e':
|
case 'e':
|
||||||
// HLSL todo: entry point handle needs much more sophistication.
|
// HLSL todo: entry point handle needs much more sophistication.
|
||||||
// This is okay for one compilation unit with one entry point.
|
// 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];
|
entryPointName = argv[1];
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
argc--;
|
argc--;
|
||||||
@ -685,6 +696,9 @@ EShLanguage FindLanguage(const std::string& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string suffix = name.substr(ext + 1, std::string::npos);
|
std::string suffix = name.substr(ext + 1, std::string::npos);
|
||||||
|
if (shaderTargetName)
|
||||||
|
suffix = shaderTargetName;
|
||||||
|
|
||||||
if (suffix == "vert")
|
if (suffix == "vert")
|
||||||
return EShLangVertex;
|
return EShLangVertex;
|
||||||
else if (suffix == "tesc")
|
else if (suffix == "tesc")
|
||||||
@ -778,6 +792,8 @@ void usage()
|
|||||||
" -H print human readable form of SPIR-V; turns on -V\n"
|
" -H print human readable form of SPIR-V; turns on -V\n"
|
||||||
" -E print pre-processed GLSL; cannot be used with -l;\n"
|
" -E print pre-processed GLSL; cannot be used with -l;\n"
|
||||||
" errors will appear on stderr.\n"
|
" errors will appear on stderr.\n"
|
||||||
|
" -T <target> uses explicit target specified, rather then the file extension.\n"
|
||||||
|
" valid choices are vert,tesc, tese,geom, rag,comp\n"
|
||||||
" -c configuration dump;\n"
|
" -c configuration dump;\n"
|
||||||
" creates the default configuration file (redirect to a .conf file)\n"
|
" creates the default configuration file (redirect to a .conf file)\n"
|
||||||
" -C cascading errors; risks crashes from accumulation of error recoveries\n"
|
" -C cascading errors; risks crashes from accumulation of error recoveries\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user