Commit 282847e9 by Olli Etuaho Committed by Commit Bot

Clean up recording declarations in OutputHLSL

Relying on the AST conforming to known limitations makes the code for recording referenced varyings easier to understand. BUG=angleproject:2104 TEST=angle_end2end_tests Change-Id: Icdcd7602f6ed54fa439f989bf256e261627d11f5 Reviewed-on: https://chromium-review.googlesource.com/568018Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent dde78e8c
...@@ -1644,9 +1644,9 @@ bool OutputHLSL::visitDeclaration(Visit visit, TIntermDeclaration *node) ...@@ -1644,9 +1644,9 @@ bool OutputHLSL::visitDeclaration(Visit visit, TIntermDeclaration *node)
TIntermSequence *sequence = node->getSequence(); TIntermSequence *sequence = node->getSequence();
TIntermTyped *variable = (*sequence)[0]->getAsTyped(); TIntermTyped *variable = (*sequence)[0]->getAsTyped();
ASSERT(sequence->size() == 1); ASSERT(sequence->size() == 1);
ASSERT(variable);
if (variable && if ((variable->getQualifier() == EvqTemporary || variable->getQualifier() == EvqGlobal ||
(variable->getQualifier() == EvqTemporary || variable->getQualifier() == EvqGlobal ||
variable->getQualifier() == EvqConst)) variable->getQualifier() == EvqConst))
{ {
ensureStructDefined(variable->getType()); ensureStructDefined(variable->getType());
...@@ -1682,23 +1682,14 @@ bool OutputHLSL::visitDeclaration(Visit visit, TIntermDeclaration *node) ...@@ -1682,23 +1682,14 @@ bool OutputHLSL::visitDeclaration(Visit visit, TIntermDeclaration *node)
else else
UNREACHABLE(); UNREACHABLE();
} }
else if (variable && IsVaryingOut(variable->getQualifier())) else if (IsVaryingOut(variable->getQualifier()))
{ {
for (TIntermSequence::iterator sit = sequence->begin(); sit != sequence->end(); sit++) TIntermSymbol *symbol = variable->getAsSymbolNode();
{ ASSERT(symbol); // Varying declarations can't have initializers.
TIntermSymbol *symbol = (*sit)->getAsSymbolNode();
if (symbol) // Vertex outputs which are declared but not written to should still be declared to
{ // allow successful linking.
// Vertex (output) varyings which are declared but not written to should mReferencedVaryings[symbol->getSymbol()] = symbol;
// still be declared to allow successful linking
mReferencedVaryings[symbol->getSymbol()] = symbol;
}
else
{
(*sit)->traverse(this);
}
}
} }
} }
return false; return false;
......
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