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/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
index 107cea4..bcc7d76 100644
--- a/src/libANGLE/Framebuffer.cpp
+++ b/src/libANGLE/Framebuffer.cpp
@@ -246,14 +246,14 @@
switch (buffer)
{
case GL_COLOR:
- return IsColorMaskedOut(context->getGLState().getBlendState());
+ return IsColorMaskedOut(context->getState().getBlendState());
case GL_DEPTH:
- return IsDepthMaskedOut(context->getGLState().getDepthStencilState());
+ return IsDepthMaskedOut(context->getState().getDepthStencilState());
case GL_STENCIL:
- return IsStencilMaskedOut(context->getGLState().getDepthStencilState());
+ return IsStencilMaskedOut(context->getState().getDepthStencilState());
case GL_DEPTH_STENCIL:
- return IsDepthMaskedOut(context->getGLState().getDepthStencilState()) &&
- IsStencilMaskedOut(context->getGLState().getDepthStencilState());
+ return IsDepthMaskedOut(context->getState().getDepthStencilState()) &&
+ IsStencilMaskedOut(context->getState().getDepthStencilState());
default:
UNREACHABLE();
return true;
@@ -1004,7 +1004,7 @@
GLenum Framebuffer::checkStatusWithGLFrontEnd(const Context *context)
{
- const ContextState &state = context->getContextState();
+ const State &state = context->getState();
ASSERT(mState.mId != 0);
@@ -1292,7 +1292,7 @@
bool depth,
bool stencil)
{
- const auto &glState = context->getGLState();
+ const auto &glState = context->getState();
if (!glState.isRobustResourceInitEnabled())
{
@@ -1342,7 +1342,7 @@
angle::Result Framebuffer::clear(const Context *context, GLbitfield mask)
{
- const auto &glState = context->getGLState();
+ const auto &glState = context->getState();
if (glState.isRasterizerDiscardEnabled())
{
return angle::Result::Continue;
@@ -1358,8 +1358,7 @@
GLint drawbuffer,
const GLfloat *values)
{
- if (context->getGLState().isRasterizerDiscardEnabled() ||
- IsClearBufferMaskedOut(context, buffer))
+ if (context->getState().isRasterizerDiscardEnabled() || IsClearBufferMaskedOut(context, buffer))
{
return angle::Result::Continue;
}
@@ -1374,8 +1373,7 @@
GLint drawbuffer,
const GLuint *values)
{
- if (context->getGLState().isRasterizerDiscardEnabled() ||
- IsClearBufferMaskedOut(context, buffer))
+ if (context->getState().isRasterizerDiscardEnabled() || IsClearBufferMaskedOut(context, buffer))
{
return angle::Result::Continue;
}
@@ -1390,8 +1388,7 @@
GLint drawbuffer,
const GLint *values)
{
- if (context->getGLState().isRasterizerDiscardEnabled() ||
- IsClearBufferMaskedOut(context, buffer))
+ if (context->getState().isRasterizerDiscardEnabled() || IsClearBufferMaskedOut(context, buffer))
{
return angle::Result::Continue;
}
@@ -1407,8 +1404,7 @@
GLfloat depth,
GLint stencil)
{
- if (context->getGLState().isRasterizerDiscardEnabled() ||
- IsClearBufferMaskedOut(context, buffer))
+ if (context->getState().isRasterizerDiscardEnabled() || IsClearBufferMaskedOut(context, buffer))
{
return angle::Result::Continue;
}
@@ -1442,7 +1438,7 @@
ANGLE_TRY(ensureReadAttachmentInitialized(context, GL_COLOR_BUFFER_BIT));
ANGLE_TRY(mImpl->readPixels(context, area, format, type, pixels));
- Buffer *unpackBuffer = context->getGLState().getTargetBuffer(BufferBinding::PixelUnpack);
+ Buffer *unpackBuffer = context->getState().getTargetBuffer(BufferBinding::PixelUnpack);
if (unpackBuffer)
{
unpackBuffer->onPixelPack(context);
@@ -1481,7 +1477,7 @@
return angle::Result::Continue;
}
- auto *sourceFBO = context->getGLState().getReadFramebuffer();
+ auto *sourceFBO = context->getState().getReadFramebuffer();
ANGLE_TRY(sourceFBO->ensureReadAttachmentInitialized(context, blitMask));
// TODO(jmadill): Only clear if not the full FBO dimensions, and only specified bitmask.
@@ -2014,7 +2010,7 @@
angle::Result Framebuffer::ensureClearAttachmentsInitialized(const Context *context,
GLbitfield mask)
{
- const auto &glState = context->getGLState();
+ const auto &glState = context->getState();
if (!context->isRobustResourceInitEnabled() || glState.isRasterizerDiscardEnabled())
{
return angle::Result::Continue;
@@ -2050,8 +2046,7 @@
GLint drawbuffer)
{
if (!context->isRobustResourceInitEnabled() ||
- context->getGLState().isRasterizerDiscardEnabled() ||
- IsClearBufferMaskedOut(context, buffer))
+ context->getState().isRasterizerDiscardEnabled() || IsClearBufferMaskedOut(context, buffer))
{
return angle::Result::Continue;
}