Add a command-line option to override uniform locations

This commit is contained in:
Neil Roberts 2018-03-20 17:30:53 +01:00 committed by Alejandro Piñeiro
parent 4508a8170a
commit 16f53474c8
5 changed files with 54 additions and 2 deletions

View file

@ -671,6 +671,20 @@ public:
void addProcessArgument(const std::string& arg) { processes.addArgument(arg); }
const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); }
void addUniformLocationOverride(const TString& name, int location)
{
uniformLocationOverrides[name] = location;
}
int getUniformLocationOverride(const TString& name) const
{
auto pos = uniformLocationOverrides.find(name);
if (pos == uniformLocationOverrides.end())
return -1;
else
return pos->second;
}
void setNeedsLegalization() { needToLegalize = true; }
bool needsLegalization() const { return needToLegalize; }
@ -796,6 +810,8 @@ protected:
bool needToLegalize;
bool binaryDoubleOutput;
std::unordered_map<TString, int> uniformLocationOverrides;
private:
void operator=(TIntermediate&); // prevent assignments
};