Fixed initialization and comparison of variable Types

TRAC #12262 Signed-off-by: Shannon Woods Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@280 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 13eeeede
......@@ -2006,7 +2006,7 @@ bool OutputHLSL::CompareConstructor::operator()(const Constructor &x, const Cons
if (x.type != y.type)
{
return memcmp(&x.type, &y.type, sizeof(TType)) < 0;
return x.type < y.type;
}
if (x.parameters.size() != y.parameters.size())
......@@ -2018,7 +2018,7 @@ bool OutputHLSL::CompareConstructor::operator()(const Constructor &x, const Cons
{
if (x.parameters[i] != y.parameters[i])
{
return memcmp(&x.parameters[i], &y.parameters[i], sizeof(TType)) < 0;
return x.parameters[i] < y.parameters[i];
}
}
......
......@@ -101,7 +101,7 @@ public:
}
explicit TType(TTypeList* userDef, const TString& n, TPrecision p = EbpHigh) :
type(EbtStruct), precision(p), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0),
structure(userDef), maxArraySize(0), arrayInformationType(0), fieldName(0), mangled(0) {
structure(userDef), structureSize(0), maxArraySize(0), arrayInformationType(0), fieldName(0), mangled(0) {
typeName = NewPoolTString(n.c_str());
}
explicit TType() {}
......@@ -276,6 +276,16 @@ public:
bool operator!=(const TType& right) const {
return !operator==(right);
}
bool operator<(const TType& right) const {
if (type != right.type) return type < right.type;
if (size != right.size) return size < right.size;
if (matrix != right.matrix) return matrix < right.matrix;
if (array != right.array) return array < right.array;
if (arraySize != right.arraySize) return arraySize < right.arraySize;
if (structure != right.structure) return structure < right.structure;
return false;
}
TString getCompleteString() const;
protected:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment