Output the complete function at once to avoid having to erase the function arguments.

TRAC #20737 Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@1118 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 06eb0d42
...@@ -1290,59 +1290,54 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -1290,59 +1290,54 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
{ {
TString name = TFunction::unmangleName(node->getName()); TString name = TFunction::unmangleName(node->getName());
if (visit == PreVisit) out << typeString(node->getType()) << " ";
if (name == "main")
{
out << "gl_main(";
}
else
{ {
out << typeString(node->getType()) << " "; out << decorate(name) << "(";
}
if (name == "main") TIntermSequence &sequence = node->getSequence();
{ TIntermSequence &arguments = sequence[0]->getAsAggregate()->getSequence();
out << "gl_main(";
}
else
{
out << decorate(name) << "(";
}
TIntermSequence &sequence = node->getSequence(); for (unsigned int i = 0; i < arguments.size(); i++)
TIntermSequence &arguments = sequence[0]->getAsAggregate()->getSequence(); {
TIntermSymbol *symbol = arguments[i]->getAsSymbolNode();
for (unsigned int i = 0; i < arguments.size(); i++) if (symbol)
{ {
TIntermSymbol *symbol = arguments[i]->getAsSymbolNode(); if (symbol->getType().getStruct())
if (symbol)
{ {
if (symbol->getType().getStruct()) addConstructor(symbol->getType(), scopedStruct(symbol->getType().getTypeName()), NULL);
{ }
addConstructor(symbol->getType(), scopedStruct(symbol->getType().getTypeName()), NULL);
}
out << argumentString(symbol); out << argumentString(symbol);
if (i < arguments.size() - 1) if (i < arguments.size() - 1)
{ {
out << ", "; out << ", ";
}
} }
else UNREACHABLE();
} }
else UNREACHABLE();
sequence.erase(sequence.begin());
out << ")\n";
outputLineDirective(node->getLine());
out << "{\n";
mInsideFunction = true;
} }
else if (visit == PostVisit)
{
outputLineDirective(node->getEndLine());
out << "}\n";
out << ")\n"
"{\n";
if (sequence.size() > 1)
{
mInsideFunction = true;
sequence[1]->traverse(this);
mInsideFunction = false; mInsideFunction = false;
} }
out << "}\n";
return false;
} }
break; break;
case EOpFunctionCall: case EOpFunctionCall:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment