Commit 6ff56fd4 by alokp@chromium.org

Renamed constUnion class to ConstantUnion.

Review URL: http://codereview.appspot.com/1106042 git-svn-id: https://angleproject.googlecode.com/svn/trunk@227 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 428d1587
......@@ -8,7 +8,7 @@
#define _CONSTANT_UNION_INCLUDED_
class constUnion {
class ConstantUnion {
public:
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
......@@ -47,7 +47,7 @@ public:
return false;
}
bool operator==(const constUnion& constant) const
bool operator==(const ConstantUnion& constant) const
{
if (constant.type != type)
return false;
......@@ -88,12 +88,12 @@ public:
return !operator==(b);
}
bool operator!=(const constUnion& constant) const
bool operator!=(const ConstantUnion& constant) const
{
return !operator==(constant);
}
bool operator>(const constUnion& constant) const
bool operator>(const ConstantUnion& constant) const
{
assert(type == constant.type);
switch (type) {
......@@ -115,7 +115,7 @@ public:
return false;
}
bool operator<(const constUnion& constant) const
bool operator<(const ConstantUnion& constant) const
{
assert(type == constant.type);
switch (type) {
......@@ -137,9 +137,9 @@ public:
return false;
}
constUnion operator+(const constUnion& constant) const
ConstantUnion operator+(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
......@@ -150,9 +150,9 @@ public:
return returnValue;
}
constUnion operator-(const constUnion& constant) const
ConstantUnion operator-(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
......@@ -163,9 +163,9 @@ public:
return returnValue;
}
constUnion operator*(const constUnion& constant) const
ConstantUnion operator*(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
......@@ -176,9 +176,9 @@ public:
return returnValue;
}
constUnion operator%(const constUnion& constant) const
ConstantUnion operator%(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
......@@ -188,9 +188,9 @@ public:
return returnValue;
}
constUnion operator>>(const constUnion& constant) const
ConstantUnion operator>>(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
......@@ -200,9 +200,9 @@ public:
return returnValue;
}
constUnion operator<<(const constUnion& constant) const
ConstantUnion operator<<(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst << constant.iConst); break;
......@@ -212,9 +212,9 @@ public:
return returnValue;
}
constUnion operator&(const constUnion& constant) const
ConstantUnion operator&(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst & constant.iConst); break;
......@@ -224,9 +224,9 @@ public:
return returnValue;
}
constUnion operator|(const constUnion& constant) const
ConstantUnion operator|(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst | constant.iConst); break;
......@@ -236,9 +236,9 @@ public:
return returnValue;
}
constUnion operator^(const constUnion& constant) const
ConstantUnion operator^(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break;
......@@ -248,9 +248,9 @@ public:
return returnValue;
}
constUnion operator&&(const constUnion& constant) const
ConstantUnion operator&&(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtBool: returnValue.setBConst(bConst && constant.bConst); break;
......@@ -260,9 +260,9 @@ public:
return returnValue;
}
constUnion operator||(const constUnion& constant) const
ConstantUnion operator||(const ConstantUnion& constant) const
{
constUnion returnValue;
ConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtBool: returnValue.setBConst(bConst || constant.bConst); break;
......
......@@ -14,7 +14,7 @@
#include "compiler/QualifierAlive.h"
#include "compiler/RemoveTree.h"
bool CompareStructure(const TType& leftNodeType, constUnion* rightUnionArray, constUnion* leftUnionArray);
bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
////////////////////////////////////////////////////////////////////////////
//
......@@ -570,7 +570,7 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
// Returns the constant union node created.
//
TIntermConstantUnion* TIntermediate::addConstantUnion(constUnion* unionArrayPointer, const TType& t, TSourceLoc line)
TIntermConstantUnion* TIntermediate::addConstantUnion(ConstantUnion* unionArrayPointer, const TType& t, TSourceLoc line)
{
TIntermConstantUnion* node = new TIntermConstantUnion(unionArrayPointer, t);
node->setLine(line);
......@@ -586,10 +586,10 @@ TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, TSourceLoc line)
node->setLine(line);
TIntermConstantUnion* constIntNode;
TIntermSequence &sequenceVector = node->getSequence();
constUnion* unionArray;
ConstantUnion* unionArray;
for (int i = 0; i < fields.num; i++) {
unionArray = new constUnion[1];
unionArray = new ConstantUnion[1];
unionArray->setIConst(fields.offsets[i]);
constIntNode = addConstantUnion(unionArray, TType(EbtInt, EvqConst), line);
sequenceVector.push_back(constIntNode);
......@@ -973,7 +973,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
return true;
}
bool CompareStruct(const TType& leftNodeType, constUnion* rightUnionArray, constUnion* leftUnionArray)
bool CompareStruct(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray)
{
TTypeList* fields = leftNodeType.getStruct();
......@@ -997,7 +997,7 @@ bool CompareStruct(const TType& leftNodeType, constUnion* rightUnionArray, const
return true;
}
bool CompareStructure(const TType& leftNodeType, constUnion* rightUnionArray, constUnion* leftUnionArray)
bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray)
{
if (leftNodeType.isArray()) {
TType typeWithoutArrayness = leftNodeType;
......@@ -1025,43 +1025,43 @@ bool CompareStructure(const TType& leftNodeType, constUnion* rightUnionArray, co
TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode, TInfoSink& infoSink)
{
constUnion *unionArray = getUnionArrayPointer();
ConstantUnion *unionArray = getUnionArrayPointer();
int objectSize = getType().getObjectSize();
if (constantNode) { // binary operations
TIntermConstantUnion *node = constantNode->getAsConstantUnion();
constUnion *rightUnionArray = node->getUnionArrayPointer();
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
TType returnType = getType();
// for a case like float f = 1.2 + vec4(2,3,4,5);
if (constantNode->getType().getObjectSize() == 1 && objectSize > 1) {
rightUnionArray = new constUnion[objectSize];
rightUnionArray = new ConstantUnion[objectSize];
for (int i = 0; i < objectSize; ++i)
rightUnionArray[i] = *node->getUnionArrayPointer();
returnType = getType();
} else if (constantNode->getType().getObjectSize() > 1 && objectSize == 1) {
// for a case like float f = vec4(2,3,4,5) + 1.2;
unionArray = new constUnion[constantNode->getType().getObjectSize()];
unionArray = new ConstantUnion[constantNode->getType().getObjectSize()];
for (int i = 0; i < constantNode->getType().getObjectSize(); ++i)
unionArray[i] = *getUnionArrayPointer();
returnType = node->getType();
objectSize = constantNode->getType().getObjectSize();
}
constUnion* tempConstArray = 0;
ConstantUnion* tempConstArray = 0;
TIntermConstantUnion *tempNode;
bool boolNodeFlag = false;
switch(op) {
case EOpAdd:
tempConstArray = new constUnion[objectSize];
tempConstArray = new ConstantUnion[objectSize];
{// support MSVC++6.0
for (int i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] + rightUnionArray[i];
}
break;
case EOpSub:
tempConstArray = new constUnion[objectSize];
tempConstArray = new ConstantUnion[objectSize];
{// support MSVC++6.0
for (int i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] - rightUnionArray[i];
......@@ -1071,7 +1071,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EOpMul:
case EOpVectorTimesScalar:
case EOpMatrixTimesScalar:
tempConstArray = new constUnion[objectSize];
tempConstArray = new ConstantUnion[objectSize];
{// support MSVC++6.0
for (int i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] * rightUnionArray[i];
......@@ -1084,7 +1084,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
}
{// support MSVC++6.0
int size = getNominalSize();
tempConstArray = new constUnion[size*size];
tempConstArray = new ConstantUnion[size*size];
for (int row = 0; row < size; row++) {
for (int column = 0; column < size; column++) {
tempConstArray[size * column + row].setFConst(0.0f);
......@@ -1096,7 +1096,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
}
break;
case EOpDiv:
tempConstArray = new constUnion[objectSize];
tempConstArray = new ConstantUnion[objectSize];
{// support MSVC++6.0
for (int i = 0; i < objectSize; i++) {
switch (getType().getBasicType()) {
......@@ -1128,7 +1128,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix times vector", getLine());
return 0;
}
tempConstArray = new constUnion[getNominalSize()];
tempConstArray = new ConstantUnion[getNominalSize()];
{// support MSVC++6.0
for (int size = getNominalSize(), i = 0; i < size; i++) {
......@@ -1150,7 +1150,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
return 0;
}
tempConstArray = new constUnion[getNominalSize()];
tempConstArray = new ConstantUnion[getNominalSize()];
{// support MSVC++6.0
for (int size = getNominalSize(), i = 0; i < size; i++) {
tempConstArray[i].setFConst(0.0f);
......@@ -1162,7 +1162,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
break;
case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
tempConstArray = new constUnion[objectSize];
tempConstArray = new ConstantUnion[objectSize];
{// support MSVC++6.0
for (int i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] && rightUnionArray[i];
......@@ -1170,7 +1170,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
break;
case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
tempConstArray = new constUnion[objectSize];
tempConstArray = new ConstantUnion[objectSize];
{// support MSVC++6.0
for (int i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] || rightUnionArray[i];
......@@ -1178,7 +1178,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
break;
case EOpLogicalXor:
tempConstArray = new constUnion[objectSize];
tempConstArray = new ConstantUnion[objectSize];
{// support MSVC++6.0
for (int i = 0; i < objectSize; i++)
switch (getType().getBasicType()) {
......@@ -1190,22 +1190,22 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EOpLessThan:
assert(objectSize == 1);
tempConstArray = new constUnion[1];
tempConstArray = new ConstantUnion[1];
tempConstArray->setBConst(*unionArray < *rightUnionArray);
returnType = TType(EbtBool, EvqConst);
break;
case EOpGreaterThan:
assert(objectSize == 1);
tempConstArray = new constUnion[1];
tempConstArray = new ConstantUnion[1];
tempConstArray->setBConst(*unionArray > *rightUnionArray);
returnType = TType(EbtBool, EvqConst);
break;
case EOpLessThanEqual:
{
assert(objectSize == 1);
constUnion constant;
ConstantUnion constant;
constant.setBConst(*unionArray > *rightUnionArray);
tempConstArray = new constUnion[1];
tempConstArray = new ConstantUnion[1];
tempConstArray->setBConst(!constant.getBConst());
returnType = TType(EbtBool, EvqConst);
break;
......@@ -1213,9 +1213,9 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EOpGreaterThanEqual:
{
assert(objectSize == 1);
constUnion constant;
ConstantUnion constant;
constant.setBConst(*unionArray < *rightUnionArray);
tempConstArray = new constUnion[1];
tempConstArray = new ConstantUnion[1];
tempConstArray->setBConst(!constant.getBConst());
returnType = TType(EbtBool, EvqConst);
break;
......@@ -1234,7 +1234,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
}
}
tempConstArray = new constUnion[1];
tempConstArray = new ConstantUnion[1];
if (!boolNodeFlag) {
tempConstArray->setBConst(true);
}
......@@ -1260,7 +1260,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
}
}
tempConstArray = new constUnion[1];
tempConstArray = new ConstantUnion[1];
if (!boolNodeFlag) {
tempConstArray->setBConst(true);
}
......@@ -1286,7 +1286,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
// Do unary operations
//
TIntermConstantUnion *newNode = 0;
constUnion* tempConstArray = new constUnion[objectSize];
ConstantUnion* tempConstArray = new ConstantUnion[objectSize];
for (int i = 0; i < objectSize; i++) {
switch(op) {
case EOpNegative:
......@@ -1320,10 +1320,10 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node)
{
constUnion *rightUnionArray = node->getUnionArrayPointer();
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
int size = node->getType().getObjectSize();
constUnion *leftUnionArray = new constUnion[size];
ConstantUnion *leftUnionArray = new ConstantUnion[size];
for (int i=0; i < size; i++) {
......
......@@ -115,7 +115,7 @@ void TOutputGLSL::visitConstantUnion(TIntermConstantUnion* node)
out << getTypeName(type) << "(";
for (int i = 0; i < size; ++i)
{
const constUnion& data = node->getUnionArrayPointer()[i];
const ConstantUnion& data = node->getUnionArrayPointer()[i];
switch (data.getType())
{
case EbtFloat: out << data.getFConst(); break;
......@@ -178,7 +178,7 @@ bool TOutputGLSL::visitBinary(Visit visit, TIntermBinary* node)
TIntermConstantUnion* element = (*sit)->getAsConstantUnion();
ASSERT(element->getBasicType() == EbtInt);
ASSERT(element->getNominalSize() == 1);
const constUnion& data = element->getUnionArrayPointer()[0];
const ConstantUnion& data = element->getUnionArrayPointer()[0];
ASSERT(data.getType() == EbtInt);
switch (data.getIConst())
{
......
......@@ -951,7 +951,7 @@ bool TParseContext::executeInitializer(TSourceLoc line, TString& identifier, TPu
return true;
}
if (initializer->getAsConstantUnion()) {
constUnion* unionArray = variable->getConstPointer();
ConstantUnion* unionArray = variable->getConstPointer();
if (type.getObjectSize() == 1 && type.getBasicType() != EbtStruct) {
*unionArray = (initializer->getAsConstantUnion()->getUnionArrayPointer())[0];
......@@ -962,7 +962,7 @@ bool TParseContext::executeInitializer(TSourceLoc line, TString& identifier, TPu
const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol());
const TVariable* tVar = static_cast<const TVariable*>(symbol);
constUnion* constArray = tVar->getConstPointer();
ConstantUnion* constArray = tVar->getConstPointer();
variable->shareConstPointer(constArray);
} else {
error(line, " cannot assign to", "=", "'%s'", variable->getType().getCompleteString().c_str());
......@@ -1095,7 +1095,7 @@ TIntermTyped* TParseContext::foldConstConstructor(TIntermAggregate* aggrNode, co
aggrNode->setType(type);
if (canBeFolded) {
bool returnVal = false;
constUnion* unionArray = new constUnion[type.getObjectSize()];
ConstantUnion* unionArray = new ConstantUnion[type.getObjectSize()];
if (aggrNode->getSequence().size() == 1) {
returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), symbolTable, type, true);
}
......@@ -1208,12 +1208,12 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy
TIntermTyped* typedNode;
TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
constUnion *unionArray;
ConstantUnion *unionArray;
if (tempConstantNode) {
unionArray = tempConstantNode->getUnionArrayPointer();
if (!unionArray) { // this error message should never be raised
infoSink.info.message(EPrefixInternalError, "constUnion not initialized in addConstVectorNode function", line);
infoSink.info.message(EPrefixInternalError, "ConstantUnion not initialized in addConstVectorNode function", line);
recover();
return node;
......@@ -1225,7 +1225,7 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy
return 0;
}
constUnion* constArray = new constUnion[fields.num];
ConstantUnion* constArray = new ConstantUnion[fields.num];
for (int i = 0; i < fields.num; i++) {
if (fields.offsets[i] >= node->getType().getObjectSize()) {
......@@ -1259,7 +1259,7 @@ TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, T
}
if (tempConstantNode) {
constUnion* unionArray = tempConstantNode->getUnionArrayPointer();
ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
int size = tempConstantNode->getType().getNominalSize();
typedNode = intermediate.addConstantUnion(&unionArray[size*index], tempConstantNode->getType(), line);
} else {
......@@ -1295,7 +1295,7 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, TS
int arrayElementSize = arrayElementType.getObjectSize();
if (tempConstantNode) {
constUnion* unionArray = tempConstantNode->getUnionArrayPointer();
ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
} else {
error(line, "Cannot offset into the array", "Error", "");
......@@ -1330,7 +1330,7 @@ TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* n
}
if (tempConstantNode) {
constUnion* constArray = tempConstantNode->getUnionArrayPointer();
ConstantUnion* constArray = tempConstantNode->getUnionArrayPointer();
typedNode = intermediate.addConstantUnion(constArray+instanceSize, tempConstantNode->getType(), line); // type will be changed in the calling function
} else {
......
......@@ -156,7 +156,7 @@ TVariable::TVariable(const TVariable& copyOf, TStructureMap& remapper) : TSymbol
if (copyOf.unionArray) {
assert(!copyOf.type.getStruct());
assert(copyOf.type.getObjectSize() == 1);
unionArray = new constUnion[1];
unionArray = new ConstantUnion[1];
unionArray[0] = copyOf.unionArray[0];
} else
unionArray = 0;
......
......@@ -81,17 +81,17 @@ public:
virtual void dump(TInfoSink &infoSink) const;
constUnion* getConstPointer()
ConstantUnion* getConstPointer()
{
if (!unionArray)
unionArray = new constUnion[type.getObjectSize()];
unionArray = new ConstantUnion[type.getObjectSize()];
return unionArray;
}
constUnion* getConstPointer() const { return unionArray; }
ConstantUnion* getConstPointer() const { return unionArray; }
void shareConstPointer( constUnion *constArray)
void shareConstPointer( ConstantUnion *constArray)
{
delete unionArray;
unionArray = constArray;
......@@ -104,7 +104,7 @@ protected:
bool userType;
// we are assuming that Pool Allocator will free the memory allocated to unionArray
// when this object is destroyed
constUnion *unionArray;
ConstantUnion *unionArray;
TType *arrayInformationType; // this is used for updating maxArraySize in all the references to a given symbol
};
......
......@@ -314,14 +314,14 @@ protected:
class TIntermConstantUnion : public TIntermTyped {
public:
TIntermConstantUnion(constUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
constUnion* getUnionArrayPointer() const { return unionArrayPointer; }
void setUnionArrayPointer(constUnion *c) { unionArrayPointer = c; }
TIntermConstantUnion(ConstantUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
void setUnionArrayPointer(ConstantUnion *c) { unionArrayPointer = c; }
virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
virtual void traverse(TIntermTraverser* );
virtual TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&);
protected:
constUnion *unionArrayPointer;
ConstantUnion *unionArrayPointer;
};
//
......
......@@ -37,9 +37,9 @@ public:
TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, TSourceLoc);
TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc);
TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc);
TIntermConstantUnion* addConstantUnion(constUnion*, const TType&, TSourceLoc);
TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, TSourceLoc);
TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;
bool parseConstTree(TSourceLoc, TIntermNode*, constUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
bool parseConstTree(TSourceLoc, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
TIntermNode* addLoop(TIntermNode*, TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, TSourceLoc);
TIntermBranch* addBranch(TOperator, TSourceLoc);
TIntermBranch* addBranch(TOperator, TIntermTyped*, TSourceLoc);
......
......@@ -12,7 +12,7 @@
//
class TConstTraverser : public TIntermTraverser {
public:
TConstTraverser(constUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TSymbolTable& symTable, TType& t) : unionArray(cUnion), type(t),
TConstTraverser(ConstantUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TSymbolTable& symTable, TType& t) : unionArray(cUnion), type(t),
constructorType(constructType), singleConstantParam(singleConstParam), infoSink(sink), symbolTable(symTable), error(false), isMatrix(false), matrixSize(0)
{
index = 0;
......@@ -31,7 +31,7 @@ protected:
bool visitBranch(Visit visit, TIntermBranch*);
int index;
constUnion *unionArray;
ConstantUnion *unionArray;
TType type;
TOperator constructorType;
bool singleConstantParam;
......@@ -140,7 +140,7 @@ bool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node)
void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
{
constUnion* leftUnionArray = unionArray;
ConstantUnion* leftUnionArray = unionArray;
int instanceSize = type.getObjectSize();
if (index >= instanceSize)
......@@ -149,7 +149,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
if (!singleConstantParam) {
int size = node->getType().getObjectSize();
constUnion *rightUnionArray = node->getUnionArrayPointer();
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
for (int i=0; i < size; i++) {
if (index >= instanceSize)
return;
......@@ -159,7 +159,7 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
}
} else {
int totalSize = index + size;
constUnion *rightUnionArray = node->getUnionArrayPointer();
ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
if (!isMatrix) {
int count = 0;
for (int i = index; i < totalSize; i++) {
......@@ -212,7 +212,7 @@ bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node)
// Individual functions can be initialized to 0 to skip processing of that
// type of node. It's children will still be processed.
//
bool TIntermediate::parseConstTree(TSourceLoc line, TIntermNode* root, constUnion* unionArray, TOperator constructorType, TSymbolTable& symbolTable, TType t, bool singleConstantParam)
bool TIntermediate::parseConstTree(TSourceLoc line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TSymbolTable& symbolTable, TType t, bool singleConstantParam)
{
if (root == 0)
return false;
......
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