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
|
|
@ -176,13 +176,13 @@ void TIntermSelection::traverse(TIntermTraverser* it)
|
|||
if (it->rightToLeft) {
|
||||
if (falseBlock)
|
||||
falseBlock->traverse(it);
|
||||
if (trueBlock)
|
||||
trueBlock->traverse(it);
|
||||
if (trueBlock)
|
||||
trueBlock->traverse(it);
|
||||
condition->traverse(it);
|
||||
} else {
|
||||
condition->traverse(it);
|
||||
if (trueBlock)
|
||||
trueBlock->traverse(it);
|
||||
if (trueBlock)
|
||||
trueBlock->traverse(it);
|
||||
if (falseBlock)
|
||||
falseBlock->traverse(it);
|
||||
}
|
||||
|
|
@ -210,11 +210,11 @@ void TIntermLoop::traverse(TIntermTraverser* it)
|
|||
terminal->traverse(it);
|
||||
if (body)
|
||||
body->traverse(it);
|
||||
if (test)
|
||||
test->traverse(it);
|
||||
if (test)
|
||||
test->traverse(it);
|
||||
} else {
|
||||
if (test)
|
||||
test->traverse(it);
|
||||
if (test)
|
||||
test->traverse(it);
|
||||
if (body)
|
||||
body->traverse(it);
|
||||
if (terminal)
|
||||
|
|
@ -247,3 +247,28 @@ void TIntermBranch::traverse(TIntermTraverser* it)
|
|||
it->visitBranch(false, this, it);
|
||||
}
|
||||
|
||||
//
|
||||
// Traverse a switch node.
|
||||
//
|
||||
void TIntermSwitch::traverse(TIntermTraverser* it)
|
||||
{
|
||||
bool visit = true;
|
||||
|
||||
if (it->preVisit && it->visitSwitch)
|
||||
visit = it->visitSwitch(true, this, it);
|
||||
|
||||
if (visit) {
|
||||
++it->depth;
|
||||
if (it->rightToLeft) {
|
||||
body->traverse(it);
|
||||
condition->traverse(it);
|
||||
} else {
|
||||
condition->traverse(it);
|
||||
body->traverse(it);
|
||||
}
|
||||
--it->depth;
|
||||
}
|
||||
|
||||
if (visit && it->postVisit && it->visitSwitch)
|
||||
it->visitSwitch(false, this, it);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue