Merge gl::Context and gl::ContextState.

This reduces the number of indrections when accessing the Extensions
or Caps structures. It will provide a small speed-up to some methods.
It also cleans up the code.

Bug: angleproject:2966
Change-Id: Idddac70758c42c1c2b75c885d0cacc8a5c458685
Reviewed-on: https://chromium-review.googlesource.com/c/1392391
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Markus Tavenrath <matavenrath@nvidia.com>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index afe51c8..28ee135 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -282,21 +282,16 @@
              shareContext ? &shareContext->mState : nullptr,
              shareTextures,
              GetClientVersion(attribs),
-             &mGLState,
-             mCaps,
-             mTextureCaps,
-             mExtensions,
-             mLimitations),
+             GetDebug(attribs),
+             GetBindGeneratesResource(attribs),
+             GetClientArraysEnabled(attribs),
+             GetRobustResourceInit(attribs),
+             memoryProgramCache != nullptr),
       mSkipValidation(GetNoError(attribs)),
       mDisplayTextureShareGroup(shareTextures != nullptr),
       mImplementation(implFactory->createContext(mState, config, shareContext, attribs)),
       mLabel(nullptr),
       mCompiler(),
-      mGLState(GetDebug(attribs),
-               GetBindGeneratesResource(attribs),
-               GetClientArraysEnabled(attribs),
-               GetRobustResourceInit(attribs),
-               memoryProgramCache != nullptr),
       mConfig(config),
       mClientType(EGL_OPENGL_ES_API),
       mErrors(this),
@@ -340,7 +335,7 @@
     initCaps();
     initWorkarounds();
 
-    mGLState.initialize(this);
+    mState.initialize(this);
 
     mFenceNVHandleAllocator.setBaseHandle(0);
 
@@ -377,12 +372,12 @@
             new Texture(mImplementation.get(), 0, TextureType::_2DMultisampleArray);
         mZeroTextures[TextureType::_2DMultisampleArray].set(this, zeroTexture2DMultisampleArray);
 
-        for (unsigned int i = 0; i < mCaps.maxAtomicCounterBufferBindings; i++)
+        for (unsigned int i = 0; i < mState.mCaps.maxAtomicCounterBufferBindings; i++)
         {
             bindBufferRange(BufferBinding::AtomicCounter, i, 0, 0, 0);
         }
 
-        for (unsigned int i = 0; i < mCaps.maxShaderStorageBufferBindings; i++)
+        for (unsigned int i = 0; i < mState.mCaps.maxShaderStorageBufferBindings; i++)
         {
             bindBufferRange(BufferBinding::ShaderStorage, i, 0, 0, 0);
         }
@@ -401,7 +396,7 @@
         mZeroTextures[TextureType::External].set(this, zeroTextureExternal);
     }
 
-    mGLState.initializeZeroTextures(this, mZeroTextures);
+    mState.initializeZeroTextures(this, mZeroTextures);
 
     bindVertexArray(0);
 
@@ -421,7 +416,7 @@
 
     bindRenderbuffer(GL_RENDERBUFFER, 0);
 
-    for (unsigned int i = 0; i < mCaps.maxUniformBufferBindings; i++)
+    for (unsigned int i = 0; i < mState.mCaps.maxUniformBufferBindings; i++)
     {
         bindBufferRange(BufferBinding::Uniform, i, 0, 0, -1);
     }
@@ -500,7 +495,7 @@
 {
     if (mGLES1Renderer)
     {
-        mGLES1Renderer->onDestroy(this, &mGLState);
+        mGLES1Renderer->onDestroy(this, &mState);
     }
 
     ANGLE_TRY(releaseSurface(display));
@@ -549,17 +544,17 @@
 
     releaseShaderCompiler();
 
-    mGLState.reset(this);
+    mState.reset(this);
 
-    mState.mBuffers->release(this);
-    mState.mShaderPrograms->release(this);
-    mState.mTextures->release(this);
-    mState.mRenderbuffers->release(this);
-    mState.mSamplers->release(this);
-    mState.mSyncs->release(this);
-    mState.mPaths->release(this);
-    mState.mFramebuffers->release(this);
-    mState.mPipelines->release(this);
+    mState.mBufferManager->release(this);
+    mState.mShaderProgramManager->release(this);
+    mState.mTextureManager->release(this);
+    mState.mRenderbufferManager->release(this);
+    mState.mSamplerManager->release(this);
+    mState.mSyncManager->release(this);
+    mState.mPathManager->release(this);
+    mState.mFramebufferManager->release(this);
+    mState.mProgramPipelineManager->release(this);
 
     mThreadPool.reset();
 
@@ -599,15 +594,15 @@
             height = surface->getHeight();
         }
 
-        mGLState.setViewportParams(0, 0, width, height);
-        mGLState.setScissorParams(0, 0, width, height);
+        mState.setViewportParams(0, 0, width, height);
+        mState.setScissorParams(0, 0, width, height);
 
         mHasBeenCurrent = true;
     }
 
     // TODO(jmadill): Rework this when we support ContextImpl
-    mGLState.setAllDirtyBits();
-    mGLState.setAllDirtyObjects();
+    mState.setAllDirtyBits();
+    mState.setAllDirtyObjects();
 
     ANGLE_TRY(releaseSurface(display));
 
@@ -626,12 +621,12 @@
     // Update default framebuffer, the binding of the previous default
     // framebuffer (or lack of) will have a nullptr.
     {
-        mState.mFramebuffers->setDefaultFramebuffer(newDefault);
-        if (mGLState.getReadFramebuffer() == nullptr)
+        mState.mFramebufferManager->setDefaultFramebuffer(newDefault);
+        if (mState.getReadFramebuffer() == nullptr)
         {
             bindReadFramebuffer(0);
         }
-        if (mGLState.getDrawFramebuffer() == nullptr)
+        if (mState.getDrawFramebuffer() == nullptr)
         {
             bindDrawFramebuffer(0);
         }
@@ -643,18 +638,18 @@
 
 egl::Error Context::releaseSurface(const egl::Display *display)
 {
-    gl::Framebuffer *defaultFramebuffer = mState.mFramebuffers->getFramebuffer(0);
+    gl::Framebuffer *defaultFramebuffer = mState.mFramebufferManager->getFramebuffer(0);
 
     // Remove the default framebuffer
-    if (mGLState.getReadFramebuffer() == defaultFramebuffer)
+    if (mState.getReadFramebuffer() == defaultFramebuffer)
     {
-        mGLState.setReadFramebufferBinding(nullptr);
+        mState.setReadFramebufferBinding(nullptr);
         mReadFramebufferObserverBinding.bind(nullptr);
     }
 
-    if (mGLState.getDrawFramebuffer() == defaultFramebuffer)
+    if (mState.getDrawFramebuffer() == defaultFramebuffer)
     {
-        mGLState.setDrawFramebufferBinding(nullptr);
+        mState.setDrawFramebufferBinding(nullptr);
         mDrawFramebufferObserverBinding.bind(nullptr);
     }
 
@@ -664,7 +659,7 @@
         delete defaultFramebuffer;
     }
 
-    mState.mFramebuffers->setDefaultFramebuffer(nullptr);
+    mState.mFramebufferManager->setDefaultFramebuffer(nullptr);
 
     if (mCurrentSurface)
     {
@@ -677,32 +672,33 @@
 
 GLuint Context::createBuffer()
 {
-    return mState.mBuffers->createBuffer();
+    return mState.mBufferManager->createBuffer();
 }
 
 GLuint Context::createProgram()
 {
-    return mState.mShaderPrograms->createProgram(mImplementation.get());
+    return mState.mShaderProgramManager->createProgram(mImplementation.get());
 }
 
 GLuint Context::createShader(ShaderType type)
 {
-    return mState.mShaderPrograms->createShader(mImplementation.get(), mLimitations, type);
+    return mState.mShaderProgramManager->createShader(mImplementation.get(), mState.mLimitations,
+                                                      type);
 }
 
 GLuint Context::createTexture()
 {
-    return mState.mTextures->createTexture();
+    return mState.mTextureManager->createTexture();
 }
 
 GLuint Context::createRenderbuffer()
 {
-    return mState.mRenderbuffers->createRenderbuffer();
+    return mState.mRenderbufferManager->createRenderbuffer();
 }
 
 void Context::tryGenPaths(GLsizei range, GLuint *createdOut)
 {
-    ANGLE_CONTEXT_TRY(mState.mPaths->createPaths(this, range, createdOut));
+    ANGLE_CONTEXT_TRY(mState.mPathManager->createPaths(this, range, createdOut));
 }
 
 GLuint Context::genPaths(GLsizei range)
@@ -715,7 +711,7 @@
 // Returns an unused framebuffer name
 GLuint Context::createFramebuffer()
 {
-    return mState.mFramebuffers->createFramebuffer();
+    return mState.mFramebufferManager->createFramebuffer();
 }
 
 void Context::genFencesNV(GLsizei n, GLuint *fences)
@@ -730,7 +726,7 @@
 
 GLuint Context::createProgramPipeline()
 {
-    return mState.mPipelines->createProgramPipeline();
+    return mState.mProgramPipelineManager->createProgramPipeline();
 }
 
 GLuint Context::createShaderProgramv(ShaderType type, GLsizei count, const GLchar *const *strings)
@@ -741,43 +737,43 @@
 
 void Context::deleteBuffer(GLuint bufferName)
 {
-    Buffer *buffer = mState.mBuffers->getBuffer(bufferName);
+    Buffer *buffer = mState.mBufferManager->getBuffer(bufferName);
     if (buffer)
     {
         detachBuffer(buffer);
     }
 
-    mState.mBuffers->deleteObject(this, bufferName);
+    mState.mBufferManager->deleteObject(this, bufferName);
 }
 
 void Context::deleteShader(GLuint shader)
 {
-    mState.mShaderPrograms->deleteShader(this, shader);
+    mState.mShaderProgramManager->deleteShader(this, shader);
 }
 
 void Context::deleteProgram(GLuint program)
 {
-    mState.mShaderPrograms->deleteProgram(this, program);
+    mState.mShaderProgramManager->deleteProgram(this, program);
 }
 
 void Context::deleteTexture(GLuint texture)
 {
-    if (mState.mTextures->getTexture(texture))
+    if (mState.mTextureManager->getTexture(texture))
     {
         detachTexture(texture);
     }
 
-    mState.mTextures->deleteObject(this, texture);
+    mState.mTextureManager->deleteObject(this, texture);
 }
 
 void Context::deleteRenderbuffer(GLuint renderbuffer)
 {
-    if (mState.mRenderbuffers->getRenderbuffer(renderbuffer))
+    if (mState.mRenderbufferManager->getRenderbuffer(renderbuffer))
     {
         detachRenderbuffer(renderbuffer);
     }
 
-    mState.mRenderbuffers->deleteObject(this, renderbuffer);
+    mState.mRenderbufferManager->deleteObject(this, renderbuffer);
 }
 
 void Context::deleteSync(GLsync sync)
@@ -786,27 +782,27 @@
     // wait commands finish. However, since the name becomes invalid, we cannot query the fence,
     // and since our API is currently designed for being called from a single thread, we can delete
     // the fence immediately.
-    mState.mSyncs->deleteObject(this, static_cast<GLuint>(reinterpret_cast<uintptr_t>(sync)));
+    mState.mSyncManager->deleteObject(this, static_cast<GLuint>(reinterpret_cast<uintptr_t>(sync)));
 }
 
 void Context::deleteProgramPipeline(GLuint pipeline)
 {
-    if (mState.mPipelines->getProgramPipeline(pipeline))
+    if (mState.mProgramPipelineManager->getProgramPipeline(pipeline))
     {
         detachProgramPipeline(pipeline);
     }
 
-    mState.mPipelines->deleteObject(this, pipeline);
+    mState.mProgramPipelineManager->deleteObject(this, pipeline);
 }
 
 void Context::deletePaths(GLuint first, GLsizei range)
 {
-    mState.mPaths->deletePaths(first, range);
+    mState.mPathManager->deletePaths(first, range);
 }
 
 bool Context::isPath(GLuint path) const
 {
-    const auto *pathObj = mState.mPaths->getPath(path);
+    const auto *pathObj = mState.mPathManager->getPath(path);
     if (pathObj == nullptr)
         return false;
 
@@ -815,7 +811,7 @@
 
 bool Context::isPathGenerated(GLuint path) const
 {
-    return mState.mPaths->hasPath(path);
+    return mState.mPathManager->hasPath(path);
 }
 
 void Context::pathCommands(GLuint path,
@@ -825,14 +821,14 @@
                            GLenum coordType,
                            const void *coords)
 {
-    auto *pathObject = mState.mPaths->getPath(path);
+    auto *pathObject = mState.mPathManager->getPath(path);
 
     ANGLE_CONTEXT_TRY(pathObject->setCommands(numCommands, commands, numCoords, coordType, coords));
 }
 
 void Context::pathParameterf(GLuint path, GLenum pname, GLfloat value)
 {
-    Path *pathObj = mState.mPaths->getPath(path);
+    Path *pathObj = mState.mPathManager->getPath(path);
 
     switch (pname)
     {
@@ -865,7 +861,7 @@
 
 void Context::getPathParameterfv(GLuint path, GLenum pname, GLfloat *value)
 {
-    const Path *pathObj = mState.mPaths->getPath(path);
+    const Path *pathObj = mState.mPathManager->getPath(path);
 
     switch (pname)
     {
@@ -900,17 +896,17 @@
 
 void Context::pathStencilFunc(GLenum func, GLint ref, GLuint mask)
 {
-    mGLState.setPathStencilFunc(func, ref, mask);
+    mState.setPathStencilFunc(func, ref, mask);
 }
 
 void Context::deleteFramebuffer(GLuint framebuffer)
 {
-    if (mState.mFramebuffers->getFramebuffer(framebuffer))
+    if (mState.mFramebufferManager->getFramebuffer(framebuffer))
     {
         detachFramebuffer(framebuffer);
     }
 
-    mState.mFramebuffers->deleteObject(this, framebuffer);
+    mState.mFramebufferManager->deleteObject(this, framebuffer);
 }
 
 void Context::deleteFencesNV(GLsizei n, const GLuint *fences)
@@ -930,17 +926,17 @@
 
 Buffer *Context::getBuffer(GLuint handle) const
 {
-    return mState.mBuffers->getBuffer(handle);
+    return mState.mBufferManager->getBuffer(handle);
 }
 
 Renderbuffer *Context::getRenderbuffer(GLuint handle) const
 {
-    return mState.mRenderbuffers->getRenderbuffer(handle);
+    return mState.mRenderbufferManager->getRenderbuffer(handle);
 }
 
 Sync *Context::getSync(GLsync handle) const
 {
-    return mState.mSyncs->getSync(static_cast<GLuint>(reinterpret_cast<uintptr_t>(handle)));
+    return mState.mSyncManager->getSync(static_cast<GLuint>(reinterpret_cast<uintptr_t>(handle)));
 }
 
 VertexArray *Context::getVertexArray(GLuint handle) const
@@ -950,7 +946,7 @@
 
 Sampler *Context::getSampler(GLuint handle) const
 {
-    return mState.mSamplers->getSampler(handle);
+    return mState.mSamplerManager->getSampler(handle);
 }
 
 TransformFeedback *Context::getTransformFeedback(GLuint handle) const
@@ -960,7 +956,7 @@
 
 ProgramPipeline *Context::getProgramPipeline(GLuint handle) const
 {
-    return mState.mPipelines->getProgramPipeline(handle);
+    return mState.mProgramPipelineManager->getProgramPipeline(handle);
 }
 
 gl::LabeledObject *Context::getLabeledObject(GLenum identifier, GLuint name) const
@@ -1008,7 +1004,7 @@
 
     // TODO(jmadill): Determine if the object is dirty based on 'name'. Conservatively assume the
     // specified object is active until we do this.
-    mGLState.setObjectDirty(identifier);
+    mState.setObjectDirty(identifier);
 }
 
 void Context::objectPtrLabel(const void *ptr, GLsizei length, const GLchar *label)
@@ -1047,7 +1043,7 @@
 
 bool Context::isSampler(GLuint samplerName) const
 {
-    return mState.mSamplers->isSampler(samplerName);
+    return mState.mSamplerManager->isSampler(samplerName);
 }
 
 void Context::bindTexture(TextureType target, GLuint handle)
@@ -1060,27 +1056,28 @@
     }
     else
     {
-        texture = mState.mTextures->checkTextureAllocation(mImplementation.get(), handle, target);
+        texture =
+            mState.mTextureManager->checkTextureAllocation(mImplementation.get(), handle, target);
     }
 
     ASSERT(texture);
-    mGLState.setSamplerTexture(this, target, texture);
+    mState.setSamplerTexture(this, target, texture);
     mStateCache.onActiveTextureChange(this);
 }
 
 void Context::bindReadFramebuffer(GLuint framebufferHandle)
 {
-    Framebuffer *framebuffer = mState.mFramebuffers->checkFramebufferAllocation(
-        mImplementation.get(), mCaps, framebufferHandle);
-    mGLState.setReadFramebufferBinding(framebuffer);
+    Framebuffer *framebuffer = mState.mFramebufferManager->checkFramebufferAllocation(
+        mImplementation.get(), mState.mCaps, framebufferHandle);
+    mState.setReadFramebufferBinding(framebuffer);
     mReadFramebufferObserverBinding.bind(framebuffer);
 }
 
 void Context::bindDrawFramebuffer(GLuint framebufferHandle)
 {
-    Framebuffer *framebuffer = mState.mFramebuffers->checkFramebufferAllocation(
-        mImplementation.get(), mCaps, framebufferHandle);
-    mGLState.setDrawFramebufferBinding(framebuffer);
+    Framebuffer *framebuffer = mState.mFramebufferManager->checkFramebufferAllocation(
+        mImplementation.get(), mState.mCaps, framebufferHandle);
+    mState.setDrawFramebufferBinding(framebuffer);
     mDrawFramebufferObserverBinding.bind(framebuffer);
     mStateCache.onDrawFramebufferChange(this);
 }
@@ -1088,7 +1085,7 @@
 void Context::bindVertexArray(GLuint vertexArrayHandle)
 {
     VertexArray *vertexArray = checkVertexArrayAllocation(vertexArrayHandle);
-    mGLState.setVertexArrayBinding(this, vertexArray);
+    mState.setVertexArrayBinding(this, vertexArray);
     mVertexArrayObserverBinding.bind(vertexArray);
     mStateCache.onVertexArrayBindingChange(this);
 }
@@ -1098,17 +1095,18 @@
                                GLintptr offset,
                                GLsizei stride)
 {
-    Buffer *buffer = mState.mBuffers->checkBufferAllocation(mImplementation.get(), bufferHandle);
-    mGLState.bindVertexBuffer(this, bindingIndex, buffer, offset, stride);
+    Buffer *buffer =
+        mState.mBufferManager->checkBufferAllocation(mImplementation.get(), bufferHandle);
+    mState.bindVertexBuffer(this, bindingIndex, buffer, offset, stride);
     mStateCache.onVertexArrayStateChange(this);
 }
 
 void Context::bindSampler(GLuint textureUnit, GLuint samplerHandle)
 {
-    ASSERT(textureUnit < mCaps.maxCombinedTextureImageUnits);
+    ASSERT(textureUnit < mState.mCaps.maxCombinedTextureImageUnits);
     Sampler *sampler =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), samplerHandle);
-    mGLState.setSamplerBinding(this, textureUnit, sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), samplerHandle);
+    mState.setSamplerBinding(this, textureUnit, sampler);
     mSamplerObserverBindings[textureUnit].bind(sampler);
 }
 
