Title: [234380] trunk
Revision
234380
Author
[email protected]
Date
2018-07-30 13:00:54 -0700 (Mon, 30 Jul 2018)

Log Message

[WebGL2] Support compilation of GLSL ES version 300 shaders
https://bugs.webkit.org/show_bug.cgi?id=187982
<rdar://problem/42564229>

Patch by Justin Fan <[email protected]> on 2018-07-30
Reviewed by Dean Jackson.

Source/WebCore:

Test: fast/canvas/webgl/webgl2-glsl3-compile.html

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::create): Rename 'useGLES3' to 'isWebGL2' (everywhere) to make more sense.
* platform/graphics/GraphicsContext3DAttributes.h: Rename 'useGLES3' to 'isWebGL2'.
* platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
(WebCore::setPixelFormat): Back WebGL2 contexts with OpenGL 4 for full OpenGL ES 3 support.
(WebCore::GraphicsContext3D::GraphicsContext3D): Request correct GLSL output version and WebGL 2 for ANGLE shader compilation.
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::checkVaryingsPacking const): MAX_VARYING_FLOATS is deprecated in OpenGL 3+.
* platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp: Rename 'useGLES3' to 'isWebGL2'.
(WebCore::GraphicsContext3D::create):
(WebCore::GraphicsContext3D::GraphicsContext3D):

LayoutTests:

New simple test added to ensure that GLSL ES version 300 shaders compile.
Updated other test results in glsl3 to match new functionality.

* fast/canvas/webgl/webgl2-glsl3-compile-expected.txt: Added.
* fast/canvas/webgl/webgl2-glsl3-compile.html: Added.
* platform/ios/TestExpectations: Skipping ios for now.
* webgl/2.0.0/conformance2/glsl3/compound-assignment-type-combination-expected.txt:
* webgl/2.0.0/conformance2/glsl3/forbidden-operators-expected.txt:
* webgl/2.0.0/conformance2/glsl3/invalid-default-precision-expected.txt:
* webgl/2.0.0/conformance2/glsl3/invalid-invariant-expected.txt:
* webgl/2.0.0/conformance2/glsl3/misplaced-version-directive-expected.txt:
* webgl/2.0.0/conformance2/glsl3/sampler-no-precision-expected.txt:
* webgl/2.0.0/conformance2/glsl3/sequence-operator-returns-non-constant-expected.txt:
* webgl/2.0.0/conformance2/glsl3/texture-offset-out-of-range-expected.txt:
* webgl/2.0.0/conformance2/glsl3/texture-offset-uniform-texture-coordinate-expected.txt:
* webgl/2.0.0/conformance2/glsl3/uniform-block-layout-match-expected.txt:
* webgl/2.0.0/conformance2/glsl3/uniform-block-layouts-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (234379 => 234380)


--- trunk/LayoutTests/ChangeLog	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/ChangeLog	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,3 +1,29 @@
+2018-07-30  Justin Fan  <[email protected]>
+
+        [WebGL2] Support compilation of GLSL ES version 300 shaders
+        https://bugs.webkit.org/show_bug.cgi?id=187982
+        <rdar://problem/42564229>
+
+        Reviewed by Dean Jackson.
+
+        New simple test added to ensure that GLSL ES version 300 shaders compile.
+        Updated other test results in glsl3 to match new functionality.
+
+        * fast/canvas/webgl/webgl2-glsl3-compile-expected.txt: Added.
+        * fast/canvas/webgl/webgl2-glsl3-compile.html: Added.
+        * platform/ios/TestExpectations: Skipping ios for now. 
+        * webgl/2.0.0/conformance2/glsl3/compound-assignment-type-combination-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/forbidden-operators-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/invalid-default-precision-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/invalid-invariant-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/misplaced-version-directive-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/sampler-no-precision-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/sequence-operator-returns-non-constant-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/texture-offset-out-of-range-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/texture-offset-uniform-texture-coordinate-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/uniform-block-layout-match-expected.txt:
+        * webgl/2.0.0/conformance2/glsl3/uniform-block-layouts-expected.txt:
+
 2018-07-30  Ryan Haddad  <[email protected]>
 
         Rebaseline fast/forms/file/input-file-re-render.html for Mojave.

Added: trunk/LayoutTests/fast/canvas/webgl/webgl2-glsl3-compile-expected.txt (0 => 234380)


--- trunk/LayoutTests/fast/canvas/webgl/webgl2-glsl3-compile-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl2-glsl3-compile-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -0,0 +1,12 @@
+Make sure that compiling GLSL ES 3 shaders works as expected.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS success is true
+PASS success is true
+PASS success is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/canvas/webgl/webgl2-glsl3-compile.html (0 => 234380)


