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

@@ -385,7 +385,7 @@ public:
// Helper to use for building nested control flow with if-then-else.
class If {
public:
If(Id condition, Builder& builder);
If(Id condition, unsigned int ctrl, Builder& builder);
~If() {}
void makeBeginElse();
@@ -397,6 +397,7 @@ public:
Builder& builder;
Id condition;
unsigned int control;
Function* function;
Block* headerBlock;
Block* thenBlock;
@@ -416,7 +417,7 @@ public:
// Returns the right set of basic blocks to start each code segment with, so that the caller's
// recursion stack can hold the memory for it.
//
void makeSwitch(Id condition, int numSegments, const std::vector<int>& caseValues,
void makeSwitch(Id condition, unsigned int control, int numSegments, const std::vector<int>& caseValues,
const std::vector<int>& valueToSegment, int defaultSegment, std::vector<Block*>& segmentBB); // return argument
// Add a branch to the innermost switch's merge block.