@@ -1120,13 +1118,13 @@
                                GLenum access,
                                GLenum format)
 {
-    Texture *tex = mState.mTextures->getTexture(texture);
-    mGLState.setImageUnit(this, unit, tex, level, layered, layer, access, format);
+    Texture *tex = mState.mTextureManager->getTexture(texture);
+    mState.setImageUnit(this, unit, tex, level, layered, layer, access, format);
 }
 
 void Context::useProgram(GLuint program)
 {
-    ANGLE_CONTEXT_TRY(mGLState.setProgram(this, getProgramResolveLink(program)));
+    ANGLE_CONTEXT_TRY(mState.setProgram(this, getProgramResolveLink(program)));
     mStateCache.onProgramExecutableChange(this);
 }
 
@@ -1140,14 +1138,14 @@
     ASSERT(target == GL_TRANSFORM_FEEDBACK);
     TransformFeedback *transformFeedback =
         checkTransformFeedbackAllocation(transformFeedbackHandle);
-    mGLState.setTransformFeedbackBinding(this, transformFeedback);
+    mState.setTransformFeedbackBinding(this, transformFeedback);
 }
 
 void Context::bindProgramPipeline(GLuint pipelineHandle)
 {
-    ProgramPipeline *pipeline =
-        mState.mPipelines->checkProgramPipelineAllocation(mImplementation.get(), pipelineHandle);
-    mGLState.setProgramPipelineBinding(this, pipeline);
+    ProgramPipeline *pipeline = mState.mProgramPipelineManager->checkProgramPipelineAllocation(
+        mImplementation.get(), pipelineHandle);
+    mState.setProgramPipelineBinding(this, pipeline);
 }
 
 void Context::beginQuery(QueryType target, GLuint query)
@@ -1159,20 +1157,20 @@
     ANGLE_CONTEXT_TRY(queryObject->begin(this));
 
     // set query as active for specified target only if begin succeeded
-    mGLState.setActiveQuery(this, target, queryObject);
+    mState.setActiveQuery(this, target, queryObject);
     mStateCache.onQueryChange(this);
 }
 
 void Context::endQuery(QueryType target)
 {
-    Query *queryObject = mGLState.getActiveQuery(target);
+    Query *queryObject = mState.getActiveQuery(target);
     ASSERT(queryObject);
 
     // Intentionally don't call try here. We don't want an early return.
     (void)(queryObject->end(this));
 
     // Always unbind the query, even if there was an error. This may delete the query object.
-    mGLState.setActiveQuery(this, target, nullptr);
+    mState.setActiveQuery(this, target, nullptr);
     mStateCache.onQueryChange(this);
 }
 
@@ -1191,7 +1189,7 @@
     switch (pname)
     {
         case GL_CURRENT_QUERY_EXT:
-            params[0] = mGLState.getActiveQueryId(target);
+            params[0] = mState.getActiveQueryId(target);
             break;
         case GL_QUERY_COUNTER_BITS_EXT:
             switch (target)
@@ -1281,7 +1279,7 @@
 
 Framebuffer *Context::getFramebuffer(GLuint handle) const
 {
-    return mState.mFramebuffers->getFramebuffer(handle);
+    return mState.mFramebufferManager->getFramebuffer(handle);
 }
 
 FenceNV *Context::getFenceNV(GLuint handle)
@@ -1315,12 +1313,12 @@
 Texture *Context::getTargetTexture(TextureType type) const
 {
     ASSERT(ValidTextureTarget(this, type) || ValidTextureExternalTarget(this, type));
-    return mGLState.getTargetTexture(type);
+    return mState.getTargetTexture(type);
 }
 
 Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type) const
 {
-    return mGLState.getSamplerTexture(sampler, type);
+    return mState.getSamplerTexture(sampler, type);
 }
 
 Compiler *Context::getCompiler() const
@@ -1343,7 +1341,7 @@
             *params = mRobustAccess ? GL_TRUE : GL_FALSE;
             break;
         default:
-            mGLState.getBooleanv(pname, params);
+            mState.getBooleanv(pname, params);
             break;
     }
 }
@@ -1355,27 +1353,27 @@
     switch (pname)
     {
         case GL_ALIASED_LINE_WIDTH_RANGE:
-            params[0] = mCaps.minAliasedLineWidth;
-            params[1] = mCaps.maxAliasedLineWidth;
+            params[0] = mState.mCaps.minAliasedLineWidth;
+            params[1] = mState.mCaps.maxAliasedLineWidth;
             break;
         case GL_ALIASED_POINT_SIZE_RANGE:
-            params[0] = mCaps.minAliasedPointSize;
-            params[1] = mCaps.maxAliasedPointSize;
+            params[0] = mState.mCaps.minAliasedPointSize;
+            params[1] = mState.mCaps.maxAliasedPointSize;
             break;
         case GL_SMOOTH_POINT_SIZE_RANGE:
-            params[0] = mCaps.minSmoothPointSize;
-            params[1] = mCaps.maxSmoothPointSize;
+            params[0] = mState.mCaps.minSmoothPointSize;
+            params[1] = mState.mCaps.maxSmoothPointSize;
             break;
         case GL_SMOOTH_LINE_WIDTH_RANGE:
-            params[0] = mCaps.minSmoothLineWidth;
-            params[1] = mCaps.maxSmoothLineWidth;
+            params[0] = mState.mCaps.minSmoothLineWidth;
+            params[1] = mState.mCaps.maxSmoothLineWidth;
             break;
         case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
-            ASSERT(mExtensions.textureFilterAnisotropic);
-            *params = mExtensions.maxTextureAnisotropy;
+            ASSERT(mState.mExtensions.textureFilterAnisotropic);
+            *params = mState.mExtensions.maxTextureAnisotropy;
             break;
         case GL_MAX_TEXTURE_LOD_BIAS:
-            *params = mCaps.maxLODBias;
+            *params = mState.mCaps.maxLODBias;
             break;
 
         case GL_PATH_MODELVIEW_MATRIX_CHROMIUM:
@@ -1385,19 +1383,19 @@
             // GLES1 constants for modelview/projection matrix.
             if (getClientVersion() < Version(2, 0))
             {
-                mGLState.getFloatv(pname, params);
+                mState.getFloatv(pname, params);
             }
             else
             {
-                ASSERT(mExtensions.pathRendering);
-                const GLfloat *m = mGLState.getPathRenderingMatrix(pname);
+                ASSERT(mState.mExtensions.pathRendering);
+                const GLfloat *m = mState.getPathRenderingMatrix(pname);
                 memcpy(params, m, 16 * sizeof(GLfloat));
             }
         }
         break;
 
         default:
-            mGLState.getFloatv(pname, params);
+            mState.getFloatv(pname, params);
             break;
     }
 }
