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..b26e6c571791967e089a366d938259f6ec9cbffb 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,15 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size) |
-void DrawingBuffer::clearFramebuffers(GLbitfield clearMask) |
+void DrawingBuffer::clearFramebuffers(GLbitfield clearMask, GLenum target) |
{ |
// 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); |
Ken Russell (switch to Gerrit)
2015/05/06 21:17:33
Let's add an ASSERT that target == GL_FRAMEBUFFER
yunchao
2015/05/22 09:54:35
Done.
|
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); |
} |
@@ -782,7 +783,7 @@ bool DrawingBuffer::reset(const IntSize& newSize) |
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 +801,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 |