HLSL: Implement switch/case/default.

This commit is contained in:
John Kessenich
2016-07-01 00:04:11 -06:00
parent 2f47bc9781
commit d02dc5d05a
7 changed files with 514 additions and 7 deletions

View File

@@ -147,6 +147,9 @@ public:
void pushScope() { symbolTable.push(); }
void popScope() { symbolTable.pop(0); }
void pushSwitchSequence(TIntermSequence* sequence) { switchSequenceStack.push_back(sequence); }
void popSwitchSequence() { switchSequenceStack.pop_back(); }
protected:
void inheritGlobalDefaults(TQualifier& dst) const;
TVariable* makeInternalVariable(const char* name, const TType&) const;
@@ -166,7 +169,6 @@ protected:
int structNestingLevel; // 0 if outside blocks and structures
int controlFlowNestingLevel; // 0 if outside all flow control
TList<TIntermSequence*> switchSequenceStack; // case, node, case, case, node, ...; ensure only one node between cases; stack of them for nesting
TList<int> switchLevel; // the statementNestingLevel the current switch statement is at, which must match the level of its case statements
bool inEntrypoint; // if inside a function, true if the function is the entry point
bool postMainReturn; // if inside a function, true if the function is the entry point and this is after a return statement
const TType* currentFunctionType; // the return type of the function that's currently being parsed