Add PrimitiveMode packed GLenum.

Bug: angleproject:2574
Change-Id: I3d7bd7ca0d69a364a611dc04799ea34906fc4a6c
Reviewed-on: https://chromium-review.googlesource.com/1067114
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
diff --git a/scripts/entry_point_packed_gl_enums.json b/scripts/entry_point_packed_gl_enums.json
index 39b9001..7c0b475 100644
--- a/scripts/entry_point_packed_gl_enums.json
+++ b/scripts/entry_point_packed_gl_enums.json
@@ -5,6 +5,9 @@
     "glAlphaFuncx": {
         "func": "AlphaTestFunc"
     },
+    "glBeginTransformFeedback": {
+        "primitiveMode": "PrimitiveMode"
+    },
     "glBeginQuery": {
         "target": "QueryType"
     },
@@ -85,6 +88,33 @@
     "glDisableClientState": {
         "array": "ClientVertexArrayType"
     },
+    "glDrawArrays": {
+        "mode": "PrimitiveMode"
+    },
+    "glDrawArraysIndirect": {
+        "mode": "PrimitiveMode"
+    },
+    "glDrawArraysInstanced": {
+        "mode": "PrimitiveMode"
+    },
+    "glDrawArraysInstancedANGLE": {
+        "mode": "PrimitiveMode"
+    },
+    "glDrawElements": {
+        "mode": "PrimitiveMode"
+    },
+    "glDrawElementsIndirect": {
+        "mode": "PrimitiveMode"
+    },
+    "glDrawElementsInstanced": {
+        "mode": "PrimitiveMode"
+    },
+    "glDrawElementsInstancedANGLE": {
+        "mode": "PrimitiveMode"
+    },
+    "glDrawRangeElements": {
+        "mode": "PrimitiveMode"
+    },
     "glEGLImageTargetTexture2DOES": {
         "target": "TextureType"
     },
diff --git a/src/common/PackedGLEnums_autogen.cpp b/src/common/PackedGLEnums_autogen.cpp
index d7b7026..c79831a 100644
--- a/src/common/PackedGLEnums_autogen.cpp
+++ b/src/common/PackedGLEnums_autogen.cpp
@@ -552,6 +552,70 @@
 }
 
 template <>
+PrimitiveMode FromGLenum<PrimitiveMode>(GLenum from)
+{
+    switch (from)
+    {
+        case GL_POINTS:
+            return PrimitiveMode::Points;
+        case GL_LINES:
+            return PrimitiveMode::Lines;
+        case GL_LINE_LOOP:
+            return PrimitiveMode::LineLoop;
+        case GL_LINE_STRIP:
+            return PrimitiveMode::LineStrip;
+        case GL_TRIANGLES:
+            return PrimitiveMode::Triangles;
+        case GL_TRIANGLE_STRIP:
+            return PrimitiveMode::TriangleStrip;
+        case GL_TRIANGLE_FAN:
+            return PrimitiveMode::TriangleFan;
+        case GL_LINES_ADJACENCY_EXT:
+            return PrimitiveMode::LinesAdjacency;
+        case GL_LINE_STRIP_ADJACENCY_EXT:
+            return PrimitiveMode::LineStripAdjacency;
+        case GL_TRIANGLES_ADJACENCY_EXT:
+            return PrimitiveMode::TrianglesAdjacency;
+        case GL_TRIANGLE_STRIP_ADJACENCY_EXT:
+            return PrimitiveMode::TriangleStripAdjacency;
+        default:
+            return PrimitiveMode::InvalidEnum;
+    }
+}
+
+GLenum ToGLenum(PrimitiveMode from)
+{
+    switch (from)
+    {
+        case PrimitiveMode::Points:
+            return GL_POINTS;
+        case PrimitiveMode::Lines:
+            return GL_LINES;
+        case PrimitiveMode::LineLoop:
+            return GL_LINE_LOOP;
+        case PrimitiveMode::LineStrip:
+            return GL_LINE_STRIP;
+        case PrimitiveMode::Triangles:
+            return GL_TRIANGLES;
+        case PrimitiveMode::TriangleStrip:
+            return GL_TRIANGLE_STRIP;
+        case PrimitiveMode::TriangleFan:
+            return GL_TRIANGLE_FAN;
+        case PrimitiveMode::LinesAdjacency:
+            return GL_LINES_ADJACENCY_EXT;
+        case PrimitiveMode::LineStripAdjacency:
+            return GL_LINE_STRIP_ADJACENCY_EXT;
+        case PrimitiveMode::TrianglesAdjacency:
+            return GL_TRIANGLES_ADJACENCY_EXT;
+        case PrimitiveMode::TriangleStripAdjacency:
+            return GL_TRIANGLE_STRIP_ADJACENCY_EXT;
+        default:
+            UNREACHABLE();
+            return 0;
+    }
+}
+
+template <>
 QueryType FromGLenum<QueryType>(GLenum from)
 {
     switch (from)
diff --git a/src/common/PackedGLEnums_autogen.h b/src/common/PackedGLEnums_autogen.h
index ba02a22..1ffe2a7 100644
--- a/src/common/PackedGLEnums_autogen.h
+++ b/src/common/PackedGLEnums_autogen.h
@@ -224,6 +224,28 @@
 MatrixType FromGLenum<MatrixType>(GLenum from);
 GLenum ToGLenum(MatrixType from);
 
+enum class PrimitiveMode : uint8_t
+{
+    Points                 = 0,
+    Lines                  = 1,
+    LineLoop               = 2,
+    LineStrip              = 3,
+    Triangles              = 4,
+    TriangleStrip          = 5,
+    TriangleFan            = 6,
+    LinesAdjacency         = 7,
+    LineStripAdjacency     = 8,
+    TrianglesAdjacency     = 9,
+    TriangleStripAdjacency = 10,
+
+    InvalidEnum = 11,
+    EnumCount   = 11,
+};
+
+template <>
+PrimitiveMode FromGLenum<PrimitiveMode>(GLenum from);
+GLenum ToGLenum(PrimitiveMode from);
+
 enum class QueryType : uint8_t
 {
     AnySamples                         = 0,
diff --git a/src/common/packed_gl_enums.json b/src/common/packed_gl_enums.json
index 050d5d1..e385b1a 100644
--- a/src/common/packed_gl_enums.json
+++ b/src/common/packed_gl_enums.json
@@ -199,5 +199,19 @@
         "SpotCutoff": "GL_SPOT_CUTOFF",
         "SpotDirection": "GL_SPOT_DIRECTION",
         "SpotExponent": "GL_SPOT_EXPONENT"
+    },
+    "PrimitiveMode":
+    {
+        "Points": "GL_POINTS",
+        "Lines": "GL_LINES",
+        "LineLoop": "GL_LINE_LOOP",
+        "LineStrip": "GL_LINE_STRIP",
+        "Triangles": "GL_TRIANGLES",
+        "TriangleStrip": "GL_TRIANGLE_STRIP",
+        "TriangleFan": "GL_TRIANGLE_FAN",
+        "LinesAdjacency": "GL_LINES_ADJACENCY_EXT",
+        "LineStripAdjacency": "GL_LINE_STRIP_ADJACENCY_EXT",
+        "TrianglesAdjacency": "GL_TRIANGLES_ADJACENCY_EXT",
+        "TriangleStripAdjacency": "GL_TRIANGLE_STRIP_ADJACENCY_EXT"
     }
 }
diff --git a/src/common/utilities.cpp b/src/common/utilities.cpp
index 644e46b..460845c 100644
--- a/src/common/utilities.cpp
+++ b/src/common/utilities.cpp
@@ -14,10 +14,10 @@
 #include <set>
 
 #if defined(ANGLE_ENABLE_WINDOWS_STORE)
-#  include <wrl.h>
-#  include <wrl/wrappers/corewrappers.h>
-#  include <windows.applicationmodel.core.h>
-#  include <windows.graphics.display.h>
+#include <windows.applicationmodel.core.h>
+#include <windows.graphics.display.h>
+#include <wrl.h>
+#include <wrl/wrappers/corewrappers.h>
 #endif
 
 namespace
@@ -102,72 +102,72 @@
 
 GLenum VariableComponentType(GLenum type)
 {
-    switch(type)
+    switch (type)
     {
-      case GL_BOOL:
-      case GL_BOOL_VEC2:
-      case GL_BOOL_VEC3:
-      case GL_BOOL_VEC4:
-        return GL_BOOL;
-      case GL_FLOAT:
-      case GL_FLOAT_VEC2:
-      case GL_FLOAT_VEC3:
-      case GL_FLOAT_VEC4:
-      case GL_FLOAT_MAT2:
-      case GL_FLOAT_MAT3:
-      case GL_FLOAT_MAT4:
-      case GL_FLOAT_MAT2x3:
-      case GL_FLOAT_MAT3x2:
-      case GL_FLOAT_MAT2x4:
-      case GL_FLOAT_MAT4x2:
-      case GL_FLOAT_MAT3x4:
-      case GL_FLOAT_MAT4x3:
-        return GL_FLOAT;
-      case GL_INT:
-      case GL_SAMPLER_2D:
-      case GL_SAMPLER_2D_RECT_ANGLE:
-      case GL_SAMPLER_3D:
-      case GL_SAMPLER_CUBE:
-      case GL_SAMPLER_2D_ARRAY:
-      case GL_SAMPLER_EXTERNAL_OES:
-      case GL_SAMPLER_2D_MULTISAMPLE:
-      case GL_INT_SAMPLER_2D:
-      case GL_INT_SAMPLER_3D:
-      case GL_INT_SAMPLER_CUBE:
-      case GL_INT_SAMPLER_2D_ARRAY:
-      case GL_INT_SAMPLER_2D_MULTISAMPLE:
-      case GL_UNSIGNED_INT_SAMPLER_2D:
-      case GL_UNSIGNED_INT_SAMPLER_3D:
-      case GL_UNSIGNED_INT_SAMPLER_CUBE:
-      case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
-      case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
-      case GL_SAMPLER_2D_SHADOW:
-      case GL_SAMPLER_CUBE_SHADOW:
-      case GL_SAMPLER_2D_ARRAY_SHADOW:
-      case GL_INT_VEC2:
-      case GL_INT_VEC3:
-      case GL_INT_VEC4:
-      case GL_IMAGE_2D:
-      case GL_INT_IMAGE_2D:
-      case GL_UNSIGNED_INT_IMAGE_2D:
-      case GL_IMAGE_3D:
-      case GL_INT_IMAGE_3D:
-      case GL_UNSIGNED_INT_IMAGE_3D:
-      case GL_IMAGE_2D_ARRAY:
-      case GL_INT_IMAGE_2D_ARRAY:
-      case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
-      case GL_IMAGE_CUBE:
-      case GL_INT_IMAGE_CUBE:
-      case GL_UNSIGNED_INT_IMAGE_CUBE:
-      case GL_UNSIGNED_INT_ATOMIC_COUNTER:
-          return GL_INT;
-      case GL_UNSIGNED_INT:
-      case GL_UNSIGNED_INT_VEC2:
-      case GL_UNSIGNED_INT_VEC3:
-      case GL_UNSIGNED_INT_VEC4:
-        return GL_UNSIGNED_INT;
-      default:
-        UNREACHABLE();
+        case GL_BOOL:
+        case GL_BOOL_VEC2:
+        case GL_BOOL_VEC3:
+        case GL_BOOL_VEC4:
+            return GL_BOOL;
+        case GL_FLOAT:
+        case GL_FLOAT_VEC2:
+        case GL_FLOAT_VEC3:
+        case GL_FLOAT_VEC4:
+        case GL_FLOAT_MAT2:
+        case GL_FLOAT_MAT3:
+        case GL_FLOAT_MAT4:
+        case GL_FLOAT_MAT2x3:
+        case GL_FLOAT_MAT3x2:
+        case GL_FLOAT_MAT2x4:
+        case GL_FLOAT_MAT4x2:
+        case GL_FLOAT_MAT3x4:
+        case GL_FLOAT_MAT4x3:
+            return GL_FLOAT;
+        case GL_INT:
+        case GL_SAMPLER_2D:
+        case GL_SAMPLER_2D_RECT_ANGLE:
+        case GL_SAMPLER_3D:
+        case GL_SAMPLER_CUBE:
+        case GL_SAMPLER_2D_ARRAY:
+        case GL_SAMPLER_EXTERNAL_OES:
+        case GL_SAMPLER_2D_MULTISAMPLE:
+        case GL_INT_SAMPLER_2D:
+        case GL_INT_SAMPLER_3D:
+        case GL_INT_SAMPLER_CUBE:
+        case GL_INT_SAMPLER_2D_ARRAY:
+        case GL_INT_SAMPLER_2D_MULTISAMPLE:
+        case GL_UNSIGNED_INT_SAMPLER_2D:
+        case GL_UNSIGNED_INT_SAMPLER_3D:
+        case GL_UNSIGNED_INT_SAMPLER_CUBE:
+        case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+        case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+        case GL_SAMPLER_2D_SHADOW:
+        case GL_SAMPLER_CUBE_SHADOW:
+        case GL_SAMPLER_2D_ARRAY_SHADOW:
+        case GL_INT_VEC2:
+        case GL_INT_VEC3:
+        case GL_INT_VEC4:
+        case GL_IMAGE_2D:
+        case GL_INT_IMAGE_2D:
+        case GL_UNSIGNED_INT_IMAGE_2D:
+        case GL_IMAGE_3D:
+        case GL_INT_IMAGE_3D:
+        case GL_UNSIGNED_INT_IMAGE_3D:
+        case GL_IMAGE_2D_ARRAY:
+        case GL_INT_IMAGE_2D_ARRAY:
+        case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+        case GL_IMAGE_CUBE:
+        case GL_INT_IMAGE_CUBE:
+        case GL_UNSIGNED_INT_IMAGE_CUBE:
+        case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+            return GL_INT;
+        case GL_UNSIGNED_INT:
+        case GL_UNSIGNED_INT_VEC2:
+        case GL_UNSIGNED_INT_VEC3:
+        case GL_UNSIGNED_INT_VEC4:
+            return GL_UNSIGNED_INT;
+        default:
+            UNREACHABLE();
     }
 
     return GL_NONE;
@@ -175,13 +175,18 @@
 
 size_t VariableComponentSize(GLenum type)
 {
-    switch(type)
+    switch (type)
     {
-      case GL_BOOL:         return sizeof(GLint);
-      case GL_FLOAT:        return sizeof(GLfloat);
-      case GL_INT:          return sizeof(GLint);
-      case GL_UNSIGNED_INT: return sizeof(GLuint);
-      default:       UNREACHABLE();
+        case GL_BOOL:
+            return sizeof(GLint);
+        case GL_FLOAT:
+            return sizeof(GLfloat);
+        case GL_INT:
+            return sizeof(GLint);
+        case GL_UNSIGNED_INT:
+            return sizeof(GLuint);
+        default:
+            UNREACHABLE();
     }
 
     return 0;
@@ -202,26 +207,26 @@
 {
     switch (type)
     {
-      case GL_FLOAT:
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-        return GL_BOOL;
-      case GL_FLOAT_VEC2:
-      case GL_INT_VEC2:
-      case GL_UNSIGNED_INT_VEC2:
-        return GL_BOOL_VEC2;
-      case GL_FLOAT_VEC3:
-      case GL_INT_VEC3:
-      case GL_UNSIGNED_INT_VEC3:
-        return GL_BOOL_VEC3;
-      case GL_FLOAT_VEC4:
-      case GL_INT_VEC4:
-      case GL_UNSIGNED_INT_VEC4:
-        return GL_BOOL_VEC4;
+        case GL_FLOAT:
+        case GL_INT:
+        case GL_UNSIGNED_INT:
+            return GL_BOOL;
+        case GL_FLOAT_VEC2:
+        case GL_INT_VEC2:
+        case GL_UNSIGNED_INT_VEC2:
+            return GL_BOOL_VEC2;
+        case GL_FLOAT_VEC3:
+        case GL_INT_VEC3:
+        case GL_UNSIGNED_INT_VEC3:
+            return GL_BOOL_VEC3;
+        case GL_FLOAT_VEC4:
+        case GL_INT_VEC4:
+        case GL_UNSIGNED_INT_VEC4:
+            return GL_BOOL_VEC4;
 
-      default:
-        UNREACHABLE();
-        return GL_NONE;
+        default:
+            UNREACHABLE();
+            return GL_NONE;
     }
 }
 
@@ -229,72 +234,72 @@
 {
     switch (type)
     {
-      case GL_NONE:
-        return 0;
-      case GL_BOOL:
-      case GL_FLOAT:
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-      case GL_BOOL_VEC2:
-      case GL_FLOAT_VEC2:
-      case GL_INT_VEC2:
-      case GL_UNSIGNED_INT_VEC2:
-      case GL_BOOL_VEC3:
-      case GL_FLOAT_VEC3:
-      case GL_INT_VEC3:
-      case GL_UNSIGNED_INT_VEC3:
-      case GL_BOOL_VEC4:
-      case GL_FLOAT_VEC4:
-      case GL_INT_VEC4:
-      case GL_UNSIGNED_INT_VEC4:
-      case GL_SAMPLER_2D:
-      case GL_SAMPLER_3D:
-      case GL_SAMPLER_CUBE:
-      case GL_SAMPLER_2D_ARRAY:
-      case GL_SAMPLER_EXTERNAL_OES:
-      case GL_SAMPLER_2D_RECT_ANGLE:
-      case GL_SAMPLER_2D_MULTISAMPLE:
-      case GL_INT_SAMPLER_2D:
-      case GL_INT_SAMPLER_3D:
-      case GL_INT_SAMPLER_CUBE:
-      case GL_INT_SAMPLER_2D_ARRAY:
-      case GL_INT_SAMPLER_2D_MULTISAMPLE:
-      case GL_UNSIGNED_INT_SAMPLER_2D:
-      case GL_UNSIGNED_INT_SAMPLER_3D:
-      case GL_UNSIGNED_INT_SAMPLER_CUBE:
-      case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
-      case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
-      case GL_SAMPLER_2D_SHADOW:
-      case GL_SAMPLER_CUBE_SHADOW:
-      case GL_SAMPLER_2D_ARRAY_SHADOW:
-      case GL_IMAGE_2D:
-      case GL_INT_IMAGE_2D:
-      case GL_UNSIGNED_INT_IMAGE_2D:
-      case GL_IMAGE_2D_ARRAY:
-      case GL_INT_IMAGE_2D_ARRAY:
-      case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
-      case GL_IMAGE_3D:
-      case GL_INT_IMAGE_3D:
-      case GL_UNSIGNED_INT_IMAGE_3D:
-      case GL_IMAGE_CUBE:
-      case GL_INT_IMAGE_CUBE:
-      case GL_UNSIGNED_INT_IMAGE_CUBE:
-      case GL_UNSIGNED_INT_ATOMIC_COUNTER:
-          return 1;
-      case GL_FLOAT_MAT2:
-      case GL_FLOAT_MAT3x2:
-      case GL_FLOAT_MAT4x2:
-        return 2;
-      case GL_FLOAT_MAT3:
-      case GL_FLOAT_MAT2x3:
-      case GL_FLOAT_MAT4x3:
-        return 3;
-      case GL_FLOAT_MAT4:
-      case GL_FLOAT_MAT2x4:
-      case GL_FLOAT_MAT3x4:
-        return 4;
-      default:
-        UNREACHABLE();
+        case GL_NONE:
+            return 0;
+        case GL_BOOL:
+        case GL_FLOAT:
+        case GL_INT:
+        case GL_UNSIGNED_INT:
+        case GL_BOOL_VEC2:
+        case GL_FLOAT_VEC2:
+        case GL_INT_VEC2:
+        case GL_UNSIGNED_INT_VEC2:
+        case GL_BOOL_VEC3:
+        case GL_FLOAT_VEC3:
+        case GL_INT_VEC3:
+        case GL_UNSIGNED_INT_VEC3:
+        case GL_BOOL_VEC4:
+        case GL_FLOAT_VEC4:
+        case GL_INT_VEC4:
+        case GL_UNSIGNED_INT_VEC4:
+        case GL_SAMPLER_2D:
+        case GL_SAMPLER_3D:
+        case GL_SAMPLER_CUBE:
+        case GL_SAMPLER_2D_ARRAY:
+        case GL_SAMPLER_EXTERNAL_OES:
+        case GL_SAMPLER_2D_RECT_ANGLE:
+        case GL_SAMPLER_2D_MULTISAMPLE:
+        case GL_INT_SAMPLER_2D:
+        case GL_INT_SAMPLER_3D:
+        case GL_INT_SAMPLER_CUBE:
+        case GL_INT_SAMPLER_2D_ARRAY:
+        case GL_INT_SAMPLER_2D_MULTISAMPLE:
+        case GL_UNSIGNED_INT_SAMPLER_2D:
+        case GL_UNSIGNED_INT_SAMPLER_3D:
+        case GL_UNSIGNED_INT_SAMPLER_CUBE:
+        case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+        case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+        case GL_SAMPLER_2D_SHADOW:
+        case GL_SAMPLER_CUBE_SHADOW:
+        case GL_SAMPLER_2D_ARRAY_SHADOW:
+        case GL_IMAGE_2D:
+        case GL_INT_IMAGE_2D:
+        case GL_UNSIGNED_INT_IMAGE_2D:
+        case GL_IMAGE_2D_ARRAY:
+        case GL_INT_IMAGE_2D_ARRAY:
+        case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+        case GL_IMAGE_3D:
+        case GL_INT_IMAGE_3D:
+        case GL_UNSIGNED_INT_IMAGE_3D:
+        case GL_IMAGE_CUBE:
+        case GL_INT_IMAGE_CUBE:
+        case GL_UNSIGNED_INT_IMAGE_CUBE:
+        case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+            return 1;
+        case GL_FLOAT_MAT2:
+        case GL_FLOAT_MAT3x2:
+        case GL_FLOAT_MAT4x2:
+            return 2;
+        case GL_FLOAT_MAT3:
+        case GL_FLOAT_MAT2x3:
+        case GL_FLOAT_MAT4x3:
+            return 3;
+        case GL_FLOAT_MAT4:
+        case GL_FLOAT_MAT2x4:
+        case GL_FLOAT_MAT3x4:
+            return 4;
+        default:
+            UNREACHABLE();
     }
 
     return 0;
@@ -304,72 +309,72 @@
 {
     switch (type)
     {
-      case GL_NONE:
-        return 0;
-      case GL_BOOL:
-      case GL_FLOAT:
-      case GL_INT:
-      case GL_UNSIGNED_INT:
-      case GL_SAMPLER_2D:
-      case GL_SAMPLER_3D:
-      case GL_SAMPLER_CUBE:
-      case GL_SAMPLER_2D_ARRAY:
-      case GL_SAMPLER_2D_MULTISAMPLE:
-      case GL_INT_SAMPLER_2D:
-      case GL_INT_SAMPLER_3D:
-      case GL_INT_SAMPLER_CUBE:
-      case GL_INT_SAMPLER_2D_ARRAY:
-      case GL_INT_SAMPLER_2D_MULTISAMPLE:
-      case GL_SAMPLER_EXTERNAL_OES:
-      case GL_SAMPLER_2D_RECT_ANGLE:
-      case GL_UNSIGNED_INT_SAMPLER_2D:
-      case GL_UNSIGNED_INT_SAMPLER_3D:
-      case GL_UNSIGNED_INT_SAMPLER_CUBE:
-      case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
-      case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
-      case GL_SAMPLER_2D_SHADOW:
-      case GL_SAMPLER_CUBE_SHADOW:
-      case GL_SAMPLER_2D_ARRAY_SHADOW:
-      case GL_IMAGE_2D:
-      case GL_INT_IMAGE_2D:
-      case GL_UNSIGNED_INT_IMAGE_2D:
-      case GL_IMAGE_3D:
-      case GL_INT_IMAGE_3D:
-      case GL_UNSIGNED_INT_IMAGE_3D:
-      case GL_IMAGE_2D_ARRAY:
-      case GL_INT_IMAGE_2D_ARRAY:
-      case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
-      case GL_IMAGE_CUBE:
-      case GL_INT_IMAGE_CUBE:
-      case GL_UNSIGNED_INT_IMAGE_CUBE:
-      case GL_UNSIGNED_INT_ATOMIC_COUNTER:
-          return 1;
-      case GL_BOOL_VEC2:
-      case GL_FLOAT_VEC2:
-      case GL_INT_VEC2:
-      case GL_UNSIGNED_INT_VEC2:
-      case GL_FLOAT_MAT2:
-      case GL_FLOAT_MAT2x3:
-      case GL_FLOAT_MAT2x4:
-        return 2;
-      case GL_BOOL_VEC3:
-      case GL_FLOAT_VEC3:
-      case GL_INT_VEC3:
-      case GL_UNSIGNED_INT_VEC3:
-      case GL_FLOAT_MAT3:
-      case GL_FLOAT_MAT3x2:
-      case GL_FLOAT_MAT3x4:
-        return 3;
-      case GL_BOOL_VEC4:
-      case GL_FLOAT_VEC4:
-      case GL_INT_VEC4:
-      case GL_UNSIGNED_INT_VEC4:
-      case GL_FLOAT_MAT4:
-      case GL_FLOAT_MAT4x2:
-      case GL_FLOAT_MAT4x3:
-        return 4;
-      default:
-        UNREACHABLE();
+        case GL_NONE:
+            return 0;
+        case GL_BOOL:
+        case GL_FLOAT:
+        case GL_INT:
+        case GL_UNSIGNED_INT:
+        case GL_SAMPLER_2D:
+        case GL_SAMPLER_3D:
+        case GL_SAMPLER_CUBE:
+        case GL_SAMPLER_2D_ARRAY:
+        case GL_SAMPLER_2D_MULTISAMPLE:
+        case GL_INT_SAMPLER_2D:
+        case GL_INT_SAMPLER_3D:
+        case GL_INT_SAMPLER_CUBE:
+        case GL_INT_SAMPLER_2D_ARRAY:
+        case GL_INT_SAMPLER_2D_MULTISAMPLE:
+        case GL_SAMPLER_EXTERNAL_OES:
+        case GL_SAMPLER_2D_RECT_ANGLE:
+        case GL_UNSIGNED_INT_SAMPLER_2D:
+        case GL_UNSIGNED_INT_SAMPLER_3D:
+        case GL_UNSIGNED_INT_SAMPLER_CUBE:
+        case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+        case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+        case GL_SAMPLER_2D_SHADOW:
+        case GL_SAMPLER_CUBE_SHADOW:
+        case GL_SAMPLER_2D_ARRAY_SHADOW:
+        case GL_IMAGE_2D:
+        case GL_INT_IMAGE_2D:
+        case GL_UNSIGNED_INT_IMAGE_2D:
+        case GL_IMAGE_3D:
+        case GL_INT_IMAGE_3D:
+        case GL_UNSIGNED_INT_IMAGE_3D:
+        case GL_IMAGE_2D_ARRAY:
+        case GL_INT_IMAGE_2D_ARRAY:
+        case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+        case GL_IMAGE_CUBE:
+        case GL_INT_IMAGE_CUBE:
+        case GL_UNSIGNED_INT_IMAGE_CUBE:
+        case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+            return 1;
+        case GL_BOOL_VEC2:
+        case GL_FLOAT_VEC2:
+        case GL_INT_VEC2:
+        case GL_UNSIGNED_INT_VEC2:
+        case GL_FLOAT_MAT2:
+        case GL_FLOAT_MAT2x3:
+        case GL_FLOAT_MAT2x4:
+            return 2;
+        case GL_BOOL_VEC3:
+        case GL_FLOAT_VEC3:
+        case GL_INT_VEC3:
+        case GL_UNSIGNED_INT_VEC3:
+        case GL_FLOAT_MAT3:
+        case GL_FLOAT_MAT3x2:
+        case GL_FLOAT_MAT3x4:
+            return 3;
+        case GL_BOOL_VEC4:
+        case GL_FLOAT_VEC4:
+        case GL_INT_VEC4:
+        case GL_UNSIGNED_INT_VEC4:
+        case GL_FLOAT_MAT4:
+        case GL_FLOAT_MAT4x2:
+        case GL_FLOAT_MAT4x3:
+            return 4;
+        default:
+            UNREACHABLE();
     }
 
     return 0;
@@ -379,27 +384,27 @@
 {
     switch (type)
     {
-      case GL_SAMPLER_2D:
-      case GL_SAMPLER_3D:
-      case GL_SAMPLER_CUBE:
-      case GL_SAMPLER_2D_ARRAY:
-      case GL_SAMPLER_EXTERNAL_OES:
-      case GL_SAMPLER_2D_MULTISAMPLE:
-      case GL_SAMPLER_2D_RECT_ANGLE:
-      case GL_INT_SAMPLER_2D:
-      case GL_INT_SAMPLER_3D:
-      case GL_INT_SAMPLER_CUBE:
-      case GL_INT_SAMPLER_2D_ARRAY:
-      case GL_INT_SAMPLER_2D_MULTISAMPLE:
-      case GL_UNSIGNED_INT_SAMPLER_2D:
-      case GL_UNSIGNED_INT_SAMPLER_3D:
-      case GL_UNSIGNED_INT_SAMPLER_CUBE:
-      case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
-      case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
-      case GL_SAMPLER_2D_SHADOW:
-      case GL_SAMPLER_CUBE_SHADOW:
-      case GL_SAMPLER_2D_ARRAY_SHADOW:
-        return true;
+        case GL_SAMPLER_2D:
+        case GL_SAMPLER_3D:
+        case GL_SAMPLER_CUBE:
+        case GL_SAMPLER_2D_ARRAY:
+        case GL_SAMPLER_EXTERNAL_OES:
+        case GL_SAMPLER_2D_MULTISAMPLE:
+        case GL_SAMPLER_2D_RECT_ANGLE:
+        case GL_INT_SAMPLER_2D:
+        case GL_INT_SAMPLER_3D:
+        case GL_INT_SAMPLER_CUBE:
+        case GL_INT_SAMPLER_2D_ARRAY:
+        case GL_INT_SAMPLER_2D_MULTISAMPLE:
+        case GL_UNSIGNED_INT_SAMPLER_2D:
+        case GL_UNSIGNED_INT_SAMPLER_3D:
+        case GL_UNSIGNED_INT_SAMPLER_CUBE:
+        case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+        case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+        case GL_SAMPLER_2D_SHADOW:
+        case GL_SAMPLER_CUBE_SHADOW:
+        case GL_SAMPLER_2D_ARRAY_SHADOW:
+            return true;
     }
 
     return false;
@@ -451,16 +456,27 @@
 
     switch (type)
     {
-      case GL_FLOAT_MAT2:   return GL_FLOAT_MAT2;
-      case GL_FLOAT_MAT3:   return GL_FLOAT_MAT3;
-      case GL_FLOAT_MAT4:   return GL_FLOAT_MAT4;
-      case GL_FLOAT_MAT2x3: return GL_FLOAT_MAT3x2;
-      case GL_FLOAT_MAT3x2: return GL_FLOAT_MAT2x3;
-      case GL_FLOAT_MAT2x4: return GL_FLOAT_MAT4x2;
-      case GL_FLOAT_MAT4x2: return GL_FLOAT_MAT2x4;
-      case GL_FLOAT_MAT3x4: return GL_FLOAT_MAT4x3;
-      case GL_FLOAT_MAT4x3: return GL_FLOAT_MAT3x4;
-      default: UNREACHABLE(); return GL_NONE;
+        case GL_FLOAT_MAT2:
+            return GL_FLOAT_MAT2;
+        case GL_FLOAT_MAT3:
+            return GL_FLOAT_MAT3;
+        case GL_FLOAT_MAT4:
+            return GL_FLOAT_MAT4;
+        case GL_FLOAT_MAT2x3:
+            return GL_FLOAT_MAT3x2;
+        case GL_FLOAT_MAT3x2:
+            return GL_FLOAT_MAT2x3;
+        case GL_FLOAT_MAT2x4:
+            return GL_FLOAT_MAT4x2;
+        case GL_FLOAT_MAT4x2:
+            return GL_FLOAT_MAT2x4;
+        case GL_FLOAT_MAT3x4:
+            return GL_FLOAT_MAT4x3;
+        case GL_FLOAT_MAT4x3:
+            return GL_FLOAT_MAT3x4;
+        default:
+            UNREACHABLE();
+            return GL_NONE;
     }
 }
 
@@ -485,7 +501,8 @@
 {
     ASSERT(allocationSize <= bitsSize);
 
-    unsigned int mask = std::numeric_limits<unsigned int>::max() >> (std::numeric_limits<unsigned int>::digits - allocationSize);
+    unsigned int mask = std::numeric_limits<unsigned int>::max() >>
+                        (std::numeric_limits<unsigned int>::digits - allocationSize);
 
     for (unsigned int i = 0; i < bitsSize - allocationSize + 1; i++)
     {
@@ -542,20 +559,21 @@
     }
 }
 
-bool IsTriangleMode(GLenum drawMode)
+bool IsTriangleMode(PrimitiveMode drawMode)
 {
     switch (drawMode)
     {
-      case GL_TRIANGLES:
-      case GL_TRIANGLE_FAN:
-      case GL_TRIANGLE_STRIP:
-        return true;
-      case GL_POINTS:
-      case GL_LINES:
-      case GL_LINE_LOOP:
-      case GL_LINE_STRIP:
-        return false;
-      default: UNREACHABLE();
+        case PrimitiveMode::Triangles:
+        case PrimitiveMode::TriangleFan:
+        case PrimitiveMode::TriangleStrip:
+            return true;
+        case PrimitiveMode::Points:
+        case PrimitiveMode::Lines:
+        case PrimitiveMode::LineLoop:
+        case PrimitiveMode::LineStrip:
+            return false;
+        default:
+            UNREACHABLE();
     }
 
     return false;
@@ -582,90 +600,90 @@
 {
     switch (type)
     {
-      // 1. Arrays of mat4 and mat4
-      // Non-square matrices of type matCxR consume the same space as a square
-      // matrix of type matN where N is the greater of C and R
-      case GL_FLOAT_MAT4:
-      case GL_FLOAT_MAT2x4:
-      case GL_FLOAT_MAT3x4:
-      case GL_FLOAT_MAT4x2:
-      case GL_FLOAT_MAT4x3:
-        return 0;
+        // 1. Arrays of mat4 and mat4
+        // Non-square matrices of type matCxR consume the same space as a square
+        // matrix of type matN where N is the greater of C and R
+        case GL_FLOAT_MAT4:
+        case GL_FLOAT_MAT2x4:
+        case GL_FLOAT_MAT3x4:
+        case GL_FLOAT_MAT4x2:
+        case GL_FLOAT_MAT4x3:
+            return 0;
 
-      // 2. Arrays of mat2 and mat2 (since they occupy full rows)
-      case GL_FLOAT_MAT2:
-        return 1;
+        // 2. Arrays of mat2 and mat2 (since they occupy full rows)
+        case GL_FLOAT_MAT2:
+            return 1;
 
-      // 3. Arrays of vec4 and vec4
-      case GL_FLOAT_VEC4:
-      case GL_INT_VEC4:
-      case GL_BOOL_VEC4:
-      case GL_UNSIGNED_INT_VEC4:
-        return 2;
+        // 3. Arrays of vec4 and vec4
+        case GL_FLOAT_VEC4:
+        case GL_INT_VEC4:
+        case GL_BOOL_VEC4:
+        case GL_UNSIGNED_INT_VEC4:
+            return 2;
 
-      // 4. Arrays of mat3 and mat3
-      case GL_FLOAT_MAT3:
-      case GL_FLOAT_MAT2x3:
-      case GL_FLOAT_MAT3x2:
-        return 3;
+        // 4. Arrays of mat3 and mat3
+        case GL_FLOAT_MAT3:
+        case GL_FLOAT_MAT2x3:
+        case GL_FLOAT_MAT3x2:
+            return 3;
 
-      // 5. Arrays of vec3 and vec3
-      case GL_FLOAT_VEC3:
-      case GL_INT_VEC3:
-      case GL_BOOL_VEC3:
-      case GL_UNSIGNED_INT_VEC3:
-        return 4;
+        // 5. Arrays of vec3 and vec3
+        case GL_FLOAT_VEC3:
+        case GL_INT_VEC3:
+        case GL_BOOL_VEC3:
+        case GL_UNSIGNED_INT_VEC3:
+            return 4;
 
-      // 6. Arrays of vec2 and vec2
-      case GL_FLOAT_VEC2:
-      case GL_INT_VEC2:
-      case GL_BOOL_VEC2:
-      case GL_UNSIGNED_INT_VEC2:
-        return 5;
+        // 6. Arrays of vec2 and vec2
+        case GL_FLOAT_VEC2:
+        case GL_INT_VEC2:
+        case GL_BOOL_VEC2:
+        case GL_UNSIGNED_INT_VEC2:
+            return 5;
 
-      // 7. Single component types
-      case GL_FLOAT:
-      case GL_INT:
-      case GL_BOOL:
-      case GL_UNSIGNED_INT:
-      case GL_SAMPLER_2D:
-      case GL_SAMPLER_CUBE:
-      case GL_SAMPLER_EXTERNAL_OES:
-      case GL_SAMPLER_2D_RECT_ANGLE:
-      case GL_SAMPLER_2D_ARRAY:
-      case GL_SAMPLER_2D_MULTISAMPLE:
-      case GL_SAMPLER_3D:
-      case GL_INT_SAMPLER_2D:
-      case GL_INT_SAMPLER_3D:
-      case GL_INT_SAMPLER_CUBE:
-      case GL_INT_SAMPLER_2D_ARRAY:
-      case GL_INT_SAMPLER_2D_MULTISAMPLE:
-      case GL_UNSIGNED_INT_SAMPLER_2D:
-      case GL_UNSIGNED_INT_SAMPLER_3D:
-      case GL_UNSIGNED_INT_SAMPLER_CUBE:
-      case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
-      case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
-      case GL_SAMPLER_2D_SHADOW:
-      case GL_SAMPLER_2D_ARRAY_SHADOW:
-      case GL_SAMPLER_CUBE_SHADOW:
-      case GL_IMAGE_2D:
-      case GL_INT_IMAGE_2D:
-      case GL_UNSIGNED_INT_IMAGE_2D:
-      case GL_IMAGE_3D:
-      case GL_INT_IMAGE_3D:
-      case GL_UNSIGNED_INT_IMAGE_3D:
-      case GL_IMAGE_2D_ARRAY:
-      case GL_INT_IMAGE_2D_ARRAY:
-      case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
-      case GL_IMAGE_CUBE:
-      case GL_INT_IMAGE_CUBE:
-      case GL_UNSIGNED_INT_IMAGE_CUBE:
-      case GL_UNSIGNED_INT_ATOMIC_COUNTER:
-          return 6;
+        // 7. Single component types
+        case GL_FLOAT:
+        case GL_INT:
+        case GL_BOOL:
+        case GL_UNSIGNED_INT:
+        case GL_SAMPLER_2D:
+        case GL_SAMPLER_CUBE:
+        case GL_SAMPLER_EXTERNAL_OES:
+        case GL_SAMPLER_2D_RECT_ANGLE:
+        case GL_SAMPLER_2D_ARRAY:
+        case GL_SAMPLER_2D_MULTISAMPLE:
+        case GL_SAMPLER_3D:
+        case GL_INT_SAMPLER_2D:
+        case GL_INT_SAMPLER_3D:
+        case GL_INT_SAMPLER_CUBE:
+        case GL_INT_SAMPLER_2D_ARRAY:
+        case GL_INT_SAMPLER_2D_MULTISAMPLE:
+        case GL_UNSIGNED_INT_SAMPLER_2D:
+        case GL_UNSIGNED_INT_SAMPLER_3D:
+        case GL_UNSIGNED_INT_SAMPLER_CUBE:
+        case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+        case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
+        case GL_SAMPLER_2D_SHADOW:
+        case GL_SAMPLER_2D_ARRAY_SHADOW:
+        case GL_SAMPLER_CUBE_SHADOW:
+        case GL_IMAGE_2D:
+        case GL_INT_IMAGE_2D:
+        case GL_UNSIGNED_INT_IMAGE_2D:
+        case GL_IMAGE_3D:
+        case GL_INT_IMAGE_3D:
+        case GL_UNSIGNED_INT_IMAGE_3D:
+        case GL_IMAGE_2D_ARRAY:
+        case GL_INT_IMAGE_2D_ARRAY:
+        case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
+        case GL_IMAGE_CUBE:
+        case GL_INT_IMAGE_CUBE:
+        case GL_UNSIGNED_INT_IMAGE_CUBE:
+        case GL_UNSIGNED_INT_ATOMIC_COUNTER:
+            return 6;
 
-      default:
-        UNREACHABLE();
-        return 0;
+        default:
+            UNREACHABLE();
+            return 0;
     }
 }
 
@@ -980,9 +998,9 @@
 #endif
 }
 
-void writeFile(const char* path, const void* content, size_t size)
+void writeFile(const char *path, const void *content, size_t size)
 {
-    FILE* file = fopen(path, "w");
+    FILE *file = fopen(path, "w");
     if (!file)
     {
         UNREACHABLE();
@@ -992,9 +1010,9 @@
     fwrite(content, sizeof(char), size, file);
     fclose(file);
 }
-#endif // !ANGLE_ENABLE_WINDOWS_STORE
+#endif  // !ANGLE_ENABLE_WINDOWS_STORE
 
-#if defined (ANGLE_PLATFORM_WINDOWS)
+#if defined(ANGLE_PLATFORM_WINDOWS)
 
 // Causes the thread to relinquish the remainder of its time slice to any
 // other thread that is ready to run.If there are no other threads ready
diff --git a/src/common/utilities.h b/src/common/utilities.h
index 8fc2848..b162cff 100644
--- a/src/common/utilities.h
+++ b/src/common/utilities.h
@@ -17,6 +17,7 @@
 #include <vector>
 #include "angle_gl.h"
 
+#include "common/PackedEnums.h"
 #include "common/mathutil.h"
 
 namespace sh
@@ -70,7 +71,7 @@
 // Get the primitive restart index value for the given index type.
 GLuint GetPrimitiveRestartIndex(GLenum indexType);
 
-bool IsTriangleMode(GLenum drawMode);
+bool IsTriangleMode(PrimitiveMode drawMode);
 bool IsIntegerFormat(GLenum unsizedFormat);
 
 // Returns the product of the sizes in the vector, or 1 if the vector is empty. Doesn't currently
@@ -142,7 +143,7 @@
 namespace egl
 {
 static const EGLenum FirstCubeMapTextureTarget = EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR;
-static const EGLenum LastCubeMapTextureTarget = EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR;
+static const EGLenum LastCubeMapTextureTarget  = EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR;
 bool IsCubeMapTextureTarget(EGLenum target);
 size_t CubeMapTextureTargetToLayerIndex(EGLenum target);
 EGLenum LayerIndexToCubeMapTextureTarget(size_t index);
@@ -164,10 +165,10 @@
 
 #if !defined(ANGLE_ENABLE_WINDOWS_STORE)
 std::string getTempPath();
-void writeFile(const char* path, const void* data, size_t size);
+void writeFile(const char *path, const void *data, size_t size);
 #endif
 
-#if defined (ANGLE_PLATFORM_WINDOWS)
+#if defined(ANGLE_PLATFORM_WINDOWS)
 void ScheduleYield();
 #endif
 
diff --git a/src/libANGLE/AttributeMap.h b/src/libANGLE/AttributeMap.h
index 1845313..4ece6ed 100644
--- a/src/libANGLE/AttributeMap.h
+++ b/src/libANGLE/AttributeMap.h
@@ -61,7 +61,6 @@
   private:
     std::map<EGLAttrib, EGLAttrib> mAttributes;
 };
-
 }
 
-#endif   // LIBANGLE_ATTRIBUTEMAP_H_
+#endif  // LIBANGLE_ATTRIBUTEMAP_H_
diff --git a/src/libANGLE/Compiler.h b/src/libANGLE/Compiler.h
index b7fa236..6c0401a 100644
--- a/src/libANGLE/Compiler.h
+++ b/src/libANGLE/Compiler.h
@@ -46,4 +46,4 @@
 
 }  // namespace gl
 
-#endif // LIBANGLE_COMPILER_H_
+#endif  // LIBANGLE_COMPILER_H_
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 1441f71..e38b85d 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -2060,7 +2060,7 @@
     UNIMPLEMENTED();
 }
 
-void Context::drawArrays(GLenum mode, GLint first, GLsizei count)
+void Context::drawArrays(PrimitiveMode mode, GLint first, GLsizei count)
 {
     // No-op if zero count
     if (count == 0)
@@ -2073,7 +2073,10 @@
     MarkTransformFeedbackBufferUsage(this, mGLState.getCurrentTransformFeedback(), count, 1);
 }
 
-void Context::drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
+void Context::drawArraysInstanced(PrimitiveMode mode,
+                                  GLint first,
+                                  GLsizei count,
+                                  GLsizei instanceCount)
 {
     // No-op if zero count
     if (count == 0 || instanceCount == 0)
@@ -2088,7 +2091,7 @@
                                      instanceCount);
 }
 
-void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices)
+void Context::drawElements(PrimitiveMode mode, GLsizei count, GLenum type, const void *indices)
 {
     // No-op if zero count
     if (count == 0)
@@ -2100,7 +2103,7 @@
     ANGLE_CONTEXT_TRY(mImplementation->drawElements(this, mode, count, type, indices));
 }
 
