Title: [219910] trunk
Revision
219910
Author
[email protected]
Date
2017-07-26 01:26:08 -0700 (Wed, 26 Jul 2017)

Log Message

[WPE] WebGL2 support
https://bugs.webkit.org/show_bug.cgi?id=174249

Reviewed by Alex Christensen.

Source/WebCore:

Implement WebGL2 support in GraphicsContext3DCairo for the WPE port, but keep
the implementation specific to libepoxy (which WPE leverages by default).

In the GraphicsContext3D::create() method, we first construct the
GraphicsContext3D object that also ensures a current GL context on this thread.
Only then can we determine through libepoxy whether the underlying GL library
is able to support WebGL2.

For WebGL2, the GLES3 support is required. The initial libepoxy implementation
ensures this only in case of 'non-desktop GL' library of minimum version 3.0.
This effectively translates to the only supported configuration being the
EGL and OpenGL ES 3.0 (or higher) combination. If this cannot be ensured, we
discard the existing GraphicsContext3D object and return null.

WebGL2 can also be supported via OpenGL (i.e. 'desktop GL'), but this hasn't
been tested yet. Implementation will in the future be extended to support that
as required.

In the GraphicsContext3D constructor itself, the ANGLEWebKitBridge constructor
has to now receive the second argument, the desired shader specification that's
used when parsing the provided shaders. This should be SH_WEBGL_SPEC for WebGL1,
and SH_WEBGL2_SPEC for WebGL2.

No new tests -- a small set of existing WebGL2 tests is unskipped and passing.

* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::create):
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
Add WebGL2-specific methods to the build.

Tools:

* Scripts/webkitperl/FeatureList.pm:
Enable WebGL2 for WPE when building through build-webkit.

LayoutTests:

* platform/wpe/TestExpectations:
Unskip WebGL2 tests under the webgl/ directory. More tests under fast/canvas/webgl2/
will be unskipped later.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (219909 => 219910)


--- trunk/LayoutTests/ChangeLog	2017-07-26 08:16:48 UTC (rev 219909)
+++ trunk/LayoutTests/ChangeLog	2017-07-26 08:26:08 UTC (rev 219910)
@@ -1,3 +1,14 @@
+2017-07-26  Zan Dobersek  <[email protected]>
+
+        [WPE] WebGL2 support
+        https://bugs.webkit.org/show_bug.cgi?id=174249
+
+        Reviewed by Alex Christensen.
+
+        * platform/wpe/TestExpectations:
+        Unskip WebGL2 tests under the webgl/ directory. More tests under fast/canvas/webgl2/
+        will be unskipped later.
+
 2017-07-26  Nan Wang  <[email protected]>
 
         AX: should dispatch accessibilityPerformPressAction async on MacOS

Modified: trunk/LayoutTests/platform/wpe/TestExpectations (219909 => 219910)


--- trunk/LayoutTests/platform/wpe/TestExpectations	2017-07-26 08:16:48 UTC (rev 219909)
+++ trunk/LayoutTests/platform/wpe/TestExpectations	2017-07-26 08:26:08 UTC (rev 219910)
@@ -179,11 +179,6 @@
 webkit.org/b/169917 webgl/1.0.2/conformance/glsl/misc/shader-with-non-reserved-words.html [ Slow ]
 webkit.org/b/169917 webgl/1.0.3/conformance/rendering/many-draw-calls.html [ Slow ]
 
-# WebGL2
-Bug(WPE) webgl/webgl-vertex-array-object-defined.html [ Failure ]
-Bug(WPE) webgl/webgl2-rendering-context-defined.html [ Failure ]
-Bug(WPE) webgl/webgl2-rendering-context-obtain.html [ Failure ]
-
 # security/
 # Require EventSender support
 Bug(WPE) security/contentSecurityPolicy/image-with-blob-url-allowed-by-img-src-star-with-AllowContentSecurityPolicySourceStarToMatchAnyProtocol-enabled.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (219909 => 219910)


