REGRESSION: WebGL no longer producing a transparent canvas on iOS
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Feb 2018 22:23:11 +0000 (22:23 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Feb 2018 22:23:11 +0000 (22:23 +0000)
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:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228191 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm
Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm

index cd6f0ca..93351d4 100644 (file)
@@ -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
index 5718533..a0c26e4 100644 (file)
@@ -602,7 +602,7 @@ void GraphicsContext3D::setRenderbufferStorageFromDrawable(GC3Dsizei width, GC3D
     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())];
 
index 3b99220..a304d9f 100644 (file)
@@ -57,6 +57,8 @@ using namespace WebCore;
     self.contentsOpaque = !context->getContextAttributes().alpha;
     self.transform = CATransform3DIdentity;
     self.contentsScale = _devicePixelRatio;
+#else
+    self.opaque = !context->getContextAttributes().alpha;
 #endif
     return self;
 }