-void Context::drawElementsInstanced(GLenum mode,
+void Context::drawElementsInstanced(PrimitiveMode mode,
                                     GLsizei count,
                                     GLenum type,
                                     const void *indices,
@@ -2117,7 +2120,7 @@
         mImplementation->drawElementsInstanced(this, mode, count, type, indices, instances));
 }
 
-void Context::drawRangeElements(GLenum mode,
+void Context::drawRangeElements(PrimitiveMode mode,
                                 GLuint start,
                                 GLuint end,
                                 GLsizei count,
@@ -2135,13 +2138,13 @@
         mImplementation->drawRangeElements(this, mode, start, end, count, type, indices));
 }
 
-void Context::drawArraysIndirect(GLenum mode, const void *indirect)
+void Context::drawArraysIndirect(PrimitiveMode mode, const void *indirect)
 {
     ANGLE_CONTEXT_TRY(prepareForDraw());
     ANGLE_CONTEXT_TRY(mImplementation->drawArraysIndirect(this, mode, indirect));
 }
 
-void Context::drawElementsIndirect(GLenum mode, GLenum type, const void *indirect)
+void Context::drawElementsIndirect(PrimitiveMode mode, GLenum type, const void *indirect)
 {
     ANGLE_CONTEXT_TRY(prepareForDraw());
     ANGLE_CONTEXT_TRY(mImplementation->drawElementsIndirect(this, mode, type, indirect));
@@ -2999,7 +3002,7 @@
     return mRequestableExtensionStrings.size();
 }
 
-void Context::beginTransformFeedback(GLenum primitiveMode)
+void Context::beginTransformFeedback(PrimitiveMode primitiveMode)
 {
     TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
     ASSERT(transformFeedback != nullptr);
@@ -3109,7 +3112,7 @@
 
     mSupportedExtensions =
         generateSupportedExtensions(displayExtensions, clientExtensions, robustResourceInit);
-    mExtensions          = mSupportedExtensions;
+    mExtensions = mSupportedExtensions;
 
     mLimitations = mImplementation->getNativeLimitations();
 
diff --git a/src/libANGLE/Context.h b/src/libANGLE/Context.h
index 56c1b45..4377e79 100644
--- a/src/libANGLE/Context.h
+++ b/src/libANGLE/Context.h
@@ -534,23 +534,23 @@
     void clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values);
     void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
 
-    void drawArrays(GLenum mode, GLint first, GLsizei count);
-    void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
+    void drawArrays(PrimitiveMode mode, GLint first, GLsizei count);
+    void drawArraysInstanced(PrimitiveMode mode, GLint first, GLsizei count, GLsizei instanceCount);
 
-    void drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
-    void drawElementsInstanced(GLenum mode,
+    void drawElements(PrimitiveMode mode, GLsizei count, GLenum type, const void *indices);
+    void drawElementsInstanced(PrimitiveMode mode,
                                GLsizei count,
                                GLenum type,
                                const void *indices,
                                GLsizei instances);
-    void drawRangeElements(GLenum mode,
+    void drawRangeElements(PrimitiveMode mode,
                            GLuint start,
                            GLuint end,
                            GLsizei count,
                            GLenum type,
                            const void *indices);
-    void drawArraysIndirect(GLenum mode, const void *indirect);
-    void drawElementsIndirect(GLenum mode, GLenum type, const void *indirect);
+    void drawArraysIndirect(PrimitiveMode mode, const void *indirect);
+    void drawElementsIndirect(PrimitiveMode mode, GLenum type, const void *indirect);
 
     void blitFramebuffer(GLint srcX0,
                          GLint srcY0,
@@ -868,7 +868,7 @@
                          GLbitfield access);
     void flushMappedBufferRange(BufferBinding target, GLintptr offset, GLsizeiptr length);
 
-    void beginTransformFeedback(GLenum primitiveMode);
+    void beginTransformFeedback(PrimitiveMode primitiveMode);
 
     bool hasActiveTransformFeedback(GLuint program) const;
 
diff --git a/src/libANGLE/ImageIndex.h b/src/libANGLE/ImageIndex.h
index 302c69a..71f5232 100644
--- a/src/libANGLE/ImageIndex.h
+++ b/src/libANGLE/ImageIndex.h
@@ -115,4 +115,4 @@
 };
 }  // namespace gl
 
-#endif // LIBANGLE_IMAGE_INDEX_H_
+#endif  // LIBANGLE_IMAGE_INDEX_H_
diff --git a/src/libANGLE/MemoryProgramCache.cpp b/src/libANGLE/MemoryProgramCache.cpp
index e9340c61b..cf10b1c 100644
--- a/src/libANGLE/MemoryProgramCache.cpp
+++ b/src/libANGLE/MemoryProgramCache.cpp
@@ -80,8 +80,8 @@
 
 void LoadShaderVariableBuffer(BinaryInputStream *stream, ShaderVariableBuffer *var)
 {
-    var->binding           = stream->readInt<int>();
-    var->dataSize          = stream->readInt<unsigned int>();
+    var->binding  = stream->readInt<int>();
+    var->dataSize = stream->readInt<unsigned int>();
 
     for (ShaderType shaderType : AllShaderTypes())
     {
@@ -239,8 +239,8 @@
     state->mComputeShaderLocalSize[1] = stream.readInt<int>();
     state->mComputeShaderLocalSize[2] = stream.readInt<int>();
 
-    state->mGeometryShaderInputPrimitiveType  = stream.readInt<GLenum>();
-    state->mGeometryShaderOutputPrimitiveType = stream.readInt<GLenum>();
+    state->mGeometryShaderInputPrimitiveType  = stream.readEnum<PrimitiveMode>();
+    state->mGeometryShaderOutputPrimitiveType = stream.readEnum<PrimitiveMode>();
     state->mGeometryShaderInvocations         = stream.readInt<int>();
     state->mGeometryShaderMaxVertices         = stream.readInt<int>();
 
@@ -400,19 +400,19 @@
     unsigned int samplerRangeLow  = stream.readInt<unsigned int>();
     unsigned int samplerRangeHigh = stream.readInt<unsigned int>();
     state->mSamplerUniformRange   = RangeUI(samplerRangeLow, samplerRangeHigh);
-    unsigned int samplerCount = stream.readInt<unsigned int>();
+    unsigned int samplerCount     = stream.readInt<unsigned int>();
     for (unsigned int samplerIndex = 0; samplerIndex < samplerCount; ++samplerIndex)
     {
         TextureType textureType = stream.readEnum<TextureType>();
-        size_t bindingCount = stream.readInt<size_t>();
-        bool unreferenced   = stream.readBool();
+        size_t bindingCount     = stream.readInt<size_t>();
+        bool unreferenced       = stream.readBool();
         state->mSamplerBindings.emplace_back(
             SamplerBinding(textureType, bindingCount, unreferenced));
     }
 
-    unsigned int imageRangeLow  = stream.readInt<unsigned int>();
-    unsigned int imageRangeHigh = stream.readInt<unsigned int>();
-    state->mImageUniformRange   = RangeUI(imageRangeLow, imageRangeHigh);
+    unsigned int imageRangeLow     = stream.readInt<unsigned int>();
+    unsigned int imageRangeHigh    = stream.readInt<unsigned int>();
+    state->mImageUniformRange      = RangeUI(imageRangeLow, imageRangeHigh);
     unsigned int imageBindingCount = stream.readInt<unsigned int>();
     for (unsigned int imageIndex = 0; imageIndex < imageBindingCount; ++imageIndex)
     {
@@ -469,8 +469,8 @@
     stream.writeInt(computeLocalSize[2]);
 
     ASSERT(state.mGeometryShaderInvocations >= 1 && state.mGeometryShaderMaxVertices >= 0);
-    stream.writeInt(state.mGeometryShaderInputPrimitiveType);
-    stream.writeInt(state.mGeometryShaderOutputPrimitiveType);
+    stream.writeEnum(state.mGeometryShaderInputPrimitiveType);
+    stream.writeEnum(state.mGeometryShaderOutputPrimitiveType);
     stream.writeInt(state.mGeometryShaderInvocations);
     stream.writeInt(state.mGeometryShaderMaxVertices);
 
diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
index de06eb3..e0a697e 100644
--- a/src/libANGLE/Program.cpp
+++ b/src/libANGLE/Program.cpp
@@ -660,8 +660,7 @@
         {
             msg.erase(found, strlen(g_fakepath));
         }
-    }
-    while (found != std::string::npos);
+    } while (found != std::string::npos);
 
     *mLazyStream << message << std::endl;
 }
@@ -792,8 +791,8 @@
       mBinaryRetrieveableHint(false),
       mNumViews(-1),
       // [GL_EXT_geometry_shader] Table 20.22
-      mGeometryShaderInputPrimitiveType(GL_TRIANGLES),
-      mGeometryShaderOutputPrimitiveType(GL_TRIANGLE_STRIP),
+      mGeometryShaderInputPrimitiveType(PrimitiveMode::Triangles),
+      mGeometryShaderOutputPrimitiveType(PrimitiveMode::TriangleStrip),
       mGeometryShaderInvocations(1),
       mGeometryShaderMaxVertices(0)
 {
@@ -1306,9 +1305,9 @@
     mState.mComputeShaderLocalSize.fill(1);
     mState.mSamplerBindings.clear();
     mState.mImageBindings.clear();
-    mState.mNumViews = -1;
-    mState.mGeometryShaderInputPrimitiveType  = GL_TRIANGLES;
-    mState.mGeometryShaderOutputPrimitiveType = GL_TRIANGLE_STRIP;
+    mState.mNumViews                          = -1;
+    mState.mGeometryShaderInputPrimitiveType  = PrimitiveMode::Triangles;
+    mState.mGeometryShaderOutputPrimitiveType = PrimitiveMode::TriangleStrip;
     mState.mGeometryShaderInvocations         = 1;
     mState.mGeometryShaderMaxVertices         = 0;
 
@@ -1376,15 +1375,15 @@
             *length = 0;
         }
 
-        // TODO: This should be moved to the validation layer but computing the size of the binary before saving
-        // it causes the save to happen twice.  It may be possible to write the binary to a separate buffer, validate
-        // sizes and then copy it.
+        // TODO: This should be moved to the validation layer but computing the size of the binary
+        // before saving it causes the save to happen twice.  It may be possible to write the binary
+        // to a separate buffer, validate sizes and then copy it.
         return InternalError();
     }
 
     if (binary)
     {
-        char *ptr = reinterpret_cast<char*>(binary);
+        char *ptr = reinterpret_cast<char *>(binary);
 
         memcpy(ptr, streamState, streamLength);
         ptr += streamLength;
@@ -1863,55 +1862,82 @@
     mProgram->setUniform4uiv(location, clampedCount, v);
 }
 
-void Program::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+void Program::setUniformMatrix2fv(GLint location,
+                                  GLsizei count,
+                                  GLboolean transpose,
+                                  const GLfloat *v)
 {
     GLsizei clampedCount = clampMatrixUniformCount<2, 2>(location, count, transpose, v);
     mProgram->setUniformMatrix2fv(location, clampedCount, transpose, v);
 }
 
-void Program::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+void Program::setUniformMatrix3fv(GLint location,
+                                  GLsizei count,
+                                  GLboolean transpose,
+                                  const GLfloat *v)
 {
     GLsizei clampedCount = clampMatrixUniformCount<3, 3>(location, count, transpose, v);
     mProgram->setUniformMatrix3fv(location, clampedCount, transpose, v);
 }
 
-void Program::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+void Program::setUniformMatrix4fv(GLint location,
+                                  GLsizei count,
+                                  GLboolean transpose,
+                                  const GLfloat *v)
 {
     GLsizei clampedCount = clampMatrixUniformCount<4, 4>(location, count, transpose, v);
     mProgram->setUniformMatrix4fv(location, clampedCount, transpose, v);
 }
 
-void Program::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+void Program::setUniformMatrix2x3fv(GLint location,
+                                    GLsizei count,
+                                    GLboolean transpose,
+                                    const GLfloat *v)
 {
     GLsizei clampedCount = clampMatrixUniformCount<2, 3>(location, count, transpose, v);
     mProgram->setUniformMatrix2x3fv(location, clampedCount, transpose, v);
 }
 
-void Program::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+void Program::setUniformMatrix2x4fv(GLint location,
+                                    GLsizei count,
+                                    GLboolean transpose,
+                                    const GLfloat *v)
 {
     GLsizei clampedCount = clampMatrixUniformCount<2, 4>(location, count, transpose, v);
     mProgram->setUniformMatrix2x4fv(location, clampedCount, transpose, v);
 }
 
-void Program::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+void Program::setUniformMatrix3x2fv(GLint location,
+                                    GLsizei count,
+                                    GLboolean transpose,
+                                    const GLfloat *v)
 {
     GLsizei clampedCount = clampMatrixUniformCount<3, 2>(location, count, transpose, v);
     mProgram->setUniformMatrix3x2fv(location, clampedCount, transpose, v);
 }
 
-void Program::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+void Program::setUniformMatrix3x4fv(GLint location,
+                                    GLsizei count,
+                                    GLboolean transpose,
+                                    const GLfloat *v)
 {
     GLsizei clampedCount = clampMatrixUniformCount<3, 4>(location, count, transpose, v);
     mProgram->setUniformMatrix3x4fv(location, clampedCount, transpose, v);
 }
 
-void Program::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+void Program::setUniformMatrix4x2fv(GLint location,
+                                    GLsizei count,
+                                    GLboolean transpose,
+                                    const GLfloat *v)
 {
     GLsizei clampedCount = clampMatrixUniformCount<4, 2>(location, count, transpose, v);
     mProgram->setUniformMatrix4x2fv(location, clampedCount, transpose, v);
 }
 
-void Program::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+void Program::setUniformMatrix4x3fv(GLint location,
+                                    GLsizei count,
+                                    GLboolean transpose,
+                                    const GLfloat *v)
 {
     GLsizei clampedCount = clampMatrixUniformCount<4, 3>(location, count, transpose, v);
     mProgram->setUniformMatrix4x3fv(location, clampedCount, transpose, v);
@@ -2168,7 +2194,9 @@
     return mState.getShaderStorageBlockBinding(shaderStorageBlockIndex);
 }
 
-void Program::setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
+void Program::setTransformFeedbackVaryings(GLsizei count,
+                                           const GLchar *const *varyings,
+                                           GLenum bufferMode)
 {
     mState.mTransformFeedbackVaryingNames.resize(count);
     for (GLsizei i = 0; i < count; i++)
@@ -2179,7 +2207,12 @@
     mState.mTransformFeedbackBufferMode = bufferMode;
 }
 
-void Program::getTransformFeedbackVarying(GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) const
+void Program::getTransformFeedbackVarying(GLuint index,
+                                          GLsizei bufSize,
+                                          GLsizei *length,
+                                          GLsizei *size,
+                                          GLenum *type,
+                                          GLchar *name) const
 {
     if (mLinked)
     {
@@ -2250,7 +2283,7 @@
     Shader *computeShader  = mState.mAttachedShaders[ShaderType::Compute];
     Shader *geometryShader = mState.mAttachedShaders[ShaderType::Geometry];
 
-    bool isComputeShaderAttached  = (computeShader != nullptr);
+    bool isComputeShaderAttached = (computeShader != nullptr);
     bool isGraphicsShaderAttached =
         (vertexShader != nullptr || fragmentShader != nullptr || geometryShader != nullptr);
     // Check whether we both have a compute and non-compute shaders attached.
@@ -2329,7 +2362,7 @@
             }
             ASSERT(geometryShader->getType() == ShaderType::Geometry);
 
-            Optional<GLenum> inputPrimitive =
+            Optional<PrimitiveMode> inputPrimitive =
                 geometryShader->getGeometryShaderInputPrimitiveType(context);
             if (!inputPrimitive.valid())
             {
@@ -2337,7 +2370,7 @@
                 return false;
             }
 
-            Optional<GLenum> outputPrimitive =
+            Optional<PrimitiveMode> outputPrimitive =
                 geometryShader->getGeometryShaderOutputPrimitiveType(context);
             if (!outputPrimitive.valid())
             {
@@ -2612,13 +2645,13 @@
 {
     for (unsigned int index : mState.mAtomicCounterUniformRange)
     {
-        auto &uniform = mState.mUniforms[index];
+        auto &uniform                      = mState.mUniforms[index];
         uniform.blockInfo.offset           = uniform.offset;
         uniform.blockInfo.arrayStride      = (uniform.isArray() ? 4 : 0);
         uniform.blockInfo.matrixStride     = 0;
         uniform.blockInfo.isRowMajorMatrix = false;
 
-        bool found    = false;
+        bool found = false;
         for (unsigned int bufferIndex = 0; bufferIndex < mState.mAtomicCounterBuffers.size();
              ++bufferIndex)
         {
@@ -2668,7 +2701,7 @@
         // In GLSL ES 1.00.17 we only do aliasing checks for active attributes.
         mState.mAttributes = vertexShader->getActiveAttributes(context);
     }
-    GLuint maxAttribs          = data.getCaps().maxVertexAttributes;
+    GLuint maxAttribs = data.getCaps().maxVertexAttributes;
 
     // TODO(jmadill): handle aliasing robustly
     if (mState.mAttributes.size() > maxAttribs)
diff --git a/src/libANGLE/Program.h b/src/libANGLE/Program.h
index 092e24f..9610782 100644
--- a/src/libANGLE/Program.h
+++ b/src/libANGLE/Program.h
@@ -20,9 +20,9 @@
 #include <string>
 #include <vector>
 
+#include "common/Optional.h"
 #include "common/angleutils.h"
 #include "common/mathutil.h"
-#include "common/Optional.h"
 
 #include "libANGLE/Constants.h"
 #include "libANGLE/Debug.h"
@@ -50,7 +50,7 @@
 class Buffer;
 class Framebuffer;
 
-extern const char * const g_fakepath;
+extern const char *const g_fakepath;
 
 enum class LinkMismatchError
 {
@@ -93,11 +93,7 @@
     class StreamHelper : angle::NonCopyable
     {
       public:
-        StreamHelper(StreamHelper &&rhs)
-            : mStream(rhs.mStream)
-        {
-            rhs.mStream = nullptr;
-        }
+        StreamHelper(StreamHelper &&rhs) : mStream(rhs.mStream) { rhs.mStream = nullptr; }
 
         StreamHelper &operator=(StreamHelper &&rhs)
         {
@@ -124,11 +120,7 @@
       private:
         friend class InfoLog;
 
-        StreamHelper(std::stringstream *stream)
-            : mStream(stream)
-        {
-            ASSERT(stream);
-        }
+        StreamHelper(std::stringstream *stream) : mStream(stream) { ASSERT(stream); }
 
         std::stringstream *mStream;
     };
@@ -427,8 +419,8 @@
     int mNumViews;
 
     // GL_EXT_geometry_shader.
-    GLenum mGeometryShaderInputPrimitiveType;
-    GLenum mGeometryShaderOutputPrimitiveType;
+    PrimitiveMode mGeometryShaderInputPrimitiveType;
+    PrimitiveMode mGeometryShaderOutputPrimitiveType;
     int mGeometryShaderInvocations;
     int mGeometryShaderMaxVertices;
 
@@ -585,15 +577,42 @@
     void setUniform2uiv(GLint location, GLsizei count, const GLuint *v);
     void setUniform3uiv(GLint location, GLsizei count, const GLuint *v);
     void setUniform4uiv(GLint location, GLsizei count, const GLuint *v);
-    void setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    void setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    void setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    void setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    void setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    void setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    void setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    void setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    void setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix2fv(GLint location,
+                             GLsizei count,
+                             GLboolean transpose,
+                             const GLfloat *value);
+    void setUniformMatrix3fv(GLint location,
+                             GLsizei count,
+                             GLboolean transpose,
+                             const GLfloat *value);
+    void setUniformMatrix4fv(GLint location,
+                             GLsizei count,
+                             GLboolean transpose,
+                             const GLfloat *value);
+    void setUniformMatrix2x3fv(GLint location,
+                               GLsizei count,
+                               GLboolean transpose,
+                               const GLfloat *value);
+    void setUniformMatrix3x2fv(GLint location,
+                               GLsizei count,
+                               GLboolean transpose,
+                               const GLfloat *value);
+    void setUniformMatrix2x4fv(GLint location,
+                               GLsizei count,
+                               GLboolean transpose,
+                               const GLfloat *value);
+    void setUniformMatrix4x2fv(GLint location,
+                               GLsizei count,
+                               GLboolean transpose,
+                               const GLfloat *value);
+    void setUniformMatrix3x4fv(GLint location,
+                               GLsizei count,
+                               GLboolean transpose,
+                               const GLfloat *value);
+    void setUniformMatrix4x3fv(GLint location,
+                               GLsizei count,
+                               GLboolean transpose,
+                               const GLfloat *value);
 
     void getUniformfv(const Context *context, GLint location, GLfloat *params) const;
     void getUniformiv(const Context *context, GLint location, GLint *params) const;
@@ -623,8 +642,15 @@
     const InterfaceBlock &getUniformBlockByIndex(GLuint index) const;
     const InterfaceBlock &getShaderStorageBlockByIndex(GLuint index) const;
 
-    void setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode);
-    void getTransformFeedbackVarying(GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) const;
+    void setTransformFeedbackVaryings(GLsizei count,
+                                      const GLchar *const *varyings,
+                                      GLenum bufferMode);
+    void getTransformFeedbackVarying(GLuint index,
+                                     GLsizei bufSize,
+                                     GLsizei *length,
+                                     GLsizei *size,
+                                     GLenum *type,
+                                     GLchar *name) const;
     GLsizei getTransformFeedbackVaryingCount() const;
     GLsizei getTransformFeedbackVaryingMaxLength() const;
     GLenum getTransformFeedbackBufferMode() const;
@@ -658,11 +684,11 @@
         return mState.mComputeShaderLocalSize;
     }
 
-    GLenum getGeometryShaderInputPrimitiveType() const
+    PrimitiveMode getGeometryShaderInputPrimitiveType() const
     {
         return mState.mGeometryShaderInputPrimitiveType;
     }
-    GLenum getGeometryShaderOutputPrimitiveType() const
+    PrimitiveMode getGeometryShaderOutputPrimitiveType() const
     {
         return mState.mGeometryShaderOutputPrimitiveType;
     }
@@ -806,7 +832,7 @@
     ProgramBindings mFragmentInputBindings;
 
     bool mLinked;
-    bool mDeleteStatus;   // Flag to indicate that the program can be deleted when no longer in use
+    bool mDeleteStatus;  // Flag to indicate that the program can be deleted when no longer in use
 
     unsigned int mRefCount;
 
@@ -821,4 +847,4 @@
 };
 }  // namespace gl
 
-#endif   // LIBANGLE_PROGRAM_H_
+#endif  // LIBANGLE_PROGRAM_H_
diff --git a/src/libANGLE/ProgramLinkedResources.h b/src/libANGLE/ProgramLinkedResources.h
index ade7d64..e0e086d 100644
--- a/src/libANGLE/ProgramLinkedResources.h
+++ b/src/libANGLE/ProgramLinkedResources.h
@@ -228,11 +228,11 @@
                                        int blockIndex,
                                        const sh::BlockMemberInfo &memberInfo,
                                        int topLevelArraySize,
-                                       ShaderType shaderType) const             = 0;
-    virtual size_t getCurrentBlockMemberIndex() const                           = 0;
+                                       ShaderType shaderType) const = 0;
+    virtual size_t getCurrentBlockMemberIndex() const               = 0;
     virtual void updateBlockMemberActiveImpl(const std::string &fullName,
                                              ShaderType shaderType,
-                                             bool active) const                 = 0;
+                                             bool active) const     = 0;
 
     ShaderMap<const std::vector<sh::InterfaceBlock> *> mShaderBlocks;
 
diff --git a/src/libANGLE/Query.h b/src/libANGLE/Query.h
index 7c43cd3..05580ae 100644
--- a/src/libANGLE/Query.h
+++ b/src/libANGLE/Query.h
@@ -55,7 +55,6 @@
 
     std::string mLabel;
 };
-
 }
 
-#endif   // LIBANGLE_QUERY_H_
+#endif  // LIBANGLE_QUERY_H_
diff --git a/src/libANGLE/Shader.cpp b/src/libANGLE/Shader.cpp
index 0da1039..874e1e4 100644
--- a/src/libANGLE/Shader.cpp
+++ b/src/libANGLE/Shader.cpp
@@ -12,15 +12,15 @@
 
 #include <sstream>
 
-#include "common/utilities.h"
 #include "GLSLANG/ShaderLang.h"
+#include "common/utilities.h"
 #include "libANGLE/Caps.h"
 #include "libANGLE/Compiler.h"
 #include "libANGLE/Constants.h"
+#include "libANGLE/Context.h"
+#include "libANGLE/ResourceManager.h"
 #include "libANGLE/renderer/GLImplFactory.h"
 #include "libANGLE/renderer/ShaderImpl.h"
-#include "libANGLE/ResourceManager.h"
-#include "libANGLE/Context.h"
 
 namespace gl
 {
@@ -389,7 +389,7 @@
     // Gather the shader information
     mState.mShaderVersion = sh::GetShaderVersion(compilerHandle);
 
-    mState.mUniforms        = GetShaderVariables(sh::GetUniforms(compilerHandle));
+    mState.mUniforms            = GetShaderVariables(sh::GetUniforms(compilerHandle));
     mState.mUniformBlocks       = GetShaderVariables(sh::GetUniformBlocks(compilerHandle));
     mState.mShaderStorageBlocks = GetShaderVariables(sh::GetShaderStorageBlocks(compilerHandle));
 
@@ -406,7 +406,7 @@
                 mState.mOutputVaryings = GetShaderVariables(sh::GetOutputVaryings(compilerHandle));
                 mState.mAllAttributes    = GetShaderVariables(sh::GetAttributes(compilerHandle));
                 mState.mActiveAttributes = GetActiveShaderVariables(&mState.mAllAttributes);
-                mState.mNumViews = sh::GetVertexShaderNumViews(compilerHandle);
+                mState.mNumViews         = sh::GetVertexShaderNumViews(compilerHandle);
             }
             break;
         }
@@ -426,13 +426,13 @@
 
             if (sh::HasValidGeometryShaderInputPrimitiveType(compilerHandle))
             {
-                mState.mGeometryShaderInputPrimitiveType =
-                    sh::GetGeometryShaderInputPrimitiveType(compilerHandle);
+                mState.mGeometryShaderInputPrimitiveType = FromGLenum<PrimitiveMode>(
+                    sh::GetGeometryShaderInputPrimitiveType(compilerHandle));
             }
             if (sh::HasValidGeometryShaderOutputPrimitiveType(compilerHandle))
             {
-                mState.mGeometryShaderOutputPrimitiveType =
-                    sh::GetGeometryShaderOutputPrimitiveType(compilerHandle);
+                mState.mGeometryShaderOutputPrimitiveType = FromGLenum<PrimitiveMode>(
+                    sh::GetGeometryShaderOutputPrimitiveType(compilerHandle));
             }
             if (sh::HasValidGeometryShaderMaxVertices(compilerHandle))
             {
@@ -594,13 +594,13 @@
     return mState.mNumViews;
 }
 
-Optional<GLenum> Shader::getGeometryShaderInputPrimitiveType(const Context *context)
+Optional<PrimitiveMode> Shader::getGeometryShaderInputPrimitiveType(const Context *context)
 {
     resolveCompile(context);
     return mState.mGeometryShaderInputPrimitiveType;
 }
 
-Optional<GLenum> Shader::getGeometryShaderOutputPrimitiveType(const Context *context)
+Optional<PrimitiveMode> Shader::getGeometryShaderOutputPrimitiveType(const Context *context)
 {
     resolveCompile(context);
     return mState.mGeometryShaderOutputPrimitiveType;
diff --git a/src/libANGLE/Shader.h b/src/libANGLE/Shader.h
index a3b5f24..cf30368 100644
--- a/src/libANGLE/Shader.h
+++ b/src/libANGLE/Shader.h
@@ -17,8 +17,8 @@
 #include <string>
 #include <vector>
 
-#include "angle_gl.h"
 #include <GLSLANG/ShaderLang.h>
+#include "angle_gl.h"
 
 #include "common/Optional.h"
 #include "common/angleutils.h"
@@ -104,8 +104,8 @@
     int mNumViews;
 
     // Geometry Shader.
-    Optional<GLenum> mGeometryShaderInputPrimitiveType;
-    Optional<GLenum> mGeometryShaderOutputPrimitiveType;
+    Optional<PrimitiveMode> mGeometryShaderInputPrimitiveType;
+    Optional<PrimitiveMode> mGeometryShaderOutputPrimitiveType;
     Optional<GLint> mGeometryShaderMaxVertices;
     int mGeometryShaderInvocations;
 
@@ -180,8 +180,8 @@
 
     int getNumViews(const Context *context);
 
-    Optional<GLenum> getGeometryShaderInputPrimitiveType(const Context *context);
-    Optional<GLenum> getGeometryShaderOutputPrimitiveType(const Context *context);
+    Optional<PrimitiveMode> getGeometryShaderInputPrimitiveType(const Context *context);
+    Optional<PrimitiveMode> getGeometryShaderOutputPrimitiveType(const Context *context);
     int getGeometryShaderInvocations(const Context *context);
     Optional<GLint> getGeometryShaderMaxVertices(const Context *context);
 
@@ -204,8 +204,8 @@
     const gl::Limitations &mRendererLimitations;
     const GLuint mHandle;
     const ShaderType mType;
-    unsigned int mRefCount;     // Number of program objects this shader is attached to
-    bool mDeleteStatus;         // Flag to indicate that the shader can be deleted when no longer in use
+    unsigned int mRefCount;  // Number of program objects this shader is attached to
+    bool mDeleteStatus;  // Flag to indicate that the shader can be deleted when no longer in use
     std::string mInfoLog;
 
     // We keep a reference to the translator in order to defer compiles while preserving settings.
@@ -219,4 +219,4 @@
 const char *GetShaderTypeString(ShaderType type);
 }  // namespace gl
 
-#endif   // LIBANGLE_SHADER_H_
+#endif  // LIBANGLE_SHADER_H_
diff --git a/src/libANGLE/Surface.h b/src/libANGLE/Surface.h
index eebdb34..00759d8 100644
--- a/src/libANGLE/Surface.h
+++ b/src/libANGLE/Surface.h
@@ -174,9 +174,9 @@
     TextureFormat mTextureFormat;
     EGLenum mTextureTarget;
 
-    EGLint mPixelAspectRatio;      // Display aspect ratio
-    EGLenum mRenderBuffer;         // Render buffer
-    EGLenum mSwapBehavior;         // Buffer swap behavior
+    EGLint mPixelAspectRatio;  // Display aspect ratio
+    EGLenum mRenderBuffer;     // Render buffer
+    EGLenum mSwapBehavior;     // Buffer swap behavior
 
     EGLint mOrientation;
 
@@ -246,4 +246,4 @@
 
 }  // namespace egl
 
-#endif   // LIBANGLE_SURFACE_H_
+#endif  // LIBANGLE_SURFACE_H_
diff --git a/src/libANGLE/TransformFeedback.cpp b/src/libANGLE/TransformFeedback.cpp
index d42ed92..af144d1 100644
--- a/src/libANGLE/TransformFeedback.cpp
+++ b/src/libANGLE/TransformFeedback.cpp
@@ -20,7 +20,7 @@
 namespace gl
 {
 
-angle::CheckedNumeric<GLsizeiptr> GetVerticesNeededForDraw(GLenum primitiveMode,
+angle::CheckedNumeric<GLsizeiptr> GetVerticesNeededForDraw(PrimitiveMode primitiveMode,
                                                            GLsizei count,
                                                            GLsizei primcount)
 {
@@ -34,11 +34,11 @@
     angle::CheckedNumeric<GLsizeiptr> checkedPrimcount = primcount;
     switch (primitiveMode)
     {
-        case GL_TRIANGLES:
+        case PrimitiveMode::Triangles:
             return checkedPrimcount * (checkedCount - checkedCount % 3);
-        case GL_LINES:
+        case PrimitiveMode::Lines:
             return checkedPrimcount * (checkedCount - checkedCount % 2);
-        case GL_POINTS:
+        case PrimitiveMode::Points:
             return checkedPrimcount * checkedCount;
         default:
             UNREACHABLE();
@@ -49,7 +49,7 @@
 TransformFeedbackState::TransformFeedbackState(size_t maxIndexedBuffers)
     : mLabel(),
       mActive(false),
-      mPrimitiveMode(GL_NONE),
+      mPrimitiveMode(PrimitiveMode::InvalidEnum),
       mPaused(false),
       mVerticesDrawn(0),
       mVertexCapacity(0),
@@ -113,7 +113,7 @@
     return mState.mLabel;
 }
 
-void TransformFeedback::begin(const Context *context, GLenum primitiveMode, Program *program)
+void TransformFeedback::begin(const Context *context, PrimitiveMode primitiveMode, Program *program)
 {
     mState.mActive        = true;
     mState.mPrimitiveMode = primitiveMode;
@@ -145,7 +145,7 @@
 void TransformFeedback::end(const Context *context)
 {
     mState.mActive         = false;
-    mState.mPrimitiveMode  = GL_NONE;
+    mState.mPrimitiveMode  = PrimitiveMode::InvalidEnum;
     mState.mPaused         = false;
     mState.mVerticesDrawn  = 0;
     mState.mVertexCapacity = 0;
@@ -179,7 +179,7 @@
     return mState.mPaused;
 }
 
-GLenum TransformFeedback::getPrimitiveMode() const
+PrimitiveMode TransformFeedback::getPrimitiveMode() const
 {
     return mState.mPrimitiveMode;
 }
diff --git a/src/libANGLE/TransformFeedback.h b/src/libANGLE/TransformFeedback.h
index 5dabeac..800ce87 100644
--- a/src/libANGLE/TransformFeedback.h
+++ b/src/libANGLE/TransformFeedback.h
@@ -9,6 +9,7 @@
 
 #include "libANGLE/RefCountObject.h"
 
+#include "common/PackedEnums.h"
 #include "common/angleutils.h"
 #include "libANGLE/Debug.h"
 
@@ -42,7 +43,7 @@
     std::string mLabel;
 
     bool mActive;
-    GLenum mPrimitiveMode;
+    PrimitiveMode mPrimitiveMode;
     bool mPaused;
     GLsizeiptr mVerticesDrawn;
     GLsizeiptr mVertexCapacity;
@@ -62,14 +63,14 @@
     void setLabel(const std::string &label) override;
     const std::string &getLabel() const override;
 
-    void begin(const Context *context, GLenum primitiveMode, Program *program);
+    void begin(const Context *context, PrimitiveMode primitiveMode, Program *program);
     void end(const Context *context);
     void pause();
     void resume();
 
     bool isActive() const;
     bool isPaused() const;
-    GLenum getPrimitiveMode() const;
+    PrimitiveMode getPrimitiveMode() const;
     // Validates that the vertices produced by a draw call will fit in the bound transform feedback
     // buffers.
     bool checkBufferSpaceForDraw(GLsizei count, GLsizei primcount) const;
@@ -108,4 +109,4 @@
 
 }  // namespace gl
 
-#endif // LIBANGLE_TRANSFORM_FEEDBACK_H_
+#endif  // LIBANGLE_TRANSFORM_FEEDBACK_H_
diff --git a/src/libANGLE/TransformFeedback_unittest.cpp b/src/libANGLE/TransformFeedback_unittest.cpp
index 54f1086..5cb432b 100644
--- a/src/libANGLE/TransformFeedback_unittest.cpp
+++ b/src/libANGLE/TransformFeedback_unittest.cpp
@@ -6,6 +6,7 @@
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
+
 #include "libANGLE/Buffer.h"
 #include "libANGLE/Caps.h"
 #include "libANGLE/TransformFeedback.h"
@@ -61,8 +62,8 @@
     }
 
     rx::MockGLFactory mMockFactory;
-    rx::MockTransformFeedbackImpl* mImpl;
-    gl::TransformFeedback* mFeedback;
+    rx::MockTransformFeedbackImpl *mImpl;
+    gl::TransformFeedback *mFeedback;
     gl::Caps mCaps;
 };
 
@@ -71,10 +72,10 @@
     testing::InSequence seq;
 
     EXPECT_FALSE(mFeedback->isActive());
-    EXPECT_CALL(*mImpl, begin(GL_TRIANGLES));
-    mFeedback->begin(nullptr, GL_TRIANGLES, nullptr);
+    EXPECT_CALL(*mImpl, begin(gl::PrimitiveMode::Triangles));
+    mFeedback->begin(nullptr, gl::PrimitiveMode::Triangles, nullptr);
     EXPECT_TRUE(mFeedback->isActive());
-    EXPECT_EQ(static_cast<GLenum>(GL_TRIANGLES), mFeedback->getPrimitiveMode());
+    EXPECT_EQ(gl::PrimitiveMode::Triangles, mFeedback->getPrimitiveMode());
     EXPECT_CALL(*mImpl, end());
     mFeedback->end(nullptr);
     EXPECT_FALSE(mFeedback->isActive());
@@ -85,8 +86,8 @@
     testing::InSequence seq;
 
     EXPECT_FALSE(mFeedback->isActive());
-    EXPECT_CALL(*mImpl, begin(GL_TRIANGLES));
-    mFeedback->begin(nullptr, GL_TRIANGLES, nullptr);
+    EXPECT_CALL(*mImpl, begin(gl::PrimitiveMode::Triangles));
+    mFeedback->begin(nullptr, gl::PrimitiveMode::Triangles, nullptr);
     EXPECT_FALSE(mFeedback->isPaused());
     EXPECT_CALL(*mImpl, pause());
     mFeedback->pause();
diff --git a/src/libANGLE/angletypes.cpp b/src/libANGLE/angletypes.cpp
index da25a49..86a82c7 100644
--- a/src/libANGLE/angletypes.cpp
+++ b/src/libANGLE/angletypes.cpp
@@ -8,30 +8,30 @@
 
 #include "libANGLE/angletypes.h"
 #include "libANGLE/Program.h"
-#include "libANGLE/VertexAttribute.h"
 #include "libANGLE/State.h"
 #include "libANGLE/VertexArray.h"
+#include "libANGLE/VertexAttribute.h"
 
 namespace gl
 {
 
-PrimitiveType GetPrimitiveType(GLenum drawMode)
+PrimitiveType GetPrimitiveType(PrimitiveMode drawMode)
 {
     switch (drawMode)
     {
-        case GL_POINTS:
+        case PrimitiveMode::Points:
             return PRIMITIVE_POINTS;
-        case GL_LINES:
+        case PrimitiveMode::Lines:
             return PRIMITIVE_LINES;
-        case GL_LINE_STRIP:
+        case PrimitiveMode::LineStrip:
             return PRIMITIVE_LINE_STRIP;
-        case GL_LINE_LOOP:
+        case PrimitiveMode::LineLoop:
             return PRIMITIVE_LINE_LOOP;
-        case GL_TRIANGLES:
+        case PrimitiveMode::Triangles:
             return PRIMITIVE_TRIANGLES;
-        case GL_TRIANGLE_STRIP:
+        case gl::PrimitiveMode::TriangleStrip:
             return PRIMITIVE_TRIANGLE_STRIP;
-        case GL_TRIANGLE_FAN:
+        case gl::PrimitiveMode::TriangleFan:
             return PRIMITIVE_TRIANGLE_FAN;
         default:
             UNREACHABLE();
@@ -216,14 +216,15 @@
     MinMax(clip.x, clip.x + clip.width, &minClipX, &maxClipX);
     MinMax(clip.y, clip.y + clip.height, &minClipY, &maxClipY);
 
-    if (minSourceX >= maxClipX || maxSourceX <= minClipX || minSourceY >= maxClipY || maxSourceY <= minClipY)
+    if (minSourceX >= maxClipX || maxSourceX <= minClipX || minSourceY >= maxClipY ||
+        maxSourceY <= minClipY)
     {
         return false;
     }
     if (intersection)
     {
-        intersection->x = std::max(minSourceX, minClipX);
-        intersection->y = std::max(minSourceY, minClipY);
+        intersection->x      = std::max(minSourceX, minClipX);
+        intersection->y      = std::max(minSourceY, minClipY);
         intersection->width  = std::min(maxSourceX, maxClipX) - std::max(minSourceX, minClipX);
         intersection->height = std::min(maxSourceY, maxClipY) - std::max(minSourceY, minClipY);
     }
@@ -232,8 +233,8 @@
 
 bool Box::operator==(const Box &other) const
 {
-    return (x == other.x && y == other.y && z == other.z &&
-            width == other.width && height == other.height && depth == other.depth);
+    return (x == other.x && y == other.y && z == other.z && width == other.width &&
+            height == other.height && depth == other.depth);
 }
 
 bool Box::operator!=(const Box &other) const
diff --git a/src/libANGLE/angletypes.h b/src/libANGLE/angletypes.h
index 30c5eb8..a8f8c8c 100644
--- a/src/libANGLE/angletypes.h
+++ b/src/libANGLE/angletypes.h
@@ -28,6 +28,7 @@
 class Buffer;
 class Texture;
 
+// TODO(jmadill): Remove this.
 enum PrimitiveType
 {
     PRIMITIVE_POINTS,
diff --git a/src/libANGLE/params.cpp b/src/libANGLE/params.cpp
index a77435c..f5640e5 100644
--- a/src/libANGLE/params.cpp
+++ b/src/libANGLE/params.cpp
@@ -22,7 +22,7 @@
 
 // DrawCallParams implementation.
 // Called by DrawArrays.
-DrawCallParams::DrawCallParams(GLenum mode,
+DrawCallParams::DrawCallParams(PrimitiveMode mode,
                                GLint firstVertex,
                                GLsizei vertexCount,
                                GLsizei instances)
@@ -39,7 +39,7 @@
 }
 
 // Called by DrawElements.
-DrawCallParams::DrawCallParams(GLenum mode,
+DrawCallParams::DrawCallParams(PrimitiveMode mode,
                                GLint indexCount,
                                GLenum type,
                                const void *indices,
@@ -58,7 +58,7 @@
 }
 
 // Called by DrawArraysIndirect.
-DrawCallParams::DrawCallParams(GLenum mode, const void *indirect)
+DrawCallParams::DrawCallParams(PrimitiveMode mode, const void *indirect)
     : mMode(mode),
       mFirstVertex(0),
       mVertexCount(0),
@@ -72,7 +72,7 @@
 }
 
 // Called by DrawElementsIndirect.
-DrawCallParams::DrawCallParams(GLenum mode, GLenum type, const void *indirect)
+DrawCallParams::DrawCallParams(PrimitiveMode mode, GLenum type, const void *indirect)
     : mMode(mode),
       mFirstVertex(0),
       mVertexCount(0),
@@ -85,7 +85,7 @@
 {
 }
 
-GLenum DrawCallParams::mode() const
+PrimitiveMode DrawCallParams::mode() const
 {
     return mMode;
 }
diff --git a/src/libANGLE/params.h b/src/libANGLE/params.h
index 3fa023e..83c0de4 100644
--- a/src/libANGLE/params.h
+++ b/src/libANGLE/params.h
@@ -12,6 +12,7 @@
 
 #include "angle_gl.h"
 #include "common/Optional.h"
+#include "common/PackedEnums.h"
 #include "common/angleutils.h"
 #include "common/mathutil.h"
 #include "libANGLE/Error.h"
@@ -77,10 +78,10 @@
 {
   public:
     // Called by DrawArrays.
-    DrawCallParams(GLenum mode, GLint firstVertex, GLsizei vertexCount, GLsizei instances);
+    DrawCallParams(PrimitiveMode mode, GLint firstVertex, GLsizei vertexCount, GLsizei instances);
 
     // Called by DrawElements.
-    DrawCallParams(GLenum mode,
+    DrawCallParams(PrimitiveMode mode,
                    GLint indexCount,
                    GLenum type,
                    const void *indices,
@@ -88,12 +89,12 @@
                    GLsizei instances);
 
     // Called by DrawArraysIndirect.
-    DrawCallParams(GLenum mode, const void *indirect);
+    DrawCallParams(PrimitiveMode mode, const void *indirect);
 
     // Called by DrawElementsIndirect.
-    DrawCallParams(GLenum mode, GLenum type, const void *indirect);
+    DrawCallParams(PrimitiveMode mode, GLenum type, const void *indirect);
 
-    GLenum mode() const;
+    PrimitiveMode mode() const;
 
     // This value is the sum of 'baseVertex' and the first indexed vertex for DrawElements calls.
     GLint firstVertex() const;
@@ -122,7 +123,7 @@
     ANGLE_PARAM_TYPE_INFO(DrawCallParams, ParamsBase);
 
   private:
-    GLenum mMode;
+    PrimitiveMode mMode;
     mutable Optional<IndexRange> mIndexRange;
     mutable GLint mFirstVertex;
     mutable size_t mVertexCount;
@@ -158,7 +159,7 @@
                        DrawCallParams,
                        DrawCallParams *objBuffer,
                        Context *context,
-                       GLenum mode,
+                       PrimitiveMode mode,
                        GLint first,
                        GLsizei count)
 {
@@ -169,7 +170,7 @@
                        DrawCallParams,
                        DrawCallParams *objBuffer,
                        Context *context,
-                       GLenum mode,
+                       PrimitiveMode mode,
                        GLint first,
                        GLsizei count,
                        GLsizei instanceCount)
@@ -182,7 +183,7 @@
                        DrawCallParams,
                        DrawCallParams *objBuffer,
                        Context *context,
-                       GLenum mode,
+                       PrimitiveMode mode,
                        GLint first,
                        GLsizei count,
                        GLsizei instanceCount)
@@ -195,7 +196,7 @@
                        DrawCallParams,
                        DrawCallParams *objBuffer,
                        Context *context,
-                       GLenum mode,
+                       PrimitiveMode mode,
                        const void *indirect)
 {
     return ParamsBase::Factory<EntryPoint::DrawArraysIndirect>(objBuffer, mode, indirect);
@@ -205,7 +206,7 @@
                        DrawCallParams,
                        DrawCallParams *objBuffer,
                        Context *context,
-                       GLenum mode,
+                       PrimitiveMode mode,
                        GLenum type,
                        const void *indirect)
 {
@@ -216,7 +217,7 @@
                        DrawCallParams,
                        DrawCallParams *objBuffer,
                        Context *context,
-                       GLenum mode,
+                       PrimitiveMode mode,
                        GLsizei count,
                        GLenum type,
                        const void *indices)
@@ -229,7 +230,7 @@
                        DrawCallParams,
                        DrawCallParams *objBuffer,
                        Context *context,
-                       GLenum mode,
+                       PrimitiveMode mode,
                        GLsizei count,
                        GLenum type,
                        const void *indices,
@@ -243,7 +244,7 @@
                        DrawCallParams,
                        DrawCallParams *objBuffer,
                        Context *context,
-                       GLenum mode,
+                       PrimitiveMode mode,
                        GLsizei count,
                        GLenum type,
                        const void *indices,
@@ -257,7 +258,7 @@
                        DrawCallParams,
                        DrawCallParams *objBuffer,
                        Context *context,
-                       GLenum mode,
+                       PrimitiveMode mode,
                        GLuint /*start*/,
                        GLuint /*end*/,
                        GLsizei count,
diff --git a/src/libANGLE/queryutils.cpp b/src/libANGLE/queryutils.cpp
index 9a6b0f6..38730c3 100644
--- a/src/libANGLE/queryutils.cpp
+++ b/src/libANGLE/queryutils.cpp
@@ -1023,10 +1023,10 @@
             *params = program->getActiveAtomicCounterBufferCount();
             break;
         case GL_GEOMETRY_LINKED_INPUT_TYPE_EXT:
-            *params = program->getGeometryShaderInputPrimitiveType();
+            *params = ToGLenum(program->getGeometryShaderInputPrimitiveType());
             break;
         case GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT:
-            *params = program->getGeometryShaderOutputPrimitiveType();
+            *params = ToGLenum(program->getGeometryShaderOutputPrimitiveType());
             break;
         case GL_GEOMETRY_LINKED_VERTICES_OUT_EXT:
             *params = program->getGeometryShaderMaxVertices();
diff --git a/src/libANGLE/renderer/BufferImpl.h b/src/libANGLE/renderer/BufferImpl.h
index 1bf0ab0..2e09d95 100644
--- a/src/libANGLE/renderer/BufferImpl.h
+++ b/src/libANGLE/renderer/BufferImpl.h
@@ -49,14 +49,14 @@
                                   BufferImpl *source,
                                   GLintptr sourceOffset,
                                   GLintptr destOffset,
-                                  GLsizeiptr size) = 0;
+                                  GLsizeiptr size)                                  = 0;
     virtual gl::Error map(const gl::Context *context, GLenum access, void **mapPtr) = 0;
     virtual gl::Error mapRange(const gl::Context *context,
                                size_t offset,
                                size_t length,
                                GLbitfield access,
-                               void **mapPtr) = 0;
-    virtual gl::Error unmap(const gl::Context *context, GLboolean *result) = 0;
+                               void **mapPtr)                                       = 0;
+    virtual gl::Error unmap(const gl::Context *context, GLboolean *result)          = 0;
 
     virtual gl::Error getIndexRange(const gl::Context *context,
                                     GLenum type,
diff --git a/src/libANGLE/renderer/ContextImpl.h b/src/libANGLE/renderer/ContextImpl.h
index df55847..45d747a 100644
--- a/src/libANGLE/renderer/ContextImpl.h
+++ b/src/libANGLE/renderer/ContextImpl.h
@@ -41,39 +41,39 @@
 
     // Drawing methods.
     virtual gl::Error drawArrays(const gl::Context *context,
-                                 GLenum mode,
+                                 gl::PrimitiveMode mode,
                                  GLint first,
-                                 GLsizei count) = 0;
+                                 GLsizei count)                  = 0;
     virtual gl::Error drawArraysInstanced(const gl::Context *context,
-                                          GLenum mode,
+                                          gl::PrimitiveMode mode,
                                           GLint first,
                                           GLsizei count,
                                           GLsizei instanceCount) = 0;
 
     virtual gl::Error drawElements(const gl::Context *context,
-                                   GLenum mode,
+                                   gl::PrimitiveMode mode,
                                    GLsizei count,
                                    GLenum type,
-                                   const void *indices) = 0;
+                                   const void *indices)        = 0;
     virtual gl::Error drawElementsInstanced(const gl::Context *context,
-                                            GLenum mode,
+                                            gl::PrimitiveMode mode,
                                             GLsizei count,
                                             GLenum type,
                                             const void *indices,
                                             GLsizei instances) = 0;
     virtual gl::Error drawRangeElements(const gl::Context *context,
-                                        GLenum mode,
+                                        gl::PrimitiveMode mode,
                                         GLuint start,
                                         GLuint end,
                                         GLsizei count,
                                         GLenum type,
-                                        const void *indices) = 0;
+                                        const void *indices)   = 0;
 
     virtual gl::Error drawArraysIndirect(const gl::Context *context,
-                                         GLenum mode,
-                                         const void *indirect) = 0;
+                                         gl::PrimitiveMode mode,
+                                         const void *indirect)   = 0;
     virtual gl::Error drawElementsIndirect(const gl::Context *context,
-                                           GLenum mode,
+                                           gl::PrimitiveMode mode,
                                            GLenum type,
                                            const void *indirect) = 0;
 
