| 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)
|
| {
|
| + 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)
|
| {
|
| 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);
|
| m_contentsChangeCommitted = true;
|
| }
|
|
|
| -void DrawingBuffer::restoreFramebufferBinding()
|
| +void DrawingBuffer::restoreFramebufferBinding(GLenum target)
|
| {
|
| - 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
|
|
|