Commit ed319792 by John Kessenich

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

parent f6648dc1
......@@ -288,7 +288,7 @@ public:
class TPublicType {
public:
TBasicType type;
TBasicType basicType;
TSampler sampler;
TQualifier qualifier;
int vectorSize : 4;
......@@ -300,7 +300,7 @@ public:
void initType(int ln = 0)
{
type = EbtVoid;
basicType = EbtVoid;
vectorSize = 1;
matrixRows = 0;
matrixCols = 0;
......@@ -352,7 +352,7 @@ class TType {
public:
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
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),
fieldName(0), mangled(0), typeName(0)
{
......@@ -361,7 +361,7 @@ public:
qualifier.storage = q;
}
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),
fieldName(0), mangled(0), typeName(0)
{
......@@ -372,7 +372,7 @@ public:
assert(p >= 0 && p <= EpqHigh);
}
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)
{
sampler = p.sampler;
......@@ -383,7 +383,7 @@ public:
}
}
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)
{
sampler.clear();
......@@ -391,7 +391,7 @@ public:
// is it an interface block?
if (blockQualifier != EvqGlobal) {
qualifier.storage = blockQualifier;
type = EbtBlock;
basicType = EbtBlock;
}
typeName = NewPoolTString(n.c_str());
}
......@@ -402,7 +402,7 @@ public:
void copyType(const TType& copyOf, const TStructureMap& remapper)
{
type = copyOf.type;
basicType = copyOf.basicType;
sampler = copyOf.sampler;
qualifier = copyOf.qualifier;
vectorSize = copyOf.vectorSize;
......@@ -472,7 +472,7 @@ public:
virtual void setElementType(TBasicType t, int s, int mc, int mr, const TType* userDef)
{
type = t;
basicType = t;
vectorSize = s;
matrixCols = mc;
matrixRows = mr;
......@@ -494,7 +494,7 @@ public:
return *fieldName;
}
virtual TBasicType getBasicType() const { return type; }
virtual TBasicType getBasicType() const { return basicType; }
virtual const TSampler& getSampler() const { return sampler; }
virtual TQualifier& getQualifier() { return qualifier; }
virtual const TQualifier& getQualifier() const { return qualifier; }
......@@ -519,7 +519,7 @@ public:
TType* getArrayInformationType() { return arrayInformationType; }
virtual bool isVector() const { return vectorSize > 1; }
const char* getBasicString() const {
return TType::getBasicString(type);
return TType::getBasicString(basicType);
}
static const char* getBasicString(TBasicType t) {
switch (t) {
......@@ -604,7 +604,7 @@ public:
TString getCompleteTypeString() const
{
if (type == EbtSampler)
if (basicType == EbtSampler)
return sampler.getString();
else
return getBasicString();
......@@ -645,7 +645,7 @@ public:
bool sameElementType(const TType& right) const
{
return type == right.type &&
return basicType == right.basicType &&
sampler == right.sampler &&
vectorSize == right.vectorSize &&
matrixCols == right.matrixCols &&
......@@ -670,7 +670,7 @@ protected:
void buildMangledName(TString&);
int getStructSize() const;
TBasicType type : 8;
TBasicType basicType : 8;
int vectorSize : 4;
int matrixCols : 4;
int matrixRows : 4;
......
......@@ -577,7 +577,7 @@ bool TParseContext::constructorErrorCheck(int line, TIntermNode* node, TFunction
//
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(), "");
return true;
}
......@@ -605,7 +605,7 @@ bool TParseContext::boolErrorCheck(int line, const TIntermTyped* type)
//
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", "", "");
return true;
}
......@@ -615,16 +615,16 @@ bool TParseContext::boolErrorCheck(int line, const TPublicType& pType)
bool TParseContext::samplerErrorCheck(int line, const TPublicType& pType, const char* reason)
{
if (pType.type == EbtStruct) {
if (pType.basicType == EbtStruct) {
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 false;
} else if (pType.type == EbtSampler) {
error(line, reason, TType::getBasicString(pType.type), "");
} else if (pType.basicType == EbtSampler) {
error(line, reason, TType::getBasicString(pType.basicType), "");
return true;
}
......@@ -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
if (publicType.type == EbtBool) {
if (publicType.basicType == EbtBool) {
error(line, "cannot be bool", getStorageQualifierString(qualifier.storage), "");
return true;
}
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), "");
return true;
}
......@@ -690,17 +690,17 @@ bool TParseContext::globalQualifierFixAndErrorCheck(int line, TQualifier& qualif
if (language == EShLangFragment && qualifier.storage == EvqVaryingOut) {
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), "");
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");
if (language != EShLangVertex && qualifier.storage == EvqVaryingIn && ! 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;
}
......@@ -776,7 +776,7 @@ bool TParseContext::mergeQualifiersErrorCheck(int line, TPublicType& dst, const
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 (publicType.isScalar()) {
......@@ -1478,7 +1478,7 @@ void TParseContext::addBlock(int line, TPublicType& qualifier, const TString& bl
return;
}
if (qualifier.type != EbtVoid) {
if (qualifier.basicType != EbtVoid) {
error(line, "interface blocks cannot be declared with a type", blockName.c_str(), "");
recover();
......
......@@ -55,7 +55,7 @@ void TType::buildMangledName(TString& mangledName)
else if (isVector())
mangledName += 'v';
switch (type) {
switch (basicType) {
case EbtFloat: mangledName += 'f'; break;
case EbtDouble: mangledName += 'd'; 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