@@ -133,7 +133,7 @@
     // EXT_debug_marker
     virtual void insertEventMarker(GLsizei length, const char *marker) = 0;
     virtual void pushGroupMarker(GLsizei length, const char *marker)   = 0;
-    virtual void popGroupMarker() = 0;
+    virtual void popGroupMarker()                                      = 0;
 
     // KHR_debug
     virtual void pushDebugGroup(GLenum source, GLuint id, GLsizei length, const char *message) = 0;
@@ -160,7 +160,7 @@
     virtual gl::Error dispatchCompute(const gl::Context *context,
                                       GLuint numGroupsX,
                                       GLuint numGroupsY,
-                                      GLuint numGroupsZ) = 0;
+                                      GLuint numGroupsZ)                                     = 0;
     virtual gl::Error dispatchComputeIndirect(const gl::Context *context, GLintptr indirect) = 0;
 
     virtual gl::Error memoryBarrier(const gl::Context *context, GLbitfield barriers)         = 0;
diff --git a/src/libANGLE/renderer/Format_table_autogen.cpp b/src/libANGLE/renderer/Format_table_autogen.cpp
index af2d273..f3cb5f3 100644
--- a/src/libANGLE/renderer/Format_table_autogen.cpp
+++ b/src/libANGLE/renderer/Format_table_autogen.cpp
@@ -17,7 +17,7 @@
 namespace angle
 {
 
-static constexpr rx::FastCopyFunctionMap::Entry BGRAEntry = {GL_RGBA, GL_UNSIGNED_BYTE,
+static constexpr rx::FastCopyFunctionMap::Entry BGRAEntry  = {GL_RGBA, GL_UNSIGNED_BYTE,
                                                              CopyBGRA8ToRGBA8};
 static constexpr rx::FastCopyFunctionMap BGRACopyFunctions = {&BGRAEntry, 1};
 static constexpr rx::FastCopyFunctionMap NoCopyFunctions;
diff --git a/src/libANGLE/renderer/QueryImpl.h b/src/libANGLE/renderer/QueryImpl.h
index fb9d284..21baaed 100644
--- a/src/libANGLE/renderer/QueryImpl.h
+++ b/src/libANGLE/renderer/QueryImpl.h
@@ -20,15 +20,15 @@
 {
   public:
     explicit QueryImpl(gl::QueryType type) { mType = type; }
-    virtual ~QueryImpl() { }
+    virtual ~QueryImpl() {}
 
-    virtual gl::Error begin() = 0;
-    virtual gl::Error end() = 0;
-    virtual gl::Error queryCounter() = 0;
-    virtual gl::Error getResult(GLint *params) = 0;
-    virtual gl::Error getResult(GLuint *params) = 0;
-    virtual gl::Error getResult(GLint64 *params) = 0;
-    virtual gl::Error getResult(GLuint64 *params) = 0;
+    virtual gl::Error begin()                            = 0;
+    virtual gl::Error end()                              = 0;
+    virtual gl::Error queryCounter()                     = 0;
+    virtual gl::Error getResult(GLint *params)           = 0;
+    virtual gl::Error getResult(GLuint *params)          = 0;
+    virtual gl::Error getResult(GLint64 *params)         = 0;
+    virtual gl::Error getResult(GLuint64 *params)        = 0;
     virtual gl::Error isResultAvailable(bool *available) = 0;
 
     gl::QueryType getType() const { return mType; }
@@ -36,7 +36,6 @@
   private:
     gl::QueryType mType;
 };
-
 }
 
-#endif // LIBANGLE_RENDERER_QUERYIMPL_H_
+#endif  // LIBANGLE_RENDERER_QUERYIMPL_H_
diff --git a/src/libANGLE/renderer/TransformFeedbackImpl.h b/src/libANGLE/renderer/TransformFeedbackImpl.h
index ad371e9..b9fbd2d 100644
--- a/src/libANGLE/renderer/TransformFeedbackImpl.h
+++ b/src/libANGLE/renderer/TransformFeedbackImpl.h
@@ -19,21 +19,20 @@
 {
   public:
     TransformFeedbackImpl(const gl::TransformFeedbackState &state) : mState(state) {}
-    virtual ~TransformFeedbackImpl() { }
+    virtual ~TransformFeedbackImpl() {}
 
-    virtual void begin(GLenum primitiveMode) = 0;
-    virtual void end() = 0;
-    virtual void pause() = 0;
-    virtual void resume() = 0;
+    virtual void begin(gl::PrimitiveMode primitiveMode) = 0;
+    virtual void end()                                  = 0;
+    virtual void pause()                                = 0;
+    virtual void resume()                               = 0;
 
-    virtual void bindGenericBuffer(const gl::BindingPointer<gl::Buffer> &binding) = 0;
+    virtual void bindGenericBuffer(const gl::BindingPointer<gl::Buffer> &binding)       = 0;
     virtual void bindIndexedBuffer(size_t index,
                                    const gl::OffsetBindingPointer<gl::Buffer> &binding) = 0;
 
   protected:
     const gl::TransformFeedbackState &mState;
 };
-
 }
 
-#endif // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_
+#endif  // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_
diff --git a/src/libANGLE/renderer/TransformFeedbackImpl_mock.h b/src/libANGLE/renderer/TransformFeedbackImpl_mock.h
index 2de3ad7..3baab0d 100644
--- a/src/libANGLE/renderer/TransformFeedbackImpl_mock.h
+++ b/src/libANGLE/renderer/TransformFeedbackImpl_mock.h
@@ -25,7 +25,7 @@
     }
     ~MockTransformFeedbackImpl() { destructor(); }
 
-    MOCK_METHOD1(begin, void(GLenum primitiveMode));
+    MOCK_METHOD1(begin, void(gl::PrimitiveMode));
     MOCK_METHOD0(end, void());
     MOCK_METHOD0(pause, void());
     MOCK_METHOD0(resume, void());
@@ -35,7 +35,6 @@
 
     MOCK_METHOD0(destructor, void());
 };
-
 }
 
-#endif // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_
+#endif  // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_
diff --git a/src/libANGLE/renderer/d3d/ImageD3D.h b/src/libANGLE/renderer/d3d/ImageD3D.h
index f41f07e..419dd5f 100644
--- a/src/libANGLE/renderer/d3d/ImageD3D.h
+++ b/src/libANGLE/renderer/d3d/ImageD3D.h
@@ -38,7 +38,7 @@
 {
   public:
     ImageD3D();
-    virtual ~ImageD3D() {};
+    virtual ~ImageD3D(){};
 
     GLsizei getWidth() const { return mWidth; }
     GLsizei getHeight() const { return mHeight; }
@@ -61,7 +61,7 @@
                                const gl::PixelUnpackState &unpack,
                                GLenum type,
                                const void *input,
-                               bool applySkipImages) = 0;
+                               bool applySkipImages)        = 0;
     virtual gl::Error loadCompressedData(const gl::Context *context,
                                          const gl::Box &area,
                                          const void *input) = 0;
@@ -87,7 +87,7 @@
 
     virtual gl::Error copyFromTexStorage(const gl::Context *context,
                                          const gl::ImageIndex &imageIndex,
-                                         TextureStorage *source) = 0;
+                                         TextureStorage *source)         = 0;
     virtual gl::Error copyFromFramebuffer(const gl::Context *context,
                                           const gl::Offset &destOffset,
                                           const gl::Rectangle &sourceArea,
@@ -103,7 +103,6 @@
 
     bool mDirty;
 };
-
 }
 
-#endif // LIBANGLE_RENDERER_D3D_IMAGED3D_H_
+#endif  // LIBANGLE_RENDERER_D3D_IMAGED3D_H_
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
index 33edeac..9448bd4 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
@@ -135,27 +135,27 @@
     return true;
 }
 
-gl::PrimitiveType GetGeometryShaderTypeFromDrawMode(GLenum drawMode)
+gl::PrimitiveType GetGeometryShaderTypeFromDrawMode(gl::PrimitiveMode drawMode)
 {
     switch (drawMode)
     {
         // Uses the point sprite geometry shader.
-        case GL_POINTS:
+        case gl::PrimitiveMode::Points:
             return gl::PRIMITIVE_POINTS;
 
         // All line drawing uses the same geometry shader.
-        case GL_LINES:
-        case GL_LINE_STRIP:
-        case GL_LINE_LOOP:
+        case gl::PrimitiveMode::Lines:
+        case gl::PrimitiveMode::LineStrip:
+        case gl::PrimitiveMode::LineLoop:
             return gl::PRIMITIVE_LINES;
 
         // The triangle fan primitive is emulated with strips in D3D11.
-        case GL_TRIANGLES:
-        case GL_TRIANGLE_FAN:
+        case gl::PrimitiveMode::Triangles:
+        case gl::PrimitiveMode::TriangleFan:
             return gl::PRIMITIVE_TRIANGLES;
 
         // Special case for triangle strips.
-        case GL_TRIANGLE_STRIP:
+        case gl::PrimitiveMode::TriangleStrip:
             return gl::PRIMITIVE_TRIANGLE_STRIP;
 
         default:
@@ -668,13 +668,13 @@
     return usesPointSpriteEmulation() && !usesInstancedPointSpriteEmulation();
 }
 
-bool ProgramD3D::usesGeometryShader(GLenum drawMode) const
+bool ProgramD3D::usesGeometryShader(gl::PrimitiveMode drawMode) const
 {
     if (mHasANGLEMultiviewEnabled && !mRenderer->canSelectViewInVertexShader())
     {
         return true;
     }
-    if (drawMode != GL_POINTS)
+    if (drawMode != gl::PrimitiveMode::Points)
     {
         return mUsesFlatInterpolation;
     }
@@ -1356,7 +1356,7 @@
 }
 
 gl::Error ProgramD3D::getGeometryExecutableForPrimitiveType(const gl::Context *context,
-                                                            GLenum drawMode,
+                                                            gl::PrimitiveMode drawMode,
                                                             ShaderExecutableD3D **outExecutable,
                                                             gl::InfoLog *infoLog)
 {
@@ -1497,10 +1497,10 @@
     {
         // Auto-generate the geometry shader here, if we expect to be using point rendering in
         // D3D11.
-        if (mProgram->usesGeometryShader(GL_POINTS))
+        if (mProgram->usesGeometryShader(gl::PrimitiveMode::Points))
         {
-            ANGLE_TRY(mProgram->getGeometryExecutableForPrimitiveType(mContext, GL_POINTS, &mResult,
-                                                                      &mInfoLog));
+            ANGLE_TRY(mProgram->getGeometryExecutableForPrimitiveType(
+                mContext, gl::PrimitiveMode::Points, &mResult, &mInfoLog));
         }
 
         return gl::NoError();
@@ -1562,7 +1562,7 @@
     const ShaderD3D *vertexShaderD3D =
         GetImplAs<ShaderD3D>(mState.getAttachedShader(gl::ShaderType::Vertex));
 
-    if (usesGeometryShader(GL_POINTS) && pointGS)
+    if (usesGeometryShader(gl::PrimitiveMode::Points) && pointGS)
     {
         // Geometry shaders are currently only used internally, so there is no corresponding shader
         // object at the interface level. For now the geometry shader debug info is prepended to
@@ -1585,7 +1585,7 @@
     }
 
     return (defaultVertexExecutable && defaultPixelExecutable &&
-            (!usesGeometryShader(GL_POINTS) || pointGS));
+            (!usesGeometryShader(gl::PrimitiveMode::Points) || pointGS));
 }
 
 gl::LinkResult ProgramD3D::compileComputeExecutable(const gl::Context *context,
@@ -2280,8 +2280,8 @@
                                 uint8_t *targetData,
                                 GLenum uniformType)
 {
-    D3DUniform *targetUniform = mD3DUniforms[locationInfo.index];
-    const int components      = targetUniform->typeInfo.componentCount;
+    D3DUniform *targetUniform             = mD3DUniforms[locationInfo.index];
+    const int components                  = targetUniform->typeInfo.componentCount;
     const unsigned int arrayElementOffset = locationInfo.arrayIndex;
 
     if (targetUniform->typeInfo.type == uniformType)
@@ -2789,7 +2789,7 @@
     return mCachedVertexExecutableIndex.valid();
 }
 
-bool ProgramD3D::hasGeometryExecutableForPrimitiveType(GLenum drawMode)
+bool ProgramD3D::hasGeometryExecutableForPrimitiveType(gl::PrimitiveMode drawMode)
 {
     if (!usesGeometryShader(drawMode))
     {
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.h b/src/libANGLE/renderer/d3d/ProgramD3D.h
index 4662430..6263e2a 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.h
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.h
@@ -175,7 +175,7 @@
 
     bool usesPointSize() const { return mUsesPointSize; }
     bool usesPointSpriteEmulation() const;
-    bool usesGeometryShader(GLenum drawMode) const;
+    bool usesGeometryShader(gl::PrimitiveMode drawMode) const;
     bool usesGeometryShaderForPointSpriteEmulation() const;
     bool usesInstancedPointSpriteEmulation() const;
 
@@ -189,7 +189,7 @@
     gl::Error getVertexExecutableForCachedInputLayout(ShaderExecutableD3D **outExectuable,
                                                       gl::InfoLog *infoLog);
     gl::Error getGeometryExecutableForPrimitiveType(const gl::Context *context,
-                                                    GLenum drawMode,
+                                                    gl::PrimitiveMode drawMode,
                                                     ShaderExecutableD3D **outExecutable,
                                                     gl::InfoLog *infoLog);
     gl::Error getPixelExecutableForCachedOutputLayout(ShaderExecutableD3D **outExectuable,
@@ -285,7 +285,7 @@
 
     // Checks if we need to recompile certain shaders.
     bool hasVertexExecutableForCachedInputLayout();
-    bool hasGeometryExecutableForPrimitiveType(GLenum drawMode);
+    bool hasGeometryExecutableForPrimitiveType(gl::PrimitiveMode drawMode);
     bool hasPixelExecutableForCachedOutputLayout();
 
     bool anyShaderUniformsDirty() const;
diff --git a/src/libANGLE/renderer/d3d/RendererD3D.cpp b/src/libANGLE/renderer/d3d/RendererD3D.cpp
index 666ed67..9dba209 100644
--- a/src/libANGLE/renderer/d3d/RendererD3D.cpp
+++ b/src/libANGLE/renderer/d3d/RendererD3D.cpp
@@ -54,9 +54,9 @@
     mIncompleteTextures.onDestroy(mDisplay->getProxyContext());
 }
 
-bool RendererD3D::skipDraw(const gl::State &glState, GLenum drawMode)
+bool RendererD3D::skipDraw(const gl::State &glState, gl::PrimitiveMode drawMode)
 {
-    if (drawMode == GL_POINTS)
+    if (drawMode == gl::PrimitiveMode::Points)
     {
         bool usesPointSize = GetImplAs<ProgramD3D>(glState.getProgram())->usesPointSize();
 
@@ -194,10 +194,10 @@
     return mSerialFactory.generate();
 }
 
-bool InstancedPointSpritesActive(ProgramD3D *programD3D, GLenum mode)
+bool InstancedPointSpritesActive(ProgramD3D *programD3D, gl::PrimitiveMode mode)
 {
     return programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation() &&
-           mode == GL_POINTS;
+           mode == gl::PrimitiveMode::Points;
 }
 
 gl::Error RendererD3D::initRenderTarget(RenderTargetD3D *renderTarget)
@@ -223,7 +223,7 @@
 
 unsigned int GetBlendSampleMask(const gl::State &glState, int samples)
 {
-    unsigned int mask   = 0;
+    unsigned int mask = 0;
     if (glState.isSampleCoverageEnabled())
     {
         GLfloat coverageValue = glState.getSampleCoverageValue();
diff --git a/src/libANGLE/renderer/d3d/RendererD3D.h b/src/libANGLE/renderer/d3d/RendererD3D.h
index 86ea932..4856775 100644
--- a/src/libANGLE/renderer/d3d/RendererD3D.h
+++ b/src/libANGLE/renderer/d3d/RendererD3D.h
@@ -84,10 +84,11 @@
     virtual ~BufferFactoryD3D() {}
 
     virtual VertexBuffer *createVertexBuffer() = 0;
-    virtual IndexBuffer *createIndexBuffer() = 0;
+    virtual IndexBuffer *createIndexBuffer()   = 0;
 
     // TODO(jmadill): add VertexFormatCaps
-    virtual VertexConversionType getVertexConversionType(gl::VertexFormatType vertexFormatType) const = 0;
+    virtual VertexConversionType getVertexConversionType(
+        gl::VertexFormatType vertexFormatType) const                                   = 0;
     virtual GLenum getVertexComponentType(gl::VertexFormatType vertexFormatType) const = 0;
 
     // Warning: you should ensure binding really matches attrib.bindingIndex before using this
@@ -109,20 +110,20 @@
 
     virtual egl::Error initialize() = 0;
 
-    virtual egl::ConfigSet generateConfigs() = 0;
+    virtual egl::ConfigSet generateConfigs()                                            = 0;
     virtual void generateDisplayExtensions(egl::DisplayExtensions *outExtensions) const = 0;
 
     virtual ContextImpl *createContext(const gl::ContextState &state) = 0;
 
     std::string getVendorString() const;
 
-    virtual int getMinorShaderModel() const = 0;
+    virtual int getMinorShaderModel() const          = 0;
     virtual std::string getShaderModelSuffix() const = 0;
 
     // Direct3D Specific methods
     virtual DeviceIdentifier getAdapterIdentifier() const = 0;
 
-    virtual bool isValidNativeWindow(EGLNativeWindowType window) const = 0;
+    virtual bool isValidNativeWindow(EGLNativeWindowType window) const                  = 0;
     virtual NativeWindowD3D *createNativeWindow(EGLNativeWindowType window,
                                                 const egl::Config *config,
                                                 const egl::AttributeMap &attribs) const = 0;
@@ -133,7 +134,7 @@
                                           GLenum backBufferFormat,
                                           GLenum depthBufferFormat,
                                           EGLint orientation,
-                                          EGLint samples) = 0;
+                                          EGLint samples)                          = 0;
     virtual egl::Error getD3DTextureInfo(const egl::Config *configuration,
                                          IUnknown *d3dTexture,
                                          EGLint *width,
@@ -154,7 +155,7 @@
                                   GLenum destFormat,
                                   const gl::Offset &destOffset,
                                   TextureStorage *storage,
-                                  GLint level) = 0;
+                                  GLint level)      = 0;
     virtual gl::Error copyImageCube(const gl::Context *context,
                                     const gl::Framebuffer *framebuffer,
                                     const gl::Rectangle &sourceRect,
@@ -169,7 +170,7 @@
                                   GLenum destFormat,
                                   const gl::Offset &destOffset,
                                   TextureStorage *storage,
-                                  GLint level) = 0;
+                                  GLint level)      = 0;
     virtual gl::Error copyImage2DArray(const gl::Context *context,
                                        const gl::Framebuffer *framebuffer,
                                        const gl::Rectangle &sourceRect,
@@ -195,10 +196,14 @@
                                             const gl::Texture *source,
                                             GLint sourceLevel,
                                             TextureStorage *storage,
-                                            GLint destLevel) = 0;
+                                            GLint destLevel)  = 0;
 
     // RenderTarget creation
-    virtual gl::Error createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT) = 0;
+    virtual gl::Error createRenderTarget(int width,
+                                         int height,
+                                         GLenum format,
+                                         GLsizei samples,
+                                         RenderTargetD3D **outRT)                              = 0;
     virtual gl::Error createRenderTargetCopy(RenderTargetD3D *source, RenderTargetD3D **outRT) = 0;
 
     // Shader operations
@@ -220,13 +225,13 @@
     virtual UniformStorageD3D *createUniformStorage(size_t storageSize) = 0;
 
     // Image operations
-    virtual ImageD3D *createImage() = 0;
+    virtual ImageD3D *createImage()                                                        = 0;
     virtual gl::Error generateMipmap(const gl::Context *context,
                                      ImageD3D *dest,
-                                     ImageD3D *source) = 0;
+                                     ImageD3D *source)                                     = 0;
     virtual gl::Error generateMipmapUsingD3D(const gl::Context *context,
                                              TextureStorage *storage,
-                                             const gl::TextureState &textureState) = 0;
+                                             const gl::TextureState &textureState)         = 0;
     virtual gl::Error copyImage(const gl::Context *context,
                                 ImageD3D *dest,
                                 ImageD3D *source,
@@ -234,17 +239,36 @@
                                 const gl::Offset &destOffset,
                                 bool unpackFlipY,
                                 bool unpackPremultiplyAlpha,
-                                bool unpackUnmultiplyAlpha)                 = 0;
-    virtual TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain) = 0;
+                                bool unpackUnmultiplyAlpha)                                = 0;
+    virtual TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain)                = 0;
     virtual TextureStorage *createTextureStorageEGLImage(EGLImageD3D *eglImage,
                                                          RenderTargetD3D *renderTargetD3D) = 0;
     virtual TextureStorage *createTextureStorageExternal(
         egl::Stream *stream,
-        const egl::Stream::GLTextureDescription &desc) = 0;
-    virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly) = 0;
-    virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly) = 0;
-    virtual TextureStorage *createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels) = 0;
-    virtual TextureStorage *createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels) = 0;
+        const egl::Stream::GLTextureDescription &desc)                                   = 0;
+    virtual TextureStorage *createTextureStorage2D(GLenum internalformat,
+                                                   bool renderTarget,
+                                                   GLsizei width,
+                                                   GLsizei height,
+                                                   int levels,
+                                                   bool hintLevelZeroOnly)               = 0;
+    virtual TextureStorage *createTextureStorageCube(GLenum internalformat,
+                                                     bool renderTarget,
+                                                     int size,
+                                                     int levels,
+                                                     bool hintLevelZeroOnly)             = 0;
+    virtual TextureStorage *createTextureStorage3D(GLenum internalformat,
+                                                   bool renderTarget,
+                                                   GLsizei width,
+                                                   GLsizei height,
+                                                   GLsizei depth,
+                                                   int levels)                           = 0;
+    virtual TextureStorage *createTextureStorage2DArray(GLenum internalformat,
+                                                        bool renderTarget,
+                                                        GLsizei width,
+                                                        GLsizei height,
+                                                        GLsizei depth,
+                                                        int levels)                      = 0;
     virtual TextureStorage *createTextureStorage2DMultisample(GLenum internalformat,
                                                               GLsizei width,
                                                               GLsizei height,
@@ -260,17 +284,17 @@
                                               RenderTargetD3D *destRenderTarget,
                                               GLenum destinationFormat,
                                               GLenum sourcePixelsType,
-                                              const gl::Box &destArea) = 0;
+                                              const gl::Box &destArea)        = 0;
 
     // Device lost
     GLenum getResetStatus();
     void notifyDeviceLost();
-    virtual bool resetDevice() = 0;
+    virtual bool resetDevice()          = 0;
     virtual bool testDeviceLost()       = 0;
     virtual bool testDeviceResettable() = 0;
 
     virtual RendererClass getRendererClass() const = 0;
-    virtual void *getD3DDevice() = 0;
+    virtual void *getD3DDevice()                   = 0;
 
     void setGPUDisjoint();
 
@@ -320,7 +344,7 @@
     virtual void onDirtyUniformBlockBinding(GLuint uniformBlockIndex);
 
   protected:
-    virtual bool getLUID(LUID *adapterLuid) const = 0;
+    virtual bool getLUID(LUID *adapterLuid) const                    = 0;
     virtual void generateCaps(gl::Caps *outCaps,
                               gl::TextureCapsMap *outTextureCaps,
                               gl::Extensions *outExtensions,
@@ -328,7 +352,7 @@
 
     void cleanup();
 
-    bool skipDraw(const gl::State &glState, GLenum drawMode);
+    bool skipDraw(const gl::State &glState, gl::PrimitiveMode drawMode);
 
     egl::Display *mDisplay;
 
@@ -359,8 +383,8 @@
 };
 
 unsigned int GetBlendSampleMask(const gl::State &glState, int samples);
-bool InstancedPointSpritesActive(ProgramD3D *programD3D, GLenum mode);
+bool InstancedPointSpritesActive(ProgramD3D *programD3D, gl::PrimitiveMode mode);
 
 }  // namespace rx
 
