Allow using WebGL 2 when USE_ANGLE=1
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Oct 2019 19:57:20 +0000 (19:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Oct 2019 19:57:20 +0000 (19:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202593

Patch by James Darpinian <jdarpinian@chromium.org> on 2019-10-04
Reviewed by Alex Christensen.

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create):
    Disable irrelevant extension check.
* platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):
    Use ES3 ANGLE context when WebGL 2 is requested.

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

Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm

index e17f94b..1495719 100644 (file)
@@ -1,3 +1,17 @@
+2019-10-04  James Darpinian  <jdarpinian@chromium.org>
+
+        Allow using WebGL 2 when USE_ANGLE=1
+        https://bugs.webkit.org/show_bug.cgi?id=202593
+
+        Reviewed by Alex Christensen.
+
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::create):
+            Disable irrelevant extension check.
+        * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+            Use ES3 ANGLE context when WebGL 2 is requested.
+
 2019-10-04  Alex Christensen  <achristensen@webkit.org>
 
         Stop sending list of display-isolated schemes to NetworkProcess
index 3a01d37..de47ae7 100644 (file)
@@ -611,7 +611,7 @@ std::unique_ptr<WebGLRenderingContextBase> WebGLRenderingContextBase::create(Can
     if (extensions.supports("GL_EXT_debug_marker"_s))
         extensions.pushGroupMarkerEXT("WebGLRenderingContext"_s);
 
-#if ENABLE(WEBGL2) && PLATFORM(MAC)
+#if ENABLE(WEBGL2) && PLATFORM(MAC) && !USE(ANGLE)
     // glTexStorage() was only added to Core in OpenGL 4.2.
     // However, according to https://developer.apple.com/opengl/capabilities/ all Apple GPUs support this extension.
     if (attributes.isWebGL2 && !extensions.supports("GL_ARB_texture_storage"))
index ae24c78..a2eeab4 100644 (file)
@@ -325,11 +325,16 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWind
     }
 
     std::vector<EGLint> contextAttributes;
-    contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
-    contextAttributes.push_back(2);
-    // ANGLE will upgrade the context to ES3 automatically unless this is specified.
-    contextAttributes.push_back(EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE);
-    contextAttributes.push_back(EGL_FALSE);
+    if (attrs.isWebGL2) {
+        contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
+        contextAttributes.push_back(3);
+    } else {
+        contextAttributes.push_back(EGL_CONTEXT_CLIENT_VERSION);
+        contextAttributes.push_back(2);
+        // ANGLE will upgrade the context to ES3 automatically unless this is specified.
+        contextAttributes.push_back(EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE);
+        contextAttributes.push_back(EGL_FALSE);
+    }
     contextAttributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE);
     contextAttributes.push_back(EGL_TRUE);
     if (strstr(displayExtensions, "EGL_ANGLE_power_preference")) {