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

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

Issue 1856933002: WebGL GL_RGB emulation to support IOSurfaces on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from kbr. Created 4 years, 8 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: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
index e44d8d510fd913fdf9cd6da80f0ca709e000128a..a8e739b96413bb2ba46460622d583730188d3e0d 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h
@@ -141,6 +141,25 @@ public:
}
}
+ // The DrawingBuffer needs to track the color mask and clear color so that
+ // it can restore it when needed.
+ void setClearColor(GLfloat* clearColor)
+ {
+ memcpy(m_clearColor, clearColor, 4 * sizeof(GLfloat));
+ }
+
+ void setColorMask(GLboolean* colorMask)
+ {
+ memcpy(m_colorMask, colorMask, 4 * sizeof(GLboolean));
+ }
+
+ // The DrawingBuffer needs to track the currently bound renderbuffer so it
+ // restore the binding when needed.
+ void setRenderbufferBinding(GLuint renderbuffer)
+ {
+ m_renderbufferBinding = renderbuffer;
+ }
+
// Track the currently active texture unit. Texture unit 0 is used as host for a scratch
// texture.
void setActiveTextureUnit(GLint textureUnit) { m_activeTextureUnit = textureUnit; }
@@ -157,6 +176,12 @@ public:
void setIsHidden(bool);
void setFilterQuality(SkFilterQuality);
+ // Indicates that the currently bound framebuffer has internalformat
+ // GL_RGBA, but is emulating GL_RGB. This happens to the backbuffer when the
+ // client requests alpha:False, but GL_RGB textures are unusable because of
+ // driver bugs.
+ bool requiresRGBEmulation();
+
WebLayer* platformLayer();
gpu::gles2::GLES2Interface* contextGL();
@@ -199,12 +224,18 @@ private:
DISALLOW_NEW();
GLenum target;
GLenum internalColorFormat;
+
+ // The internal color format used when allocating storage for the
+ // texture. This may be different from internalColorFormat if RGB
+ // emulation is required.
+ GLenum creationInternalColorFormat;
GLenum colorFormat;
GLenum internalRenderbufferFormat;
TextureParameters()
: target(0)
, internalColorFormat(0)
+ , creationInternalColorFormat(0)
, colorFormat(0)
, internalRenderbufferFormat(0)
{
@@ -290,6 +321,11 @@ private:
// Allocate buffer storage to be sent to compositor using either texImage2D or CHROMIUM_image based on available support.
void deleteChromiumImageForTexture(TextureInfo*);
+ // If RGB emulation is required, then the CHROMIUM image's alpha channel
+ // must be immediately cleared after it is bound to a texture. Nothing
+ // should be allowed to change the alpha channel after this.
+ void clearChromiumImageAlpha(const TextureInfo&);
+
// Tries to create a CHROMIUM_image backed texture if
// RuntimeEnabledFeatures::webGLImageChromiumEnabled() is true. On failure,
// or if the flag is false, creates a default texture.
@@ -307,7 +343,10 @@ private:
GLuint m_texture2DBinding;
GLuint m_drawFramebufferBinding;
GLuint m_readFramebufferBinding;
+ GLuint m_renderbufferBinding;
GLenum m_activeTextureUnit;
+ GLfloat m_clearColor[4];
+ GLboolean m_colorMask[4];
OwnPtr<WebGraphicsContext3DProvider> m_contextProvider;
// Lifetime is tied to the m_contextProvider.
@@ -334,6 +373,8 @@ private:
// For multisampling.
GLuint m_multisampleFBO;
+ GLuint m_intermediateFBO;
+ GLuint m_intermediateRenderbuffer;
GLuint m_multisampleColorBuffer;
// True if our contents have been modified since the last presentation of this buffer.
« no previous file with comments | « third_party/WebKit/Source/platform/BUILD.gn ('k') | third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698