--- trunk/LayoutTests/fast/canvas/webgl/webgl2-glsl3-compile.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl2-glsl3-compile.html	2018-07-30 20:00:54 UTC (rev 234380)
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<canvas id="canvas" width="40" height="40"></canvas>
+
+<script>
+var success = false;
+function compileShader(gl, shaderSource, shaderType) {
+    var shader = gl.createShader(shaderType);
+
+    gl.shaderSource(shader, shaderSource);
+
+    gl.compileShader(shader);
+
+    success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
+
+    shouldBe("success", "true");
+
+    return shader;
+}
+
+function createProgram(gl, vertexShader, fragmentShader) {
+    var program = gl.createProgram();
+
+    gl.attachShader(program, vertexShader);
+    gl.attachShader(program, fragmentShader);
+
+    gl.linkProgram(program);
+
+    success = gl.getProgramParameter(program, gl.LINK_STATUS);
+
+    shouldBe("success", "true");
+
+    return program;
+}
+
+description("Make sure that compiling GLSL ES 3 shaders works as expected.");
+
+if (window.internals)
+    internals.settings.setWebGL2Enabled(true);
+
+var vertexShaderSource = `#version 300 es
+layout(location = 0) in vec2 pos;
+
+void main()
+{
+    gl_Position = vec4(pos, 0.0, 1.0);
+}
+`;
+
+var fragmentShaderSource = `#version 300 es
+precision mediump float;
+out vec4 color;
+
+void main()
+{
+    color = vec4(1.0, 0.5, 0.0, 1.0);
+}
+`;
+    
+var canvas = document.getElementById("canvas");
+var gl = canvas.getContext("webgl2");
+
+var vertexShader = compileShader(gl, vertexShaderSource, gl.VERTEX_SHADER);
+var fragmentShader = compileShader(gl, fragmentShaderSource, gl.FRAGMENT_SHADER);
+
+var program = createProgram(gl, vertexShader, fragmentShader);
+
+</script>
+<script src=""
+</body>
+</html>
+

Modified: trunk/LayoutTests/platform/ios/TestExpectations (234379 => 234380)


--- trunk/LayoutTests/platform/ios/TestExpectations	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2018-07-30 20:00:54 UTC (rev 234380)
@@ -3339,3 +3339,6 @@
 # Datalist
 webkit.org/b/186714 fast/forms/datalist/datalist-show-hide.html [ Skip ]
 webkit.org/b/186714 fast/forms/datalist/datalist-textinput-keydown.html [ Skip ]
+
+# We are only accepting GLSL3 for macOS. 
+webkit.org/b/187982 webgl/2.0.0/conformance2/glsl3 [ Skip ]

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/compound-assignment-type-combination-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/compound-assignment-type-combination-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/compound-assignment-type-combination-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/compound-assignment-type-combination.html
-FAIL
+PASS
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/forbidden-operators-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/forbidden-operators-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/forbidden-operators-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/forbidden-operators.html
-FAIL
+PASS
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/invalid-default-precision-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/invalid-default-precision-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/invalid-default-precision-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/invalid-default-precision.html
-FAIL
+PASS
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/invalid-invariant-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/invalid-invariant-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/invalid-invariant-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/invalid-invariant.html
-FAIL
+PASS
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/misplaced-version-directive-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/misplaced-version-directive-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/misplaced-version-directive-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/misplaced-version-directive.html
-FAIL
+PASS
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/sampler-no-precision-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/sampler-no-precision-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/sampler-no-precision-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/sampler-no-precision.html
-FAIL
+PASS
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/sequence-operator-returns-non-constant-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/sequence-operator-returns-non-constant-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/sequence-operator-returns-non-constant-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/sequence-operator-returns-non-constant.html
-FAIL
+PASS
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/texture-offset-out-of-range-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/texture-offset-out-of-range-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/texture-offset-out-of-range-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/texture-offset-out-of-range.html
-FAIL
+PASS
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/texture-offset-uniform-texture-coordinate-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/texture-offset-uniform-texture-coordinate-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/texture-offset-uniform-texture-coordinate-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/texture-offset-uniform-texture-coordinate.html
-FAIL
+PASS
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/uniform-block-layout-match-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/uniform-block-layout-match-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/uniform-block-layout-match-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/uniform-block-layout-match.html
-FAIL
+PASS
 

Modified: trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/uniform-block-layouts-expected.txt (234379 => 234380)


--- trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/uniform-block-layouts-expected.txt	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/LayoutTests/webgl/2.0.0/conformance2/glsl3/uniform-block-layouts-expected.txt	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,5 @@
 This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
 
 Test: ../../resources/webgl_test_files/conformance2/glsl3/uniform-block-layouts.html
-FAIL
+PASS
 

Modified: trunk/Source/WebCore/ChangeLog (234379 => 234380)


--- trunk/Source/WebCore/ChangeLog	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/Source/WebCore/ChangeLog	2018-07-30 20:00:54 UTC (rev 234380)
@@ -1,5 +1,27 @@
 2018-07-30  Justin Fan  <[email protected]>
 
+        [WebGL2] Support compilation of GLSL ES version 300 shaders
+        https://bugs.webkit.org/show_bug.cgi?id=187982
+        <rdar://problem/42564229>
+
+        Reviewed by Dean Jackson.
+
+        Test: fast/canvas/webgl/webgl2-glsl3-compile.html
+
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::create): Rename 'useGLES3' to 'isWebGL2' (everywhere) to make more sense.
+        * platform/graphics/GraphicsContext3DAttributes.h: Rename 'useGLES3' to 'isWebGL2'.
+        * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
+        (WebCore::setPixelFormat): Back WebGL2 contexts with OpenGL 4 for full OpenGL ES 3 support. 
+        (WebCore::GraphicsContext3D::GraphicsContext3D): Request correct GLSL output version and WebGL 2 for ANGLE shader compilation.
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::checkVaryingsPacking const): MAX_VARYING_FLOATS is deprecated in OpenGL 3+.
+        * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp: Rename 'useGLES3' to 'isWebGL2'.
+        (WebCore::GraphicsContext3D::create):
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+
+2018-07-30  Justin Fan  <[email protected]>
+
         Match GraphicsContext3D with correct virtual screen using registryID
         https://bugs.webkit.org/show_bug.cgi?id=188072
         <rdar://problem/42634940>

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (234379 => 234380)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2018-07-30 20:00:54 UTC (rev 234380)
@@ -583,7 +583,7 @@
 
 #if ENABLE(WEBGL2)
     if (type == "webgl2")
-        attributes.useGLES3 = true;
+        attributes.isWebGL2 = true;
 #endif
 
     if (isPendingPolicyResolution) {
@@ -613,7 +613,7 @@
 #if ENABLE(WEBGL2) && PLATFORM(MAC)
     // 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.useGLES3 && !extensions.supports("GL_ARB_texture_storage"))
+    if (attributes.isWebGL2 && !extensions.supports("GL_ARB_texture_storage"))
         return nullptr;
 #endif
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h (234379 => 234380)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3DAttributes.h	2018-07-30 20:00:54 UTC (rev 234380)
@@ -48,7 +48,7 @@
     // Additional attributes.
     bool forceSoftwareRenderer { false };
     bool shareResources { true };
-    bool useGLES3 { false };
+    bool isWebGL2 { false };
     bool noExtensions { false };
     float devicePixelRatio { 1 };
     PowerPreference initialPowerPreference { PowerPreference::Default };

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm (234379 => 234380)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm	2018-07-30 20:00:54 UTC (rev 234380)
@@ -81,7 +81,7 @@
 
 #if USE(OPENGL)
 
-static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBits, int depthBits, bool accelerated, bool supersample, bool closest, bool antialias, bool useGLES3, bool allowOfflineRenderers)
+static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBits, int depthBits, bool accelerated, bool supersample, bool closest, bool antialias, bool isWebGL2, bool allowOfflineRenderers)
 {
     attribs.clear();
     
@@ -118,11 +118,11 @@
         attribs.append(static_cast<CGLPixelFormatAttribute>(4));
     }
 
