Fix #1536: use string instead of TString for uniform-location override.

This commit is contained in:
John Kessenich 2018-10-20 17:36:13 -06:00
parent fa61e4c061
commit 43bb5bd188
3 changed files with 15 additions and 12 deletions

View file

@ -1,3 +1,3 @@
// This header is generated by the make-revision script. // This header is generated by the make-revision script.
#define GLSLANG_PATCH_LEVEL 2904 #define GLSLANG_PATCH_LEVEL 2933

2
glslang/MachineIndependent/iomapper.cpp Normal file → Executable file
View file

@ -457,7 +457,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
int location = intermediate.getUniformLocationOverride(name); int location = intermediate.getUniformLocationOverride(name);
if (location != -1) if (location != -1)
return location; return location;
location = nextUniformLocation; location = nextUniformLocation;

23
glslang/MachineIndependent/localintermediate.h Normal file → Executable file
View file

@ -664,7 +664,8 @@ public:
const std::string& getSourceFile() const { return sourceFile; } const std::string& getSourceFile() const { return sourceFile; }
void addSourceText(const char* text) { sourceText = sourceText + text; } void addSourceText(const char* text) { sourceText = sourceText + text; }
const std::string& getSourceText() const { return sourceText; } const std::string& getSourceText() const { return sourceText; }
void addProcesses(const std::vector<std::string>& p) { void addProcesses(const std::vector<std::string>& p)
{
for (int i = 0; i < (int)p.size(); ++i) for (int i = 0; i < (int)p.size(); ++i)
processes.addProcess(p[i]); processes.addProcess(p[i]);
} }
@ -672,18 +673,20 @@ public:
void addProcessArgument(const std::string& arg) { processes.addArgument(arg); } void addProcessArgument(const std::string& arg) { processes.addArgument(arg); }
const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); } const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); }
void addUniformLocationOverride(const TString& name, int location) void addUniformLocationOverride(const char* nameStr, int location)
{ {
uniformLocationOverrides[name] = location; std::string name = nameStr;
uniformLocationOverrides[name] = location;
} }
int getUniformLocationOverride(const TString& name) const int getUniformLocationOverride(const char* nameStr) const
{ {
auto pos = uniformLocationOverrides.find(name); std::string name = nameStr;
if (pos == uniformLocationOverrides.end()) auto pos = uniformLocationOverrides.find(name);
return -1; if (pos == uniformLocationOverrides.end())
else return -1;
return pos->second; else
return pos->second;
} }
void setUniformLocationBase(int base) { uniformLocationBase = base; } void setUniformLocationBase(int base) { uniformLocationBase = base; }
@ -814,7 +817,7 @@ protected:
bool needToLegalize; bool needToLegalize;
bool binaryDoubleOutput; bool binaryDoubleOutput;
std::unordered_map<TString, int> uniformLocationOverrides; std::unordered_map<std::string, int> uniformLocationOverrides;
int uniformLocationBase; int uniformLocationBase;
private: private: