Commit ed319792 by John Kessenich

Change TType member from "type" to "basicType". It was very confusing.

parent f6648dc1
...@@ -288,7 +288,7 @@ public: ...@@ -288,7 +288,7 @@ public:
class TPublicType { class TPublicType {
public: public:
TBasicType type; TBasicType basicType;
TSampler sampler; TSampler sampler;
TQualifier qualifier; TQualifier qualifier;
int vectorSize : 4; int vectorSize : 4;
...@@ -300,7 +300,7 @@ public: ...@@ -300,7 +300,7 @@ public:
void initType(int ln = 0) void initType(int ln = 0)
{ {
type = EbtVoid; basicType = EbtVoid;
vectorSize = 1; vectorSize = 1;
matrixRows = 0; matrixRows = 0;
matrixCols = 0; matrixCols = 0;
...@@ -352,7 +352,7 @@ class TType { ...@@ -352,7 +352,7 @@ class TType {
public: public:
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
TType(TBasicType t, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0) : TType(TBasicType t, TStorageQualifier q = EvqTemporary, int vs = 1, int mc = 0, int mr = 0) :
type(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), mangled(0), typeName(0)
{ {
...@@ -361,7 +361,7 @@ public: ...@@ -361,7 +361,7 @@ public:
qualifier.storage = q; qualifier.storage = q;
} }
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) :
type(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), mangled(0), typeName(0)
{ {
...@@ -372,7 +372,7 @@ public: ...@@ -372,7 +372,7 @@ public:
assert(p >= 0 && p <= EpqHigh); assert(p >= 0 && p <= EpqHigh);
} }
explicit TType(const TPublicType &p) : explicit TType(const TPublicType &p) :
type(p.type), 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), mangled(0), typeName(0)
{ {
sampler = p.sampler; sampler = p.sampler;
...@@ -383,7 +383,7 @@ public: ...@@ -383,7 +383,7 @@ public:
} }
} }
TType(TTypeList* userDef, const TString& n, TStorageQualifier blockQualifier = EvqGlobal) : TType(TTypeList* userDef, const TString& n, TStorageQualifier blockQualifier = EvqGlobal) :
type(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), mangled(0)
{ {
sampler.clear(); sampler.clear();
...@@ -391,7 +391,7 @@ public: ...@@ -391,7 +391,7 @@ public:
// is it an interface block? // is it an interface block?
if (blockQualifier != EvqGlobal) { if (blockQualifier != EvqGlobal) {
qualifier.storage = blockQualifier; qualifier.storage = blockQualifier;
type = EbtBlock; basicType = EbtBlock;
} }
typeName = NewPoolTString(n.c_str()); typeName = NewPoolTString(n.c_str());
} }
...@@ -402,7 +402,7 @@ public: ...@@ -402,7 +402,7 @@ public:
void copyType(const TType& copyOf, const TStructureMap& remapper) void copyType(const TType& copyOf, const TStructureMap& remapper)
{ {
type = copyOf.type; basicType = copyOf.basicType;
sampler = copyOf.sampler; sampler = copyOf.sampler;
qualifier = copyOf.qualifier; qualifier = copyOf.qualifier;
vectorSize = copyOf.vectorSize; vectorSize = copyOf.vectorSize;
...@@ -472,7 +472,7 @@ public: ...@@ -472,7 +472,7 @@ public:
virtual void setElementType(TBasicType t, int s, int mc, int mr, const TType* userDef) virtual void setElementType(TBasicType t, int s, int mc, int mr, const TType* userDef)
{ {
type = t; basicType = t;
vectorSize = s; vectorSize = s;
matrixCols = mc; matrixCols = mc;
matrixRows = mr; matrixRows = mr;
...@@ -494,7 +494,7 @@ public: ...@@ -494,7 +494,7 @@ public:
return *fieldName; return *fieldName;
} }
virtual TBasicType getBasicType() const { return type; } virtual TBasicType getBasicType() const { return basicType; }
virtual const TSampler& getSampler() const { return sampler; } virtual const TSampler& getSampler() const { return sampler; }
virtual TQualifier& getQualifier() { return qualifier; } virtual TQualifier& getQualifier() { return qualifier; }
virtual const TQualifier& getQualifier() const { return qualifier; } virtual const TQualifier& getQualifier() const { return qualifier; }
...@@ -519,7 +519,7 @@ public: ...@@ -519,7 +519,7 @@ public:
TType* getArrayInformationType() { return arrayInformationType; } TType* getArrayInformationType() { return arrayInformationType; }
virtual bool isVector() const { return vectorSize > 1; } virtual bool isVector() const { return vectorSize > 1; }
const char* getBasicString() const { const char* getBasicString() const {
return TType::getBasicString(type); return TType::getBasicString(basicType);
} }
static const char* getBasicString(TBasicType t) { static const char* getBasicString(TBasicType t) {
switch (t) { switch (t) {
...@@ -604,7 +604,7 @@ public: ...@@ -604,7 +604,7 @@ public:
TString getCompleteTypeString() const TString getCompleteTypeString() const
{ {
if (type == EbtSampler) if (basicType == EbtSampler)
return sampler.getString(); return sampler.getString();
else else
return getBasicString(); return getBasicString();
...@@ -645,7 +645,7 @@ public: ...@@ -645,7 +645,7 @@ public:
bool sameElementType(const TType& right) const bool sameElementType(const TType& right) const
{ {
return type == right.type && return basicType == right.basicType &&
sampler == right.sampler && sampler == right.sampler &&
vectorSize == right.vectorSize && vectorSize == right.vectorSize &&
matrixCols == right.matrixCols && matrixCols == right.matrixCols &&
...@@ -670,7 +670,7 @@ protected: ...@@ -670,7 +670,7 @@ protected:
void buildMangledName(TString&); void buildMangledName(TString&);
int getStructSize() const; int getStructSize() const;
TBasicType type : 8; TBasicType basicType : 8;
int vectorSize : 4; int vectorSize : 4;
int matrixCols : 4; int matrixCols : 4;
int matrixRows : 4; int matrixRows : 4;
......
...@@ -577,7 +577,7 @@ bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction ...@@ -577,7 +577,7 @@ bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction
// //
bool TParseContext::voidErrorCheck(int line, const TString& identifier, const TPublicType& pubType) bool TParseContext::voidErrorCheck(int line, const TString& identifier, const TPublicType& pubType)
{ {
if (pubType.type == EbtVoid) { if (pubType.basicType == EbtVoid) {
error(line, "illegal use of type 'void'", identifier.c_str(), ""); error(line, "illegal use of type 'void'", identifier.c_str(), "");
return true; return true;
} }
...@@ -605,7 +605,7 @@ bool TParseContext::boolErrorCheck(int line, const TIntermTyped* type) ...@@ -605,7 +605,7 @@ bool TParseContext::boolErrorCheck(int line, const TIntermTyped* type)
// //
bool TParseContext::boolErrorCheck(int line, const TPublicType& pType) bool TParseContext::boolErrorCheck(int line, const TPublicType& pType)
{ {
if (pType.type != EbtBool || pType.arraySizes || pType.matrixCols > 1 || (pType.vectorSize > 1)) { if (pType.basicType != EbtBool || pType.arraySizes || pType.matrixCols > 1 || (pType.vectorSize > 1)) {
error(line, "boolean expression expected", "", ""); error(line, "boolean expression expected", "", "");
return true; return true;
} }
...@@ -615,16 +615,16 @@ bool TParseContext::boolErrorCheck(int line, const TPublicType& pType) ...@@ -615,16 +615,16 @@ bool TParseContext::boolErrorCheck(int line, const TPublicType& pType)
bool TParseContext::samplerErrorCheck(int line, const TPublicType& pType, const char* reason) bool TParseContext::samplerErrorCheck(int line, const TPublicType& pType, const char* reason)
{ {
if (pType.type == EbtStruct) { if (pType.basicType == EbtStruct) {
if (containsSampler(*pType.userDef)) { if (containsSampler(*pType.userDef)) {
error(line, reason, TType::getBasicString(pType.type), "(structure cannot contain a sampler or image)"); error(line, reason, TType::getBasicString(pType.basicType), "(structure cannot contain a sampler or image)");
return true; return true;
} }
return false; return false;
} else if (pType.type == EbtSampler) { } else if (pType.basicType == EbtSampler) {
error(line, reason, TType::getBasicString(pType.type), ""); error(line, reason, TType::getBasicString(pType.basicType), "");
return true; return true;
} }
...@@ -672,13 +672,13 @@ bool TParseContext::globalQualifierFixAndErrorCheck(int line, TQualifier& qualif ...@@ -672,13 +672,13 @@ bool TParseContext::globalQualifierFixAndErrorCheck(int line, TQualifier& qualif
// now, knowing it is a shader in/out, do all the in/out semantic checks // now, knowing it is a shader in/out, do all the in/out semantic checks
if (publicType.type == EbtBool) { if (publicType.basicType == EbtBool) {
error(line, "cannot be bool", getStorageQualifierString(qualifier.storage), ""); error(line, "cannot be bool", getStorageQualifierString(qualifier.storage), "");
return true; return true;
} }
if (language == EShLangVertex && qualifier.storage == EvqVaryingIn) { if (language == EShLangVertex && qualifier.storage == EvqVaryingIn) {
if (publicType.type == EbtStruct) { if (publicType.basicType == EbtStruct) {
error(line, "cannot be a structure or array", getStorageQualifierString(qualifier.storage), ""); error(line, "cannot be a structure or array", getStorageQualifierString(qualifier.storage), "");
return true; return true;
} }
...@@ -690,17 +690,17 @@ bool TParseContext::globalQualifierFixAndErrorCheck(int line, TQualifier& qualif ...@@ -690,17 +690,17 @@ bool TParseContext::globalQualifierFixAndErrorCheck(int line, TQualifier& qualif
if (language == EShLangFragment && qualifier.storage == EvqVaryingOut) { if (language == EShLangFragment && qualifier.storage == EvqVaryingOut) {
profileRequires(line, EEsProfile, 300, 0, "fragment shader output"); profileRequires(line, EEsProfile, 300, 0, "fragment shader output");
if (publicType.type == EbtStruct) { if (publicType.basicType == EbtStruct) {
error(line, "cannot be a structure", getStorageQualifierString(qualifier.storage), ""); error(line, "cannot be a structure", getStorageQualifierString(qualifier.storage), "");
return true; return true;
} }
} }
if (publicType.type == EbtInt || publicType.type == EbtUint || publicType.type == EbtDouble) { if (publicType.basicType == EbtInt || publicType.basicType == EbtUint || publicType.basicType == EbtDouble) {
profileRequires(line, EEsProfile, 300, 0, "shader input/output"); profileRequires(line, EEsProfile, 300, 0, "shader input/output");
if (language != EShLangVertex && qualifier.storage == EvqVaryingIn && ! qualifier.flat || if (language != EShLangVertex && qualifier.storage == EvqVaryingIn && ! qualifier.flat ||
language != EShLangFragment && qualifier.storage == EvqVaryingOut && ! qualifier.flat) { language != EShLangFragment && qualifier.storage == EvqVaryingOut && ! qualifier.flat) {
error(line, "must be qualified as 'flat'", getStorageQualifierString(qualifier.storage), TType::getBasicString(publicType.type)); error(line, "must be qualified as 'flat'", getStorageQualifierString(qualifier.storage), TType::getBasicString(publicType.basicType));
return true; return true;
} }
...@@ -776,7 +776,7 @@ bool TParseContext::mergeQualifiersErrorCheck(int line, TPublicType& dst, const ...@@ -776,7 +776,7 @@ bool TParseContext::mergeQualifiersErrorCheck(int line, TPublicType& dst, const
void TParseContext::setDefaultPrecision(int line, TPublicType& publicType, TPrecisionQualifier qualifier) void TParseContext::setDefaultPrecision(int line, TPublicType& publicType, TPrecisionQualifier qualifier)
{ {
TBasicType basicType = publicType.type; TBasicType basicType = publicType.basicType;
if (basicType == EbtSampler || basicType == EbtInt || basicType == EbtFloat) { if (basicType == EbtSampler || basicType == EbtInt || basicType == EbtFloat) {
if (publicType.isScalar()) { if (publicType.isScalar()) {
...@@ -1478,7 +1478,7 @@ void TParseContext::addBlock(int line, TPublicType& qualifier, const TString& bl ...@@ -1478,7 +1478,7 @@ void TParseContext::addBlock(int line, TPublicType& qualifier, const TString& bl
return; return;
} }
if (qualifier.type != EbtVoid) { if (qualifier.basicType != EbtVoid) {
error(line, "interface blocks cannot be declared with a type", blockName.c_str(), ""); error(line, "interface blocks cannot be declared with a type", blockName.c_str(), "");
recover(); recover();
......
...@@ -55,7 +55,7 @@ void TType::buildMangledName(TString& mangledName) ...@@ -55,7 +55,7 @@ void TType::buildMangledName(TString& mangledName)
else if (isVector()) else if (isVector())
mangledName += 'v'; mangledName += 'v';
switch (type) { switch (basicType) {
case EbtFloat: mangledName += 'f'; break; case EbtFloat: mangledName += 'f'; break;
case EbtDouble: mangledName += 'd'; break; case EbtDouble: mangledName += 'd'; break;
case EbtInt: mangledName += 'i'; break; case EbtInt: mangledName += 'i'; break;
......
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