Commit 51f40ecd by Jamie Madill Committed by Commit Bot

Make Framebuffer::checkStatus non-const.

BUG=angleproject:1388 Change-Id: Ia9befba0c915c087f2fe0557d91060256f6d4950 Reviewed-on: https://chromium-review.googlesource.com/348955Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent a9d60da8
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
// Data.cpp: Container class for all GL relevant state, caps and objects // Data.cpp: Container class for all GL relevant state, caps and objects
#include "libANGLE/ContextState.h" #include "libANGLE/ContextState.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/ResourceManager.h" #include "libANGLE/ResourceManager.h"
namespace gl namespace gl
......
...@@ -388,7 +388,7 @@ bool Framebuffer::usingExtendedDrawBuffers() const ...@@ -388,7 +388,7 @@ bool Framebuffer::usingExtendedDrawBuffers() const
return false; return false;
} }
GLenum Framebuffer::checkStatus(const ContextState &state) const GLenum Framebuffer::checkStatus(const ContextState &state)
{ {
// The default framebuffer *must* always be complete, though it may not be // The default framebuffer *must* always be complete, though it may not be
// subject to the same rules as application FBOs. ie, it could have 0x0 size. // subject to the same rules as application FBOs. ie, it could have 0x0 size.
...@@ -743,7 +743,7 @@ Error Framebuffer::blit(rx::ContextImpl *context, ...@@ -743,7 +743,7 @@ Error Framebuffer::blit(rx::ContextImpl *context,
return mImpl->blit(context, sourceArea, destArea, mask, filter); return mImpl->blit(context, sourceArea, destArea, mask, filter);
} }
int Framebuffer::getSamples(const ContextState &state) const int Framebuffer::getSamples(const ContextState &state)
{ {
if (checkStatus(state) == GL_FRAMEBUFFER_COMPLETE) if (checkStatus(state) == GL_FRAMEBUFFER_COMPLETE)
{ {
...@@ -836,4 +836,18 @@ void Framebuffer::syncState() const ...@@ -836,4 +836,18 @@ void Framebuffer::syncState() const
} }
} }
int Framebuffer::getCachedSamples(const ContextState &state) const
{
// TODO(jmadill): Framebuffer samples caching.
ASSERT(mDirtyBits.none());
return const_cast<Framebuffer *>(this)->getSamples(state);
}
GLenum Framebuffer::getCachedStatus(const ContextState &state) const
{
// TODO(jmadill): Framebuffer status caching.
ASSERT(mDirtyBits.none());
return const_cast<Framebuffer *>(this)->checkStatus(state);
}
} // namespace gl } // namespace gl
...@@ -96,8 +96,7 @@ class Framebuffer final : public LabeledObject ...@@ -96,8 +96,7 @@ class Framebuffer final : public LabeledObject
void setLabel(const std::string &label) override; void setLabel(const std::string &label) override;
const std::string &getLabel() const override; const std::string &getLabel() const override;
const rx::FramebufferImpl *getImplementation() const { return mImpl; } rx::FramebufferImpl *getImplementation() const { return mImpl; }
rx::FramebufferImpl *getImplementation() { return mImpl; }
GLuint id() const { return mId; } GLuint id() const { return mId; }
...@@ -134,10 +133,18 @@ class Framebuffer final : public LabeledObject ...@@ -134,10 +133,18 @@ class Framebuffer final : public LabeledObject
size_t getNumColorBuffers() const; size_t getNumColorBuffers() const;
bool hasDepth() const; bool hasDepth() const;
bool hasStencil() const; bool hasStencil() const;
int getSamples(const ContextState &state) const;
bool usingExtendedDrawBuffers() const; bool usingExtendedDrawBuffers() const;
GLenum checkStatus(const ContextState &state) const; // This method calls checkStatus.
int getSamples(const ContextState &state);
GLenum checkStatus(const ContextState &state);
// These methods do not change any state.
// TODO(jmadill): Remove ContextState parameter when able.
int getCachedSamples(const ContextState &state) const;
GLenum getCachedStatus(const ContextState &state) const;
bool hasValidDepthStencil() const; bool hasValidDepthStencil() const;
Error discard(size_t count, const GLenum *attachments); Error discard(size_t count, const GLenum *attachments);
......
...@@ -889,22 +889,12 @@ Framebuffer *State::getTargetFramebuffer(GLenum target) const ...@@ -889,22 +889,12 @@ Framebuffer *State::getTargetFramebuffer(GLenum target) const
} }
} }
Framebuffer *State::getReadFramebuffer() Framebuffer *State::getReadFramebuffer() const
{ {
return mReadFramebuffer; return mReadFramebuffer;
} }
Framebuffer *State::getDrawFramebuffer() Framebuffer *State::getDrawFramebuffer() const
{
return mDrawFramebuffer;
}
const Framebuffer *State::getReadFramebuffer() const
{
return mReadFramebuffer;
}
const Framebuffer *State::getDrawFramebuffer() const
{ {
return mDrawFramebuffer; return mDrawFramebuffer;
} }
......
...@@ -176,10 +176,8 @@ class State : angle::NonCopyable ...@@ -176,10 +176,8 @@ class State : angle::NonCopyable
void setReadFramebufferBinding(Framebuffer *framebuffer); void setReadFramebufferBinding(Framebuffer *framebuffer);
void setDrawFramebufferBinding(Framebuffer *framebuffer); void setDrawFramebufferBinding(Framebuffer *framebuffer);
Framebuffer *getTargetFramebuffer(GLenum target) const; Framebuffer *getTargetFramebuffer(GLenum target) const;
Framebuffer *getReadFramebuffer(); Framebuffer *getReadFramebuffer() const;
Framebuffer *getDrawFramebuffer(); Framebuffer *getDrawFramebuffer() const;
const Framebuffer *getReadFramebuffer() const;
const Framebuffer *getDrawFramebuffer() const;
bool removeReadFramebufferBinding(GLuint framebuffer); bool removeReadFramebufferBinding(GLuint framebuffer);
bool removeDrawFramebufferBinding(GLuint framebuffer); bool removeDrawFramebufferBinding(GLuint framebuffer);
......
...@@ -531,10 +531,9 @@ bool Framebuffer11::hasAnyInternalDirtyBit() const ...@@ -531,10 +531,9 @@ bool Framebuffer11::hasAnyInternalDirtyBit() const
return mInternalDirtyBits.any(); return mInternalDirtyBits.any();
} }
void Framebuffer11::syncInternalState() const void Framebuffer11::syncInternalState()
{ {
// TODO(jmadill): Clean up this hack. syncState(gl::Framebuffer::DirtyBits());
const_cast<Framebuffer11 *>(this)->syncState(gl::Framebuffer::DirtyBits());
} }
} // namespace rx } // namespace rx
...@@ -42,8 +42,7 @@ class Framebuffer11 : public FramebufferD3D, public angle::SignalReceiver ...@@ -42,8 +42,7 @@ class Framebuffer11 : public FramebufferD3D, public angle::SignalReceiver
} }
bool hasAnyInternalDirtyBit() const; bool hasAnyInternalDirtyBit() const;
// TODO(jmadill): make this non-const void syncInternalState();
void syncInternalState() const;
void signal(angle::SignalToken token) override; void signal(angle::SignalToken token) override;
......
...@@ -1498,8 +1498,9 @@ gl::Error Renderer11::updateState(const gl::ContextState &data, GLenum drawMode) ...@@ -1498,8 +1498,9 @@ gl::Error Renderer11::updateState(const gl::ContextState &data, GLenum drawMode)
// Applies the render target surface, depth stencil surface, viewport rectangle and // Applies the render target surface, depth stencil surface, viewport rectangle and
// scissor rectangle to the renderer // scissor rectangle to the renderer
const gl::Framebuffer *framebufferObject = glState.getDrawFramebuffer(); gl::Framebuffer *framebufferObject = glState.getDrawFramebuffer();
ASSERT(framebufferObject && framebufferObject->checkStatus(data) == GL_FRAMEBUFFER_COMPLETE); ASSERT(framebufferObject &&
framebufferObject->getCachedStatus(data) == GL_FRAMEBUFFER_COMPLETE);
ANGLE_TRY(applyRenderTarget(framebufferObject)); ANGLE_TRY(applyRenderTarget(framebufferObject));
// Set the present path state // Set the present path state
...@@ -1516,7 +1517,7 @@ gl::Error Renderer11::updateState(const gl::ContextState &data, GLenum drawMode) ...@@ -1516,7 +1517,7 @@ gl::Error Renderer11::updateState(const gl::ContextState &data, GLenum drawMode)
mStateManager.setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled()); mStateManager.setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
// Applying rasterizer state to D3D11 device // Applying rasterizer state to D3D11 device
int samples = framebufferObject->getSamples(data); int samples = framebufferObject->getCachedSamples(data);
gl::RasterizerState rasterizer = glState.getRasterizerState(); gl::RasterizerState rasterizer = glState.getRasterizerState();
rasterizer.pointDrawMode = (drawMode == GL_POINTS); rasterizer.pointDrawMode = (drawMode == GL_POINTS);
rasterizer.multiSample = (samples != 0); rasterizer.multiSample = (samples != 0);
...@@ -1572,7 +1573,7 @@ bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSi ...@@ -1572,7 +1573,7 @@ bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSi
return count >= minCount; return count >= minCount;
} }
gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer) gl::Error Renderer11::applyRenderTarget(gl::Framebuffer *framebuffer)
{ {
return mStateManager.syncFramebuffer(framebuffer); return mStateManager.syncFramebuffer(framebuffer);
} }
......
...@@ -136,7 +136,7 @@ class Renderer11 : public RendererD3D ...@@ -136,7 +136,7 @@ class Renderer11 : public RendererD3D
gl::Error updateState(const gl::ContextState &data, GLenum drawMode); gl::Error updateState(const gl::ContextState &data, GLenum drawMode);
bool applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSize); bool applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSize);
gl::Error applyRenderTarget(const gl::Framebuffer *frameBuffer); gl::Error applyRenderTarget(gl::Framebuffer *frameBuffer);
gl::Error applyUniforms(const ProgramD3D &programD3D, gl::Error applyUniforms(const ProgramD3D &programD3D,
GLenum drawMode, GLenum drawMode,
const std::vector<D3DUniform *> &uniformArray) override; const std::vector<D3DUniform *> &uniformArray) override;
......
...@@ -981,9 +981,9 @@ void StateManager11::deinitialize() ...@@ -981,9 +981,9 @@ void StateManager11::deinitialize()
mCurrentValueAttribs.clear(); mCurrentValueAttribs.clear();
} }
gl::Error StateManager11::syncFramebuffer(const gl::Framebuffer *framebuffer) gl::Error StateManager11::syncFramebuffer(gl::Framebuffer *framebuffer)
{ {
const Framebuffer11 *framebuffer11 = GetImplAs<Framebuffer11>(framebuffer); Framebuffer11 *framebuffer11 = GetImplAs<Framebuffer11>(framebuffer);
gl::Error error = framebuffer11->invalidateSwizzles(); gl::Error error = framebuffer11->invalidateSwizzles();
if (error.isError()) if (error.isError())
{ {
......
...@@ -77,7 +77,7 @@ class StateManager11 final : angle::NonCopyable ...@@ -77,7 +77,7 @@ class StateManager11 final : angle::NonCopyable
ID3D11ShaderResourceView *srv); ID3D11ShaderResourceView *srv);
gl::Error clearTextures(gl::SamplerType samplerType, size_t rangeStart, size_t rangeEnd); gl::Error clearTextures(gl::SamplerType samplerType, size_t rangeStart, size_t rangeEnd);
gl::Error syncFramebuffer(const gl::Framebuffer *framebuffer); gl::Error syncFramebuffer(gl::Framebuffer *framebuffer);
void invalidateRenderTarget(); void invalidateRenderTarget();
void invalidateBoundViews(); void invalidateBoundViews();
......
...@@ -894,7 +894,8 @@ gl::Error Renderer9::updateState(Context9 *context, GLenum drawMode) ...@@ -894,7 +894,8 @@ gl::Error Renderer9::updateState(Context9 *context, GLenum drawMode)
// Applies the render target surface, depth stencil surface, viewport rectangle and // Applies the render target surface, depth stencil surface, viewport rectangle and
// scissor rectangle to the renderer // scissor rectangle to the renderer
const gl::Framebuffer *framebufferObject = glState.getDrawFramebuffer(); const gl::Framebuffer *framebufferObject = glState.getDrawFramebuffer();
ASSERT(framebufferObject && framebufferObject->checkStatus(data) == GL_FRAMEBUFFER_COMPLETE); ASSERT(framebufferObject &&
framebufferObject->getCachedStatus(data) == GL_FRAMEBUFFER_COMPLETE);
ANGLE_TRY(applyRenderTarget(context, framebufferObject)); ANGLE_TRY(applyRenderTarget(context, framebufferObject));
...@@ -906,7 +907,7 @@ gl::Error Renderer9::updateState(Context9 *context, GLenum drawMode) ...@@ -906,7 +907,7 @@ gl::Error Renderer9::updateState(Context9 *context, GLenum drawMode)
setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled()); setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
// Setting blend, depth stencil, and rasterizer states // Setting blend, depth stencil, and rasterizer states
int samples = framebufferObject->getSamples(data); int samples = framebufferObject->getCachedSamples(data);
gl::RasterizerState rasterizer = glState.getRasterizerState(); gl::RasterizerState rasterizer = glState.getRasterizerState();
rasterizer.pointDrawMode = (drawMode == GL_POINTS); rasterizer.pointDrawMode = (drawMode == GL_POINTS);
rasterizer.multiSample = (samples != 0); rasterizer.multiSample = (samples != 0);
...@@ -927,7 +928,7 @@ void Renderer9::setScissorRectangle(const gl::Rectangle &scissor, bool enabled) ...@@ -927,7 +928,7 @@ void Renderer9::setScissorRectangle(const gl::Rectangle &scissor, bool enabled)
gl::Error Renderer9::setBlendDepthRasterStates(const gl::ContextState &glData, GLenum drawMode) gl::Error Renderer9::setBlendDepthRasterStates(const gl::ContextState &glData, GLenum drawMode)
{ {
const auto &glState = glData.getState(); const auto &glState = glData.getState();
int samples = glState.getDrawFramebuffer()->getSamples(glData); int samples = glState.getDrawFramebuffer()->getCachedSamples(glData);
gl::RasterizerState rasterizer = glState.getRasterizerState(); gl::RasterizerState rasterizer = glState.getRasterizerState();
rasterizer.pointDrawMode = (drawMode == GL_POINTS); rasterizer.pointDrawMode = (drawMode == GL_POINTS);
rasterizer.multiSample = (samples != 0); rasterizer.multiSample = (samples != 0);
......
...@@ -662,9 +662,9 @@ bool ValidateBlitFramebufferParameters(ValidationContext *context, ...@@ -662,9 +662,9 @@ bool ValidateBlitFramebufferParameters(ValidationContext *context,
return false; return false;
} }
const auto &glState = context->getGLState(); const auto &glState = context->getGLState();
const gl::Framebuffer *readFramebuffer = glState.getReadFramebuffer(); gl::Framebuffer *readFramebuffer = glState.getReadFramebuffer();
const gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer(); gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
if (!readFramebuffer || !drawFramebuffer) if (!readFramebuffer || !drawFramebuffer)
{ {
...@@ -678,13 +678,13 @@ bool ValidateBlitFramebufferParameters(ValidationContext *context, ...@@ -678,13 +678,13 @@ bool ValidateBlitFramebufferParameters(ValidationContext *context,
return false; return false;
} }
if (!readFramebuffer->checkStatus(context->getContextState())) if (readFramebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{ {
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION)); context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false; return false;
} }
if (!drawFramebuffer->checkStatus(context->getContextState())) if (drawFramebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{ {
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION)); context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false; return false;
...@@ -1085,22 +1085,22 @@ bool ValidateReadPixels(ValidationContext *context, ...@@ -1085,22 +1085,22 @@ bool ValidateReadPixels(ValidationContext *context,
return false; return false;
} }
const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer(); auto readFramebuffer = context->getGLState().getReadFramebuffer();
ASSERT(framebuffer);
if (framebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE) if (readFramebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{ {
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION)); context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false; return false;
} }
if (context->getGLState().getReadFramebuffer()->id() != 0 && if (readFramebuffer->id() != 0 && readFramebuffer->getSamples(context->getContextState()) != 0)
framebuffer->getSamples(context->getContextState()) != 0)
{ {
context->handleError(Error(GL_INVALID_OPERATION)); context->handleError(Error(GL_INVALID_OPERATION));
return false; return false;
} }
const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer();
ASSERT(framebuffer);
const FramebufferAttachment *readBuffer = framebuffer->getReadColorbuffer(); const FramebufferAttachment *readBuffer = framebuffer->getReadColorbuffer();
if (!readBuffer) if (!readBuffer)
{ {
...@@ -1587,14 +1587,15 @@ bool ValidateStateQuery(ValidationContext *context, ...@@ -1587,14 +1587,15 @@ bool ValidateStateQuery(ValidationContext *context,
case GL_IMPLEMENTATION_COLOR_READ_TYPE: case GL_IMPLEMENTATION_COLOR_READ_TYPE:
case GL_IMPLEMENTATION_COLOR_READ_FORMAT: case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
{ {
const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer(); if (context->getGLState().getReadFramebuffer()->checkStatus(
ASSERT(framebuffer); context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
if (framebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{ {
context->handleError(Error(GL_INVALID_OPERATION)); context->handleError(Error(GL_INVALID_OPERATION));
return false; return false;
} }
const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer();
ASSERT(framebuffer);
const FramebufferAttachment *attachment = framebuffer->getReadColorbuffer(); const FramebufferAttachment *attachment = framebuffer->getReadColorbuffer();
if (!attachment) if (!attachment)
{ {
...@@ -1656,16 +1657,15 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context, ...@@ -1656,16 +1657,15 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context,
return false; return false;
} }
const auto &state = context->getGLState(); const auto &state = context->getGLState();
const gl::Framebuffer *framebuffer = state.getReadFramebuffer(); auto readFramebuffer = state.getReadFramebuffer();
if (framebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE) if (readFramebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{ {
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION)); context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false; return false;
} }
if (state.getReadFramebuffer()->id() != 0 && if (readFramebuffer->id() != 0 && readFramebuffer->getSamples(context->getContextState()) != 0)
framebuffer->getSamples(context->getContextState()) != 0)
{ {
context->handleError(Error(GL_INVALID_OPERATION)); context->handleError(Error(GL_INVALID_OPERATION));
return false; return false;
...@@ -1801,9 +1801,9 @@ static bool ValidateDrawBase(ValidationContext *context, ...@@ -1801,9 +1801,9 @@ static bool ValidateDrawBase(ValidationContext *context,
return false; return false;
} }
Framebuffer *framebuffer = state.getDrawFramebuffer();
if (context->getLimitations().noSeparateStencilRefsAndMasks) if (context->getLimitations().noSeparateStencilRefsAndMasks)
{ {
const Framebuffer *framebuffer = state.getDrawFramebuffer();
const FramebufferAttachment *stencilBuffer = framebuffer->getStencilbuffer(); const FramebufferAttachment *stencilBuffer = framebuffer->getStencilbuffer();
GLuint stencilBits = stencilBuffer ? stencilBuffer->getStencilSize() : 0; GLuint stencilBits = stencilBuffer ? stencilBuffer->getStencilSize() : 0;
GLuint minimumRequiredStencilMask = (1 << stencilBits) - 1; GLuint minimumRequiredStencilMask = (1 << stencilBits) - 1;
...@@ -1824,8 +1824,7 @@ static bool ValidateDrawBase(ValidationContext *context, ...@@ -1824,8 +1824,7 @@ static bool ValidateDrawBase(ValidationContext *context,
} }
} }
const gl::Framebuffer *fbo = state.getDrawFramebuffer(); if (framebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
if (!fbo || fbo->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{ {
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION)); context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false; return false;
......
...@@ -1632,8 +1632,8 @@ bool ValidateBlitFramebufferANGLE(Context *context, ...@@ -1632,8 +1632,8 @@ bool ValidateBlitFramebufferANGLE(Context *context,
return false; return false;
} }
const Framebuffer *readFramebuffer = context->getGLState().getReadFramebuffer(); Framebuffer *readFramebuffer = context->getGLState().getReadFramebuffer();
const Framebuffer *drawFramebuffer = context->getGLState().getDrawFramebuffer(); Framebuffer *drawFramebuffer = context->getGLState().getDrawFramebuffer();
if (mask & GL_COLOR_BUFFER_BIT) if (mask & GL_COLOR_BUFFER_BIT)
{ {
...@@ -1676,9 +1676,7 @@ bool ValidateBlitFramebufferANGLE(Context *context, ...@@ -1676,9 +1676,7 @@ bool ValidateBlitFramebufferANGLE(Context *context,
} }
} }
int readSamples = readFramebuffer->getSamples(context->getContextState()); if (readFramebuffer->getSamples(context->getContextState()) != 0 &&
if (readSamples != 0 &&
IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0, IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0,
srcX1, srcY1, dstX0, dstY0, dstX1, dstY1)) srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
{ {
...@@ -1727,10 +1725,8 @@ bool ValidateBlitFramebufferANGLE(Context *context, ...@@ -1727,10 +1725,8 @@ bool ValidateBlitFramebufferANGLE(Context *context,
bool ValidateClear(ValidationContext *context, GLbitfield mask) bool ValidateClear(ValidationContext *context, GLbitfield mask)
{ {
const Framebuffer *framebufferObject = context->getGLState().getDrawFramebuffer(); auto fbo = context->getGLState().getDrawFramebuffer();
ASSERT(framebufferObject); if (fbo->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
if (framebufferObject->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{ {
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION)); context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false; return false;
......
...@@ -891,9 +891,9 @@ bool ValidateES3CopyTexImageParametersBase(ValidationContext *context, ...@@ -891,9 +891,9 @@ bool ValidateES3CopyTexImageParametersBase(ValidationContext *context,
return false; return false;
} }
const auto &state = context->getGLState(); const auto &state = context->getGLState();
const gl::Framebuffer *framebuffer = state.getReadFramebuffer(); gl::Framebuffer *framebuffer = state.getReadFramebuffer();
GLuint readFramebufferID = framebuffer->id(); GLuint readFramebufferID = framebuffer->id();
if (framebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE) if (framebuffer->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE)
{ {
...@@ -1414,8 +1414,8 @@ bool ValidateClearBuffer(ValidationContext *context) ...@@ -1414,8 +1414,8 @@ bool ValidateClearBuffer(ValidationContext *context)
return false; return false;
} }
const gl::Framebuffer *fbo = context->getGLState().getDrawFramebuffer(); if (context->getGLState().getDrawFramebuffer()->checkStatus(context->getContextState()) !=
if (!fbo || fbo->checkStatus(context->getContextState()) != GL_FRAMEBUFFER_COMPLETE) GL_FRAMEBUFFER_COMPLETE)
{ {
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION)); context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment