Title: [270257] trunk
Revision
270257
Author
[email protected]
Date
2020-11-30 12:29:35 -0800 (Mon, 30 Nov 2020)

Log Message

Support KHR_parallel_shader_compile
https://bugs.webkit.org/show_bug.cgi?id=219266

Reviewed by Kenneth Russell.

Source/WebCore:

Tested by webgl/conformance/extensions/khr-parallel-shader-compile.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMConvertWebGL.cpp:
(WebCore::convertToJSValue):
* html/canvas/KHRParallelShaderCompile.cpp: Added.
(WebCore::KHRParallelShaderCompile::KHRParallelShaderCompile):
(WebCore::KHRParallelShaderCompile::getName const):
(WebCore::KHRParallelShaderCompile::supported):
* html/canvas/KHRParallelShaderCompile.h: Added.
* html/canvas/KHRParallelShaderCompile.idl: Added.
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::getExtension):
(WebCore::WebGL2RenderingContext::getSupportedExtensions):
* html/canvas/WebGLExtension.h:
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getExtension):
(WebCore::WebGLRenderingContext::getSupportedExtensions):
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::getProgramParameter):
(WebCore::WebGLRenderingContextBase::getShaderParameter):
(WebCore::WebGLRenderingContextBase::extensionIsEnabled):
(WebCore::WebGLRenderingContextBase::loseExtensions):
* html/canvas/WebGLRenderingContextBase.h:
* platform/graphics/ExtensionsGL.h:

LayoutTests:

* webgl/conformance/extensions/khr-parallel-shader-compile-expected.txt: Added.
* webgl/conformance/extensions/khr-parallel-shader-compile.html: Added.
* webgl/resources/webgl_test_files/conformance/extensions/khr-parallel-shader-compile.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (270256 => 270257)


--- trunk/LayoutTests/ChangeLog	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/LayoutTests/ChangeLog	2020-11-30 20:29:35 UTC (rev 270257)
@@ -1,3 +1,14 @@
+2020-11-30  James Darpinian  <[email protected]>
+
+        Support KHR_parallel_shader_compile
+        https://bugs.webkit.org/show_bug.cgi?id=219266
+
+        Reviewed by Kenneth Russell.
+
+        * webgl/conformance/extensions/khr-parallel-shader-compile-expected.txt: Added.
+        * webgl/conformance/extensions/khr-parallel-shader-compile.html: Added.
+        * webgl/resources/webgl_test_files/conformance/extensions/khr-parallel-shader-compile.html: Added.
+
 2020-11-30  Youenn Fablet  <[email protected]>
 
         Introduce an experimental flag specific to VP9 profile 2

Added: trunk/LayoutTests/webgl/conformance/extensions/khr-parallel-shader-compile-expected.txt (0 => 270257)


--- trunk/LayoutTests/webgl/conformance/extensions/khr-parallel-shader-compile-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgl/conformance/extensions/khr-parallel-shader-compile-expected.txt	2020-11-30 20:29:35 UTC (rev 270257)
@@ -0,0 +1,4 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/extensions/khr-parallel-shader-compile.html
+PASS

Added: trunk/LayoutTests/webgl/conformance/extensions/khr-parallel-shader-compile.html (0 => 270257)


--- trunk/LayoutTests/webgl/conformance/extensions/khr-parallel-shader-compile.html	                        (rev 0)
+++ trunk/LayoutTests/webgl/conformance/extensions/khr-parallel-shader-compile.html	2020-11-30 20:29:35 UTC (rev 270257)
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for khr-parallel-shader-compile.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/webgl_test_files/conformance/extensions/khr-parallel-shader-compile.html (0 => 270257)


--- trunk/LayoutTests/webgl/resources/webgl_test_files/conformance/extensions/khr-parallel-shader-compile.html	                        (rev 0)
+++ trunk/LayoutTests/webgl/resources/webgl_test_files/conformance/extensions/khr-parallel-shader-compile.html	2020-11-30 20:29:35 UTC (rev 270257)
@@ -0,0 +1,93 @@
+<!--
+Copyright (c) 2020 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">
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+"use strict";
+description("Test KHR_parallel_shader_compile");
+
+const wtu = WebGLTestUtils;
+
+const gl = wtu.create3DContext();
+const loseContext = wtu.getExtensionWithKnownPrefixes(gl, "WEBGL_lose_context");
+
+let counter = 0;
+const vertexSource = () => `
+void main() {
+    gl_Position = vec4(${counter++}, 1, 1, 1);
+}`;
+const fragmentSource = () => `
+void main() {
+    gl_FragColor = vec4(0.${counter++}, 1, 1, 1);
+}`;
+
+const vs = gl.createShader(gl.VERTEX_SHADER);
+const fs = gl.createShader(gl.FRAGMENT_SHADER);
+const program = gl.createProgram();
+gl.attachShader(program, vs);
+gl.attachShader(program, fs);
+
+const COMPLETION_STATUS_KHR = 0x91B1;
+
+gl.shaderSource(vs, vertexSource());
+gl.compileShader(vs);
+let status = gl.getShaderParameter(vs, COMPLETION_STATUS_KHR);
+if (status !== null) testFailed('Extension disabled, status should be null');
+wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "extension disabled");
+
+gl.shaderSource(fs, fragmentSource());
+gl.compileShader(fs);
+
+gl.linkProgram(program);
+status = gl.getProgramParameter(program, COMPLETION_STATUS_KHR);
+if (status !== null) testFailed('Extension disabled, status should be null');
+wtu.glErrorShouldBe(gl, gl.INVALID_ENUM, "extension disabled");
+
+const ext = wtu.getExtensionWithKnownPrefixes(gl, "KHR_parallel_shader_compile");
+if (!ext) {
+    testPassed("No KHR_parallel_shader_compile support -- this is legal");
+} else {
+    testPassed("Successfully enabled KHR_parallel_shader_compile extension");
+
+    shouldBe("ext.COMPLETION_STATUS_KHR", "0x91B1");
+
+    debug("Checking that status is a boolean.");
+    gl.shaderSource(vs, vertexSource());
+    gl.compileShader(vs);
+    let status = gl.getShaderParameter(vs, COMPLETION_STATUS_KHR);
+    if (status !== true && status !== false) testFailed("status should be a boolean");
+
+    gl.linkProgram(program);
+    status = gl.getProgramParameter(program, COMPLETION_STATUS_KHR);
+    if (status !== true && status !== false) testFailed("status should be a boolean");
+
+    debug("Checking that status is true when context is lost.");
+    if (loseContext) {
+        loseContext.loseContext();
+        status = gl.getShaderParameter(vs, COMPLETION_STATUS_KHR);
+        if (status !== true) testFailed("status should be true when context is lost");
+        status = gl.getProgramParameter(program, COMPLETION_STATUS_KHR);
+        if (status !== true) testFailed("status should be true when context is lost");
+    }
+}
+
+const successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/CMakeLists.txt (270256 => 270257)


--- trunk/Source/WebCore/CMakeLists.txt	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/CMakeLists.txt	2020-11-30 20:29:35 UTC (rev 270257)
@@ -1515,6 +1515,7 @@
         html/canvas/EXTTextureCompressionRGTC.cpp
         html/canvas/EXTTextureFilterAnisotropic.cpp
         html/canvas/EXTsRGB.cpp
+        html/canvas/KHRParallelShaderCompile.cpp
         html/canvas/OESElementIndexUint.cpp
         html/canvas/OESFBORenderMipmap.cpp
         html/canvas/OESStandardDerivatives.cpp
@@ -1574,6 +1575,7 @@
     html/canvas/EXTTextureCompressionRGTC.idl
     html/canvas/EXTTextureFilterAnisotropic.idl
     html/canvas/EXTsRGB.idl
+    html/canvas/KHRParallelShaderCompile.idl
     html/canvas/OESElementIndexUint.idl
     html/canvas/OESFBORenderMipmap.idl
     html/canvas/OESStandardDerivatives.idl

Modified: trunk/Source/WebCore/ChangeLog (270256 => 270257)


--- trunk/Source/WebCore/ChangeLog	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/ChangeLog	2020-11-30 20:29:35 UTC (rev 270257)
@@ -1,3 +1,41 @@
+2020-11-30  James Darpinian  <[email protected]>
+
+        Support KHR_parallel_shader_compile
+        https://bugs.webkit.org/show_bug.cgi?id=219266
+
+        Reviewed by Kenneth Russell.
+
+        Tested by webgl/conformance/extensions/khr-parallel-shader-compile.html
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSDOMConvertWebGL.cpp:
+        (WebCore::convertToJSValue):
+        * html/canvas/KHRParallelShaderCompile.cpp: Added.
+        (WebCore::KHRParallelShaderCompile::KHRParallelShaderCompile):
+        (WebCore::KHRParallelShaderCompile::getName const):
+        (WebCore::KHRParallelShaderCompile::supported):
+        * html/canvas/KHRParallelShaderCompile.h: Added.
+        * html/canvas/KHRParallelShaderCompile.idl: Added.
+        * html/canvas/WebGL2RenderingContext.cpp:
+        (WebCore::WebGL2RenderingContext::getExtension):
+        (WebCore::WebGL2RenderingContext::getSupportedExtensions):
+        * html/canvas/WebGLExtension.h:
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::getExtension):
+        (WebCore::WebGLRenderingContext::getSupportedExtensions):
+        * html/canvas/WebGLRenderingContextBase.cpp:
+        (WebCore::WebGLRenderingContextBase::getProgramParameter):
+        (WebCore::WebGLRenderingContextBase::getShaderParameter):
+        (WebCore::WebGLRenderingContextBase::extensionIsEnabled):
+        (WebCore::WebGLRenderingContextBase::loseExtensions):
+        * html/canvas/WebGLRenderingContextBase.h:
+        * platform/graphics/ExtensionsGL.h:
+
 2020-11-30  Youenn Fablet  <[email protected]>
 
         Introduce an experimental flag specific to VP9 profile 2

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (270256 => 270257)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-11-30 20:29:35 UTC (rev 270257)
@@ -985,6 +985,7 @@
 $(PROJECT_DIR)/html/canvas/ImageBitmapRenderingContext.idl
 $(PROJECT_DIR)/html/canvas/ImageBitmapRenderingContextSettings.idl
 $(PROJECT_DIR)/html/canvas/ImageSmoothingQuality.idl
+$(PROJECT_DIR)/html/canvas/KHRParallelShaderCompile.idl
 $(PROJECT_DIR)/html/canvas/OESElementIndexUint.idl
 $(PROJECT_DIR)/html/canvas/OESFBORenderMipmap.idl
 $(PROJECT_DIR)/html/canvas/OESStandardDerivatives.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (270256 => 270257)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-11-30 20:29:35 UTC (rev 270257)
@@ -1193,6 +1193,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSIterationCompositeOperation.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSJsonWebKey.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSJsonWebKey.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSKHRParallelShaderCompile.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSKHRParallelShaderCompile.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSKeyboardEvent.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSKeyboardEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSKeyframeAnimationOptions.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (270256 => 270257)


--- trunk/Source/WebCore/DerivedSources.make	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/DerivedSources.make	2020-11-30 20:29:35 UTC (rev 270257)
@@ -929,6 +929,7 @@
     $(WebCore)/html/canvas/ImageBitmapRenderingContext.idl \
     $(WebCore)/html/canvas/ImageBitmapRenderingContextSettings.idl \
     $(WebCore)/html/canvas/ImageSmoothingQuality.idl \
+    $(WebCore)/html/canvas/KHRParallelShaderCompile.idl \
     $(WebCore)/html/canvas/OESElementIndexUint.idl \
     $(WebCore)/html/canvas/OESFBORenderMipmap.idl \
     $(WebCore)/html/canvas/OESStandardDerivatives.idl \

Modified: trunk/Source/WebCore/Sources.txt (270256 => 270257)


--- trunk/Source/WebCore/Sources.txt	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/Sources.txt	2020-11-30 20:29:35 UTC (rev 270257)
@@ -1305,6 +1305,7 @@
 html/canvas/EXTsRGB.cpp
 html/canvas/GPUBasedCanvasRenderingContext.cpp
 html/canvas/ImageBitmapRenderingContext.cpp
+html/canvas/KHRParallelShaderCompile.cpp
 html/canvas/OESElementIndexUint.cpp
 html/canvas/OESFBORenderMipmap.cpp
 html/canvas/OESStandardDerivatives.cpp
@@ -2934,6 +2935,7 @@
 JSEXTTextureCompressionRGTC.cpp
 JSEXTTextureFilterAnisotropic.cpp
 JSEXTsRGB.cpp
+JSKHRParallelShaderCompile.cpp
 JSEcKeyParams.cpp
 JSEcdhKeyDeriveParams.cpp
 JSEcdsaParams.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (270256 => 270257)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-11-30 20:29:35 UTC (rev 270257)
@@ -12354,6 +12354,9 @@
 		A3AF9D8220325324006CAD06 /* UserAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserAgent.h; sourceTree = "<group>"; };
 		A3AF9D8320325691006CAD06 /* UserAgentIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentIOS.mm; sourceTree = "<group>"; };
 		A3AF9D84203256A3006CAD06 /* UserAgentMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserAgentMac.mm; sourceTree = "<group>"; };
+		A3BF7EF2256C8D720044BC75 /* KHRParallelShaderCompile.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = KHRParallelShaderCompile.cpp; sourceTree = "<group>"; };
+		A3BF7EF4256C8D720044BC75 /* KHRParallelShaderCompile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KHRParallelShaderCompile.h; sourceTree = "<group>"; };
+		A3BF7EF5256C8D740044BC75 /* KHRParallelShaderCompile.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = KHRParallelShaderCompile.idl; sourceTree = "<group>"; };
 		A3C3DC5D253A19920061F32A /* GPUPlatformTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPUPlatformTypes.h; sourceTree = "<group>"; };
 		A3D42A841F33BA3600A64B62 /* LayoutUnit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutUnit.cpp; sourceTree = "<group>"; };
 		A409C982116D0DDD007197BD /* AccessibilityProgressIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityProgressIndicator.cpp; sourceTree = "<group>"; };
@@ -19783,6 +19786,9 @@
 				318EAD4C1FA91352008CEF86 /* ImageBitmapRenderingContextSettings.idl */,
 				7C193BAF1F5E0EB40088F3E6 /* ImageSmoothingQuality.h */,
 				7C193BA81F5E0EAF0088F3E6 /* ImageSmoothingQuality.idl */,
+				A3BF7EF2256C8D720044BC75 /* KHRParallelShaderCompile.cpp */,
+				A3BF7EF4256C8D720044BC75 /* KHRParallelShaderCompile.h */,
+				A3BF7EF5256C8D740044BC75 /* KHRParallelShaderCompile.idl */,
 				7E5D7A73161D3F8F00896C34 /* OESElementIndexUint.cpp */,
 				7E5D7A74161D3F8F00896C34 /* OESElementIndexUint.h */,
 				E176580C180DF3A0005A96D1 /* OESElementIndexUint.idl */,
@@ -31224,6 +31230,7 @@
 				079D086B162F21F900DB8658 /* CaptionUserPreferencesMediaAF.h in Headers */,
 				07B7116D1D899E63009F0FFB /* CaptureDevice.h in Headers */,
 				07B7116F1D899E63009F0FFB /* CaptureDeviceManager.h in Headers */,
+				E4F0BE3125712F6E009E7431 /* CaretRectComputation.h in Headers */,
 				CDC734151977896D0046BFC5 /* CARingBuffer.h in Headers */,
 				E4ABABF52368C6EF00FA4345 /* CascadeLevel.h in Headers */,
 				57303BBB2006C6EE00355965 /* CBORBinary.h in Headers */,
