Add flags for outputting absolute paths for messages (#3467)
Uses std::filesystem to create absolute paths. Also adds "shaderFileName" to TSinkBase so it can be used during message outputs.
This commit is contained in:
parent
e7d4ad91a9
commit
d73712b8f6
7 changed files with 73 additions and 40 deletions
|
|
@ -182,6 +182,7 @@ bool HlslEnable16BitTypes = false;
|
|||
bool HlslDX9compatible = false;
|
||||
bool HlslDxPositionW = false;
|
||||
bool EnhancedMsgs = false;
|
||||
bool AbsolutePath = false;
|
||||
bool DumpBuiltinSymbols = false;
|
||||
std::vector<std::string> IncludeDirectoryList;
|
||||
|
||||
|
|
@ -727,6 +728,8 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
|||
HlslDxPositionW = true;
|
||||
} else if (lowerword == "enhanced-msgs") {
|
||||
EnhancedMsgs = true;
|
||||
} else if (lowerword == "absolute-path") {
|
||||
AbsolutePath = true;
|
||||
} else if (lowerword == "auto-sampled-textures") {
|
||||
autoSampledTextures = true;
|
||||
} else if (lowerword == "invert-y" || // synonyms
|
||||
|
|
@ -1159,6 +1162,8 @@ void SetMessageOptions(EShMessages& messages)
|
|||
messages = (EShMessages)(messages | EShMsgBuiltinSymbolTable);
|
||||
if (EnhancedMsgs)
|
||||
messages = (EShMessages)(messages | EShMsgEnhanced);
|
||||
if (AbsolutePath)
|
||||
messages = (EShMessages)(messages | EShMsgAbsolutePath);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1190,6 +1195,7 @@ void CompileShaders(glslang::TWorklist& worklist)
|
|||
if (compiler == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
CompileFile(workItem->name.c_str(), compiler);
|
||||
|
||||
if (! (Options & EOptionSuppressInfolog))
|
||||
|
|
@ -1878,7 +1884,7 @@ void CompileFile(const char* fileName, ShHandle compiler)
|
|||
for (int j = 0; j < ((Options & EOptionMemoryLeakMode) ? 100 : 1); ++j) {
|
||||
// ret = ShCompile(compiler, shaderStrings, NumShaderStrings, lengths, EShOptNone, &Resources, Options, (Options & EOptionDefaultDesktop) ? 110 : 100, false, messages);
|
||||
ret = ShCompile(compiler, &shaderString, 1, nullptr, EShOptNone, GetResources(), 0,
|
||||
(Options & EOptionDefaultDesktop) ? 110 : 100, false, messages);
|
||||
(Options & EOptionDefaultDesktop) ? 110 : 100, false, messages, fileName);
|
||||
// const char* multi[12] = { "# ve", "rsion", " 300 e", "s", "\n#err",
|
||||
// "or should be l", "ine 1", "string 5\n", "float glo", "bal",
|
||||
// ";\n#error should be line 2\n void main() {", "global = 2.3;}" };
|
||||
|
|
@ -1993,6 +1999,7 @@ void usage()
|
|||
" without explicit bindings\n"
|
||||
" --auto-map-locations | --aml automatically locate input/output lacking\n"
|
||||
" 'location' (fragile, not cross stage)\n"
|
||||
" --absolute-path Prints absolute path for messages\n"
|
||||
" --auto-sampled-textures Removes sampler variables and converts\n"
|
||||
" existing textures to sampled textures\n"
|
||||
" --client {vulkan<ver>|opengl<ver>} see -V and -G\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue