Fold user-definedness of function nodes into TOperator
Whether a function call is user-defined is not orthogonal to TOperator
associated with the call node - other ops than function calls can't be
user-defined. Because of this it makes sense to store the user-
definedness by having different TOperator enums for different types of
calls.
This patch also tags internal helper functions that have a raw
definition outside the AST with a separate TOperator enum. This way
they can be handled with logic that is easy to understand. Before this,
function calls like this left the user-defined bit unset, despite not
really being built-ins either. The EmulatePrecision traverser uses
this. This is also something that could be used to clean up built-in
emulation in the future.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I597fcd9789d0cc22b689ef3ce5a0cc3f621d4859
Reviewed-on: https://chromium-review.googlesource.com/433443
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 5539a99..8a3794d 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -1000,7 +1000,7 @@
}
// ArrayReturnValueToOutParameter should have eliminated expressions where a
// function call is assigned.
- ASSERT(rightAgg == nullptr || rightAgg->getOp() != EOpFunctionCall);
+ ASSERT(rightAgg == nullptr);
const TString &functionName = addArrayAssignmentFunction(node->getType());
outputTriplet(out, visit, (functionName + "(").c_str(), ", ", ")");
@@ -1755,12 +1755,14 @@
switch (node->getOp())
{
- case EOpFunctionCall:
+ case EOpCallBuiltInFunction:
+ case EOpCallFunctionInAST:
+ case EOpCallInternalRawFunction:
{
TIntermSequence *arguments = node->getSequence();
bool lod0 = mInsideDiscontinuousLoop || mOutputLod0Function;
- if (node->isUserDefined())
+ if (node->getOp() == EOpCallFunctionInAST)
{
if (node->isArray())
{
@@ -1774,7 +1776,7 @@
out << DisambiguateFunctionName(node->getSequence());
out << (lod0 ? "Lod0(" : "(");
}
- else if (node->getFunctionSymbolInfo()->getNameObj().isInternal())
+ else if (node->getOp() == EOpCallInternalRawFunction)
{
// This path is used for internal functions that don't have their definitions in the
// AST, such as precision emulation functions.