@@ -35121,7 +35128,6 @@
 				A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */,
 				6E3FAE8F14733FDB00E42307 /* WebGLDepthTexture.h in Headers */,
 				5B30695E18B3D3450099D5E8 /* WebGLDrawBuffers.h in Headers */,
-				E4F0BE3125712F6E009E7431 /* CaretRectComputation.h in Headers */,
 				6EBF0E5512A8929800DB1709 /* WebGLExtension.h in Headers */,
 				49C7B9CF1042D32F0009D447 /* WebGLFramebuffer.h in Headers */,
 				49FFBF3F11C93EE3006A7118 /* WebGLLayer.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp (270256 => 270257)


--- trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp	2020-11-30 20:29:35 UTC (rev 270257)
@@ -39,6 +39,7 @@
 #include "JSEXTTextureCompressionRGTC.h"
 #include "JSEXTTextureFilterAnisotropic.h"
 #include "JSEXTsRGB.h"
+#include "JSKHRParallelShaderCompile.h"
 #include "JSOESElementIndexUint.h"
 #include "JSOESFBORenderMipmap.h"
 #include "JSOESStandardDerivatives.h"
@@ -182,6 +183,8 @@
         return toJS(&lexicalGlobalObject, &globalObject, static_cast<EXTFragDepth&>(extension));
     case WebGLExtension::EXTBlendMinMaxName:
         return toJS(&lexicalGlobalObject, &globalObject, static_cast<EXTBlendMinMax&>(extension));
+    case WebGLExtension::KHRParallelShaderCompileName:
+        return toJS(&lexicalGlobalObject, &globalObject, static_cast<KHRParallelShaderCompile&>(extension));
     case WebGLExtension::OESStandardDerivativesName:
         return toJS(&lexicalGlobalObject, &globalObject, static_cast<OESStandardDerivatives&>(extension));
     case WebGLExtension::OESTextureFloatName:

Added: trunk/Source/WebCore/html/canvas/KHRParallelShaderCompile.cpp (0 => 270257)


--- trunk/Source/WebCore/html/canvas/KHRParallelShaderCompile.cpp	                        (rev 0)
+++ trunk/Source/WebCore/html/canvas/KHRParallelShaderCompile.cpp	2020-11-30 20:29:35 UTC (rev 270257)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEBGL)
+#include "KHRParallelShaderCompile.h"
+
+#include "ExtensionsGL.h"
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(KHRParallelShaderCompile);
+
+KHRParallelShaderCompile::KHRParallelShaderCompile(WebGLRenderingContextBase& context)
+    : WebGLExtension(context)
+{
+    context.graphicsContextGL()->getExtensions().ensureEnabled("GL_KHR_parallel_shader_compile"_s);
+}
+
+KHRParallelShaderCompile::~KHRParallelShaderCompile() = default;
+
+WebGLExtension::ExtensionName KHRParallelShaderCompile::getName() const
+{
+    return KHRParallelShaderCompileName;
+}
+
+bool KHRParallelShaderCompile::supported(const WebGLRenderingContextBase& context)
+{
+    return context.graphicsContextGL()->getExtensions().supports("GL_KHR_parallel_shader_compile"_s);
+}
+    
+} // namespace WebCore
+
+#endif // ENABLE(WEBGL)

Added: trunk/Source/WebCore/html/canvas/KHRParallelShaderCompile.h (0 => 270257)


--- trunk/Source/WebCore/html/canvas/KHRParallelShaderCompile.h	                        (rev 0)
+++ trunk/Source/WebCore/html/canvas/KHRParallelShaderCompile.h	2020-11-30 20:29:35 UTC (rev 270257)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "WebGLExtension.h"
+
+namespace WebCore {
+
+class KHRParallelShaderCompile final : public WebGLExtension {
+    WTF_MAKE_ISO_ALLOCATED(KHRParallelShaderCompile);
+public:
+    explicit KHRParallelShaderCompile(WebGLRenderingContextBase&);
+    ~KHRParallelShaderCompile() override final;
+
+    ExtensionName getName() const override;
+
+    static bool supported(const WebGLRenderingContextBase&);
+};
+
+} // namespace WebCore

Added: trunk/Source/WebCore/html/canvas/KHRParallelShaderCompile.idl (0 => 270257)


--- trunk/Source/WebCore/html/canvas/KHRParallelShaderCompile.idl	                        (rev 0)
+++ trunk/Source/WebCore/html/canvas/KHRParallelShaderCompile.idl	2020-11-30 20:29:35 UTC (rev 270257)
@@ -0,0 +1,32 @@
+/*
+* Copyright (C) 2020 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+*
+* 1.  Redistributions of source code must retain the above copyright
+*     notice, this list of conditions and the following disclaimer.
+* 2.  Redistributions in binary form must reproduce the above copyright
+*     notice, this list of conditions and the following disclaimer in the
+*     documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+    LegacyNoInterfaceObject,
+    Conditional=WEBGL,
+    GenerateIsReachable=ImplWebGLRenderingContext
+] interface KHRParallelShaderCompile {
+    const unsigned long COMPLETION_STATUS_KHR = 0x91B1;
+};

Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (270256 => 270257)


--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp	2020-11-30 20:29:35 UTC (rev 270257)
@@ -42,6 +42,7 @@
 #include "ImageBitmap.h"
 #include "ImageData.h"
 #include "InspectorInstrumentation.h"
+#include "KHRParallelShaderCompile.h"
 #include "Logging.h"
 #include "OESTextureFloatLinear.h"
 #include "RenderBox.h"
@@ -2688,6 +2689,7 @@
     ENABLE_IF_REQUESTED(EXTColorBufferFloat, m_extColorBufferFloat, "EXT_color_buffer_float", EXTColorBufferFloat::supported(*this));
     ENABLE_IF_REQUESTED(EXTColorBufferHalfFloat, m_extColorBufferHalfFloat, "EXT_color_buffer_half_float", EXTColorBufferHalfFloat::supported(*this));
     ENABLE_IF_REQUESTED(EXTFloatBlend, m_extFloatBlend, "EXT_float_blend", EXTFloatBlend::supported(*this));
+    ENABLE_IF_REQUESTED(KHRParallelShaderCompile, m_khrParallelShaderCompile, "KHR_parallel_shader_compile", KHRParallelShaderCompile::supported(*this));
     return nullptr;
 }
 
@@ -2734,6 +2736,8 @@
         result.append("EXT_color_buffer_half_float"_s);
     if (EXTFloatBlend::supported(*this))
         result.append("EXT_float_blend"_s);
+    if (KHRParallelShaderCompile::supported(*this))
+        result.append("KHR_parallel_shader_compile"_s);
 
     return result;
 }

Modified: trunk/Source/WebCore/html/canvas/WebGLExtension.h (270256 => 270257)


--- trunk/Source/WebCore/html/canvas/WebGLExtension.h	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/html/canvas/WebGLExtension.h	2020-11-30 20:29:35 UTC (rev 270257)
@@ -44,6 +44,7 @@
         EXTTextureCompressionRGTCName,
         EXTTextureFilterAnisotropicName,
         EXTsRGBName,
+        KHRParallelShaderCompileName,
         OESTextureFloatName,
         OESTextureFloatLinearName,
         OESTextureHalfFloatName,

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (270256 => 270257)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2020-11-30 20:29:35 UTC (rev 270257)
@@ -44,6 +44,7 @@
 #include "HTMLVideoElement.h"
 #include "ImageData.h"
 #include "InspectorInstrumentation.h"
+#include "KHRParallelShaderCompile.h"
 #include "OESElementIndexUint.h"
 #include "OESFBORenderMipmap.h"
 #include "OESStandardDerivatives.h"
@@ -155,6 +156,7 @@
     }
     ENABLE_IF_REQUESTED(EXTTextureFilterAnisotropic, m_extTextureFilterAnisotropic, "EXT_texture_filter_anisotropic", enableSupportedExtension("GL_EXT_texture_filter_anisotropic"_s));
     ENABLE_IF_REQUESTED(EXTTextureCompressionRGTC, m_extTextureCompressionRGTC, "EXT_texture_compression_rgtc", enableSupportedExtension("GL_EXT_texture_compression_rgtc"_s));
+    ENABLE_IF_REQUESTED(KHRParallelShaderCompile, m_khrParallelShaderCompile, "KHR_parallel_shader_compile", KHRParallelShaderCompile::supported(*this));
     ENABLE_IF_REQUESTED(OESStandardDerivatives, m_oesStandardDerivatives, "OES_standard_derivatives", enableSupportedExtension("GL_OES_standard_derivatives"_s));
     ENABLE_IF_REQUESTED(OESTextureFloat, m_oesTextureFloat, "OES_texture_float", OESTextureFloat::supported(*this));
     ENABLE_IF_REQUESTED(OESTextureFloatLinear, m_oesTextureFloatLinear, "OES_texture_float_linear", enableSupportedExtension("GL_OES_texture_float_linear"_s));
@@ -275,6 +277,8 @@
         result.append("EXT_float_blend"_s);
     if (WebGLColorBufferFloat::supported(*this))
         result.append("WEBGL_color_buffer_float"_s);
+    if (KHRParallelShaderCompile::supported(*this))
+        result.append("KHR_parallel_shader_compile");
 
     return result;
 }

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (270256 => 270257)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2020-11-30 20:29:35 UTC (rev 270257)
@@ -61,6 +61,7 @@
 #include "InspectorInstrumentation.h"
 #include "IntSize.h"
 #include "JSExecState.h"
+#include "KHRParallelShaderCompile.h"
 #include "Logging.h"
 #include "NavigatorWebXR.h"
 #include "NotImplemented.h"
@@ -3209,8 +3210,15 @@
 
 WebGLAny WebGLRenderingContextBase::getProgramParameter(WebGLProgram& program, GCGLenum pname)
 {
-    if (isContextLostOrPending() || !validateWebGLProgramOrShader("getProgramParameter", &program))
+    // COMPLETION_STATUS_KHR should always return true if the context is lost, so applications
+    // don't get stuck in an infinite polling loop.
+    if (isContextLostOrPending()) {
+        if (pname == ExtensionsGL::COMPLETION_STATUS_KHR)
+            return true;
         return nullptr;
+    }
+    if (!validateWebGLProgramOrShader("getProgramParameter", &program))
+        return nullptr;
 
     switch (pname) {
     case GraphicsContextGL::DELETE_STATUS:
@@ -3232,6 +3240,11 @@
             return value;
         }
 #endif // USE(ANGLE)
+    case ExtensionsGL::COMPLETION_STATUS_KHR:
+        if (m_khrParallelShaderCompile)
+            return static_cast<bool>(m_context->getProgrami(program.object(), pname));
+        synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "getProgramParameter", "KHR_parallel_shader_compile not enabled");
+        return nullptr;
     default:
 #if ENABLE(WEBGL2)
         if (isWebGL2()) {
@@ -3328,8 +3341,16 @@
 
 WebGLAny WebGLRenderingContextBase::getShaderParameter(WebGLShader& shader, GCGLenum pname)
 {
-    if (isContextLostOrPending() || !validateWebGLProgramOrShader("getShaderParameter", &shader))
+    // COMPLETION_STATUS_KHR should always return true if the context is lost, so applications
+    // don't get stuck in an infinite polling loop.
+    if (isContextLostOrPending()) {
+        if (pname == ExtensionsGL::COMPLETION_STATUS_KHR)
+            return true;
         return nullptr;
+    }
+    if (!validateWebGLProgramOrShader("getShaderParameter", &shader))
+        return nullptr;
+
     switch (pname) {
     case GraphicsContextGL::DELETE_STATUS:
         return shader.isDeleted();
@@ -3337,6 +3358,11 @@
         return static_cast<bool>(m_context->getShaderi(shader.object(), pname));
     case GraphicsContextGL::SHADER_TYPE:
         return static_cast<unsigned>(m_context->getShaderi(shader.object(), pname));
+    case ExtensionsGL::COMPLETION_STATUS_KHR:
+        if (m_khrParallelShaderCompile)
+            return static_cast<bool>(m_context->getShaderi(shader.object(), pname));
+        synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "getShaderParameter", "KHR_parallel_shader_compile not enabled");
+        return nullptr;
     default:
         synthesizeGLError(GraphicsContextGL::INVALID_ENUM, "getShaderParameter", "invalid parameter name");
         return nullptr;
@@ -3732,6 +3758,7 @@
     CHECK_EXTENSION(m_extTextureFilterAnisotropic, "EXT_texture_filter_anisotropic");
     CHECK_EXTENSION(m_extTextureFilterAnisotropic, "WEBKIT_EXT_texture_filter_anisotropic");
     CHECK_EXTENSION(m_extShaderTextureLOD, "EXT_shader_texture_lod");
+    CHECK_EXTENSION(m_khrParallelShaderCompile, "KHR_parallel_shader_compile");
     CHECK_EXTENSION(m_oesTextureFloat, "OES_texture_float");
     CHECK_EXTENSION(m_oesTextureFloatLinear, "OES_texture_float_linear");
     CHECK_EXTENSION(m_oesTextureHalfFloat, "OES_texture_half_float");
@@ -7836,6 +7863,7 @@
     LOSE_EXTENSION(m_extTextureCompressionRGTC);
     LOSE_EXTENSION(m_extTextureFilterAnisotropic);
     LOSE_EXTENSION(m_extShaderTextureLOD);
+    LOSE_EXTENSION(m_khrParallelShaderCompile);
     LOSE_EXTENSION(m_oesTextureFloat);
     LOSE_EXTENSION(m_oesTextureFloatLinear);
     LOSE_EXTENSION(m_oesTextureHalfFloat);

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (270256 => 270257)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2020-11-30 20:29:35 UTC (rev 270257)
@@ -80,6 +80,7 @@
 class HTMLImageElement;
 class ImageData;
 class IntSize;
+class KHRParallelShaderCompile;
 class OESStandardDerivatives;
 class OESTextureFloat;
 class OESTextureFloatLinear;
@@ -676,6 +677,7 @@
     RefPtr<EXTTextureCompressionRGTC> m_extTextureCompressionRGTC;
     RefPtr<EXTTextureFilterAnisotropic> m_extTextureFilterAnisotropic;
     RefPtr<EXTShaderTextureLOD> m_extShaderTextureLOD;
+    RefPtr<KHRParallelShaderCompile> m_khrParallelShaderCompile;
     RefPtr<OESTextureFloat> m_oesTextureFloat;
     RefPtr<OESTextureFloatLinear> m_oesTextureFloatLinear;
     RefPtr<OESTextureHalfFloat> m_oesTextureHalfFloat;

Modified: trunk/Source/WebCore/platform/graphics/ExtensionsGL.h (270256 => 270257)


--- trunk/Source/WebCore/platform/graphics/ExtensionsGL.h	2020-11-30 19:36:55 UTC (rev 270256)
+++ trunk/Source/WebCore/platform/graphics/ExtensionsGL.h	2020-11-30 20:29:35 UTC (rev 270257)
@@ -264,6 +264,9 @@
     static constexpr GCGLenum COLOR_ATTACHMENT14_EXT = 0x8CEE;
     static constexpr GCGLenum COLOR_ATTACHMENT15_EXT = 0x8CEF;
 
+    // GL_KHR_parallel_shader_compile
+    static constexpr GCGLenum COMPLETION_STATUS_KHR = 0x91B1;
+
     // WebGL functions in format generate-gpup-webgl understands.
 
     // GL_ARB_robustness
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to