@@ -1410,88 +1408,88 @@
     switch (pname)
     {
         case GL_MAX_VERTEX_ATTRIBS:
-            *params = mCaps.maxVertexAttributes;
+            *params = mState.mCaps.maxVertexAttributes;
             break;
         case GL_MAX_VERTEX_UNIFORM_VECTORS:
-            *params = mCaps.maxVertexUniformVectors;
+            *params = mState.mCaps.maxVertexUniformVectors;
             break;
         case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
-            *params = mCaps.maxShaderUniformComponents[ShaderType::Vertex];
+            *params = mState.mCaps.maxShaderUniformComponents[ShaderType::Vertex];
             break;
         case GL_MAX_VARYING_VECTORS:
-            *params = mCaps.maxVaryingVectors;
+            *params = mState.mCaps.maxVaryingVectors;
             break;
         case GL_MAX_VARYING_COMPONENTS:
-            *params = mCaps.maxVertexOutputComponents;
+            *params = mState.mCaps.maxVertexOutputComponents;
             break;
         case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
-            *params = mCaps.maxCombinedTextureImageUnits;
+            *params = mState.mCaps.maxCombinedTextureImageUnits;
             break;
         case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
-            *params = mCaps.maxShaderTextureImageUnits[ShaderType::Vertex];
+            *params = mState.mCaps.maxShaderTextureImageUnits[ShaderType::Vertex];
             break;
         case GL_MAX_TEXTURE_IMAGE_UNITS:
-            *params = mCaps.maxShaderTextureImageUnits[ShaderType::Fragment];
+            *params = mState.mCaps.maxShaderTextureImageUnits[ShaderType::Fragment];
             break;
         case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
-            *params = mCaps.maxFragmentUniformVectors;
+            *params = mState.mCaps.maxFragmentUniformVectors;
             break;
         case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
-            *params = mCaps.maxShaderUniformComponents[ShaderType::Fragment];
+            *params = mState.mCaps.maxShaderUniformComponents[ShaderType::Fragment];
             break;
         case GL_MAX_RENDERBUFFER_SIZE:
-            *params = mCaps.maxRenderbufferSize;
+            *params = mState.mCaps.maxRenderbufferSize;
             break;
         case GL_MAX_COLOR_ATTACHMENTS_EXT:
-            *params = mCaps.maxColorAttachments;
+            *params = mState.mCaps.maxColorAttachments;
             break;
         case GL_MAX_DRAW_BUFFERS_EXT:
-            *params = mCaps.maxDrawBuffers;
+            *params = mState.mCaps.maxDrawBuffers;
             break;
         case GL_SUBPIXEL_BITS:
             *params = 4;
             break;
         case GL_MAX_TEXTURE_SIZE:
-            *params = mCaps.max2DTextureSize;
+            *params = mState.mCaps.max2DTextureSize;
             break;
         case GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE:
-            *params = mCaps.maxRectangleTextureSize;
+            *params = mState.mCaps.maxRectangleTextureSize;
             break;
         case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
-            *params = mCaps.maxCubeMapTextureSize;
+            *params = mState.mCaps.maxCubeMapTextureSize;
             break;
         case GL_MAX_3D_TEXTURE_SIZE:
-            *params = mCaps.max3DTextureSize;
+            *params = mState.mCaps.max3DTextureSize;
             break;
         case GL_MAX_ARRAY_TEXTURE_LAYERS:
-            *params = mCaps.maxArrayTextureLayers;
+            *params = mState.mCaps.maxArrayTextureLayers;
             break;
         case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
-            *params = mCaps.uniformBufferOffsetAlignment;
+            *params = mState.mCaps.uniformBufferOffsetAlignment;
             break;
         case GL_MAX_UNIFORM_BUFFER_BINDINGS:
-            *params = mCaps.maxUniformBufferBindings;
+            *params = mState.mCaps.maxUniformBufferBindings;
             break;
         case GL_MAX_VERTEX_UNIFORM_BLOCKS:
-            *params = mCaps.maxShaderUniformBlocks[ShaderType::Vertex];
+            *params = mState.mCaps.maxShaderUniformBlocks[ShaderType::Vertex];
             break;
         case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
-            *params = mCaps.maxShaderUniformBlocks[ShaderType::Fragment];
+            *params = mState.mCaps.maxShaderUniformBlocks[ShaderType::Fragment];
             break;
         case GL_MAX_COMBINED_UNIFORM_BLOCKS:
-            *params = mCaps.maxCombinedTextureImageUnits;
+            *params = mState.mCaps.maxCombinedTextureImageUnits;
             break;
         case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
-            *params = mCaps.maxVertexOutputComponents;
+            *params = mState.mCaps.maxVertexOutputComponents;
             break;
         case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
-            *params = mCaps.maxFragmentInputComponents;
+            *params = mState.mCaps.maxFragmentInputComponents;
             break;
         case GL_MIN_PROGRAM_TEXEL_OFFSET:
-            *params = mCaps.minProgramTexelOffset;
+            *params = mState.mCaps.minProgramTexelOffset;
             break;
         case GL_MAX_PROGRAM_TEXEL_OFFSET:
-            *params = mCaps.maxProgramTexelOffset;
+            *params = mState.mCaps.maxProgramTexelOffset;
             break;
         case GL_MAJOR_VERSION:
             *params = getClientVersion().major;
@@ -1500,50 +1498,52 @@
             *params = getClientVersion().minor;
             break;
         case GL_MAX_ELEMENTS_INDICES:
-            *params = mCaps.maxElementsIndices;
+            *params = mState.mCaps.maxElementsIndices;
             break;
         case GL_MAX_ELEMENTS_VERTICES:
-            *params = mCaps.maxElementsVertices;
+            *params = mState.mCaps.maxElementsVertices;
             break;
         case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
-            *params = mCaps.maxTransformFeedbackInterleavedComponents;
+            *params = mState.mCaps.maxTransformFeedbackInterleavedComponents;
             break;
         case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
-            *params = mCaps.maxTransformFeedbackSeparateAttributes;
+            *params = mState.mCaps.maxTransformFeedbackSeparateAttributes;
             break;
         case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
-            *params = mCaps.maxTransformFeedbackSeparateComponents;
+            *params = mState.mCaps.maxTransformFeedbackSeparateComponents;
             break;
         case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
-            *params = static_cast<GLint>(mCaps.compressedTextureFormats.size());
+            *params = static_cast<GLint>(mState.mCaps.compressedTextureFormats.size());
             break;
         case GL_MAX_SAMPLES_ANGLE:
-            *params = mCaps.maxSamples;
+            *params = mState.mCaps.maxSamples;
             break;
         case GL_MAX_VIEWPORT_DIMS:
         {
-            params[0] = mCaps.maxViewportWidth;
-            params[1] = mCaps.maxViewportHeight;
+            params[0] = mState.mCaps.maxViewportWidth;
+            params[1] = mState.mCaps.maxViewportHeight;
         }
         break;
         case GL_COMPRESSED_TEXTURE_FORMATS:
-            std::copy(mCaps.compressedTextureFormats.begin(), mCaps.compressedTextureFormats.end(),
-                      params);
+            std::copy(mState.mCaps.compressedTextureFormats.begin(),
+                      mState.mCaps.compressedTextureFormats.end(), params);
             break;
         case GL_RESET_NOTIFICATION_STRATEGY_EXT:
             *params = mResetStrategy;
             break;
         case GL_NUM_SHADER_BINARY_FORMATS:
-            *params = static_cast<GLint>(mCaps.shaderBinaryFormats.size());
+            *params = static_cast<GLint>(mState.mCaps.shaderBinaryFormats.size());
             break;
         case GL_SHADER_BINARY_FORMATS:
-            std::copy(mCaps.shaderBinaryFormats.begin(), mCaps.shaderBinaryFormats.end(), params);
+            std::copy(mState.mCaps.shaderBinaryFormats.begin(),
+                      mState.mCaps.shaderBinaryFormats.end(), params);
             break;
         case GL_NUM_PROGRAM_BINARY_FORMATS:
-            *params = static_cast<GLint>(mCaps.programBinaryFormats.size());
+            *params = static_cast<GLint>(mState.mCaps.programBinaryFormats.size());
             break;
         case GL_PROGRAM_BINARY_FORMATS:
-            std::copy(mCaps.programBinaryFormats.begin(), mCaps.programBinaryFormats.end(), params);
+            std::copy(mState.mCaps.programBinaryFormats.begin(),
+                      mState.mCaps.programBinaryFormats.end(), params);
             break;
         case GL_NUM_EXTENSIONS:
             *params = static_cast<GLint>(mExtensionStrings.size());
@@ -1556,21 +1556,21 @@
 
         // GL_KHR_debug
         case GL_MAX_DEBUG_MESSAGE_LENGTH:
-            *params = mExtensions.maxDebugMessageLength;
+            *params = mState.mExtensions.maxDebugMessageLength;
             break;
         case GL_MAX_DEBUG_LOGGED_MESSAGES:
-            *params = mExtensions.maxDebugLoggedMessages;
+            *params = mState.mExtensions.maxDebugLoggedMessages;
             break;
         case GL_MAX_DEBUG_GROUP_STACK_DEPTH:
-            *params = mExtensions.maxDebugGroupStackDepth;
+            *params = mState.mExtensions.maxDebugGroupStackDepth;
             break;
         case GL_MAX_LABEL_LENGTH:
-            *params = mExtensions.maxLabelLength;
+            *params = mState.mExtensions.maxLabelLength;
             break;
 
         // GL_ANGLE_multiview
         case GL_MAX_VIEWS_ANGLE:
-            *params = mExtensions.maxViews;
+            *params = mState.mExtensions.maxViews;
             break;
 
         // GL_EXT_disjoint_timer_query
@@ -1578,195 +1578,195 @@
             *params = mImplementation->getGPUDisjoint();
             break;
         case GL_MAX_FRAMEBUFFER_WIDTH:
-            *params = mCaps.maxFramebufferWidth;
+            *params = mState.mCaps.maxFramebufferWidth;
             break;
         case GL_MAX_FRAMEBUFFER_HEIGHT:
-            *params = mCaps.maxFramebufferHeight;
+            *params = mState.mCaps.maxFramebufferHeight;
             break;
         case GL_MAX_FRAMEBUFFER_SAMPLES:
-            *params = mCaps.maxFramebufferSamples;
+            *params = mState.mCaps.maxFramebufferSamples;
             break;
         case GL_MAX_SAMPLE_MASK_WORDS:
-            *params = mCaps.maxSampleMaskWords;
+            *params = mState.mCaps.maxSampleMaskWords;
             break;
         case GL_MAX_COLOR_TEXTURE_SAMPLES:
-            *params = mCaps.maxColorTextureSamples;
+            *params = mState.mCaps.maxColorTextureSamples;
             break;
         case GL_MAX_DEPTH_TEXTURE_SAMPLES:
-            *params = mCaps.maxDepthTextureSamples;
+            *params = mState.mCaps.maxDepthTextureSamples;
             break;
         case GL_MAX_INTEGER_SAMPLES:
-            *params = mCaps.maxIntegerSamples;
+            *params = mState.mCaps.maxIntegerSamples;
             break;
         case GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET:
-            *params = mCaps.maxVertexAttribRelativeOffset;
+            *params = mState.mCaps.maxVertexAttribRelativeOffset;
             break;
         case GL_MAX_VERTEX_ATTRIB_BINDINGS:
-            *params = mCaps.maxVertexAttribBindings;
+            *params = mState.mCaps.maxVertexAttribBindings;
             break;
         case GL_MAX_VERTEX_ATTRIB_STRIDE:
-            *params = mCaps.maxVertexAttribStride;
+            *params = mState.mCaps.maxVertexAttribStride;
             break;
         case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS:
-            *params = mCaps.maxShaderAtomicCounterBuffers[ShaderType::Vertex];
+            *params = mState.mCaps.maxShaderAtomicCounterBuffers[ShaderType::Vertex];
             break;
         case GL_MAX_VERTEX_ATOMIC_COUNTERS:
-            *params = mCaps.maxShaderAtomicCounters[ShaderType::Vertex];
+            *params = mState.mCaps.maxShaderAtomicCounters[ShaderType::Vertex];
             break;
         case GL_MAX_VERTEX_IMAGE_UNIFORMS:
-            *params = mCaps.maxShaderImageUniforms[ShaderType::Vertex];
+            *params = mState.mCaps.maxShaderImageUniforms[ShaderType::Vertex];
             break;
         case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS:
-            *params = mCaps.maxShaderStorageBlocks[ShaderType::Vertex];
+            *params = mState.mCaps.maxShaderStorageBlocks[ShaderType::Vertex];
             break;
         case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS:
-            *params = mCaps.maxShaderAtomicCounterBuffers[ShaderType::Fragment];
+            *params = mState.mCaps.maxShaderAtomicCounterBuffers[ShaderType::Fragment];
             break;
         case GL_MAX_FRAGMENT_ATOMIC_COUNTERS:
-            *params = mCaps.maxShaderAtomicCounters[ShaderType::Fragment];
+            *params = mState.mCaps.maxShaderAtomicCounters[ShaderType::Fragment];
             break;
         case GL_MAX_FRAGMENT_IMAGE_UNIFORMS:
-            *params = mCaps.maxShaderImageUniforms[ShaderType::Fragment];
+            *params = mState.mCaps.maxShaderImageUniforms[ShaderType::Fragment];
             break;
         case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS:
-            *params = mCaps.maxShaderStorageBlocks[ShaderType::Fragment];
+            *params = mState.mCaps.maxShaderStorageBlocks[ShaderType::Fragment];
             break;
         case GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET:
-            *params = mCaps.minProgramTextureGatherOffset;
+            *params = mState.mCaps.minProgramTextureGatherOffset;
             break;
         case GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET:
-            *params = mCaps.maxProgramTextureGatherOffset;
+            *params = mState.mCaps.maxProgramTextureGatherOffset;
             break;
         case GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS:
-            *params = mCaps.maxComputeWorkGroupInvocations;
+            *params = mState.mCaps.maxComputeWorkGroupInvocations;
             break;
         case GL_MAX_COMPUTE_UNIFORM_BLOCKS:
-            *params = mCaps.maxShaderUniformBlocks[ShaderType::Compute];
+            *params = mState.mCaps.maxShaderUniformBlocks[ShaderType::Compute];
             break;
         case GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS:
-            *params = mCaps.maxShaderTextureImageUnits[ShaderType::Compute];
+            *params = mState.mCaps.maxShaderTextureImageUnits[ShaderType::Compute];
             break;
         case GL_MAX_COMPUTE_SHARED_MEMORY_SIZE:
-            *params = mCaps.maxComputeSharedMemorySize;
+            *params = mState.mCaps.maxComputeSharedMemorySize;
             break;
         case GL_MAX_COMPUTE_UNIFORM_COMPONENTS:
-            *params = mCaps.maxShaderUniformComponents[ShaderType::Compute];
+            *params = mState.mCaps.maxShaderUniformComponents[ShaderType::Compute];
             break;
         case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS:
-            *params = mCaps.maxShaderAtomicCounterBuffers[ShaderType::Compute];
+            *params = mState.mCaps.maxShaderAtomicCounterBuffers[ShaderType::Compute];
             break;
         case GL_MAX_COMPUTE_ATOMIC_COUNTERS:
-            *params = mCaps.maxShaderAtomicCounters[ShaderType::Compute];
+            *params = mState.mCaps.maxShaderAtomicCounters[ShaderType::Compute];
             break;
         case GL_MAX_COMPUTE_IMAGE_UNIFORMS:
-            *params = mCaps.maxShaderImageUniforms[ShaderType::Compute];
+            *params = mState.mCaps.maxShaderImageUniforms[ShaderType::Compute];
             break;
         case GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS:
-            *params =
-                static_cast<GLint>(mCaps.maxCombinedShaderUniformComponents[ShaderType::Compute]);
+            *params = static_cast<GLint>(
+                mState.mCaps.maxCombinedShaderUniformComponents[ShaderType::Compute]);
             break;
         case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS:
-            *params = mCaps.maxShaderStorageBlocks[ShaderType::Compute];
+            *params = mState.mCaps.maxShaderStorageBlocks[ShaderType::Compute];
             break;
         case GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
-            *params = mCaps.maxCombinedShaderOutputResources;
+            *params = mState.mCaps.maxCombinedShaderOutputResources;
             break;
         case GL_MAX_UNIFORM_LOCATIONS:
-            *params = mCaps.maxUniformLocations;
+            *params = mState.mCaps.maxUniformLocations;
             break;
         case GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS:
-            *params = mCaps.maxAtomicCounterBufferBindings;
+            *params = mState.mCaps.maxAtomicCounterBufferBindings;
             break;
         case GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE:
-            *params = mCaps.maxAtomicCounterBufferSize;
+            *params = mState.mCaps.maxAtomicCounterBufferSize;
             break;
         case GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS:
-            *params = mCaps.maxCombinedAtomicCounterBuffers;
+            *params = mState.mCaps.maxCombinedAtomicCounterBuffers;
             break;
         case GL_MAX_COMBINED_ATOMIC_COUNTERS:
-            *params = mCaps.maxCombinedAtomicCounters;
+            *params = mState.mCaps.maxCombinedAtomicCounters;
             break;
         case GL_MAX_IMAGE_UNITS:
-            *params = mCaps.maxImageUnits;
+            *params = mState.mCaps.maxImageUnits;
             break;
         case GL_MAX_COMBINED_IMAGE_UNIFORMS:
-            *params = mCaps.maxCombinedImageUniforms;
+            *params = mState.mCaps.maxCombinedImageUniforms;
             break;
         case GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS:
-            *params = mCaps.maxShaderStorageBufferBindings;
+            *params = mState.mCaps.maxShaderStorageBufferBindings;
             break;
         case GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS:
-            *params = mCaps.maxCombinedShaderStorageBlocks;
+            *params = mState.mCaps.maxCombinedShaderStorageBlocks;
             break;
         case GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT:
-            *params = mCaps.shaderStorageBufferOffsetAlignment;
+            *params = mState.mCaps.shaderStorageBufferOffsetAlignment;
             break;
 
         // GL_EXT_geometry_shader
         case GL_MAX_FRAMEBUFFER_LAYERS_EXT:
-            *params = mCaps.maxFramebufferLayers;
+            *params = mState.mCaps.maxFramebufferLayers;
             break;
         case GL_LAYER_PROVOKING_VERTEX_EXT:
-            *params = mCaps.layerProvokingVertex;
+            *params = mState.mCaps.layerProvokingVertex;
             break;
         case GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT:
-            *params = mCaps.maxShaderUniformComponents[ShaderType::Geometry];
+            *params = mState.mCaps.maxShaderUniformComponents[ShaderType::Geometry];
             break;
         case GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT:
-            *params = mCaps.maxShaderUniformBlocks[ShaderType::Geometry];
+            *params = mState.mCaps.maxShaderUniformBlocks[ShaderType::Geometry];
             break;
         case GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT:
-            *params =
-                static_cast<GLint>(mCaps.maxCombinedShaderUniformComponents[ShaderType::Geometry]);
+            *params = static_cast<GLint>(
+                mState.mCaps.maxCombinedShaderUniformComponents[ShaderType::Geometry]);
             break;
         case GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT:
-            *params = mCaps.maxGeometryInputComponents;
+            *params = mState.mCaps.maxGeometryInputComponents;
             break;
         case GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT:
-            *params = mCaps.maxGeometryOutputComponents;
+            *params = mState.mCaps.maxGeometryOutputComponents;
             break;
         case GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT:
-            *params = mCaps.maxGeometryOutputVertices;
+            *params = mState.mCaps.maxGeometryOutputVertices;
             break;
         case GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT:
-            *params = mCaps.maxGeometryTotalOutputComponents;
+            *params = mState.mCaps.maxGeometryTotalOutputComponents;
             break;
         case GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT:
-            *params = mCaps.maxGeometryShaderInvocations;
+            *params = mState.mCaps.maxGeometryShaderInvocations;
             break;
         case GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT:
-            *params = mCaps.maxShaderTextureImageUnits[ShaderType::Geometry];
+            *params = mState.mCaps.maxShaderTextureImageUnits[ShaderType::Geometry];
             break;
         case GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT:
-            *params = mCaps.maxShaderAtomicCounterBuffers[ShaderType::Geometry];
+            *params = mState.mCaps.maxShaderAtomicCounterBuffers[ShaderType::Geometry];
             break;
         case GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT:
-            *params = mCaps.maxShaderAtomicCounters[ShaderType::Geometry];
+            *params = mState.mCaps.maxShaderAtomicCounters[ShaderType::Geometry];
             break;
         case GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT:
-            *params = mCaps.maxShaderImageUniforms[ShaderType::Geometry];
+            *params = mState.mCaps.maxShaderImageUniforms[ShaderType::Geometry];
             break;
         case GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT:
-            *params = mCaps.maxShaderStorageBlocks[ShaderType::Geometry];
+            *params = mState.mCaps.maxShaderStorageBlocks[ShaderType::Geometry];
             break;
         // GLES1 emulation: Caps queries
         case GL_MAX_TEXTURE_UNITS:
-            *params = mCaps.maxMultitextureUnits;
+            *params = mState.mCaps.maxMultitextureUnits;
             break;
         case GL_MAX_MODELVIEW_STACK_DEPTH:
-            *params = mCaps.maxModelviewMatrixStackDepth;
+            *params = mState.mCaps.maxModelviewMatrixStackDepth;
             break;
         case GL_MAX_PROJECTION_STACK_DEPTH:
-            *params = mCaps.maxProjectionMatrixStackDepth;
+            *params = mState.mCaps.maxProjectionMatrixStackDepth;
             break;
         case GL_MAX_TEXTURE_STACK_DEPTH:
-            *params = mCaps.maxTextureMatrixStackDepth;
+            *params = mState.mCaps.maxTextureMatrixStackDepth;
             break;
         case GL_MAX_LIGHTS:
-            *params = mCaps.maxLights;
+            *params = mState.mCaps.maxLights;
             break;
         case GL_MAX_CLIP_PLANES:
-            *params = mCaps.maxClipPlanes;
+            *params = mState.mCaps.maxClipPlanes;
             break;
         // GLES1 emulation: Vertex attribute queries
         case GL_VERTEX_ARRAY_BUFFER_BINDING:
@@ -1802,16 +1802,16 @@
 
         // GL_KHR_parallel_shader_compile
         case GL_MAX_SHADER_COMPILER_THREADS_KHR:
-            *params = mGLState.getMaxShaderCompilerThreads();
+            *params = mState.getMaxShaderCompilerThreads();
             break;
 
         // GL_EXT_blend_func_extended
         case GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT:
-            *params = mExtensions.maxDualSourceDrawBuffers;
+            *params = mState.mExtensions.maxDualSourceDrawBuffers;
             break;
 
         default:
-            ANGLE_CONTEXT_TRY(mGLState.getIntegerv(this, pname, params));
+            ANGLE_CONTEXT_TRY(mState.getIntegerv(this, pname, params));
             break;
     }
 }
