(glslang) Remove more unused code -

* EShMsgKeepUncalled will never be used
* ShBinding never used
* TIOMapResolver never used
This commit is contained in:
LibretroAdmin 2022-07-31 19:02:36 +02:00
parent 0faee680c0
commit 819d02ab24
5 changed files with 6 additions and 95 deletions

View File

@ -47,8 +47,6 @@ namespace glslang {
void C_DECL TParseContextBase::error(const TSourceLoc& loc, const char* szReason, const char* szToken,
const char* szExtraInfoFormat, ...)
{
if (messages & EShMsgOnlyPreprocessor)
return;
va_list args;
va_start(args, szExtraInfoFormat);
const int maxSize = MaxTokenLength + 200;

View File

@ -704,8 +704,6 @@ static void RecordProcesses(TIntermediate& intermediate, EShMessages messages, c
intermediate.processes.processes.push_back("relaxed-errors");
if ((messages & EShMsgSuppressWarnings) != 0)
intermediate.processes.processes.push_back("suppress-warnings");
if ((messages & EShMsgKeepUncalled) != 0)
intermediate.processes.processes.push_back("keep-uncalled");
if (sourceEntryPointName.size() > 0) {
intermediate.processes.processes.push_back("source-entrypoint");
intermediate.addProcessArgument(sourceEntryPointName);
@ -1496,7 +1494,7 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
intermediate[stage]->merge(*infoSink, *(*it)->intermediate);
}
intermediate[stage]->finalCheck(*infoSink, (messages & EShMsgKeepUncalled) != 0);
intermediate[stage]->finalCheck(*infoSink);
return intermediate[stage]->getNumErrors() == 0;
}

View File

@ -389,7 +389,7 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
//
// Also, lock in defaults of things not set, including array sizes.
//
void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
void TIntermediate::finalCheck(TInfoSink& infoSink)
{
if (getTreeRoot() == nullptr)
return;
@ -406,7 +406,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
// recursion and missing body checking
checkCallGraphCycles(infoSink);
checkCallGraphBodies(infoSink, keepUncalled);
checkCallGraphBodies(infoSink);
// overlap/alias/missing I/O, etc.
inOutLocationCheck(infoSink);
@ -614,7 +614,7 @@ void TIntermediate::checkCallGraphCycles(TInfoSink& infoSink)
// Reachable ones with missing bodies are errors.
// Unreachable bodies are dead code.
//
void TIntermediate::checkCallGraphBodies(TInfoSink& infoSink, bool keepUncalled)
void TIntermediate::checkCallGraphBodies(TInfoSink& infoSink)
{
// Clear fields we'll use for this.
for (TGraph::iterator call = callGraph.begin(); call != callGraph.end(); ++call) {
@ -679,13 +679,11 @@ void TIntermediate::checkCallGraphBodies(TInfoSink& infoSink, bool keepUncalled)
// Bodies in the AST not reached by the call graph are dead;
// clear them out, since they can't be reached and also can't
// be translated further due to possibility of being ill defined.
if (! keepUncalled) {
for (int f = 0; f < (int)functionSequence.size(); ++f) {
if (! reachable[f])
functionSequence[f] = nullptr;
}
functionSequence.erase(std::remove(functionSequence.begin(), functionSequence.end(), nullptr), functionSequence.end());
}
}
//

View File

@ -471,7 +471,7 @@ public:
void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee);
void merge(TInfoSink&, TIntermediate&);
void finalCheck(TInfoSink&, bool keepUncalled);
void finalCheck(TInfoSink&);
void addIoAccessed(const TString& name) { ioAccessed.insert(name); }
bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); }
@ -531,7 +531,7 @@ protected:
void mergeImplicitArraySizes(TType&, const TType&);
void mergeErrorCheck(TInfoSink&, const TIntermSymbol&, const TIntermSymbol&, bool crossStage);
void checkCallGraphCycles(TInfoSink&);
void checkCallGraphBodies(TInfoSink&, bool keepUncalled);
void checkCallGraphBodies(TInfoSink&);
void inOutLocationCheck(TInfoSink&);
TIntermSequence& findLinkerObjects() const;
bool userOutputUsed() const;

View File

@ -213,20 +213,6 @@ enum EShMessages {
EShMsgHlslLegalization = (1 << 12), // enable HLSL Legalization messages
};
//
// Build a table for bindings. This can be used for locating
// attributes, uniforms, globals, etc., as needed.
//
typedef struct {
const char* name;
int binding;
} ShBinding;
typedef struct {
int numBindings;
ShBinding* bindings; // array of bindings
} ShBindingTable;
//
// ShHandle held by but opaque to the driver. It is allocated,
// managed, and de-allocated by the compiler/linker. It's contents
@ -260,7 +246,6 @@ typedef void* ShHandle;
#include <list>
#include <string>
#include <utility>
class TCompiler;
class TInfoSink;
@ -448,74 +433,6 @@ private:
TShader& operator=(TShader&);
};
class TReflection;
// Allows to customize the binding layout after linking.
// All used uniform variables will invoke at least validateBinding.
// If validateBinding returned true then the other resolveBinding,
// resolveSet, and resolveLocation are invoked to resolve the binding
// and descriptor set index respectively.
//
// Invocations happen in a particular order:
// 1) all shader inputs
// 2) all shader outputs
// 3) all uniforms with binding and set already defined
// 4) all uniforms with binding but no set defined
// 5) all uniforms with set but no binding defined
// 6) all uniforms with no binding and no set defined
//
// mapIO will use this resolver in two phases. The first
// phase is a notification phase, calling the corresponging
// notifiy callbacks, this phase ends with a call to endNotifications.
// Phase two starts directly after the call to endNotifications
// and calls all other callbacks to validate and to get the
// bindings, sets, locations, component and color indices.
//
// NOTE: that still limit checks are applied to bindings and sets
// and may result in an error.
class TIoMapResolver
{
public:
virtual ~TIoMapResolver() {}
// Should return true if the resulting/current binding would be okay.
// Basic idea is to do aliasing binding checks with this.
virtual bool validateBinding(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0;
// Should return a value >= 0 if the current binding should be overridden.
// Return -1 if the current binding (including no binding) should be kept.
virtual int resolveBinding(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0;
// Should return a value >= 0 if the current set should be overridden.
// Return -1 if the current set (including no set) should be kept.
virtual int resolveSet(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0;
// Should return a value >= 0 if the current location should be overridden.
// Return -1 if the current location (including no location) should be kept.
virtual int resolveUniformLocation(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0;
// Should return true if the resulting/current setup would be okay.
// Basic idea is to do aliasing checks and reject invalid semantic names.
virtual bool validateInOut(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0;
// Should return a value >= 0 if the current location should be overridden.
// Return -1 if the current location (including no location) should be kept.
virtual int resolveInOutLocation(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0;
// Should return a value >= 0 if the current component index should be overridden.
// Return -1 if the current component index (including no index) should be kept.
virtual int resolveInOutComponent(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0;
// Should return a value >= 0 if the current color index should be overridden.
// Return -1 if the current color index (including no index) should be kept.
virtual int resolveInOutIndex(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0;
// Notification of a uniform variable
virtual void notifyBinding(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0;
// Notification of a in or out variable
virtual void notifyInOut(EShLanguage stage, const char* name, const TType& type, bool is_live) = 0;
// Called by mapIO when it has finished the notify pass
virtual void endNotifications(EShLanguage stage) = 0;
// Called by mapIO when it starts its notify pass for the given stage
virtual void beginNotifications(EShLanguage stage) = 0;
// Called by mipIO when it starts its resolve pass for the given stage
virtual void beginResolve(EShLanguage stage) = 0;
// Called by mapIO when it has finished the resolve pass
virtual void endResolve(EShLanguage stage) = 0;
};
// Make one TProgram per set of shaders that will get linked together. Add all
// the shaders that are to be linked together. After calling shader.parse()
// for all shaders, call link().