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

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: addressed kbr@'s feedback 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..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
« Source/platform/graphics/gpu/DrawingBuffer.h ('K') | « Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698