Split TIntermInvariantDeclaration from TIntermAggregate
This change is pure refactoring and doesn't fix bugs related to
invariant declarations. Invariant declarations are supposed to accept
a list of identifiers, but this refactoring keeps the current behavior
of only accepting a single identifier in an invariant declaration.
When the bug will be fixed, the new TIntermInvariantDeclaration class
that now has only a single child node can be changed so that it may
have multiple children.
TIntermAggregate is still used for function calls, function
prototypes and function parameter lists.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I3e22092c87e1c06445fd7e123d9922c2fcb59428
Reviewed-on: https://chromium-review.googlesource.com/419415
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index 775f979..379d6d6 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -959,6 +959,15 @@
return false;
}
+bool TOutputGLSLBase::visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node)
+{
+ TInfoSinkBase &out = objSink();
+ ASSERT(visit == PreVisit);
+ const TIntermSymbol *symbol = node->getSymbol();
+ out << "invariant " << hashVariableName(symbol->getName());
+ return false;
+}
+
bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
{
bool visitChildren = true;
@@ -1001,18 +1010,6 @@
out << ")";
visitChildren = false;
break;
- case EOpInvariantDeclaration:
- // Invariant declaration.
- ASSERT(visit == PreVisit);
- {
- const TIntermSequence *sequence = node->getSequence();
- ASSERT(sequence && sequence->size() == 1);
- const TIntermSymbol *symbol = sequence->front()->getAsSymbolNode();
- ASSERT(symbol);
- out << "invariant " << hashVariableName(symbol->getName());
- }
- visitChildren = false;
- break;
case EOpConstructFloat:
case EOpConstructVec2:
case EOpConstructVec3: