Rename ConstantUnion to TConstantUnion.
This clarified that we're using the Pool allocator/deallocator for
this type.
BUG=angleproject:993
Change-Id: If8c95f6054d07291e7014be0d4e35766ba2e943b
Reviewed-on: https://chromium-review.googlesource.com/269131
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/compiler/translator/ConstantUnion.h b/src/compiler/translator/ConstantUnion.h
index 31ff2cc..a86d27f 100644
--- a/src/compiler/translator/ConstantUnion.h
+++ b/src/compiler/translator/ConstantUnion.h
@@ -9,16 +9,18 @@
#include <assert.h>
-class ConstantUnion {
+#include "compiler/translator/BaseTypes.h"
+
+class TConstantUnion {
public:
POOL_ALLOCATOR_NEW_DELETE();
- ConstantUnion()
+ TConstantUnion()
{
iConst = 0;
type = EbtVoid;
}
- bool cast(TBasicType newType, const ConstantUnion &constant)
+ bool cast(TBasicType newType, const TConstantUnion &constant)
{
switch (newType)
{
@@ -109,7 +111,7 @@
return b == bConst;
}
- bool operator==(const ConstantUnion& constant) const
+ bool operator==(const TConstantUnion& constant) const
{
if (constant.type != type)
return false;
@@ -148,12 +150,12 @@
return !operator==(b);
}
- bool operator!=(const ConstantUnion& constant) const
+ bool operator!=(const TConstantUnion& constant) const
{
return !operator==(constant);
}
- bool operator>(const ConstantUnion& constant) const
+ bool operator>(const TConstantUnion& constant) const
{
assert(type == constant.type);
switch (type) {
@@ -168,7 +170,7 @@
}
}
- bool operator<(const ConstantUnion& constant) const
+ bool operator<(const TConstantUnion& constant) const
{
assert(type == constant.type);
switch (type) {
@@ -183,9 +185,9 @@
}
}
- ConstantUnion operator+(const ConstantUnion& constant) const
+ TConstantUnion operator+(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
@@ -197,9 +199,9 @@
return returnValue;
}
- ConstantUnion operator-(const ConstantUnion& constant) const
+ TConstantUnion operator-(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
@@ -211,9 +213,9 @@
return returnValue;
}
- ConstantUnion operator*(const ConstantUnion& constant) const
+ TConstantUnion operator*(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
@@ -225,9 +227,9 @@
return returnValue;
}
- ConstantUnion operator%(const ConstantUnion& constant) const
+ TConstantUnion operator%(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
@@ -238,9 +240,9 @@
return returnValue;
}
- ConstantUnion operator>>(const ConstantUnion& constant) const
+ TConstantUnion operator>>(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
@@ -251,9 +253,9 @@
return returnValue;
}
- ConstantUnion operator<<(const ConstantUnion& constant) const
+ TConstantUnion operator<<(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
// The signedness of the second parameter might be different, but we
// don't care, since the result is undefined if the second parameter is
// negative, and aliasing should not be a problem with unions.
@@ -267,9 +269,9 @@
return returnValue;
}
- ConstantUnion operator&(const ConstantUnion& constant) const
+ TConstantUnion operator&(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
assert(constant.type == EbtInt || constant.type == EbtUInt);
switch (type) {
case EbtInt: returnValue.setIConst(iConst & constant.iConst); break;
@@ -280,9 +282,9 @@
return returnValue;
}
- ConstantUnion operator|(const ConstantUnion& constant) const
+ TConstantUnion operator|(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst | constant.iConst); break;
@@ -293,9 +295,9 @@
return returnValue;
}
- ConstantUnion operator^(const ConstantUnion& constant) const
+ TConstantUnion operator^(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break;
@@ -306,9 +308,9 @@
return returnValue;
}
- ConstantUnion operator&&(const ConstantUnion& constant) const
+ TConstantUnion operator&&(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtBool: returnValue.setBConst(bConst && constant.bConst); break;
@@ -318,9 +320,9 @@
return returnValue;
}
- ConstantUnion operator||(const ConstantUnion& constant) const
+ TConstantUnion operator||(const TConstantUnion& constant) const
{
- ConstantUnion returnValue;
+ TConstantUnion returnValue;
assert(type == constant.type);
switch (type) {
case EbtBool: returnValue.setBConst(bConst || constant.bConst); break;
diff --git a/src/compiler/translator/InitializeVariables.cpp b/src/compiler/translator/InitializeVariables.cpp
index 68e2b53..86d3e6b 100644
--- a/src/compiler/translator/InitializeVariables.cpp
+++ b/src/compiler/translator/InitializeVariables.cpp
@@ -17,7 +17,7 @@
unsigned char size = static_cast<unsigned char>(myType.getNominalSize());
if (myType.isMatrix())
size *= size;
- ConstantUnion *u = new ConstantUnion[size];
+ TConstantUnion *u = new TConstantUnion[size];
for (int ii = 0; ii < size; ++ii)
u[ii].setFConst(0.0f);
@@ -29,7 +29,7 @@
TIntermConstantUnion *constructIndexNode(int index)
{
- ConstantUnion *u = new ConstantUnion[1];
+ TConstantUnion *u = new TConstantUnion[1];
u[0].setIConst(index);
TType type(EbtInt, EbpUndefined, EvqConst, 1);
diff --git a/src/compiler/translator/IntermNode.cpp b/src/compiler/translator/IntermNode.cpp
index 5aa8478..7580fb9 100644
--- a/src/compiler/translator/IntermNode.cpp
+++ b/src/compiler/translator/IntermNode.cpp
@@ -64,12 +64,12 @@
}
bool CompareStructure(const TType& leftNodeType,
- ConstantUnion *rightUnionArray,
- ConstantUnion *leftUnionArray);
+ TConstantUnion *rightUnionArray,
+ TConstantUnion *leftUnionArray);
bool CompareStruct(const TType &leftNodeType,
- ConstantUnion *rightUnionArray,
- ConstantUnion *leftUnionArray)
+ TConstantUnion *rightUnionArray,
+ TConstantUnion *leftUnionArray)
{
const TFieldList &fields = leftNodeType.getStruct()->fields();
@@ -102,8 +102,8 @@
}
bool CompareStructure(const TType &leftNodeType,
- ConstantUnion *rightUnionArray,
- ConstantUnion *leftUnionArray)
+ TConstantUnion *rightUnionArray,
+ TConstantUnion *leftUnionArray)
{
if (leftNodeType.isArray())
{
@@ -668,7 +668,7 @@
TIntermTyped *TIntermConstantUnion::fold(
TOperator op, TIntermConstantUnion *rightNode, TInfoSink &infoSink)
{
- ConstantUnion *unionArray = getUnionArrayPointer();
+ TConstantUnion *unionArray = getUnionArrayPointer();
if (!unionArray)
return nullptr;
@@ -678,7 +678,7 @@
if (rightNode)
{
// binary operations
- ConstantUnion *rightUnionArray = rightNode->getUnionArrayPointer();
+ TConstantUnion *rightUnionArray = rightNode->getUnionArrayPointer();
TType returnType = getType();
if (!rightUnionArray)
@@ -687,7 +687,7 @@
// for a case like float f = vec4(2, 3, 4, 5) + 1.2;
if (rightNode->getType().getObjectSize() == 1 && objectSize > 1)
{
- rightUnionArray = new ConstantUnion[objectSize];
+ rightUnionArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; ++i)
{
rightUnionArray[i] = *rightNode->getUnionArrayPointer();
@@ -697,7 +697,7 @@
else if (rightNode->getType().getObjectSize() > 1 && objectSize == 1)
{
// for a case like float f = 1.2 + vec4(2, 3, 4, 5);
- unionArray = new ConstantUnion[rightNode->getType().getObjectSize()];
+ unionArray = new TConstantUnion[rightNode->getType().getObjectSize()];
for (size_t i = 0; i < rightNode->getType().getObjectSize(); ++i)
{
unionArray[i] = *getUnionArrayPointer();
@@ -706,19 +706,19 @@
objectSize = rightNode->getType().getObjectSize();
}
- ConstantUnion *tempConstArray = nullptr;
+ TConstantUnion *tempConstArray = nullptr;
TIntermConstantUnion *tempNode;
bool boolNodeFlag = false;
switch(op)
{
case EOpAdd:
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] + rightUnionArray[i];
break;
case EOpSub:
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] - rightUnionArray[i];
break;
@@ -726,7 +726,7 @@
case EOpMul:
case EOpVectorTimesScalar:
case EOpMatrixTimesScalar:
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] * rightUnionArray[i];
break;
@@ -749,7 +749,7 @@
const int resultCols = rightCols;
const int resultRows = leftRows;
- tempConstArray = new ConstantUnion[resultCols * resultRows];
+ tempConstArray = new TConstantUnion[resultCols * resultRows];
for (int row = 0; row < resultRows; row++)
{
for (int column = 0; column < resultCols; column++)
@@ -774,7 +774,7 @@
case EOpDiv:
case EOpIMod:
{
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
{
switch (getType().getBasicType())
@@ -872,7 +872,7 @@
const int matrixCols = getCols();
const int matrixRows = getRows();
- tempConstArray = new ConstantUnion[matrixRows];
+ tempConstArray = new TConstantUnion[matrixRows];
for (int matrixRow = 0; matrixRow < matrixRows; matrixRow++)
{
@@ -908,7 +908,7 @@
const int matrixCols = rightNode->getType().getCols();
const int matrixRows = rightNode->getType().getRows();
- tempConstArray = new ConstantUnion[matrixCols];
+ tempConstArray = new TConstantUnion[matrixCols];
for (int matrixCol = 0; matrixCol < matrixCols; matrixCol++)
{
@@ -930,7 +930,7 @@
// this code is written for possible future use,
// will not get executed currently
{
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
{
tempConstArray[i] = unionArray[i] && rightUnionArray[i];
@@ -942,7 +942,7 @@
// this code is written for possible future use,
// will not get executed currently
{
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
{
tempConstArray[i] = unionArray[i] || rightUnionArray[i];
@@ -952,7 +952,7 @@
case EOpLogicalXor:
{
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
{
switch (getType().getBasicType())
@@ -970,41 +970,41 @@
break;
case EOpBitwiseAnd:
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] & rightUnionArray[i];
break;
case EOpBitwiseXor:
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] ^ rightUnionArray[i];
break;
case EOpBitwiseOr:
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] | rightUnionArray[i];
break;
case EOpBitShiftLeft:
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] << rightUnionArray[i];
break;
case EOpBitShiftRight:
- tempConstArray = new ConstantUnion[objectSize];
+ tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
tempConstArray[i] = unionArray[i] >> rightUnionArray[i];
break;
case EOpLessThan:
ASSERT(objectSize == 1);
- tempConstArray = new ConstantUnion[1];
+ tempConstArray = new TConstantUnion[1];
tempConstArray->setBConst(*unionArray < *rightUnionArray);
returnType = TType(EbtBool, EbpUndefined, EvqConst);
break;
case EOpGreaterThan:
ASSERT(objectSize == 1);
- tempConstArray = new ConstantUnion[1];
+ tempConstArray = new TConstantUnion[1];
tempConstArray->setBConst(*unionArray > *rightUnionArray);
returnType = TType(EbtBool, EbpUndefined, EvqConst);
break;
@@ -1012,9 +1012,9 @@
case EOpLessThanEqual:
{
ASSERT(objectSize == 1);
- ConstantUnion constant;
+ TConstantUnion constant;
constant.setBConst(*unionArray > *rightUnionArray);
- tempConstArray = new ConstantUnion[1];
+ tempConstArray = new TConstantUnion[1];
tempConstArray->setBConst(!constant.getBConst());
returnType = TType(EbtBool, EbpUndefined, EvqConst);
break;
@@ -1023,9 +1023,9 @@
case EOpGreaterThanEqual:
{
ASSERT(objectSize == 1);
- ConstantUnion constant;
+ TConstantUnion constant;
constant.setBConst(*unionArray < *rightUnionArray);
- tempConstArray = new ConstantUnion[1];
+ tempConstArray = new TConstantUnion[1];
tempConstArray->setBConst(!constant.getBConst());
returnType = TType(EbtBool, EbpUndefined, EvqConst);
break;
@@ -1053,7 +1053,7 @@
}
}
- tempConstArray = new ConstantUnion[1];
+ tempConstArray = new TConstantUnion[1];
if (!boolNodeFlag)
{
tempConstArray->setBConst(true);
@@ -1091,7 +1091,7 @@
}
}
- tempConstArray = new ConstantUnion[1];
+ tempConstArray = new TConstantUnion[1];
if (!boolNodeFlag)
{
tempConstArray->setBConst(true);
@@ -1124,7 +1124,7 @@
// Do unary operations
//
TIntermConstantUnion *newNode = 0;
- ConstantUnion* tempConstArray = new ConstantUnion[objectSize];
+ TConstantUnion* tempConstArray = new TConstantUnion[objectSize];
for (size_t i = 0; i < objectSize; i++)
{
switch(op)
@@ -1457,8 +1457,8 @@
}
}
-bool TIntermConstantUnion::foldFloatTypeUnary(const ConstantUnion ¶meter, FloatTypeUnaryFunc builtinFunc,
- TInfoSink &infoSink, ConstantUnion *result) const
+bool TIntermConstantUnion::foldFloatTypeUnary(const TConstantUnion ¶meter, FloatTypeUnaryFunc builtinFunc,
+ TInfoSink &infoSink, TConstantUnion *result) const
{
ASSERT(builtinFunc);
diff --git a/src/compiler/translator/IntermNode.h b/src/compiler/translator/IntermNode.h
index 8fd8f45..06a0a7f 100644
--- a/src/compiler/translator/IntermNode.h
+++ b/src/compiler/translator/IntermNode.h
@@ -23,9 +23,9 @@
#include "common/angleutils.h"
#include "compiler/translator/Common.h"
-#include "compiler/translator/Types.h"
#include "compiler/translator/ConstantUnion.h"
#include "compiler/translator/Operator.h"
+#include "compiler/translator/Types.h"
class TIntermTraverser;
class TIntermAggregate;
@@ -264,13 +264,13 @@
class TIntermConstantUnion : public TIntermTyped
{
public:
- TIntermConstantUnion(ConstantUnion *unionPointer, const TType &type)
+ TIntermConstantUnion(TConstantUnion *unionPointer, const TType &type)
: TIntermTyped(type),
mUnionArrayPointer(unionPointer) { }
virtual bool hasSideEffects() const { return false; }
- ConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; }
+ TConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; }
int getIConst(size_t index) const
{
@@ -296,11 +296,11 @@
TIntermTyped *fold(TOperator op, TIntermConstantUnion *rightNode, TInfoSink &infoSink);
protected:
- ConstantUnion *mUnionArrayPointer;
+ TConstantUnion *mUnionArrayPointer;
private:
typedef float(*FloatTypeUnaryFunc) (float);
- bool foldFloatTypeUnary(const ConstantUnion ¶meter, FloatTypeUnaryFunc builtinFunc, TInfoSink &infoSink, ConstantUnion *result) const;
+ bool foldFloatTypeUnary(const TConstantUnion ¶meter, FloatTypeUnaryFunc builtinFunc, TInfoSink &infoSink, TConstantUnion *result) const;
};
//
diff --git a/src/compiler/translator/Intermediate.cpp b/src/compiler/translator/Intermediate.cpp
index ebe6c39..81f8aa0 100644
--- a/src/compiler/translator/Intermediate.cpp
+++ b/src/compiler/translator/Intermediate.cpp
@@ -361,7 +361,7 @@
//
TIntermConstantUnion *TIntermediate::addConstantUnion(
- ConstantUnion *unionArrayPointer, const TType &t, const TSourceLoc &line)
+ TConstantUnion *unionArrayPointer, const TType &t, const TSourceLoc &line)
{
TIntermConstantUnion *node = new TIntermConstantUnion(unionArrayPointer, t);
node->setLine(line);
@@ -378,11 +378,11 @@
node->setLine(line);
TIntermConstantUnion *constIntNode;
TIntermSequence *sequenceVector = node->getSequence();
- ConstantUnion *unionArray;
+ TConstantUnion *unionArray;
for (int i = 0; i < fields.num; i++)
{
- unionArray = new ConstantUnion[1];
+ unionArray = new TConstantUnion[1];
unionArray->setIConst(fields.offsets[i]);
constIntNode = addConstantUnion(
unionArray, TType(EbtInt, EbpUndefined, EvqConst), line);
diff --git a/src/compiler/translator/Intermediate.h b/src/compiler/translator/Intermediate.h
index 3efb3bd..74a3f89 100644
--- a/src/compiler/translator/Intermediate.h
+++ b/src/compiler/translator/Intermediate.h
@@ -49,9 +49,9 @@
TIntermTyped *condition, const TSourceLoc &line);
TIntermTyped *addComma(
TIntermTyped *left, TIntermTyped *right, const TSourceLoc &);
- TIntermConstantUnion *addConstantUnion(ConstantUnion *, const TType &, const TSourceLoc &);
+ TIntermConstantUnion *addConstantUnion(TConstantUnion *, const TType &, const TSourceLoc &);
// TODO(zmo): Get rid of default value.
- bool parseConstTree(const TSourceLoc &, TIntermNode *, ConstantUnion *,
+ bool parseConstTree(const TSourceLoc &, TIntermNode *, TConstantUnion *,
TOperator, TType, bool singleConstantParam = false);
TIntermNode *addLoop(TLoopType, TIntermNode *, TIntermTyped *, TIntermTyped *,
TIntermNode *, const TSourceLoc &);
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index 13c6579..5bf6bb2 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -168,8 +168,8 @@
}
}
-const ConstantUnion *TOutputGLSLBase::writeConstantUnion(
- const TType &type, const ConstantUnion *pConstUnion)
+const TConstantUnion *TOutputGLSLBase::writeConstantUnion(
+ const TType &type, const TConstantUnion *pConstUnion)
{
TInfoSinkBase &out = objSink();
@@ -386,7 +386,7 @@
TIntermConstantUnion *element = (*sit)->getAsConstantUnion();
ASSERT(element->getBasicType() == EbtInt);
ASSERT(element->getNominalSize() == 1);
- const ConstantUnion& data = element->getUnionArrayPointer()[0];
+ const TConstantUnion& data = element->getUnionArrayPointer()[0];
ASSERT(data.getType() == EbtInt);
switch (data.getIConst())
{
diff --git a/src/compiler/translator/OutputGLSLBase.h b/src/compiler/translator/OutputGLSLBase.h
index 92c657b..1f3558e 100644
--- a/src/compiler/translator/OutputGLSLBase.h
+++ b/src/compiler/translator/OutputGLSLBase.h
@@ -35,7 +35,7 @@
void writeVariableType(const TType &type);
virtual bool writeVariablePrecision(TPrecision precision) = 0;
void writeFunctionParameters(const TIntermSequence &args);
- const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *pConstUnion);
+ const TConstantUnion *writeConstantUnion(const TType &type, const TConstantUnion *pConstUnion);
void writeConstructorTriplet(Visit visit, const TType &type, const char *constructorBaseType);
TString getTypeName(const TType &type);
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index dba62d3..cb7931a 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -2895,7 +2895,7 @@
}
}
-const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const ConstantUnion *constUnion)
+const TConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const TConstantUnion *constUnion)
{
TInfoSinkBase &out = getInfoSink();
diff --git a/src/compiler/translator/OutputHLSL.h b/src/compiler/translator/OutputHLSL.h
index 77186b0..59f305c 100644
--- a/src/compiler/translator/OutputHLSL.h
+++ b/src/compiler/translator/OutputHLSL.h
@@ -76,7 +76,7 @@
// Emit constructor. Called with literal names so using const char* instead of TString.
void outputConstructor(Visit visit, const TType &type, const char *name, const TIntermSequence *parameters);
- const ConstantUnion *writeConstantUnion(const TType &type, const ConstantUnion *constUnion);
+ const TConstantUnion *writeConstantUnion(const TType &type, const TConstantUnion *constUnion);
void outputEqual(Visit visit, const TType &type, TOperator op, TInfoSinkBase &out);
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 7e5dcb3..eb9328c 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -1133,7 +1133,7 @@
const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol(), 0);
const TVariable* tVar = static_cast<const TVariable*>(symbol);
- ConstantUnion* constArray = tVar->getConstPointer();
+ TConstantUnion* constArray = tVar->getConstPointer();
variable->shareConstPointer(constArray);
} else {
std::stringstream extraInfoStream;
@@ -1786,7 +1786,7 @@
aggrNode->setType(type);
if (canBeFolded) {
bool returnVal = false;
- ConstantUnion* unionArray = new ConstantUnion[type.getObjectSize()];
+ TConstantUnion* unionArray = new TConstantUnion[type.getObjectSize()];
if (aggrNode->getSequence()->size() == 1) {
returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), type, true);
}
@@ -1814,7 +1814,7 @@
TIntermTyped* typedNode;
TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
- ConstantUnion *unionArray;
+ TConstantUnion *unionArray;
if (tempConstantNode) {
unionArray = tempConstantNode->getUnionArrayPointer();
@@ -1828,7 +1828,7 @@
return 0;
}
- ConstantUnion* constArray = new ConstantUnion[fields.num];
+ TConstantUnion* constArray = new TConstantUnion[fields.num];
for (int i = 0; i < fields.num; i++) {
if (fields.offsets[i] >= node->getType().getNominalSize()) {
@@ -1868,7 +1868,7 @@
}
if (tempConstantNode) {
- ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
+ TConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
int size = tempConstantNode->getType().getCols();
typedNode = intermediate.addConstantUnion(&unionArray[size*index], tempConstantNode->getType(), line);
} else {
@@ -1906,7 +1906,7 @@
if (tempConstantNode) {
size_t arrayElementSize = arrayElementType.getObjectSize();
- ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
+ TConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
} else {
error(line, "Cannot offset into the array", "Error");
@@ -1940,7 +1940,7 @@
TIntermTyped *typedNode;
TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
if (tempConstantNode) {
- ConstantUnion* constArray = tempConstantNode->getUnionArrayPointer();
+ TConstantUnion* constArray = tempConstantNode->getUnionArrayPointer();
typedNode = intermediate.addConstantUnion(constArray+instanceSize, tempConstantNode->getType(), line); // type will be changed in the calling function
} else {
@@ -2252,7 +2252,7 @@
if (indexedExpression == 0)
{
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setFConst(0.0f);
indexedExpression = intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), location);
}
@@ -2356,7 +2356,7 @@
{
error(dotLocation, " non-scalar fields not implemented yet", ".");
recover();
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst(0);
TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
@@ -2365,7 +2365,7 @@
}
else
{
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst(fields.col * baseExpression->getRows() + fields.row);
TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
@@ -2413,7 +2413,7 @@
}
else
{
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst(i);
TIntermTyped* index = intermediate.addConstantUnion(unionArray, *fields[i]->type(), fieldLocation);
indexedExpression = intermediate.addIndex(EOpIndexDirectStruct, baseExpression, index, dotLocation);
@@ -2451,7 +2451,7 @@
}
if (fieldFound)
{
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst(i);
TIntermTyped* index = intermediate.addConstantUnion(unionArray, *fields[i]->type(), fieldLocation);
indexedExpression = intermediate.addIndex(EOpIndexDirectInterfaceBlock, baseExpression, index, dotLocation);
@@ -3054,7 +3054,7 @@
{
binaryOpError(loc, GetOperatorString(op), left->getCompleteString(), right->getCompleteString());
recover();
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setBConst(false);
return intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), loc);
}
@@ -3142,7 +3142,7 @@
if (thisNode != nullptr)
{
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
int arraySize = 0;
TIntermTyped *typedThis = thisNode->getAsTyped();
if (fnCall->getName() != "length")
@@ -3282,7 +3282,7 @@
{
// error message was put out by findFunction()
// Put on a dummy node for error recovery
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setFConst(0.0f);
callNode = intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), loc);
recover();
diff --git a/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp b/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp
index c1fdf50..ff35e41 100644
--- a/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp
+++ b/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp
@@ -39,7 +39,7 @@
TIntermConstantUnion *ConstructIndexNode(int index)
{
- ConstantUnion *u = new ConstantUnion[1];
+ TConstantUnion *u = new TConstantUnion[1];
u[0].setIConst(index);
TType type(EbtInt, EbpUndefined, EvqConst, 1);
diff --git a/src/compiler/translator/SymbolTable.h b/src/compiler/translator/SymbolTable.h
index dfc65cb..8ccb443 100644
--- a/src/compiler/translator/SymbolTable.h
+++ b/src/compiler/translator/SymbolTable.h
@@ -133,20 +133,20 @@
type.setQualifier(qualifier);
}
- ConstantUnion *getConstPointer()
+ TConstantUnion *getConstPointer()
{
if (!unionArray)
- unionArray = new ConstantUnion[type.getObjectSize()];
+ unionArray = new TConstantUnion[type.getObjectSize()];
return unionArray;
}
- ConstantUnion *getConstPointer() const
+ TConstantUnion *getConstPointer() const
{
return unionArray;
}
- void shareConstPointer(ConstantUnion *constArray)
+ void shareConstPointer(TConstantUnion *constArray)
{
if (unionArray == constArray)
return;
@@ -160,7 +160,7 @@
bool userType;
// we are assuming that Pool Allocator will free the memory
// allocated to unionArray when this object is destroyed.
- ConstantUnion *unionArray;
+ TConstantUnion *unionArray;
};
// The function sub-class of symbols and the parser will need to
diff --git a/src/compiler/translator/UnfoldShortCircuitAST.cpp b/src/compiler/translator/UnfoldShortCircuitAST.cpp
index d548d42..e50bf20 100644
--- a/src/compiler/translator/UnfoldShortCircuitAST.cpp
+++ b/src/compiler/translator/UnfoldShortCircuitAST.cpp
@@ -13,7 +13,7 @@
TIntermSelection *UnfoldOR(TIntermTyped *x, TIntermTyped *y)
{
const TType boolType(EbtBool, EbpUndefined);
- ConstantUnion *u = new ConstantUnion;
+ TConstantUnion *u = new TConstantUnion;
u->setBConst(true);
TIntermConstantUnion *trueNode = new TIntermConstantUnion(
u, TType(EbtBool, EbpUndefined, EvqConst, 1));
@@ -24,7 +24,7 @@
TIntermSelection *UnfoldAND(TIntermTyped *x, TIntermTyped *y)
{
const TType boolType(EbtBool, EbpUndefined);
- ConstantUnion *u = new ConstantUnion;
+ TConstantUnion *u = new TConstantUnion;
u->setBConst(false);
TIntermConstantUnion *falseNode = new TIntermConstantUnion(
u, TType(EbtBool, EbpUndefined, EvqConst, 1));
diff --git a/src/compiler/translator/glslang.y b/src/compiler/translator/glslang.y
index 871ff2a..a9cc4bc 100644
--- a/src/compiler/translator/glslang.y
+++ b/src/compiler/translator/glslang.y
@@ -218,7 +218,7 @@
if (variable->getType().getQualifier() == EvqConst)
{
- ConstantUnion* constArray = variable->getConstPointer();
+ TConstantUnion* constArray = variable->getConstPointer();
TType t(variable->getType());
$$ = context->intermediate.addConstantUnion(constArray, t, @1);
}
@@ -240,22 +240,22 @@
$$ = $1;
}
| INTCONSTANT {
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst($1.i);
$$ = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), @1);
}
| UINTCONSTANT {
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setUConst($1.u);
$$ = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), @1);
}
| FLOATCONSTANT {
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setFConst($1.f);
$$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), @1);
}
| BOOLCONSTANT {
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setBConst($1.b);
$$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @1);
}
diff --git a/src/compiler/translator/glslang_tab.cpp b/src/compiler/translator/glslang_tab.cpp
index 6c2e12a..03cef93 100644
--- a/src/compiler/translator/glslang_tab.cpp
+++ b/src/compiler/translator/glslang_tab.cpp
@@ -2361,7 +2361,7 @@
if (variable->getType().getQualifier() == EvqConst)
{
- ConstantUnion* constArray = variable->getConstPointer();
+ TConstantUnion* constArray = variable->getConstPointer();
TType t(variable->getType());
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yylsp[0]));
}
@@ -2390,7 +2390,7 @@
case 6:
{
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setIConst((yyvsp[0].lex).i);
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[0]));
}
@@ -2400,7 +2400,7 @@
case 7:
{
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setUConst((yyvsp[0].lex).u);
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), (yylsp[0]));
}
@@ -2410,7 +2410,7 @@
case 8:
{
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setFConst((yyvsp[0].lex).f);
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[0]));
}
@@ -2420,7 +2420,7 @@
case 9:
{
- ConstantUnion *unionArray = new ConstantUnion[1];
+ TConstantUnion *unionArray = new TConstantUnion[1];
unionArray->setBConst((yyvsp[0].lex).b);
(yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[0]));
}
diff --git a/src/compiler/translator/intermOut.cpp b/src/compiler/translator/intermOut.cpp
index 07c50f0..3833f5a 100644
--- a/src/compiler/translator/intermOut.cpp
+++ b/src/compiler/translator/intermOut.cpp
@@ -265,7 +265,7 @@
OutputTreeText(out, intermConstantUnion, mDepth + 1);
// The following code finds the field name from the constant union
- const ConstantUnion *constantUnion = intermConstantUnion->getUnionArrayPointer();
+ const TConstantUnion *constantUnion = intermConstantUnion->getUnionArrayPointer();
const TStructure *structure = node->getLeft()->getType().getStruct();
const TInterfaceBlock *interfaceBlock = node->getLeft()->getType().getInterfaceBlock();
ASSERT(structure || interfaceBlock);
diff --git a/src/compiler/translator/parseConst.cpp b/src/compiler/translator/parseConst.cpp
index 1897ed1..cb9dfa8 100644
--- a/src/compiler/translator/parseConst.cpp
+++ b/src/compiler/translator/parseConst.cpp
@@ -13,7 +13,7 @@
class TConstTraverser : public TIntermTraverser
{
public:
- TConstTraverser(ConstantUnion *cUnion, bool singleConstParam,
+ TConstTraverser(TConstantUnion *cUnion, bool singleConstParam,
TOperator constructType, TInfoSink &sink, TType &t)
: error(false),
mIndex(0),
@@ -42,7 +42,7 @@
bool visitBranch(Visit visit, TIntermBranch *);
size_t mIndex;
- ConstantUnion *mUnionArray;
+ TConstantUnion *mUnionArray;
TType mType;
TOperator mConstructorType;
bool mSingleConstantParam;
@@ -167,7 +167,7 @@
return;
}
- ConstantUnion *leftUnionArray = mUnionArray;
+ TConstantUnion *leftUnionArray = mUnionArray;
size_t instanceSize = mType.getObjectSize();
TBasicType basicType = mType.getBasicType();
@@ -177,7 +177,7 @@
if (!mSingleConstantParam)
{
size_t objectSize = node->getType().getObjectSize();
- ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
+ TConstantUnion *rightUnionArray = node->getUnionArrayPointer();
for (size_t i=0; i < objectSize; i++)
{
if (mIndex >= instanceSize)
@@ -189,7 +189,7 @@
else
{
size_t totalSize = mIndex + mSize;
- ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
+ TConstantUnion *rightUnionArray = node->getUnionArrayPointer();
if (!mIsDiagonalMatrixInit)
{
int count = 0;
@@ -247,7 +247,7 @@
// type of node. It's children will still be processed.
//
bool TIntermediate::parseConstTree(
- const TSourceLoc &line, TIntermNode *root, ConstantUnion *unionArray,
+ const TSourceLoc &line, TIntermNode *root, TConstantUnion *unionArray,
TOperator constructorType, TType t, bool singleConstantParam)
{
if (root == 0)