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

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

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: in DrawingBuffer::commit, we should bind to the single-sampled FB at the end, instead of the multis… Created 5 years, 6 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.h
diff --git a/Source/platform/graphics/gpu/DrawingBuffer.h b/Source/platform/graphics/gpu/DrawingBuffer.h
index c65dd5d64f9822dba83ca1f23a3bd120c0004ae6..377e4459507753241702f172754cef5667e05323 100644
--- a/Source/platform/graphics/gpu/DrawingBuffer.h
+++ b/Source/platform/graphics/gpu/DrawingBuffer.h
@@ -107,11 +107,11 @@ public:
// Given the desired buffer size, provides the largest dimensions that will fit in the pixel budget.
static IntSize adjustSize(const IntSize& desiredSize, const IntSize& curSize, int maxTextureSize);
bool reset(const IntSize&);
- void bind(GLenum target = GL_FRAMEBUFFER);
+ void bind(GLenum target);
IntSize size() const { return m_size; }
// Copies the multisample color buffer to the normal color buffer and leaves m_fbo bound.
- void commit();
+ void commit(GLenum target);
// commit should copy the full multisample buffer, and not respect the
// current scissor bounds. Track the state of the scissor test so that it
@@ -124,7 +124,23 @@ public:
// The DrawingBuffer needs to track the currently bound framebuffer so it
// restore the binding when needed.
- void setFramebufferBinding(Platform3DObject fbo) { m_framebufferBinding = fbo; }
+ void setFramebufferBinding(GLenum target, Platform3DObject fbo)
+ {
+ switch (target) {
+ case GL_FRAMEBUFFER:
+ m_drawFramebufferBinding = fbo;
+ m_readFramebufferBinding = fbo;
+ break;
+ case GL_DRAW_FRAMEBUFFER:
+ m_drawFramebufferBinding = fbo;
+ break;
+ case GL_READ_FRAMEBUFFER:
+ m_readFramebufferBinding = fbo;
+ break;
+ default:
+ ASSERT(0);
+ }
+ }
// Track the currently active texture unit. Texture unit 0 is used as host for a scratch
// texture.
@@ -166,6 +182,10 @@ public:
int sampleCount() const { return m_sampleCount; }
bool explicitResolveOfMultisampleData() const { return m_multisampleMode == ExplicitResolve; };
+ // Bind to m_drawFramebufferBinding or m_readFramebufferBinding if it's not 0.
+ // Otherwise, bind to the default FBO.
+ void restoreFramebufferBindings();
+
protected: // For unittests
DrawingBuffer(
PassOwnPtr<WebGraphicsContext3D>,
@@ -188,9 +208,6 @@ private:
bool resizeMultisampleFramebuffer(const IntSize&);
void resizeDepthStencil(const IntSize&);
- // Bind to the m_framebufferBinding if it's not 0. Otherwise, bind to the default FBO.
- void restoreFramebufferBinding();
-
void clearPlatformLayer();
PassRefPtr<MailboxInfo> recycledMailbox();
@@ -226,7 +243,8 @@ private:
PreserveDrawingBuffer m_preserveDrawingBuffer;
bool m_scissorEnabled;
Platform3DObject m_texture2DBinding;
- Platform3DObject m_framebufferBinding;
+ Platform3DObject m_drawFramebufferBinding;
+ Platform3DObject m_readFramebufferBinding;
GLenum m_activeTextureUnit;
OwnPtr<WebGraphicsContext3D> m_context;

Powered by Google App Engine
This is Rietveld 408576698