Skip to content

Commit

Permalink
REGRESSION: WebGL no longer producing a transparent canvas on iOS
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=182550
<rdar://problem/37234491>

Reviewed by Eric Carlson.

Due to some weirdness GL_RGBA8 is sometimes different between iOS and
other platforms. Only tell the WebGLLayer that it is opaque when it really
is not transparent.

Covered by existing test: fast/canvas/webgl/context-attributes-alpha

* platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
(WebCore::GraphicsContext3D::setRenderbufferStorageFromDrawable): Look at the context
attributes to decide if we should use an opaque layer.
* platform/graphics/cocoa/WebGLLayer.mm: Ditto.
(-[WebGLLayer initWithGraphicsContext3D:]):

Canonical link: https://commits.webkit.org/198343@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228191 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
grorg committed Feb 6, 2018
1 parent fc85a7f commit 72b9f2a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
20 changes: 20 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
2018-02-06 Dean Jackson <dino@apple.com>

REGRESSION: WebGL no longer producing a transparent canvas on iOS
https://bugs.webkit.org/show_bug.cgi?id=182550
<rdar://problem/37234491>

Reviewed by Eric Carlson.

Due to some weirdness GL_RGBA8 is sometimes different between iOS and
other platforms. Only tell the WebGLLayer that it is opaque when it really
is not transparent.

Covered by existing test: fast/canvas/webgl/context-attributes-alpha

* platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
(WebCore::GraphicsContext3D::setRenderbufferStorageFromDrawable): Look at the context
attributes to decide if we should use an opaque layer.
* platform/graphics/cocoa/WebGLLayer.mm: Ditto.
(-[WebGLLayer initWithGraphicsContext3D:]):

2018-02-06 Andy Estes <aestes@apple.com>

[WebIDL] Support optional Promise arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBi
CGRect previousBounds = [m_webGLLayer.get() bounds];

[m_webGLLayer setBounds:CGRectMake(0, 0, width, height)];
[m_webGLLayer setOpaque:(m_internalColorFormat != GL_RGBA8)];
[m_webGLLayer setOpaque:!m_attrs.alpha];

[m_contextObj renderbufferStorage:GL_RENDERBUFFER fromDrawable:static_cast<id<EAGLDrawable>>(m_webGLLayer.get())];

Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ -(id)initWithGraphicsContext3D:(GraphicsContext3D*)context
self.contentsOpaque = !context->getContextAttributes().alpha;
self.transform = CATransform3DIdentity;
self.contentsScale = _devicePixelRatio;
#else
self.opaque = !context->getContextAttributes().alpha;
#endif
return self;
}
Expand Down

0 comments on commit 72b9f2a

Please sign in to comment.