Commit bb2bcae3 by Nicolas Capens Committed by Nicolas Capens

In-class initialize all TType members.

Also remove default constructors and unused members. Bug chromium:801648 Change-Id: I822ca1e1569708ca661796ee9252bae68a0a284a Reviewed-on: https://swiftshader-review.googlesource.com/16948Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 74faebba
...@@ -3598,7 +3598,7 @@ namespace glsl ...@@ -3598,7 +3598,7 @@ namespace glsl
const BlockMemberInfo blockInfo = encoder ? encoder->encodeType(type) : BlockMemberInfo::getDefaultBlockInfo(); const BlockMemberInfo blockInfo = encoder ? encoder->encodeType(type) : BlockMemberInfo::getDefaultBlockInfo();
if(blockId >= 0) if(blockId >= 0)
{ {
blockDefinitions[blockId][registerIndex] = TypedMemberInfo(blockInfo, type); blockDefinitions[blockId].insert(BlockDefinitionIndexMap::value_type(registerIndex, TypedMemberInfo(blockInfo, type)));
shaderObject->activeUniformBlocks[blockId].fields.push_back(activeUniforms.size()); shaderObject->activeUniformBlocks[blockId].fields.push_back(activeUniforms.size());
} }
int fieldRegisterIndex = encoder ? shaderObject->activeUniformBlocks[blockId].registerIndex + BlockLayoutEncoder::getBlockRegister(blockInfo) : registerIndex; int fieldRegisterIndex = encoder ? shaderObject->activeUniformBlocks[blockId].registerIndex + BlockLayoutEncoder::getBlockRegister(blockInfo) : registerIndex;
......
...@@ -333,7 +333,6 @@ namespace glsl ...@@ -333,7 +333,6 @@ namespace glsl
struct TypedMemberInfo : public BlockMemberInfo struct TypedMemberInfo : public BlockMemberInfo
{ {
TypedMemberInfo() {}
TypedMemberInfo(const BlockMemberInfo& b, const TType& t) : BlockMemberInfo(b), type(t) {} TypedMemberInfo(const BlockMemberInfo& b, const TType& t) : BlockMemberInfo(b), type(t) {}
TType type; TType type;
}; };
......
...@@ -34,14 +34,13 @@ ...@@ -34,14 +34,13 @@
int TSymbolTableLevel::uniqueId = 0; int TSymbolTableLevel::uniqueId = 0;
TType::TType(const TPublicType &p) : TType::TType(const TPublicType &p) :
type(p.type), precision(p.precision), qualifier(p.qualifier), invariant(p.invariant), layoutQualifier(p.layoutQualifier), type(p.type), precision(p.precision), qualifier(p.qualifier), layoutQualifier(p.layoutQualifier),
primarySize(p.primarySize), secondarySize(p.secondarySize), array(p.array), arraySize(p.arraySize), maxArraySize(0), primarySize(p.primarySize), secondarySize(p.secondarySize), array(p.array), arraySize(p.arraySize), maxArraySize(0),
arrayInformationType(0), interfaceBlock(0), structure(0), deepestStructNesting(0), mangled(0) arrayInformationType(0), interfaceBlock(0), structure(0), mangled(0)
{ {
if (p.userDef) if (p.userDef)
{ {
structure = p.userDef->getStruct(); structure = p.userDef->getStruct();
computeDeepestStructNesting();
} }
} }
...@@ -106,11 +105,6 @@ size_t TType::getStructSize() const ...@@ -106,11 +105,6 @@ size_t TType::getStructSize() const
return getStruct()->objectSize(); return getStruct()->objectSize();
} }
void TType::computeDeepestStructNesting()
{
deepestStructNesting = structure ? structure->deepestNesting() : 0;
}
bool TStructure::containsArrays() const bool TStructure::containsArrays() const
{ {
for(const auto& field : *mFields) for(const auto& field : *mFields)
......
...@@ -240,33 +240,32 @@ class TType ...@@ -240,33 +240,32 @@ class TType
{ {
public: public:
POOL_ALLOCATOR_NEW_DELETE(); POOL_ALLOCATOR_NEW_DELETE();
TType() {}
TType(TBasicType t, int s0 = 1, int s1 = 1) : TType(TBasicType t, int s0 = 1, int s1 = 1) :
type(t), precision(EbpUndefined), qualifier(EvqGlobal), invariant(false), layoutQualifier(TLayoutQualifier::create()), type(t), precision(EbpUndefined), qualifier(EvqGlobal), layoutQualifier(TLayoutQualifier::create()),
primarySize(s0), secondarySize(s1), array(false), arraySize(0), maxArraySize(0), arrayInformationType(0), interfaceBlock(0), primarySize(s0), secondarySize(s1), array(false), arraySize(0), maxArraySize(0), arrayInformationType(0), interfaceBlock(0),
structure(0), deepestStructNesting(0), mangled(0) structure(0), mangled(0)
{ {
} }
TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, int s0 = 1, int s1 = 1, bool a = false) : TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, int s0 = 1, int s1 = 1, bool a = false) :
type(t), precision(p), qualifier(q), invariant(false), layoutQualifier(TLayoutQualifier::create()), type(t), precision(p), qualifier(q), layoutQualifier(TLayoutQualifier::create()),
primarySize(s0), secondarySize(s1), array(a), arraySize(0), maxArraySize(0), arrayInformationType(0), interfaceBlock(0), primarySize(s0), secondarySize(s1), array(a), arraySize(0), maxArraySize(0), arrayInformationType(0), interfaceBlock(0),
structure(0), deepestStructNesting(0), mangled(0) structure(0), mangled(0)
{ {
} }
explicit TType(const TPublicType &p); explicit TType(const TPublicType &p);
TType(TStructure* userDef, TPrecision p = EbpUndefined) : TType(TStructure* userDef, TPrecision p = EbpUndefined) :
type(EbtStruct), precision(p), qualifier(EvqTemporary), invariant(false), layoutQualifier(TLayoutQualifier::create()), type(EbtStruct), precision(p), qualifier(EvqTemporary), layoutQualifier(TLayoutQualifier::create()),
primarySize(1), secondarySize(1), array(false), arraySize(0), maxArraySize(0), arrayInformationType(0), interfaceBlock(0), primarySize(1), secondarySize(1), array(false), arraySize(0), maxArraySize(0), arrayInformationType(0), interfaceBlock(0),
structure(userDef), deepestStructNesting(0), mangled(0) structure(userDef),mangled(0)
{ {
} }
TType(TInterfaceBlock *interfaceBlockIn, TQualifier qualifierIn, TType(TInterfaceBlock *interfaceBlockIn, TQualifier qualifierIn,
TLayoutQualifier layoutQualifierIn, int arraySizeIn) TLayoutQualifier layoutQualifierIn, int arraySizeIn)
: type(EbtInterfaceBlock), precision(EbpUndefined), qualifier(qualifierIn), : type(EbtInterfaceBlock), precision(EbpUndefined), qualifier(qualifierIn),
invariant(false), layoutQualifier(layoutQualifierIn), layoutQualifier(layoutQualifierIn),
primarySize(1), secondarySize(1), array(arraySizeIn > 0), arraySize(arraySizeIn), maxArraySize(0), arrayInformationType(0), primarySize(1), secondarySize(1), array(arraySizeIn > 0), arraySize(arraySizeIn), maxArraySize(0), arrayInformationType(0),
interfaceBlock(interfaceBlockIn), structure(0), deepestStructNesting(0), mangled(0) interfaceBlock(interfaceBlockIn), structure(0), mangled(0)
{ {
} }
...@@ -279,8 +278,6 @@ public: ...@@ -279,8 +278,6 @@ public:
TQualifier getQualifier() const { return qualifier; } TQualifier getQualifier() const { return qualifier; }
void setQualifier(TQualifier q) { qualifier = q; } void setQualifier(TQualifier q) { qualifier = q; }
bool isInvariant() const { return invariant; }
TLayoutQualifier getLayoutQualifier() const { return layoutQualifier; } TLayoutQualifier getLayoutQualifier() const { return layoutQualifier; }
void setLayoutQualifier(TLayoutQualifier lq) { layoutQualifier = lq; } void setLayoutQualifier(TLayoutQualifier lq) { layoutQualifier = lq; }
...@@ -450,7 +447,7 @@ public: ...@@ -450,7 +447,7 @@ public:
bool isScalarInt() const { return isScalar() && IsInteger(type); } bool isScalarInt() const { return isScalar() && IsInteger(type); }
TStructure* getStruct() const { return structure; } TStructure* getStruct() const { return structure; }
void setStruct(TStructure* s) { structure = s; computeDeepestStructNesting(); } void setStruct(TStructure* s) { structure = s; }
TString& getMangledName() { TString& getMangledName() {
if (!mangled) { if (!mangled) {
...@@ -530,27 +527,24 @@ public: ...@@ -530,27 +527,24 @@ public:
protected: protected:
void buildMangledName(TString&); void buildMangledName(TString&);
size_t getStructSize() const; size_t getStructSize() const;
void computeDeepestStructNesting();
TBasicType type; TBasicType type = EbtVoid;
TPrecision precision; TPrecision precision = EbpUndefined;
TQualifier qualifier; TQualifier qualifier = EvqTemporary;
bool invariant; unsigned char primarySize = 0; // size of vector or matrix, not size of array
unsigned char secondarySize = 0; // 1 for vectors, > 1 for matrices
bool array = false;
int arraySize = 0;
int maxArraySize = 0;
TType *arrayInformationType = nullptr;
// null unless this is an interface block, or interface block member variable
TInterfaceBlock *interfaceBlock = nullptr;
TLayoutQualifier layoutQualifier; TLayoutQualifier layoutQualifier;
unsigned char primarySize; // size of vector or matrix, not size of array
unsigned char secondarySize; // secondarySize: 1 for vectors, >1 for matrices
bool array;
int arraySize;
int maxArraySize;
TType *arrayInformationType;
// 0 unless this is an interface block, or interface block member variable
TInterfaceBlock *interfaceBlock;
TStructure *structure; // 0 unless this is a struct TStructure *structure = nullptr; // null unless this is a struct
int deepestStructNesting;
TString *mangled; TString *mangled = nullptr;
}; };
// //
......
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