ES31: Implement creation and attaching geometry shader on OpenGL

This patch intends to implement the creation of a geometry shader
and attaching a geometry shader to a program on OpenGL back-ends.

This patch also adds all geometry shader related dEQP-GLES31 test
failures to deqp_gles31_test_expectations.txt.

BUG=angleproject:1941
TEST=angle_end2end_tests

Change-Id: Ib0b497030255b15dacd967e48bc59eef0009af46
Reviewed-on: https://chromium-review.googlesource.com/757979
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ShaderLang.cpp b/src/compiler/translator/ShaderLang.cpp
index 003c40f..fabce78 100644
--- a/src/compiler/translator/ShaderLang.cpp
+++ b/src/compiler/translator/ShaderLang.cpp
@@ -112,6 +112,35 @@
 }
 #endif  // ANGLE_ENABLE_HLSL
 
+GLenum GetGeometryShaderPrimitiveTypeEnum(sh::TLayoutPrimitiveType primitiveType)
+{
+    switch (primitiveType)
+    {
+        case EptPoints:
+            return GL_POINTS;
+        case EptLines:
+            return GL_LINES;
+        case EptLinesAdjacency:
+            return GL_LINES_ADJACENCY_EXT;
+        case EptTriangles:
+            return GL_TRIANGLES;
+        case EptTrianglesAdjacency:
+            return GL_TRIANGLES_ADJACENCY_EXT;
+
+        case EptLineStrip:
+            return GL_LINE_STRIP;
+        case EptTriangleStrip:
+            return GL_TRIANGLE_STRIP;
+
+        case EptUndefined:
+            return GL_INVALID_VALUE;
+
+        default:
+            UNREACHABLE();
+            return GL_INVALID_VALUE;
+    }
+}
+
 }  // anonymous namespace
 
 //
@@ -501,4 +530,48 @@
 #endif  // ANGLE_ENABLE_HLSL
 }
 
+GLenum GetGeometryShaderInputPrimitiveType(const ShHandle handle)
+{
+    ASSERT(handle);
+
+    TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+    TCompiler *compiler = base->getAsCompiler();
+    ASSERT(compiler);
+
+    return GetGeometryShaderPrimitiveTypeEnum(compiler->getGeometryShaderInputPrimitiveType());
+}
+
+GLenum GetGeometryShaderOutputPrimitiveType(const ShHandle handle)
+{
+    ASSERT(handle);
+
+    TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+    TCompiler *compiler = base->getAsCompiler();
+    ASSERT(compiler);
+
+    return GetGeometryShaderPrimitiveTypeEnum(compiler->getGeometryShaderOutputPrimitiveType());
+}
+
+int GetGeometryShaderInvocations(const ShHandle handle)
+{
+    ASSERT(handle);
+
+    TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+    TCompiler *compiler = base->getAsCompiler();
+    ASSERT(compiler);
+
+    return compiler->getGeometryShaderInvocations();
+}
+
+int GetGeometryShaderMaxVertices(const ShHandle handle)
+{
+    ASSERT(handle);
+
+    TShHandleBase *base = static_cast<TShHandleBase *>(handle);
+    TCompiler *compiler = base->getAsCompiler();
+    ASSERT(compiler);
+
+    return compiler->getGeometryShaderMaxVertices();
+}
+
 }  // namespace sh