Separate function info from TIntermAggregate
This change will make it easier to split types of TIntermAggregate
nodes representing functions and function calls into different node
classes.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I730aa7858fe31fda86218fc685980c6ad486f5e0
Reviewed-on: https://chromium-review.googlesource.com/394706
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index f3f59e3..d6ef96f 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -1533,7 +1533,7 @@
case EOpPrototype:
if (visit == PreVisit)
{
- size_t index = mCallDag.findIndex(node);
+ size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo());
// Skip the prototype if it is not implemented (and thus not used)
if (index == CallDAG::InvalidIndex)
{
@@ -1542,7 +1542,8 @@
TIntermSequence *arguments = node->getSequence();
- TString name = DecorateFunctionIfNeeded(node->getNameObj());
+ TString name =
+ DecorateFunctionIfNeeded(node->getFunctionSymbolInfo()->getNameObj());
out << TypeString(node->getType()) << " " << name
<< DisambiguateFunctionName(arguments) << (mOutputLod0Function ? "Lod0(" : "(");
@@ -1583,9 +1584,8 @@
case EOpFunction:
{
ASSERT(mCurrentFunctionMetadata == nullptr);
- TString name = TFunction::unmangleName(node->getNameObj().getString());
- size_t index = mCallDag.findIndex(node);
+ size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo());
ASSERT(index != CallDAG::InvalidIndex);
mCurrentFunctionMetadata = &mASTMetadataList[index];
@@ -1594,13 +1594,13 @@
TIntermSequence *sequence = node->getSequence();
TIntermSequence *arguments = (*sequence)[0]->getAsAggregate()->getSequence();
- if (name == "main")
+ if (node->getFunctionSymbolInfo()->isMain())
{
out << "gl_main(";
}
else
{
- out << DecorateFunctionIfNeeded(node->getNameObj())
+ out << DecorateFunctionIfNeeded(node->getFunctionSymbolInfo()->getNameObj())
<< DisambiguateFunctionName(arguments) << (mOutputLod0Function ? "Lod0(" : "(");
}
@@ -1637,7 +1637,7 @@
bool needsLod0 = mASTMetadataList[index].mNeedsLod0;
if (needsLod0 && !mOutputLod0Function && mShaderType == GL_FRAGMENT_SHADER)
{
- ASSERT(name != "main");
+ ASSERT(!node->getFunctionSymbolInfo()->isMain());
mOutputLod0Function = true;
node->traverse(this);
mOutputLod0Function = false;
@@ -1656,23 +1656,23 @@
{
UNIMPLEMENTED();
}
- size_t index = mCallDag.findIndex(node);
+ size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo());
ASSERT(index != CallDAG::InvalidIndex);
lod0 &= mASTMetadataList[index].mNeedsLod0;
- out << DecorateFunctionIfNeeded(node->getNameObj());
+ out << DecorateFunctionIfNeeded(node->getFunctionSymbolInfo()->getNameObj());
out << DisambiguateFunctionName(node->getSequence());
out << (lod0 ? "Lod0(" : "(");
}
- else if (node->getNameObj().isInternal())
+ else if (node->getFunctionSymbolInfo()->getNameObj().isInternal())
{
// This path is used for internal functions that don't have their definitions in the
// AST, such as precision emulation functions.
- out << DecorateFunctionIfNeeded(node->getNameObj()) << "(";
+ out << DecorateFunctionIfNeeded(node->getFunctionSymbolInfo()->getNameObj()) << "(";
}
else
{
- TString name = TFunction::unmangleName(node->getNameObj().getString());
+ TString name = TFunction::unmangleName(node->getFunctionSymbolInfo()->getName());
TBasicType samplerType = (*arguments)[0]->getAsTyped()->getType().getBasicType();
int coords = (*arguments)[1]->getAsTyped()->getNominalSize();
TString textureFunctionName = mTextureFunctionHLSL->useTextureFunction(