Commit 8fab320c by Olli Etuaho Committed by Commit Bot

Share a single TOperator enum among all constructor AST nodes

The code is a lot simpler when the type information is only carried in the TType of the node, instead of being partially duplicated in the enum value. BUG=angleproject:1490 TEST=angle_unittests Change-Id: I956376225ec01e469c7afb7378fa48cc097c0cea Reviewed-on: https://chromium-review.googlesource.com/498768 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 9405005f
...@@ -640,12 +640,16 @@ bool EmulatePrecision::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -640,12 +640,16 @@ bool EmulatePrecision::visitAggregate(Visit visit, TIntermAggregate *node)
bool visitChildren = true; bool visitChildren = true;
switch (node->getOp()) switch (node->getOp())
{ {
case EOpConstructStruct:
case EOpCallInternalRawFunction: case EOpCallInternalRawFunction:
case EOpCallFunctionInAST: case EOpCallFunctionInAST:
// User-defined function return values are not rounded. The calculations that produced // User-defined function return values are not rounded. The calculations that produced
// the value inside the function definition should have been rounded. // the value inside the function definition should have been rounded.
break; break;
case EOpConstruct:
if (node->getBasicType() == EbtStruct)
{
break;
}
default: default:
TIntermNode *parent = getParentNode(); TIntermNode *parent = getParentNode();
if (canRoundFloat(node->getType()) && visit == PreVisit && if (canRoundFloat(node->getType()) && visit == PreVisit &&
......
...@@ -306,10 +306,7 @@ TIntermAggregate *TIntermAggregate::CreateBuiltInFunctionCall(const TFunction &f ...@@ -306,10 +306,7 @@ TIntermAggregate *TIntermAggregate::CreateBuiltInFunctionCall(const TFunction &f
TIntermAggregate *TIntermAggregate::CreateConstructor(const TType &type, TIntermAggregate *TIntermAggregate::CreateConstructor(const TType &type,
TIntermSequence *arguments) TIntermSequence *arguments)
{ {
TIntermAggregate *constructorNode = return new TIntermAggregate(type, EOpConstruct, arguments);
new TIntermAggregate(type, sh::TypeToConstructorOperator(type), arguments);
ASSERT(constructorNode->isConstructor());
return constructorNode;
} }
TIntermAggregate *TIntermAggregate::Create(const TType &type, TIntermAggregate *TIntermAggregate::Create(const TType &type,
...@@ -343,7 +340,7 @@ void TIntermAggregate::setTypePrecisionAndQualifier(const TType &type) ...@@ -343,7 +340,7 @@ void TIntermAggregate::setTypePrecisionAndQualifier(const TType &type)
{ {
// Structs should not be precision qualified, the individual members may be. // Structs should not be precision qualified, the individual members may be.
// Built-in types on the other hand should be precision qualified. // Built-in types on the other hand should be precision qualified.
if (mOp != EOpConstructStruct) if (getBasicType() != EbtStruct)
{ {
setPrecisionFromChildren(); setPrecisionFromChildren();
} }
...@@ -776,43 +773,9 @@ bool TIntermOperator::isMultiplication() const ...@@ -776,43 +773,9 @@ bool TIntermOperator::isMultiplication() const
} }
} }
// Returns true if the operator is for one of the constructors.
bool TIntermOperator::isConstructor() const bool TIntermOperator::isConstructor() const
{ {
switch (mOp) return (mOp == EOpConstruct);
{
case EOpConstructVec2:
case EOpConstructVec3:
case EOpConstructVec4:
case EOpConstructMat2:
case EOpConstructMat2x3:
case EOpConstructMat2x4:
case EOpConstructMat3x2:
case EOpConstructMat3:
case EOpConstructMat3x4:
case EOpConstructMat4x2:
case EOpConstructMat4x3:
case EOpConstructMat4:
case EOpConstructFloat:
case EOpConstructIVec2:
case EOpConstructIVec3:
case EOpConstructIVec4:
case EOpConstructInt:
case EOpConstructUVec2:
case EOpConstructUVec3:
case EOpConstructUVec4:
case EOpConstructUInt:
case EOpConstructBVec2:
case EOpConstructBVec3:
case EOpConstructBVec4:
case EOpConstructBool:
case EOpConstructStruct:
return true;
default:
// EOpConstruct is not supposed to be used in the AST.
ASSERT(mOp != EOpConstruct);
return false;
}
} }
bool TIntermOperator::isFunctionCall() const bool TIntermOperator::isFunctionCall() const
......
...@@ -296,58 +296,6 @@ const char *GetOperatorString(TOperator op) ...@@ -296,58 +296,6 @@ const char *GetOperatorString(TOperator op)
case EOpContinue: case EOpContinue:
return "continue"; return "continue";
case EOpConstructInt:
return "int";
case EOpConstructUInt:
return "uint";
case EOpConstructBool:
return "bool";
case EOpConstructFloat:
return "float";
case EOpConstructVec2:
return "vec2";
case EOpConstructVec3:
return "vec3";
case EOpConstructVec4:
return "vec4";
case EOpConstructBVec2:
return "bvec2";
case EOpConstructBVec3:
return "bvec3";
case EOpConstructBVec4:
return "bvec4";
case EOpConstructIVec2:
return "ivec2";
case EOpConstructIVec3:
return "ivec3";
case EOpConstructIVec4:
return "ivec4";
case EOpConstructUVec2:
return "uvec2";
case EOpConstructUVec3:
return "uvec3";
case EOpConstructUVec4:
return "uvec4";
case EOpConstructMat2:
return "mat2";
case EOpConstructMat2x3:
return "mat2x3";
case EOpConstructMat2x4:
return "mat2x4";
case EOpConstructMat3x2:
return "mat3x2";
case EOpConstructMat3:
return "mat3";
case EOpConstructMat3x4:
return "mat3x4";
case EOpConstructMat4x2:
return "mat4x2";
case EOpConstructMat4x3:
return "mat4x3";
case EOpConstructMat4:
return "mat4";
// Note: EOpConstructStruct can't be handled here
case EOpAssign: case EOpAssign:
return "="; return "=";
case EOpInitialize: case EOpInitialize:
......
...@@ -202,40 +202,11 @@ enum TOperator ...@@ -202,40 +202,11 @@ enum TOperator
EOpContinue, EOpContinue,
// //
// Constructors // Constructor
// //
// Used by ParseContext to denote any constructor.
EOpConstruct, EOpConstruct,
// In the AST, constructors are stored using the below more specific op codes.
EOpConstructInt,
EOpConstructUInt,
EOpConstructBool,
EOpConstructFloat,
EOpConstructVec2,
EOpConstructVec3,
EOpConstructVec4,
EOpConstructBVec2,
EOpConstructBVec3,
EOpConstructBVec4,
EOpConstructIVec2,
EOpConstructIVec3,
EOpConstructIVec4,
EOpConstructUVec2,
EOpConstructUVec3,
EOpConstructUVec4,
EOpConstructMat2,
EOpConstructMat2x3,
EOpConstructMat2x4,
EOpConstructMat3x2,
EOpConstructMat3,
EOpConstructMat3x4,
EOpConstructMat4x2,
EOpConstructMat4x3,
EOpConstructMat4,
EOpConstructStruct,
// //
// moves // moves
// //
......
...@@ -962,32 +962,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -962,32 +962,7 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
else else
out << ")"; out << ")";
break; break;
case EOpConstructFloat: case EOpConstruct:
case EOpConstructVec2:
case EOpConstructVec3:
case EOpConstructVec4:
case EOpConstructBool:
case EOpConstructBVec2:
case EOpConstructBVec3:
case EOpConstructBVec4:
case EOpConstructInt:
case EOpConstructIVec2:
case EOpConstructIVec3:
case EOpConstructIVec4:
case EOpConstructUInt:
case EOpConstructUVec2:
case EOpConstructUVec3:
case EOpConstructUVec4:
case EOpConstructMat2:
case EOpConstructMat2x3:
case EOpConstructMat2x4:
case EOpConstructMat3x2:
case EOpConstructMat3:
case EOpConstructMat3x4:
case EOpConstructMat4x2:
case EOpConstructMat4x3:
case EOpConstructMat4:
case EOpConstructStruct:
writeConstructorTriplet(visit, node->getType()); writeConstructorTriplet(visit, node->getType());
break; break;
......
...@@ -1846,92 +1846,47 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -1846,92 +1846,47 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
return false; return false;
} }
case EOpConstructFloat: case EOpConstruct:
outputConstructor(out, visit, node->getType(), "vec1", node->getSequence()); if (node->getBasicType() == EbtStruct)
break;
case EOpConstructVec2:
outputConstructor(out, visit, node->getType(), "vec2", node->getSequence());
break;
case EOpConstructVec3:
outputConstructor(out, visit, node->getType(), "vec3", node->getSequence());
break;
case EOpConstructVec4:
outputConstructor(out, visit, node->getType(), "vec4", node->getSequence());
break;
case EOpConstructBool:
outputConstructor(out, visit, node->getType(), "bvec1", node->getSequence());
break;
case EOpConstructBVec2:
outputConstructor(out, visit, node->getType(), "bvec2", node->getSequence());
break;
case EOpConstructBVec3:
outputConstructor(out, visit, node->getType(), "bvec3", node->getSequence());
break;
case EOpConstructBVec4:
outputConstructor(out, visit, node->getType(), "bvec4", node->getSequence());
break;
case EOpConstructInt:
outputConstructor(out, visit, node->getType(), "ivec1", node->getSequence());
break;
case EOpConstructIVec2:
outputConstructor(out, visit, node->getType(), "ivec2", node->getSequence());
break;
case EOpConstructIVec3:
outputConstructor(out, visit, node->getType(), "ivec3", node->getSequence());
break;
case EOpConstructIVec4:
outputConstructor(out, visit, node->getType(), "ivec4", node->getSequence());
break;
case EOpConstructUInt:
outputConstructor(out, visit, node->getType(), "uvec1", node->getSequence());
break;
case EOpConstructUVec2:
outputConstructor(out, visit, node->getType(), "uvec2", node->getSequence());
break;
case EOpConstructUVec3:
outputConstructor(out, visit, node->getType(), "uvec3", node->getSequence());
break;
case EOpConstructUVec4:
outputConstructor(out, visit, node->getType(), "uvec4", node->getSequence());
break;
case EOpConstructMat2:
outputConstructor(out, visit, node->getType(), "mat2", node->getSequence());
break;
case EOpConstructMat2x3:
outputConstructor(out, visit, node->getType(), "mat2x3", node->getSequence());
break;
case EOpConstructMat2x4:
outputConstructor(out, visit, node->getType(), "mat2x4", node->getSequence());
break;
case EOpConstructMat3x2:
outputConstructor(out, visit, node->getType(), "mat3x2", node->getSequence());
break;
case EOpConstructMat3:
outputConstructor(out, visit, node->getType(), "mat3", node->getSequence());
break;
case EOpConstructMat3x4:
outputConstructor(out, visit, node->getType(), "mat3x4", node->getSequence());
break;
case EOpConstructMat4x2:
outputConstructor(out, visit, node->getType(), "mat4x2", node->getSequence());
break;
case EOpConstructMat4x3:
outputConstructor(out, visit, node->getType(), "mat4x3", node->getSequence());
break;
case EOpConstructMat4:
outputConstructor(out, visit, node->getType(), "mat4", node->getSequence());
break;
case EOpConstructStruct:
{
if (node->getType().isArray())
{ {
UNIMPLEMENTED(); if (node->getType().isArray())
{
UNIMPLEMENTED();
}
const TString &structName = StructNameString(*node->getType().getStruct());
mStructureHLSL->addConstructor(node->getType(), structName, node->getSequence());
outputTriplet(out, visit, (structName + "_ctor(").c_str(), ", ", ")");
} }
const TString &structName = StructNameString(*node->getType().getStruct()); else
mStructureHLSL->addConstructor(node->getType(), structName, node->getSequence()); {
outputTriplet(out, visit, (structName + "_ctor(").c_str(), ", ", ")"); const char *name = "";
} if (node->getType().getNominalSize() == 1)
break; {
switch (node->getBasicType())
{
case EbtFloat:
name = "vec1";
break;
case EbtInt:
name = "ivec1";
break;
case EbtUInt:
name = "uvec1";
break;
case EbtBool:
name = "bvec1";
break;
default:
UNREACHABLE();
}
}
else
{
name = node->getType().getBuiltInTypeNameString();
}
outputConstructor(out, visit, node->getType(), name, node->getSequence());
}
break;
case EOpEqualComponentWise: case EOpEqualComponentWise:
outputTriplet(out, visit, "(", " == ", ")"); outputTriplet(out, visit, "(", " == ", ")");
break; break;
......
...@@ -97,37 +97,12 @@ class ScalarizeArgsTraverser : public TIntermTraverser ...@@ -97,37 +97,12 @@ class ScalarizeArgsTraverser : public TIntermTraverser
bool ScalarizeArgsTraverser::visitAggregate(Visit visit, TIntermAggregate *node) bool ScalarizeArgsTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
{ {
if (visit == PreVisit) if (visit == PreVisit && node->getOp() == EOpConstruct)
{ {
switch (node->getOp()) if (node->getType().isVector() && ContainsMatrixNode(*(node->getSequence())))
{ scalarizeArgs(node, false, true);
case EOpConstructVec2: else if (node->getType().isMatrix() && ContainsVectorNode(*(node->getSequence())))
case EOpConstructVec3: scalarizeArgs(node, true, false);
case EOpConstructVec4:
case EOpConstructBVec2:
case EOpConstructBVec3:
case EOpConstructBVec4:
case EOpConstructIVec2:
case EOpConstructIVec3:
case EOpConstructIVec4:
if (ContainsMatrixNode(*(node->getSequence())))
scalarizeArgs(node, false, true);
break;
case EOpConstructMat2:
case EOpConstructMat2x3:
case EOpConstructMat2x4:
case EOpConstructMat3x2:
case EOpConstructMat3:
case EOpConstructMat3x4:
case EOpConstructMat4x2:
case EOpConstructMat4x3:
case EOpConstructMat4:
if (ContainsVectorNode(*(node->getSequence())))
scalarizeArgs(node, true, false);
break;
default:
break;
}
} }
return true; return true;
} }
...@@ -157,46 +132,8 @@ void ScalarizeArgsTraverser::scalarizeArgs(TIntermAggregate *aggregate, ...@@ -157,46 +132,8 @@ void ScalarizeArgsTraverser::scalarizeArgs(TIntermAggregate *aggregate,
bool scalarizeMatrix) bool scalarizeMatrix)
{ {
ASSERT(aggregate); ASSERT(aggregate);
int size = 0; ASSERT(!aggregate->isArray());
switch (aggregate->getOp()) int size = static_cast<int>(aggregate->getType().getObjectSize());
{
case EOpConstructVec2:
case EOpConstructBVec2:
case EOpConstructIVec2:
size = 2;
break;
case EOpConstructVec3:
case EOpConstructBVec3:
case EOpConstructIVec3:
size = 3;
break;
case EOpConstructVec4:
case EOpConstructBVec4:
case EOpConstructIVec4:
case EOpConstructMat2:
size = 4;
break;
case EOpConstructMat2x3:
case EOpConstructMat3x2:
size = 6;
break;
case EOpConstructMat2x4:
case EOpConstructMat4x2:
size = 8;
break;
case EOpConstructMat3:
size = 9;
break;
case EOpConstructMat3x4:
case EOpConstructMat4x3:
size = 12;
break;
case EOpConstructMat4:
size = 16;
break;
default:
break;
}
TIntermSequence *sequence = aggregate->getSequence(); TIntermSequence *sequence = aggregate->getSequence();
TIntermSequence original(*sequence); TIntermSequence original(*sequence);
sequence->clear(); sequence->clear();
......
...@@ -120,31 +120,17 @@ bool TVersionGLSL::visitFunctionPrototype(Visit, TIntermFunctionPrototype *node) ...@@ -120,31 +120,17 @@ bool TVersionGLSL::visitFunctionPrototype(Visit, TIntermFunctionPrototype *node)
bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate *node) bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate *node)
{ {
switch (node->getOp()) if (node->getOp() == EOpConstruct && node->getType().isMatrix())
{ {
case EOpConstructMat2: const TIntermSequence &sequence = *(node->getSequence());
case EOpConstructMat2x3: if (sequence.size() == 1)
case EOpConstructMat2x4:
case EOpConstructMat3x2:
case EOpConstructMat3:
case EOpConstructMat3x4:
case EOpConstructMat4x2:
case EOpConstructMat4x3:
case EOpConstructMat4:
{ {
const TIntermSequence &sequence = *(node->getSequence()); TIntermTyped *typed = sequence.front()->getAsTyped();
if (sequence.size() == 1) if (typed && typed->isMatrix())
{ {
TIntermTyped *typed = sequence.front()->getAsTyped(); ensureVersionIsAtLeast(GLSL_VERSION_120);
if (typed && typed->isMatrix())
{
ensureVersionIsAtLeast(GLSL_VERSION_120);
}
} }
break;
} }
default:
break;
} }
return true; return true;
} }
......
...@@ -386,67 +386,58 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -386,67 +386,58 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
return true; return true;
} }
if (node->isConstructor()) // Give verbose names for some built-in functions that are easy to confuse with others, but
{ // mostly use GLSL names for functions.
if (node->getOp() == EOpConstructStruct) switch (node->getOp())
{
out << "Construct structure";
}
else
{
out << "Construct " << GetOperatorString(node->getOp());
}
}
else
{ {
// Give verbose names for some built-in functions that are easy to confuse with others, but case EOpCallFunctionInAST:
// mostly use GLSL names for functions. OutputFunction(out, "Call an user-defined function", node->getFunctionSymbolInfo());
switch (node->getOp()) break;
{ case EOpCallInternalRawFunction:
case EOpCallFunctionInAST: OutputFunction(out, "Call an internal function with raw implementation",
OutputFunction(out, "Call an user-defined function", node->getFunctionSymbolInfo()); node->getFunctionSymbolInfo());
break; break;
case EOpCallInternalRawFunction: case EOpCallBuiltInFunction:
OutputFunction(out, "Call an internal function with raw implementation", OutputFunction(out, "Call a built-in function", node->getFunctionSymbolInfo());
node->getFunctionSymbolInfo()); break;
break;
case EOpCallBuiltInFunction:
OutputFunction(out, "Call a built-in function", node->getFunctionSymbolInfo());
break;
case EOpEqualComponentWise: case EOpConstruct:
out << "component-wise equal"; // The type of the constructor will be printed below.
break; out << "Construct";
case EOpNotEqualComponentWise: break;
out << "component-wise not equal";
break;
case EOpLessThanComponentWise:
out << "component-wise less than";
break;
case EOpGreaterThanComponentWise:
out << "component-wise greater than";
break;
case EOpLessThanEqualComponentWise:
out << "component-wise less than or equal";
break;
case EOpGreaterThanEqualComponentWise:
out << "component-wise greater than or equal";
break;
case EOpDot: case EOpEqualComponentWise:
out << "dot product"; out << "component-wise equal";
break; break;
case EOpCross: case EOpNotEqualComponentWise:
out << "cross product"; out << "component-wise not equal";
break; break;
case EOpMulMatrixComponentWise: case EOpLessThanComponentWise:
out << "component-wise multiply"; out << "component-wise less than";
break; break;
case EOpGreaterThanComponentWise:
out << "component-wise greater than";
break;
case EOpLessThanEqualComponentWise:
out << "component-wise less than or equal";
break;
case EOpGreaterThanEqualComponentWise:
out << "component-wise greater than or equal";
break;
default: case EOpDot:
out << GetOperatorString(node->getOp()); out << "dot product";
break; break;
} case EOpCross:
out << "cross product";
break;
case EOpMulMatrixComponentWise:
out << "component-wise multiply";
break;
default:
out << GetOperatorString(node->getOp());
break;
} }
out << " (" << node->getCompleteString() << ")"; out << " (" << node->getCompleteString() << ")";
......
...@@ -575,134 +575,6 @@ TType GetShaderVariableBasicType(const sh::ShaderVariable &var) ...@@ -575,134 +575,6 @@ TType GetShaderVariableBasicType(const sh::ShaderVariable &var)
} }
} }
TOperator TypeToConstructorOperator(const TType &type)
{
switch (type.getBasicType())
{
case EbtFloat:
if (type.isMatrix())
{
switch (type.getCols())
{
case 2:
switch (type.getRows())
{
case 2:
return EOpConstructMat2;
case 3:
return EOpConstructMat2x3;
case 4:
return EOpConstructMat2x4;
default:
break;
}
break;
case 3:
switch (type.getRows())
{
case 2:
return EOpConstructMat3x2;
case 3:
return EOpConstructMat3;
case 4:
return EOpConstructMat3x4;
default:
break;
}
break;
case 4:
switch (type.getRows())
{
case 2:
return EOpConstructMat4x2;
case 3:
return EOpConstructMat4x3;
case 4:
return EOpConstructMat4;
default:
break;
}
break;
}
}
else
{
switch (type.getNominalSize())
{
case 1:
return EOpConstructFloat;
case 2:
return EOpConstructVec2;
case 3:
return EOpConstructVec3;
case 4:
return EOpConstructVec4;
default:
break;
}
}
break;
case EbtInt:
switch (type.getNominalSize())
{
case 1:
return EOpConstructInt;
case 2:
return EOpConstructIVec2;
case 3:
return EOpConstructIVec3;
case 4:
return EOpConstructIVec4;
default:
break;
}
break;
case EbtUInt:
switch (type.getNominalSize())
{
case 1:
return EOpConstructUInt;
case 2:
return EOpConstructUVec2;
case 3:
return EOpConstructUVec3;
case 4:
return EOpConstructUVec4;
default:
break;
}
break;
case EbtBool:
switch (type.getNominalSize())
{
case 1:
return EOpConstructBool;
case 2:
return EOpConstructBVec2;
case 3:
return EOpConstructBVec3;
case 4:
return EOpConstructBVec4;
default:
break;
}
break;
case EbtStruct:
return EOpConstructStruct;
default:
break;
}
return EOpNull;
}
// GLSL ES 1.0.17 4.6.1 The Invariant Qualifier // GLSL ES 1.0.17 4.6.1 The Invariant Qualifier
bool CanBeInvariantESSL1(TQualifier qualifier) bool CanBeInvariantESSL1(TQualifier qualifier)
{ {
......
...@@ -43,8 +43,6 @@ TString ArrayString(const TType &type); ...@@ -43,8 +43,6 @@ TString ArrayString(const TType &type);
TType GetShaderVariableBasicType(const sh::ShaderVariable &var); TType GetShaderVariableBasicType(const sh::ShaderVariable &var);
TOperator TypeToConstructorOperator(const TType &type);
bool IsBuiltinOutputVariable(TQualifier qualifier); bool IsBuiltinOutputVariable(TQualifier qualifier);
bool IsBuiltinFragmentInputVariable(TQualifier qualifier); bool IsBuiltinFragmentInputVariable(TQualifier qualifier);
bool CanBeInvariantESSL1(TQualifier qualifier); bool CanBeInvariantESSL1(TQualifier qualifier);
......
...@@ -157,12 +157,12 @@ TEST_F(TypeTrackingTest, BuiltInMatFunctionResultTypeAndPrecision) ...@@ -157,12 +157,12 @@ TEST_F(TypeTrackingTest, BuiltInMatFunctionResultTypeAndPrecision)
"}\n"; "}\n";
compile(shaderString); compile(shaderString);
ASSERT_FALSE(foundErrorInIntermediateTree()); ASSERT_FALSE(foundErrorInIntermediateTree());
ASSERT_TRUE(foundInIntermediateTree("Construct mat2x3 (mediump 2X3 matrix of float)")); ASSERT_TRUE(foundInIntermediateTree("Construct (mediump 2X3 matrix of float)"));
ASSERT_TRUE(foundInIntermediateTree("Construct mat3x2 (mediump 3X2 matrix of float)")); ASSERT_TRUE(foundInIntermediateTree("Construct (mediump 3X2 matrix of float)"));
ASSERT_TRUE(foundInIntermediateTree("Construct mat2x4 (mediump 2X4 matrix of float)")); ASSERT_TRUE(foundInIntermediateTree("Construct (mediump 2X4 matrix of float)"));
ASSERT_TRUE(foundInIntermediateTree("Construct mat4x2 (mediump 4X2 matrix of float)")); ASSERT_TRUE(foundInIntermediateTree("Construct (mediump 4X2 matrix of float)"));
ASSERT_TRUE(foundInIntermediateTree("Construct mat3x4 (mediump 3X4 matrix of float)")); ASSERT_TRUE(foundInIntermediateTree("Construct (mediump 3X4 matrix of float)"));
ASSERT_TRUE(foundInIntermediateTree("Construct mat4x3 (mediump 4X3 matrix of float)")); ASSERT_TRUE(foundInIntermediateTree("Construct (mediump 4X3 matrix of float)"));
} }
TEST_F(TypeTrackingTest, BuiltInFunctionChoosesHigherPrecision) TEST_F(TypeTrackingTest, BuiltInFunctionChoosesHigherPrecision)
...@@ -288,7 +288,7 @@ TEST_F(TypeTrackingTest, BuiltInConstructorResultTypeAndPrecision) ...@@ -288,7 +288,7 @@ TEST_F(TypeTrackingTest, BuiltInConstructorResultTypeAndPrecision)
"}\n"; "}\n";
compile(shaderString); compile(shaderString);
ASSERT_FALSE(foundErrorInIntermediateTree()); ASSERT_FALSE(foundErrorInIntermediateTree());
ASSERT_TRUE(foundInIntermediateTree("Construct vec4 (mediump 4-component vector of float)")); ASSERT_TRUE(foundInIntermediateTree("Construct (mediump 4-component vector of float)"));
} }
TEST_F(TypeTrackingTest, StructConstructorResultNoPrecision) TEST_F(TypeTrackingTest, StructConstructorResultNoPrecision)
...@@ -304,7 +304,7 @@ TEST_F(TypeTrackingTest, StructConstructorResultNoPrecision) ...@@ -304,7 +304,7 @@ TEST_F(TypeTrackingTest, StructConstructorResultNoPrecision)
"}\n"; "}\n";
compile(shaderString); compile(shaderString);
ASSERT_FALSE(foundErrorInIntermediateTree()); ASSERT_FALSE(foundErrorInIntermediateTree());
ASSERT_TRUE(foundInIntermediateTree("Construct structure (structure)")); ASSERT_TRUE(foundInIntermediateTree("Construct (structure)"));
} }
TEST_F(TypeTrackingTest, PackResultTypeAndPrecision) TEST_F(TypeTrackingTest, PackResultTypeAndPrecision)
......
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