-    if (useGLES3) {
-        // FIXME: Instead of backing a WebGL2 GraphicsContext3D with a OpenGL 3.2 context, we should instead back it with ANGLE.
-        // Use an OpenGL 3.2 context for now until the ANGLE backend is ready.
+    if (isWebGL2) {
+        // FIXME: Instead of backing a WebGL2 GraphicsContext3D with a OpenGL 4 context, we should instead back it with ANGLE.
+        // Use an OpenGL 4 context for now until the ANGLE backend is ready.
         attribs.append(kCGLPFAOpenGLProfile);
-        attribs.append(static_cast<CGLPixelFormatAttribute>(kCGLOGLPVersion_3_2_Core));
+        attribs.append(static_cast<CGLPixelFormatAttribute>(kCGLOGLPVersion_GL4_Core));
     }
         
     attribs.append(static_cast<CGLPixelFormatAttribute>(0));
@@ -244,14 +244,21 @@
 
 GraphicsContext3D::GraphicsContext3D(GraphicsContext3DAttributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle, GraphicsContext3D* sharedContext)
     : m_attrs(attrs)
+    , m_private(std::make_unique<GraphicsContext3DPrivate>(this))
+{
 #if PLATFORM(IOS)
-    , m_compiler(SH_ESSL_OUTPUT)
+    if (m_attrs.isWebGL2)
+        m_compiler = ANGLEWebKitBridge(SH_ESSL_OUTPUT, SH_WEBGL2_SPEC);
+    else
+        m_compiler = ANGLEWebKitBridge(SH_ESSL_OUTPUT);
+#else
+    if (m_attrs.isWebGL2)
+        m_compiler = ANGLEWebKitBridge(SH_GLSL_410_CORE_OUTPUT, SH_WEBGL2_SPEC);
 #endif
-    , m_private(std::make_unique<GraphicsContext3DPrivate>(this))
-{
+
 #if USE(OPENGL_ES)
     UNUSED_PARAM(hostWindow);
-    EAGLRenderingAPI api = m_attrs.useGLES3 ? kEAGLRenderingAPIOpenGLES3 : kEAGLRenderingAPIOpenGLES2;
+    EAGLRenderingAPI api = m_attrs.isWebGL2 ? kEAGLRenderingAPIOpenGLES3 : kEAGLRenderingAPIOpenGLES2;
     if (!sharedContext)
         m_contextObj = [[EAGLContext alloc] initWithAPI:api];
     else
@@ -284,19 +291,19 @@
     m_powerPreferenceUsedForCreation = GraphicsContext3DPowerPreference::Default;
 #endif
 
-    setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.useGLES3, allowOfflineRenderers());
+    setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
     CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
 
     if (!numPixelFormats) {
-        setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.useGLES3, allowOfflineRenderers());
+        setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
         CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
 
         if (!numPixelFormats) {
-            setPixelFormat(attribs, 32, 16, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.useGLES3, allowOfflineRenderers());
+            setPixelFormat(attribs, 32, 16, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
             CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
 
             if (!attrs.forceSoftwareRenderer && !numPixelFormats) {
-                setPixelFormat(attribs, 32, 16, false, false, true, false, attrs.useGLES3, allowOfflineRenderers());
+                setPixelFormat(attribs, 32, 16, false, false, true, false, attrs.isWebGL2, allowOfflineRenderers());
                 CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
                 useMultisampling = false;
             }
@@ -335,7 +342,7 @@
         return;
     }
 
-    m_isForWebGL2 = attrs.useGLES3;
+    m_isForWebGL2 = attrs.isWebGL2;
 
     // Set the current context to the one given to us.
     CGLSetCurrentContext(m_contextObj);

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


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2018-07-30 20:00:54 UTC (rev 234380)
@@ -400,9 +400,13 @@
 
     GC3Dint maxVaryingVectors = 0;
 #if !USE(OPENGL_ES)
-    GC3Dint maxVaryingFloats = 0;
-    ::glGetIntegerv(GL_MAX_VARYING_FLOATS, &maxVaryingFloats);
-    maxVaryingVectors = maxVaryingFloats / 4;
+    if (m_isForWebGL2)
+        ::glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryingVectors);
+    else {
+        GC3Dint maxVaryingFloats = 0;
+        ::glGetIntegerv(GL_MAX_VARYING_FLOATS, &maxVaryingFloats);
+        maxVaryingVectors = maxVaryingFloats / 4;
+    }
 #else
     ::glGetIntegerv(MAX_VARYING_VECTORS, &maxVaryingVectors);
 #endif

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp (234379 => 234380)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp	2018-07-30 19:56:16 UTC (rev 234379)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp	2018-07-30 20:00:54 UTC (rev 234380)
@@ -93,7 +93,7 @@
 
 #if USE(LIBEPOXY) && USE(OPENGL_ES)
     // Bail if GLES3 was requested but cannot be provided.
-    if (attributes.useGLES3 && !epoxy_is_desktop_gl() && epoxy_gl_version() < 30)
+    if (attributes.isWebGL2 && !epoxy_is_desktop_gl() && epoxy_gl_version() < 30)
         return nullptr;
 #endif
 
@@ -195,7 +195,7 @@
     }
 #else
     // 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);
+    m_compiler = ANGLEWebKitBridge(SH_ESSL_OUTPUT, m_attrs.isWebGL2 ? SH_WEBGL2_SPEC : SH_WEBGL_SPEC);
 #endif
 
     // ANGLE initialization.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to