Commit 2d96b9eb by Jamie Madill

Use GL-like methods for InvalidateFramebuffer calls.

This will faciliate the MANGLE implementation. BUG=angle:732 Change-Id: I0e4d569667e03305c9cca8d7c23154c70fb71eeb Reviewed-on: https://chromium-review.googlesource.com/213854Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org>
parent 400a4418
......@@ -2279,29 +2279,6 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
}
}
void Context::invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
GLint x, GLint y, GLsizei width, GLsizei height)
{
Framebuffer *framebuffer = NULL;
switch (target)
{
case GL_FRAMEBUFFER:
case GL_DRAW_FRAMEBUFFER:
framebuffer = mState.getDrawFramebuffer();
break;
case GL_READ_FRAMEBUFFER:
framebuffer = mState.getReadFramebuffer();
break;
default:
UNREACHABLE();
}
if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE)
{
framebuffer->invalidate(numAttachments, attachments, x, y, width, height);
}
}
void Context::releaseShaderCompiler()
{
mRenderer->releaseShaderCompiler();
......
......@@ -221,9 +221,6 @@ class Context
void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
void invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
GLint x, GLint y, GLsizei width, GLsizei height);
rx::Renderer *getRenderer() { return mRenderer; }
State &getState() { return mState; }
......
......@@ -561,8 +561,14 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_COMPLETE;
}
void Framebuffer::invalidate(GLsizei numAttachments, const GLenum* attachments,
GLint x, GLint y, GLsizei width, GLsizei height)
void Framebuffer::invalidate(const Caps &caps, GLsizei numAttachments, const GLenum *attachments)
{
GLuint maxDimension = caps.maxRenderbufferSize;
invalidateSub(caps, numAttachments, attachments, 0, 0, maxDimension, maxDimension);
}
void Framebuffer::invalidateSub(const Caps &caps, GLsizei numAttachments, const GLenum *attachments,
GLint x, GLint y, GLsizei width, GLsizei height)
{
ASSERT(completeness() == GL_FRAMEBUFFER_COMPLETE);
for (int i = 0; i < numAttachments; ++i)
......@@ -618,8 +624,6 @@ void Framebuffer::invalidate(GLsizei numAttachments, const GLenum* attachments,
}
}
DefaultFramebuffer::DefaultFramebuffer(rx::Renderer *renderer, Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil)
: Framebuffer(renderer, 0)
{
......
......@@ -26,6 +26,7 @@ class Colorbuffer;
class Depthbuffer;
class Stencilbuffer;
class DepthStencilbuffer;
struct Caps;
class Framebuffer
{
......@@ -67,8 +68,9 @@ class Framebuffer
virtual GLenum completeness() const;
bool hasValidDepthStencil() const;
void invalidate(GLsizei numAttachments, const GLenum* attachments,
GLint x, GLint y, GLsizei width, GLsizei height);
void invalidate(const Caps &caps, GLsizei numAttachments, const GLenum *attachments);
void invalidateSub(const Caps &caps, GLsizei numAttachments, const GLenum *attachments,
GLint x, GLint y, GLsizei width, GLsizei height);
protected:
rx::Renderer *mRenderer;
......
......@@ -7990,8 +7990,11 @@ void __stdcall glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, co
return;
}
GLuint maxDimension = context->getCaps().maxRenderbufferSize;
context->invalidateFrameBuffer(target, numAttachments, attachments, 0, 0, maxDimension, maxDimension);
gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE)
{
framebuffer->invalidate(context->getCaps(), numAttachments, attachments);
}
}
}
......@@ -8015,7 +8018,11 @@ void __stdcall glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
return;
}
context->invalidateFrameBuffer(target, numAttachments, attachments, x, y, width, height);
gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target);
if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE)
{
framebuffer->invalidateSub(context->getCaps(), numAttachments, attachments, x, y, width, height);
}
}
}
......
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