diff --git a/deps/glslang/glslang/glslang/Include/InfoSink.h b/deps/glslang/glslang/glslang/Include/InfoSink.h index b48a966171..89de84042e 100644 --- a/deps/glslang/glslang/glslang/Include/InfoSink.h +++ b/deps/glslang/glslang/glslang/Include/InfoSink.h @@ -88,18 +88,12 @@ public: } } void location(const TSourceLoc& loc) { - const int maxSize = 24; - char locText[maxSize]; - snprintf(locText, maxSize, ":%d", loc.line); + char locText[24]; + snprintf(locText, 24, ":%d", loc.line); append(loc.getStringNameOrNum(false).c_str()); append(locText); append(": "); } - void message(TPrefixType message, const char* s) { - prefix(message); - append(s); - append("\n"); - } void message(TPrefixType message, const char* s, const TSourceLoc& loc) { prefix(message); location(loc); @@ -107,7 +101,6 @@ public: append("\n"); } -protected: void append(const char* s); void append(int count, char c); @@ -116,7 +109,7 @@ protected: void checkMem(size_t growth) { if (sink.capacity() < sink.size() + growth + 2) sink.reserve(sink.capacity() + sink.capacity() / 2); } - void appendToStream(const char* s); +protected: TPersistString sink; }; diff --git a/deps/glslang/glslang/glslang/MachineIndependent/ParseHelper.cpp b/deps/glslang/glslang/glslang/MachineIndependent/ParseHelper.cpp index 828e49651f..848e5600f6 100755 --- a/deps/glslang/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -92,7 +92,11 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b globalOutputDefaults.layoutStream = 0; if (entryPoint != nullptr && entryPoint->size() > 0 && *entryPoint != "main") - infoSink.info.message(EPrefixError, "Source entry point must be \"main\""); + { + infoSink.info.append("ERROR: "); + infoSink.info.append("Source entry point must be \"main\""); + infoSink.info.append("\n"); + } } TParseContext::~TParseContext() diff --git a/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp b/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp index 3bf1ae0304..937442e0e9 100644 --- a/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -82,7 +82,9 @@ static TBuiltInParseables* CreateBuiltInParseables(TInfoSink& infoSink, EShSourc #endif default: - infoSink.info.message(EPrefixInternalError, "Unable to determine source language"); + infoSink.info.append("INTERNAL ERROR: "); + infoSink.info.append("Unable to determine source language"); + infoSink.info.append("\n"); return nullptr; } } @@ -108,7 +110,9 @@ static TParseContextBase* CreateParseContext(TSymbolTable& symbolTable, TInterme language, infoSink, sourceEntryPointName.c_str(), forwardCompatible, messages); #endif default: - infoSink.info.message(EPrefixInternalError, "Unable to determine source language"); + infoSink.info.append("INTERNAL ERROR: "); + infoSink.info.append("Unable to determine source language"); + infoSink.info.append("\n"); return nullptr; } } @@ -252,7 +256,9 @@ static bool InitializeSymbolTable(const TString& builtIns, int version, EProfile TInputScanner input(1, builtInShaders, builtInLengths); if (! _parseContext->parseShaderStrings(ppContext, input) != 0) { - infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins"); + infoSink.info.append("INTERNAL ERROR: "); + infoSink.info.append("Unable to parse built-ins"); + infoSink.info.append("\n"); return false; } @@ -440,16 +446,16 @@ static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool ve } // Get a version... - if (version == 0) { + if (version == 0) version = defaultVersion; - // infoSink.info.message(EPrefixWarning, "#version: statement missing; use #version on first line of shader"); - } // Get a good profile... if (profile == ENoProfile) { if (version == 300 || version == 310 || version == 320) { correct = false; - infoSink.info.message(EPrefixError, "#version: versions 300, 310, and 320 require specifying the 'es' profile"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: versions 300, 310, and 320 require specifying the 'es' profile"); + infoSink.info.append("\n"); profile = EEsProfile; } else if (version == 100) profile = EEsProfile; @@ -461,7 +467,9 @@ static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool ve // a profile was provided... if (version < 150) { correct = false; - infoSink.info.message(EPrefixError, "#version: versions before 150 do not allow a profile token"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: versions before 150 do not allow a profile token"); + infoSink.info.append("\n"); if (version == 100) profile = EEsProfile; else @@ -469,13 +477,17 @@ static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool ve } else if (version == 300 || version == 310 || version == 320) { if (profile != EEsProfile) { correct = false; - infoSink.info.message(EPrefixError, "#version: versions 300, 310, and 320 support only the es profile"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: versions 300, 310, and 320 support only the es profile"); + infoSink.info.append("\n"); } profile = EEsProfile; } else { if (profile == EEsProfile) { correct = false; - infoSink.info.message(EPrefixError, "#version: only version 300, 310, and 320 support the es profile"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: only version 300, 310, and 320 support the es profile"); + infoSink.info.append("\n"); if (version >= FirstProfileVersion) profile = ECoreProfile; else @@ -511,7 +523,9 @@ static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool ve // unknown version default: correct = false; - infoSink.info.message(EPrefixError, "version not supported"); + infoSink.info.append("ERROR: "); + infoSink.info.append("version not supported"); + infoSink.info.append("\n"); if (profile == EEsProfile) version = 310; else { @@ -527,7 +541,9 @@ static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool ve if ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 150)) { correct = false; - infoSink.info.message(EPrefixError, "#version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above"); + infoSink.info.append("\n"); version = (profile == EEsProfile) ? 310 : 150; if (profile == EEsProfile || profile == ENoProfile) profile = ECoreProfile; @@ -538,7 +554,9 @@ static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool ve if ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 150)) { correct = false; - infoSink.info.message(EPrefixError, "#version: tessellation shaders require es profile with version 310 or non-es profile with version 150 or above"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: tessellation shaders require es profile with version 310 or non-es profile with version 150 or above"); + infoSink.info.append("\n"); version = (profile == EEsProfile) ? 310 : 400; // 150 supports the extension, correction is to 400 which does not if (profile == EEsProfile || profile == ENoProfile) profile = ECoreProfile; @@ -548,7 +566,9 @@ static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool ve if ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 420)) { correct = false; - infoSink.info.message(EPrefixError, "#version: compute shaders require es profile with version 310 or above, or non-es profile with version 420 or above"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: compute shaders require es profile with version 310 or above, or non-es profile with version 420 or above"); + infoSink.info.append("\n"); version = profile == EEsProfile ? 310 : 420; } break; @@ -558,7 +578,9 @@ static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool ve if (profile == EEsProfile && version >= 300 && versionNotFirst) { correct = false; - infoSink.info.message(EPrefixError, "#version: statement must appear first in es-profile shader; before comments or newlines"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: statement must appear first in es-profile shader; before comments or newlines"); + infoSink.info.append("\n"); } // Check for SPIR-V compatibility @@ -567,27 +589,37 @@ static bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool ve case EEsProfile: if (spvVersion.vulkan > 0 && version < 310) { correct = false; - infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: ES shaders for Vulkan SPIR-V require version 310 or higher"); + infoSink.info.append("\n"); version = 310; } if (spvVersion.openGl >= 100) { correct = false; - infoSink.info.message(EPrefixError, "#version: ES shaders for OpenGL SPIR-V are not supported"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: ES shaders for OpenGL SPIR-V are not supported"); + infoSink.info.append("\n"); version = 310; } break; case ECompatibilityProfile: - infoSink.info.message(EPrefixError, "#version: compilation for SPIR-V does not support the compatibility profile"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: compilation for SPIR-V does not support the compatibility profile"); + infoSink.info.append("\n"); break; default: if (spvVersion.vulkan > 0 && version < 140) { correct = false; - infoSink.info.message(EPrefixError, "#version: Desktop shaders for Vulkan SPIR-V require version 140 or higher"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: Desktop shaders for Vulkan SPIR-V require version 140 or higher"); + infoSink.info.append("\n"); version = 140; } if (spvVersion.openGl >= 100 && version < 330) { correct = false; - infoSink.info.message(EPrefixError, "#version: Desktop shaders for OpenGL SPIR-V require version 330 or higher"); + infoSink.info.append("ERROR: "); + infoSink.info.append("#version: Desktop shaders for OpenGL SPIR-V require version 330 or higher"); + infoSink.info.append("\n"); version = 330; } break; @@ -1092,7 +1124,11 @@ struct DoFullParse{ if (success && intermediate.getTreeRoot()) { if (optLevel == EShOptNoGeneration) - _parseContext.infoSink.info.message(EPrefixNone, "No errors. No code generation or linking was requested."); + { + _parseContext.infoSink.info.append("ERROR: "); + _parseContext.infoSink.info.append("No errors. No code generation or linking was requested."); + _parseContext.infoSink.info.append("\n"); + } else success = intermediate.postProcess(intermediate.getTreeRoot(), _parseContext.getLanguage()); } else if (! success) { @@ -1502,11 +1538,15 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) } if (numEsShaders > 0 && numNonEsShaders > 0) { - infoSink->info.message(EPrefixError, "Cannot mix ES profile with non-ES profile shaders"); - return false; + infoSink->info.append("ERROR: "); + infoSink->info.append("Cannot mix ES profile with non-ES profile shaders"); + infoSink->info.append("\n"); + return false; } else if (numEsShaders > 1) { - infoSink->info.message(EPrefixError, "Cannot attach multiple ES shaders of the same type to a single program"); - return false; + infoSink->info.append("ERROR: "); + infoSink->info.append("Cannot attach multiple ES shaders of the same type to a single program"); + infoSink->info.append("\n"); + return false; } // diff --git a/deps/glslang/glslang/glslang/MachineIndependent/Versions.cpp b/deps/glslang/glslang/glslang/MachineIndependent/Versions.cpp index 51b6430853..46c75eb8a9 100755 --- a/deps/glslang/glslang/glslang/MachineIndependent/Versions.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/Versions.cpp @@ -633,7 +633,10 @@ void TParseVersions::requireExtensions(const TSourceLoc& loc, int numExtensions, else { error(loc, "required extension not requested:", featureDesc, "Possible extensions include:"); for (int i = 0; i < numExtensions; ++i) - infoSink.info.message(EPrefixNone, extensions[i]); + { + infoSink.info.append(extensions[i]); + infoSink.info.append("\n"); + } } } @@ -652,7 +655,10 @@ void TParseVersions::ppRequireExtensions(const TSourceLoc& loc, int numExtension else { ppError(loc, "required extension not requested:", featureDesc, "Possible extensions include:"); for (int i = 0; i < numExtensions; ++i) - infoSink.info.message(EPrefixNone, extensions[i]); + { + infoSink.info.append(extensions[i]); + infoSink.info.append("\n"); + } } } diff --git a/deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp b/deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp index fb6e4f7011..9c73ca12a7 100755 --- a/deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp @@ -675,7 +675,11 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node) case EOpSubpassLoad: out.debug << "subpassLoad"; break; case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; - default: out.debug.message(EPrefixError, "Bad unary op"); + default: + out.debug.append("ERROR: "); + out.debug.append("Bad unary op"); + out.debug.append("\n"); + break; } out.debug << " (" << node->getCompleteString() << ")"; @@ -690,7 +694,9 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node TInfoSink& out = infoSink; if (node->getOp() == EOpNull) { - out.debug.message(EPrefixError, "node is still EOpNull!"); + out.debug.append("ERROR: "); + out.debug.append("node is still EOpNull!"); + out.debug.append("\n"); return true; } @@ -1039,7 +1045,11 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node case EOpSubpassLoad: out.debug << "subpassLoad"; break; case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break; - default: out.debug.message(EPrefixError, "Bad aggregation op"); + default: + out.debug.append("ERROR: "); + out.debug.append("Bad aggregation op"); + out.debug.append("\n"); + break; } if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)