Make aggregate node creation more robust
Now aggregate nodes are always built with their return type, op and
arguments set. They'll determine their qualifier and precision
automatically.
This fixes setting of gotPrecisionFromChildren in a few cases.
This will also make it easier to split TIntermAggregate further into
specialized classes if that is desired.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I1fbe0c75679c517a22d44dfc1ea160ad7a7fdfda
Reviewed-on: https://chromium-review.googlesource.com/433468
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/EmulatePrecision.cpp b/src/compiler/translator/EmulatePrecision.cpp
index 1c9dc39..b8a5c9a 100644
--- a/src/compiler/translator/EmulatePrecision.cpp
+++ b/src/compiler/translator/EmulatePrecision.cpp
@@ -427,13 +427,14 @@
(type.getPrecision() == EbpLow || type.getPrecision() == EbpMedium);
}
-TIntermAggregate *createInternalFunctionCallNode(TString name, TIntermNode *child)
+TIntermAggregate *createInternalFunctionCallNode(const TType &type,
+ TString name,
+ TIntermSequence *arguments)
{
- TIntermAggregate *callNode = new TIntermAggregate(EOpCallInternalRawFunction);
- TName nameObj(TFunction::mangleName(name));
+ TName nameObj(TFunction::GetMangledNameFromCall(name, *arguments));
nameObj.setInternal(true);
+ TIntermAggregate *callNode = new TIntermAggregate(type, EOpCallInternalRawFunction, arguments);
callNode->getFunctionSymbolInfo()->setNameObj(nameObj);
- callNode->getSequence()->push_back(child);
return callNode;
}
@@ -444,9 +445,9 @@
roundFunctionName = "angle_frm";
else
roundFunctionName = "angle_frl";
- TIntermAggregate *callNode = createInternalFunctionCallNode(roundFunctionName, roundedChild);
- callNode->setType(roundedChild->getType());
- return callNode;
+ TIntermSequence *arguments = new TIntermSequence();
+ arguments->push_back(roundedChild);
+ return createInternalFunctionCallNode(roundedChild->getType(), roundFunctionName, arguments);
}
TIntermAggregate *createCompoundAssignmentFunctionCallNode(TIntermTyped *left,
@@ -459,9 +460,10 @@
else
strstr << "angle_compound_" << opNameStr << "_frl";
TString functionName = strstr.str().c_str();
- TIntermAggregate *callNode = createInternalFunctionCallNode(functionName, left);
- callNode->getSequence()->push_back(right);
- return callNode;
+ TIntermSequence *arguments = new TIntermSequence();
+ arguments->push_back(left);
+ arguments->push_back(right);
+ return createInternalFunctionCallNode(TType(EbtVoid), functionName, arguments);
}
bool parentUsesResult(TIntermNode *parent, TIntermNode *node)