HLSL: Translate directive [flatten] and [branch] to SPV control mask.

This commit is contained in:
Rex Xu
2017-07-04 23:23:40 +08:00
parent 423fae4858
commit 57e65929e4
15 changed files with 92 additions and 35 deletions

View File

@@ -8273,6 +8273,19 @@ bool HlslParseContext::handleOutputGeometry(const TSourceLoc& loc, const TLayout
return true;
}
//
// Selection hints
//
TSelectionControl HlslParseContext::handleSelectionControl(const TAttributeMap& attributes) const
{
if (attributes.contains(EatFlatten))
return ESelectionControlFlatten;
else if (attributes.contains(EatBranch))
return ESelectionControlDontFlatten;
else
return ESelectionControlNone;
}
//
// Loop hints
//
@@ -8286,7 +8299,6 @@ TLoopControl HlslParseContext::handleLoopControl(const TAttributeMap& attributes
return ELoopControlNone;
}
//
// Updating default qualifier for the case of a declaration with just a qualifier,
// no type, block, or identifier.
@@ -8425,7 +8437,7 @@ void HlslParseContext::wrapupSwitchSubsequence(TIntermAggregate* statements, TIn
// Turn the top-level node sequence built up of wrapupSwitchSubsequence
// into a switch node.
//
TIntermNode* HlslParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expression, TIntermAggregate* lastStatements)
TIntermNode* HlslParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expression, TIntermAggregate* lastStatements, TSelectionControl control)
{
wrapupSwitchSubsequence(lastStatements, nullptr);
@@ -8452,6 +8464,7 @@ TIntermNode* HlslParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* ex
TIntermSwitch* switchNode = new TIntermSwitch(expression, body);
switchNode->setLoc(loc);
switchNode->setSelectionControl(control);
return switchNode;
}