Commit 94bf7f22 by Jamie Madill Committed by Shannon Woods

Used size_t for object size instead of signed int.

BUG=crbug 179653 R=aedla@chromium.org, kbr@chromium.org Review URL: https://codereview.appspot.com/8834048 git-svn-id: https://angleproject.googlecode.com/svn/trunk@2211 736b8ea6-26fd-11df-bfd4-992fa37f6226 TRAC #23333 Authored-by: alokp@chromium.org Signed-off-by: Shannon Woods Signed-off-by Nicolas Capens Merged-by: Jamie Madill
parent 7164cf47
...@@ -1145,11 +1145,11 @@ bool CompareStruct(const TType& leftNodeType, ConstantUnion* rightUnionArray, Co ...@@ -1145,11 +1145,11 @@ bool CompareStruct(const TType& leftNodeType, ConstantUnion* rightUnionArray, Co
const TTypeList* fields = leftNodeType.getStruct(); const TTypeList* fields = leftNodeType.getStruct();
size_t structSize = fields->size(); size_t structSize = fields->size();
int index = 0; size_t index = 0;
for (size_t j = 0; j < structSize; j++) { for (size_t j = 0; j < structSize; j++) {
int size = (*fields)[j].type->getObjectSize(); size_t size = (*fields)[j].type->getObjectSize();
for (int i = 0; i < size; i++) { for (size_t i = 0; i < size; i++) {
if ((*fields)[j].type->getBasicType() == EbtStruct) { if ((*fields)[j].type->getBasicType() == EbtStruct) {
if (!CompareStructure(*(*fields)[j].type, &rightUnionArray[index], &leftUnionArray[index])) if (!CompareStructure(*(*fields)[j].type, &rightUnionArray[index], &leftUnionArray[index]))
return false; return false;
...@@ -1170,10 +1170,10 @@ bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ...@@ -1170,10 +1170,10 @@ bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray,
TType typeWithoutArrayness = leftNodeType; TType typeWithoutArrayness = leftNodeType;
typeWithoutArrayness.clearArrayness(); typeWithoutArrayness.clearArrayness();
int arraySize = leftNodeType.getArraySize(); size_t arraySize = leftNodeType.getArraySize();
for (int i = 0; i < arraySize; ++i) { for (size_t i = 0; i < arraySize; ++i) {
int offset = typeWithoutArrayness.getObjectSize() * i; size_t offset = typeWithoutArrayness.getObjectSize() * i;
if (!CompareStruct(typeWithoutArrayness, &rightUnionArray[offset], &leftUnionArray[offset])) if (!CompareStruct(typeWithoutArrayness, &rightUnionArray[offset], &leftUnionArray[offset]))
return false; return false;
} }
...@@ -1193,7 +1193,7 @@ bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ...@@ -1193,7 +1193,7 @@ bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray,
TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode, TInfoSink& infoSink) TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode, TInfoSink& infoSink)
{ {
ConstantUnion *unionArray = getUnionArrayPointer(); ConstantUnion *unionArray = getUnionArrayPointer();
int objectSize = getType().getObjectSize(); size_t objectSize = getType().getObjectSize();
if (constantNode) if (constantNode)
{ {
...@@ -1206,7 +1206,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1206,7 +1206,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
if (constantNode->getType().getObjectSize() == 1 && objectSize > 1) if (constantNode->getType().getObjectSize() == 1 && objectSize > 1)
{ {
rightUnionArray = new ConstantUnion[objectSize]; rightUnionArray = new ConstantUnion[objectSize];
for (int i = 0; i < objectSize; ++i) for (size_t i = 0; i < objectSize; ++i)
{ {
rightUnionArray[i] = *node->getUnionArrayPointer(); rightUnionArray[i] = *node->getUnionArrayPointer();
} }
...@@ -1216,7 +1216,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1216,7 +1216,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
{ {
// for a case like float f = vec4(2,3,4,5) + 1.2; // for a case like float f = vec4(2,3,4,5) + 1.2;
unionArray = new ConstantUnion[constantNode->getType().getObjectSize()]; unionArray = new ConstantUnion[constantNode->getType().getObjectSize()];
for (int i = 0; i < constantNode->getType().getObjectSize(); ++i) for (size_t i = 0; i < constantNode->getType().getObjectSize(); ++i)
{ {
unionArray[i] = *getUnionArrayPointer(); unionArray[i] = *getUnionArrayPointer();
} }
...@@ -1232,14 +1232,14 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1232,14 +1232,14 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EOpAdd: case EOpAdd:
tempConstArray = new ConstantUnion[objectSize]; tempConstArray = new ConstantUnion[objectSize];
{ {
for (int i = 0; i < objectSize; i++) for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] + rightUnionArray[i]; tempConstArray[i] = unionArray[i] + rightUnionArray[i];
} }
break; break;
case EOpSub: case EOpSub:
tempConstArray = new ConstantUnion[objectSize]; tempConstArray = new ConstantUnion[objectSize];
{ {
for (int i = 0; i < objectSize; i++) for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] - rightUnionArray[i]; tempConstArray[i] = unionArray[i] - rightUnionArray[i];
} }
break; break;
...@@ -1249,7 +1249,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1249,7 +1249,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EOpMatrixTimesScalar: case EOpMatrixTimesScalar:
tempConstArray = new ConstantUnion[objectSize]; tempConstArray = new ConstantUnion[objectSize];
{ {
for (int i = 0; i < objectSize; i++) for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] * rightUnionArray[i]; tempConstArray[i] = unionArray[i] * rightUnionArray[i];
} }
break; break;
...@@ -1291,7 +1291,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1291,7 +1291,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EOpDiv: case EOpDiv:
{ {
tempConstArray = new ConstantUnion[objectSize]; tempConstArray = new ConstantUnion[objectSize];
for (int i = 0; i < objectSize; i++) for (size_t i = 0; i < objectSize; i++)
{ {
switch (getType().getBasicType()) switch (getType().getBasicType())
{ {
...@@ -1399,7 +1399,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1399,7 +1399,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
{ {
tempConstArray = new ConstantUnion[objectSize]; tempConstArray = new ConstantUnion[objectSize];
for (int i = 0; i < objectSize; i++) for (size_t i = 0; i < objectSize; i++)
{ {
tempConstArray[i] = unionArray[i] && rightUnionArray[i]; tempConstArray[i] = unionArray[i] && rightUnionArray[i];
} }
...@@ -1409,7 +1409,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1409,7 +1409,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EOpLogicalOr: // this code is written for possible future use, will not get executed currently case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
{ {
tempConstArray = new ConstantUnion[objectSize]; tempConstArray = new ConstantUnion[objectSize];
for (int i = 0; i < objectSize; i++) for (size_t i = 0; i < objectSize; i++)
{ {
tempConstArray[i] = unionArray[i] || rightUnionArray[i]; tempConstArray[i] = unionArray[i] || rightUnionArray[i];
} }
...@@ -1419,7 +1419,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1419,7 +1419,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EOpLogicalXor: case EOpLogicalXor:
{ {
tempConstArray = new ConstantUnion[objectSize]; tempConstArray = new ConstantUnion[objectSize];
for (int i = 0; i < objectSize; i++) for (size_t i = 0; i < objectSize; i++)
{ {
switch (getType().getBasicType()) switch (getType().getBasicType())
{ {
...@@ -1478,7 +1478,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1478,7 +1478,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
} }
else else
{ {
for (int i = 0; i < objectSize; i++) for (size_t i = 0; i < objectSize; i++)
{ {
if (unionArray[i] != rightUnionArray[i]) if (unionArray[i] != rightUnionArray[i])
{ {
...@@ -1511,7 +1511,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1511,7 +1511,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
} }
else else
{ {
for (int i = 0; i < objectSize; i++) for (size_t i = 0; i < objectSize; i++)
{ {
if (unionArray[i] == rightUnionArray[i]) if (unionArray[i] == rightUnionArray[i])
{ {
...@@ -1552,7 +1552,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1552,7 +1552,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
// //
TIntermConstantUnion *newNode = 0; TIntermConstantUnion *newNode = 0;
ConstantUnion* tempConstArray = new ConstantUnion[objectSize]; ConstantUnion* tempConstArray = new ConstantUnion[objectSize];
for (int i = 0; i < objectSize; i++) for (size_t i = 0; i < objectSize; i++)
{ {
switch(op) switch(op)
{ {
...@@ -1590,11 +1590,11 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1590,11 +1590,11 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node) TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node)
{ {
int size = node->getType().getObjectSize(); size_t size = node->getType().getObjectSize();
ConstantUnion *leftUnionArray = new ConstantUnion[size]; ConstantUnion *leftUnionArray = new ConstantUnion[size];
for (int i=0; i < size; i++) { for (size_t i=0; i < size; i++) {
switch (promoteTo) { switch (promoteTo) {
case EbtFloat: case EbtFloat:
......
...@@ -152,10 +152,10 @@ const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type, ...@@ -152,10 +152,10 @@ const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType& type,
} }
else else
{ {
int size = type.getObjectSize(); size_t size = type.getObjectSize();
bool writeType = size > 1; bool writeType = size > 1;
if (writeType) out << getTypeName(type) << "("; if (writeType) out << getTypeName(type) << "(";
for (int i = 0; i < size; ++i, ++pConstUnion) for (size_t i = 0; i < size; ++i, ++pConstUnion)
{ {
switch (pConstUnion->getType()) switch (pConstUnion->getType())
{ {
......
...@@ -3008,11 +3008,12 @@ TString OutputHLSL::initializer(const TType &type) ...@@ -3008,11 +3008,12 @@ TString OutputHLSL::initializer(const TType &type)
{ {
TString string; TString string;
for (int component = 0; component < type.getObjectSize(); component++) size_t size = type.getObjectSize();
for (size_t component = 0; component < size; component++)
{ {
string += "0"; string += "0";
if (component < type.getObjectSize() - 1) if (component + 1 < size)
{ {
string += ", "; string += ", ";
} }
...@@ -3244,13 +3245,14 @@ void OutputHLSL::addConstructor(const TType &type, const TString &name, const TI ...@@ -3244,13 +3245,14 @@ void OutputHLSL::addConstructor(const TType &type, const TString &name, const TI
} }
else else
{ {
int remainingComponents = ctorType.getObjectSize(); size_t remainingComponents = ctorType.getObjectSize();
int parameterIndex = 0; size_t parameterIndex = 0;
while (remainingComponents > 0) while (remainingComponents > 0)
{ {
const TType &parameter = ctorParameters[parameterIndex]; const TType &parameter = ctorParameters[parameterIndex];
bool moreParameters = parameterIndex < (int)ctorParameters.size() - 1; const size_t parameterSize = parameter.getObjectSize();
bool moreParameters = parameterIndex + 1 < ctorParameters.size();
constructor += "x" + str(parameterIndex); constructor += "x" + str(parameterIndex);
...@@ -3260,11 +3262,12 @@ void OutputHLSL::addConstructor(const TType &type, const TString &name, const TI ...@@ -3260,11 +3262,12 @@ void OutputHLSL::addConstructor(const TType &type, const TString &name, const TI
} }
else if (parameter.isVector()) else if (parameter.isVector())
{ {
if (remainingComponents == parameter.getObjectSize() || moreParameters) if (remainingComponents == parameterSize || moreParameters)
{ {
remainingComponents -= parameter.getObjectSize(); ASSERT(parameterSize <= remainingComponents);
remainingComponents -= parameterSize;
} }
else if (remainingComponents < parameter.getNominalSize()) else if (remainingComponents < static_cast<size_t>(parameter.getNominalSize()))
{ {
switch (remainingComponents) switch (remainingComponents)
{ {
...@@ -3281,9 +3284,10 @@ void OutputHLSL::addConstructor(const TType &type, const TString &name, const TI ...@@ -3281,9 +3284,10 @@ void OutputHLSL::addConstructor(const TType &type, const TString &name, const TI
} }
else if (parameter.isMatrix() || parameter.getStruct()) else if (parameter.isMatrix() || parameter.getStruct())
{ {
ASSERT(remainingComponents == parameter.getObjectSize() || moreParameters); ASSERT(remainingComponents == parameterSize || moreParameters);
ASSERT(parameterSize <= remainingComponents);
remainingComponents -= parameter.getObjectSize(); remainingComponents -= parameterSize;
} }
else UNREACHABLE(); else UNREACHABLE();
...@@ -3340,7 +3344,7 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con ...@@ -3340,7 +3344,7 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con
} }
else else
{ {
int size = type.getObjectSize(); size_t size = type.getObjectSize();
bool writeType = size > 1; bool writeType = size > 1;
if (writeType) if (writeType)
...@@ -3348,7 +3352,7 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con ...@@ -3348,7 +3352,7 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con
out << typeString(type) << "("; out << typeString(type) << "(";
} }
for (int i = 0; i < size; i++, constUnion++) for (size_t i = 0; i < size; i++, constUnion++)
{ {
switch (constUnion->getType()) switch (constUnion->getType())
{ {
......
...@@ -486,7 +486,7 @@ bool TParseContext::constructorErrorCheck(const TSourceLoc& line, TIntermNode* n ...@@ -486,7 +486,7 @@ bool TParseContext::constructorErrorCheck(const TSourceLoc& line, TIntermNode* n
// again, there is an extra argument, so 'overfull' will become true. // again, there is an extra argument, so 'overfull' will become true.
// //
int size = 0; size_t size = 0;
bool constType = true; bool constType = true;
bool full = false; bool full = false;
bool overFull = false; bool overFull = false;
...@@ -1124,13 +1124,7 @@ bool TParseContext::executeInitializer(const TSourceLoc& line, const TString& id ...@@ -1124,13 +1124,7 @@ bool TParseContext::executeInitializer(const TSourceLoc& line, const TString& id
return true; return true;
} }
if (initializer->getAsConstantUnion()) { if (initializer->getAsConstantUnion()) {
ConstantUnion* unionArray = variable->getConstPointer();
if (type.getObjectSize() == 1 && type.getBasicType() != EbtStruct) {
*unionArray = (initializer->getAsConstantUnion()->getUnionArrayPointer())[0];
} else {
variable->shareConstPointer(initializer->getAsConstantUnion()->getUnionArrayPointer()); variable->shareConstPointer(initializer->getAsConstantUnion()->getUnionArrayPointer());
}
} else if (initializer->getAsSymbolNode()) { } else if (initializer->getAsSymbolNode()) {
const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol(), 0); const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol(), 0);
const TVariable* tVar = static_cast<const TVariable*>(symbol); const TVariable* tVar = static_cast<const TVariable*>(symbol);
...@@ -1767,7 +1761,7 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy ...@@ -1767,7 +1761,7 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy
ConstantUnion* constArray = new ConstantUnion[fields.num]; ConstantUnion* constArray = new ConstantUnion[fields.num];
for (int i = 0; i < fields.num; i++) { for (int i = 0; i < fields.num; i++) {
if (fields.offsets[i] >= node->getType().getObjectSize()) { if (fields.offsets[i] >= node->getType().getNominalSize()) {
std::stringstream extraInfoStream; std::stringstream extraInfoStream;
extraInfoStream << "vector field selection out of range '" << fields.offsets[i] << "'"; extraInfoStream << "vector field selection out of range '" << fields.offsets[i] << "'";
std::string extraInfo = extraInfoStream.str(); std::string extraInfo = extraInfoStream.str();
...@@ -1840,9 +1834,8 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, co ...@@ -1840,9 +1834,8 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, co
index = 0; index = 0;
} }
int arrayElementSize = arrayElementType.getObjectSize();
if (tempConstantNode) { if (tempConstantNode) {
size_t arrayElementSize = arrayElementType.getObjectSize();
ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer(); ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line); typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
} else { } else {
...@@ -1864,12 +1857,9 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, co ...@@ -1864,12 +1857,9 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, co
TIntermTyped* TParseContext::addConstStruct(const TString &identifier, TIntermTyped *node, const TSourceLoc& line) TIntermTyped* TParseContext::addConstStruct(const TString &identifier, TIntermTyped *node, const TSourceLoc& line)
{ {
const TTypeList* fields = node->getType().getStruct(); const TTypeList* fields = node->getType().getStruct();
TIntermTyped *typedNode; size_t instanceSize = 0;
int instanceSize = 0;
unsigned int index = 0;
TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
for ( index = 0; index < fields->size(); ++index) { for (size_t index = 0; index < fields->size(); ++index) {
if ((*fields)[index].type->getFieldName() == identifier) { if ((*fields)[index].type->getFieldName() == identifier) {
break; break;
} else { } else {
...@@ -1877,6 +1867,8 @@ TIntermTyped* TParseContext::addConstStruct(const TString &identifier, TIntermTy ...@@ -1877,6 +1867,8 @@ TIntermTyped* TParseContext::addConstStruct(const TString &identifier, TIntermTy
} }
} }
TIntermTyped *typedNode;
TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
if (tempConstantNode) { if (tempConstantNode) {
ConstantUnion* constArray = tempConstantNode->getUnionArrayPointer(); ConstantUnion* constArray = tempConstantNode->getUnionArrayPointer();
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <stdio.h> #include <stdio.h>
#include <algorithm> #include <algorithm>
#include <climits>
int TSymbolTableLevel::uniqueId = 0; int TSymbolTableLevel::uniqueId = 0;
...@@ -106,16 +107,42 @@ void TType::buildMangledName(TString& mangledName) ...@@ -106,16 +107,42 @@ void TType::buildMangledName(TString& mangledName)
} }
} }
int TType::getStructSize() const size_t TType::getObjectSize() const
{
size_t totalSize;
if (getBasicType() == EbtStruct)
totalSize = getStructSize();
else
totalSize = primarySize * secondarySize;
if (isArray()) {
size_t arraySize = std::max(getArraySize(), getMaxArraySize());
if (arraySize > INT_MAX / totalSize)
totalSize = INT_MAX;
else
totalSize *= arraySize;
}
return totalSize;
}
size_t TType::getStructSize() const
{ {
if (!getStruct()) { if (!getStruct()) {
assert(false && "Not a struct"); assert(false && "Not a struct");
return 0; return 0;
} }
if (structureSize == 0) if (structureSize == 0) {
for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++) for (TTypeList::const_iterator tl = getStruct()->begin(); tl != getStruct()->end(); tl++) {
structureSize += ((*tl).type)->getObjectSize(); size_t fieldSize = ((*tl).type)->getObjectSize();
if (fieldSize > INT_MAX - structureSize)
structureSize = INT_MAX;
else
structureSize += fieldSize;
}
}
return structureSize; return structureSize;
} }
......
...@@ -70,20 +70,7 @@ public: ...@@ -70,20 +70,7 @@ public:
void setSecondarySize(int ss) { secondarySize = ss; } void setSecondarySize(int ss) { secondarySize = ss; }
// Full size of single instance of type // Full size of single instance of type
int getObjectSize() const size_t getObjectSize() const;
{
int totalSize;
if (getBasicType() == EbtStruct)
totalSize = getStructSize();
else
totalSize = primarySize * secondarySize;
if (isArray())
totalSize *= std::max(getArraySize(), getMaxArraySize());
return totalSize;
}
int elementRegisterCount() const int elementRegisterCount() const
{ {
...@@ -243,7 +230,7 @@ public: ...@@ -243,7 +230,7 @@ public:
private: private:
void buildMangledName(TString&); void buildMangledName(TString&);
int getStructSize() const; size_t getStructSize() const;
void computeDeepestStructNesting(); void computeDeepestStructNesting();
TBasicType type : 6; TBasicType type : 6;
...@@ -259,7 +246,7 @@ private: ...@@ -259,7 +246,7 @@ private:
TType* interfaceBlockType; TType* interfaceBlockType;
TTypeList* structure; // 0 unless this is a struct TTypeList* structure; // 0 unless this is a struct
mutable int structureSize; mutable size_t structureSize;
int deepestStructNesting; int deepestStructNesting;
TString *fieldName; // for structure field names TString *fieldName; // for structure field names
......
...@@ -327,9 +327,9 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node) ...@@ -327,9 +327,9 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node)
{ {
TInfoSinkBase& out = sink; TInfoSinkBase& out = sink;
int size = node->getType().getObjectSize(); size_t size = node->getType().getObjectSize();
for (int i = 0; i < size; i++) { for (size_t i = 0; i < size; i++) {
OutputTreeText(out, node, depth); OutputTreeText(out, node, depth);
switch (node->getUnionArrayPointer()[i].getType()) { switch (node->getUnionArrayPointer()[i].getType()) {
case EbtBool: case EbtBool:
......
...@@ -38,13 +38,13 @@ protected: ...@@ -38,13 +38,13 @@ protected:
bool visitLoop(Visit visit, TIntermLoop*); bool visitLoop(Visit visit, TIntermLoop*);
bool visitBranch(Visit visit, TIntermBranch*); bool visitBranch(Visit visit, TIntermBranch*);
int index; size_t index;
ConstantUnion *unionArray; ConstantUnion *unionArray;
TType type; TType type;
TOperator constructorType; TOperator constructorType;
bool singleConstantParam; bool singleConstantParam;
TInfoSink& infoSink; TInfoSink& infoSink;
int size; // size of the constructor ( 4 for vec4) size_t size; // size of the constructor ( 4 for vec4)
bool isDiagonalMatrixInit; bool isDiagonalMatrixInit;
int matrixCols; // columns of the matrix int matrixCols; // columns of the matrix
int matrixRows; // rows of the matrix int matrixRows; // rows of the matrix
...@@ -161,16 +161,16 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node) ...@@ -161,16 +161,16 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
} }
ConstantUnion* leftUnionArray = unionArray; ConstantUnion* leftUnionArray = unionArray;
int instanceSize = type.getObjectSize(); size_t instanceSize = type.getObjectSize();
if (index >= instanceSize) if (index >= instanceSize)
return; return;
if (!singleConstantParam) { if (!singleConstantParam) {
int objectSize = node->getType().getObjectSize(); size_t objectSize = node->getType().getObjectSize();
ConstantUnion *rightUnionArray = node->getUnionArrayPointer(); ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
for (int i=0; i < objectSize; i++) { for (size_t i=0; i < objectSize; i++) {
if (index >= instanceSize) if (index >= instanceSize)
return; return;
leftUnionArray[index] = rightUnionArray[i]; leftUnionArray[index] = rightUnionArray[i];
...@@ -178,11 +178,11 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node) ...@@ -178,11 +178,11 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
(index)++; (index)++;
} }
} else { } else {
int totalSize = index + size; size_t totalSize = index + size;
ConstantUnion *rightUnionArray = node->getUnionArrayPointer(); ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
if (!isDiagonalMatrixInit) { if (!isDiagonalMatrixInit) {
int count = 0; int count = 0;
for (int i = index; i < totalSize; i++) { for (size_t i = index; i < totalSize; i++) {
if (i >= instanceSize) if (i >= instanceSize)
return; return;
......
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