diff options
Diffstat (limited to 'Source/ThirdParty/ANGLE/src/compiler/Types.h')
-rw-r--r-- | Source/ThirdParty/ANGLE/src/compiler/Types.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Source/ThirdParty/ANGLE/src/compiler/Types.h b/Source/ThirdParty/ANGLE/src/compiler/Types.h index d0fcc08..e1a18fd 100644 --- a/Source/ThirdParty/ANGLE/src/compiler/Types.h +++ b/Source/ThirdParty/ANGLE/src/compiler/Types.h @@ -85,21 +85,22 @@ public: TType() {} TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, int s = 1, bool m = false, bool a = false) : type(t), precision(p), qualifier(q), size(s), matrix(m), array(a), arraySize(0), - maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), fieldName(0), mangled(0), typeName(0) + maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0) { } explicit TType(const TPublicType &p) : type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize), - maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), fieldName(0), mangled(0), typeName(0) + maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0) { if (p.userDef) { structure = p.userDef->getStruct(); typeName = NewPoolTString(p.userDef->getTypeName().c_str()); + computeDeepestStructNesting(); } } TType(TTypeList* userDef, const TString& n, TPrecision p = EbpUndefined) : type(EbtStruct), precision(p), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0), - maxArraySize(0), arrayInformationType(0), structure(userDef), structureSize(0), fieldName(0), mangled(0) + maxArraySize(0), arrayInformationType(0), structure(userDef), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0) { typeName = NewPoolTString(n.c_str()); } @@ -144,6 +145,7 @@ public: structureSize = copyOf.structureSize; maxArraySize = copyOf.maxArraySize; + deepestStructNesting = copyOf.deepestStructNesting; assert(copyOf.arrayInformationType == 0); arrayInformationType = 0; // arrayInformationType should not be set for builtIn symbol table level } @@ -202,7 +204,7 @@ public: bool isScalar() const { return size == 1 && !matrix && !structure; } TTypeList* getStruct() const { return structure; } - void setStruct(TTypeList* s) { structure = s; } + void setStruct(TTypeList* s) { structure = s; computeDeepestStructNesting(); } const TString& getTypeName() const { @@ -268,9 +270,24 @@ public: const char* getQualifierString() const { return ::getQualifierString(qualifier); } TString getCompleteString() const; + // If this type is a struct, returns the deepest struct nesting of + // any field in the struct. For example: + // struct nesting1 { + // vec4 position; + // }; + // struct nesting2 { + // nesting1 field1; + // vec4 field2; + // }; + // For type "nesting2", this method would return 2 -- the number + // of structures through which indirection must occur to reach the + // deepest field (nesting2.field1.position). + int getDeepestStructNesting() const { return deepestStructNesting; } + protected: void buildMangledName(TString&); int getStructSize() const; + void computeDeepestStructNesting(); TBasicType type : 6; TPrecision precision; @@ -284,6 +301,7 @@ protected: TTypeList* structure; // 0 unless this is a struct mutable int structureSize; + int deepestStructNesting; TString *fieldName; // for structure field names TString *mangled; |