@@ -1823,19 +1823,19 @@
     switch (pname)
     {
         case GL_MAX_ELEMENT_INDEX:
-            *params = mCaps.maxElementIndex;
+            *params = mState.mCaps.maxElementIndex;
             break;
         case GL_MAX_UNIFORM_BLOCK_SIZE:
-            *params = mCaps.maxUniformBlockSize;
+            *params = mState.mCaps.maxUniformBlockSize;
             break;
         case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
-            *params = mCaps.maxCombinedShaderUniformComponents[ShaderType::Vertex];
+            *params = mState.mCaps.maxCombinedShaderUniformComponents[ShaderType::Vertex];
             break;
         case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
-            *params = mCaps.maxCombinedShaderUniformComponents[ShaderType::Fragment];
+            *params = mState.mCaps.maxCombinedShaderUniformComponents[ShaderType::Fragment];
             break;
         case GL_MAX_SERVER_WAIT_TIMEOUT:
-            *params = mCaps.maxServerWaitTimeout;
+            *params = mState.mCaps.maxServerWaitTimeout;
             break;
 
         // GL_EXT_disjoint_timer_query
@@ -1844,7 +1844,7 @@
             break;
 
         case GL_MAX_SHADER_STORAGE_BLOCK_SIZE:
-            *params = mCaps.maxShaderStorageBlockSize;
+            *params = mState.mCaps.maxShaderStorageBlockSize;
             break;
         default:
             UNREACHABLE();
@@ -1854,7 +1854,7 @@
 
 void Context::getPointerv(GLenum pname, void **params) const
 {
-    mGLState.getPointerv(this, pname, params);
+    mState.getPointerv(this, pname, params);
 }
 
 void Context::getPointervRobustANGLERobust(GLenum pname,
@@ -1881,14 +1881,14 @@
         {
             case GL_MAX_COMPUTE_WORK_GROUP_COUNT:
                 ASSERT(index < 3u);
-                *data = mCaps.maxComputeWorkGroupCount[index];
+                *data = mState.mCaps.maxComputeWorkGroupCount[index];
                 break;
             case GL_MAX_COMPUTE_WORK_GROUP_SIZE:
                 ASSERT(index < 3u);
-                *data = mCaps.maxComputeWorkGroupSize[index];
+                *data = mState.mCaps.maxComputeWorkGroupSize[index];
                 break;
             default:
-                mGLState.getIntegeri_v(target, index, data);
+                mState.getIntegeri_v(target, index, data);
         }
     }
     else
@@ -1918,7 +1918,7 @@
 
     if (nativeType == GL_INT_64_ANGLEX)
     {
-        mGLState.getInteger64i_v(target, index, data);
+        mState.getInteger64i_v(target, index, data);
     }
     else
     {
@@ -1947,7 +1947,7 @@
 
     if (nativeType == GL_BOOL)
     {
-        mGLState.getBooleani_v(target, index, data);
+        mState.getBooleani_v(target, index, data);
     }
     else
     {
@@ -1966,7 +1966,7 @@
 
 void Context::getBufferParameteriv(BufferBinding target, GLenum pname, GLint *params)
 {
-    Buffer *buffer = mGLState.getTargetBuffer(target);
+    Buffer *buffer = mState.getTargetBuffer(target);
     QueryBufferParameteriv(buffer, pname, params);
 }
 
@@ -1984,7 +1984,7 @@
                                                   GLenum pname,
                                                   GLint *params)
 {
-    const Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    const Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     QueryFramebufferAttachmentParameteriv(this, framebuffer, attachment, pname, params);
 }
 
@@ -2000,7 +2000,7 @@
 
 void Context::getRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
 {
-    Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
+    Renderbuffer *renderbuffer = mState.getCurrentRenderbuffer();
     QueryRenderbufferiv(this, renderbuffer, pname, params);
 }
 
@@ -2288,12 +2288,12 @@
 
 void Context::coverageModulation(GLenum components)
 {
-    mGLState.setCoverageModulation(components);
+    mState.setCoverageModulation(components);
 }
 
 void Context::matrixLoadf(GLenum matrixMode, const GLfloat *matrix)
 {
-    mGLState.loadPathRenderingMatrix(matrixMode, matrix);
+    mState.loadPathRenderingMatrix(matrixMode, matrix);
 }
 
 void Context::matrixLoadIdentity(GLenum matrixMode)
@@ -2301,12 +2301,12 @@
     GLfloat I[16];
     angle::Matrix<GLfloat>::setToIdentity(I);
 
-    mGLState.loadPathRenderingMatrix(matrixMode, I);
+    mState.loadPathRenderingMatrix(matrixMode, I);
 }
 
 void Context::stencilFillPath(GLuint path, GLenum fillMode, GLuint mask)
 {
-    const auto *pathObj = mState.mPaths->getPath(path);
+    const auto *pathObj = mState.mPathManager->getPath(path);
     if (!pathObj)
         return;
 
@@ -2317,7 +2317,7 @@
 
 void Context::stencilStrokePath(GLuint path, GLint reference, GLuint mask)
 {
-    const auto *pathObj = mState.mPaths->getPath(path);
+    const auto *pathObj = mState.mPathManager->getPath(path);
     if (!pathObj)
         return;
 
@@ -2328,7 +2328,7 @@
 
 void Context::coverFillPath(GLuint path, GLenum coverMode)
 {
-    const auto *pathObj = mState.mPaths->getPath(path);
+    const auto *pathObj = mState.mPathManager->getPath(path);
     if (!pathObj)
         return;
 
@@ -2339,7 +2339,7 @@
 
 void Context::coverStrokePath(GLuint path, GLenum coverMode)
 {
-    const auto *pathObj = mState.mPaths->getPath(path);
+    const auto *pathObj = mState.mPathManager->getPath(path);
     if (!pathObj)
         return;
 
@@ -2350,7 +2350,7 @@
 
 void Context::stencilThenCoverFillPath(GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode)
 {
-    const auto *pathObj = mState.mPaths->getPath(path);
+    const auto *pathObj = mState.mPathManager->getPath(path);
     if (!pathObj)
         return;
 
@@ -2364,7 +2364,7 @@
                                          GLuint mask,
                                          GLenum coverMode)
 {
-    const auto *pathObj = mState.mPaths->getPath(path);
+    const auto *pathObj = mState.mPathManager->getPath(path);
     if (!pathObj)
         return;
 
@@ -2381,7 +2381,8 @@
                                      GLenum transformType,
                                      const GLfloat *transformValues)
 {
-    const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
+    const auto &pathObjects =
+        GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
 
     ANGLE_CONTEXT_TRY(syncStateForPathOperation());
 
@@ -2396,7 +2397,8 @@
                                        GLenum transformType,
                                        const GLfloat *transformValues)
 {
-    const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
+    const auto &pathObjects =
+        GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
 
     // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
     ANGLE_CONTEXT_TRY(syncStateForPathOperation());
@@ -2414,7 +2416,8 @@
                                        GLenum transformType,
                                        const GLfloat *transformValues)
 {
-    const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
+    const auto &pathObjects =
+        GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
 
     // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering?
     ANGLE_CONTEXT_TRY(syncStateForPathOperation());
@@ -2432,7 +2435,8 @@
                                          GLenum transformType,
                                          const GLfloat *transformValues)
 {
-    const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
+    const auto &pathObjects =
+        GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
 
     ANGLE_CONTEXT_TRY(syncStateForPathOperation());
 
@@ -2450,7 +2454,8 @@
                                                 GLenum transformType,
                                                 const GLfloat *transformValues)
 {
-    const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
+    const auto &pathObjects =
+        GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
 
     ANGLE_CONTEXT_TRY(syncStateForPathOperation());
 
@@ -2468,7 +2473,8 @@
                                                   GLenum transformType,
                                                   const GLfloat *transformValues)
 {
-    const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase);
+    const auto &pathObjects =
+        GatherPaths(*mState.mPathManager, numPaths, pathNameType, paths, pathBase);
 
     ANGLE_CONTEXT_TRY(syncStateForPathOperation());
 
@@ -2649,7 +2655,7 @@
 
 EGLenum Context::getRenderBuffer() const
 {
-    const Framebuffer *framebuffer = mState.mFramebuffers->getFramebuffer(0);
+    const Framebuffer *framebuffer = mState.mFramebufferManager->getFramebuffer(0);
     if (framebuffer == nullptr)
     {
         return EGL_NONE;
@@ -2666,8 +2672,9 @@
     VertexArray *vertexArray = getVertexArray(vertexArrayHandle);
     if (!vertexArray)
     {
-        vertexArray = new VertexArray(mImplementation.get(), vertexArrayHandle,
-                                      mCaps.maxVertexAttributes, mCaps.maxVertexAttribBindings);
+        vertexArray =
+            new VertexArray(mImplementation.get(), vertexArrayHandle,
+                            mState.mCaps.maxVertexAttributes, mState.mCaps.maxVertexAttribBindings);
 
         mVertexArrayMap.assign(vertexArrayHandle, vertexArray);
     }
@@ -2682,7 +2689,7 @@
     if (!transformFeedback)
     {
         transformFeedback =
-            new TransformFeedback(mImplementation.get(), transformFeedbackHandle, mCaps);
+            new TransformFeedback(mImplementation.get(), transformFeedbackHandle, mState.mCaps);
         transformFeedback->addRef();
         mTransformFeedbackMap.assign(transformFeedbackHandle, transformFeedback);
     }
@@ -2708,7 +2715,7 @@
     // allocation map management either here or in the resource manager at detach time.
     // Zero textures are held by the Context, and we don't attempt to request them from
     // the State.
-    mGLState.detachTexture(this, mZeroTextures, texture);
+    mState.detachTexture(this, mZeroTextures, texture);
 }
 
 void Context::detachBuffer(Buffer *buffer)
@@ -2721,7 +2728,7 @@
     // Attachments to unbound container objects, such as
     // deletion of a buffer attached to a vertex array object which is not bound to the context,
     // are not affected and continue to act as references on the deleted object
-    ANGLE_CONTEXT_TRY(mGLState.detachBuffer(this, buffer));
+    ANGLE_CONTEXT_TRY(mState.detachBuffer(this, buffer));
 }
 
 void Context::detachFramebuffer(GLuint framebuffer)
@@ -2735,12 +2742,12 @@
     // though BindFramebuffer had been executed with the target of FRAMEBUFFER and framebuffer of
     // zero.
 
-    if (mGLState.removeReadFramebufferBinding(framebuffer) && framebuffer != 0)
+    if (mState.removeReadFramebufferBinding(framebuffer) && framebuffer != 0)
     {
         bindReadFramebuffer(0);
     }
 
-    if (mGLState.removeDrawFramebufferBinding(framebuffer) && framebuffer != 0)
+    if (mState.removeDrawFramebufferBinding(framebuffer) && framebuffer != 0)
     {
         bindDrawFramebuffer(0);
     }
@@ -2748,7 +2755,7 @@
 
 void Context::detachRenderbuffer(GLuint renderbuffer)
 {
-    mGLState.detachRenderbuffer(this, renderbuffer);
+    mState.detachRenderbuffer(this, renderbuffer);
 }
 
 void Context::detachVertexArray(GLuint vertexArray)
@@ -2760,7 +2767,7 @@
     // [OpenGL ES 3.0.2] section 2.10 page 43:
     // If a vertex array object that is currently bound is deleted, the binding
     // for that object reverts to zero and the default vertex array becomes current.
-    if (mGLState.removeVertexArrayBinding(this, vertexArray))
+    if (mState.removeVertexArrayBinding(this, vertexArray))
     {
         bindVertexArray(0);
     }
@@ -2775,7 +2782,7 @@
     // The OpenGL specification doesn't mention what should happen when the currently bound
     // transform feedback object is deleted. Since it is a container object, we treat it like
     // VAOs and FBOs and set the current bound transform feedback back to 0.
-    if (mGLState.removeTransformFeedbackBinding(this, transformFeedback))
+    if (mState.removeTransformFeedbackBinding(this, transformFeedback))
     {
         bindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
     }
@@ -2783,45 +2790,45 @@
 
 void Context::detachSampler(GLuint sampler)
 {
-    mGLState.detachSampler(this, sampler);
+    mState.detachSampler(this, sampler);
 }
 
 void Context::detachProgramPipeline(GLuint pipeline)
 {
-    mGLState.detachProgramPipeline(this, pipeline);
+    mState.detachProgramPipeline(this, pipeline);
 }
 
 void Context::vertexAttribDivisor(GLuint index, GLuint divisor)
 {
-    mGLState.setVertexAttribDivisor(this, index, divisor);
+    mState.setVertexAttribDivisor(this, index, divisor);
     mStateCache.onVertexArrayStateChange(this);
 }
 
 void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
 {
     Sampler *const samplerObject =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
     SetSamplerParameteri(this, samplerObject, pname, param);
 }
 
 void Context::samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
 {
     Sampler *const samplerObject =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
     SetSamplerParameteriv(this, samplerObject, pname, param);
 }
 
 void Context::samplerParameterIiv(GLuint sampler, GLenum pname, const GLint *param)
 {
     Sampler *const samplerObject =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
     SetSamplerParameterIiv(this, samplerObject, pname, param);
 }
 
 void Context::samplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *param)
 {
     Sampler *const samplerObject =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
     SetSamplerParameterIuiv(this, samplerObject, pname, param);
 }
 
@@ -2852,14 +2859,14 @@
 void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
 {
     Sampler *const samplerObject =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
     SetSamplerParameterf(this, samplerObject, pname, param);
 }
 
 void Context::samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
 {
     Sampler *const samplerObject =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
     SetSamplerParameterfv(this, samplerObject, pname, param);
 }
 
@@ -2874,21 +2881,21 @@
 void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
 {
     const Sampler *const samplerObject =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
     QuerySamplerParameteriv(samplerObject, pname, params);
 }
 
 void Context::getSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
 {
     const Sampler *const samplerObject =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
     QuerySamplerParameterIiv(samplerObject, pname, params);
 }
 
 void Context::getSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
 {
     const Sampler *const samplerObject =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
     QuerySamplerParameterIuiv(samplerObject, pname, params);
 }
 
@@ -2922,7 +2929,7 @@
 void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
 {
     const Sampler *const samplerObject =
-        mState.mSamplers->checkSamplerAllocation(mImplementation.get(), sampler);
+        mState.mSamplerManager->checkSamplerAllocation(mImplementation.get(), sampler);
     QuerySamplerParameterfv(samplerObject, pname, params);
 }
 
@@ -2978,7 +2985,7 @@
     };
 
     mExtensionStrings.clear();
-    for (const auto &extensionString : mExtensions.getStrings())
+    for (const auto &extensionString : mState.mExtensions.getStrings())
     {
         mExtensionStrings.push_back(MakeStaticString(extensionString));
     }
@@ -2988,7 +2995,7 @@
     for (const auto &extensionInfo : GetExtensionInfoMap())
     {
         if (extensionInfo.second.Requestable &&
-            !(mExtensions.*(extensionInfo.second.ExtensionsMember)) &&
+            !(mState.mExtensions.*(extensionInfo.second.ExtensionsMember)) &&
             mSupportedExtensions.*(extensionInfo.second.ExtensionsMember))
         {
             mRequestableExtensionStrings.push_back(MakeStaticString(extensionInfo.first));
@@ -3063,13 +3070,13 @@
     ASSERT(extension.Requestable);
     ASSERT(isExtensionRequestable(name));
 
-    if (mExtensions.*(extension.ExtensionsMember))
+    if (mState.mExtensions.*(extension.ExtensionsMember))
     {
         // Extension already enabled
         return;
     }
 
-    mExtensions.*(extension.ExtensionsMember) = true;
+    mState.mExtensions.*(extension.ExtensionsMember) = true;
     updateCaps();
     initExtensionStrings();
 
@@ -3078,7 +3085,7 @@
 
     // Invalidate all textures and framebuffer. Some extensions make new formats renderable or
     // sampleable.
-    mState.mTextures->signalAllTexturesDirty(this);
+    mState.mTextureManager->signalAllTexturesDirty(this);
     for (auto &zeroTexture : mZeroTextures)
     {
         if (zeroTexture.get() != nullptr)
@@ -3087,7 +3094,7 @@
         }
     }
 
-    mState.mFramebuffers->invalidateFramebufferComplenessCache(this);
+    mState.mFramebufferManager->invalidateFramebufferComplenessCache(this);
 }
 
 size_t Context::getRequestableExtensionStringCount() const
@@ -3097,11 +3104,11 @@
 
 void Context::beginTransformFeedback(PrimitiveMode primitiveMode)
 {
-    TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
+    TransformFeedback *transformFeedback = mState.getCurrentTransformFeedback();
     ASSERT(transformFeedback != nullptr);
     ASSERT(!transformFeedback->isPaused());
 
-    ANGLE_CONTEXT_TRY(transformFeedback->begin(this, primitiveMode, mGLState.getProgram()));
+    ANGLE_CONTEXT_TRY(transformFeedback->begin(this, primitiveMode, mState.getProgram()));
     mStateCache.onActiveTransformFeedbackChange(this);
 }
 
@@ -3193,10 +3200,10 @@
     supportedExtensions.robustClientMemory = true;
 
     // Determine robust resource init availability from EGL.
-    supportedExtensions.robustResourceInitialization = mGLState.isRobustResourceInitEnabled();
+    supportedExtensions.robustResourceInitialization = mState.isRobustResourceInitEnabled();
 
-    // mExtensions.robustBufferAccessBehavior is true only if robust access is true and the backend
-    // supports it.
+    // mState.mExtensions.robustBufferAccessBehavior is true only if robust access is true and the
+    // backend supports it.
     supportedExtensions.robustBufferAccessBehavior =
         mRobustAccess && supportedExtensions.robustBufferAccessBehavior;
 
@@ -3219,69 +3226,70 @@
 
 void Context::initCaps()
 {
-    mCaps = mImplementation->getNativeCaps();
+    mState.mCaps = mImplementation->getNativeCaps();
 
     mSupportedExtensions = generateSupportedExtensions();
-    mExtensions          = mSupportedExtensions;
+    mState.mExtensions   = mSupportedExtensions;
 
-    mLimitations = mImplementation->getNativeLimitations();
+    mState.mLimitations = mImplementation->getNativeLimitations();
 
     // GLES1 emulation: Initialize caps (Table 6.20 / 6.22 in the ES 1.1 spec)
     if (getClientVersion() < Version(2, 0))
     {
-        mCaps.maxMultitextureUnits          = 4;
-        mCaps.maxClipPlanes                 = 6;
-        mCaps.maxLights                     = 8;
-        mCaps.maxModelviewMatrixStackDepth  = Caps::GlobalMatrixStackDepth;
-        mCaps.maxProjectionMatrixStackDepth = Caps::GlobalMatrixStackDepth;
-        mCaps.maxTextureMatrixStackDepth    = Caps::GlobalMatrixStackDepth;
-        mCaps.minSmoothPointSize            = 1.0f;
-        mCaps.maxSmoothPointSize            = 1.0f;
-        mCaps.minSmoothLineWidth            = 1.0f;
-        mCaps.maxSmoothLineWidth            = 1.0f;
+        mState.mCaps.maxMultitextureUnits          = 4;
+        mState.mCaps.maxClipPlanes                 = 6;
+        mState.mCaps.maxLights                     = 8;
+        mState.mCaps.maxModelviewMatrixStackDepth  = Caps::GlobalMatrixStackDepth;
+        mState.mCaps.maxProjectionMatrixStackDepth = Caps::GlobalMatrixStackDepth;
+        mState.mCaps.maxTextureMatrixStackDepth    = Caps::GlobalMatrixStackDepth;
+        mState.mCaps.minSmoothPointSize            = 1.0f;
+        mState.mCaps.maxSmoothPointSize            = 1.0f;
+        mState.mCaps.minSmoothLineWidth            = 1.0f;
+        mState.mCaps.maxSmoothLineWidth            = 1.0f;
     }
 
     // Apply/Verify implementation limits
-    LimitCap(&mCaps.maxVertexAttributes, MAX_VERTEX_ATTRIBS);
+    LimitCap(&mState.mCaps.maxVertexAttributes, MAX_VERTEX_ATTRIBS);
 
-    ASSERT(mCaps.minAliasedPointSize >= 1.0f);
+    ASSERT(mState.mCaps.minAliasedPointSize >= 1.0f);
 
     if (getClientVersion() < ES_3_1)
     {
-        mCaps.maxVertexAttribBindings = mCaps.maxVertexAttributes;
+        mState.mCaps.maxVertexAttribBindings = mState.mCaps.maxVertexAttributes;
     }
     else
     {
-        LimitCap(&mCaps.maxVertexAttribBindings, MAX_VERTEX_ATTRIB_BINDINGS);
+        LimitCap(&mState.mCaps.maxVertexAttribBindings, MAX_VERTEX_ATTRIB_BINDINGS);
     }
 
-    LimitCap(&mCaps.maxShaderUniformBlocks[ShaderType::Vertex],
+    LimitCap(&mState.mCaps.maxShaderUniformBlocks[ShaderType::Vertex],
              IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS);
-    LimitCap(&mCaps.maxUniformBufferBindings, IMPLEMENTATION_MAX_UNIFORM_BUFFER_BINDINGS);
+    LimitCap(&mState.mCaps.maxUniformBufferBindings, IMPLEMENTATION_MAX_UNIFORM_BUFFER_BINDINGS);
 
-    LimitCap(&mCaps.maxVertexOutputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
-    LimitCap(&mCaps.maxFragmentInputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
+    LimitCap(&mState.mCaps.maxVertexOutputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
+    LimitCap(&mState.mCaps.maxFragmentInputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
 
     // Limit textures as well, so we can use fast bitsets with texture bindings.
-    LimitCap(&mCaps.maxCombinedTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES);
-    LimitCap(&mCaps.maxShaderTextureImageUnits[ShaderType::Vertex],
+    LimitCap(&mState.mCaps.maxCombinedTextureImageUnits, IMPLEMENTATION_MAX_ACTIVE_TEXTURES);
+    LimitCap(&mState.mCaps.maxShaderTextureImageUnits[ShaderType::Vertex],
              IMPLEMENTATION_MAX_ACTIVE_TEXTURES / 2);
-    LimitCap(&mCaps.maxShaderTextureImageUnits[ShaderType::Fragment],
+    LimitCap(&mState.mCaps.maxShaderTextureImageUnits[ShaderType::Fragment],
              IMPLEMENTATION_MAX_ACTIVE_TEXTURES / 2);
 
-    LimitCap(&mCaps.maxImageUnits, IMPLEMENTATION_MAX_IMAGE_UNITS);
+    LimitCap(&mState.mCaps.maxImageUnits, IMPLEMENTATION_MAX_IMAGE_UNITS);
 
-    mCaps.maxSampleMaskWords = std::min<GLuint>(mCaps.maxSampleMaskWords, MAX_SAMPLE_MASK_WORDS);
+    mState.mCaps.maxSampleMaskWords =
+        std::min<GLuint>(mState.mCaps.maxSampleMaskWords, MAX_SAMPLE_MASK_WORDS);
 
     // WebGL compatibility
-    mExtensions.webglCompatibility = mWebGLContext;
+    mState.mExtensions.webglCompatibility = mWebGLContext;
     for (const auto &extensionInfo : GetExtensionInfoMap())
     {
         // If the user has requested that extensions start disabled and they are requestable,
         // disable them.
         if (!mExtensionsEnabled && extensionInfo.second.Requestable)
         {
-            mExtensions.*(extensionInfo.second.ExtensionsMember) = false;
+            mState.mExtensions.*(extensionInfo.second.ExtensionsMember) = false;
         }
     }
 
@@ -3291,8 +3299,8 @@
 
 void Context::updateCaps()
 {
-    mCaps.compressedTextureFormats.clear();
-    mTextureCaps.clear();
+    mState.mCaps.compressedTextureFormats.clear();
+    mState.mTextureCaps.clear();
 
     for (GLenum sizedInternalFormat : GetAllSizedInternalFormats())
     {
@@ -3302,15 +3310,16 @@
         // Update the format caps based on the client version and extensions.
         // Caps are AND'd with the renderer caps because some core formats are still unsupported in
         // ES3.
-        formatCaps.texturable =
-            formatCaps.texturable && formatInfo.textureSupport(getClientVersion(), mExtensions);
-        formatCaps.filterable =
-            formatCaps.filterable && formatInfo.filterSupport(getClientVersion(), mExtensions);
+        formatCaps.texturable = formatCaps.texturable &&
+                                formatInfo.textureSupport(getClientVersion(), mState.mExtensions);
+        formatCaps.filterable = formatCaps.filterable &&
+                                formatInfo.filterSupport(getClientVersion(), mState.mExtensions);
         formatCaps.textureAttachment =
             formatCaps.textureAttachment &&
-            formatInfo.textureAttachmentSupport(getClientVersion(), mExtensions);
-        formatCaps.renderbuffer = formatCaps.renderbuffer &&
-                                  formatInfo.renderbufferSupport(getClientVersion(), mExtensions);
+            formatInfo.textureAttachmentSupport(getClientVersion(), mState.mExtensions);
+        formatCaps.renderbuffer =
+            formatCaps.renderbuffer &&
+            formatInfo.renderbufferSupport(getClientVersion(), mState.mExtensions);
 
         // OpenGL ES does not support multisampling with non-rendererable formats
         // OpenGL ES 3.0 or prior does not support multisampling with integer formats
@@ -3333,7 +3342,7 @@
                 formatInfo.isRequiredRenderbufferFormat(getClientVersion()))
             {
                 ASSERT(getClientVersion() < ES_3_0 || formatMaxSamples >= 4);
-                mCaps.maxSamples = std::min(mCaps.maxSamples, formatMaxSamples);
+                mState.mCaps.maxSamples = std::min(mState.mCaps.maxSamples, formatMaxSamples);
             }
 
             // Handle GLES 3.1 MAX_*_SAMPLES values similarly to MAX_SAMPLES.
@@ -3347,7 +3356,8 @@
                 if (formatInfo.componentType == GL_INT ||
                     formatInfo.componentType == GL_UNSIGNED_INT)
                 {
-                    mCaps.maxIntegerSamples = std::min(mCaps.maxIntegerSamples, formatMaxSamples);
+                    mState.mCaps.maxIntegerSamples =
+                        std::min(mState.mCaps.maxIntegerSamples, formatMaxSamples);
                 }
 
                 // GLES 3.1 section 19.3.1.
@@ -3355,13 +3365,13 @@
                 {
                     if (formatInfo.depthBits > 0)
                     {
-                        mCaps.maxDepthTextureSamples =
-                            std::min(mCaps.maxDepthTextureSamples, formatMaxSamples);
+                        mState.mCaps.maxDepthTextureSamples =
+                            std::min(mState.mCaps.maxDepthTextureSamples, formatMaxSamples);
                     }
                     else if (formatInfo.redBits > 0)
                     {
-                        mCaps.maxColorTextureSamples =
-                            std::min(mCaps.maxColorTextureSamples, formatMaxSamples);
+                        mState.mCaps.maxColorTextureSamples =
+                            std::min(mState.mCaps.maxColorTextureSamples, formatMaxSamples);
                     }
                 }
             }
@@ -3369,10 +3379,10 @@
 
         if (formatCaps.texturable && formatInfo.compressed)
         {
-            mCaps.compressedTextureFormats.push_back(sizedInternalFormat);
+            mState.mCaps.compressedTextureFormats.push_back(sizedInternalFormat);
         }
 
-        mTextureCaps.insert(sizedInternalFormat, formatCaps);
+        mState.mTextureCaps.insert(sizedInternalFormat, formatCaps);
     }
 
     // If program binary is disabled, blank out the memory cache pointer.
@@ -3386,7 +3396,7 @@
     mValidBufferBindings.set(BufferBinding::ElementArray);
     mValidBufferBindings.set(BufferBinding::Array);
 
-    if (mExtensions.pixelBufferObject || getClientVersion() >= ES_3_0)
+    if (mState.mExtensions.pixelBufferObject || getClientVersion() >= ES_3_0)
     {
         mValidBufferBindings.set(BufferBinding::PixelPack);
         mValidBufferBindings.set(BufferBinding::PixelUnpack);
@@ -3408,10 +3418,10 @@
         mValidBufferBindings.set(BufferBinding::DispatchIndirect);
     }
 
-    mThreadPool = angle::WorkerThreadPool::Create(mExtensions.parallelShaderCompile);
+    mThreadPool = angle::WorkerThreadPool::Create(mState.mExtensions.parallelShaderCompile);
 
     // Reinitialize some dirty bits that depend on extensions.
-    bool robustInit = mGLState.isRobustResourceInitEnabled();
+    bool robustInit = mState.isRobustResourceInitEnabled();
     mDrawDirtyObjects.set(State::DIRTY_OBJECT_DRAW_ATTACHMENTS, robustInit);
     mDrawDirtyObjects.set(State::DIRTY_OBJECT_TEXTURES_INIT, robustInit);
     mDrawDirtyObjects.set(State::DIRTY_OBJECT_IMAGES_INIT, robustInit);
@@ -3448,7 +3458,7 @@
 angle::Result Context::prepareForClear(GLbitfield mask)
 {
     ANGLE_TRY(syncDirtyObjects(mClearDirtyObjects));
-    ANGLE_TRY(mGLState.getDrawFramebuffer()->ensureClearAttachmentsInitialized(this, mask));
+    ANGLE_TRY(mState.getDrawFramebuffer()->ensureClearAttachmentsInitialized(this, mask));
     ANGLE_TRY(syncDirtyBits(mClearDirtyBits));
     return angle::Result::Continue;
 }
@@ -3456,8 +3466,8 @@
 angle::Result Context::prepareForClearBuffer(GLenum buffer, GLint drawbuffer)
 {
     ANGLE_TRY(syncDirtyObjects(mClearDirtyObjects));
-    ANGLE_TRY(mGLState.getDrawFramebuffer()->ensureClearBufferAttachmentsInitialized(this, buffer,
-                                                                                     drawbuffer));
+    ANGLE_TRY(mState.getDrawFramebuffer()->ensureClearBufferAttachmentsInitialized(this, buffer,
+                                                                                   drawbuffer));
     ANGLE_TRY(syncDirtyBits(mClearDirtyBits));
     return angle::Result::Continue;
 }
@@ -3494,7 +3504,7 @@
         return;
     }
 
-    Framebuffer *drawFramebuffer = mGLState.getDrawFramebuffer();
+    Framebuffer *drawFramebuffer = mState.getDrawFramebuffer();
     ASSERT(drawFramebuffer);
 
     Rectangle srcArea(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
@@ -3508,12 +3518,12 @@
 void Context::clear(GLbitfield mask)
 {
     ANGLE_CONTEXT_TRY(prepareForClear(mask));
-    ANGLE_CONTEXT_TRY(mGLState.getDrawFramebuffer()->clear(this, mask));
+    ANGLE_CONTEXT_TRY(mState.getDrawFramebuffer()->clear(this, mask));
 }
 
 void Context::clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *values)
 {
-    Framebuffer *framebufferObject          = mGLState.getDrawFramebuffer();
+    Framebuffer *framebufferObject          = mState.getDrawFramebuffer();
     const FramebufferAttachment *attachment = nullptr;
     if (buffer == GL_DEPTH)
     {
@@ -3536,7 +3546,7 @@
 
 void Context::clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *values)
 {
-    Framebuffer *framebufferObject          = mGLState.getDrawFramebuffer();
+    Framebuffer *framebufferObject          = mState.getDrawFramebuffer();
     const FramebufferAttachment *attachment = nullptr;
     if (buffer == GL_COLOR &&
         static_cast<size_t>(drawbuffer) < framebufferObject->getNumColorBuffers())
@@ -3555,7 +3565,7 @@
 
 void Context::clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values)
 {
-    Framebuffer *framebufferObject          = mGLState.getDrawFramebuffer();
+    Framebuffer *framebufferObject          = mState.getDrawFramebuffer();
     const FramebufferAttachment *attachment = nullptr;
     if (buffer == GL_STENCIL)
     {
@@ -3578,7 +3588,7 @@
 
 void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
 {
-    Framebuffer *framebufferObject = mGLState.getDrawFramebuffer();
+    Framebuffer *framebufferObject = mState.getDrawFramebuffer();
     ASSERT(framebufferObject);
 
     // If a buffer is not present, the clear has no effect
@@ -3607,7 +3617,7 @@
 
     ANGLE_CONTEXT_TRY(syncStateForReadPixels());
 
-    Framebuffer *readFBO = mGLState.getReadFramebuffer();
+    Framebuffer *readFBO = mState.getReadFramebuffer();
     ASSERT(readFBO);
 
     Rectangle area(x, y, width, height);
@@ -3654,11 +3664,11 @@
                              GLint border)
 {
     // Only sync the read FBO
-    ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER));
+    ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, GL_READ_FRAMEBUFFER));
 
     Rectangle sourceArea(x, y, width, height);
 
-    Framebuffer *framebuffer = mGLState.getReadFramebuffer();
+    Framebuffer *framebuffer = mState.getReadFramebuffer();
     Texture *texture         = getTargetTexture(TextureTargetToType(target));
     ANGLE_CONTEXT_TRY(
         texture->copyImage(this, target, level, sourceArea, internalformat, framebuffer));
@@ -3679,12 +3689,12 @@
     }
 
     // Only sync the read FBO
-    ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER));
+    ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, GL_READ_FRAMEBUFFER));
 
     Offset destOffset(xoffset, yoffset, 0);
     Rectangle sourceArea(x, y, width, height);
 
-    Framebuffer *framebuffer = mGLState.getReadFramebuffer();
+    Framebuffer *framebuffer = mState.getReadFramebuffer();
     Texture *texture         = getTargetTexture(TextureTargetToType(target));
     ANGLE_CONTEXT_TRY(
         texture->copySubImage(this, target, level, destOffset, sourceArea, framebuffer));
@@ -3706,12 +3716,12 @@
     }
 
     // Only sync the read FBO
-    ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER));
+    ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, GL_READ_FRAMEBUFFER));
 
     Offset destOffset(xoffset, yoffset, zoffset);
     Rectangle sourceArea(x, y, width, height);
 
-    Framebuffer *framebuffer = mGLState.getReadFramebuffer();
+    Framebuffer *framebuffer = mState.getReadFramebuffer();
     Texture *texture         = getTargetTexture(target);
     ANGLE_CONTEXT_TRY(texture->copySubImage(this, NonCubeTextureTypeToTarget(target), level,
                                             destOffset, sourceArea, framebuffer));
@@ -3723,7 +3733,7 @@
                                    GLuint texture,
                                    GLint level)
 {
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     ASSERT(framebuffer);
 
     if (texture != 0)
@@ -3737,7 +3747,7 @@
         framebuffer->resetAttachment(this, attachment);
     }
 
-    mGLState.setObjectDirty(target);
+    mState.setObjectDirty(target);
 }
 
 void Context::framebufferRenderbuffer(GLenum target,
@@ -3745,7 +3755,7 @@
                                       GLenum renderbuffertarget,
                                       GLuint renderbuffer)
 {
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     ASSERT(framebuffer);
 
     if (renderbuffer != 0)
@@ -3760,7 +3770,7 @@
         framebuffer->resetAttachment(this, attachment);
     }
 
-    mGLState.setObjectDirty(target);
+    mState.setObjectDirty(target);
 }
 
 void Context::framebufferTextureLayer(GLenum target,
@@ -3769,7 +3779,7 @@
                                       GLint level,
                                       GLint layer)
 {
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     ASSERT(framebuffer);
 
     if (texture != 0)
@@ -3783,7 +3793,7 @@
         framebuffer->resetAttachment(this, attachment);
     }
 
-    mGLState.setObjectDirty(target);
+    mState.setObjectDirty(target);
 }
 
 void Context::framebufferTextureMultiviewLayered(GLenum target,
@@ -3793,7 +3803,7 @@
                                                  GLint baseViewIndex,
                                                  GLsizei numViews)
 {
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     ASSERT(framebuffer);
 
     if (texture != 0)
@@ -3819,7 +3829,7 @@
         framebuffer->resetAttachment(this, attachment);
     }
 
-    mGLState.setObjectDirty(target);
+    mState.setObjectDirty(target);
 }
 
 void Context::framebufferTextureMultiviewSideBySide(GLenum target,
@@ -3829,7 +3839,7 @@
                                                     GLsizei numViews,
                                                     const GLint *viewportOffsets)
 {
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     ASSERT(framebuffer);
 
     if (texture != 0)
@@ -3845,12 +3855,12 @@
         framebuffer->resetAttachment(this, attachment);
     }
 
-    mGLState.setObjectDirty(target);
+    mState.setObjectDirty(target);
 }
 
 void Context::framebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
 {
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     ASSERT(framebuffer);
 
     if (texture != 0)
@@ -3866,31 +3876,31 @@
         framebuffer->resetAttachment(this, attachment);
     }
 
