#include <algorithm>
#include <climits>
+const char* getBasicString(TBasicType t)
+{
+ switch (t)
+ {
+ case EbtVoid: return "void"; break;
+ case EbtFloat: return "float"; break;
+ case EbtInt: return "int"; break;
+ case EbtUInt: return "uint"; break;
+ case EbtBool: return "bool"; break;
+ case EbtSampler2D: return "sampler2D"; break;
+ case EbtSampler3D: return "sampler3D"; break;
+ case EbtSamplerCube: return "samplerCube"; break;
+ case EbtSamplerExternalOES: return "samplerExternalOES"; break;
+ case EbtSampler2DRect: return "sampler2DRect"; break;
+ case EbtSampler2DArray: return "sampler2DArray"; break;
+ case EbtISampler2D: return "isampler2D"; break;
+ case EbtISampler3D: return "isampler3D"; break;
+ case EbtISamplerCube: return "isamplerCube"; break;
+ case EbtISampler2DArray: return "isampler2DArray"; break;
+ case EbtUSampler2D: return "usampler2D"; break;
+ case EbtUSampler3D: return "usampler3D"; break;
+ case EbtUSamplerCube: return "usamplerCube"; break;
+ case EbtUSampler2DArray: return "usampler2DArray"; break;
+ case EbtSampler2DShadow: return "sampler2DShadow"; break;
+ case EbtSamplerCubeShadow: return "samplerCubeShadow"; break;
+ case EbtSampler2DArrayShadow: return "sampler2DArrayShadow"; break;
+ case EbtStruct: return "structure"; break;
+ case EbtInterfaceBlock: return "interface block"; break;
+ case EbtInvariant: return "invariant"; break;
+ default: UNREACHABLE(); return "unknown type";
+ }
+}
+
TType::TType(const TPublicType &p)
: type(p.type), precision(p.precision), qualifier(p.qualifier), layoutQualifier(p.layoutQualifier),
primarySize(p.primarySize), secondarySize(p.secondarySize), array(p.array), arraySize(p.arraySize),
structure = p.userDef->getStruct();
}
-bool TType::equals(const TType &other) const
-{
- if (type != other.type || precision != other.precision ||
- primarySize != other.primarySize || secondarySize != other.secondarySize ||
- array != other.array || (array && arraySize != other.arraySize) ||
- interfaceBlock != other.interfaceBlock || structure != other.structure)
- {
- return false;
- }
- if (interfaceBlock && !interfaceBlock->equals(*(other.interfaceBlock)))
- return false;
- if (structure && !structure->equals(*(other.structure)))
- return false;
- return true;
-}
-
-bool TField::equals(const TField &other) const
-{
- ASSERT(mType && mName);
- ASSERT(other.mType && other.mName);
- return mType->equals(*(other.mType)) && *mName == *(other.mName);
-}
-
-bool TFieldListCollection::equals(const TFieldListCollection &other) const
-{
- ASSERT(mName && mFields);
- ASSERT(other.mName && other.mFields);
- if (*mName != *(other.mName))
- return false;
- if (mFields->size() != other.mFields->size())
- return false;
- for (size_t ii = 0; ii < mFields->size(); ++ii)
- {
- ASSERT((*mFields)[ii] && (*(other.mFields))[ii]);
- if (!(*mFields)[ii]->equals(*((*(other.mFields))[ii])))
- return false;
- }
- return true;
-}
-
bool TStructure::equals(const TStructure &other) const
{
- return TFieldListCollection::equals(other);
-}
-
-bool TInterfaceBlock::equals(const TInterfaceBlock &other) const
-{
- if (!TFieldListCollection::equals(other))
- return false;
- // TODO(zmo): do we need to consider mBlockStorage and mMatrixPacking?
- return mArraySize == other.mArraySize;
+ return (uniqueId() == other.uniqueId());
}
//