- Revision
- 289071
- Author
- commit-qu...@webkit.org
- Date
- 2022-02-03 13:06:48 -0800 (Thu, 03 Feb 2022)
Log Message
ANGLE Metal and ANGLE OpenGL cannot be initialised one after the other
https://bugs.webkit.org/show_bug.cgi?id=236030
Patch by Kimmo Kinnunen <kkinnu...@apple.com> on 2022-02-03
Reviewed by Dean Jackson.
Source/WebCore:
Test: webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html
Remove the power-preference specific native displays.
Add a native display for opengl, and use the default
one for Metal.
After the recent ANGLE roll, ANGLE uses (native display, power preference)
as the key to look up EGLDisplays.
* platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::releaseThreadResources):
* platform/graphics/angle/GraphicsContextGLANGLE.h:
* platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
(WebCore::initializeEGLDisplay):
LayoutTests:
* webgl/pending/conformance2/misc/webgl2-after-webgl1-bug-expected.txt: Added.
* webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html: Added.
* webgl/resources/pending_webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (289070 => 289071)
--- trunk/LayoutTests/ChangeLog 2022-02-03 21:05:05 UTC (rev 289070)
+++ trunk/LayoutTests/ChangeLog 2022-02-03 21:06:48 UTC (rev 289071)
@@ -1,3 +1,14 @@
+2022-02-03 Kimmo Kinnunen <kkinnu...@apple.com>
+
+ ANGLE Metal and ANGLE OpenGL cannot be initialised one after the other
+ https://bugs.webkit.org/show_bug.cgi?id=236030
+
+ Reviewed by Dean Jackson.
+
+ * webgl/pending/conformance2/misc/webgl2-after-webgl1-bug-expected.txt: Added.
+ * webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html: Added.
+ * webgl/resources/pending_webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html: Added.
+
2022-02-03 Patrick Griffis <pgrif...@igalia.com>
[Win] Update expectations for failing CSP test
Added: trunk/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug-expected.txt (0 => 289071)
--- trunk/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug-expected.txt (rev 0)
+++ trunk/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug-expected.txt 2022-02-03 21:06:48 UTC (rev 289071)
@@ -0,0 +1,4 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../../resources/pending_webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html?webglVersion=2
+[ PASS ] All tests passed
Added: trunk/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html (0 => 289071)
--- trunk/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html (rev 0)
+++ trunk/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html 2022-02-03 21:06:48 UTC (rev 289071)
@@ -0,0 +1,17 @@
+<!DOCTYPE html><!-- webkit-test-runner [ runSingly=true ] -->
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for webgl2-after-webgl1-bug.html</title>
+<script type="text/_javascript_" src=""
+<script type="text/_javascript_" src=""
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href=""
+<div id="iframe">
+<iframe src="" width="800" height="600"></iframe>
+</div>
+<div id="result"></div>
+</body>
+</html>
Added: trunk/LayoutTests/webgl/resources/pending_webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html (0 => 289071)
--- trunk/LayoutTests/webgl/resources/pending_webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html (rev 0)
+++ trunk/LayoutTests/webgl/resources/pending_webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html 2022-02-03 21:06:48 UTC (rev 289071)
@@ -0,0 +1,67 @@
+<!--
+Copyright (c) 2022 The Khronos Group Inc.
+Use of this source code is governed by an MIT-style license that can be
+found in the LICENSE.txt file.
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="webkit-test-runner-options" content="runSingly=true">
+<title>WebGL conformance test for WebGL1 and WebGL2 context sequentially</title>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas1" style="width: 50px; height: 50px;"> </canvas>
+<canvas id="canvas2" style="width: 50px; height: 50px;"> </canvas>
+<script>
+"use strict";
+description("This test ensures that WebGL2 context instantiated after WebGL1 context works.");
+
+debug("");
+
+function runTest() {
+ assertMsg(window.WebGL2RenderingContext,
+ "WebGL2RenderingContext should be a member of window");
+ assertMsg('WebGL2RenderingContext' in window,
+ "WebGL2RenderingContext should be 'in' window");
+
+ const wtu = WebGLTestUtils;
+ let canvas1 = document.getElementById("canvas1");
+ let gl1 = wtu.create3DContext(canvas1, null, 1);
+ if (!gl1) {
+ testFailed("Could not fetch WebGL 1.0 context");
+ return;
+ }
+ testPassed("Fetched WebGL 1.0 context successfully");
+ debug("Checking WebGL1 context type");
+ assertMsg(gl1 instanceof WebGLRenderingContext,
+ "context type should be WebGLRenderingContext");
+
+ let canvas2 = document.getElementById("canvas2");
+ let gl2 = wtu.create3DContext(canvas2, null, 2);
+ if (!gl2) {
+ testFailed("Could not fetch WebGL 2.0 context");
+ return;
+ }
+ testPassed("Fetched WebGL2 context successfully");
+
+ debug("Checking WebGL2 context type");
+ assertMsg(gl2 instanceof WebGL2RenderingContext,
+ "context type should be WebGL2RenderingContext");
+}
+
+runTest();
+debug("");
+
+var successfullyParsed = true;
+</script>
+<script src=""
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (289070 => 289071)
--- trunk/Source/WebCore/ChangeLog 2022-02-03 21:05:05 UTC (rev 289070)
+++ trunk/Source/WebCore/ChangeLog 2022-02-03 21:06:48 UTC (rev 289071)
@@ -1,5 +1,27 @@
2022-02-03 Kimmo Kinnunen <kkinnu...@apple.com>
+ ANGLE Metal and ANGLE OpenGL cannot be initialised one after the other
+ https://bugs.webkit.org/show_bug.cgi?id=236030
+
+ Reviewed by Dean Jackson.
+
+ Test: webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html
+
+ Remove the power-preference specific native displays.
+ Add a native display for opengl, and use the default
+ one for Metal.
+
+ After the recent ANGLE roll, ANGLE uses (native display, power preference)
+ as the key to look up EGLDisplays.
+
+ * platform/graphics/angle/GraphicsContextGLANGLE.cpp:
+ (WebCore::GraphicsContextGLANGLE::releaseThreadResources):
+ * platform/graphics/angle/GraphicsContextGLANGLE.h:
+ * platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
+ (WebCore::initializeEGLDisplay):
+
+2022-02-03 Kimmo Kinnunen <kkinnu...@apple.com>
+
Crash at com.apple.WebKit: WebKit::RemoteLayerBackingStore::display
https://bugs.webkit.org/show_bug.cgi?id=236003
Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (289070 => 289071)
--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2022-02-03 21:05:05 UTC (rev 289070)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp 2022-02-03 21:06:48 UTC (rev 289071)
@@ -144,8 +144,7 @@
constexpr EGLNativeDisplayType nativeDisplays[] = {
defaultDisplay,
#if PLATFORM(COCOA)
- lowPowerDisplay,
- highPerformanceDisplay
+ defaultOpenGLDisplay,
#endif
};
for (auto nativeDisplay : nativeDisplays) {
Modified: trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h (289070 => 289071)
--- trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h 2022-02-03 21:05:05 UTC (rev 289070)
+++ trunk/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h 2022-02-03 21:06:48 UTC (rev 289071)
@@ -357,8 +357,8 @@
constexpr static EGLNativeDisplayType defaultDisplay = EGL_DEFAULT_DISPLAY;
#if PLATFORM(COCOA)
- constexpr static EGLNativeDisplayType lowPowerDisplay = EGL_CAST(EGLNativeDisplayType, -1);
- constexpr static EGLNativeDisplayType highPerformanceDisplay = EGL_CAST(EGLNativeDisplayType, -2);
+ constexpr static EGLNativeDisplayType defaultOpenGLDisplay = EGL_CAST(EGLNativeDisplayType, -1);
+ static_assert(defaultDisplay != defaultOpenGLDisplay);
#endif
protected:
Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm (289070 => 289071)
--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm 2022-02-03 21:05:05 UTC (rev 289070)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm 2022-02-03 21:06:48 UTC (rev 289071)
@@ -159,13 +159,13 @@
if (powerPreference == GraphicsContextGLAttributes::PowerPreference::LowPower) {
displayAttributes.append(EGL_POWER_PREFERENCE_ANGLE);
displayAttributes.append(EGL_LOW_POWER_ANGLE);
- nativeDisplay = GraphicsContextGLANGLE::lowPowerDisplay;
} else if (powerPreference == GraphicsContextGLAttributes::PowerPreference::HighPerformance) {
displayAttributes.append(EGL_POWER_PREFERENCE_ANGLE);
displayAttributes.append(EGL_HIGH_POWER_ANGLE);
- nativeDisplay = GraphicsContextGLANGLE::highPerformanceDisplay;
}
- }
+ } else
+ nativeDisplay = GraphicsContextGLANGLE::defaultOpenGLDisplay;
+
displayAttributes.append(EGL_NONE);
display = EGL_GetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, reinterpret_cast<void*>(nativeDisplay), displayAttributes.data());