From 0faee680c043204c0ce9d62889f28775bcf58bb7 Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Sun, 31 Jul 2022 18:49:16 +0200 Subject: [PATCH] (glslang) remove more code we won't need - EShMsgAST, etc --- deps/glslang/glslang/SPIRV/SpvBuilder.cpp | 28 +----- deps/glslang/glslang/SPIRV/SpvBuilder.h | 10 -- .../MachineIndependent/Intermediate.cpp | 16 ---- .../glslang/MachineIndependent/ShaderLang.cpp | 14 --- .../glslang/MachineIndependent/intermOut.cpp | 95 ------------------- .../MachineIndependent/localintermediate.h | 10 -- 6 files changed, 2 insertions(+), 171 deletions(-) diff --git a/deps/glslang/glslang/SPIRV/SpvBuilder.cpp b/deps/glslang/glslang/SPIRV/SpvBuilder.cpp index c4d5b2f039..c82d03de96 100755 --- a/deps/glslang/glslang/SPIRV/SpvBuilder.cpp +++ b/deps/glslang/glslang/SPIRV/SpvBuilder.cpp @@ -58,7 +58,6 @@ Builder::Builder(unsigned int spvVersion, unsigned int magicNumber) : spvVersion(spvVersion), source(SourceLanguageUnknown), sourceVersion(0), - sourceFileStringId(NoResult), currentLine(0), emitOpLines(false), addressModel(AddressingModelLogical), @@ -92,7 +91,7 @@ void Builder::setLine(int lineNum) if (lineNum != 0 && lineNum != currentLine) { currentLine = lineNum; if (emitOpLines) - addLine(sourceFileStringId, currentLine, 0); + addLine(NoResult, currentLine, 0); } } @@ -2730,30 +2729,7 @@ void Builder::dumpSourceInstructions(std::vector& out) const sourceInst.addImmediateOperand(source); sourceInst.addImmediateOperand(sourceVersion); // File operand - if (sourceFileStringId != NoResult) { - sourceInst.addIdOperand(sourceFileStringId); - // Source operand - if (sourceText.size() > 0) { - int nextByte = 0; - std::string subString; - while ((int)sourceText.size() - nextByte > 0) { - subString = sourceText.substr(nextByte, nonNullBytesPerInstruction); - if (nextByte == 0) { - // OpSource - sourceInst.addStringOperand(subString.c_str()); - sourceInst.dump(out); - } else { - // OpSourcContinued - Instruction sourceContinuedInst(OpSourceContinued); - sourceContinuedInst.addStringOperand(subString.c_str()); - sourceContinuedInst.dump(out); - } - nextByte += nonNullBytesPerInstruction; - } - } else - sourceInst.dump(out); - } else - sourceInst.dump(out); + sourceInst.dump(out); } } diff --git a/deps/glslang/glslang/SPIRV/SpvBuilder.h b/deps/glslang/glslang/SPIRV/SpvBuilder.h index f6252fdd64..1faad1f1d1 100755 --- a/deps/glslang/glslang/SPIRV/SpvBuilder.h +++ b/deps/glslang/glslang/SPIRV/SpvBuilder.h @@ -73,14 +73,6 @@ public: source = lang; sourceVersion = version; } - void setSourceFile(const std::string& file) - { - Instruction* fileString = new Instruction(getUniqueId(), NoType, OpString); - fileString->addStringOperand(file.c_str()); - sourceFileStringId = fileString->getResultId(); - strings.push_back(std::unique_ptr(fileString)); - } - void setSourceText(const std::string& text) { sourceText = text; } void addSourceExtension(const char* ext) { sourceExtensions.push_back(ext); } void addModuleProcessed(const std::string& p) { moduleProcesses.push_back(p.c_str()); } void setEmitOpLines() { emitOpLines = true; } @@ -598,8 +590,6 @@ public: unsigned int spvVersion; // the version of SPIR-V to emit in the header SourceLanguage source; int sourceVersion; - spv::Id sourceFileStringId; - std::string sourceText; int currentLine; bool emitOpLines; std::set extensions; diff --git a/deps/glslang/glslang/glslang/MachineIndependent/Intermediate.cpp b/deps/glslang/glslang/glslang/MachineIndependent/Intermediate.cpp index 0ff6253365..793d39db3f 100644 --- a/deps/glslang/glslang/glslang/MachineIndependent/Intermediate.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/Intermediate.cpp @@ -3829,20 +3829,4 @@ void TIntermediate::performTextureUpgradeAndSamplerRemovalTransformation(TInterm root->traverse(&transform); } -const char* TIntermediate::getResourceName(TResourceType res) -{ - switch (res) { - case EResSampler: return "shift-sampler-binding"; - case EResTexture: return "shift-texture-binding"; - case EResImage: return "shift-image-binding"; - case EResUbo: return "shift-UBO-binding"; - case EResSsbo: return "shift-ssbo-binding"; - case EResUav: return "shift-uav-binding"; - default: - assert(0); // internal error: should only be called with valid resource types. - return nullptr; - } -} - - } // end namespace glslang diff --git a/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp b/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp index 6c83bd73d0..4e95c522c3 100644 --- a/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -839,11 +839,6 @@ static bool ProcessDeferred( intermediate.setOriginUpperLeft(); if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl) intermediate.setHlslOffsets(); - if (messages & EShMsgDebugInfo) { - intermediate.setSourceFile(names[numPre]); - for (int s = 0; s < numStrings; ++s) - intermediate.addSourceText(strings[numPre + s]); - } SetupBuiltinSymbolTable(version, profile, spvVersion, source); TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)] @@ -1136,9 +1131,6 @@ struct DoFullParse{ _parseContext.infoSink.info << _parseContext.getNumErrors() << " compilation errors. No code generated.\n\n"; } - if (messages & EShMsgAST) - intermediate.output(_parseContext.infoSink, true); - return success; } }; @@ -1498,9 +1490,6 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) newedIntermediate[stage] = true; } - if (messages & EShMsgAST) - infoSink->info << "\nLinked " << StageName(stage) << " stage:\n\n"; - if (stages[stage].size() > 1) { std::list::const_iterator it; for (it = stages[stage].begin(); it != stages[stage].end(); ++it) @@ -1509,9 +1498,6 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) intermediate[stage]->finalCheck(*infoSink, (messages & EShMsgKeepUncalled) != 0); - if (messages & EShMsgAST) - intermediate[stage]->output(*infoSink, true); - return intermediate[stage]->getNumErrors() == 0; } diff --git a/deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp b/deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp index 75b066d02c..5c279be0f8 100755 --- a/deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp +++ b/deps/glslang/glslang/glslang/MachineIndependent/intermOut.cpp @@ -1387,99 +1387,4 @@ bool TOutputTraverser::visitSwitch(TVisit /* visit */, TIntermSwitch* node) return false; } -// -// This function is the one to call externally to start the traversal. -// Individual functions can be initialized to 0 to skip processing of that -// type of node. It's children will still be processed. -// -void TIntermediate::output(TInfoSink& infoSink, bool tree) -{ - infoSink.debug << "Shader version: " << version << "\n"; - if (requestedExtensions.size() > 0) { - for (auto extIt = requestedExtensions.begin(); extIt != requestedExtensions.end(); ++extIt) - infoSink.debug << "Requested " << *extIt << "\n"; - } - - if (xfbMode) - infoSink.debug << "in xfb mode\n"; - - switch (language) { - case EShLangVertex: - break; - - case EShLangTessControl: - infoSink.debug << "vertices = " << vertices << "\n"; - - if (inputPrimitive != ElgNone) - infoSink.debug << "input primitive = " << TQualifier::getGeometryString(inputPrimitive) << "\n"; - if (vertexSpacing != EvsNone) - infoSink.debug << "vertex spacing = " << TQualifier::getVertexSpacingString(vertexSpacing) << "\n"; - if (vertexOrder != EvoNone) - infoSink.debug << "triangle order = " << TQualifier::getVertexOrderString(vertexOrder) << "\n"; - break; - - case EShLangTessEvaluation: - infoSink.debug << "input primitive = " << TQualifier::getGeometryString(inputPrimitive) << "\n"; - infoSink.debug << "vertex spacing = " << TQualifier::getVertexSpacingString(vertexSpacing) << "\n"; - infoSink.debug << "triangle order = " << TQualifier::getVertexOrderString(vertexOrder) << "\n"; - if (pointMode) - infoSink.debug << "using point mode\n"; - break; - - case EShLangGeometry: - infoSink.debug << "invocations = " << invocations << "\n"; - infoSink.debug << "max_vertices = " << vertices << "\n"; - infoSink.debug << "input primitive = " << TQualifier::getGeometryString(inputPrimitive) << "\n"; - infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n"; - break; - - case EShLangFragment: - if (pixelCenterInteger) - infoSink.debug << "gl_FragCoord pixel center is integer\n"; - if (originUpperLeft) - infoSink.debug << "gl_FragCoord origin is upper left\n"; - if (earlyFragmentTests) - infoSink.debug << "using early_fragment_tests\n"; - if (postDepthCoverage) - infoSink.debug << "using post_depth_coverage\n"; - if (depthLayout != EldNone) - infoSink.debug << "using " << TQualifier::getLayoutDepthString(depthLayout) << "\n"; - if (blendEquations != 0) { - infoSink.debug << "using"; - // blendEquations is a mask, decode it - for (TBlendEquationShift be = (TBlendEquationShift)0; be < EBlendCount; be = (TBlendEquationShift)(be + 1)) { - if (blendEquations & (1 << be)) - infoSink.debug << " " << TQualifier::getBlendEquationString(be); - } - infoSink.debug << "\n"; - } - break; - - case EShLangCompute: - infoSink.debug << "local_size = (" << localSize[0] << ", " << localSize[1] << ", " << localSize[2] << ")\n"; - { - if (localSizeSpecId[0] != TQualifier::layoutNotSet || - localSizeSpecId[1] != TQualifier::layoutNotSet || - localSizeSpecId[2] != TQualifier::layoutNotSet) { - infoSink.debug << "local_size ids = (" << - localSizeSpecId[0] << ", " << - localSizeSpecId[1] << ", " << - localSizeSpecId[2] << ")\n"; - } - } - break; - - default: - break; - } - - if (treeRoot == 0 || ! tree) - return; - - TOutputTraverser it(infoSink); - if (getBinaryDoubleOutput()) - it.setDoubleOutput(TOutputTraverser::BinaryDoubleOutput); - treeRoot->traverse(&it); -} - } // end namespace glslang diff --git a/deps/glslang/glslang/glslang/MachineIndependent/localintermediate.h b/deps/glslang/glslang/glslang/MachineIndependent/localintermediate.h index cbf44891f3..8300f2d937 100755 --- a/deps/glslang/glslang/glslang/MachineIndependent/localintermediate.h +++ b/deps/glslang/glslang/glslang/MachineIndependent/localintermediate.h @@ -222,7 +222,6 @@ public: void setLimits(const TBuiltInResource& r) { resources = r; } bool postProcess(TIntermNode*, EShLanguage); - void output(TInfoSink&, bool tree); void setSource(EShSource s) { source = s; } EShSource getSource() const { return source; } @@ -511,10 +510,6 @@ public: return semanticNameSet.insert(name).first->c_str(); } - void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; } - const std::string& getSourceFile() const { return sourceFile; } - void addSourceText(const char* text) { sourceText = sourceText + text; } - const std::string& getSourceText() const { return sourceText; } void addProcessArgument(const std::string& arg) { processes.addArgument(arg.c_str()); } void setNeedsLegalization() { needToLegalize = true; } bool needsLegalization() const { return needToLegalize; } @@ -554,7 +549,6 @@ protected: TIntermUnary* createConversion(TBasicType convertTo, TIntermTyped* node) const; std::tuple getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const; bool extensionRequested(const char *extension) const {return requestedExtensions.find(extension) != requestedExtensions.end();} - static const char* getResourceName(TResourceType); const EShLanguage language; // stage, known at construction time EShSource source; // source language, known a bit later @@ -617,10 +611,6 @@ protected: EShTextureSamplerTransformMode textureSamplerTransformMode; - // source code of shader, useful as part of debug information - std::string sourceFile; - std::string sourceText; - bool needToLegalize; bool binaryDoubleOutput;