(glslang) remove more code we won't need - EShMsgAST, etc

This commit is contained in:
LibretroAdmin 2022-07-31 18:49:16 +02:00
parent 5a4e7cfbd1
commit 0faee680c0
6 changed files with 2 additions and 171 deletions

View File

@ -58,7 +58,6 @@ Builder::Builder(unsigned int spvVersion, unsigned int magicNumber) :
spvVersion(spvVersion), spvVersion(spvVersion),
source(SourceLanguageUnknown), source(SourceLanguageUnknown),
sourceVersion(0), sourceVersion(0),
sourceFileStringId(NoResult),
currentLine(0), currentLine(0),
emitOpLines(false), emitOpLines(false),
addressModel(AddressingModelLogical), addressModel(AddressingModelLogical),
@ -92,7 +91,7 @@ void Builder::setLine(int lineNum)
if (lineNum != 0 && lineNum != currentLine) { if (lineNum != 0 && lineNum != currentLine) {
currentLine = lineNum; currentLine = lineNum;
if (emitOpLines) if (emitOpLines)
addLine(sourceFileStringId, currentLine, 0); addLine(NoResult, currentLine, 0);
} }
} }
@ -2730,30 +2729,7 @@ void Builder::dumpSourceInstructions(std::vector<unsigned int>& out) const
sourceInst.addImmediateOperand(source); sourceInst.addImmediateOperand(source);
sourceInst.addImmediateOperand(sourceVersion); sourceInst.addImmediateOperand(sourceVersion);
// File operand // File operand
if (sourceFileStringId != NoResult) { sourceInst.dump(out);
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);
} }
} }

View File

@ -73,14 +73,6 @@ public:
source = lang; source = lang;
sourceVersion = version; 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<Instruction>(fileString));
}
void setSourceText(const std::string& text) { sourceText = text; }
void addSourceExtension(const char* ext) { sourceExtensions.push_back(ext); } void addSourceExtension(const char* ext) { sourceExtensions.push_back(ext); }
void addModuleProcessed(const std::string& p) { moduleProcesses.push_back(p.c_str()); } void addModuleProcessed(const std::string& p) { moduleProcesses.push_back(p.c_str()); }
void setEmitOpLines() { emitOpLines = true; } void setEmitOpLines() { emitOpLines = true; }
@ -598,8 +590,6 @@ public:
unsigned int spvVersion; // the version of SPIR-V to emit in the header unsigned int spvVersion; // the version of SPIR-V to emit in the header
SourceLanguage source; SourceLanguage source;
int sourceVersion; int sourceVersion;
spv::Id sourceFileStringId;
std::string sourceText;
int currentLine; int currentLine;
bool emitOpLines; bool emitOpLines;
std::set<std::string> extensions; std::set<std::string> extensions;

View File

@ -3829,20 +3829,4 @@ void TIntermediate::performTextureUpgradeAndSamplerRemovalTransformation(TInterm
root->traverse(&transform); 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 } // end namespace glslang

View File

@ -839,11 +839,6 @@ static bool ProcessDeferred(
intermediate.setOriginUpperLeft(); intermediate.setOriginUpperLeft();
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl) if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
intermediate.setHlslOffsets(); 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); SetupBuiltinSymbolTable(version, profile, spvVersion, source);
TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)] TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)]
@ -1136,9 +1131,6 @@ struct DoFullParse{
_parseContext.infoSink.info << _parseContext.getNumErrors() << " compilation errors. No code generated.\n\n"; _parseContext.infoSink.info << _parseContext.getNumErrors() << " compilation errors. No code generated.\n\n";
} }
if (messages & EShMsgAST)
intermediate.output(_parseContext.infoSink, true);
return success; return success;
} }
}; };
@ -1498,9 +1490,6 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
newedIntermediate[stage] = true; newedIntermediate[stage] = true;
} }
if (messages & EShMsgAST)
infoSink->info << "\nLinked " << StageName(stage) << " stage:\n\n";
if (stages[stage].size() > 1) { if (stages[stage].size() > 1) {
std::list<TShader*>::const_iterator it; std::list<TShader*>::const_iterator it;
for (it = stages[stage].begin(); it != stages[stage].end(); ++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); intermediate[stage]->finalCheck(*infoSink, (messages & EShMsgKeepUncalled) != 0);
if (messages & EShMsgAST)
intermediate[stage]->output(*infoSink, true);
return intermediate[stage]->getNumErrors() == 0; return intermediate[stage]->getNumErrors() == 0;
} }

View File

@ -1387,99 +1387,4 @@ bool TOutputTraverser::visitSwitch(TVisit /* visit */, TIntermSwitch* node)
return false; 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 } // end namespace glslang

View File

@ -222,7 +222,6 @@ public:
void setLimits(const TBuiltInResource& r) { resources = r; } void setLimits(const TBuiltInResource& r) { resources = r; }
bool postProcess(TIntermNode*, EShLanguage); bool postProcess(TIntermNode*, EShLanguage);
void output(TInfoSink&, bool tree);
void setSource(EShSource s) { source = s; } void setSource(EShSource s) { source = s; }
EShSource getSource() const { return source; } EShSource getSource() const { return source; }
@ -511,10 +510,6 @@ public:
return semanticNameSet.insert(name).first->c_str(); 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 addProcessArgument(const std::string& arg) { processes.addArgument(arg.c_str()); }
void setNeedsLegalization() { needToLegalize = true; } void setNeedsLegalization() { needToLegalize = true; }
bool needsLegalization() const { return needToLegalize; } bool needsLegalization() const { return needToLegalize; }
@ -554,7 +549,6 @@ protected:
TIntermUnary* createConversion(TBasicType convertTo, TIntermTyped* node) const; TIntermUnary* createConversion(TBasicType convertTo, TIntermTyped* node) const;
std::tuple<TBasicType, TBasicType> getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const; std::tuple<TBasicType, TBasicType> getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const;
bool extensionRequested(const char *extension) const {return requestedExtensions.find(extension) != requestedExtensions.end();} 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 const EShLanguage language; // stage, known at construction time
EShSource source; // source language, known a bit later EShSource source; // source language, known a bit later
@ -617,10 +611,6 @@ protected:
EShTextureSamplerTransformMode textureSamplerTransformMode; EShTextureSamplerTransformMode textureSamplerTransformMode;
// source code of shader, useful as part of debug information
std::string sourceFile;
std::string sourceText;
bool needToLegalize; bool needToLegalize;
bool binaryDoubleOutput; bool binaryDoubleOutput;