Context: Remove mutable gl::State getter.
This will preserve layering - the API layer doesn't mutate the state
directly, it passes the API call through to the Context. Is also
removes the possiblity of any shenanigans of the Validation layer
changing the GL state.
Also, this CL refactors a few validation entry points to take
ValidationContext instead of Context. ValidationContext will be the
correct way to interact with the gl::Context in the Validation code.
Finally, additional refactorings make ContextState a proper class with
private data. This allows the ContextState itself to keep a mutable
pointer to the gl::State, so ValidationContext can modify it if
necessary (and it will be necessary for Framebuffer completeness
caching).
BUG=angleproject:1388
Change-Id: I86ab3561573caa9535c8d1b8aad4ab3d0e7cd470
Reviewed-on: https://chromium-review.googlesource.com/348954
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
index 634f345..19ad6f4 100644
--- a/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
+++ b/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
@@ -97,7 +97,7 @@
gl::Error FramebufferD3D::clear(ContextImpl *context, GLbitfield mask)
{
- ClearParameters clearParams = GetClearParameters(context->getState(), mask);
+ ClearParameters clearParams = GetClearParameters(context->getGLState(), mask);
return clearImpl(context, clearParams);
}
@@ -107,7 +107,7 @@
const GLfloat *values)
{
// glClearBufferfv can be called to clear the color buffer or depth buffer
- ClearParameters clearParams = GetClearParameters(context->getState(), 0);
+ ClearParameters clearParams = GetClearParameters(context->getGLState(), 0);
if (buffer == GL_COLOR)
{
@@ -134,7 +134,7 @@
const GLuint *values)
{
// glClearBufferuiv can only be called to clear a color buffer
- ClearParameters clearParams = GetClearParameters(context->getState(), 0);
+ ClearParameters clearParams = GetClearParameters(context->getGLState(), 0);
for (unsigned int i = 0; i < ArraySize(clearParams.clearColor); i++)
{
clearParams.clearColor[i] = (drawbuffer == static_cast<int>(i));
@@ -151,7 +151,7 @@
const GLint *values)
{
// glClearBufferiv can be called to clear the color buffer or stencil buffer
- ClearParameters clearParams = GetClearParameters(context->getState(), 0);
+ ClearParameters clearParams = GetClearParameters(context->getGLState(), 0);
if (buffer == GL_COLOR)
{
@@ -179,7 +179,7 @@
GLint stencil)
{
// glClearBufferfi can only be called to clear a depth stencil buffer
- ClearParameters clearParams = GetClearParameters(context->getState(), 0);
+ ClearParameters clearParams = GetClearParameters(context->getGLState(), 0);
clearParams.clearDepth = true;
clearParams.depthClearValue = depth;
clearParams.clearStencil = true;
@@ -238,7 +238,7 @@
GLenum type,
GLvoid *pixels) const
{
- const gl::PixelPackState &packState = context->getState().getPackState();
+ const gl::PixelPackState &packState = context->getGLState().getPackState();
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(format, type);
const gl::InternalFormat &sizedFormatInfo = gl::GetInternalFormatInfo(sizedInternalFormat);
@@ -259,7 +259,7 @@
GLbitfield mask,
GLenum filter)
{
- const auto &glState = context->getState();
+ const auto &glState = context->getGLState();
const gl::Framebuffer *sourceFramebuffer = glState.getReadFramebuffer();
bool blitRenderTarget = false;
if ((mask & GL_COLOR_BUFFER_BIT) && sourceFramebuffer->getReadColorbuffer() != nullptr &&