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/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);