Add GLSL output of switch and case

BUG=angle:921

Change-Id: I0d752440ce6ffdfcc005f1a6123694bdfeb1b067
Reviewed-on: https://chromium-review.googlesource.com/251526
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index a3db2ee..b769d28 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -36,6 +36,14 @@
     {
         return false;
     }
+    else if (node->getAsSwitchNode())
+    {
+        return false;
+    }
+    else if (node->getAsCaseNode())
+    {
+        return false;
+    }
     return true;
 }
 }  // namespace
@@ -638,16 +646,34 @@
     return false;
 }
 
-bool TOutputGLSLBase::visitSwitch(Visit, TIntermSwitch *)
+bool TOutputGLSLBase::visitSwitch(Visit visit, TIntermSwitch *node)
 {
-    UNIMPLEMENTED();
-    return false;
+    if (node->getStatementList())
+    {
+        writeTriplet(visit, "switch (", ") ", nullptr);
+        // The curly braces get written when visiting the statementList aggregate
+    }
+    else
+    {
+        // No statementList, so it won't output curly braces
+        writeTriplet(visit, "switch (", ") {", "}\n");
+    }
+    return true;
 }
 
-bool TOutputGLSLBase::visitCase(Visit, TIntermCase *)
+bool TOutputGLSLBase::visitCase(Visit visit, TIntermCase *node)
 {
-    UNIMPLEMENTED();
-    return false;
+    if (node->hasCondition())
+    {
+        writeTriplet(visit, "case (", nullptr, "):\n");
+        return true;
+    }
+    else
+    {
+        TInfoSinkBase &out = objSink();
+        out << "default:\n";
+        return false;
+    }
 }
 
 bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)