-    mGLState.setObjectDirty(target);
+    mState.setObjectDirty(target);
 }
 
 void Context::drawBuffers(GLsizei n, const GLenum *bufs)
 {
-    Framebuffer *framebuffer = mGLState.getDrawFramebuffer();
+    Framebuffer *framebuffer = mState.getDrawFramebuffer();
     ASSERT(framebuffer);
     framebuffer->setDrawBuffers(n, bufs);
-    mGLState.setDrawFramebufferDirty();
+    mState.setDrawFramebufferDirty();
     mStateCache.onDrawFramebufferChange(this);
 }
 
 void Context::readBuffer(GLenum mode)
 {
-    Framebuffer *readFBO = mGLState.getReadFramebuffer();
+    Framebuffer *readFBO = mState.getReadFramebuffer();
     readFBO->setReadBuffer(mode);
-    mGLState.setObjectDirty(GL_READ_FRAMEBUFFER);
+    mState.setObjectDirty(GL_READ_FRAMEBUFFER);
 }
 
 void Context::discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
 {
     // Only sync the FBO
-    ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, target));
+    ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, target));
 
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     ASSERT(framebuffer);
 
     // The specification isn't clear what should be done when the framebuffer isn't complete.
@@ -3903,9 +3913,9 @@
                                     const GLenum *attachments)
 {
     // Only sync the FBO
-    ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, target));
+    ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, target));
 
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     ASSERT(framebuffer);
 
     if (!framebuffer->isComplete(this))
@@ -3925,9 +3935,9 @@
                                        GLsizei height)
 {
     // Only sync the FBO
-    ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, target));
+    ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, target));
 
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     ASSERT(framebuffer);
 
     if (!framebuffer->isComplete(this))
@@ -3953,7 +3963,7 @@
 
     Extents size(width, height, 1);
     Texture *texture = getTargetTexture(TextureTargetToType(target));
-    ANGLE_CONTEXT_TRY(texture->setImage(this, mGLState.getUnpackState(), target, level,
+    ANGLE_CONTEXT_TRY(texture->setImage(this, mState.getUnpackState(), target, level,
                                         internalformat, size, format, type,
                                         static_cast<const uint8_t *>(pixels)));
 }
@@ -3987,7 +3997,7 @@
 
     Extents size(width, height, depth);
     Texture *texture = getTargetTexture(target);
-    ANGLE_CONTEXT_TRY(texture->setImage(this, mGLState.getUnpackState(),
+    ANGLE_CONTEXT_TRY(texture->setImage(this, mState.getUnpackState(),
                                         NonCubeTextureTypeToTarget(target), level, internalformat,
                                         size, format, type, static_cast<const uint8_t *>(pixels)));
 }
@@ -4028,9 +4038,9 @@
     Box area(xoffset, yoffset, 0, width, height, 1);
     Texture *texture = getTargetTexture(TextureTargetToType(target));
 
-    gl::Buffer *unpackBuffer = mGLState.getTargetBuffer(gl::BufferBinding::PixelUnpack);
+    gl::Buffer *unpackBuffer = mState.getTargetBuffer(gl::BufferBinding::PixelUnpack);
 
-    ANGLE_CONTEXT_TRY(texture->setSubImage(this, mGLState.getUnpackState(), unpackBuffer, target,
+    ANGLE_CONTEXT_TRY(texture->setSubImage(this, mState.getUnpackState(), unpackBuffer, target,
                                            level, area, format, type,
                                            static_cast<const uint8_t *>(pixels)));
 }
@@ -4072,9 +4082,9 @@
     Box area(xoffset, yoffset, zoffset, width, height, depth);
     Texture *texture = getTargetTexture(target);
 
-    gl::Buffer *unpackBuffer = mGLState.getTargetBuffer(gl::BufferBinding::PixelUnpack);
+    gl::Buffer *unpackBuffer = mState.getTargetBuffer(gl::BufferBinding::PixelUnpack);
 
-    ANGLE_CONTEXT_TRY(texture->setSubImage(this, mGLState.getUnpackState(), unpackBuffer,
+    ANGLE_CONTEXT_TRY(texture->setSubImage(this, mState.getUnpackState(), unpackBuffer,
                                            NonCubeTextureTypeToTarget(target), level, area, format,
                                            type, static_cast<const uint8_t *>(pixels)));
 }
@@ -4109,7 +4119,7 @@
 
     Extents size(width, height, 1);
     Texture *texture = getTargetTexture(TextureTargetToType(target));
-    ANGLE_CONTEXT_TRY(texture->setCompressedImage(this, mGLState.getUnpackState(), target, level,
+    ANGLE_CONTEXT_TRY(texture->setCompressedImage(this, mState.getUnpackState(), target, level,
                                                   internalformat, size, imageSize,
                                                   static_cast<const uint8_t *>(data)));
 }
@@ -4142,7 +4152,7 @@
     Extents size(width, height, depth);
     Texture *texture = getTargetTexture(target);
     ANGLE_CONTEXT_TRY(texture->setCompressedImage(
-        this, mGLState.getUnpackState(), NonCubeTextureTypeToTarget(target), level, internalformat,
+        this, mState.getUnpackState(), NonCubeTextureTypeToTarget(target), level, internalformat,
         size, imageSize, static_cast<const uint8_t *>(data)));
 }
 
@@ -4175,7 +4185,7 @@
 
     Box area(xoffset, yoffset, 0, width, height, 1);
     Texture *texture = getTargetTexture(TextureTargetToType(target));
-    ANGLE_CONTEXT_TRY(texture->setCompressedSubImage(this, mGLState.getUnpackState(), target, level,
+    ANGLE_CONTEXT_TRY(texture->setCompressedSubImage(this, mState.getUnpackState(), target, level,
                                                      area, format, imageSize,
                                                      static_cast<const uint8_t *>(data)));
 }
@@ -4218,7 +4228,7 @@
     Box area(xoffset, yoffset, zoffset, width, height, depth);
     Texture *texture = getTargetTexture(target);
     ANGLE_CONTEXT_TRY(texture->setCompressedSubImage(
-        this, mGLState.getUnpackState(), NonCubeTextureTypeToTarget(target), level, area, format,
+        this, mState.getUnpackState(), NonCubeTextureTypeToTarget(target), level, area, format,
         imageSize, static_cast<const uint8_t *>(data)));
 }
 
@@ -4367,7 +4377,7 @@
 
 void Context::getBufferPointerv(BufferBinding target, GLenum pname, void **params)
 {
-    Buffer *buffer = mGLState.getTargetBuffer(target);
+    Buffer *buffer = mState.getTargetBuffer(target);
     ASSERT(buffer);
 
     QueryBufferPointerv(buffer, pname, params);
@@ -4384,7 +4394,7 @@
 
 void *Context::mapBuffer(BufferBinding target, GLenum access)
 {
-    Buffer *buffer = mGLState.getTargetBuffer(target);
+    Buffer *buffer = mState.getTargetBuffer(target);
     ASSERT(buffer);
 
     if (buffer->map(this, access) == angle::Result::Stop)
@@ -4397,7 +4407,7 @@
 
 GLboolean Context::unmapBuffer(BufferBinding target)
 {
-    Buffer *buffer = mGLState.getTargetBuffer(target);
+    Buffer *buffer = mState.getTargetBuffer(target);
     ASSERT(buffer);
 
     GLboolean result;
@@ -4414,7 +4424,7 @@
                               GLsizeiptr length,
                               GLbitfield access)
 {
-    Buffer *buffer = mGLState.getTargetBuffer(target);
+    Buffer *buffer = mState.getTargetBuffer(target);
     ASSERT(buffer);
 
     if (buffer->mapRange(this, offset, length, access) == angle::Result::Stop)
@@ -4464,102 +4474,102 @@
 
 void Context::activeTexture(GLenum texture)
 {
-    mGLState.setActiveSampler(texture - GL_TEXTURE0);
+    mState.setActiveSampler(texture - GL_TEXTURE0);
 }
 
 void Context::blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
 {
-    mGLState.setBlendColor(clamp01(red), clamp01(green), clamp01(blue), clamp01(alpha));
+    mState.setBlendColor(clamp01(red), clamp01(green), clamp01(blue), clamp01(alpha));
 }
 
 void Context::blendEquation(GLenum mode)
 {
-    mGLState.setBlendEquation(mode, mode);
+    mState.setBlendEquation(mode, mode);
 }
 
 void Context::blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
 {
-    mGLState.setBlendEquation(modeRGB, modeAlpha);
+    mState.setBlendEquation(modeRGB, modeAlpha);
 }
 
 void Context::blendFunc(GLenum sfactor, GLenum dfactor)
 {
-    mGLState.setBlendFactors(sfactor, dfactor, sfactor, dfactor);
+    mState.setBlendFactors(sfactor, dfactor, sfactor, dfactor);
 }
 
 void Context::blendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
 {
-    mGLState.setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
+    mState.setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
 }
 
 void Context::clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
 {
-    mGLState.setColorClearValue(red, green, blue, alpha);
+    mState.setColorClearValue(red, green, blue, alpha);
 }
 
 void Context::clearDepthf(GLfloat depth)
 {
-    mGLState.setDepthClearValue(clamp01(depth));
+    mState.setDepthClearValue(clamp01(depth));
 }
 
 void Context::clearStencil(GLint s)
 {
-    mGLState.setStencilClearValue(s);
+    mState.setStencilClearValue(s);
 }
 
 void Context::colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
 {
-    mGLState.setColorMask(ConvertToBool(red), ConvertToBool(green), ConvertToBool(blue),
-                          ConvertToBool(alpha));
+    mState.setColorMask(ConvertToBool(red), ConvertToBool(green), ConvertToBool(blue),
+                        ConvertToBool(alpha));
 }
 
 void Context::cullFace(CullFaceMode mode)
 {
-    mGLState.setCullMode(mode);
+    mState.setCullMode(mode);
 }
 
 void Context::depthFunc(GLenum func)
 {
-    mGLState.setDepthFunc(func);
+    mState.setDepthFunc(func);
 }
 
 void Context::depthMask(GLboolean flag)
 {
-    mGLState.setDepthMask(ConvertToBool(flag));
+    mState.setDepthMask(ConvertToBool(flag));
 }
 
 void Context::depthRangef(GLfloat zNear, GLfloat zFar)
 {
-    mGLState.setDepthRange(clamp01(zNear), clamp01(zFar));
+    mState.setDepthRange(clamp01(zNear), clamp01(zFar));
 }
 
 void Context::disable(GLenum cap)
 {
-    mGLState.setEnableFeature(cap, false);
+    mState.setEnableFeature(cap, false);
     mStateCache.onContextCapChange(this);
 }
 
 void Context::disableVertexAttribArray(GLuint index)
 {
-    mGLState.setEnableVertexAttribArray(index, false);
+    mState.setEnableVertexAttribArray(index, false);
     mStateCache.onVertexArrayStateChange(this);
 }
 
 void Context::enable(GLenum cap)
 {
-    mGLState.setEnableFeature(cap, true);
+    mState.setEnableFeature(cap, true);
     mStateCache.onContextCapChange(this);
 }
 
 void Context::enableVertexAttribArray(GLuint index)
 {
-    mGLState.setEnableVertexAttribArray(index, true);
+    mState.setEnableVertexAttribArray(index, true);
     mStateCache.onVertexArrayStateChange(this);
 }
 
 void Context::frontFace(GLenum mode)
 {
-    mGLState.setFrontFace(mode);
+    mState.setFrontFace(mode);
 }
 
 void Context::hint(GLenum target, GLenum mode)
@@ -4567,18 +4577,18 @@
     switch (target)
     {
         case GL_GENERATE_MIPMAP_HINT:
-            mGLState.setGenerateMipmapHint(mode);
+            mState.setGenerateMipmapHint(mode);
             break;
 
         case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
-            mGLState.setFragmentShaderDerivativeHint(mode);
+            mState.setFragmentShaderDerivativeHint(mode);
             break;
 
         case GL_PERSPECTIVE_CORRECTION_HINT:
         case GL_POINT_SMOOTH_HINT:
         case GL_LINE_SMOOTH_HINT:
         case GL_FOG_HINT:
-            mGLState.gles1().setHint(target, mode);
+            mState.gles1().setHint(target, mode);
             break;
         default:
             UNREACHABLE();
@@ -4588,7 +4598,7 @@
 
 void Context::lineWidth(GLfloat width)
 {
-    mGLState.setLineWidth(width);
+    mState.setLineWidth(width);
 }
 
 void Context::pixelStorei(GLenum pname, GLint param)
@@ -4596,55 +4606,55 @@
     switch (pname)
     {
         case GL_UNPACK_ALIGNMENT:
-            mGLState.setUnpackAlignment(param);
+            mState.setUnpackAlignment(param);
             break;
 
         case GL_PACK_ALIGNMENT:
-            mGLState.setPackAlignment(param);
+            mState.setPackAlignment(param);
             break;
 
         case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
-            mGLState.setPackReverseRowOrder(param != 0);
+            mState.setPackReverseRowOrder(param != 0);
             break;
 
         case GL_UNPACK_ROW_LENGTH:
             ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
-            mGLState.setUnpackRowLength(param);
+            mState.setUnpackRowLength(param);
             break;
 
         case GL_UNPACK_IMAGE_HEIGHT:
             ASSERT(getClientMajorVersion() >= 3);
-            mGLState.setUnpackImageHeight(param);
+            mState.setUnpackImageHeight(param);
             break;
 
         case GL_UNPACK_SKIP_IMAGES:
             ASSERT(getClientMajorVersion() >= 3);
-            mGLState.setUnpackSkipImages(param);
+            mState.setUnpackSkipImages(param);
             break;
 
         case GL_UNPACK_SKIP_ROWS:
             ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
-            mGLState.setUnpackSkipRows(param);
+            mState.setUnpackSkipRows(param);
             break;
 
         case GL_UNPACK_SKIP_PIXELS:
             ASSERT((getClientMajorVersion() >= 3) || getExtensions().unpackSubimage);
-            mGLState.setUnpackSkipPixels(param);
+            mState.setUnpackSkipPixels(param);
             break;
 
         case GL_PACK_ROW_LENGTH:
             ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
-            mGLState.setPackRowLength(param);
+            mState.setPackRowLength(param);
             break;
 
         case GL_PACK_SKIP_ROWS:
             ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
-            mGLState.setPackSkipRows(param);
+            mState.setPackSkipRows(param);
             break;
 
         case GL_PACK_SKIP_PIXELS:
             ASSERT((getClientMajorVersion() >= 3) || getExtensions().packSubimage);
-            mGLState.setPackSkipPixels(param);
+            mState.setPackSkipPixels(param);
             break;
 
         default:
@@ -4655,34 +4665,34 @@
 
 void Context::polygonOffset(GLfloat factor, GLfloat units)
 {
-    mGLState.setPolygonOffsetParams(factor, units);
+    mState.setPolygonOffsetParams(factor, units);
 }
 
 void Context::sampleCoverage(GLfloat value, GLboolean invert)
 {
-    mGLState.setSampleCoverageParams(clamp01(value), ConvertToBool(invert));
+    mState.setSampleCoverageParams(clamp01(value), ConvertToBool(invert));
 }
 
 void Context::sampleMaski(GLuint maskNumber, GLbitfield mask)
 {
-    mGLState.setSampleMaskParams(maskNumber, mask);
+    mState.setSampleMaskParams(maskNumber, mask);
 }
 
 void Context::scissor(GLint x, GLint y, GLsizei width, GLsizei height)
 {
-    mGLState.setScissorParams(x, y, width, height);
+    mState.setScissorParams(x, y, width, height);
 }
 
 void Context::stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
 {
     if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
     {
-        mGLState.setStencilParams(func, ref, mask);
+        mState.setStencilParams(func, ref, mask);
     }
 
     if (face == GL_BACK || face == GL_FRONT_AND_BACK)
     {
-        mGLState.setStencilBackParams(func, ref, mask);
+        mState.setStencilBackParams(func, ref, mask);
     }
 
     mStateCache.onStencilStateChange(this);
@@ -4692,12 +4702,12 @@
 {
     if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
     {
-        mGLState.setStencilWritemask(mask);
+        mState.setStencilWritemask(mask);
     }
 
     if (face == GL_BACK || face == GL_FRONT_AND_BACK)
     {
-        mGLState.setStencilBackWritemask(mask);
+        mState.setStencilBackWritemask(mask);
     }
 
     mStateCache.onStencilStateChange(this);
@@ -4707,67 +4717,67 @@
 {
     if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
     {
-        mGLState.setStencilOperations(fail, zfail, zpass);
+        mState.setStencilOperations(fail, zfail, zpass);
     }
 
     if (face == GL_BACK || face == GL_FRONT_AND_BACK)
     {
-        mGLState.setStencilBackOperations(fail, zfail, zpass);
+        mState.setStencilBackOperations(fail, zfail, zpass);
     }
 }
 
 void Context::vertexAttrib1f(GLuint index, GLfloat x)
 {
     GLfloat vals[4] = {x, 0, 0, 1};
-    mGLState.setVertexAttribf(index, vals);
+    mState.setVertexAttribf(index, vals);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::vertexAttrib1fv(GLuint index, const GLfloat *values)
 {
     GLfloat vals[4] = {values[0], 0, 0, 1};
-    mGLState.setVertexAttribf(index, vals);
+    mState.setVertexAttribf(index, vals);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::vertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
 {
     GLfloat vals[4] = {x, y, 0, 1};
-    mGLState.setVertexAttribf(index, vals);
+    mState.setVertexAttribf(index, vals);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::vertexAttrib2fv(GLuint index, const GLfloat *values)
 {
     GLfloat vals[4] = {values[0], values[1], 0, 1};
-    mGLState.setVertexAttribf(index, vals);
+    mState.setVertexAttribf(index, vals);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
 {
     GLfloat vals[4] = {x, y, z, 1};
-    mGLState.setVertexAttribf(index, vals);
+    mState.setVertexAttribf(index, vals);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::vertexAttrib3fv(GLuint index, const GLfloat *values)
 {
     GLfloat vals[4] = {values[0], values[1], values[2], 1};
-    mGLState.setVertexAttribf(index, vals);
+    mState.setVertexAttribf(index, vals);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
     GLfloat vals[4] = {x, y, z, w};
-    mGLState.setVertexAttribf(index, vals);
+    mState.setVertexAttribf(index, vals);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::vertexAttrib4fv(GLuint index, const GLfloat *values)
 {
-    mGLState.setVertexAttribf(index, values);
+    mState.setVertexAttribf(index, values);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
@@ -4778,8 +4788,8 @@
                                   GLsizei stride,
                                   const void *ptr)
 {
-    mGLState.setVertexAttribPointer(this, index, mGLState.getTargetBuffer(BufferBinding::Array),
-                                    size, type, ConvertToBool(normalized), false, stride, ptr);
+    mState.setVertexAttribPointer(this, index, mState.getTargetBuffer(BufferBinding::Array), size,
+                                  type, ConvertToBool(normalized), false, stride, ptr);
     mStateCache.onVertexArrayStateChange(this);
 }
 
@@ -4789,8 +4799,8 @@
                                  GLboolean normalized,
                                  GLuint relativeOffset)
 {
-    mGLState.setVertexAttribFormat(attribIndex, size, type, ConvertToBool(normalized), false,
-                                   relativeOffset);
+    mState.setVertexAttribFormat(attribIndex, size, type, ConvertToBool(normalized), false,
+                                 relativeOffset);
     mStateCache.onVertexArrayFormatChange(this);
 }
 
@@ -4799,25 +4809,25 @@
                                   GLenum type,
                                   GLuint relativeOffset)
 {
-    mGLState.setVertexAttribFormat(attribIndex, size, type, false, true, relativeOffset);
+    mState.setVertexAttribFormat(attribIndex, size, type, false, true, relativeOffset);
     mStateCache.onVertexArrayFormatChange(this);
 }
 
 void Context::vertexAttribBinding(GLuint attribIndex, GLuint bindingIndex)
 {
-    mGLState.setVertexAttribBinding(this, attribIndex, bindingIndex);
+    mState.setVertexAttribBinding(this, attribIndex, bindingIndex);
     mStateCache.onVertexArrayStateChange(this);
 }
 
 void Context::vertexBindingDivisor(GLuint bindingIndex, GLuint divisor)
 {
-    mGLState.setVertexBindingDivisor(bindingIndex, divisor);
+    mState.setVertexBindingDivisor(bindingIndex, divisor);
     mStateCache.onVertexArrayFormatChange(this);
 }
 
 void Context::viewport(GLint x, GLint y, GLsizei width, GLsizei height)
 {
-    mGLState.setViewportParams(x, y, width, height);
+    mState.setViewportParams(x, y, width, height);
 }
 
 void Context::vertexAttribIPointer(GLuint index,
@@ -4826,42 +4836,42 @@
                                    GLsizei stride,
                                    const void *pointer)
 {
-    mGLState.setVertexAttribPointer(this, index, mGLState.getTargetBuffer(BufferBinding::Array),
-                                    size, type, false, true, stride, pointer);
+    mState.setVertexAttribPointer(this, index, mState.getTargetBuffer(BufferBinding::Array), size,
+                                  type, false, true, stride, pointer);
     mStateCache.onVertexArrayStateChange(this);
 }
 
 void Context::vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
 {
     GLint vals[4] = {x, y, z, w};
-    mGLState.setVertexAttribi(index, vals);
+    mState.setVertexAttribi(index, vals);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
 {
     GLuint vals[4] = {x, y, z, w};
-    mGLState.setVertexAttribu(index, vals);
+    mState.setVertexAttribu(index, vals);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::vertexAttribI4iv(GLuint index, const GLint *v)
 {
-    mGLState.setVertexAttribi(index, v);
+    mState.setVertexAttribi(index, v);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::vertexAttribI4uiv(GLuint index, const GLuint *v)
 {
-    mGLState.setVertexAttribu(index, v);
+    mState.setVertexAttribu(index, v);
     mStateCache.onDefaultVertexAttributeChange(this);
 }
 
 void Context::getVertexAttribiv(GLuint index, GLenum pname, GLint *params)
 {
     const VertexAttribCurrentValueData &currentValues =
-        getGLState().getVertexAttribCurrentValue(index);
-    const VertexArray *vao = getGLState().getVertexArray();
+        getState().getVertexAttribCurrentValue(index);
+    const VertexArray *vao = getState().getVertexArray();
     QueryVertexAttribiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
                         currentValues, pname, params);
 }
@@ -4878,8 +4888,8 @@
 void Context::getVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
 {
     const VertexAttribCurrentValueData &currentValues =
-        getGLState().getVertexAttribCurrentValue(index);
-    const VertexArray *vao = getGLState().getVertexArray();
+        getState().getVertexAttribCurrentValue(index);
+    const VertexArray *vao = getState().getVertexArray();
     QueryVertexAttribfv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
                         currentValues, pname, params);
 }
@@ -4896,8 +4906,8 @@
 void Context::getVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
 {
     const VertexAttribCurrentValueData &currentValues =
-        getGLState().getVertexAttribCurrentValue(index);
-    const VertexArray *vao = getGLState().getVertexArray();
+        getState().getVertexAttribCurrentValue(index);
+    const VertexArray *vao = getState().getVertexArray();
     QueryVertexAttribIiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
                          currentValues, pname, params);
 }
@@ -4914,8 +4924,8 @@
 void Context::getVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
 {
     const VertexAttribCurrentValueData &currentValues =
-        getGLState().getVertexAttribCurrentValue(index);
-    const VertexArray *vao = getGLState().getVertexArray();
+        getState().getVertexAttribCurrentValue(index);
+    const VertexArray *vao = getState().getVertexArray();
     QueryVertexAttribIuiv(vao->getVertexAttribute(index), vao->getBindingFromAttribIndex(index),
                           currentValues, pname, params);
 }
@@ -4931,7 +4941,7 @@
 
 void Context::getVertexAttribPointerv(GLuint index, GLenum pname, void **pointer)
 {
-    const VertexAttribute &attrib = getGLState().getVertexArray()->getVertexAttribute(index);
+    const VertexAttribute &attrib = getState().getVertexArray()->getVertexAttribute(index);
     QueryVertexAttribPointerv(attrib, pname, pointer);
 }
 
@@ -4952,8 +4962,8 @@
                                   GLboolean enabled)
 {
     std::vector<GLuint> idVector(ids, ids + count);
-    mGLState.getDebug().setMessageControl(source, type, severity, std::move(idVector),
-                                          ConvertToBool(enabled));
+    mState.getDebug().setMessageControl(source, type, severity, std::move(idVector),
+                                        ConvertToBool(enabled));
 }
 
 void Context::debugMessageInsert(GLenum source,
@@ -4964,12 +4974,12 @@
                                  const GLchar *buf)
 {
     std::string msg(buf, (length > 0) ? static_cast<size_t>(length) : strlen(buf));
-    mGLState.getDebug().insertMessage(source, type, id, severity, std::move(msg));
+    mState.getDebug().insertMessage(source, type, id, severity, std::move(msg));
 }
 
 void Context::debugMessageCallback(GLDEBUGPROCKHR callback, const void *userParam)
 {
-    mGLState.getDebug().setCallback(callback, userParam);
+    mState.getDebug().setCallback(callback, userParam);
 }
 
 GLuint Context::getDebugMessageLog(GLuint count,
@@ -4981,26 +4991,26 @@
                                    GLsizei *lengths,
                                    GLchar *messageLog)
 {
-    return static_cast<GLuint>(mGLState.getDebug().getMessages(count, bufSize, sources, types, ids,
-                                                               severities, lengths, messageLog));
+    return static_cast<GLuint>(mState.getDebug().getMessages(count, bufSize, sources, types, ids,
+                                                             severities, lengths, messageLog));
 }
 
 void Context::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message)
 {
     std::string msg(message, (length > 0) ? static_cast<size_t>(length) : strlen(message));
-    mGLState.getDebug().pushGroup(source, id, std::move(msg));
+    mState.getDebug().pushGroup(source, id, std::move(msg));
     mImplementation->pushDebugGroup(source, id, length, message);
 }
 
 void Context::popDebugGroup()
 {
-    mGLState.getDebug().popGroup();
+    mState.getDebug().popGroup();
     mImplementation->popDebugGroup();
 }
 
 void Context::bufferData(BufferBinding target, GLsizeiptr size, const void *data, BufferUsage usage)
 {
-    Buffer *buffer = mGLState.getTargetBuffer(target);
+    Buffer *buffer = mState.getTargetBuffer(target);
     ASSERT(buffer);
     ANGLE_CONTEXT_TRY(buffer->bufferData(this, target, data, size, usage));
 }
@@ -5015,15 +5025,15 @@
         return;
     }
 
-    Buffer *buffer = mGLState.getTargetBuffer(target);
+    Buffer *buffer = mState.getTargetBuffer(target);
     ASSERT(buffer);
     ANGLE_CONTEXT_TRY(buffer->bufferSubData(this, target, data, size, offset));
 }
 
 void Context::attachShader(GLuint program, GLuint shader)
 {
-    Program *programObject = mState.mShaderPrograms->getProgram(program);
-    Shader *shaderObject   = mState.mShaderPrograms->getShader(shader);
+    Program *programObject = mState.mShaderProgramManager->getProgram(program);
+    Shader *shaderObject   = mState.mShaderProgramManager->getShader(shader);
     ASSERT(programObject && shaderObject);
     programObject->attachShader(shaderObject);
 }
@@ -5046,8 +5056,8 @@
     }
 
     // TODO(jmadill): cache these.
-    Buffer *readBuffer  = mGLState.getTargetBuffer(readTarget);
-    Buffer *writeBuffer = mGLState.getTargetBuffer(writeTarget);
+    Buffer *readBuffer  = mState.getTargetBuffer(readTarget);
+    Buffer *writeBuffer = mState.getTargetBuffer(writeTarget);
 
     ANGLE_CONTEXT_TRY(
         writeBuffer->copyBufferSubData(this, readBuffer, readOffset, writeOffset, size));
@@ -5072,8 +5082,8 @@
                               GLintptr offset,
                               GLsizeiptr size)
 {
-    Buffer *object = mState.mBuffers->checkBufferAllocation(mImplementation.get(), buffer);
-    ANGLE_CONTEXT_TRY(mGLState.setIndexedBufferBinding(this, target, index, object, offset, size));
+    Buffer *object = mState.mBufferManager->checkBufferAllocation(mImplementation.get(), buffer);
+    ANGLE_CONTEXT_TRY(mState.setIndexedBufferBinding(this, target, index, object, offset, size));
     if (target == BufferBinding::Uniform)
     {
         mUniformBufferObserverBindings[index].bind(object);
@@ -5101,9 +5111,9 @@
 void Context::bindRenderbuffer(GLenum target, GLuint renderbuffer)
 {
     ASSERT(target == GL_RENDERBUFFER);
-    Renderbuffer *object =
-        mState.mRenderbuffers->checkRenderbufferAllocation(mImplementation.get(), renderbuffer);
-    mGLState.setRenderbufferBinding(this, object);
+    Renderbuffer *object = mState.mRenderbufferManager->checkRenderbufferAllocation(
+        mImplementation.get(), renderbuffer);
+    mState.setRenderbufferBinding(this, object);
 }
 
 void Context::texStorage2DMultisample(TextureType target,
@@ -5137,8 +5147,8 @@
 {
     // According to spec 3.1 Table 20.49: Framebuffer Dependent Values,
     // the sample position should be queried by DRAW_FRAMEBUFFER.
-    ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER));
-    const Framebuffer *framebuffer = mGLState.getDrawFramebuffer();
+    ANGLE_CONTEXT_TRY(mState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER));
+    const Framebuffer *framebuffer = mState.getDrawFramebuffer();
 
     switch (pname)
     {
@@ -5167,7 +5177,7 @@
     // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
     GLenum convertedInternalFormat = getConvertedRenderbufferFormat(internalformat);
 
-    Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
+    Renderbuffer *renderbuffer = mState.getCurrentRenderbuffer();
     ANGLE_CONTEXT_TRY(renderbuffer->setStorage(this, convertedInternalFormat, width, height));
 }
 
@@ -5180,7 +5190,7 @@
     // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
     GLenum convertedInternalFormat = getConvertedRenderbufferFormat(internalformat);
 
-    Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
+    Renderbuffer *renderbuffer = mState.getCurrentRenderbuffer();
     ANGLE_CONTEXT_TRY(
         renderbuffer->setStorageMultisample(this, samples, convertedInternalFormat, width, height));
 }
@@ -5193,7 +5203,7 @@
 
 void Context::getFramebufferParameteriv(GLenum target, GLenum pname, GLint *params)
 {
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     QueryFramebufferParameteriv(framebuffer, pname, params);
 }
 
@@ -5208,7 +5218,7 @@
 
 void Context::framebufferParameteri(GLenum target, GLenum pname, GLint param)
 {
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     SetFramebufferParameteri(this, framebuffer, pname, param);
 }
 
@@ -5280,7 +5290,7 @@
                               GLsizei drawcount)
 {
     ANGLE_CONTEXT_TRY(prepareForDraw(mode));
-    Program *programObject = mGLState.getLinkedProgram(this);
+    Program *programObject = mState.getLinkedProgram(this);
     const bool hasDrawID   = programObject && programObject->hasDrawIDUniform();
     if (hasDrawID)
     {
@@ -5318,7 +5328,7 @@
                                        GLsizei drawcount)
 {
     ANGLE_CONTEXT_TRY(prepareForDraw(mode));
-    Program *programObject = mGLState.getLinkedProgram(this);
+    Program *programObject = mState.getLinkedProgram(this);
     const bool hasDrawID   = programObject && programObject->hasDrawIDUniform();
     if (hasDrawID)
     {
@@ -5356,7 +5366,7 @@
                                 GLsizei drawcount)
 {
     ANGLE_CONTEXT_TRY(prepareForDraw(mode));
-    Program *programObject = mGLState.getLinkedProgram(this);
+    Program *programObject = mState.getLinkedProgram(this);
     const bool hasDrawID   = programObject && programObject->hasDrawIDUniform();
     if (hasDrawID)
     {
@@ -5393,7 +5403,7 @@
                                          GLsizei drawcount)
 {
     ANGLE_CONTEXT_TRY(prepareForDraw(mode));
-    Program *programObject = mGLState.getLinkedProgram(this);
+    Program *programObject = mState.getLinkedProgram(this);
     const bool hasDrawID   = programObject && programObject->hasDrawIDUniform();
     if (hasDrawID)
     {
@@ -5424,7 +5434,7 @@
 
 GLenum Context::checkFramebufferStatus(GLenum target)
 {
-    Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
+    Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
     ASSERT(framebuffer);
     return framebuffer->checkStatus(this);
 }
@@ -5697,23 +5707,23 @@
             switch (precisiontype)
             {
                 case GL_LOW_FLOAT:
-                    mCaps.vertexLowpFloat.get(range, precision);
+                    mState.mCaps.vertexLowpFloat.get(range, precision);
                     break;
                 case GL_MEDIUM_FLOAT:
-                    mCaps.vertexMediumpFloat.get(range, precision);
+                    mState.mCaps.vertexMediumpFloat.get(range, precision);
                     break;
                 case GL_HIGH_FLOAT:
-                    mCaps.vertexHighpFloat.get(range, precision);
+                    mState.mCaps.vertexHighpFloat.get(range, precision);
                     break;
 
                 case GL_LOW_INT:
-                    mCaps.vertexLowpInt.get(range, precision);
+                    mState.mCaps.vertexLowpInt.get(range, precision);
                     break;
                 case GL_MEDIUM_INT:
-                    mCaps.vertexMediumpInt.get(range, precision);
+                    mState.mCaps.vertexMediumpInt.get(range, precision);
                     break;
                 case GL_HIGH_INT:
-                    mCaps.vertexHighpInt.get(range, precision);
+                    mState.mCaps.vertexHighpInt.get(range, precision);
                     break;
 
                 default:
@@ -5726,23 +5736,23 @@
             switch (precisiontype)
             {
                 case GL_LOW_FLOAT:
-                    mCaps.fragmentLowpFloat.get(range, precision);
+                    mState.mCaps.fragmentLowpFloat.get(range, precision);
                     break;
                 case GL_MEDIUM_FLOAT:
-                    mCaps.fragmentMediumpFloat.get(range, precision);
+                    mState.mCaps.fragmentMediumpFloat.get(range, precision);
                     break;
                 case GL_HIGH_FLOAT:
-                    mCaps.fragmentHighpFloat.get(range, precision);
+                    mState.mCaps.fragmentHighpFloat.get(range, precision);
                     break;
 
                 case GL_LOW_INT:
-                    mCaps.fragmentLowpInt.get(range, precision);
+                    mState.mCaps.fragmentLowpInt.get(range, precision);
                     break;
                 case GL_MEDIUM_INT:
-                    mCaps.fragmentMediumpInt.get(range, precision);
+                    mState.mCaps.fragmentMediumpInt.get(range, precision);
                     break;
                 case GL_HIGH_INT:
-                    mCaps.fragmentHighpInt.get(range, precision);
+                    mState.mCaps.fragmentHighpInt.get(range, precision);
                     break;
 
                 default:
@@ -5815,7 +5825,7 @@
 
 GLboolean Context::isEnabled(GLenum cap)
 {
-    return mGLState.getEnableFeature(cap);
+    return mState.getEnableFeature(cap);
 }
 
 GLboolean Context::isFramebuffer(GLuint framebuffer)
@@ -5886,7 +5896,7 @@
         programObject->resolveLink(this);
         if (programObject->isLinked())
         {
-            ANGLE_CONTEXT_TRY(mGLState.onProgramExecutableChange(this, programObject));
+            ANGLE_CONTEXT_TRY(mState.onProgramExecutableChange(this, programObject));
         }
         mStateCache.onProgramExecutableChange(this);
     }
@@ -5964,13 +5974,13 @@
 
 void Context::uniform1f(GLint location, GLfloat x)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform1fv(location, 1, &x);
 }
 
 void Context::uniform1fv(GLint location, GLsizei count, const GLfloat *v)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform1fv(location, count, v);
 }
 
@@ -5981,95 +5991,95 @@
 
 void Context::onSamplerUniformChange(size_t textureUnitIndex)
 {
-    mGLState.onActiveTextureChange(this, textureUnitIndex);
+    mState.onActiveTextureChange(this, textureUnitIndex);
     mStateCache.onActiveTextureChange(this);
 }
 
 void Context::uniform1i(GLint location, GLint x)
 {
-    setUniform1iImpl(mGLState.getProgram(), location, 1, &x);
+    setUniform1iImpl(mState.getProgram(), location, 1, &x);
 }
 
 void Context::uniform1iv(GLint location, GLsizei count, const GLint *v)
 {
-    setUniform1iImpl(mGLState.getProgram(), location, count, v);
+    setUniform1iImpl(mState.getProgram(), location, count, v);
 }
 
 void Context::uniform2f(GLint location, GLfloat x, GLfloat y)
 {
     GLfloat xy[2]    = {x, y};
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform2fv(location, 1, xy);
 }
 
 void Context::uniform2fv(GLint location, GLsizei count, const GLfloat *v)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform2fv(location, count, v);
 }
 
 void Context::uniform2i(GLint location, GLint x, GLint y)
 {
     GLint xy[2]      = {x, y};
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform2iv(location, 1, xy);
 }
 
 void Context::uniform2iv(GLint location, GLsizei count, const GLint *v)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform2iv(location, count, v);
 }
 
 void Context::uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
 {
     GLfloat xyz[3]   = {x, y, z};
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform3fv(location, 1, xyz);
 }
 
 void Context::uniform3fv(GLint location, GLsizei count, const GLfloat *v)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform3fv(location, count, v);
 }
 
 void Context::uniform3i(GLint location, GLint x, GLint y, GLint z)
 {
     GLint xyz[3]     = {x, y, z};
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform3iv(location, 1, xyz);
 }
 
 void Context::uniform3iv(GLint location, GLsizei count, const GLint *v)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform3iv(location, count, v);
 }
 
 void Context::uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
     GLfloat xyzw[4]  = {x, y, z, w};
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform4fv(location, 1, xyzw);
 }
 
 void Context::uniform4fv(GLint location, GLsizei count, const GLfloat *v)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform4fv(location, count, v);
 }
 
 void Context::uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
 {
     GLint xyzw[4]    = {x, y, z, w};
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform4iv(location, 1, xyzw);
 }
 
 void Context::uniform4iv(GLint location, GLsizei count, const GLint *v)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform4iv(location, count, v);
 }
 
@@ -6078,7 +6088,7 @@
                                GLboolean transpose,
                                const GLfloat *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniformMatrix2fv(location, count, transpose, value);
 }
 
@@ -6087,7 +6097,7 @@
                                GLboolean transpose,
                                const GLfloat *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniformMatrix3fv(location, count, transpose, value);
 }
 
@@ -6096,7 +6106,7 @@
                                GLboolean transpose,
                                const GLfloat *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniformMatrix4fv(location, count, transpose, value);
 }
 
@@ -6104,7 +6114,7 @@
 {
     Program *programObject = getProgramResolveLink(program);
     ASSERT(programObject);
-    programObject->validate(mCaps);
+    programObject->validate(mState.mCaps);
 }
 
 void Context::validateProgramPipeline(GLuint pipeline)
@@ -6132,58 +6142,58 @@
     ANGLE_CONTEXT_TRY(programObject->loadBinary(this, binaryFormat, binary, length));
     if (programObject->isInUse())
     {
-        ANGLE_CONTEXT_TRY(mGLState.onProgramExecutableChange(this, programObject));
+        ANGLE_CONTEXT_TRY(mState.onProgramExecutableChange(this, programObject));
         mStateCache.onProgramExecutableChange(this);
     }
 }
 
 void Context::uniform1ui(GLint location, GLuint v0)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform1uiv(location, 1, &v0);
 }
 
 void Context::uniform2ui(GLint location, GLuint v0, GLuint v1)
 {
-    Program *program  = mGLState.getProgram();
+    Program *program  = mState.getProgram();
     const GLuint xy[] = {v0, v1};
     program->setUniform2uiv(location, 1, xy);
 }
 
 void Context::uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
 {
-    Program *program   = mGLState.getProgram();
+    Program *program   = mState.getProgram();
     const GLuint xyz[] = {v0, v1, v2};
     program->setUniform3uiv(location, 1, xyz);
 }
 
 void Context::uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
 {
-    Program *program    = mGLState.getProgram();
+    Program *program    = mState.getProgram();
     const GLuint xyzw[] = {v0, v1, v2, v3};
     program->setUniform4uiv(location, 1, xyzw);
 }
 
 void Context::uniform1uiv(GLint location, GLsizei count, const GLuint *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform1uiv(location, count, value);
 }
 void Context::uniform2uiv(GLint location, GLsizei count, const GLuint *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform2uiv(location, count, value);
 }
 
 void Context::uniform3uiv(GLint location, GLsizei count, const GLuint *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform3uiv(location, count, value);
 }
 
 void Context::uniform4uiv(GLint location, GLsizei count, const GLuint *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniform4uiv(location, count, value);
 }
 
