Title: [291069] branches/safari-613-branch
Revision
291069
Author
[email protected]
Date
2022-03-09 14:15:21 -0800 (Wed, 09 Mar 2022)

Log Message

Cherry-pick r289071. rdar://problem/89997434

    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 <[email protected]> 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.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (291068 => 291069)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-09 22:10:35 UTC (rev 291068)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-09 22:15:21 UTC (rev 291069)
@@ -1,3 +1,49 @@
+2022-03-09  Russell Epstein  <[email protected]>
+
+        Cherry-pick r289071. rdar://problem/89997434
+
+    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 <[email protected]> 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.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-03  Kimmo Kinnunen  <[email protected]>
+
+            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-03-08  Russell Epstein  <[email protected]>
 
         Cherry-pick r288701. rdar://problem/83734079

Added: branches/safari-613-branch/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug-expected.txt (0 => 291069)


--- branches/safari-613-branch/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug-expected.txt	2022-03-09 22:15:21 UTC (rev 291069)
@@ -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: branches/safari-613-branch/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html (0 => 291069)


--- branches/safari-613-branch/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/webgl/pending/conformance2/misc/webgl2-after-webgl1-bug.html	2022-03-09 22:15:21 UTC (rev 291069)
@@ -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: branches/safari-613-branch/LayoutTests/webgl/pending/resources/webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html (0 => 291069)


--- branches/safari-613-branch/LayoutTests/webgl/pending/resources/webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/webgl/pending/resources/webgl_test_files/conformance2/misc/webgl2-after-webgl1-bug.html	2022-03-09 22:15:21 UTC (rev 291069)
@@ -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: branches/safari-613-branch/Source/WebCore/ChangeLog (291068 => 291069)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-09 22:10:35 UTC (rev 291068)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-09 22:15:21 UTC (rev 291069)
@@ -1,3 +1,60 @@
+2022-03-09  Russell Epstein  <[email protected]>
+
+        Cherry-pick r289071. rdar://problem/89997434
+
+    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 <[email protected]> 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.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@289071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-03  Kimmo Kinnunen  <[email protected]>
+
+            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-03-08  Russell Epstein  <[email protected]>
 
         Cherry-pick r288701. rdar://problem/83734079

Modified: branches/safari-613-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp (291068 => 291069)


--- branches/safari-613-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2022-03-09 22:10:35 UTC (rev 291068)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp	2022-03-09 22:15:21 UTC (rev 291069)
@@ -144,8 +144,7 @@
         constexpr EGLNativeDisplayType nativeDisplays[] = {
             defaultDisplay,
 #if PLATFORM(COCOA)
-            lowPowerDisplay,
-            highPerformanceDisplay
+            defaultOpenGLDisplay,
 #endif
         };
         for (auto nativeDisplay : nativeDisplays) {

Modified: branches/safari-613-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h (291068 => 291069)


--- branches/safari-613-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h	2022-03-09 22:10:35 UTC (rev 291068)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.h	2022-03-09 22:15:21 UTC (rev 291069)
@@ -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: branches/safari-613-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm (291068 => 291069)


--- branches/safari-613-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm	2022-03-09 22:10:35 UTC (rev 291068)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm	2022-03-09 22:15:21 UTC (rev 291069)
@@ -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());
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to