Adding switch case default keywords
This adds switch/case keywords to glsl.
This makes the shaders that include these
keywords compile, but they don't run
properly yet, partly because the "break"
statement only handles loops currently.
Change-Id: I1f52b445e1124ed3931843c46e27ecc1d9ce3d11
Reviewed-on: https://swiftshader-review.googlesource.com/3400
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/compiler/Intermediate.cpp b/src/OpenGL/compiler/Intermediate.cpp
index ca0f702..62658a4 100644
--- a/src/OpenGL/compiler/Intermediate.cpp
+++ b/src/OpenGL/compiler/Intermediate.cpp
@@ -552,6 +552,22 @@
return node;
}
+TIntermSwitch *TIntermediate::addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &line)
+{
+ TIntermSwitch *node = new TIntermSwitch(init, statementList);
+ node->setLine(line);
+
+ return node;
+}
+
+TIntermCase *TIntermediate::addCase(TIntermTyped *condition, const TSourceLoc &line)
+{
+ TIntermCase *node = new TIntermCase(condition);
+ node->setLine(line);
+
+ return node;
+}
+
//
// Constant terminal nodes. Has a union that contains bool, float or int constants
//