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)
{
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")
{
out << "gl_main(";
}
else
{
out << decorate(name) << "(";
}
TIntermSequence &sequence = node->getSequence();
TIntermSequence &arguments = sequence[0]->getAsAggregate()->getSequence();
TIntermSequence &sequence = node->getSequence();
TIntermSequence &arguments = sequence[0]->getAsAggregate()->getSequence();
for (unsigned int i = 0; i < arguments.size(); i++)
{
TIntermSymbol *symbol = arguments[i]->getAsSymbolNode();
for (unsigned int i = 0; i < arguments.size(); i++)
if (symbol)
{
TIntermSymbol *symbol = arguments[i]->getAsSymbolNode();
if (symbol)
if (symbol->getType().getStruct())
{
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)
{
out << ", ";
}
if (i < arguments.size() - 1)
{
out << ", ";
}
else UNREACHABLE();
}
sequence.erase(sequence.begin());
out << ")\n";
outputLineDirective(node->getLine());
out << "{\n";
mInsideFunction = true;
else UNREACHABLE();
}
else if (visit == PostVisit)
{
outputLineDirective(node->getEndLine());
out << "}\n";
out << ")\n"
"{\n";
if (sequence.size() > 1)
{
mInsideFunction = true;
sequence[1]->traverse(this);
mInsideFunction = false;
}
out << "}\n";
return false;
}
break;
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