Commit 758bc6a9 by Zhenyao Mo Committed by Commit Bot

Revert "Clean up the TType class."

This reverts commit 3f286cd1. Reason for revert: crbug.com/786603 Original change's description: > Clean up the TType class. > > Move more methods into the cpp file, and rename member variables to > start with the "m" prefix. > > Also move most of the TPublicType methods into the cpp. > > Bug: angleproject:1432 > Change-Id: Ib11a3c8c6ace654fd52077a317814665f81a7261 > Reviewed-on: https://chromium-review.googlesource.com/776276 > Reviewed-by: Kai Ninomiya <kainino@chromium.org> > Commit-Queue: Jamie Madill <jmadill@chromium.org> TBR=jmadill@chromium.org,oetuaho@nvidia.com,kainino@chromium.org Change-Id: Ib3062a71118095a3e58e75bfee2474c2e4ae9431 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: angleproject:1432 Reviewed-on: https://chromium-review.googlesource.com/777801Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org>
parent 3f286cd1
...@@ -113,52 +113,6 @@ const char *getBasicString(TBasicType t) ...@@ -113,52 +113,6 @@ const char *getBasicString(TBasicType t)
} }
} }
// TType implementation.
TType::TType()
: type(EbtVoid),
precision(EbpUndefined),
qualifier(EvqGlobal),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(0),
secondarySize(0),
mInterfaceBlock(nullptr),
mStructure(nullptr),
mIsStructSpecifier(false)
{
}
TType::TType(TBasicType t, unsigned char ps, unsigned char ss)
: type(t),
precision(EbpUndefined),
qualifier(EvqGlobal),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(ps),
secondarySize(ss),
mInterfaceBlock(0),
mStructure(0),
mIsStructSpecifier(false)
{
}
TType::TType(TBasicType t, TPrecision p, TQualifier q, unsigned char ps, unsigned char ss)
: type(t),
precision(p),
qualifier(q),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(ps),
secondarySize(ss),
mInterfaceBlock(0),
mStructure(0),
mIsStructSpecifier(false)
{
}
TType::TType(const TPublicType &p) TType::TType(const TPublicType &p)
: type(p.getBasicType()), : type(p.getBasicType()),
precision(p.precision), precision(p.precision),
...@@ -168,8 +122,8 @@ TType::TType(const TPublicType &p) ...@@ -168,8 +122,8 @@ TType::TType(const TPublicType &p)
layoutQualifier(p.layoutQualifier), layoutQualifier(p.layoutQualifier),
primarySize(p.getPrimarySize()), primarySize(p.getPrimarySize()),
secondarySize(p.getSecondarySize()), secondarySize(p.getSecondarySize()),
mInterfaceBlock(nullptr), interfaceBlock(0),
mStructure(nullptr), structure(0),
mIsStructSpecifier(false) mIsStructSpecifier(false)
{ {
ASSERT(primarySize <= 4); ASSERT(primarySize <= 4);
...@@ -180,41 +134,14 @@ TType::TType(const TPublicType &p) ...@@ -180,41 +134,14 @@ TType::TType(const TPublicType &p)
} }
if (p.getUserDef()) if (p.getUserDef())
{ {
mStructure = p.getUserDef(); structure = p.getUserDef();
mIsStructSpecifier = p.isStructSpecifier(); mIsStructSpecifier = p.isStructSpecifier();
} }
} }
TType::TType(TStructure *userDef) bool TStructure::equals(const TStructure &other) const
: type(EbtStruct),
precision(EbpUndefined),
qualifier(EvqTemporary),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(1),
secondarySize(1),
mInterfaceBlock(nullptr),
mStructure(userDef),
mIsStructSpecifier(false)
{
}
TType::TType(TInterfaceBlock *interfaceBlockIn,
TQualifier qualifierIn,
TLayoutQualifier layoutQualifierIn)
: type(EbtInterfaceBlock),
precision(EbpUndefined),
qualifier(qualifierIn),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(layoutQualifierIn),
primarySize(1),
secondarySize(1),
mInterfaceBlock(interfaceBlockIn),
mStructure(0),
mIsStructSpecifier(false)
{ {
return (uniqueId() == other.uniqueId());
} }
bool TType::canBeConstructed() const bool TType::canBeConstructed() const
...@@ -503,10 +430,10 @@ TString TType::buildMangledName() const ...@@ -503,10 +430,10 @@ TString TType::buildMangledName() const
mangledName += "ac"; mangledName += "ac";
break; break;
case EbtStruct: case EbtStruct:
mangledName += mStructure->mangledName(); mangledName += structure->mangledName();
break; break;
case EbtInterfaceBlock: case EbtInterfaceBlock:
mangledName += mInterfaceBlock->mangledName(); mangledName += interfaceBlock->mangledName();
break; break;
default: default:
// EbtVoid, EbtAddress and non types // EbtVoid, EbtAddress and non types
...@@ -540,7 +467,7 @@ size_t TType::getObjectSize() const ...@@ -540,7 +467,7 @@ size_t TType::getObjectSize() const
size_t totalSize; size_t totalSize;
if (getBasicType() == EbtStruct) if (getBasicType() == EbtStruct)
totalSize = mStructure->objectSize(); totalSize = structure->objectSize();
else else
totalSize = primarySize * secondarySize; totalSize = primarySize * secondarySize;
...@@ -564,7 +491,7 @@ int TType::getLocationCount() const ...@@ -564,7 +491,7 @@ int TType::getLocationCount() const
if (getBasicType() == EbtStruct) if (getBasicType() == EbtStruct)
{ {
count = mStructure->getLocationCount(); count = structure->getLocationCount();
} }
if (count == 0) if (count == 0)
...@@ -612,7 +539,7 @@ bool TType::isUnsizedArray() const ...@@ -612,7 +539,7 @@ bool TType::isUnsizedArray() const
bool TType::sameNonArrayType(const TType &right) const bool TType::sameNonArrayType(const TType &right) const
{ {
return (type == right.type && primarySize == right.primarySize && return (type == right.type && primarySize == right.primarySize &&
secondarySize == right.secondarySize && mStructure == right.mStructure); secondarySize == right.secondarySize && structure == right.structure);
} }
bool TType::isElementTypeOf(const TType &arrayType) const bool TType::isElementTypeOf(const TType &arrayType) const
...@@ -661,100 +588,6 @@ void TType::sizeOutermostUnsizedArray(unsigned int arraySize) ...@@ -661,100 +588,6 @@ void TType::sizeOutermostUnsizedArray(unsigned int arraySize)
mArraySizes.back() = arraySize; mArraySizes.back() = arraySize;
} }
void TType::setBasicType(TBasicType t)
{
if (type != t)
{
type = t;
invalidateMangledName();
}
}
void TType::setPrimarySize(unsigned char ps)
{
if (primarySize != ps)
{
ASSERT(ps <= 4);
primarySize = ps;
invalidateMangledName();
}
}
void TType::setSecondarySize(unsigned char ss)
{
if (secondarySize != ss)
{
ASSERT(ss <= 4);
secondarySize = ss;
invalidateMangledName();
}
}
void TType::makeArray(unsigned int s)
{
mArraySizes.push_back(s);
invalidateMangledName();
}
void TType::setArraySize(size_t arrayDimension, unsigned int s)
{
ASSERT(arrayDimension < mArraySizes.size());
if (mArraySizes.at(arrayDimension) != s)
{
mArraySizes[arrayDimension] = s;
invalidateMangledName();
}
}
void TType::toArrayElementType()
{
if (mArraySizes.size() > 0)
{
mArraySizes.pop_back();
invalidateMangledName();
}
}
void TType::setInterfaceBlock(TInterfaceBlock *interfaceBlockIn)
{
if (mInterfaceBlock != interfaceBlockIn)
{
mInterfaceBlock = interfaceBlockIn;
invalidateMangledName();
}
}
void TType::setStruct(TStructure *s)
{
if (mStructure != s)
{
mStructure = s;
invalidateMangledName();
}
}
const TString &TType::getMangledName() const
{
if (mMangledName.empty())
{
mMangledName = buildMangledName();
mMangledName += ';';
}
return mMangledName;
}
void TType::realize()
{
getMangledName();
}
void TType::invalidateMangledName()
{
mMangledName = "";
}
// TStructure implementation.
TStructure::TStructure(TSymbolTable *symbolTable, const TString *name, TFieldList *fields) TStructure::TStructure(TSymbolTable *symbolTable, const TString *name, TFieldList *fields)
: TFieldListCollection(name, fields), : TFieldListCollection(name, fields),
mDeepestNesting(0), mDeepestNesting(0),
...@@ -763,11 +596,6 @@ TStructure::TStructure(TSymbolTable *symbolTable, const TString *name, TFieldLis ...@@ -763,11 +596,6 @@ TStructure::TStructure(TSymbolTable *symbolTable, const TString *name, TFieldLis
{ {
} }
bool TStructure::equals(const TStructure &other) const
{
return (uniqueId() == other.uniqueId());
}
bool TStructure::containsArrays() const bool TStructure::containsArrays() const
{ {
for (size_t i = 0; i < mFields->size(); ++i) for (size_t i = 0; i < mFields->size(); ++i)
...@@ -826,7 +654,7 @@ void TType::createSamplerSymbols(const TString &namePrefix, ...@@ -826,7 +654,7 @@ void TType::createSamplerSymbols(const TString &namePrefix,
} }
else else
{ {
mStructure->createSamplerSymbols(namePrefix, apiNamePrefix, outputSymbols, structure->createSamplerSymbols(namePrefix, apiNamePrefix, outputSymbols,
outputSymbolsToAPINames, symbolTable); outputSymbolsToAPINames, symbolTable);
} }
return; return;
...@@ -913,68 +741,4 @@ int TStructure::calculateDeepestNesting() const ...@@ -913,68 +741,4 @@ int TStructure::calculateDeepestNesting() const
return 1 + maxNesting; return 1 + maxNesting;
} }
// TPublicType implementation.
void TPublicType::initialize(const TTypeSpecifierNonArray &typeSpecifier, TQualifier q)
{
typeSpecifierNonArray = typeSpecifier;
layoutQualifier = TLayoutQualifier::create();
memoryQualifier = TMemoryQualifier::create();
qualifier = q;
invariant = false;
precision = EbpUndefined;
array = false;
arraySize = 0;
}
void TPublicType::initializeBasicType(TBasicType basicType)
{
typeSpecifierNonArray.type = basicType;
typeSpecifierNonArray.primarySize = 1;
typeSpecifierNonArray.secondarySize = 1;
layoutQualifier = TLayoutQualifier::create();
memoryQualifier = TMemoryQualifier::create();
qualifier = EvqTemporary;
invariant = false;
precision = EbpUndefined;
array = false;
arraySize = 0;
}
bool TPublicType::isStructureContainingArrays() const
{
if (!typeSpecifierNonArray.userDef)
{
return false;
}
return typeSpecifierNonArray.userDef->containsArrays();
}
bool TPublicType::isStructureContainingType(TBasicType t) const
{
if (!typeSpecifierNonArray.userDef)
{
return false;
}
return typeSpecifierNonArray.userDef->containsType(t);
}
void TPublicType::setArraySize(int s)
{
array = true;
arraySize = s;
}
void TPublicType::clearArrayness()
{
array = false;
arraySize = 0;
}
bool TPublicType::isAggregate() const
{
return array || typeSpecifierNonArray.isMatrix() || typeSpecifierNonArray.isVector();
}
} // namespace sh } // namespace sh
...@@ -182,24 +182,96 @@ class TType ...@@ -182,24 +182,96 @@ class TType
{ {
public: public:
POOL_ALLOCATOR_NEW_DELETE(); POOL_ALLOCATOR_NEW_DELETE();
TType(); TType()
explicit TType(TBasicType t, unsigned char ps = 1, unsigned char ss = 1); : type(EbtVoid),
precision(EbpUndefined),
qualifier(EvqGlobal),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(0),
secondarySize(0),
interfaceBlock(nullptr),
structure(nullptr),
mIsStructSpecifier(false)
{
}
explicit TType(TBasicType t, unsigned char ps = 1, unsigned char ss = 1)
: type(t),
precision(EbpUndefined),
qualifier(EvqGlobal),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(ps),
secondarySize(ss),
interfaceBlock(0),
structure(0),
mIsStructSpecifier(false)
{
}
TType(TBasicType t, TType(TBasicType t,
TPrecision p, TPrecision p,
TQualifier q = EvqTemporary, TQualifier q = EvqTemporary,
unsigned char ps = 1, unsigned char ps = 1,
unsigned char ss = 1); unsigned char ss = 1)
: type(t),
precision(p),
qualifier(q),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(ps),
secondarySize(ss),
interfaceBlock(0),
structure(0),
mIsStructSpecifier(false)
{
}
explicit TType(const TPublicType &p); explicit TType(const TPublicType &p);
explicit TType(TStructure *userDef); explicit TType(TStructure *userDef)
: type(EbtStruct),
precision(EbpUndefined),
qualifier(EvqTemporary),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(TLayoutQualifier::create()),
primarySize(1),
secondarySize(1),
interfaceBlock(0),
structure(userDef),
mIsStructSpecifier(false)
{
}
TType(TInterfaceBlock *interfaceBlockIn, TType(TInterfaceBlock *interfaceBlockIn,
TQualifier qualifierIn, TQualifier qualifierIn,
TLayoutQualifier layoutQualifierIn); TLayoutQualifier layoutQualifierIn)
: type(EbtInterfaceBlock),
precision(EbpUndefined),
qualifier(qualifierIn),
invariant(false),
memoryQualifier(TMemoryQualifier::create()),
layoutQualifier(layoutQualifierIn),
primarySize(1),
secondarySize(1),
interfaceBlock(interfaceBlockIn),
structure(0),
mIsStructSpecifier(false)
{
}
TType(const TType &) = default; TType(const TType &) = default;
TType &operator=(const TType &) = default; TType &operator=(const TType &) = default;
TBasicType getBasicType() const { return type; } TBasicType getBasicType() const { return type; }
void setBasicType(TBasicType t); void setBasicType(TBasicType t)
{
if (type != t)
{
type = t;
invalidateMangledName();
}
}
TPrecision getPrecision() const { return precision; } TPrecision getPrecision() const { return precision; }
void setPrecision(TPrecision p) { precision = p; } void setPrecision(TPrecision p) { precision = p; }
...@@ -229,8 +301,24 @@ class TType ...@@ -229,8 +301,24 @@ class TType
ASSERT(isMatrix()); ASSERT(isMatrix());
return secondarySize; return secondarySize;
} }
void setPrimarySize(unsigned char ps); void setPrimarySize(unsigned char ps)
void setSecondarySize(unsigned char ss); {
if (primarySize != ps)
{
ASSERT(ps <= 4);
primarySize = ps;
invalidateMangledName();
}
}
void setSecondarySize(unsigned char ss)
{
if (secondarySize != ss)
{
ASSERT(ss <= 4);
secondarySize = ss;
invalidateMangledName();
}
}
// Full size of single instance of type // Full size of single instance of type
size_t getObjectSize() const; size_t getObjectSize() const;
...@@ -246,10 +334,21 @@ class TType ...@@ -246,10 +334,21 @@ class TType
unsigned int getArraySizeProduct() const; unsigned int getArraySizeProduct() const;
bool isUnsizedArray() const; bool isUnsizedArray() const;
unsigned int getOutermostArraySize() const { return mArraySizes.back(); } unsigned int getOutermostArraySize() const { return mArraySizes.back(); }
void makeArray(unsigned int s); void makeArray(unsigned int s)
{
mArraySizes.push_back(s);
invalidateMangledName();
}
// Here, the array dimension value 0 corresponds to the innermost array. // Here, the array dimension value 0 corresponds to the innermost array.
void setArraySize(size_t arrayDimension, unsigned int s); void setArraySize(size_t arrayDimension, unsigned int s)
{
ASSERT(arrayDimension < mArraySizes.size());
if (mArraySizes.at(arrayDimension) != s)
{
mArraySizes[arrayDimension] = s;
invalidateMangledName();
}
}
// Will set unsized array sizes according to arraySizes. In case there are more unsized arrays // Will set unsized array sizes according to arraySizes. In case there are more unsized arrays
// than there are sizes in arraySizes, defaults to setting array sizes to 1. // than there are sizes in arraySizes, defaults to setting array sizes to 1.
...@@ -259,27 +358,57 @@ class TType ...@@ -259,27 +358,57 @@ class TType
void sizeOutermostUnsizedArray(unsigned int arraySize); void sizeOutermostUnsizedArray(unsigned int arraySize);
// Note that the array element type might still be an array type in GLSL ES version >= 3.10. // Note that the array element type might still be an array type in GLSL ES version >= 3.10.
void toArrayElementType(); void toArrayElementType()
{
if (mArraySizes.size() > 0)
{
mArraySizes.pop_back();
invalidateMangledName();
}
}
TInterfaceBlock *getInterfaceBlock() const { return mInterfaceBlock; } TInterfaceBlock *getInterfaceBlock() const { return interfaceBlock; }
void setInterfaceBlock(TInterfaceBlock *interfaceBlockIn); void setInterfaceBlock(TInterfaceBlock *interfaceBlockIn)
{
if (interfaceBlock != interfaceBlockIn)
{
interfaceBlock = interfaceBlockIn;
invalidateMangledName();
}
}
bool isInterfaceBlock() const { return type == EbtInterfaceBlock; } bool isInterfaceBlock() const { return type == EbtInterfaceBlock; }
bool isVector() const { return primarySize > 1 && secondarySize == 1; } bool isVector() const { return primarySize > 1 && secondarySize == 1; }
bool isScalar() const bool isScalar() const
{ {
return primarySize == 1 && secondarySize == 1 && !mStructure && !isArray(); return primarySize == 1 && secondarySize == 1 && !structure && !isArray();
} }
bool isScalarFloat() const { return isScalar() && type == EbtFloat; } bool isScalarFloat() const { return isScalar() && type == EbtFloat; }
bool isScalarInt() const { return isScalar() && (type == EbtInt || type == EbtUInt); } bool isScalarInt() const { return isScalar() && (type == EbtInt || type == EbtUInt); }
bool canBeConstructed() const; bool canBeConstructed() const;
TStructure *getStruct() { return mStructure; } TStructure *getStruct() { return structure; }
const TStructure *getStruct() const { return mStructure; } const TStructure *getStruct() const { return structure; }
void setStruct(TStructure *s); void setStruct(TStructure *s)
{
if (structure != s)
{
structure = s;
invalidateMangledName();
}
}
const TString &getMangledName() const; const TString &getMangledName() const
{
if (mangled.empty())
{
mangled = buildMangledName();
mangled += ';';
}
return mangled;
}
bool sameNonArrayType(const TType &right) const; bool sameNonArrayType(const TType &right) const;
...@@ -290,7 +419,7 @@ class TType ...@@ -290,7 +419,7 @@ class TType
{ {
return type == right.type && primarySize == right.primarySize && return type == right.type && primarySize == right.primarySize &&
secondarySize == right.secondarySize && mArraySizes == right.mArraySizes && secondarySize == right.secondarySize && mArraySizes == right.mArraySizes &&
mStructure == right.mStructure; structure == right.structure;
// don't check the qualifier, it's not ever what's being sought after // don't check the qualifier, it's not ever what's being sought after
} }
bool operator!=(const TType &right) const { return !operator==(right); } bool operator!=(const TType &right) const { return !operator==(right); }
...@@ -309,8 +438,8 @@ class TType ...@@ -309,8 +438,8 @@ class TType
if (mArraySizes[i] != right.mArraySizes[i]) if (mArraySizes[i] != right.mArraySizes[i])
return mArraySizes[i] < right.mArraySizes[i]; return mArraySizes[i] < right.mArraySizes[i];
} }
if (mStructure != right.mStructure) if (structure != right.structure)
return mStructure < right.mStructure; return structure < right.structure;
return false; return false;
} }
...@@ -336,23 +465,23 @@ class TType ...@@ -336,23 +465,23 @@ class TType
// For type "nesting2", this method would return 2 -- the number // For type "nesting2", this method would return 2 -- the number
// of structures through which indirection must occur to reach the // of structures through which indirection must occur to reach the
// deepest field (nesting2.field1.position). // deepest field (nesting2.field1.position).
int getDeepestStructNesting() const { return mStructure ? mStructure->deepestNesting() : 0; } int getDeepestStructNesting() const { return structure ? structure->deepestNesting() : 0; }
bool isNamelessStruct() const { return mStructure && mStructure->name() == ""; } bool isNamelessStruct() const { return structure && structure->name() == ""; }
bool isStructureContainingArrays() const bool isStructureContainingArrays() const
{ {
return mStructure ? mStructure->containsArrays() : false; return structure ? structure->containsArrays() : false;
} }
bool isStructureContainingType(TBasicType t) const bool isStructureContainingType(TBasicType t) const
{ {
return mStructure ? mStructure->containsType(t) : false; return structure ? structure->containsType(t) : false;
} }
bool isStructureContainingSamplers() const bool isStructureContainingSamplers() const
{ {
return mStructure ? mStructure->containsSamplers() : false; return structure ? structure->containsSamplers() : false;
} }
bool isStructSpecifier() const { return mIsStructSpecifier; } bool isStructSpecifier() const { return mIsStructSpecifier; }
...@@ -364,10 +493,10 @@ class TType ...@@ -364,10 +493,10 @@ class TType
TSymbolTable *symbolTable) const; TSymbolTable *symbolTable) const;
// Initializes all lazily-initialized members. // Initializes all lazily-initialized members.
void realize(); void realize() { getMangledName(); }
private: private:
void invalidateMangledName(); void invalidateMangledName() { mangled = ""; }
TString buildMangledName() const; TString buildMangledName() const;
TBasicType type; TBasicType type;
...@@ -387,13 +516,13 @@ class TType ...@@ -387,13 +516,13 @@ class TType
// 1) Represents an interface block. // 1) Represents an interface block.
// 2) Represents the member variable of an unnamed interface block. // 2) Represents the member variable of an unnamed interface block.
// It's nullptr also for members of named interface blocks. // It's nullptr also for members of named interface blocks.
TInterfaceBlock *mInterfaceBlock; TInterfaceBlock *interfaceBlock;
// 0 unless this is a struct // 0 unless this is a struct
TStructure *mStructure; TStructure *structure;
bool mIsStructSpecifier; bool mIsStructSpecifier;
mutable TString mMangledName; mutable TString mangled;
}; };
// TTypeSpecifierNonArray stores all of the necessary fields for type_specifier_nonarray from the // TTypeSpecifierNonArray stores all of the necessary fields for type_specifier_nonarray from the
...@@ -455,8 +584,40 @@ struct TTypeSpecifierNonArray ...@@ -455,8 +584,40 @@ struct TTypeSpecifierNonArray
// //
struct TPublicType struct TPublicType
{ {
void initialize(const TTypeSpecifierNonArray &typeSpecifier, TQualifier q); TTypeSpecifierNonArray typeSpecifierNonArray;
void initializeBasicType(TBasicType basicType); TLayoutQualifier layoutQualifier;
TMemoryQualifier memoryQualifier;
TQualifier qualifier;
bool invariant;
TPrecision precision;
bool array;
int arraySize;
void initialize(const TTypeSpecifierNonArray &typeSpecifier, TQualifier q)
{
typeSpecifierNonArray = typeSpecifier;
layoutQualifier = TLayoutQualifier::create();
memoryQualifier = TMemoryQualifier::create();
qualifier = q;
invariant = false;
precision = EbpUndefined;
array = false;
arraySize = 0;
}
void initializeBasicType(TBasicType basicType)
{
typeSpecifierNonArray.type = basicType;
typeSpecifierNonArray.primarySize = 1;
typeSpecifierNonArray.secondarySize = 1;
layoutQualifier = TLayoutQualifier::create();
memoryQualifier = TMemoryQualifier::create();
qualifier = EvqTemporary;
invariant = false;
precision = EbpUndefined;
array = false;
arraySize = 0;
}
TBasicType getBasicType() const { return typeSpecifierNonArray.type; } TBasicType getBasicType() const { return typeSpecifierNonArray.type; }
void setBasicType(TBasicType basicType) { typeSpecifierNonArray.type = basicType; } void setBasicType(TBasicType basicType) { typeSpecifierNonArray.type = basicType; }
...@@ -469,20 +630,41 @@ struct TPublicType ...@@ -469,20 +630,41 @@ struct TPublicType
bool isStructSpecifier() const { return typeSpecifierNonArray.isStructSpecifier; } bool isStructSpecifier() const { return typeSpecifierNonArray.isStructSpecifier; }
bool isStructureContainingArrays() const; bool isStructureContainingArrays() const
bool isStructureContainingType(TBasicType t) const; {
void setArraySize(int s); if (!typeSpecifierNonArray.userDef)
void clearArrayness(); {
bool isAggregate() const; return false;
}
TTypeSpecifierNonArray typeSpecifierNonArray; return typeSpecifierNonArray.userDef->containsArrays();
TLayoutQualifier layoutQualifier; }
TMemoryQualifier memoryQualifier;
TQualifier qualifier; bool isStructureContainingType(TBasicType t) const
bool invariant; {
TPrecision precision; if (!typeSpecifierNonArray.userDef)
bool array; {
int arraySize; return false;
}
return typeSpecifierNonArray.userDef->containsType(t);
}
void setArraySize(int s)
{
array = true;
arraySize = s;
}
void clearArrayness()
{
array = false;
arraySize = 0;
}
bool isAggregate() const
{
return array || typeSpecifierNonArray.isMatrix() || typeSpecifierNonArray.isVector();
}
}; };
} // namespace sh } // namespace sh
......
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