Add switch/case/default statements, using a switch node that contains a sequence of case/default nodes and top-level nodes of the code chunks in between them.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21131 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
8e5425745f
commit
0576126005
10 changed files with 244 additions and 23 deletions
|
|
@ -503,6 +503,8 @@ bool OutputBranch(bool /* previsit*/, TIntermBranch* node, TIntermTraverser* it)
|
|||
case EOpBreak: out.debug << "Branch: Break"; break;
|
||||
case EOpContinue: out.debug << "Branch: Continue"; break;
|
||||
case EOpReturn: out.debug << "Branch: Return"; break;
|
||||
case EOpCase: out.debug << "case: "; break;
|
||||
case EOpDefault: out.debug << "default: "; break;
|
||||
default: out.debug << "Branch: Unknown Branch"; break;
|
||||
}
|
||||
|
||||
|
|
@ -517,6 +519,30 @@ bool OutputBranch(bool /* previsit*/, TIntermBranch* node, TIntermTraverser* it)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool OutputSwitch(bool /* preVisit */, TIntermSwitch* node, TIntermTraverser* it)
|
||||
{
|
||||
TOutputTraverser* oit = static_cast<TOutputTraverser*>(it);
|
||||
TInfoSink& out = oit->infoSink;
|
||||
|
||||
OutputTreeText(out, node, oit->depth);
|
||||
out.debug << "switch\n";
|
||||
|
||||
OutputTreeText(out, node, oit->depth);
|
||||
out.debug << "condition\n";
|
||||
++oit->depth;
|
||||
node->getCondition()->traverse(it);
|
||||
|
||||
--oit->depth;
|
||||
OutputTreeText(out, node, oit->depth);
|
||||
out.debug << "body\n";
|
||||
++oit->depth;
|
||||
node->getBody()->traverse(it);
|
||||
|
||||
--oit->depth;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// This function is the one to call externally to start the traversal.
|
||||
// Individual functions can be initialized to 0 to skip processing of that
|
||||
|
|
@ -537,6 +563,7 @@ void TIntermediate::outputTree(TIntermNode* root)
|
|||
it.visitUnary = OutputUnary;
|
||||
it.visitLoop = OutputLoop;
|
||||
it.visitBranch = OutputBranch;
|
||||
it.visitSwitch = OutputSwitch;
|
||||
|
||||
root->traverse(&it);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue