Improve handling of internal function calls
Many parts of the shader translator that deal with function calls have
been written without internal function calls in mind. Fix some of these
so that they can handle internal function calls.
-Fix TLValueTrackingTraverser handling a shader where there are an
internal and non-internal function of the same name.
-Maintain internalness when shallow copying function calls in
SeparateExpressionReturningArrays and ArrayReturnValueToOutParameter
AST transformations.
-Output function internalness in intermOut.
BUG=angleproject:1116
TEST=angle_unittests
Change-Id: Ic65e2803062b807651f1b3952409face6aceb780
Reviewed-on: https://chromium-review.googlesource.com/303353
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/compiler/translator/IntermTraverse.cpp b/src/compiler/translator/IntermTraverse.cpp
index 269a19b..7b588ca 100644
--- a/src/compiler/translator/IntermTraverse.cpp
+++ b/src/compiler/translator/IntermTraverse.cpp
@@ -160,7 +160,7 @@
++(*mTemporaryIndex);
}
-void TLValueTrackingTraverser::addToFunctionMap(const TString &name, TIntermSequence *paramSequence)
+void TLValueTrackingTraverser::addToFunctionMap(const TName &name, TIntermSequence *paramSequence)
{
mFunctionMap[name] = paramSequence;
}
@@ -168,13 +168,13 @@
bool TLValueTrackingTraverser::isInFunctionMap(const TIntermAggregate *callNode) const
{
ASSERT(callNode->getOp() == EOpFunctionCall);
- return (mFunctionMap.find(callNode->getName()) != mFunctionMap.end());
+ return (mFunctionMap.find(callNode->getNameObj()) != mFunctionMap.end());
}
TIntermSequence *TLValueTrackingTraverser::getFunctionParameters(const TIntermAggregate *callNode)
{
ASSERT(isInFunctionMap(callNode));
- return mFunctionMap[callNode->getName()];
+ return mFunctionMap[callNode->getNameObj()];
}
void TLValueTrackingTraverser::setInFunctionCallOutParameter(bool inOutParameter)
@@ -426,11 +426,11 @@
TIntermAggregate *params = sequence->front()->getAsAggregate();
ASSERT(params != nullptr);
ASSERT(params->getOp() == EOpParameters);
- addToFunctionMap(node->getName(), params->getSequence());
+ addToFunctionMap(node->getNameObj(), params->getSequence());
break;
}
case EOpPrototype:
- addToFunctionMap(node->getName(), sequence);
+ addToFunctionMap(node->getNameObj(), sequence);
break;
default:
break;