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
Родитель fa61e4c061
Коммит 43bb5bd188
3 изменённых файлов: 15 добавлений и 12 удалений

Просмотреть файл

@ -1,3 +1,3 @@
// 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
Просмотреть файл

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

23
glslang/MachineIndependent/localintermediate.h Normal file → Executable file
Просмотреть файл

@ -664,7 +664,8 @@ public:
const std::string& getSourceFile() const { return sourceFile; }
void addSourceText(const char* text) { sourceText = sourceText + text; }
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)
processes.addProcess(p[i]);
}
@ -672,18 +673,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)
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);
if (pos == uniformLocationOverrides.end())
return -1;
else
return pos->second;
std::string name = nameStr;
auto pos = uniformLocationOverrides.find(name);
if (pos == uniformLocationOverrides.end())
return -1;
else
return pos->second;
}
void setUniformLocationBase(int base) { uniformLocationBase = base; }
@ -814,7 +817,7 @@ protected:
bool needToLegalize;
bool binaryDoubleOutput;
std::unordered_map<TString, int> uniformLocationOverrides;
std::unordered_map<std::string, int> uniformLocationOverrides;
int uniformLocationBase;
private: