- Revision
- 261541
- Author
- [email protected]
- Date
- 2020-05-11 19:52:03 -0700 (Mon, 11 May 2020)
Log Message
WebGLLayer clobbers TEXTURE_2D binding on iOS
https://bugs.webkit.org/show_bug.cgi?id=211758
Patch by James Darpinian <[email protected]> on 2020-05-11
Reviewed by Dean Jackson.
Source/WebCore:
WebGLLayer was accidentally clobbering the TEXTURE_2D binding on iOS because IOSurfaces
are bound to TEXTURE_2D instead of TEXTURE_RECTANGLE. This fixes a bunch of iOS-specific
WebGL conformance failures including:
texture-bindings-unaffected-on-resize.html
default-texture.html
tex-image-and-sub-image-2d-with-canvas-rgb565.html and friends
* platform/graphics/GraphicsContextGL.h:
* platform/graphics/cocoa/WebGLLayer.mm:
(-[WebGLLayer display]):
(-[WebGLLayer bindFramebufferToNextAvailableSurface]):
LayoutTests:
We now have passing results for:
fast/canvas/webgl/webgl-texture-binding-preserved.html
webgl/1.0.3/conformance/canvas/texture-bindings-unaffected-on-resize.html
webgl/1.0.3/conformance/extensions/oes-element-index-uint.html
webgl/1.0.3/conformance/misc/delayed-drawing.html
webgl/1.0.3/conformance/state/state-uneffected-after-compositing.html
webgl/1.0.3/conformance/textures/default-texture.html
webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas-rgb565.html
webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas-rgba4444.html
webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas-rgba5551.html
webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas.html
webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgb565.html
webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgba4444.html
webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgba5551.html
webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas.html
* platform/ios/TestExpectations:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (261540 => 261541)
--- trunk/LayoutTests/ChangeLog 2020-05-12 02:39:56 UTC (rev 261540)
+++ trunk/LayoutTests/ChangeLog 2020-05-12 02:52:03 UTC (rev 261541)
@@ -1,3 +1,29 @@
+2020-05-11 James Darpinian <[email protected]>
+
+ WebGLLayer clobbers TEXTURE_2D binding on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=211758
+
+ Reviewed by Dean Jackson.
+
+ We now have passing results for:
+
+ fast/canvas/webgl/webgl-texture-binding-preserved.html
+ webgl/1.0.3/conformance/canvas/texture-bindings-unaffected-on-resize.html
+ webgl/1.0.3/conformance/extensions/oes-element-index-uint.html
+ webgl/1.0.3/conformance/misc/delayed-drawing.html
+ webgl/1.0.3/conformance/state/state-uneffected-after-compositing.html
+ webgl/1.0.3/conformance/textures/default-texture.html
+ webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas-rgb565.html
+ webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas-rgba4444.html
+ webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas-rgba5551.html
+ webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas.html
+ webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgb565.html
+ webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgba4444.html
+ webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgba5551.html
+ webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas.html
+
+ * platform/ios/TestExpectations:
+
2020-05-11 Diego Pino Garcia <[email protected]>
[GTK] Gardening, remove failures happening on EWS GTK-WK2
Modified: trunk/LayoutTests/platform/ios/TestExpectations (261540 => 261541)
--- trunk/LayoutTests/platform/ios/TestExpectations 2020-05-12 02:39:56 UTC (rev 261540)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2020-05-12 02:52:03 UTC (rev 261541)
@@ -3471,28 +3471,14 @@
webkit.org/b/207858 fast/canvas/webgl/oes-texture-half-float-uint16.html [ Pass Failure ]
webkit.org/b/207858 fast/canvas/webgl/program-test.html [ Failure ]
webkit.org/b/207858 fast/canvas/webgl/uninitialized-test.html [ Pass Failure ]
-webkit.org/b/207858 fast/canvas/webgl/webgl-texture-binding-preserved.html [ Pass Failure ]
webkit.org/b/207858 fast/canvas/webgl/oes-texture-float-linear.html [ Pass Failure ]
webkit.org/b/207858 fast/canvas/webgl/oes-vertex-array-object.html [ Pass Failure ]
webkit.org/b/207858 fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/canvas/texture-bindings-unaffected-on-resize.html [ Pass Failure ]
webkit.org/b/207858 webgl/1.0.3/conformance/context/context-lost-restored.html [ Pass Failure ]
webkit.org/b/207858 webgl/1.0.3/conformance/extensions/ext-sRGB.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/extensions/oes-element-index-uint.html [ Pass Failure ]
webkit.org/b/207858 webgl/1.0.3/conformance/glsl/misc/shader-struct-scope.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/misc/delayed-drawing.html [ Pass Failure ]
webkit.org/b/207858 webgl/1.0.3/conformance/misc/uninitialized-test.html [ Pass Failure ]
webkit.org/b/207858 webgl/1.0.3/conformance/programs/program-test.html [ Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/state/state-uneffected-after-compositing.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/textures/default-texture.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas-rgb565.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas-rgba4444.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas-rgba5551.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-canvas.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgb565.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgba4444.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas-rgba5551.html [ Pass Failure ]
-webkit.org/b/207858 webgl/1.0.3/conformance/textures/tex-image-and-sub-image-2d-with-webgl-canvas.html [ Pass Failure ]
# <rdar://problem/59635486> REGRESSION: http/wpt/webauthn/public-key-credential-get-success-local.https.html is crashing
http/wpt/webauthn/public-key-credential-get-success-local.https.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (261540 => 261541)
--- trunk/Source/WebCore/ChangeLog 2020-05-12 02:39:56 UTC (rev 261540)
+++ trunk/Source/WebCore/ChangeLog 2020-05-12 02:52:03 UTC (rev 261541)
@@ -1,3 +1,22 @@
+2020-05-11 James Darpinian <[email protected]>
+
+ WebGLLayer clobbers TEXTURE_2D binding on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=211758
+
+ Reviewed by Dean Jackson.
+
+ WebGLLayer was accidentally clobbering the TEXTURE_2D binding on iOS because IOSurfaces
+ are bound to TEXTURE_2D instead of TEXTURE_RECTANGLE. This fixes a bunch of iOS-specific
+ WebGL conformance failures including:
+ texture-bindings-unaffected-on-resize.html
+ default-texture.html
+ tex-image-and-sub-image-2d-with-canvas-rgb565.html and friends
+
+ * platform/graphics/GraphicsContextGL.h:
+ * platform/graphics/cocoa/WebGLLayer.mm:
+ (-[WebGLLayer display]):
+ (-[WebGLLayer bindFramebufferToNextAvailableSurface]):
+
2020-05-11 Simon Fraser <[email protected]>
[ macOS ] scrollingcoordinator/mac/latching/scrolling-select-should-not-latch-mainframe.html is a flaky failure
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h (261540 => 261541)
--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h 2020-05-12 02:39:56 UTC (rev 261540)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.h 2020-05-12 02:52:03 UTC (rev 261541)
@@ -666,7 +666,8 @@
MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247,
// Necessary desktop OpenGL constants.
- TEXTURE_RECTANGLE_ARB = 0x84F5
+ TEXTURE_RECTANGLE_ARB = 0x84F5,
+ TEXTURE_BINDING_RECTANGLE_ARB = 0x84F6,
};
// Attempt to enumerate all possible native image formats to
@@ -787,9 +788,11 @@
// reference them.
#if PLATFORM(MAC)
IOSurfaceTextureTarget = TEXTURE_RECTANGLE_ARB, // also GL_TEXTURE_RECTANGLE_ANGLE
+ IOSurfaceTextureTargetQuery = TEXTURE_BINDING_RECTANGLE_ARB,
EGLIOSurfaceTextureTarget = 0x345B, // EGL_TEXTURE_RECTANGLE_ANGLE
#else
IOSurfaceTextureTarget = TEXTURE_2D,
+ IOSurfaceTextureTargetQuery = TEXTURE_BINDING_2D,
EGLIOSurfaceTextureTarget = 0x305F, // EGL_TEXTURE_2D
#endif // PLATFORM(MAC)
};
Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm (261540 => 261541)
--- trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm 2020-05-12 02:39:56 UTC (rev 261540)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm 2020-05-12 02:52:03 UTC (rev 261541)
@@ -57,6 +57,27 @@
#import <ANGLE/gl2ext_angle.h>
#endif
+namespace {
+ class ScopedRestoreTextureBinding {
+ WTF_MAKE_NONCOPYABLE(ScopedRestoreTextureBinding);
+ public:
+ ScopedRestoreTextureBinding(GLenum bindingPointQuery, GLenum bindingPoint)
+ : m_bindingPoint(bindingPoint)
+ {
+ gl::GetIntegerv(bindingPointQuery, &m_bindingValue);
+ }
+
+ ~ScopedRestoreTextureBinding()
+ {
+ gl::BindTexture(m_bindingPoint, m_bindingValue);
+ }
+
+ private:
+ GLint m_bindingPoint { 0 };
+ GLint m_bindingValue { 0 };
+ };
+}
+
@implementation WebGLLayer
@synthesize context=_context;
@@ -165,7 +186,10 @@
_context->prepareTexture();
if (_drawingBuffer) {
if (_latchedPbuffer) {
-
+ WTF::Optional<ScopedRestoreTextureBinding> restoreBinding;
+ // We don't need to restore GL_TEXTURE_RECTANGLE because it's not accessible from user code.
+ if (WebCore::GraphicsContextGL::IOSurfaceTextureTarget != WebCore::GraphicsContextGL::TEXTURE_RECTANGLE_ARB)
+ restoreBinding.emplace(WebCore::GraphicsContextGL::IOSurfaceTextureTargetQuery, WebCore::GraphicsContextGL::IOSurfaceTextureTarget);
GCGLenum texture = _context->platformTexture();
gl::BindTexture(WebCore::GraphicsContextGL::IOSurfaceTextureTarget, texture);
if (!EGL_ReleaseTexImage(_eglDisplay, _latchedPbuffer, EGL_BACK_BUFFER)) {
@@ -265,6 +289,11 @@
CGLError error = CGLTexImageIOSurface2D(cglContext, GL_TEXTURE_RECTANGLE_ARB, internalFormat, _bufferSize.width(), _bufferSize.height(), GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, ioSurface, 0);
ASSERT_UNUSED(error, error == kCGLNoError);
#elif USE(ANGLE)
+ WTF::Optional<ScopedRestoreTextureBinding> restoreBinding;
+ // We don't need to restore GL_TEXTURE_RECTANGLE because it's not accessible from user code.
+ if (WebCore::GraphicsContextGL::IOSurfaceTextureTarget != WebCore::GraphicsContextGL::TEXTURE_RECTANGLE_ARB)
+ restoreBinding.emplace(WebCore::GraphicsContextGL::IOSurfaceTextureTargetQuery, WebCore::GraphicsContextGL::IOSurfaceTextureTarget);
+
GCGLenum texture = _context->platformTexture();
gl::BindTexture(WebCore::GraphicsContextGL::IOSurfaceTextureTarget, texture);