--- trunk/Source/WebCore/ChangeLog	2017-07-26 08:16:48 UTC (rev 219909)
+++ trunk/Source/WebCore/ChangeLog	2017-07-26 08:26:08 UTC (rev 219910)
@@ -1,3 +1,41 @@
+2017-07-26  Zan Dobersek  <[email protected]>
+
+        [WPE] WebGL2 support
+        https://bugs.webkit.org/show_bug.cgi?id=174249
+
+        Reviewed by Alex Christensen.
+
+        Implement WebGL2 support in GraphicsContext3DCairo for the WPE port, but keep
+        the implementation specific to libepoxy (which WPE leverages by default).
+
+        In the GraphicsContext3D::create() method, we first construct the
+        GraphicsContext3D object that also ensures a current GL context on this thread.
+        Only then can we determine through libepoxy whether the underlying GL library
+        is able to support WebGL2.
+
+        For WebGL2, the GLES3 support is required. The initial libepoxy implementation
+        ensures this only in case of 'non-desktop GL' library of minimum version 3.0.
+        This effectively translates to the only supported configuration being the
+        EGL and OpenGL ES 3.0 (or higher) combination. If this cannot be ensured, we
+        discard the existing GraphicsContext3D object and return null.
+
+        WebGL2 can also be supported via OpenGL (i.e. 'desktop GL'), but this hasn't
+        been tested yet. Implementation will in the future be extended to support that
+        as required.
+
+        In the GraphicsContext3D constructor itself, the ANGLEWebKitBridge constructor
+        has to now receive the second argument, the desired shader specification that's
+        used when parsing the provided shaders. This should be SH_WEBGL_SPEC for WebGL1,
+        and SH_WEBGL2_SPEC for WebGL2.
+
+        No new tests -- a small set of existing WebGL2 tests is unskipped and passing.
+
+        * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
+        (WebCore::GraphicsContext3D::create):
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        Add WebGL2-specific methods to the build.
+
 2017-07-26  Nan Wang  <[email protected]>
 
         AX: should dispatch accessibilityPerformPressAction async on MacOS

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp (219909 => 219910)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp	2017-07-26 08:16:48 UTC (rev 219909)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp	2017-07-26 08:26:08 UTC (rev 219910)
@@ -69,7 +69,7 @@
 {
     // This implementation doesn't currently support rendering directly to the HostWindow.
     if (renderStyle == RenderDirectlyToHostWindow)
-        return 0;
+        return nullptr;
 
     static bool initialized = false;
     static bool success = true;
@@ -80,9 +80,18 @@
         initialized = true;
     }
     if (!success)
-        return 0;
+        return nullptr;
 
-    return adoptRef(new GraphicsContext3D(attributes, hostWindow, renderStyle));
+    // Create the GraphicsContext3D object first in order to establist a current context on this thread.
+    auto context = adoptRef(new GraphicsContext3D(attributes, hostWindow, renderStyle));
+
+#if USE(LIBEPOXY) && USE(OPENGL_ES_2)
+    // Bail if GLES3 was requested but cannot be provided.
+    if (attributes.useGLES3 && !epoxy_is_desktop_gl() && epoxy_gl_version() < 30)
+        return nullptr;
+#endif
+
+    return context;
 }
 
 GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attributes, HostWindow*, GraphicsContext3D::RenderStyle renderStyle)
@@ -181,7 +190,8 @@
         ::glEnable(GL_POINT_SPRITE);
     }
 #else
-    m_compiler = ANGLEWebKitBridge(SH_ESSL_OUTPUT);
+    // Adjust the shader specification depending on whether GLES3 (i.e. WebGL2 support) was requested.
+    m_compiler = ANGLEWebKitBridge(SH_ESSL_OUTPUT, m_attrs.useGLES3 ? SH_WEBGL2_SPEC : SH_WEBGL_SPEC);
 #endif
 
     // ANGLE initialization.

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (219909 => 219910)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2017-07-26 08:16:48 UTC (rev 219909)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2017-07-26 08:26:08 UTC (rev 219910)
@@ -559,7 +559,7 @@
     ::glBufferSubData(target, offset, size, data);
 }
 
-#if PLATFORM(MAC) || PLATFORM(IOS)
+#if PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(WPE)
 void* GraphicsContext3D::mapBufferRange(GC3Denum target, GC3Dintptr offset, GC3Dsizeiptr length, GC3Dbitfield access)
 {
     makeContextCurrent();

Modified: trunk/Tools/ChangeLog (219909 => 219910)


--- trunk/Tools/ChangeLog	2017-07-26 08:16:48 UTC (rev 219909)
+++ trunk/Tools/ChangeLog	2017-07-26 08:26:08 UTC (rev 219910)
@@ -1,3 +1,13 @@
+2017-07-26  Zan Dobersek  <[email protected]>
+
+        [WPE] WebGL2 support
+        https://bugs.webkit.org/show_bug.cgi?id=174249
+
+        Reviewed by Alex Christensen.
+
+        * Scripts/webkitperl/FeatureList.pm:
+        Enable WebGL2 for WPE when building through build-webkit.
+
 2017-07-26  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Fix GTK distcheck.

Modified: trunk/Tools/Scripts/webkitperl/FeatureList.pm (219909 => 219910)


--- trunk/Tools/Scripts/webkitperl/FeatureList.pm	2017-07-26 08:16:48 UTC (rev 219909)
+++ trunk/Tools/Scripts/webkitperl/FeatureList.pm	2017-07-26 08:26:08 UTC (rev 219910)
@@ -399,7 +399,7 @@
       define => "ENABLE_WEBGL", default => (isAppleCocoaWebKit() || isGtk() || isWPE()), value => \$webglSupport },
 
     { option => "webgl2", desc => "Toggle WebGL2 support",
-      define => "ENABLE_WEBGL2", default => isAppleCocoaWebKit(), value => \$webgl2Support },
+      define => "ENABLE_WEBGL2", default => (isAppleCocoaWebKit() || isWPE()), value => \$webgl2Support },
 
     { option => "writableStreamAPI", desc => "Toggle WritableStream API support",
       define => "ENABLE_WRITABLE_STREAM_API", default => 1, value => \$writableStreamAPISupport },
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to