Make Framebuffer::checkStatus non-const.
BUG=angleproject:1388
Change-Id: Ia9befba0c915c087f2fe0557d91060256f6d4950
Reviewed-on: https://chromium-review.googlesource.com/348955
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
index 52c5e5b..f96ad6d 100644
--- a/src/libANGLE/validationES.cpp
+++ b/src/libANGLE/validationES.cpp
@@ -662,9 +662,9 @@
return false;
}
- const auto &glState = context->getGLState();
- const gl::Framebuffer *readFramebuffer = glState.getReadFramebuffer();
- const gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
+ const auto &glState = context->getGLState();
+ gl::Framebuffer *readFramebuffer = glState.getReadFramebuffer();
+ gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
if (!readFramebuffer || !drawFramebuffer)
{
@@ -678,13 +678,13 @@
return false;
}
- if (!readFramebuffer->checkStatus(context->getContextState()))
+ if (readFramebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false;
}
- if (!drawFramebuffer->checkStatus(context->getContextState()))
+ if (drawFramebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false;
@@ -1085,22 +1085,22 @@
return false;
}
- const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer();
- ASSERT(framebuffer);
+ auto readFramebuffer = context->getGLState().getReadFramebuffer();
- if (framebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
+ if (readFramebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false;
}
- if (context->getGLState().getReadFramebuffer()->id() != 0 &&
- framebuffer->getSamples(context->getContextState()) != 0)
+ if (readFramebuffer->id() != 0 && readFramebuffer->getSamples(context->getContextState()) != 0)
{
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
+ const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer();
+ ASSERT(framebuffer);
const FramebufferAttachment *readBuffer = framebuffer->getReadColorbuffer();
if (!readBuffer)
{
@@ -1587,14 +1587,15 @@
case GL_IMPLEMENTATION_COLOR_READ_TYPE:
case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
{
- const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer();
- ASSERT(framebuffer);
- if (framebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
+ if (context->getGLState().getReadFramebuffer()->checkStatus(
+ context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
+ const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer();
+ ASSERT(framebuffer);
const FramebufferAttachment *attachment = framebuffer->getReadColorbuffer();
if (!attachment)
{
@@ -1656,16 +1657,15 @@
return false;
}
- const auto &state = context->getGLState();
- const gl::Framebuffer *framebuffer = state.getReadFramebuffer();
- if (framebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
+ const auto &state = context->getGLState();
+ auto readFramebuffer = state.getReadFramebuffer();
+ if (readFramebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false;
}
- if (state.getReadFramebuffer()->id() != 0 &&
- framebuffer->getSamples(context->getContextState()) != 0)
+ if (readFramebuffer->id() != 0 && readFramebuffer->getSamples(context->getContextState()) != 0)
{
context->handleError(Error(GL_INVALID_OPERATION));
return false;
@@ -1801,9 +1801,9 @@
return false;
}
+ Framebuffer *framebuffer = state.getDrawFramebuffer();
if (context->getLimitations().noSeparateStencilRefsAndMasks)
{
- const Framebuffer *framebuffer = state.getDrawFramebuffer();
const FramebufferAttachment *stencilBuffer = framebuffer->getStencilbuffer();
GLuint stencilBits = stencilBuffer ? stencilBuffer->getStencilSize() : 0;
GLuint minimumRequiredStencilMask = (1 << stencilBits) - 1;
@@ -1824,8 +1824,7 @@
}
}
- const gl::Framebuffer *fbo = state.getDrawFramebuffer();
- if (!fbo || fbo->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
+ if (framebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false;