-#endif // LIBANGLE_RENDERER_D3D_RENDERERD3D_H_
+#endif  // LIBANGLE_RENDERER_D3D_RENDERERD3D_H_
diff --git a/src/libANGLE/renderer/d3d/d3d11/Context11.cpp b/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
index 0509f38..d87300b 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
@@ -34,7 +34,7 @@
 
 namespace
 {
-bool DrawCallHasStreamingVertexArrays(const gl::Context *context, GLenum mode)
+bool DrawCallHasStreamingVertexArrays(const gl::Context *context, gl::PrimitiveMode mode)
 {
     const gl::State &glState           = context->getGLState();
     const gl::VertexArray *vertexArray = glState.getVertexArray();
@@ -42,8 +42,8 @@
     // Direct drawing doesn't support dynamic attribute storage since it needs the first and count
     // to translate when applyVertexBuffer. GL_LINE_LOOP and GL_TRIANGLE_FAN are not supported
     // either since we need to simulate them in D3D.
-    if (vertexArray11->hasActiveDynamicAttrib(context) || mode == GL_LINE_LOOP ||
-        mode == GL_TRIANGLE_FAN)
+    if (vertexArray11->hasActiveDynamicAttrib(context) || mode == gl::PrimitiveMode::LineLoop ||
+        mode == gl::PrimitiveMode::TriangleFan)
     {
         return true;
     }
@@ -234,7 +234,10 @@
     return mRenderer->finish();
 }
 
-gl::Error Context11::drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count)
+gl::Error Context11::drawArrays(const gl::Context *context,
+                                gl::PrimitiveMode mode,
+                                GLint first,
+                                GLsizei count)
 {
     const gl::DrawCallParams &drawCallParams = context->getParams<gl::DrawCallParams>();
     ASSERT(!drawCallParams.isDrawElements() && !drawCallParams.isDrawIndirect());
@@ -243,7 +246,7 @@
 }
 
 gl::Error Context11::drawArraysInstanced(const gl::Context *context,
-                                         GLenum mode,
+                                         gl::PrimitiveMode mode,
                                          GLint first,
                                          GLsizei count,
                                          GLsizei instanceCount)
@@ -255,7 +258,7 @@
 }
 
 gl::Error Context11::drawElements(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLsizei count,
                                   GLenum type,
                                   const void *indices)
@@ -267,7 +270,7 @@
 }
 
 gl::Error Context11::drawElementsInstanced(const gl::Context *context,
-                                           GLenum mode,
+                                           gl::PrimitiveMode mode,
                                            GLsizei count,
                                            GLenum type,
                                            const void *indices,
@@ -280,7 +283,7 @@
 }
 
 gl::Error Context11::drawRangeElements(const gl::Context *context,
-                                       GLenum mode,
+                                       gl::PrimitiveMode mode,
                                        GLuint start,
                                        GLuint end,
                                        GLsizei count,
@@ -294,7 +297,7 @@
 }
 
 gl::Error Context11::drawArraysIndirect(const gl::Context *context,
-                                        GLenum mode,
+                                        gl::PrimitiveMode mode,
                                         const void *indirect)
 {
     if (DrawCallHasStreamingVertexArrays(context, mode))
@@ -316,7 +319,7 @@
 }
 
 gl::Error Context11::drawElementsIndirect(const gl::Context *context,
-                                          GLenum mode,
+                                          gl::PrimitiveMode mode,
                                           GLenum type,
                                           const void *indirect)
 {
@@ -455,7 +458,7 @@
 }
 
 gl::Error Context11::triggerDrawCallProgramRecompilation(const gl::Context *context,
-                                                         GLenum drawMode)
+                                                         gl::PrimitiveMode drawMode)
 {
     const auto &glState    = context->getGLState();
     const auto *va11       = GetImplAs<VertexArray11>(glState.getVertexArray());
diff --git a/src/libANGLE/renderer/d3d/d3d11/Context11.h b/src/libANGLE/renderer/d3d/d3d11/Context11.h
index 50829c4..b6e36a1 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Context11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/Context11.h
@@ -68,38 +68,38 @@
 
     // Drawing methods.
     gl::Error drawArrays(const gl::Context *context,
-                         GLenum mode,
+                         gl::PrimitiveMode mode,
                          GLint first,
                          GLsizei count) override;
     gl::Error drawArraysInstanced(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLint first,
                                   GLsizei count,
                                   GLsizei instanceCount) override;
 
     gl::Error drawElements(const gl::Context *context,
-                           GLenum mode,
+                           gl::PrimitiveMode mode,
                            GLsizei count,
                            GLenum type,
                            const void *indices) override;
     gl::Error drawElementsInstanced(const gl::Context *context,
-                                    GLenum mode,
+                                    gl::PrimitiveMode mode,
                                     GLsizei count,
                                     GLenum type,
                                     const void *indices,
                                     GLsizei instances) override;
     gl::Error drawRangeElements(const gl::Context *context,
-                                GLenum mode,
+                                gl::PrimitiveMode mode,
                                 GLuint start,
                                 GLuint end,
                                 GLsizei count,
                                 GLenum type,
                                 const void *indices) override;
     gl::Error drawArraysIndirect(const gl::Context *context,
-                                 GLenum mode,
+                                 gl::PrimitiveMode mode,
                                  const void *indirect) override;
     gl::Error drawElementsIndirect(const gl::Context *context,
-                                   GLenum mode,
+                                   gl::PrimitiveMode mode,
                                    GLenum type,
                                    const void *indirect) override;
 
@@ -146,7 +146,8 @@
     gl::Error memoryBarrier(const gl::Context *context, GLbitfield barriers) override;
     gl::Error memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) override;
 
-    gl::Error triggerDrawCallProgramRecompilation(const gl::Context *context, GLenum drawMode);
+    gl::Error triggerDrawCallProgramRecompilation(const gl::Context *context,
+                                                  gl::PrimitiveMode drawMode);
 
   private:
     gl::Error prepareForDrawCall(const gl::Context *context,
diff --git a/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp b/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
index f8f8865..c58cb4a 100644
--- a/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp
@@ -62,7 +62,7 @@
     uint8_t divisor;
 };
 
-} // anonymous namespace
+}  // anonymous namespace
 
 PackedAttributeLayout::PackedAttributeLayout() : numAttributes(0), flags(0), attributeData({})
 {
@@ -78,17 +78,18 @@
     gl::AttributeType attribType = gl::GetAttributeType(glType);
 
     PackedAttribute packedAttrib;
-    packedAttrib.attribType = static_cast<uint8_t>(attribType);
-    packedAttrib.semanticIndex = static_cast<uint8_t>(semanticIndex);
+    packedAttrib.attribType       = static_cast<uint8_t>(attribType);
+    packedAttrib.semanticIndex    = static_cast<uint8_t>(semanticIndex);
     packedAttrib.vertexFormatType = static_cast<uint8_t>(vertexFormatType);
-    packedAttrib.divisor = static_cast<uint8_t>(divisor);
+    packedAttrib.divisor          = static_cast<uint8_t>(divisor);
 
     ASSERT(static_cast<gl::AttributeType>(packedAttrib.attribType) == attribType);
     ASSERT(static_cast<UINT>(packedAttrib.semanticIndex) == semanticIndex);
     ASSERT(static_cast<gl::VertexFormatType>(packedAttrib.vertexFormatType) == vertexFormatType);
     ASSERT(static_cast<unsigned int>(packedAttrib.divisor) == divisor);
 
-    static_assert(sizeof(uint32_t) == sizeof(PackedAttribute), "PackedAttributes must be 32-bits exactly.");
+    static_assert(sizeof(uint32_t) == sizeof(PackedAttribute),
+                  "PackedAttributes must be 32-bits exactly.");
 
     attributeData[numAttributes++] = gl::bitCast<uint32_t>(packedAttrib);
 }
@@ -128,7 +129,7 @@
     bool programUsesInstancedPointSprites =
         programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation();
     bool instancedPointSpritesActive =
-        programUsesInstancedPointSprites && (drawCallParams.mode() == GL_POINTS);
+        programUsesInstancedPointSprites && (drawCallParams.mode() == gl::PrimitiveMode::Points);
 
     if (programUsesInstancedPointSprites)
     {
@@ -156,9 +157,9 @@
         // This will prevent mismatched vertex shaders from using the same input layout
         GLenum glslElementType = GetGLSLAttributeType(shaderAttributes, attribIndex);
 
-        const auto &attrib = attribs[attribIndex];
+        const auto &attrib  = attribs[attribIndex];
         const auto &binding = bindings[attrib.bindingIndex];
-        int d3dSemantic    = locationToSemantic[attribIndex];
+        int d3dSemantic     = locationToSemantic[attribIndex];
 
         const auto &currentValue =
             state.getVertexAttribCurrentValue(static_cast<unsigned int>(attribIndex));
@@ -183,7 +184,7 @@
             ANGLE_TRY(createInputLayout(renderer, sortedSemanticIndices, currentAttributes, program,
                                         drawCallParams, &newInputLayout));
 
-            auto insertIt = mLayoutCache.Put(layout, std::move(newInputLayout));
+            auto insertIt   = mLayoutCache.Put(layout, std::move(newInputLayout));
             *inputLayoutOut = &insertIt->second;
         }
     }