@@ -6225,7 +6235,7 @@
                                  GLboolean transpose,
                                  const GLfloat *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniformMatrix2x3fv(location, count, transpose, value);
 }
 
@@ -6234,7 +6244,7 @@
                                  GLboolean transpose,
                                  const GLfloat *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniformMatrix3x2fv(location, count, transpose, value);
 }
 
@@ -6243,7 +6253,7 @@
                                  GLboolean transpose,
                                  const GLfloat *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniformMatrix2x4fv(location, count, transpose, value);
 }
 
@@ -6252,7 +6262,7 @@
                                  GLboolean transpose,
                                  const GLfloat *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniformMatrix4x2fv(location, count, transpose, value);
 }
 
@@ -6261,7 +6271,7 @@
                                  GLboolean transpose,
                                  const GLfloat *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniformMatrix3x4fv(location, count, transpose, value);
 }
 
@@ -6270,7 +6280,7 @@
                                  GLboolean transpose,
                                  const GLfloat *value)
 {
-    Program *program = mGLState.getProgram();
+    Program *program = mState.getProgram();
     program->setUniformMatrix4x3fv(location, count, transpose, value);
 }
 
@@ -6320,7 +6330,7 @@
 
 void Context::endTransformFeedback()
 {
-    TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
+    TransformFeedback *transformFeedback = mState.getCurrentTransformFeedback();
     ANGLE_CONTEXT_TRY(transformFeedback->end(this));
     mStateCache.onActiveTransformFeedbackChange(this);
 }
@@ -6397,14 +6407,14 @@
 
 void Context::pauseTransformFeedback()
 {
-    TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
+    TransformFeedback *transformFeedback = mState.getCurrentTransformFeedback();
     ANGLE_CONTEXT_TRY(transformFeedback->pause(this));
     mStateCache.onActiveTransformFeedbackChange(this);
 }
 
 void Context::resumeTransformFeedback()
 {
-    TransformFeedback *transformFeedback = mGLState.getCurrentTransformFeedback();
+    TransformFeedback *transformFeedback = mState.getCurrentTransformFeedback();
     ANGLE_CONTEXT_TRY(transformFeedback->resume(this));
     mStateCache.onActiveTransformFeedbackChange(this);
 }
@@ -6511,14 +6521,14 @@
     // Note: If the Program is shared between Contexts we would be better using Observer/Subject.
     if (programObject->isInUse())
     {
-        mGLState.setObjectDirty(GL_PROGRAM);
+        mState.setObjectDirty(GL_PROGRAM);
         mStateCache.onUniformBufferStateChange(this);
     }
 }
 
 GLsync Context::fenceSync(GLenum condition, GLbitfield flags)
 {
-    GLuint handle     = mState.mSyncs->createSync(mImplementation.get());
+    GLuint handle     = mState.mSyncManager->createSync(mImplementation.get());
     GLsync syncHandle = reinterpret_cast<GLsync>(static_cast<uintptr_t>(handle));
 
     Sync *syncObject = getSync(syncHandle);
@@ -6577,7 +6587,7 @@
 
 void Context::getBufferParameteri64v(BufferBinding target, GLenum pname, GLint64 *params)
 {
-    Buffer *buffer = mGLState.getTargetBuffer(target);
+    Buffer *buffer = mState.getTargetBuffer(target);
     QueryBufferParameteri64v(buffer, pname, params);
 }
 
@@ -6594,7 +6604,7 @@
 {
     for (int i = 0; i < count; i++)
     {
-        samplers[i] = mState.mSamplers->createSampler();
+        samplers[i] = mState.mSamplerManager->createSampler();
     }
 }
 
@@ -6604,12 +6614,12 @@
     {
         GLuint sampler = samplers[i];
 
-        if (mState.mSamplers->getSampler(sampler))
+        if (mState.mSamplerManager->getSampler(sampler))
         {
             detachSampler(sampler);
         }
 
-        mState.mSamplers->deleteObject(this, sampler);
+        mState.mSamplerManager->deleteObject(this, sampler);
     }
 }
 
@@ -6619,7 +6629,7 @@
                                   GLsizei bufSize,
                                   GLint *params)
 {
-    const TextureCaps &formatCaps = mTextureCaps.get(internalformat);
+    const TextureCaps &formatCaps = mState.mTextureCaps.get(internalformat);
     QueryInternalFormativ(formatCaps, pname, bufSize, params);
 }
 
@@ -6902,7 +6912,7 @@
 
 bool Context::isCurrentTransformFeedback(const TransformFeedback *tf) const
 {
-    return mGLState.isCurrentTransformFeedback(tf);
+    return mState.isCurrentTransformFeedback(tf);
 }
 
 void Context::genProgramPipelines(GLsizei count, GLuint *pipelines)
@@ -7090,7 +7100,7 @@
 
 void Context::eGLImageTargetRenderbufferStorage(GLenum target, GLeglImageOES image)
 {
-    Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
+    Renderbuffer *renderbuffer = mState.getCurrentRenderbuffer();
     egl::Image *imageObject    = static_cast<egl::Image *>(image);
     ANGLE_CONTEXT_TRY(renderbuffer->setStorageEGLImageTarget(this, imageObject));
 }
@@ -7903,27 +7913,27 @@
 
 Program *Context::getProgramNoResolveLink(GLuint handle) const
 {
-    return mState.mShaderPrograms->getProgram(handle);
+    return mState.mShaderProgramManager->getProgram(handle);
 }
 
 Shader *Context::getShader(GLuint handle) const
 {
-    return mState.mShaderPrograms->getShader(handle);
+    return mState.mShaderProgramManager->getShader(handle);
 }
 
 bool Context::isRenderbufferGenerated(GLuint renderbuffer) const
 {
-    return mState.mRenderbuffers->isHandleGenerated(renderbuffer);
+    return mState.mRenderbufferManager->isHandleGenerated(renderbuffer);
 }
 
 bool Context::isFramebufferGenerated(GLuint framebuffer) const
 {
-    return mState.mFramebuffers->isHandleGenerated(framebuffer);
+    return mState.mFramebufferManager->isHandleGenerated(framebuffer);
 }
 
 bool Context::isProgramPipelineGenerated(GLuint pipeline) const
 {
-    return mState.mPipelines->isHandleGenerated(pipeline);
+    return mState.mProgramPipelineManager->isHandleGenerated(pipeline);
 }
 
 bool Context::usingDisplayTextureShareGroup() const
@@ -7941,8 +7951,8 @@
 
 void Context::maxShaderCompilerThreads(GLuint count)
 {
-    GLuint oldCount = mGLState.getMaxShaderCompilerThreads();
-    mGLState.setMaxShaderCompilerThreads(count);
+    GLuint oldCount = mState.getMaxShaderCompilerThreads();
+    mState.setMaxShaderCompilerThreads(count);
     // A count of zero specifies a request for no parallel compiling or linking.
     if ((oldCount == 0 || count == 0) && (oldCount != 0 || count != 0))
     {
@@ -7966,7 +7976,7 @@
             switch (message)
             {
                 case angle::SubjectMessage::CONTENTS_CHANGED:
-                    mGLState.setObjectDirty(GL_VERTEX_ARRAY);
+                    mState.setObjectDirty(GL_VERTEX_ARRAY);
                     mStateCache.onVertexArrayBufferContentsChange(this);
                     break;
                 case angle::SubjectMessage::RESOURCE_MAPPED:
@@ -7982,14 +7992,14 @@
         case kReadFramebufferSubjectIndex:
             if (message == angle::SubjectMessage::STORAGE_CHANGED)
             {
-                mGLState.setObjectDirty(GL_READ_FRAMEBUFFER);
+                mState.setObjectDirty(GL_READ_FRAMEBUFFER);
             }
             break;
 
         case kDrawFramebufferSubjectIndex:
             if (message == angle::SubjectMessage::STORAGE_CHANGED)
             {
-                mGLState.setDrawFramebufferDirty();
+                mState.setDrawFramebufferDirty();
             }
             mStateCache.onDrawFramebufferChange(this);
             break;
@@ -7997,18 +8007,18 @@
         default:
             if (index < kTextureMaxSubjectIndex)
             {
-                mGLState.onActiveTextureStateChange(this, index);
+                mState.onActiveTextureStateChange(this, index);
                 mStateCache.onActiveTextureChange(this);
             }
             else if (index < kUniformBufferMaxSubjectIndex)
             {
-                mGLState.onUniformBufferStateChange(index - kUniformBuffer0SubjectIndex);
+                mState.onUniformBufferStateChange(index - kUniformBuffer0SubjectIndex);
                 mStateCache.onUniformBufferStateChange(this);
             }
             else
             {
                 ASSERT(index < kSamplerMaxSubjectIndex);
-                mGLState.setSamplerDirty(index - kSampler0SubjectIndex);
+                mState.setSamplerDirty(index - kSampler0SubjectIndex);
             }
             break;
     }
@@ -8048,8 +8058,8 @@
     ASSERT(errorCode != GL_NO_ERROR);
     mErrors.insert(errorCode);
 
-    mContext->getGLState().getDebug().insertMessage(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR,
-                                                    errorCode, GL_DEBUG_SEVERITY_HIGH, message);
+    mContext->getState().getDebug().insertMessage(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_ERROR,
+                                                  errorCode, GL_DEBUG_SEVERITY_HIGH, message);
 }
 
 bool ErrorSet::empty() const
@@ -8089,7 +8099,7 @@
 void StateCache::updateActiveAttribsMask(Context *context)
 {
     bool isGLES1         = context->isGLES1();
-    const State &glState = context->getGLState();
+    const State &glState = context->getState();
 
     if (!isGLES1 && !glState.getProgram())
     {
@@ -8117,7 +8127,7 @@
 
 void StateCache::updateVertexElementLimits(Context *context)
 {
-    const VertexArray *vao = context->getGLState().getVertexArray();
+    const VertexArray *vao = context->getState().getVertexArray();
 
     mCachedNonInstancedVertexElementLimit = std::numeric_limits<GLint64>::max();
     mCachedInstancedVertexElementLimit    = std::numeric_limits<GLint64>::max();
@@ -8139,7 +8149,7 @@
 
         const VertexBinding &binding = vertexBindings[attrib.bindingIndex];
         ASSERT(context->isGLES1() ||
-               context->getGLState().getProgram()->isAttribLocationActive(attributeIndex));
+               context->getState().getProgram()->isAttribLocationActive(attributeIndex));
 
         GLint64 limit = attrib.getCachedElementLimit();
         if (binding.getDivisor() > 0)
@@ -8287,7 +8297,7 @@
 
 void StateCache::updateValidDrawModes(Context *context)
 {
-    const State &state = context->getGLState();
+    const State &state = context->getState();
     Program *program   = state.getProgram();
 
     if (mCachedTransformFeedbackActiveUnpaused)
@@ -8373,7 +8383,7 @@
 
 void StateCache::updateTransformFeedbackActiveUnpaused(Context *context)
 {
-    TransformFeedback *xfb                 = context->getGLState().getCurrentTransformFeedback();
+    TransformFeedback *xfb                 = context->getState().getCurrentTransformFeedback();
     mCachedTransformFeedbackActiveUnpaused = xfb && xfb->isActive() && !xfb->isPaused();
 }
 }  // namespace gl