Chromium Code Reviews| Index: Source/platform/graphics/gpu/DrawingBuffer.cpp |
| diff --git a/Source/platform/graphics/gpu/DrawingBuffer.cpp b/Source/platform/graphics/gpu/DrawingBuffer.cpp |
| index 007c41bbc667e6ebc322b765ccb90b5195a5beb0..28bbeae22093322dedf1f718d45b891f57f86105 100644 |
| --- a/Source/platform/graphics/gpu/DrawingBuffer.cpp |
| +++ b/Source/platform/graphics/gpu/DrawingBuffer.cpp |
| @@ -123,6 +123,7 @@ DrawingBuffer::DrawingBuffer(PassOwnPtr<WebGraphicsContext3D> context, |
| , m_scissorEnabled(false) |
| , m_texture2DBinding(0) |
| , m_framebufferBinding(0) |
| + , m_readFramebufferBinding(0) |
| , m_activeTextureUnit(GL_TEXTURE0) |
| , m_context(context) |
| , m_extensionsUtil(extensionsUtil) |
| @@ -705,15 +706,16 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size) |
| -void DrawingBuffer::clearFramebuffers(GLbitfield clearMask) |
| +void DrawingBuffer::clearFramebuffers(GLenum target, GLbitfield clearMask) |
|
Zhenyao Mo
2015/06/04 22:08:17
No need for the target, the original code is corre
yunchao
2015/06/09 10:37:55
Acknowledged.
|
| { |
| + ASSERT(target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER); |
| // We will clear the multisample FBO, but we also need to clear the non-multisampled buffer. |
| if (m_multisampleFBO) { |
| - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
| + m_context->bindFramebuffer(target, m_fbo); |
| m_context->clear(GL_COLOR_BUFFER_BIT); |
| } |
| - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO ? m_multisampleFBO : m_fbo); |
| + m_context->bindFramebuffer(target, m_multisampleFBO ? m_multisampleFBO : m_fbo); |
| m_context->clear(clearMask); |
| } |
| @@ -778,11 +780,11 @@ bool DrawingBuffer::reset(const IntSize& newSize) |
| m_context->stencilMaskSeparate(GL_FRONT, 0xFFFFFFFF); |
| } |
| - clearFramebuffers(clearMask); |
| + clearFramebuffers(GL_FRAMEBUFFER, clearMask); |
| return true; |
| } |
| -void DrawingBuffer::commit() |
| +void DrawingBuffer::commit(GLenum target) |
|
Zhenyao Mo
2015/06/04 22:08:17
|target| is not needed.
yunchao
2015/06/09 10:37:55
Acknowledged.
|
| { |
| if (m_multisampleFBO && !m_contentsChangeCommitted) { |
| m_context->bindFramebuffer(GL_READ_FRAMEBUFFER_ANGLE, m_multisampleFBO); |
| @@ -800,17 +802,18 @@ void DrawingBuffer::commit() |
| m_context->enable(GL_SCISSOR_TEST); |
| } |
| - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
| + m_context->bindFramebuffer(target, m_fbo); |
|
Zhenyao Mo
2015/06/04 22:08:17
Instead of calling this directly, you should call
yunchao
2015/06/09 10:37:55
Acknowledged.
|
| m_contentsChangeCommitted = true; |
| } |
| -void DrawingBuffer::restoreFramebufferBinding() |
| +void DrawingBuffer::restoreFramebufferBinding(GLenum target) |
|
Zhenyao Mo
2015/06/04 22:08:17
It should not have a target, but restore both READ
yunchao
2015/06/09 10:37:55
Acknowledged.
|
| { |
| - if (!m_framebufferBinding) { |
| - bind(); |
| + if (((target == GL_FRAMEBUFFER || target == GL_DRAW_FRAMEBUFFER) && !m_framebufferBinding) |
| + || (target == GL_READ_FRAMEBUFFER && !m_readFramebufferBinding)) { |
| + bind(target); |
| return; |
| } |
| - m_context->bindFramebuffer(GL_FRAMEBUFFER, m_framebufferBinding); |
| + m_context->bindFramebuffer(target, target == GL_READ_FRAMEBUFFER ? m_readFramebufferBinding : m_framebufferBinding); |
| } |
| bool DrawingBuffer::multisample() const |