@@ -258,7 +259,7 @@
         {
             // If rendering points and instanced pointsprite emulation is being used, the
             // inputClass is required to be configured as per instance data
-            if (drawCallParams.mode() == GL_POINTS)
+            if (drawCallParams.mode() == gl::PrimitiveMode::Points)
             {
                 inputElements[elementIndex].InputSlotClass       = D3D11_INPUT_PER_INSTANCE_DATA;
                 inputElements[elementIndex].InstanceDataStepRate = 1;
diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 65c5a39..3abc0d1 100644
--- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -422,8 +422,8 @@
       mScratchMemoryBuffer(ScratchMemoryBufferLifetime),
       mAnnotator(nullptr)
 {
-    mLineLoopIB       = nullptr;
-    mTriangleFanIB    = nullptr;
+    mLineLoopIB    = nullptr;
+    mTriangleFanIB = nullptr;
 
     mBlit          = nullptr;
     mPixelTransfer = nullptr;
@@ -432,13 +432,13 @@
 
     mTrim = nullptr;
 
-    mRenderer11DeviceCaps.supportsClearView             = false;
-    mRenderer11DeviceCaps.supportsConstantBufferOffsets = false;
+    mRenderer11DeviceCaps.supportsClearView                      = false;
+    mRenderer11DeviceCaps.supportsConstantBufferOffsets          = false;
     mRenderer11DeviceCaps.supportsVpRtIndexWriteFromVertexShader = false;
-    mRenderer11DeviceCaps.supportsDXGI1_2               = false;
-    mRenderer11DeviceCaps.B5G6R5support                 = 0;
-    mRenderer11DeviceCaps.B4G4R4A4support               = 0;
-    mRenderer11DeviceCaps.B5G5R5A1support               = 0;
+    mRenderer11DeviceCaps.supportsDXGI1_2                        = false;
+    mRenderer11DeviceCaps.B5G6R5support                          = 0;
+    mRenderer11DeviceCaps.B4G4R4A4support                        = 0;
+    mRenderer11DeviceCaps.B5G5R5A1support                        = 0;
 
     mD3d11Module          = nullptr;
     mDxgiModule           = nullptr;
@@ -529,12 +529,12 @@
 
         // Also set EGL_PLATFORM_ANGLE_ANGLE variables, in case they're used elsewhere in ANGLE
         // mAvailableFeatureLevels defaults to empty
-        mRequestedDriverType    = D3D_DRIVER_TYPE_UNKNOWN;
+        mRequestedDriverType = D3D_DRIVER_TYPE_UNKNOWN;
     }
 
     const EGLenum presentPath = static_cast<EGLenum>(attributes.get(
         EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE, EGL_EXPERIMENTAL_PRESENT_PATH_COPY_ANGLE));
-    mPresentPathFastEnabled = (presentPath == EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE);
+    mPresentPathFastEnabled   = (presentPath == EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE);
 
 // The D3D11 renderer must choose the D3D9 debug annotator because the D3D11 interface
 // method ID3DUserDefinedAnnotation::GetStatus on desktop builds doesn't work with the Graphics
@@ -940,7 +940,7 @@
 
     if (getWorkarounds().disableB5G6R5Support)
     {
-        mRenderer11DeviceCaps.B5G6R5support = 0;
+        mRenderer11DeviceCaps.B5G6R5support    = 0;
         mRenderer11DeviceCaps.B5G6R5maxSamples = 0;
     }
     else
@@ -1080,9 +1080,9 @@
                 config.bindToTextureRGBA = (((colorBufferFormatInfo.format == GL_RGBA) ||
                                              (colorBufferFormatInfo.format == GL_BGRA_EXT)) &&
                                             (sampleCount <= 1));
-                config.colorBufferType = EGL_RGB_BUFFER;
-                config.configCaveat    = EGL_NONE;
-                config.configID        = static_cast<EGLint>(configs.size() + 1);
+                config.colorBufferType   = EGL_RGB_BUFFER;
+                config.configCaveat      = EGL_NONE;
+                config.configID          = static_cast<EGLint>(configs.size() + 1);
 
                 // PresentPathFast may not be conformant
                 config.conformant = 0;
@@ -1470,13 +1470,13 @@
         return gl::NoError();
     }
 
-    if (params.mode() == GL_LINE_LOOP)
+    if (params.mode() == gl::PrimitiveMode::LineLoop)
     {
         return drawLineLoop(context, clampedVertexCount, GL_NONE, nullptr, 0,
                             adjustedInstanceCount);
     }
 
-    if (params.mode() == GL_TRIANGLE_FAN)
+    if (params.mode() == gl::PrimitiveMode::TriangleFan)
     {
         return drawTriangleFan(context, clampedVertexCount, GL_NONE, nullptr, 0,
                                adjustedInstanceCount);
@@ -1485,7 +1485,7 @@
     bool useInstancedPointSpriteEmulation =
         programD3D->usesPointSize() && getWorkarounds().useInstancedPointSpriteEmulation;
 
-    if (params.mode() != GL_POINTS || !useInstancedPointSpriteEmulation)
+    if (params.mode() != gl::PrimitiveMode::Points || !useInstancedPointSpriteEmulation)
     {
         if (adjustedInstanceCount == 0)
         {
@@ -1547,13 +1547,13 @@
     const gl::Program *program    = glState.getProgram();
     GLsizei adjustedInstanceCount = GetAdjustedInstanceCount(program, params.instances());
 
-    if (params.mode() == GL_LINE_LOOP)
+    if (params.mode() == gl::PrimitiveMode::LineLoop)
     {
         return drawLineLoop(context, params.indexCount(), params.type(), params.indices(),
                             baseVertex, adjustedInstanceCount);
     }
 
-    if (params.mode() == GL_TRIANGLE_FAN)
+    if (params.mode() == gl::PrimitiveMode::TriangleFan)
     {
         return drawTriangleFan(context, params.indexCount(), params.type(), params.indices(),
                                baseVertex, adjustedInstanceCount);
@@ -1561,7 +1561,8 @@
 
     const ProgramD3D *programD3D = GetImplAs<ProgramD3D>(glState.getProgram());
 
-    if (params.mode() != GL_POINTS || !programD3D->usesInstancedPointSpriteEmulation())
+    if (params.mode() != gl::PrimitiveMode::Points ||
+        !programD3D->usesInstancedPointSpriteEmulation())
     {
         if (adjustedInstanceCount == 0)
         {
@@ -1717,9 +1718,9 @@
 
     ANGLE_TRY(mLineLoopIB->unmapBuffer());
 
-    IndexBuffer11 *indexBuffer   = GetAs<IndexBuffer11>(mLineLoopIB->getIndexBuffer());
+    IndexBuffer11 *indexBuffer          = GetAs<IndexBuffer11>(mLineLoopIB->getIndexBuffer());
     const d3d11::Buffer &d3dIndexBuffer = indexBuffer->getBuffer();
-    DXGI_FORMAT indexFormat      = indexBuffer->getIndexFormat();
+    DXGI_FORMAT indexFormat             = indexBuffer->getIndexFormat();
 
     mStateManager.setIndexBuffer(d3dIndexBuffer.get(), indexFormat, offset);
 
@@ -1800,9 +1801,9 @@
 
     ANGLE_TRY(mTriangleFanIB->unmapBuffer());
 
-    IndexBuffer11 *indexBuffer   = GetAs<IndexBuffer11>(mTriangleFanIB->getIndexBuffer());
+    IndexBuffer11 *indexBuffer          = GetAs<IndexBuffer11>(mTriangleFanIB->getIndexBuffer());
     const d3d11::Buffer &d3dIndexBuffer = indexBuffer->getBuffer();
-    DXGI_FORMAT indexFormat      = indexBuffer->getIndexFormat();
+    DXGI_FORMAT indexFormat             = indexBuffer->getIndexFormat();
 
     mStateManager.setIndexBuffer(d3dIndexBuffer.get(), indexFormat, offset);
 
@@ -3023,7 +3024,7 @@
     ASSERT(rt11->getTexture().valid());
 
     const TextureHelper11 &textureHelper = rt11->getTexture();
-    unsigned int sourceSubResource = rt11->getSubresourceIndex();
+    unsigned int sourceSubResource       = rt11->getSubresourceIndex();
 
     const gl::Extents &texSize = textureHelper.getExtents();
 
@@ -3122,7 +3123,7 @@
     // tracking in the 'pixelBuffer' members, causing leaks. Instead we must use
     // pixelBuffer.set() twice, which performs the addRef/release correctly
     gl::PixelPackState invertTexturePack;
-    invertTexturePack.alignment = pack.alignment;
+    invertTexturePack.alignment       = pack.alignment;
     invertTexturePack.reverseRowOrder = !pack.reverseRowOrder;
 
     PackPixelsParams packParams(safeArea, format, type, outputPitch, invertTexturePack, packBuffer,
@@ -3178,7 +3179,7 @@
     }
 
     const TextureHelper11 &drawTexture = drawRenderTarget11->getTexture();
-    unsigned int drawSubresource    = drawRenderTarget11->getSubresourceIndex();
+    unsigned int drawSubresource       = drawRenderTarget11->getSubresourceIndex();
 
     RenderTarget11 *readRenderTarget11 = GetAs<RenderTarget11>(readRenderTarget);
     if (!readRenderTarget11)
@@ -3188,7 +3189,7 @@
     }
 
     TextureHelper11 readTexture;
-    unsigned int readSubresource      = 0;
+    unsigned int readSubresource = 0;
     d3d11::SharedSRV readSRV;
 
     if (readRenderTarget->isMultisampled())
diff --git a/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp b/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
index ce1ad21..155a3b7 100644
--- a/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
@@ -303,8 +303,8 @@
 
 bool ShaderConstants11::updateSamplerMetadata(SamplerMetadata *data, const gl::Texture &texture)
 {
-    bool dirty             = false;
-    unsigned int baseLevel = texture.getTextureState().getEffectiveBaseLevel();
+    bool dirty               = false;
+    unsigned int baseLevel   = texture.getTextureState().getEffectiveBaseLevel();
     gl::TextureTarget target = (texture.getType() == gl::TextureType::CubeMap)
                                    ? gl::kCubeMapTextureTargetMin
                                    : gl::NonCubeTextureTypeToTarget(texture.getType());
@@ -509,29 +509,29 @@
         case gl::ShaderType::Vertex:
             dirty = mShaderConstantsDirty[gl::ShaderType::Vertex] ||
                     (mNumActiveVSSamplers < numSamplers);
-            dataSize                = sizeof(Vertex);
-            data                    = reinterpret_cast<const uint8_t *>(&mVertex);
-            samplerData             = reinterpret_cast<const uint8_t *>(mSamplerMetadataVS.data());
+            dataSize    = sizeof(Vertex);
+            data        = reinterpret_cast<const uint8_t *>(&mVertex);
+            samplerData = reinterpret_cast<const uint8_t *>(mSamplerMetadataVS.data());
             mShaderConstantsDirty.set(gl::ShaderType::Vertex, false);
-            mNumActiveVSSamplers    = numSamplers;
+            mNumActiveVSSamplers = numSamplers;
             break;
         case gl::ShaderType::Fragment:
             dirty = mShaderConstantsDirty[gl::ShaderType::Fragment] ||
                     (mNumActivePSSamplers < numSamplers);
-            dataSize                = sizeof(Pixel);
-            data                    = reinterpret_cast<const uint8_t *>(&mPixel);
-            samplerData             = reinterpret_cast<const uint8_t *>(mSamplerMetadataPS.data());
+            dataSize    = sizeof(Pixel);
+            data        = reinterpret_cast<const uint8_t *>(&mPixel);
+            samplerData = reinterpret_cast<const uint8_t *>(mSamplerMetadataPS.data());
             mShaderConstantsDirty.set(gl::ShaderType::Fragment, false);
-            mNumActivePSSamplers    = numSamplers;
+            mNumActivePSSamplers = numSamplers;
             break;
         case gl::ShaderType::Compute:
             dirty = mShaderConstantsDirty[gl::ShaderType::Compute] ||
                     (mNumActiveCSSamplers < numSamplers);
-            dataSize                = sizeof(Compute);
-            data                    = reinterpret_cast<const uint8_t *>(&mCompute);
-            samplerData             = reinterpret_cast<const uint8_t *>(mSamplerMetadataCS.data());
+            dataSize    = sizeof(Compute);
+            data        = reinterpret_cast<const uint8_t *>(&mCompute);
+            samplerData = reinterpret_cast<const uint8_t *>(mSamplerMetadataCS.data());
             mShaderConstantsDirty.set(gl::ShaderType::Compute, false);
-            mNumActiveCSSamplers    = numSamplers;
+            mNumActiveCSSamplers = numSamplers;
             break;
         default:
             UNREACHABLE();
@@ -551,8 +551,7 @@
         renderer->mapResource(driverConstantBuffer.get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mapping));
 
     memcpy(mapping.pData, data, dataSize);
-    memcpy(reinterpret_cast<uint8_t *>(mapping.pData) + dataSize,
-           samplerData,
+    memcpy(reinterpret_cast<uint8_t *>(mapping.pData) + dataSize, samplerData,
            sizeof(SamplerMetadata) * numSamplers);
 
     renderer->getDeviceContext()->Unmap(driverConstantBuffer.get(), 0);
@@ -582,7 +581,7 @@
       mCurrentInputLayout(),
       mDirtyVertexBufferRange(gl::MAX_VERTEX_ATTRIBS, 0),
       mCurrentPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_UNDEFINED),
-      mLastAppliedDrawMode(GL_INVALID_INDEX),
+      mLastAppliedDrawMode(gl::PrimitiveMode::InvalidEnum),
       mCurrentMinimumDrawCount(0),
       mDirtySwizzles(false),
       mAppliedIB(nullptr),
@@ -661,7 +660,7 @@
     if (record.view != reinterpret_cast<uintptr_t>(srv))
     {
         ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
-        ID3D11ShaderResourceView *srvPtr = srv ? srv->get() : nullptr;
+        ID3D11ShaderResourceView *srvPtr   = srv ? srv->get() : nullptr;
         switch (shaderType)
         {
             case gl::ShaderType::Vertex:
@@ -1177,7 +1176,7 @@
     }
     if (!modifiedGLState.stencilTest)
     {
-        modifiedGLState.stencilWritemask = 0;
+        modifiedGLState.stencilWritemask     = 0;
         modifiedGLState.stencilBackWritemask = 0;
     }
 
@@ -1211,7 +1210,7 @@
 {
     // TODO: Remove pointDrawMode and multiSample from gl::RasterizerState.
     gl::RasterizerState rasterState = context->getGLState().getRasterizerState();
-    rasterState.pointDrawMode       = (drawCallParams.mode() == GL_POINTS);
+    rasterState.pointDrawMode       = (drawCallParams.mode() == gl::PrimitiveMode::Points);
     rasterState.multiSample         = mCurRasterState.multiSample;
 
     ID3D11RasterizerState *dxRasterState = nullptr;
@@ -1273,8 +1272,8 @@
         mRenderer->getDeviceContext()->RSSetScissorRects(numRectangles, rectangles.data());
     }
 
-    mCurScissorRect      = scissor;
-    mCurScissorEnabled   = enabled;
+    mCurScissorRect    = scissor;
+    mCurScissorEnabled = enabled;
 }
 
 void StateManager11::syncViewport(const gl::Context *context)
@@ -1451,7 +1450,7 @@
 
 void StateManager11::invalidateVertexBuffer()
 {
-    unsigned int limit = std::min<unsigned int>(mRenderer->getNativeCaps().maxVertexAttributes,
+    unsigned int limit      = std::min<unsigned int>(mRenderer->getNativeCaps().maxVertexAttributes,
                                                 gl::MAX_VERTEX_ATTRIBS);
     mDirtyVertexBufferRange = gl::RangeUI(0, limit);
     invalidateInputLayout();
@@ -1895,12 +1894,12 @@
         if (vertexAttributes[attribIndex].enabled)
             continue;
 
-        const auto *attrib                   = &vertexAttributes[attribIndex];
-        const auto &currentValue             = glState.getVertexAttribCurrentValue(attribIndex);
+        const auto *attrib                      = &vertexAttributes[attribIndex];
+        const auto &currentValue                = glState.getVertexAttribCurrentValue(attribIndex);
         TranslatedAttribute *currentValueAttrib = &mCurrentValueAttribs[attribIndex];
-        currentValueAttrib->currentValueType = currentValue.Type;
-        currentValueAttrib->attribute        = attrib;
-        currentValueAttrib->binding          = &vertexBindings[attrib->bindingIndex];
+        currentValueAttrib->currentValueType    = currentValue.Type;
+        currentValueAttrib->attribute           = attrib;
+        currentValueAttrib->binding             = &vertexBindings[attrib->bindingIndex];
 
         mDirtyVertexBufferRange.extend(static_cast<unsigned int>(attribIndex));
 
@@ -2052,7 +2051,7 @@
         mLastAppliedDrawMode = drawCallParams.mode();
         mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY);
 
-        bool pointDrawMode = (drawCallParams.mode() == GL_POINTS);
+        bool pointDrawMode = (drawCallParams.mode() == gl::PrimitiveMode::Points);
         if (pointDrawMode != mCurRasterState.pointDrawMode)
         {
             mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE);
@@ -2667,7 +2666,7 @@
 // 6. An internal shader was used.             -> triggered in StateManager11::set*Shader.
 // 7. Drawing with/without point sprites.      -> checked in StateManager11::updateState.
 // TODO(jmadill): Use dirty bits for transform feedback.
-gl::Error StateManager11::syncProgram(const gl::Context *context, GLenum drawMode)
+gl::Error StateManager11::syncProgram(const gl::Context *context, gl::PrimitiveMode drawMode)
 {
     Context11 *context11 = GetImplAs<Context11>(context);
     ANGLE_TRY(context11->triggerDrawCallProgramRecompilation(context, drawMode));
@@ -2777,7 +2776,7 @@
     bool programUsesInstancedPointSprites =
         programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation();
     bool instancedPointSpritesActive =
-        programUsesInstancedPointSprites && (drawCallParams.mode() == GL_POINTS);
+        programUsesInstancedPointSprites && (drawCallParams.mode() == gl::PrimitiveMode::Points);
 
     // Note that if we use instance emulation, we reserve the first buffer slot.
     size_t reservedBuffers = GetReservedBufferCount(programUsesInstancedPointSprites);
@@ -3053,7 +3052,7 @@
     for (unsigned int i = 0; i < samplerRange; i++)
     {
         gl::TextureType textureType = programD3D->getSamplerTextureType(type, i);
-        GLint textureUnit  = programD3D->getSamplerMapping(type, i, context->getCaps());
+        GLint textureUnit           = programD3D->getSamplerMapping(type, i, context->getCaps());
         if (textureUnit != -1)
         {
             gl::Texture *texture = glState.getSamplerTexture(textureUnit, textureType);
@@ -3451,13 +3450,13 @@
 
 void StateManager11::syncPrimitiveTopology(const gl::State &glState,
                                            ProgramD3D *programD3D,
-                                           GLenum currentDrawMode)
+                                           gl::PrimitiveMode currentDrawMode)
 {
     D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
 
     switch (currentDrawMode)
     {
-        case GL_POINTS:
+        case gl::PrimitiveMode::Points:
         {
             bool usesPointSize = programD3D->usesPointSize();
 
@@ -3485,30 +3484,30 @@
             mCurrentMinimumDrawCount = 1;
             break;
         }
-        case GL_LINES:
+        case gl::PrimitiveMode::Lines:
             primitiveTopology        = D3D_PRIMITIVE_TOPOLOGY_LINELIST;
             mCurrentMinimumDrawCount = 2;
             break;
-        case GL_LINE_LOOP:
+        case gl::PrimitiveMode::LineLoop:
             primitiveTopology        = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
             mCurrentMinimumDrawCount = 2;
             break;
-        case GL_LINE_STRIP:
+        case gl::PrimitiveMode::LineStrip:
             primitiveTopology        = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
             mCurrentMinimumDrawCount = 2;
             break;
-        case GL_TRIANGLES:
+        case gl::PrimitiveMode::Triangles:
             primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
             mCurrentMinimumDrawCount =
                 CullsEverything(glState) ? std::numeric_limits<GLsizei>::max() : 3;
             break;
-        case GL_TRIANGLE_STRIP:
+        case gl::PrimitiveMode::TriangleStrip:
             primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
             mCurrentMinimumDrawCount =
                 CullsEverything(glState) ? std::numeric_limits<GLsizei>::max() : 3;
             break;
         // emulate fans via rewriting index buffer
-        case GL_TRIANGLE_FAN:
+        case gl::PrimitiveMode::TriangleFan:
             primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
             mCurrentMinimumDrawCount =
                 CullsEverything(glState) ? std::numeric_limits<GLsizei>::max() : 3;
diff --git a/src/libANGLE/renderer/d3d/d3d11/StateManager11.h b/src/libANGLE/renderer/d3d/d3d11/StateManager11.h
index a7fbfab..d38aba0 100644
--- a/src/libANGLE/renderer/d3d/d3d11/StateManager11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/StateManager11.h
@@ -282,7 +282,7 @@
     void checkPresentPath(const gl::Context *context);
 
     gl::Error syncFramebuffer(const gl::Context *context, gl::Framebuffer *framebuffer);
-    gl::Error syncProgram(const gl::Context *context, GLenum drawMode);
+    gl::Error syncProgram(const gl::Context *context, gl::PrimitiveMode drawMode);
 
     gl::Error syncTextures(const gl::Context *context);
     gl::Error applyTextures(const gl::Context *context, gl::ShaderType shaderType);
@@ -346,7 +346,7 @@
     bool setPrimitiveTopologyInternal(D3D11_PRIMITIVE_TOPOLOGY primitiveTopology);
     void syncPrimitiveTopology(const gl::State &glState,
                                ProgramD3D *programD3D,
-                               GLenum currentDrawMode);
+                               gl::PrimitiveMode currentDrawMode);
 
     // Not handled by an internal dirty bit because it isn't synced on drawArrays calls.
     gl::Error applyIndexBuffer(const gl::Context *context,
@@ -486,7 +486,7 @@
 
     // Currently applied primitive topology
     D3D11_PRIMITIVE_TOPOLOGY mCurrentPrimitiveTopology;
-    GLenum mLastAppliedDrawMode;
+    gl::PrimitiveMode mLastAppliedDrawMode;
     GLsizei mCurrentMinimumDrawCount;
 
     // Currently applied shaders
diff --git a/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp b/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp
index 3e557be..53944c7 100644
--- a/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp
@@ -30,7 +30,7 @@
 {
 }
 
-void TransformFeedback11::begin(GLenum primitiveMode)
+void TransformFeedback11::begin(gl::PrimitiveMode primitiveMode)
 {
     // Reset all the cached offsets to the binding offsets
     mIsDirty = true;
diff --git a/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h b/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h
index cc9fcc3..35cbfe4 100644
--- a/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h
+++ b/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.h
@@ -27,7 +27,7 @@
     TransformFeedback11(const gl::TransformFeedbackState &state, Renderer11 *renderer);
     ~TransformFeedback11() override;
 
-    void begin(GLenum primitiveMode) override;
+    void begin(gl::PrimitiveMode primitiveMode) override;
     void end() override;
     void pause() override;
     void resume() override;
diff --git a/src/libANGLE/renderer/d3d/d3d9/Blit9.h b/src/libANGLE/renderer/d3d/d3d9/Blit9.h
index f34d13b..ee4e5a3 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Blit9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/Blit9.h
@@ -132,9 +132,12 @@
     IUnknown *mCompiledShaders[SHADER_COUNT];
 
     template <class D3DShaderType>
-    gl::Error setShader(ShaderId source, const char *profile,
-                        gl::Error (Renderer9::*createShader)(const DWORD *, size_t length, D3DShaderType **outShader),
-                        HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*));
+    gl::Error setShader(ShaderId source,
+                        const char *profile,
+                        gl::Error (Renderer9::*createShader)(const DWORD *,
+                                                             size_t length,
+                                                             D3DShaderType **outShader),
+                        HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType *));
 
     gl::Error setVertexShader(ShaderId shader);
     gl::Error setPixelShader(ShaderId shader);
@@ -146,7 +149,6 @@
     IDirect3DSurface9 *mSavedRenderTarget;
     IDirect3DSurface9 *mSavedDepthStencil;
 };
-
 }
 
-#endif   // LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
+#endif  // LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
diff --git a/src/libANGLE/renderer/d3d/d3d9/Context9.cpp b/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
index 3ea733f..357af5b 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
@@ -141,13 +141,16 @@
     return mRenderer->finish();
 }
 
-gl::Error Context9::drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count)
+gl::Error Context9::drawArrays(const gl::Context *context,
+                               gl::PrimitiveMode mode,
+                               GLint first,
+                               GLsizei count)
 {
     return mRenderer->genericDrawArrays(context, mode, first, count, 0);
 }
 
 gl::Error Context9::drawArraysInstanced(const gl::Context *context,
-                                        GLenum mode,
+                                        gl::PrimitiveMode mode,
                                         GLint first,
                                         GLsizei count,
                                         GLsizei instanceCount)
@@ -156,7 +159,7 @@
 }
 
 gl::Error Context9::drawElements(const gl::Context *context,
-                                 GLenum mode,
+                                 gl::PrimitiveMode mode,
                                  GLsizei count,
                                  GLenum type,
                                  const void *indices)
@@ -165,7 +168,7 @@
 }
 
 gl::Error Context9::drawElementsInstanced(const gl::Context *context,
-                                          GLenum mode,
+                                          gl::PrimitiveMode mode,
                                           GLsizei count,
                                           GLenum type,
                                           const void *indices,
@@ -175,7 +178,7 @@
 }
 
 gl::Error Context9::drawRangeElements(const gl::Context *context,
-                                      GLenum mode,
+                                      gl::PrimitiveMode mode,
                                       GLuint start,
                                       GLuint end,
                                       GLsizei count,
@@ -186,7 +189,7 @@
 }
 
 gl::Error Context9::drawArraysIndirect(const gl::Context *context,
-                                       GLenum mode,
+                                       gl::PrimitiveMode mode,
                                        const void *indirect)
 {
     UNREACHABLE();
@@ -194,7 +197,7 @@
 }
 
 gl::Error Context9::drawElementsIndirect(const gl::Context *context,
-                                         GLenum mode,
+                                         gl::PrimitiveMode mode,
                                          GLenum type,
                                          const void *indirect)
 {
diff --git a/src/libANGLE/renderer/d3d/d3d9/Context9.h b/src/libANGLE/renderer/d3d/d3d9/Context9.h
index 321ffba..d2a372a 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Context9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/Context9.h
@@ -68,38 +68,38 @@
 
     // Drawing methods.
     gl::Error drawArrays(const gl::Context *context,
-                         GLenum mode,
+                         gl::PrimitiveMode mode,
                          GLint first,
                          GLsizei count) override;
     gl::Error drawArraysInstanced(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLint first,
                                   GLsizei count,
                                   GLsizei instanceCount) override;
 
     gl::Error drawElements(const gl::Context *context,
-                           GLenum mode,
+                           gl::PrimitiveMode mode,
                            GLsizei count,
                            GLenum type,
                            const void *indices) override;
     gl::Error drawElementsInstanced(const gl::Context *context,
-                                    GLenum mode,
+                                    gl::PrimitiveMode mode,
                                     GLsizei count,
                                     GLenum type,
                                     const void *indices,
                                     GLsizei instances) override;
     gl::Error drawRangeElements(const gl::Context *context,
-                                GLenum mode,
+                                gl::PrimitiveMode mode,
                                 GLuint start,
                                 GLuint end,
                                 GLsizei count,
                                 GLenum type,
                                 const void *indices) override;
     gl::Error drawArraysIndirect(const gl::Context *context,
-                                 GLenum mode,
+                                 gl::PrimitiveMode mode,
                                  const void *indirect) override;
     gl::Error drawElementsIndirect(const gl::Context *context,
-                                   GLenum mode,
+                                   gl::PrimitiveMode mode,
                                    GLenum type,
                                    const void *indirect) override;
 
diff --git a/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
index 1321bd8..3f7db02 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
@@ -65,8 +65,8 @@
 
     const gl::State &glState = context->getGLState();
     float nearZ              = glState.getNearPlane();
-    float farZ = glState.getFarPlane();
-    mRenderer->setViewport(glState.getViewport(), nearZ, farZ, GL_TRIANGLES,
+    float farZ               = glState.getFarPlane();
+    mRenderer->setViewport(glState.getViewport(), nearZ, farZ, gl::PrimitiveMode::Triangles,
                            glState.getRasterizerState().frontFace, true);
 
     mRenderer->setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
@@ -98,7 +98,8 @@
 
     if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
     {
-        UNIMPLEMENTED();   // FIXME: Requires resolve using StretchRect into non-multisampled render target
+        UNIMPLEMENTED();  // FIXME: Requires resolve using StretchRect into non-multisampled render
+                          // target
         SafeRelease(surface);
         return gl::OutOfMemory()
                << "ReadPixels is unimplemented for multisampled framebuffer attachments.";
@@ -167,9 +168,9 @@
     }
 
     RECT rect;
-    rect.left = gl::clamp(area.x, 0L, static_cast<LONG>(desc.Width));
-    rect.top = gl::clamp(area.y, 0L, static_cast<LONG>(desc.Height));
-    rect.right = gl::clamp(area.x + area.width, 0L, static_cast<LONG>(desc.Width));
+    rect.left   = gl::clamp(area.x, 0L, static_cast<LONG>(desc.Width));
+    rect.top    = gl::clamp(area.y, 0L, static_cast<LONG>(desc.Height));
+    rect.right  = gl::clamp(area.x + area.width, 0L, static_cast<LONG>(desc.Width));
     rect.bottom = gl::clamp(area.y + area.height, 0L, static_cast<LONG>(desc.Height));
 
     D3DLOCKED_RECT lock;
@@ -249,25 +250,25 @@
         ASSERT(drawRenderTarget);
 
         // The getSurface calls do an AddRef so save them until after no errors are possible
-        IDirect3DSurface9* readSurface = readRenderTarget->getSurface();
+        IDirect3DSurface9 *readSurface = readRenderTarget->getSurface();
         ASSERT(readSurface);
 
-        IDirect3DSurface9* drawSurface = drawRenderTarget->getSurface();
+        IDirect3DSurface9 *drawSurface = drawRenderTarget->getSurface();
         ASSERT(drawSurface);
 
         gl::Extents srcSize(readRenderTarget->getWidth(), readRenderTarget->getHeight(), 1);
         gl::Extents dstSize(drawRenderTarget->getWidth(), drawRenderTarget->getHeight(), 1);
 
         RECT srcRect;
-        srcRect.left = sourceArea.x;
-        srcRect.right = sourceArea.x + sourceArea.width;
-        srcRect.top = sourceArea.y;
+        srcRect.left   = sourceArea.x;
+        srcRect.right  = sourceArea.x + sourceArea.width;
+        srcRect.top    = sourceArea.y;
         srcRect.bottom = sourceArea.y + sourceArea.height;
 
         RECT dstRect;
-        dstRect.left = destArea.x;
-        dstRect.right = destArea.x + destArea.width;
-        dstRect.top = destArea.y;
+        dstRect.left   = destArea.x;
+        dstRect.right  = destArea.x + destArea.width;
+        dstRect.top    = destArea.y;
         dstRect.bottom = destArea.y + destArea.height;
 
         // Clip the rectangles to the scissor rectangle
@@ -339,7 +340,8 @@
             srcRect.bottom = srcSize.height;
         }
 
-        HRESULT result = device->StretchRect(readSurface, &srcRect, drawSurface, &dstRect, D3DTEXF_NONE);
+        HRESULT result =
+            device->StretchRect(readSurface, &srcRect, drawSurface, &dstRect, D3DTEXF_NONE);
 
         SafeRelease(readSurface);
         SafeRelease(drawSurface);
@@ -375,13 +377,14 @@
         ASSERT(drawDepthStencil);
 
         // The getSurface calls do an AddRef so save them until after no errors are possible
-        IDirect3DSurface9* readSurface = readDepthStencil->getSurface();
+        IDirect3DSurface9 *readSurface = readDepthStencil->getSurface();
         ASSERT(readDepthStencil);
 
-        IDirect3DSurface9* drawSurface = drawDepthStencil->getSurface();
+        IDirect3DSurface9 *drawSurface = drawDepthStencil->getSurface();
         ASSERT(drawDepthStencil);
 
-        HRESULT result = device->StretchRect(readSurface, nullptr, drawSurface, nullptr, D3DTEXF_NONE);
+        HRESULT result =
+            device->StretchRect(readSurface, nullptr, drawSurface, nullptr, D3DTEXF_NONE);
 
         SafeRelease(readSurface);
         SafeRelease(drawSurface);
@@ -397,7 +400,7 @@
 
 GLenum Framebuffer9::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
 {
-    RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTarget);
+    RenderTarget9 *renderTarget9         = GetAs<RenderTarget9>(renderTarget);
     const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(renderTarget9->getD3DFormat());
     return d3dFormatInfo.info().glInternalFormat;
 }
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
index 78791b9..396a92f 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -504,7 +504,7 @@
                     config.bindToTextureRGB   = (colorBufferFormatInfo.format == GL_RGB);
                     config.bindToTextureRGBA  = (colorBufferFormatInfo.format == GL_RGBA ||
                                                 colorBufferFormatInfo.format == GL_BGRA_EXT);
-                    config.colorBufferType = EGL_RGB_BUFFER;
+                    config.colorBufferType    = EGL_RGB_BUFFER;
                     // Mark as slow if blits to the back-buffer won't be straight forward
                     config.configCaveat =
                         (currentDisplayMode.Format == d3d9ColorBufferFormatInfo.renderFormat)
@@ -1041,7 +1041,7 @@
     return gl::NoError();
 }
 
-gl::Error Renderer9::updateState(const gl::Context *context, GLenum drawMode)
+gl::Error Renderer9::updateState(const gl::Context *context, gl::PrimitiveMode drawMode)
 {
     const auto &glState = context->getGLState();
 
@@ -1066,7 +1066,7 @@
     // Since framebuffer->getSamples will return the original samples which may be different with
     // the sample counts that we set in render target view, here we use renderTarget->getSamples to
     // get the actual samples.
-    GLsizei samples           = 0;
+    GLsizei samples                                       = 0;
     const gl::FramebufferAttachment *firstColorAttachment = framebuffer->getFirstColorbuffer();
     if (firstColorAttachment)
     {
@@ -1076,7 +1076,7 @@
         samples = renderTarget->getSamples();
     }
     gl::RasterizerState rasterizer = glState.getRasterizerState();
-    rasterizer.pointDrawMode       = (drawMode == GL_POINTS);
+    rasterizer.pointDrawMode       = (drawMode == gl::PrimitiveMode::Points);
     rasterizer.multiSample         = (samples != 0);
 
     ANGLE_TRY(setBlendDepthRasterStates(context, drawMode));
@@ -1091,15 +1091,16 @@
     mStateManager.setScissorState(scissor, enabled);
 }
 
-gl::Error Renderer9::setBlendDepthRasterStates(const gl::Context *context, GLenum drawMode)
+gl::Error Renderer9::setBlendDepthRasterStates(const gl::Context *context,
+                                               gl::PrimitiveMode drawMode)
 {
-    const auto &glState  = context->getGLState();
+    const auto &glState              = context->getGLState();
     gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
     ASSERT(!drawFramebuffer->hasAnyDirtyBit());
     // Since framebuffer->getSamples will return the original samples which may be different with
     // the sample counts that we set in render target view, here we use renderTarget->getSamples to
     // get the actual samples.
-    GLsizei samples           = 0;
+    GLsizei samples                                       = 0;
     const gl::FramebufferAttachment *firstColorAttachment = drawFramebuffer->getFirstColorbuffer();
     if (firstColorAttachment)
     {
@@ -1109,7 +1110,7 @@
         samples = renderTarget->getSamples();
     }
     gl::RasterizerState rasterizer = glState.getRasterizerState();
-    rasterizer.pointDrawMode       = (drawMode == GL_POINTS);
+    rasterizer.pointDrawMode       = (drawMode == gl::PrimitiveMode::Points);
     rasterizer.multiSample         = (samples != 0);
 
     unsigned int mask = GetBlendSampleMask(glState, samples);
@@ -1119,43 +1120,43 @@
 void Renderer9::setViewport(const gl::Rectangle &viewport,
                             float zNear,
                             float zFar,
-                            GLenum drawMode,
+                            gl::PrimitiveMode drawMode,
                             GLenum frontFace,
                             bool ignoreViewport)
 {
     mStateManager.setViewportState(viewport, zNear, zFar, drawMode, frontFace, ignoreViewport);
 }
 
-bool Renderer9::applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSize)
+bool Renderer9::applyPrimitiveType(gl::PrimitiveMode mode, GLsizei count, bool usesPointSize)
 {
     switch (mode)
     {
-        case GL_POINTS:
+        case gl::PrimitiveMode::Points:
             mPrimitiveType  = D3DPT_POINTLIST;
             mPrimitiveCount = count;
             break;
-        case GL_LINES:
+        case gl::PrimitiveMode::Lines:
             mPrimitiveType  = D3DPT_LINELIST;
             mPrimitiveCount = count / 2;
             break;
-        case GL_LINE_LOOP:
+        case gl::PrimitiveMode::LineLoop:
             mPrimitiveType = D3DPT_LINESTRIP;
             mPrimitiveCount =
                 count - 1;  // D3D doesn't support line loops, so we draw the last line separately
             break;
-        case GL_LINE_STRIP:
+        case gl::PrimitiveMode::LineStrip:
             mPrimitiveType  = D3DPT_LINESTRIP;
             mPrimitiveCount = count - 1;
             break;
-        case GL_TRIANGLES:
+        case gl::PrimitiveMode::Triangles:
             mPrimitiveType  = D3DPT_TRIANGLELIST;
             mPrimitiveCount = count / 3;
             break;
-        case GL_TRIANGLE_STRIP:
+        case gl::PrimitiveMode::TriangleStrip:
             mPrimitiveType  = D3DPT_TRIANGLESTRIP;
             mPrimitiveCount = count - 2;
             break;
-        case GL_TRIANGLE_FAN:
+        case gl::PrimitiveMode::TriangleFan:
             mPrimitiveType  = D3DPT_TRIANGLEFAN;
             mPrimitiveCount = count - 2;
             break;
@@ -1203,9 +1204,9 @@
 
     SafeDelete(oldest->renderTarget);
     oldest->renderTarget = GetAs<RenderTarget9>(nullRenderTarget);
-    oldest->lruCount = ++mMaxNullColorbufferLRU;
-    oldest->width    = size.width;
-    oldest->height   = size.height;
+    oldest->lruCount     = ++mMaxNullColorbufferLRU;
+    oldest->width        = size.width;
+    oldest->height       = size.height;
 
     *outColorRenderTarget = oldest->renderTarget;
     return gl::NoError();
@@ -1297,7 +1298,7 @@
 }
 
 gl::Error Renderer9::applyVertexBuffer(const gl::Context *context,
-                                       GLenum mode,
+                                       gl::PrimitiveMode mode,
                                        GLint first,
                                        GLsizei count,
                                        GLsizei instances,
@@ -1319,7 +1320,7 @@
 gl::Error Renderer9::applyIndexBuffer(const gl::Context *context,
                                       const void *indices,
                                       GLsizei count,
-                                      GLenum mode,
+                                      gl::PrimitiveMode mode,
                                       GLenum type,
                                       TranslatedIndexData *indexInfo)
 {
@@ -1348,7 +1349,7 @@
 }
 
 gl::Error Renderer9::drawArraysImpl(const gl::Context *context,
-                                    GLenum mode,
+                                    gl::PrimitiveMode mode,
                                     GLint startVertex,
                                     GLsizei count,
                                     GLsizei instances)
@@ -1357,7 +1358,7 @@
 
     startScene();
 
-    if (mode == GL_LINE_LOOP)
+    if (mode == gl::PrimitiveMode::LineLoop)
     {
         return drawLineLoop(context, count, GL_NONE, nullptr, 0, nullptr);
     }
@@ -1393,7 +1394,7 @@
 }
 
 gl::Error Renderer9::drawElementsImpl(const gl::Context *context,
-                                      GLenum mode,
+                                      gl::PrimitiveMode mode,
                                       GLsizei count,
                                       GLenum type,
                                       const void *indices,
@@ -1418,11 +1419,11 @@
     gl::VertexArray *vao           = context->getGLState().getVertexArray();
     gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get();
 
-    if (mode == GL_POINTS)
+    if (mode == gl::PrimitiveMode::Points)
     {
         return drawIndexedPoints(context, count, type, indices, minIndex, elementArrayBuffer);
     }
-    else if (mode == GL_LINE_LOOP)
+    else if (mode == gl::PrimitiveMode::LineLoop)
     {
         return drawLineLoop(context, count, type, indices, minIndex, elementArrayBuffer);
     }
@@ -1753,7 +1754,7 @@
     return gl::NoError();
 }
 
-gl::Error Renderer9::applyShaders(const gl::Context *context, GLenum drawMode)
+gl::Error Renderer9::applyShaders(const gl::Context *context, gl::PrimitiveMode drawMode)
 {
     const gl::State &state = context->getContextState().getState();
     // This method is called single-threaded.
@@ -3063,7 +3064,7 @@
 }
 
 gl::Error Renderer9::genericDrawElements(const gl::Context *context,
-                                         GLenum mode,
+                                         gl::PrimitiveMode mode,
                                          GLsizei count,
                                          GLenum type,
                                          const void *indices,
@@ -3095,7 +3096,7 @@
 }
 
 gl::Error Renderer9::genericDrawArrays(const gl::Context *context,
-                                       GLenum mode,
+                                       gl::PrimitiveMode mode,
                                        GLint first,
                                        GLsizei count,
                                        GLsizei instances)
diff --git a/src/libANGLE/renderer/d3d/d3d9/Renderer9.h b/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
index 0d5f450..3fbc3ee 100644
--- a/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
@@ -130,13 +130,13 @@
                          int index,
                          gl::Texture *texture);
 
-    gl::Error updateState(const gl::Context *context, GLenum drawMode);
+    gl::Error updateState(const gl::Context *context, gl::PrimitiveMode drawMode);
 
     void setScissorRectangle(const gl::Rectangle &scissor, bool enabled);
     void setViewport(const gl::Rectangle &viewport,
                      float zNear,
                      float zFar,
-                     GLenum drawMode,
+                     gl::PrimitiveMode drawMode,
                      GLenum frontFace,
                      bool ignoreViewport);
 
@@ -144,9 +144,11 @@
                                 const RenderTarget9 *colorRenderTarget,
                                 const RenderTarget9 *depthStencilRenderTarget);
     gl::Error applyUniforms(ProgramD3D *programD3D);
-    bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount, bool usesPointSize);
+    bool applyPrimitiveType(gl::PrimitiveMode primitiveType,
+                            GLsizei elementCount,
+                            bool usesPointSize);
     gl::Error applyVertexBuffer(const gl::Context *context,
-                                GLenum mode,
+                                gl::PrimitiveMode mode,
                                 GLint first,
                                 GLsizei count,
                                 GLsizei instances,
@@ -154,7 +156,7 @@
     gl::Error applyIndexBuffer(const gl::Context *context,
                                const void *indices,
                                GLsizei count,
-                               GLenum mode,
+                               gl::PrimitiveMode mode,
                                GLenum type,
                                TranslatedIndexData *indexInfo);
 
@@ -362,13 +364,13 @@
     StateManager9 *getStateManager() { return &mStateManager; }
 
     gl::Error genericDrawArrays(const gl::Context *context,
-                                GLenum mode,
+                                gl::PrimitiveMode mode,
                                 GLint first,
                                 GLsizei count,
                                 GLsizei instances);
 
     gl::Error genericDrawElements(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLsizei count,
                                   GLenum type,
                                   const void *indices,
@@ -390,18 +392,18 @@
 
   private:
     gl::Error drawArraysImpl(const gl::Context *context,
-                             GLenum mode,
+                             gl::PrimitiveMode mode,
                              GLint startVertex,
                              GLsizei count,
                              GLsizei instances);
     gl::Error drawElementsImpl(const gl::Context *context,
-                               GLenum mode,
+                               gl::PrimitiveMode mode,
                                GLsizei count,
                                GLenum type,
                                const void *indices,
                                GLsizei instances);
 
-    gl::Error applyShaders(const gl::Context *context, GLenum drawMode);
+    gl::Error applyShaders(const gl::Context *context, gl::PrimitiveMode drawMode);
 
     gl::Error applyTextures(const gl::Context *context);
     gl::Error applyTextures(const gl::Context *context, gl::ShaderType shaderType);
@@ -413,7 +415,7 @@
 
     angle::WorkaroundsD3D generateWorkarounds() const override;
 
-    gl::Error setBlendDepthRasterStates(const gl::Context *context, GLenum drawMode);
+    gl::Error setBlendDepthRasterStates(const gl::Context *context, gl::PrimitiveMode drawMode);
 
     void release();
 
diff --git a/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp b/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
index 17042ac..2acee12 100644
--- a/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
+++ b/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
@@ -10,9 +10,9 @@
 #include "common/bitset_utils.h"
 #include "common/utilities.h"
 #include "libANGLE/formatutils.h"
-#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
 #include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
 #include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
+#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
 
 namespace rx
 {
@@ -477,7 +477,7 @@
 void StateManager9::setViewportState(const gl::Rectangle &viewport,
                                      float zNear,
                                      float zFar,
-                                     GLenum drawMode,
+                                     gl::PrimitiveMode drawMode,
                                      GLenum frontFace,
                                      bool ignoreViewport)
 {
@@ -611,7 +611,7 @@
 
     RECT rect;
     rect.left = gl::clamp(scissor.x, 0, static_cast<int>(mRenderTargetBounds.width));
-    rect.top = gl::clamp(scissor.y, 0, static_cast<int>(mRenderTargetBounds.height));
+    rect.top  = gl::clamp(scissor.y, 0, static_cast<int>(mRenderTargetBounds.height));
     rect.right =
         gl::clamp(scissor.x + scissor.width, 0, static_cast<int>(mRenderTargetBounds.width));
     rect.bottom =
diff --git a/src/libANGLE/renderer/d3d/d3d9/StateManager9.h b/src/libANGLE/renderer/d3d/d3d9/StateManager9.h
index 63ce17c..b5971de 100644
--- a/src/libANGLE/renderer/d3d/d3d9/StateManager9.h
+++ b/src/libANGLE/renderer/d3d/d3d9/StateManager9.h
@@ -9,9 +9,9 @@
 #ifndef LIBANGLE_RENDERER_D3D9_STATEMANAGER9_H_
 #define LIBANGLE_RENDERER_D3D9_STATEMANAGER9_H_
 
-#include "libANGLE/angletypes.h"
 #include "libANGLE/ContextState.h"
 #include "libANGLE/State.h"
+#include "libANGLE/angletypes.h"
 #include "libANGLE/renderer/d3d/RendererD3D.h"
 
 namespace rx
@@ -48,7 +48,7 @@
     void setViewportState(const gl::Rectangle &viewport,
                           float zNear,
                           float zFar,
-                          GLenum drawMode,
+                          gl::PrimitiveMode drawMode,
                           GLenum frontFace,
                           bool ignoreViewport);
 
diff --git a/src/libANGLE/renderer/gl/ContextGL.cpp b/src/libANGLE/renderer/gl/ContextGL.cpp
index 4ef8b54..60443ee 100644
--- a/src/libANGLE/renderer/gl/ContextGL.cpp
+++ b/src/libANGLE/renderer/gl/ContextGL.cpp
@@ -169,13 +169,16 @@
     return mRenderer->finish();
 }
 
-gl::Error ContextGL::drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count)
+gl::Error ContextGL::drawArrays(const gl::Context *context,
+                                gl::PrimitiveMode mode,
+                                GLint first,
+                                GLsizei count)
 {
     return mRenderer->drawArrays(context, mode, first, count);
 }
 
 gl::Error ContextGL::drawArraysInstanced(const gl::Context *context,
-                                         GLenum mode,
+                                         gl::PrimitiveMode mode,
                                          GLint first,
                                          GLsizei count,
                                          GLsizei instanceCount)
@@ -184,7 +187,7 @@
 }
 
 gl::Error ContextGL::drawElements(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLsizei count,
                                   GLenum type,
                                   const void *indices)
@@ -193,7 +196,7 @@
 }
 
 gl::Error ContextGL::drawElementsInstanced(const gl::Context *context,
-                                           GLenum mode,
+                                           gl::PrimitiveMode mode,
                                            GLsizei count,
                                            GLenum type,
                                            const void *indices,
@@ -203,7 +206,7 @@
 }
 
 gl::Error ContextGL::drawRangeElements(const gl::Context *context,
-                                       GLenum mode,
+                                       gl::PrimitiveMode mode,
                                        GLuint start,
                                        GLuint end,
                                        GLsizei count,
@@ -214,14 +217,14 @@
 }
 
 gl::Error ContextGL::drawArraysIndirect(const gl::Context *context,
-                                        GLenum mode,
+                                        gl::PrimitiveMode mode,
                                         const void *indirect)
 {
     return mRenderer->drawArraysIndirect(context, mode, indirect);
 }
 
 gl::Error ContextGL::drawElementsIndirect(const gl::Context *context,
-                                          GLenum mode,
+                                          gl::PrimitiveMode mode,
                                           GLenum type,
                                           const void *indirect)
 {
diff --git a/src/libANGLE/renderer/gl/ContextGL.h b/src/libANGLE/renderer/gl/ContextGL.h
index c1427ed..087f74c 100644
--- a/src/libANGLE/renderer/gl/ContextGL.h
+++ b/src/libANGLE/renderer/gl/ContextGL.h
@@ -78,38 +78,38 @@
 
     // Drawing methods.
     gl::Error drawArrays(const gl::Context *context,
-                         GLenum mode,
+                         gl::PrimitiveMode mode,
                          GLint first,
                          GLsizei count) override;
     gl::Error drawArraysInstanced(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLint first,
                                   GLsizei count,
                                   GLsizei instanceCount) override;
 
     gl::Error drawElements(const gl::Context *context,
-                           GLenum mode,
+                           gl::PrimitiveMode mode,
                            GLsizei count,
                            GLenum type,
                            const void *indices) override;
     gl::Error drawElementsInstanced(const gl::Context *context,
-                                    GLenum mode,
+                                    gl::PrimitiveMode mode,
                                     GLsizei count,
                                     GLenum type,
                                     const void *indices,
                                     GLsizei instances) override;
     gl::Error drawRangeElements(const gl::Context *context,
-                                GLenum mode,
+                                gl::PrimitiveMode mode,
                                 GLuint start,
                                 GLuint end,
                                 GLsizei count,
                                 GLenum type,
                                 const void *indices) override;
     gl::Error drawArraysIndirect(const gl::Context *context,
-                                 GLenum mode,
+                                 gl::PrimitiveMode mode,
                                  const void *indirect) override;
     gl::Error drawElementsIndirect(const gl::Context *context,
-                                   GLenum mode,
+                                   gl::PrimitiveMode mode,
                                    GLenum type,
                                    const void *indirect) override;
 
diff --git a/src/libANGLE/renderer/gl/RendererGL.cpp b/src/libANGLE/renderer/gl/RendererGL.cpp
index e64fc51..03befeb 100644
--- a/src/libANGLE/renderer/gl/RendererGL.cpp
+++ b/src/libANGLE/renderer/gl/RendererGL.cpp
@@ -176,8 +176,8 @@
 {
     ASSERT(mFunctions);
     nativegl_gl::GenerateWorkarounds(mFunctions, &mWorkarounds);
-    mStateManager = new StateManagerGL(mFunctions, getNativeCaps(), getNativeExtensions());
-    mBlitter      = new BlitGL(functions, mWorkarounds, mStateManager);
+    mStateManager     = new StateManagerGL(mFunctions, getNativeCaps(), getNativeExtensions());
+    mBlitter          = new BlitGL(functions, mWorkarounds, mStateManager);
     mMultiviewClearer = new ClearMultiviewGL(functions, mStateManager);
 
     bool hasDebugOutput = mFunctions->isAtLeastGL(gl::Version(4, 3)) ||
@@ -245,7 +245,7 @@
 }
 
 gl::Error RendererGL::drawArrays(const gl::Context *context,
-                                 GLenum mode,
+                                 gl::PrimitiveMode mode,
                                  GLint first,
                                  GLsizei count)
 {
@@ -256,17 +256,17 @@
     ANGLE_TRY(mStateManager->setDrawArraysState(context, first, count, instanceCount));
     if (!usesMultiview)
     {
-        mFunctions->drawArrays(mode, first, count);
+        mFunctions->drawArrays(ToGLenum(mode), first, count);
     }
     else
     {
-        mFunctions->drawArraysInstanced(mode, first, count, instanceCount);
+        mFunctions->drawArraysInstanced(ToGLenum(mode), first, count, instanceCount);
     }
     return gl::NoError();
 }
 
 gl::Error RendererGL::drawArraysInstanced(const gl::Context *context,
-                                          GLenum mode,
+                                          gl::PrimitiveMode mode,
                                           GLint first,
                                           GLsizei count,
                                           GLsizei instanceCount)
@@ -279,12 +279,12 @@
     }
 
     ANGLE_TRY(mStateManager->setDrawArraysState(context, first, count, adjustedInstanceCount));
-    mFunctions->drawArraysInstanced(mode, first, count, adjustedInstanceCount);
+    mFunctions->drawArraysInstanced(ToGLenum(mode), first, count, adjustedInstanceCount);
     return gl::NoError();
 }
 
 gl::Error RendererGL::drawElements(const gl::Context *context,
-                                   GLenum mode,
+                                   gl::PrimitiveMode mode,
                                    GLsizei count,
                                    GLenum type,
                                    const void *indices)
@@ -292,23 +292,23 @@
     const gl::Program *program  = context->getGLState().getProgram();
     const bool usesMultiview    = program->usesMultiview();
     const GLsizei instanceCount = usesMultiview ? program->getNumViews() : 0;
-    const void *drawIndexPtr = nullptr;
+    const void *drawIndexPtr    = nullptr;
 
     ANGLE_TRY(mStateManager->setDrawElementsState(context, count, type, indices, instanceCount,
                                                   &drawIndexPtr));
     if (!usesMultiview)
     {
-        mFunctions->drawElements(mode, count, type, drawIndexPtr);
+        mFunctions->drawElements(ToGLenum(mode), count, type, drawIndexPtr);
     }
     else
     {
-        mFunctions->drawElementsInstanced(mode, count, type, drawIndexPtr, instanceCount);
+        mFunctions->drawElementsInstanced(ToGLenum(mode), count, type, drawIndexPtr, instanceCount);
     }
     return gl::NoError();
 }
 
 gl::Error RendererGL::drawElementsInstanced(const gl::Context *context,
-                                            GLenum mode,
+                                            gl::PrimitiveMode mode,
                                             GLsizei count,
                                             GLenum type,
                                             const void *indices,
@@ -324,12 +324,13 @@
 
     ANGLE_TRY(mStateManager->setDrawElementsState(context, count, type, indices,
                                                   adjustedInstanceCount, &drawIndexPointer));
-    mFunctions->drawElementsInstanced(mode, count, type, drawIndexPointer, adjustedInstanceCount);
+    mFunctions->drawElementsInstanced(ToGLenum(mode), count, type, drawIndexPointer,
+                                      adjustedInstanceCount);
     return gl::NoError();
 }
 
 gl::Error RendererGL::drawRangeElements(const gl::Context *context,
-                                        GLenum mode,
+                                        gl::PrimitiveMode mode,
                                         GLuint start,
                                         GLuint end,
                                         GLsizei count,
@@ -345,31 +346,32 @@
                                                   &drawIndexPointer));
     if (!usesMultiview)
     {
-        mFunctions->drawRangeElements(mode, start, end, count, type, drawIndexPointer);
+        mFunctions->drawRangeElements(ToGLenum(mode), start, end, count, type, drawIndexPointer);
     }
     else
     {
-        mFunctions->drawElementsInstanced(mode, count, type, drawIndexPointer, instanceCount);
+        mFunctions->drawElementsInstanced(ToGLenum(mode), count, type, drawIndexPointer,
+                                          instanceCount);
     }
     return gl::NoError();
 }
 
 gl::Error RendererGL::drawArraysIndirect(const gl::Context *context,
-                                         GLenum mode,
+                                         gl::PrimitiveMode mode,
                                          const void *indirect)
 {
     ANGLE_TRY(mStateManager->setDrawIndirectState(context));
-    mFunctions->drawArraysIndirect(mode, indirect);
+    mFunctions->drawArraysIndirect(ToGLenum(mode), indirect);
     return gl::NoError();
 }
 
 gl::Error RendererGL::drawElementsIndirect(const gl::Context *context,
-                                           GLenum mode,
+                                           gl::PrimitiveMode mode,
                                            GLenum type,
                                            const void *indirect)
 {
     ANGLE_TRY(mStateManager->setDrawIndirectState(context));
-    mFunctions->drawElementsIndirect(mode, type, indirect);
+    mFunctions->drawElementsIndirect(ToGLenum(mode), type, indirect);
     return gl::NoError();
 }
 
diff --git a/src/libANGLE/renderer/gl/RendererGL.h b/src/libANGLE/renderer/gl/RendererGL.h
index 20e03df..dcc5954 100644
--- a/src/libANGLE/renderer/gl/RendererGL.h
+++ b/src/libANGLE/renderer/gl/RendererGL.h
@@ -52,34 +52,39 @@
     gl::Error flush();
     gl::Error finish();
 
-    gl::Error drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count);
+    gl::Error drawArrays(const gl::Context *context,
+                         gl::PrimitiveMode mode,
+                         GLint first,
+                         GLsizei count);
     gl::Error drawArraysInstanced(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLint first,
                                   GLsizei count,
                                   GLsizei instanceCount);
 
     gl::Error drawElements(const gl::Context *context,
-                           GLenum mode,
+                           gl::PrimitiveMode mode,
                            GLsizei count,
                            GLenum type,
                            const void *indices);
     gl::Error drawElementsInstanced(const gl::Context *context,
-                                    GLenum mode,
+                                    gl::PrimitiveMode mode,
                                     GLsizei count,
                                     GLenum type,
                                     const void *indices,
                                     GLsizei instances);
     gl::Error drawRangeElements(const gl::Context *context,
-                                GLenum mode,
+                                gl::PrimitiveMode mode,
                                 GLuint start,
                                 GLuint end,
                                 GLsizei count,
                                 GLenum type,
                                 const void *indices);
-    gl::Error drawArraysIndirect(const gl::Context *context, GLenum mode, const void *indirect);
+    gl::Error drawArraysIndirect(const gl::Context *context,
+                                 gl::PrimitiveMode mode,
+                                 const void *indirect);
     gl::Error drawElementsIndirect(const gl::Context *context,
-                                   GLenum mode,
+                                   gl::PrimitiveMode mode,
                                    GLenum type,
                                    const void *indirect);
 
diff --git a/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp b/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp
index 7c95ccd..ee219dc 100644
--- a/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp
+++ b/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp
@@ -36,7 +36,7 @@
     mTransformFeedbackID = 0;
 }
 
-void TransformFeedbackGL::begin(GLenum primitiveMode)
+void TransformFeedbackGL::begin(gl::PrimitiveMode primitiveMode)
 {
     mStateManager->onTransformFeedbackStateChange();
 }
@@ -46,7 +46,7 @@
     mStateManager->onTransformFeedbackStateChange();
 
     // Immediately end the transform feedback so that the results are visible.
-    syncActiveState(false, GL_NONE);
+    syncActiveState(false, gl::PrimitiveMode::InvalidEnum);
 }
 
 void TransformFeedbackGL::pause()
@@ -97,7 +97,7 @@
     return mTransformFeedbackID;
 }
 
-void TransformFeedbackGL::syncActiveState(bool active, GLenum primitiveMode) const
+void TransformFeedbackGL::syncActiveState(bool active, gl::PrimitiveMode primitiveMode) const
 {
     if (mIsActive != active)
     {
@@ -107,7 +107,8 @@
         mStateManager->bindTransformFeedback(GL_TRANSFORM_FEEDBACK, mTransformFeedbackID);
         if (mIsActive)
         {
-            mFunctions->beginTransformFeedback(primitiveMode);
+            ASSERT(primitiveMode != gl::PrimitiveMode::InvalidEnum);
+            mFunctions->beginTransformFeedback(gl::ToGLenum(primitiveMode));
         }
         else
         {
@@ -133,5 +134,4 @@
         }
     }
 }
-
 }
diff --git a/src/libANGLE/renderer/gl/TransformFeedbackGL.h b/src/libANGLE/renderer/gl/TransformFeedbackGL.h
index 1a6375d..5a7d071 100644
--- a/src/libANGLE/renderer/gl/TransformFeedbackGL.h
+++ b/src/libANGLE/renderer/gl/TransformFeedbackGL.h
@@ -25,7 +25,7 @@
                         StateManagerGL *stateManager);
     ~TransformFeedbackGL() override;
 
-    void begin(GLenum primitiveMode) override;
+    void begin(gl::PrimitiveMode primitiveMode) override;
     void end() override;
     void pause() override;
     void resume() override;
@@ -36,7 +36,7 @@
 
     GLuint getTransformFeedbackID() const;
 
-    void syncActiveState(bool active, GLenum primitiveMode) const;
+    void syncActiveState(bool active, gl::PrimitiveMode primitiveMode) const;
     void syncPausedState(bool paused) const;
 
   private:
@@ -48,7 +48,6 @@
     mutable bool mIsActive;
     mutable bool mIsPaused;
 };
-
 }
 
-#endif // LIBANGLE_RENDERER_GL_TRANSFORMFEEDBACKGL_H_
+#endif  // LIBANGLE_RENDERER_GL_TRANSFORMFEEDBACKGL_H_
diff --git a/src/libANGLE/renderer/null/ContextNULL.cpp b/src/libANGLE/renderer/null/ContextNULL.cpp
index 94becb4..700b8c5 100644
--- a/src/libANGLE/renderer/null/ContextNULL.cpp
+++ b/src/libANGLE/renderer/null/ContextNULL.cpp
@@ -64,22 +64,22 @@
 {
     ASSERT(mAllocationTracker != nullptr);
 
-    mExtensions                       = gl::Extensions();
-    mExtensions.fence                 = true;
-    mExtensions.instancedArrays       = true;
-    mExtensions.pixelBufferObject     = true;
-    mExtensions.mapBuffer             = true;
-    mExtensions.mapBufferRange        = true;
-    mExtensions.copyTexture           = true;
-    mExtensions.copyCompressedTexture = true;
-    mExtensions.textureRectangle      = true;
+    mExtensions                        = gl::Extensions();
+    mExtensions.fence                  = true;
+    mExtensions.instancedArrays        = true;
+    mExtensions.pixelBufferObject      = true;
+    mExtensions.mapBuffer              = true;
+    mExtensions.mapBufferRange         = true;
+    mExtensions.copyTexture            = true;
+    mExtensions.copyCompressedTexture  = true;
+    mExtensions.textureRectangle       = true;
     mExtensions.textureUsage           = true;
     mExtensions.vertexArrayObject      = true;
     mExtensions.debugMarker            = true;
     mExtensions.translatedShaderSource = true;
 
     mExtensions.textureStorage             = true;
-    mExtensions.rgb8rgba8 = true;
+    mExtensions.rgb8rgba8                  = true;
     mExtensions.textureCompressionDXT1     = true;
     mExtensions.textureCompressionDXT3     = true;
     mExtensions.textureCompressionDXT5     = true;
@@ -121,7 +121,7 @@
 }
 
 gl::Error ContextNULL::drawArrays(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLint first,
                                   GLsizei count)
 {
@@ -129,7 +129,7 @@
 }
 
 gl::Error ContextNULL::drawArraysInstanced(const gl::Context *context,
-                                           GLenum mode,
+                                           gl::PrimitiveMode mode,
                                            GLint first,
                                            GLsizei count,
                                            GLsizei instanceCount)
@@ -138,7 +138,7 @@
 }
 
 gl::Error ContextNULL::drawElements(const gl::Context *context,
-                                    GLenum mode,
+                                    gl::PrimitiveMode mode,
                                     GLsizei count,
                                     GLenum type,
                                     const void *indices)
@@ -147,7 +147,7 @@
 }
 
 gl::Error ContextNULL::drawElementsInstanced(const gl::Context *context,
-                                             GLenum mode,
+                                             gl::PrimitiveMode mode,
                                              GLsizei count,
                                              GLenum type,
                                              const void *indices,
@@ -157,7 +157,7 @@
 }
 
 gl::Error ContextNULL::drawRangeElements(const gl::Context *context,
-                                         GLenum mode,
+                                         gl::PrimitiveMode mode,
                                          GLuint start,
                                          GLuint end,
                                          GLsizei count,
@@ -168,14 +168,14 @@
 }
 
 gl::Error ContextNULL::drawArraysIndirect(const gl::Context *context,
-                                          GLenum mode,
+                                          gl::PrimitiveMode mode,
                                           const void *indirect)
 {
     return gl::NoError();
 }
 
 gl::Error ContextNULL::drawElementsIndirect(const gl::Context *context,
-                                            GLenum mode,
+                                            gl::PrimitiveMode mode,
                                             GLenum type,
                                             const void *indirect)
 {
diff --git a/src/libANGLE/renderer/null/ContextNULL.h b/src/libANGLE/renderer/null/ContextNULL.h
index 08f5cb9..fd776ae 100644
--- a/src/libANGLE/renderer/null/ContextNULL.h
+++ b/src/libANGLE/renderer/null/ContextNULL.h
@@ -44,38 +44,38 @@
 
     // Drawing methods.
     gl::Error drawArrays(const gl::Context *context,
-                         GLenum mode,
+                         gl::PrimitiveMode mode,
                          GLint first,
                          GLsizei count) override;
     gl::Error drawArraysInstanced(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLint first,
                                   GLsizei count,
                                   GLsizei instanceCount) override;
 
     gl::Error drawElements(const gl::Context *context,
-                           GLenum mode,
+                           gl::PrimitiveMode mode,
                            GLsizei count,
                            GLenum type,
                            const void *indices) override;
     gl::Error drawElementsInstanced(const gl::Context *context,
-                                    GLenum mode,
+                                    gl::PrimitiveMode mode,
                                     GLsizei count,
                                     GLenum type,
                                     const void *indices,
                                     GLsizei instances) override;
     gl::Error drawRangeElements(const gl::Context *context,
-                                GLenum mode,
+                                gl::PrimitiveMode mode,
                                 GLuint start,
                                 GLuint end,
                                 GLsizei count,
                                 GLenum type,
                                 const void *indices) override;
     gl::Error drawArraysIndirect(const gl::Context *context,
-                                 GLenum mode,
+                                 gl::PrimitiveMode mode,
                                  const void *indirect) override;
     gl::Error drawElementsIndirect(const gl::Context *context,
-                                   GLenum mode,
+                                   gl::PrimitiveMode mode,
                                    GLenum type,
                                    const void *indirect) override;
 
diff --git a/src/libANGLE/renderer/null/TransformFeedbackNULL.cpp b/src/libANGLE/renderer/null/TransformFeedbackNULL.cpp
index 177fda3..440f076 100644
--- a/src/libANGLE/renderer/null/TransformFeedbackNULL.cpp
+++ b/src/libANGLE/renderer/null/TransformFeedbackNULL.cpp
@@ -23,7 +23,7 @@
 {
 }
 
-void TransformFeedbackNULL::begin(GLenum primitiveMode)
+void TransformFeedbackNULL::begin(gl::PrimitiveMode primitiveMode)
 {
 }
 
diff --git a/src/libANGLE/renderer/null/TransformFeedbackNULL.h b/src/libANGLE/renderer/null/TransformFeedbackNULL.h
index e7f3dc5..04711cc 100644
--- a/src/libANGLE/renderer/null/TransformFeedbackNULL.h
+++ b/src/libANGLE/renderer/null/TransformFeedbackNULL.h
@@ -21,7 +21,7 @@
     TransformFeedbackNULL(const gl::TransformFeedbackState &state);
     ~TransformFeedbackNULL() override;
 
-    void begin(GLenum primitiveMode) override;
+    void begin(gl::PrimitiveMode primitiveMode) override;
     void end() override;
     void pause() override;
     void resume() override;
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp
index ccc30ff..125a398 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp
@@ -53,7 +53,7 @@
 ContextVk::ContextVk(const gl::ContextState &state, RendererVk *renderer)
     : ContextImpl(state),
       mRenderer(renderer),
-      mCurrentDrawMode(GL_NONE),
+      mCurrentDrawMode(gl::PrimitiveMode::InvalidEnum),
       mDynamicDescriptorPool(),
       mTexturesDirty(false),
       mVertexArrayBindingHasChanged(false),
@@ -167,7 +167,7 @@
 
     if (!graphNode->getInsideRenderPassCommands()->valid())
     {
-        mTexturesDirty    = true;
+        mTexturesDirty       = true;
         *newCommandBufferOut = true;
         ANGLE_TRY(graphNode->beginInsideRenderPassRecording(mRenderer, &commandBuffer));
     }
@@ -218,7 +218,7 @@
 
     // Bind the graphics descriptor sets.
     // TODO(jmadill): Handle multiple command buffers.
-    const auto &descriptorSets = programVk->getDescriptorSets();
+    const auto &descriptorSets   = programVk->getDescriptorSets();
     const gl::RangeUI &usedRange = programVk->getUsedDescriptorSetRange();
     if (!usedRange.empty())
     {
@@ -235,7 +235,10 @@
     return gl::NoError();
 }
 
-gl::Error ContextVk::drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count)
+gl::Error ContextVk::drawArrays(const gl::Context *context,
+                                gl::PrimitiveMode mode,
+                                GLint first,
+                                GLsizei count)
 {
     const gl::DrawCallParams &drawCallParams = context->getParams<gl::DrawCallParams>();
 
@@ -251,7 +254,7 @@
 }
 
 gl::Error ContextVk::drawArraysInstanced(const gl::Context *context,
-                                         GLenum mode,
+                                         gl::PrimitiveMode mode,
                                          GLint first,
                                          GLsizei count,
                                          GLsizei instanceCount)
@@ -261,7 +264,7 @@
 }
 
 gl::Error ContextVk::drawElements(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLsizei count,
                                   GLenum type,
                                   const void *indices)
@@ -281,7 +284,7 @@
 }
 
 gl::Error ContextVk::drawElementsInstanced(const gl::Context *context,
-                                           GLenum mode,
+                                           gl::PrimitiveMode mode,
                                            GLsizei count,
                                            GLenum type,
                                            const void *indices,
@@ -292,7 +295,7 @@
 }
 
 gl::Error ContextVk::drawRangeElements(const gl::Context *context,
-                                       GLenum mode,
+                                       gl::PrimitiveMode mode,
                                        GLuint start,
                                        GLuint end,
                                        GLsizei count,
@@ -308,7 +311,7 @@
 }
 
 gl::Error ContextVk::drawArraysIndirect(const gl::Context *context,
-                                        GLenum mode,
+                                        gl::PrimitiveMode mode,
                                         const void *indirect)
 {
     UNIMPLEMENTED();
@@ -316,7 +319,7 @@
 }
 
 gl::Error ContextVk::drawElementsIndirect(const gl::Context *context,
-                                          GLenum mode,
+                                          gl::PrimitiveMode mode,
                                           GLenum type,
                                           const void *indirect)
 {
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.h b/src/libANGLE/renderer/vulkan/ContextVk.h
index 23569f3..1903a0f 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.h
+++ b/src/libANGLE/renderer/vulkan/ContextVk.h
@@ -35,38 +35,38 @@
 
     // Drawing methods.
     gl::Error drawArrays(const gl::Context *context,
-                         GLenum mode,
+                         gl::PrimitiveMode mode,
                          GLint first,
                          GLsizei count) override;
     gl::Error drawArraysInstanced(const gl::Context *context,
-                                  GLenum mode,
+                                  gl::PrimitiveMode mode,
                                   GLint first,
                                   GLsizei count,
                                   GLsizei instanceCount) override;
 
     gl::Error drawElements(const gl::Context *context,
-                           GLenum mode,
+                           gl::PrimitiveMode mode,
                            GLsizei count,
                            GLenum type,
                            const void *indices) override;
     gl::Error drawElementsInstanced(const gl::Context *context,
-                                    GLenum mode,
+                                    gl::PrimitiveMode mode,
                                     GLsizei count,
                                     GLenum type,
                                     const void *indices,
                                     GLsizei instances) override;
     gl::Error drawRangeElements(const gl::Context *context,
-                                GLenum mode,
+                                gl::PrimitiveMode mode,
                                 GLuint start,
                                 GLuint end,
                                 GLsizei count,
                                 GLenum type,
                                 const void *indices) override;
     gl::Error drawArraysIndirect(const gl::Context *context,
-                                 GLenum mode,
+                                 gl::PrimitiveMode mode,
                                  const void *indirect) override;
     gl::Error drawElementsIndirect(const gl::Context *context,
-                                   GLenum mode,
+                                   gl::PrimitiveMode mode,
                                    GLenum type,
                                    const void *indirect) override;
 
@@ -175,7 +175,7 @@
 
     RendererVk *mRenderer;
     vk::PipelineAndSerial *mCurrentPipeline;
-    GLenum mCurrentDrawMode;
+    gl::PrimitiveMode mCurrentDrawMode;
 
     // Keep a cached pipeline description structure that can be used to query the pipeline cache.
     // Kept in a pointer so allocations can be aligned, and structs can be portably packed.
diff --git a/src/libANGLE/renderer/vulkan/TransformFeedbackVk.cpp b/src/libANGLE/renderer/vulkan/TransformFeedbackVk.cpp
index 5e80078..add9b3f 100644
--- a/src/libANGLE/renderer/vulkan/TransformFeedbackVk.cpp
+++ b/src/libANGLE/renderer/vulkan/TransformFeedbackVk.cpp
@@ -23,7 +23,7 @@
 {
 }
 
-void TransformFeedbackVk::begin(GLenum primitiveMode)
+void TransformFeedbackVk::begin(gl::PrimitiveMode primitiveMode)
 {
     UNIMPLEMENTED();
 }
diff --git a/src/libANGLE/renderer/vulkan/TransformFeedbackVk.h b/src/libANGLE/renderer/vulkan/TransformFeedbackVk.h
index a379b36..a257057 100644
--- a/src/libANGLE/renderer/vulkan/TransformFeedbackVk.h
+++ b/src/libANGLE/renderer/vulkan/TransformFeedbackVk.h
@@ -21,7 +21,7 @@
     TransformFeedbackVk(const gl::TransformFeedbackState &state);
     ~TransformFeedbackVk() override;
 
-    void begin(GLenum primitiveMode) override;
+    void begin(gl::PrimitiveMode primitiveMode) override;
     void end() override;
     void pause() override;
     void resume() override;
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
index f6ce42c..577717a 100644
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
@@ -98,7 +98,7 @@
         const size_t firstByte = drawCallParams.firstVertex() * binding.getStride();
         const size_t lastByte =
             lastVertex * binding.getStride() + gl::ComputeVertexAttributeTypeSize(attrib);
-        uint8_t *dst = nullptr;
+        uint8_t *dst    = nullptr;
         uint32_t offset = 0;
         ANGLE_TRY(mDynamicVertexData.allocate(
             renderer, lastByte, &dst, &mCurrentArrayBufferHandles[attribIndex], &offset, nullptr));
@@ -361,7 +361,7 @@
     // Note: Vertex indexes can be arbitrarily large.
     uint32_t clampedVertexCount = drawCallParams.getClampedVertexCount<uint32_t>();
 
-    if (drawCallParams.mode() != GL_LINE_LOOP)
+    if (drawCallParams.mode() != gl::PrimitiveMode::LineLoop)
     {
         commandBuffer->draw(clampedVertexCount, 1, drawCallParams.firstVertex(), 0);
         return gl::NoError();
@@ -398,7 +398,7 @@
     vk::CommandBuffer *commandBuffer = drawNode->getInsideRenderPassCommands();
     ASSERT(commandBuffer->valid());
 
-    if (drawCallParams.mode() != GL_LINE_LOOP)
+    if (drawCallParams.mode() != gl::PrimitiveMode::LineLoop)
     {
         ANGLE_TRY(onIndexedDraw(context, renderer, drawCallParams, drawNode, newCommandBuffer));
         commandBuffer->drawIndexed(drawCallParams.indexCount(), 1, 0, 0, 0);
@@ -491,7 +491,8 @@
 {
     ANGLE_TRY(onDraw(context, renderer, drawCallParams, drawNode, newCommandBuffer));
 
-    if (!mState.getElementArrayBuffer().get() && drawCallParams.mode() != GL_LINE_LOOP)
+    if (!mState.getElementArrayBuffer().get() &&
+        drawCallParams.mode() != gl::PrimitiveMode::LineLoop)
     {
         ANGLE_TRY(drawCallParams.ensureIndexRangeResolved(context));
         ANGLE_TRY(streamIndexData(renderer, drawCallParams));
diff --git a/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp b/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp
index 2f5d14f..9bda8e3 100644
--- a/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_cache_utils.cpp
@@ -643,10 +643,10 @@
 
 void PipelineDesc::updateViewport(const gl::Rectangle &viewport, float nearPlane, float farPlane)
 {
-    mViewport.x        = static_cast<float>(viewport.x);
-    mViewport.y        = static_cast<float>(viewport.y);
-    mViewport.width    = static_cast<float>(viewport.width);
-    mViewport.height   = static_cast<float>(viewport.height);
+    mViewport.x      = static_cast<float>(viewport.x);
+    mViewport.y      = static_cast<float>(viewport.y);
+    mViewport.width  = static_cast<float>(viewport.width);
+    mViewport.height = static_cast<float>(viewport.height);
     updateDepthRange(nearPlane, farPlane);
 }
 
@@ -665,7 +665,7 @@
     mVertexInputAttribs  = attribs;
 }
 
-void PipelineDesc::updateTopology(GLenum drawMode)
+void PipelineDesc::updateTopology(gl::PrimitiveMode drawMode)
 {
     mInputAssemblyInfo.topology = static_cast<uint32_t>(gl_vk::GetPrimitiveTopology(drawMode));
 }
diff --git a/src/libANGLE/renderer/vulkan/vk_cache_utils.h b/src/libANGLE/renderer/vulkan/vk_cache_utils.h
index 48a040a..03bd4c9 100644
--- a/src/libANGLE/renderer/vulkan/vk_cache_utils.h
+++ b/src/libANGLE/renderer/vulkan/vk_cache_utils.h
@@ -280,7 +280,7 @@
                                const VertexInputAttributes &attribs);
 
     // Input assembly info
-    void updateTopology(GLenum drawMode);
+    void updateTopology(gl::PrimitiveMode drawMode);
 
     // Raster states
     void updateCullMode(const gl::RasterizerState &rasterState);
diff --git a/src/libANGLE/renderer/vulkan/vk_utils.cpp b/src/libANGLE/renderer/vulkan/vk_utils.cpp
index fcd1811..c06b443 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_utils.cpp
@@ -149,8 +149,8 @@
 }
 }  // anonymous namespace
 
-const char *g_VkLoaderLayersPathEnv    = "VK_LAYER_PATH";
-const char *g_VkICDPathEnv             = "VK_ICD_FILENAMES";
+const char *g_VkLoaderLayersPathEnv = "VK_LAYER_PATH";
+const char *g_VkICDPathEnv          = "VK_ICD_FILENAMES";
 
 const char *VulkanResultString(VkResult result)
 {
@@ -1251,23 +1251,23 @@
             {static_cast<uint32_t>(source.width), static_cast<uint32_t>(source.height)}};
 }
 
-VkPrimitiveTopology GetPrimitiveTopology(GLenum mode)
+VkPrimitiveTopology GetPrimitiveTopology(gl::PrimitiveMode mode)
 {
     switch (mode)
     {
-        case GL_TRIANGLES:
+        case gl::PrimitiveMode::Triangles:
             return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
-        case GL_POINTS:
+        case gl::PrimitiveMode::Points:
             return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
-        case GL_LINES:
+        case gl::PrimitiveMode::Lines:
             return VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
-        case GL_LINE_STRIP:
+        case gl::PrimitiveMode::LineStrip:
             return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
-        case GL_TRIANGLE_FAN:
+        case gl::PrimitiveMode::TriangleFan:
             return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN;
-        case GL_TRIANGLE_STRIP:
+        case gl::PrimitiveMode::TriangleStrip:
             return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
-        case GL_LINE_LOOP:
+        case gl::PrimitiveMode::LineLoop:
             return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
         default:
             UNREACHABLE();
diff --git a/src/libANGLE/renderer/vulkan/vk_utils.h b/src/libANGLE/renderer/vulkan/vk_utils.h
index 00a9fe3..c02399e 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.h
+++ b/src/libANGLE/renderer/vulkan/vk_utils.h
@@ -690,7 +690,7 @@
 VkFilter GetFilter(const GLenum filter);
 VkSamplerMipmapMode GetSamplerMipmapMode(const GLenum filter);
 VkSamplerAddressMode GetSamplerAddressMode(const GLenum wrap);
-VkPrimitiveTopology GetPrimitiveTopology(GLenum mode);
+VkPrimitiveTopology GetPrimitiveTopology(gl::PrimitiveMode mode);
 VkCullModeFlags GetCullMode(const gl::RasterizerState &rasterState);
 VkFrontFace GetFrontFace(GLenum frontFace);
 VkSampleCountFlagBits GetSamples(GLint sampleCount);
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 9f25a53..97631f0 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -494,24 +494,28 @@
     return true;
 }
 
-bool IsCompatibleDrawModeWithGeometryShader(GLenum drawMode,
-                                            GLenum geometryShaderInputPrimitiveType)
+bool IsCompatibleDrawModeWithGeometryShader(PrimitiveMode drawMode,
+                                            PrimitiveMode geometryShaderInputPrimitiveType)
 {
     // [EXT_geometry_shader] Section 11.1gs.1, Geometry Shader Input Primitives
-    switch (geometryShaderInputPrimitiveType)
+    switch (drawMode)
     {
-        case GL_POINTS:
-            return drawMode == GL_POINTS;
-        case GL_LINES:
-            return drawMode == GL_LINES || drawMode == GL_LINE_STRIP || drawMode == GL_LINE_LOOP;
-        case GL_LINES_ADJACENCY_EXT:
-            return drawMode == GL_LINES_ADJACENCY_EXT || drawMode == GL_LINE_STRIP_ADJACENCY_EXT;
-        case GL_TRIANGLES:
-            return drawMode == GL_TRIANGLES || drawMode == GL_TRIANGLE_FAN ||
-                   drawMode == GL_TRIANGLE_STRIP;
-        case GL_TRIANGLES_ADJACENCY_EXT:
-            return drawMode == GL_TRIANGLES_ADJACENCY_EXT ||
-                   drawMode == GL_TRIANGLE_STRIP_ADJACENCY_EXT;
+        case PrimitiveMode::Points:
+            return geometryShaderInputPrimitiveType == PrimitiveMode::Points;
+        case PrimitiveMode::Lines:
+        case PrimitiveMode::LineStrip:
+        case PrimitiveMode::LineLoop:
+            return geometryShaderInputPrimitiveType == PrimitiveMode::Lines;
+        case PrimitiveMode::LinesAdjacency:
+        case PrimitiveMode::LineStripAdjacency:
+            return geometryShaderInputPrimitiveType == PrimitiveMode::LinesAdjacency;
+        case PrimitiveMode::Triangles:
+        case PrimitiveMode::TriangleFan:
+        case PrimitiveMode::TriangleStrip:
+            return geometryShaderInputPrimitiveType == PrimitiveMode::Triangles;
+        case PrimitiveMode::TrianglesAdjacency:
+        case PrimitiveMode::TriangleStripAdjacency:
+            return geometryShaderInputPrimitiveType == PrimitiveMode::TrianglesAdjacency;
         default:
             UNREACHABLE();
             return false;
@@ -635,8 +639,8 @@
 }
 
 bool ValidateTransformFeedbackPrimitiveMode(const Context *context,
-                                            GLenum transformFeedbackPrimitiveMode,
-                                            GLenum renderPrimitiveMode)
+                                            PrimitiveMode transformFeedbackPrimitiveMode,
+                                            PrimitiveMode renderPrimitiveMode)
 {
     ASSERT(context);
 
@@ -649,17 +653,18 @@
     }
 
     // [GL_EXT_geometry_shader] Table 12.1gs
-    switch (transformFeedbackPrimitiveMode)
+    switch (renderPrimitiveMode)
     {
-        case GL_POINTS:
-            return renderPrimitiveMode == GL_POINTS;
-        case GL_TRIANGLES:
-            return renderPrimitiveMode == GL_TRIANGLES ||
-                   renderPrimitiveMode == GL_TRIANGLE_STRIP ||
-                   renderPrimitiveMode == GL_TRIANGLE_FAN;
-        case GL_LINES:
-            return renderPrimitiveMode == GL_LINES || renderPrimitiveMode == GL_LINE_LOOP ||
-                   renderPrimitiveMode == GL_LINE_STRIP;
+        case PrimitiveMode::Points:
+            return transformFeedbackPrimitiveMode == PrimitiveMode::Points;
+        case PrimitiveMode::Lines:
+        case PrimitiveMode::LineStrip:
+        case PrimitiveMode::LineLoop:
+            return transformFeedbackPrimitiveMode == PrimitiveMode::Lines;
+        case PrimitiveMode::Triangles:
+        case PrimitiveMode::TriangleFan:
+        case PrimitiveMode::TriangleStrip:
+            return transformFeedbackPrimitiveMode == PrimitiveMode::Triangles;
         default:
             UNREACHABLE();
             return false;
@@ -667,7 +672,7 @@
 }
 
 bool ValidateDrawElementsInstancedBase(Context *context,
-                                       GLenum mode,
+                                       PrimitiveMode mode,
                                        GLsizei count,
                                        GLenum type,
                                        const GLvoid *indices,
@@ -688,7 +693,7 @@
 }
 
 bool ValidateDrawArraysInstancedBase(Context *context,
-                                     GLenum mode,
+                                     PrimitiveMode mode,
                                      GLint first,
                                      GLsizei count,
                                      GLsizei primcount)
@@ -2616,25 +2621,25 @@
     return true;
 }
 
-bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count)
+bool ValidateDrawBase(Context *context, PrimitiveMode mode, GLsizei count)
 {
     const Extensions &extensions = context->getExtensions();
 
     switch (mode)
     {
-        case GL_POINTS:
-        case GL_LINES:
-        case GL_LINE_LOOP:
-        case GL_LINE_STRIP:
-        case GL_TRIANGLES:
-        case GL_TRIANGLE_STRIP:
-        case GL_TRIANGLE_FAN:
+        case PrimitiveMode::Points:
+        case PrimitiveMode::Lines:
+        case PrimitiveMode::LineLoop:
+        case PrimitiveMode::LineStrip:
+        case PrimitiveMode::Triangles:
+        case PrimitiveMode::TriangleStrip:
+        case PrimitiveMode::TriangleFan:
             break;
 
-        case GL_LINES_ADJACENCY_EXT:
-        case GL_LINE_STRIP_ADJACENCY_EXT:
-        case GL_TRIANGLES_ADJACENCY_EXT:
-        case GL_TRIANGLE_STRIP_ADJACENCY_EXT:
+        case PrimitiveMode::LinesAdjacency:
+        case PrimitiveMode::LineStripAdjacency:
+        case PrimitiveMode::TrianglesAdjacency:
+        case PrimitiveMode::TriangleStripAdjacency:
             if (!extensions.geometryShader)
             {
                 ANGLE_VALIDATION_ERR(context, InvalidEnum(), GeometryShaderExtensionNotEnabled);
@@ -2861,7 +2866,7 @@
 }
 
 bool ValidateDrawArraysCommon(Context *context,
-                              GLenum mode,
+                              PrimitiveMode mode,
                               GLint first,
                               GLsizei count,
                               GLsizei primcount)
@@ -2920,7 +2925,7 @@
 }
 
 bool ValidateDrawArraysInstancedANGLE(Context *context,
-                                      GLenum mode,
+                                      PrimitiveMode mode,
                                       GLint first,
                                       GLsizei count,
                                       GLsizei primcount)
@@ -2939,7 +2944,7 @@
     return ValidateDrawInstancedANGLE(context);
 }
 
-bool ValidateDrawElementsBase(Context *context, GLenum mode, GLenum type)
+bool ValidateDrawElementsBase(Context *context, PrimitiveMode mode, GLenum type)
 {
     switch (type)
     {
@@ -2990,7 +2995,7 @@
 }
 
 bool ValidateDrawElementsCommon(Context *context,
-                                GLenum mode,
+                                PrimitiveMode mode,
                                 GLsizei count,
                                 GLenum type,
                                 const void *indices,
@@ -3164,7 +3169,7 @@
 }
 
 bool ValidateDrawElementsInstancedCommon(Context *context,
-                                         GLenum mode,
+                                         PrimitiveMode mode,
                                          GLsizei count,
                                          GLenum type,
                                          const void *indices,
@@ -3174,7 +3179,7 @@
 }
 
 bool ValidateDrawElementsInstancedANGLE(Context *context,
-                                        GLenum mode,
+                                        PrimitiveMode mode,
                                         GLsizei count,
                                         GLenum type,
                                         const void *indices,
diff --git a/src/libANGLE/validationES.h b/src/libANGLE/validationES.h
index 8a98d63..f1748e4 100644
--- a/src/libANGLE/validationES.h
+++ b/src/libANGLE/validationES.h
@@ -272,39 +272,39 @@
                                         GLint border,
                                         Format *textureFormatOut);
 
-bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count);
+bool ValidateDrawBase(Context *context, PrimitiveMode mode, GLsizei count);
 bool ValidateDrawArraysCommon(Context *context,
-                              GLenum mode,
+                              PrimitiveMode mode,
                               GLint first,
                               GLsizei count,
                               GLsizei primcount);
 bool ValidateDrawArraysInstancedBase(Context *context,
-                                     GLenum mode,
+                                     PrimitiveMode mode,
                                      GLint first,
                                      GLsizei count,
                                      GLsizei primcount);
 bool ValidateDrawArraysInstancedANGLE(Context *context,
-                                      GLenum mode,
+                                      PrimitiveMode mode,
                                       GLint first,
                                       GLsizei count,
                                       GLsizei primcount);
 
-bool ValidateDrawElementsBase(Context *context, GLenum mode, GLenum type);
+bool ValidateDrawElementsBase(Context *context, PrimitiveMode mode, GLenum type);
 bool ValidateDrawElementsCommon(Context *context,
-                                GLenum mode,
+                                PrimitiveMode mode,
                                 GLsizei count,
                                 GLenum type,
                                 const void *indices,
                                 GLsizei primcount);
 
 bool ValidateDrawElementsInstancedCommon(Context *context,
-                                         GLenum mode,
+                                         PrimitiveMode mode,
                                          GLsizei count,
                                          GLenum type,
                                          const void *indices,
                                          GLsizei primcount);
 bool ValidateDrawElementsInstancedANGLE(Context *context,
-                                        GLenum mode,
+                                        PrimitiveMode mode,
                                         GLsizei count,
                                         GLenum type,
                                         const void *indices,
@@ -680,8 +680,8 @@
 bool ValidateMultitextureUnit(Context *context, GLenum texture);
 
 bool ValidateTransformFeedbackPrimitiveMode(const Context *context,
-                                            GLenum transformFeedbackPrimitiveMode,
-                                            GLenum renderPrimitiveMode);
+                                            PrimitiveMode transformFeedbackPrimitiveMode,
+                                            PrimitiveMode renderPrimitiveMode);
 
 // Utility macro for handling implementation methods inside Validation.
 #define ANGLE_HANDLE_VALIDATION_ERR(X) \
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index 7d33b43..45c8858 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -5764,13 +5764,13 @@
     return true;
 }
 
-bool ValidateDrawArrays(Context *context, GLenum mode, GLint first, GLsizei count)
+bool ValidateDrawArrays(Context *context, PrimitiveMode mode, GLint first, GLsizei count)
 {
     return ValidateDrawArraysCommon(context, mode, first, count, 1);
 }
 
 bool ValidateDrawElements(Context *context,
-                          GLenum mode,
+                          PrimitiveMode mode,
                           GLsizei count,
                           GLenum type,
                           const void *indices)
diff --git a/src/libANGLE/validationES2.h b/src/libANGLE/validationES2.h
index 4bc6638..8b6c382 100644
--- a/src/libANGLE/validationES2.h
+++ b/src/libANGLE/validationES2.h
@@ -577,12 +577,12 @@
 bool ValidateVertexAttrib4fv(Context *context, GLuint index, const GLfloat *values);
 bool ValidateViewport(Context *context, GLint x, GLint y, GLsizei width, GLsizei height);
 bool ValidateDrawElements(Context *context,
-                          GLenum mode,
+                          PrimitiveMode mode,
                           GLsizei count,
                           GLenum type,
                           const void *indices);
 
-bool ValidateDrawArrays(Context *context, GLenum mode, GLint first, GLsizei count);
+bool ValidateDrawArrays(Context *context, PrimitiveMode mode, GLint first, GLsizei count);
 
 bool ValidateGetFramebufferAttachmentParameteriv(Context *context,
                                                  GLenum target,
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
index 097d924..2fd2961 100644
--- a/src/libANGLE/validationES3.cpp
+++ b/src/libANGLE/validationES3.cpp
@@ -1253,7 +1253,7 @@
 }
 
 bool ValidateDrawRangeElements(Context *context,
-                               GLenum mode,
+                               PrimitiveMode mode,
                                GLuint start,
                                GLuint end,
                                GLsizei count,
@@ -2122,7 +2122,7 @@
     return ValidateGenOrDeleteES3(context, n);
 }
 
-bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode)
+bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMode)
 {
     if (context->getClientMajorVersion() < 3)
     {
@@ -2131,9 +2131,9 @@
     }
     switch (primitiveMode)
     {
-        case GL_TRIANGLES:
-        case GL_LINES:
-        case GL_POINTS:
+        case PrimitiveMode::Triangles:
+        case PrimitiveMode::Lines:
+        case PrimitiveMode::Points:
             break;
 
         default:
@@ -2782,7 +2782,7 @@
 }
 
 bool ValidateDrawElementsInstanced(Context *context,
-                                   GLenum mode,
+                                   PrimitiveMode mode,
                                    GLsizei count,
                                    GLenum type,
                                    const void *indices,
@@ -3456,7 +3456,7 @@
 }
 
 bool ValidateDrawArraysInstanced(Context *context,
-                                 GLenum mode,
+                                 PrimitiveMode mode,
                                  GLint first,
                                  GLsizei count,
                                  GLsizei primcount)
diff --git a/src/libANGLE/validationES3.h b/src/libANGLE/validationES3.h
index 743b056..a709b1b 100644
--- a/src/libANGLE/validationES3.h
+++ b/src/libANGLE/validationES3.h
@@ -178,7 +178,7 @@
 bool ValidateClearBuffer(Context *context);
 
 bool ValidateDrawRangeElements(Context *context,
-                               GLenum mode,
+                               PrimitiveMode mode,
                                GLuint start,
                                GLuint end,
                                GLsizei count,
@@ -347,7 +347,7 @@
 bool ValidateGenVertexArrays(Context *context, GLint n, GLuint *arrays);
 bool ValidateDeleteVertexArrays(Context *context, GLint n, const GLuint *arrays);
 
-bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode);
+bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMode);
 
 bool ValidateGetBufferPointerv(Context *context, BufferBinding target, GLenum pname, void **params);
 bool ValidateGetBufferPointervRobustANGLE(Context *context,
@@ -413,7 +413,7 @@
                        GLint *values);
 
 bool ValidateDrawElementsInstanced(Context *context,
-                                   GLenum mode,
+                                   PrimitiveMode mode,
                                    GLsizei count,
                                    GLenum type,
                                    const void *indices,
@@ -539,7 +539,7 @@
                                  GLuint uniformBlockIndex,
                                  GLuint uniformBlockBinding);
 bool ValidateDrawArraysInstanced(Context *context,
-                                 GLenum mode,
+                                 PrimitiveMode mode,
                                  GLint first,
                                  GLsizei count,
                                  GLsizei primcount);
diff --git a/src/libANGLE/validationES31.cpp b/src/libANGLE/validationES31.cpp
index 86c6f9b..d00c4de 100644
--- a/src/libANGLE/validationES31.cpp
+++ b/src/libANGLE/validationES31.cpp
@@ -410,7 +410,7 @@
     return true;
 }
 
-bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirect)
+bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void *indirect)
 {
     if (context->getClientVersion() < ES_3_1)
     {
@@ -468,10 +468,10 @@
     return true;
 }
 
-bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const void *indirect)
+bool ValidateDrawArraysIndirect(Context *context, PrimitiveMode mode, const void *indirect)
 {
-    const State &state                          = context->getGLState();
-    TransformFeedback *curTransformFeedback     = state.getCurrentTransformFeedback();
+    const State &state                      = context->getGLState();
+    TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
     if (curTransformFeedback && curTransformFeedback->isActive() &&
         !curTransformFeedback->isPaused())
     {
@@ -516,16 +516,19 @@
     return true;
 }
 
-bool ValidateDrawElementsIndirect(Context *context, GLenum mode, GLenum type, const void *indirect)
+bool ValidateDrawElementsIndirect(Context *context,
+                                  PrimitiveMode mode,
+                                  GLenum type,
+                                  const void *indirect)
 {
     if (!ValidateDrawElementsBase(context, mode, type))
     {
         return false;
     }
 
-    const State &state             = context->getGLState();
-    const VertexArray *vao         = state.getVertexArray();
-    Buffer *elementArrayBuffer     = vao->getElementArrayBuffer().get();
+    const State &state         = context->getGLState();
+    const VertexArray *vao     = state.getVertexArray();
+    Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get();
     if (!elementArrayBuffer)
     {
         context->handleError(InvalidOperation() << "zero is bound to ELEMENT_ARRAY_BUFFER");
diff --git a/src/libANGLE/validationES31.h b/src/libANGLE/validationES31.h
index 62ab14f..40d59bd 100644
--- a/src/libANGLE/validationES31.h
+++ b/src/libANGLE/validationES31.h
@@ -65,9 +65,12 @@
                                          GLsizei *length,
                                          GLfloat *val);
 
-bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirect);
-bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const void *indirect);
-bool ValidateDrawElementsIndirect(Context *context, GLenum mode, GLenum type, const void *indirect);
+bool ValidateDrawIndirectBase(Context *context, PrimitiveMode mode, const void *indirect);
+bool ValidateDrawArraysIndirect(Context *context, PrimitiveMode mode, const void *indirect);
+bool ValidateDrawElementsIndirect(Context *context,
+                                  PrimitiveMode mode,
+                                  GLenum type,
+                                  const void *indirect);
 
 bool ValidateProgramUniform1i(Context *context, GLuint program, GLint location, GLint v0);
 bool ValidateProgramUniform2i(Context *context, GLuint program, GLint location, GLint v0, GLint v1);
diff --git a/src/libGLESv2/entry_points_gles_2_0_autogen.cpp b/src/libGLESv2/entry_points_gles_2_0_autogen.cpp
index 30d0574..de6e714 100644
--- a/src/libGLESv2/entry_points_gles_2_0_autogen.cpp
+++ b/src/libGLESv2/entry_points_gles_2_0_autogen.cpp
@@ -758,11 +758,12 @@
     Context *context = GetValidGlobalContext();
     if (context)
     {
-        context->gatherParams<EntryPoint::DrawArrays>(mode, first, count);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawArrays>(modePacked, first, count);
 
-        if (context->skipValidation() || ValidateDrawArrays(context, mode, first, count))
+        if (context->skipValidation() || ValidateDrawArrays(context, modePacked, first, count))
         {
-            context->drawArrays(mode, first, count);
+            context->drawArrays(modePacked, first, count);
         }
     }
 }
@@ -777,11 +778,13 @@
     Context *context = GetValidGlobalContext();
     if (context)
     {
-        context->gatherParams<EntryPoint::DrawElements>(mode, count, type, indices);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawElements>(modePacked, count, type, indices);
 
-        if (context->skipValidation() || ValidateDrawElements(context, mode, count, type, indices))
+        if (context->skipValidation() ||
+            ValidateDrawElements(context, modePacked, count, type, indices))
         {
-            context->drawElements(mode, count, type, indices);
+            context->drawElements(modePacked, count, type, indices);
         }
     }
 }
diff --git a/src/libGLESv2/entry_points_gles_3_0_autogen.cpp b/src/libGLESv2/entry_points_gles_3_0_autogen.cpp
index d25bfea..53cb40e 100644
--- a/src/libGLESv2/entry_points_gles_3_0_autogen.cpp
+++ b/src/libGLESv2/entry_points_gles_3_0_autogen.cpp
@@ -40,11 +40,13 @@
     Context *context = GetValidGlobalContext();
     if (context)
     {
-        context->gatherParams<EntryPoint::BeginTransformFeedback>(primitiveMode);
+        PrimitiveMode primitiveModePacked = FromGLenum<PrimitiveMode>(primitiveMode);
+        context->gatherParams<EntryPoint::BeginTransformFeedback>(primitiveModePacked);
 
-        if (context->skipValidation() || ValidateBeginTransformFeedback(context, primitiveMode))
+        if (context->skipValidation() ||
+            ValidateBeginTransformFeedback(context, primitiveModePacked))
         {
-            context->beginTransformFeedback(primitiveMode);
+            context->beginTransformFeedback(primitiveModePacked);
         }
     }
 }
@@ -477,12 +479,14 @@
     Context *context = GetValidGlobalContext();
     if (context)
     {
-        context->gatherParams<EntryPoint::DrawArraysInstanced>(mode, first, count, instancecount);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawArraysInstanced>(modePacked, first, count,
+                                                               instancecount);
 
         if (context->skipValidation() ||
-            ValidateDrawArraysInstanced(context, mode, first, count, instancecount))
+            ValidateDrawArraysInstanced(context, modePacked, first, count, instancecount))
         {
-            context->drawArraysInstanced(mode, first, count, instancecount);
+            context->drawArraysInstanced(modePacked, first, count, instancecount);
         }
     }
 }
@@ -517,13 +521,14 @@
     Context *context = GetValidGlobalContext();
     if (context)
     {
-        context->gatherParams<EntryPoint::DrawElementsInstanced>(mode, count, type, indices,
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawElementsInstanced>(modePacked, count, type, indices,
                                                                  instancecount);
 
         if (context->skipValidation() ||
-            ValidateDrawElementsInstanced(context, mode, count, type, indices, instancecount))
+            ValidateDrawElementsInstanced(context, modePacked, count, type, indices, instancecount))
         {
-            context->drawElementsInstanced(mode, count, type, indices, instancecount);
+            context->drawElementsInstanced(modePacked, count, type, indices, instancecount);
         }
     }
 }
@@ -543,13 +548,14 @@
     Context *context = GetValidGlobalContext();
     if (context)
     {
-        context->gatherParams<EntryPoint::DrawRangeElements>(mode, start, end, count, type,
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawRangeElements>(modePacked, start, end, count, type,
                                                              indices);
 
         if (context->skipValidation() ||
-            ValidateDrawRangeElements(context, mode, start, end, count, type, indices))
+            ValidateDrawRangeElements(context, modePacked, start, end, count, type, indices))
         {
-            context->drawRangeElements(mode, start, end, count, type, indices);
+            context->drawRangeElements(modePacked, start, end, count, type, indices);
         }
     }
 }
diff --git a/src/libGLESv2/entry_points_gles_3_1_autogen.cpp b/src/libGLESv2/entry_points_gles_3_1_autogen.cpp
index 91c0ae7..18f6c42 100644
--- a/src/libGLESv2/entry_points_gles_3_1_autogen.cpp
+++ b/src/libGLESv2/entry_points_gles_3_1_autogen.cpp
@@ -176,11 +176,12 @@
     Context *context = GetValidGlobalContext();
     if (context)
     {
-        context->gatherParams<EntryPoint::DrawArraysIndirect>(mode, indirect);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawArraysIndirect>(modePacked, indirect);
 
-        if (context->skipValidation() || ValidateDrawArraysIndirect(context, mode, indirect))
+        if (context->skipValidation() || ValidateDrawArraysIndirect(context, modePacked, indirect))
         {
-            context->drawArraysIndirect(mode, indirect);
+            context->drawArraysIndirect(modePacked, indirect);
         }
     }
 }
@@ -193,12 +194,13 @@
     Context *context = GetValidGlobalContext();
     if (context)
     {
-        context->gatherParams<EntryPoint::DrawElementsIndirect>(mode, type, indirect);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawElementsIndirect>(modePacked, type, indirect);
 
         if (context->skipValidation() ||
-            ValidateDrawElementsIndirect(context, mode, type, indirect))
+            ValidateDrawElementsIndirect(context, modePacked, type, indirect))
         {
-            context->drawElementsIndirect(mode, type, indirect);
+            context->drawElementsIndirect(modePacked, type, indirect);
         }
     }
 }
diff --git a/src/libGLESv2/entry_points_gles_ext_autogen.cpp b/src/libGLESv2/entry_points_gles_ext_autogen.cpp
index 840dd29..7d6bad9 100644
--- a/src/libGLESv2/entry_points_gles_ext_autogen.cpp
+++ b/src/libGLESv2/entry_points_gles_ext_autogen.cpp
@@ -95,12 +95,14 @@
     Context *context = GetValidGlobalContext();
     if (context)
     {
-        context->gatherParams<EntryPoint::DrawArraysInstancedANGLE>(mode, first, count, primcount);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawArraysInstancedANGLE>(modePacked, first, count,
+                                                                    primcount);
 
         if (context->skipValidation() ||
-            ValidateDrawArraysInstancedANGLE(context, mode, first, count, primcount))
+            ValidateDrawArraysInstancedANGLE(context, modePacked, first, count, primcount))
         {
-            context->drawArraysInstanced(mode, first, count, primcount);
+            context->drawArraysInstanced(modePacked, first, count, primcount);
         }
     }
 }
@@ -119,13 +121,14 @@
     Context *context = GetValidGlobalContext();
     if (context)
     {
-        context->gatherParams<EntryPoint::DrawElementsInstancedANGLE>(mode, count, type, indices,
-                                                                      primcount);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawElementsInstancedANGLE>(modePacked, count, type,
+                                                                      indices, primcount);
 
-        if (context->skipValidation() ||
-            ValidateDrawElementsInstancedANGLE(context, mode, count, type, indices, primcount))
+        if (context->skipValidation() || ValidateDrawElementsInstancedANGLE(
+                                             context, modePacked, count, type, indices, primcount))
         {
-            context->drawElementsInstanced(mode, count, type, indices, primcount);
+            context->drawElementsInstanced(modePacked, count, type, indices, primcount);
         }
     }
 }
@@ -4525,11 +4528,13 @@
     if (context)
     {
         ASSERT(context == GetValidGlobalContext());
-        context->gatherParams<EntryPoint::BeginTransformFeedback>(primitiveMode);
+        PrimitiveMode primitiveModePacked = FromGLenum<PrimitiveMode>(primitiveMode);
+        context->gatherParams<EntryPoint::BeginTransformFeedback>(primitiveModePacked);
 
-        if (context->skipValidation() || ValidateBeginTransformFeedback(context, primitiveMode))
+        if (context->skipValidation() ||
+            ValidateBeginTransformFeedback(context, primitiveModePacked))
         {
-            context->beginTransformFeedback(primitiveMode);
+            context->beginTransformFeedback(primitiveModePacked);
         }
     }
 }
@@ -6454,11 +6459,12 @@
     if (context)
     {
         ASSERT(context == GetValidGlobalContext());
-        context->gatherParams<EntryPoint::DrawArrays>(mode, first, count);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawArrays>(modePacked, first, count);
 
-        if (context->skipValidation() || ValidateDrawArrays(context, mode, first, count))
+        if (context->skipValidation() || ValidateDrawArrays(context, modePacked, first, count))
         {
-            context->drawArrays(mode, first, count);
+            context->drawArrays(modePacked, first, count);
         }
     }
 }
@@ -6471,11 +6477,12 @@
     if (context)
     {
         ASSERT(context == GetValidGlobalContext());
-        context->gatherParams<EntryPoint::DrawArraysIndirect>(mode, indirect);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawArraysIndirect>(modePacked, indirect);
 
-        if (context->skipValidation() || ValidateDrawArraysIndirect(context, mode, indirect))
+        if (context->skipValidation() || ValidateDrawArraysIndirect(context, modePacked, indirect))
         {
-            context->drawArraysIndirect(mode, indirect);
+            context->drawArraysIndirect(modePacked, indirect);
         }
     }
 }
@@ -6493,12 +6500,14 @@
     if (context)
     {
         ASSERT(context == GetValidGlobalContext());
-        context->gatherParams<EntryPoint::DrawArraysInstanced>(mode, first, count, instancecount);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawArraysInstanced>(modePacked, first, count,
+                                                               instancecount);
 
         if (context->skipValidation() ||
-            ValidateDrawArraysInstanced(context, mode, first, count, instancecount))
+            ValidateDrawArraysInstanced(context, modePacked, first, count, instancecount))
         {
-            context->drawArraysInstanced(mode, first, count, instancecount);
+            context->drawArraysInstanced(modePacked, first, count, instancecount);
         }
     }
 }
@@ -6516,12 +6525,14 @@
     if (context)
     {
         ASSERT(context == GetValidGlobalContext());
-        context->gatherParams<EntryPoint::DrawArraysInstancedANGLE>(mode, first, count, primcount);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawArraysInstancedANGLE>(modePacked, first, count,
+                                                                    primcount);
 
         if (context->skipValidation() ||
-            ValidateDrawArraysInstancedANGLE(context, mode, first, count, primcount))
+            ValidateDrawArraysInstancedANGLE(context, modePacked, first, count, primcount))
         {
-            context->drawArraysInstanced(mode, first, count, primcount);
+            context->drawArraysInstanced(modePacked, first, count, primcount);
         }
     }
 }
@@ -6575,11 +6586,13 @@
     if (context)
     {
         ASSERT(context == GetValidGlobalContext());
-        context->gatherParams<EntryPoint::DrawElements>(mode, count, type, indices);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawElements>(modePacked, count, type, indices);
 
-        if (context->skipValidation() || ValidateDrawElements(context, mode, count, type, indices))
+        if (context->skipValidation() ||
+            ValidateDrawElements(context, modePacked, count, type, indices))
         {
-            context->drawElements(mode, count, type, indices);
+            context->drawElements(modePacked, count, type, indices);
         }
     }
 }
@@ -6596,12 +6609,13 @@
     if (context)
     {
         ASSERT(context == GetValidGlobalContext());
-        context->gatherParams<EntryPoint::DrawElementsIndirect>(mode, type, indirect);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawElementsIndirect>(modePacked, type, indirect);
 
         if (context->skipValidation() ||
-            ValidateDrawElementsIndirect(context, mode, type, indirect))
+            ValidateDrawElementsIndirect(context, modePacked, type, indirect))
         {
-            context->drawElementsIndirect(mode, type, indirect);
+            context->drawElementsIndirect(modePacked, type, indirect);
         }
     }
 }
@@ -6622,13 +6636,14 @@
     if (context)
     {
         ASSERT(context == GetValidGlobalContext());
-        context->gatherParams<EntryPoint::DrawElementsInstanced>(mode, count, type, indices,
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawElementsInstanced>(modePacked, count, type, indices,
                                                                  instancecount);
 
         if (context->skipValidation() ||
-            ValidateDrawElementsInstanced(context, mode, count, type, indices, instancecount))
+            ValidateDrawElementsInstanced(context, modePacked, count, type, indices, instancecount))
         {
-            context->drawElementsInstanced(mode, count, type, indices, instancecount);
+            context->drawElementsInstanced(modePacked, count, type, indices, instancecount);
         }
     }
 }
@@ -6649,13 +6664,14 @@
     if (context)
     {
         ASSERT(context == GetValidGlobalContext());
-        context->gatherParams<EntryPoint::DrawElementsInstancedANGLE>(mode, count, type, indices,
-                                                                      primcount);
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawElementsInstancedANGLE>(modePacked, count, type,
+                                                                      indices, primcount);
 
-        if (context->skipValidation() ||
-            ValidateDrawElementsInstancedANGLE(context, mode, count, type, indices, primcount))
+        if (context->skipValidation() || ValidateDrawElementsInstancedANGLE(
+                                             context, modePacked, count, type, indices, primcount))
         {
-            context->drawElementsInstanced(mode, count, type, indices, primcount);
+            context->drawElementsInstanced(modePacked, count, type, indices, primcount);
         }
     }
 }
@@ -6677,13 +6693,14 @@
     if (context)
     {
         ASSERT(context == GetValidGlobalContext());
-        context->gatherParams<EntryPoint::DrawRangeElements>(mode, start, end, count, type,
+        PrimitiveMode modePacked = FromGLenum<PrimitiveMode>(mode);
+        context->gatherParams<EntryPoint::DrawRangeElements>(modePacked, start, end, count, type,
                                                              indices);
 
         if (context->skipValidation() ||
-            ValidateDrawRangeElements(context, mode, start, end, count, type, indices))
+            ValidateDrawRangeElements(context, modePacked, start, end, count, type, indices))
         {
-            context->drawRangeElements(mode, start, end, count, type, indices);
+            context->drawRangeElements(modePacked, start, end, count, type, indices);
         }
     }
 }