Remove a mangled-name cache in the type that was sometimes stale.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22653 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-08-08 16:22:54 +00:00
parent 1b42f2a33d
commit 252b619066
4 changed files with 15 additions and 18 deletions

Binary file not shown.

View File

@ -98,3 +98,9 @@ int foo(out float a) // ERROR
return 3.2; // ERROR return 3.2; // ERROR
foo(a); // ERROR foo(a); // ERROR
} }
bool gen(vec3 v)
{
if (abs(v[0]) < 1e-4 && abs(v[1]) < 1e-4)
return true;
}

View File

@ -405,7 +405,7 @@ public:
explicit TType(TBasicType t, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0) : explicit TType(TBasicType t, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0) :
basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), arraySizes(0), basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), arraySizes(0),
structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0),
fieldName(0), mangled(0), typeName(0) fieldName(0), typeName(0)
{ {
sampler.clear(); sampler.clear();
qualifier.clear(); qualifier.clear();
@ -414,7 +414,7 @@ public:
TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0) : TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0) :
basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), arraySizes(0), basicType(t), vectorSize(vs), matrixCols(mc), matrixRows(mr), arraySizes(0),
structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0),
fieldName(0), mangled(0), typeName(0) fieldName(0), typeName(0)
{ {
sampler.clear(); sampler.clear();
qualifier.clear(); qualifier.clear();
@ -424,7 +424,7 @@ public:
} }
explicit TType(const TPublicType &p) : explicit TType(const TPublicType &p) :
basicType(p.basicType), vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), arraySizes(p.arraySizes), basicType(p.basicType), vectorSize(p.vectorSize), matrixCols(p.matrixCols), matrixRows(p.matrixRows), arraySizes(p.arraySizes),
structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0), fieldName(0), mangled(0), typeName(0) structure(0), structureSize(0), maxArraySize(0), arrayInformationType(0), fieldName(0), typeName(0)
{ {
if (basicType == EbtSampler) if (basicType == EbtSampler)
sampler = p.sampler; sampler = p.sampler;
@ -438,7 +438,7 @@ public:
} }
TType(TTypeList* userDef, const TString& n, TStorageQualifier blockQualifier = EvqGlobal) : TType(TTypeList* userDef, const TString& n, TStorageQualifier blockQualifier = EvqGlobal) :
basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), arraySizes(0), basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), arraySizes(0),
structure(userDef), maxArraySize(0), arrayInformationType(0), fieldName(0), mangled(0) structure(userDef), maxArraySize(0), arrayInformationType(0), fieldName(0)
{ {
sampler.clear(); sampler.clear();
qualifier.clear(); qualifier.clear();
@ -497,10 +497,6 @@ public:
if (copyOf.typeName) if (copyOf.typeName)
typeName = NewPoolTString(copyOf.typeName->c_str()); typeName = NewPoolTString(copyOf.typeName->c_str());
mangled = 0;
if (copyOf.mangled)
mangled = NewPoolTString(copyOf.mangled->c_str());
structureSize = copyOf.structureSize; structureSize = copyOf.structureSize;
maxArraySize = copyOf.maxArraySize; maxArraySize = copyOf.maxArraySize;
assert(copyOf.arrayInformationType == 0); assert(copyOf.arrayInformationType == 0);
@ -706,15 +702,11 @@ public:
return totalSize; return totalSize;
} }
TString& getMangledName() // append this type's mangled name to the passed in 'name'
void appendMangledName(TString& name)
{ {
if (!mangled) { buildMangledName(name);
mangled = NewPoolTString(""); name += ';' ;
buildMangledName(*mangled);
*mangled += ';' ;
}
return *mangled;
} }
bool sameElementType(const TType& right) const bool sameElementType(const TType& right) const
@ -758,7 +750,6 @@ protected:
int maxArraySize; int maxArraySize;
TType* arrayInformationType; TType* arrayInformationType;
TString *fieldName; // for structure field names TString *fieldName; // for structure field names
TString *mangled;
TString *typeName; // for structure field type name TString *typeName; // for structure field type name
}; };

View File

@ -195,7 +195,7 @@ public:
void addParameter(TParameter& p) void addParameter(TParameter& p)
{ {
parameters.push_back(p); parameters.push_back(p);
mangledName = mangledName + p.type->getMangledName(); p.type->appendMangledName(mangledName);
} }
const TString& getMangledName() const { return mangledName; } const TString& getMangledName() const { return mangledName; }