Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 1120953002: WebGL 2: add read/write framebuffer binding points to related APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698