Unreviewed, rolling out r250114.
authortsavell@apple.com <tsavell@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Sep 2019 19:39:42 +0000 (19:39 +0000)
committertsavell@apple.com <tsavell@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Sep 2019 19:39:42 +0000 (19:39 +0000)
Broke ~16 webgpu/ tests on Mojave wk2

Reverted changeset:

"Web Inspector: Canvas: show WebGPU shader pipelines"
https://bugs.webkit.org/show_bug.cgi?id=201675
https://trac.webkit.org/changeset/250114

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

82 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/canvas/console-record-webgl.html
LayoutTests/inspector/canvas/console-record-webgl2.html
LayoutTests/inspector/canvas/recording-webgl-frameCount.html
LayoutTests/inspector/canvas/recording-webgl-full.html
LayoutTests/inspector/canvas/recording-webgl-memoryLimit.html
LayoutTests/inspector/canvas/recording-webgl-snapshots.html
LayoutTests/inspector/canvas/recording-webgl2-frameCount.html
LayoutTests/inspector/canvas/recording-webgl2-full.html
LayoutTests/inspector/canvas/recording-webgl2-memoryLimit.html
LayoutTests/inspector/canvas/recording-webgl2-snapshots.html
LayoutTests/inspector/canvas/requestShaderSource-expected.txt
LayoutTests/inspector/canvas/requestShaderSource-webgl-expected.txt [deleted file]
LayoutTests/inspector/canvas/requestShaderSource-webgl.html [deleted file]
LayoutTests/inspector/canvas/requestShaderSource-webgpu-expected.txt [deleted file]
LayoutTests/inspector/canvas/requestShaderSource-webgpu.html [deleted file]
LayoutTests/inspector/canvas/requestShaderSource.html
LayoutTests/inspector/canvas/resources/shaderProgram-utilities-webgpu.js [deleted file]
LayoutTests/inspector/canvas/resources/shaderProgram-utilities.js [moved from LayoutTests/inspector/canvas/resources/shaderProgram-utilities-webgl.js with 100% similarity]
LayoutTests/inspector/canvas/setShaderProgramDisabled.html
LayoutTests/inspector/canvas/setShaderProgramHighlighted.html
LayoutTests/inspector/canvas/shaderProgram-add-remove-webgl.html
LayoutTests/inspector/canvas/shaderProgram-add-remove-webgl2.html
LayoutTests/inspector/canvas/shaderProgram-add-remove-webgpu-expected.txt [deleted file]
LayoutTests/inspector/canvas/shaderProgram-add-remove-webgpu.html [deleted file]
LayoutTests/inspector/canvas/updateShader-expected.txt
LayoutTests/inspector/canvas/updateShader-webgl-expected.txt [deleted file]
LayoutTests/inspector/canvas/updateShader-webgl.html [deleted file]
LayoutTests/inspector/canvas/updateShader-webgpu-expected.txt [deleted file]
LayoutTests/inspector/canvas/updateShader-webgpu.html [deleted file]
LayoutTests/inspector/canvas/updateShader.html
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wincairo/TestExpectations
LayoutTests/platform/wpe/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Canvas.json
Source/WebCore/ChangeLog
Source/WebCore/Modules/webgpu/WebGPUComputePipeline.cpp
Source/WebCore/Modules/webgpu/WebGPUComputePipeline.h
Source/WebCore/Modules/webgpu/WebGPUComputePipeline.idl
Source/WebCore/Modules/webgpu/WebGPUDevice.cpp
Source/WebCore/Modules/webgpu/WebGPUDevice.h
Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp [deleted file]
Source/WebCore/Modules/webgpu/WebGPUPipeline.h [deleted file]
Source/WebCore/Modules/webgpu/WebGPUProgrammableStageDescriptor.h
Source/WebCore/Modules/webgpu/WebGPURenderPipeline.cpp
Source/WebCore/Modules/webgpu/WebGPURenderPipeline.h
Source/WebCore/Modules/webgpu/WebGPURenderPipeline.idl
Source/WebCore/Modules/webgpu/WebGPUShaderModule.cpp
Source/WebCore/Modules/webgpu/WebGPUShaderModule.h
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/canvas/WebGLProgram.cpp
Source/WebCore/html/canvas/WebGLProgram.h
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorShaderProgram.cpp
Source/WebCore/inspector/InspectorShaderProgram.h
Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
Source/WebCore/inspector/agents/InspectorCanvasAgent.h
Source/WebCore/platform/graphics/gpu/GPUComputePipeline.h
Source/WebCore/platform/graphics/gpu/GPUPipeline.cpp [deleted file]
Source/WebCore/platform/graphics/gpu/GPUPipeline.h [deleted file]
Source/WebCore/platform/graphics/gpu/GPUProgrammableStageDescriptor.h
Source/WebCore/platform/graphics/gpu/GPURenderPipeline.h
Source/WebCore/platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm
Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Controllers/CanvasManager.js
Source/WebInspectorUI/UserInterface/Models/Canvas.js
Source/WebInspectorUI/UserInterface/Models/ShaderProgram.js
Source/WebInspectorUI/UserInterface/Protocol/CanvasObserver.js
Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js
Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.css
Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js
Source/WebInspectorUI/UserInterface/Views/ShaderProgramTreeElement.js

index 9524ddf..b9d4a6f 100644 (file)
@@ -1,3 +1,15 @@
+2019-09-20  Truitt Savell  <tsavell@apple.com>
+
+        Unreviewed, rolling out r250114.
+
+        Broke ~16 webgpu/ tests on Mojave wk2
+
+        Reverted changeset:
+
+        "Web Inspector: Canvas: show WebGPU shader pipelines"
+        https://bugs.webkit.org/show_bug.cgi?id=201675
+        https://trac.webkit.org/changeset/250114
+
 2019-09-20  Rob Buis  <rbuis@igalia.com>
 
         Synchronize MathML WPT tests against upstream
 2019-09-20  Rob Buis  <rbuis@igalia.com>
 
         Synchronize MathML WPT tests against upstream
index e983f19..32f559b 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
index 3763709..13e1a01 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
index 8d9a6dc..f240276 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
index 76133ee..c74361b 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
index 8955817..64bff31 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
index 3d5588d..b70c7c5 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec3 position;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec3 position;
     void main(void) {
index 50fbede..4ca7c1d 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
index 1874ea9..ba68e17 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
index 8604df6..0174b0a 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec4 test;
     void main(void) {
index 9e9a4a8..82f27c9 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <script src="resources/recording-utilities.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec3 position;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec3 position;
     void main(void) {
index f92f495..64bcdf3 100644 (file)
@@ -1,8 +1,28 @@
-Common tests for Canvas.requestShaderSource command.
+Test compilation of shaders after being attached to a program, with and without syntax errors.
 
 
 
 
-== Running test suite: Canvas.requestShaderSource
--- Running test case: Canvas.requestShaderSource.ProgramId.Invalid
+== Running test suite: Canvas.getShaderSource
+-- Running test case: Canvas.requestShaderSource.vertexShader
+
+    void main(void) {
+        gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+    }
+
+
+-- Running test case: Canvas.requestShaderSource.fragmentShader
+
+    precision mediump float;
+
+    void main(void) {
+        gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
+    }
+
+
+-- Running test case: Canvas.requestShaderSource.invalidProgramId
 PASS: Should produce an error.
 Error: Missing program for given programId
 
 PASS: Should produce an error.
 Error: Missing program for given programId
 
+-- Running test case: Canvas.requestShaderSource.invalidShaderType
+PASS: Should produce an error.
+Error: Missing shader for given shaderType
+
diff --git a/LayoutTests/inspector/canvas/requestShaderSource-webgl-expected.txt b/LayoutTests/inspector/canvas/requestShaderSource-webgl-expected.txt
deleted file mode 100644 (file)
index 7523af4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-WebGL tests for Canvas.requestShaderSource command.
-
-
-== Running test suite: Canvas.requestShaderSource.WebGL
--- Running test case: Canvas.requestShaderSource.WebGL.Vertex
-
-    void main(void) {
-        gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
-    }
-
-
--- Running test case: Canvas.requestShaderSource.WebGL.Fragment
-
-    precision mediump float;
-
-    void main(void) {
-        gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
-    }
-
-
--- Running test case: Canvas.requestShaderSource.WebGL.ShaderType.Invalid
-PASS: Should produce an error.
-Error: Unknown shaderType: INVALID_SHADER_TYPE
-
diff --git a/LayoutTests/inspector/canvas/requestShaderSource-webgl.html b/LayoutTests/inspector/canvas/requestShaderSource-webgl.html
deleted file mode 100644 (file)
index 0b2b750..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
-<script id="vertex-shader" type="x-shader/x-vertex">
-    void main(void) {
-        gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
-    }
-</script>
-<script id="fragment-shader" type="x-shader/x-fragment">
-    precision mediump float;
-
-    void main(void) {
-        gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
-    }
-</script>
-<script>
-function load() {
-    createProgram("webgl");
-    linkProgram("vertex-shader", "fragment-shader");
-
-    runTest();
-}
-
-function test() {
-    let suite = InspectorTest.createAsyncSuite("Canvas.requestShaderSource.WebGL");
-
-    suite.addTestCase({
-        name: "Canvas.requestShaderSource.WebGL.Vertex",
-        description: "Tests requesting the source code of a program's vertex shader.",
-        test(resolve, reject) {
-            let shaderProgram = WI.canvasManager.shaderPrograms[0];
-            if (!shaderProgram) {
-                reject("Missing shader program")
-                return;
-            }
-
-            CanvasAgent.requestShaderSource(shaderProgram.identifier, CanvasAgent.ShaderType.Vertex)
-            .then(({source}) => InspectorTest.log(source))
-            .then(resolve, reject);
-        }
-    });
-
-    suite.addTestCase({
-        name: "Canvas.requestShaderSource.WebGL.Fragment",
-        description: "Tests requesting the source code of a program's fragment shader.",
-        test(resolve, reject) {
-            let shaderProgram = WI.canvasManager.shaderPrograms[0];
-            if (!shaderProgram) {
-                reject("Missing shader program")
-                return;
-            }
-
-            CanvasAgent.requestShaderSource(shaderProgram.identifier, CanvasAgent.ShaderType.Fragment)
-            .then(({source}) => InspectorTest.log(source))
-            .then(resolve, reject);
-        }
-    });
-
-    suite.addTestCase({
-        name: "Canvas.requestShaderSource.WebGL.ShaderType.Invalid",
-        description: "Invalid shader types should cause an error.",
-        test(resolve, reject) {
-            let shaderProgram = WI.canvasManager.shaderPrograms[0];
-            if (!shaderProgram) {
-                reject("Missing shader program")
-                return;
-            }
-
-            const shaderType = "INVALID_SHADER_TYPE";
-            CanvasAgent.requestShaderSource(shaderProgram.identifier, shaderType, (error) => {
-                InspectorTest.expectThat(error, "Should produce an error.");
-                InspectorTest.log("Error: " + error);
-                resolve();
-            });
-        }
-    });
-
-    suite.runTestCasesAndFinish();
-}
-</script>
-</head>
-<body onload="load()">
-<p>WebGL tests for Canvas.requestShaderSource command.</p>
-</body>
-</html>
diff --git a/LayoutTests/inspector/canvas/requestShaderSource-webgpu-expected.txt b/LayoutTests/inspector/canvas/requestShaderSource-webgpu-expected.txt
deleted file mode 100644 (file)
index 0ae56fa..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-WebGPU tests for Canvas.requestShaderSource command.
-
-
-== Running test suite: Canvas.requestShaderSource.WebGPU
--- Running test case: Canvas.requestShaderSource.WebGPU.Program.compute.Shader.compute
-
-[numthreads(2, 1, 1)]
-compute void computeShader(device float[] buffer : register(u0), float3 threadID : SV_DispatchThreadID) {
-    buffer[uint(threadID.x)] = buffer[uint(threadID.x)] * 2.0;
-}
-
-
--- Running test case: Canvas.requestShaderSource.WebGPU.Program.compute.Shader.fragment
-PASS: Should produce an exception.
-Error: Missing shader of given shaderType for given programId
-
--- Running test case: Canvas.requestShaderSource.WebGPU.Program.compute.Shader.vertex
-PASS: Should produce an exception.
-Error: Missing shader of given shaderType for given programId
-
--- Running test case: Canvas.requestShaderSource.WebGPU.Program.render.Shader.compute
-PASS: Should produce an exception.
-Error: Missing shader of given shaderType for given programId
-
--- Running test case: Canvas.requestShaderSource.WebGPU.Program.render.Shader.fragment
-
-fragment float4 fragmentShader(float4 position : SV_Position) : SV_Target 0 {
-    return position;
-}
-
-
--- Running test case: Canvas.requestShaderSource.WebGPU.Program.render.Shader.vertex
-
-vertex float4 vertexShader(float4 position : attribute(0), float i : attribute(1)) : SV_Position {
-    return position;
-}
-
-
diff --git a/LayoutTests/inspector/canvas/requestShaderSource-webgpu.html b/LayoutTests/inspector/canvas/requestShaderSource-webgpu.html
deleted file mode 100644 (file)
index 32be60e..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script src="resources/shaderProgram-utilities-webgpu.js"></script>
-<script>
-function test() {
-    let suite = InspectorTest.createAsyncSuite("Canvas.requestShaderSource.WebGPU");
-
-    for (let programType of Object.values(WI.ShaderProgram.ProgramType)) {
-        for (let shaderType of Object.values(WI.ShaderProgram.ShaderType)) {
-            suite.addTestCase({
-                name: `Canvas.requestShaderSource.WebGPU.Program.${programType}.Shader.${shaderType}`,
-                async test() {
-                    let shaderProgram = InspectorTest.ShaderProgram.programForType(programType);
-                    if (!shaderProgram)
-                        throw "Missing shader program";
-
-                    let logShader = async () => {
-                        let {source} = await CanvasAgent.requestShaderSource(shaderProgram.identifier, shaderType);
-                        InspectorTest.log(source);
-                    };
-
-                    let isComputeProgram = programType === WI.ShaderProgram.ProgramType.Compute;
-                    let isComputeShader = shaderType === WI.ShaderProgram.ShaderType.Compute;
-                    if (isComputeProgram !== isComputeShader)
-                        await InspectorTest.expectException(logShader);
-                    else
-                        await logShader()
-                }
-            });
-        }
-    }
-
-    suite.runTestCasesAndFinish();
-}
-</script>
-</head>
-<body onload="load()">
-<p>WebGPU tests for Canvas.requestShaderSource command.</p>
-</body>
-</html>
index 91e60ea..a689c16 100644 (file)
@@ -2,12 +2,64 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
+<script id="vertex-shader" type="x-shader/x-vertex">
+    void main(void) {
+        gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+    }
+</script>
+<script id="fragment-shader" type="x-shader/x-fragment">
+    precision mediump float;
+
+    void main(void) {
+        gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
+    }
+</script>
 <script>
 <script>
+function load() {
+    createProgram("webgl");
+    linkProgram("vertex-shader", "fragment-shader");
+
+    runTest();
+}
+
 function test() {
 function test() {
-    let suite = InspectorTest.createAsyncSuite("Canvas.requestShaderSource");
+    let suite = InspectorTest.createAsyncSuite("Canvas.getShaderSource");
 
     suite.addTestCase({
 
     suite.addTestCase({
-        name: "Canvas.requestShaderSource.ProgramId.Invalid",
+        name: "Canvas.requestShaderSource.vertexShader",
+        description: "Tests requesting the source code of a program's vertex shader.",
+        test(resolve, reject) {
+            let shaderProgram = WI.canvasManager.shaderPrograms[0];
+            if (!shaderProgram) {
+                reject("Missing shader program")
+                return;
+            }
+
+            CanvasAgent.requestShaderSource(shaderProgram.identifier, CanvasAgent.ShaderType.Vertex)
+            .then(({content}) => InspectorTest.log(content))
+            .then(resolve, reject);
+        }
+    });
+
+    suite.addTestCase({
+        name: "Canvas.requestShaderSource.fragmentShader",
+        description: "Tests requesting the source code of a program's fragment shader.",
+        test(resolve, reject) {
+            let shaderProgram = WI.canvasManager.shaderPrograms[0];
+            if (!shaderProgram) {
+                reject("Missing shader program")
+                return;
+            }
+
+            CanvasAgent.requestShaderSource(shaderProgram.identifier, CanvasAgent.ShaderType.Fragment)
+            .then(({content}) => InspectorTest.log(content))
+            .then(resolve, reject);
+        }
+    });
+
+    suite.addTestCase({
+        name: "Canvas.requestShaderSource.invalidProgramId",
         description: "Invalid program identifiers should cause an error.",
         test(resolve, reject) {
             const programId = "INVALID_PROGRAM_ID";
         description: "Invalid program identifiers should cause an error.",
         test(resolve, reject) {
             const programId = "INVALID_PROGRAM_ID";
@@ -20,11 +72,30 @@ function test() {
         }
     });
 
         }
     });
 
+    suite.addTestCase({
+        name: "Canvas.requestShaderSource.invalidShaderType",
+        description: "Invalid shader types should cause an error.",
+        test(resolve, reject) {
+            let shaderProgram = WI.canvasManager.shaderPrograms[0];
+            if (!shaderProgram) {
+                reject("Missing shader program")
+                return;
+            }
+
+            const shaderType = "INVALID_SHADER_TYPE";
+            CanvasAgent.requestShaderSource(shaderProgram.identifier, shaderType, (error) => {
+                InspectorTest.expectThat(error, "Should produce an error.");
+                InspectorTest.log("Error: " + error);
+                resolve();
+            });
+        }
+    });
+
     suite.runTestCasesAndFinish();
 }
 </script>
 </head>
     suite.runTestCasesAndFinish();
 }
 </script>
 </head>
-<body onload="runTest()">
-<p>Common tests for Canvas.requestShaderSource command.</p>
+<body onload="load()">
+    <p>Test compilation of shaders after being attached to a program, with and without syntax errors.</p>
 </body>
 </html>
 </body>
 </html>
diff --git a/LayoutTests/inspector/canvas/resources/shaderProgram-utilities-webgpu.js b/LayoutTests/inspector/canvas/resources/shaderProgram-utilities-webgpu.js
deleted file mode 100644 (file)
index bccfe3a..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-if (window.internals)
-    window.internals.settings.setWebGPUEnabled(true);
-
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
-
-const computeShaderSource = `
-[numthreads(2, 1, 1)]
-compute void computeShader(device float[] buffer : register(u0), float3 threadID : SV_DispatchThreadID) {
-    buffer[uint(threadID.x)] = buffer[uint(threadID.x)] * 2.0;
-}
-`;
-
-const vertexShaderSource = `
-vertex float4 vertexShader(float4 position : attribute(0), float i : attribute(1)) : SV_Position {
-    return position;
-}
-`;
-
-const fragmentShaderSource = `
-fragment float4 fragmentShader(float4 position : SV_Position) : SV_Target 0 {
-    return position;
-}
-`;
-
-let device = null;
-
-async function createComputePipeline(computeCode = computeShaderSource) {
-    // Copied from webgpu/whlsl/compute.html.
-
-    const shaderModule = device.createShaderModule({code: computeCode});
-    const computeStage = {module: shaderModule, entryPoint: "computeShader"};
-
-    const bindGroupLayoutDescriptor = {bindings: [{binding: 0, visibility: 7, type: "storage-buffer"}]};
-    const bindGroupLayout = device.createBindGroupLayout(bindGroupLayoutDescriptor);
-    const pipelineLayoutDescriptor = {bindGroupLayouts: [bindGroupLayout]};
-    const pipelineLayout = device.createPipelineLayout(pipelineLayoutDescriptor);
-
-    device.createComputePipeline({computeStage, layout: pipelineLayout});
-}
-
-async function createRenderPipeline(vertexCode = vertexShaderSource, fragmentCode = fragmentShaderSource) {
-    // Copied from webgpu/whlsl/whlsl.html.
-
-    const vertexShaderModule = device.createShaderModule({code: vertexCode});
-    const vertexStage = {module: vertexShaderModule, entryPoint: "vertexShader"};
-
-    const fragmentShaderModule = device.createShaderModule({code: fragmentCode});
-    const fragmentStage = {module: fragmentShaderModule, entryPoint: "fragmentShader"};
-
-    const primitiveTopology = "triangle-strip";
-    const rasterizationState = {frontFace: "cw", cullMode: "none"};
-    const alphaBlend = {};
-    const colorBlend = {};
-    const colorStates = [{format: "rgba8unorm", alphaBlend, colorBlend, writeMask: 15}]; // GPUColorWrite.ALL
-    const depthStencilState = null;
-    
-    const attribute0 = {shaderLocation: 0, format: "float4"};
-    const attribute1 = {shaderLocation: 1, format: "float"};
-    const input0 = {stride: 16, attributeSet: [attribute0]};
-    const input1 = {stride: 4, attributeSet: [attribute1]};
-    const inputs = [input0, input1];
-    const vertexInput = {vertexBuffers: inputs};
-
-    const bindGroupLayoutDescriptor = {bindings: [{binding: 0, visibility: 7, type: "uniform-buffer"}]};
-    const bindGroupLayout = device.createBindGroupLayout(bindGroupLayoutDescriptor);
-    const pipelineLayoutDescriptor = {bindGroupLayouts: [bindGroupLayout]};
-    const pipelineLayout = device.createPipelineLayout(pipelineLayoutDescriptor);
-
-    device.createRenderPipeline({vertexStage, fragmentStage, primitiveTopology, rasterizationState, colorStates, depthStencilState, vertexInput, sampleCount: 1, layout: pipelineLayout});
-}
-
-function deleteDevice() {
-    device = null;
-    // Force GC to make sure the device is destroyed, otherwise the frontend
-    // does not receive WI.CanvasManager.Event.CanvasRemoved events.
-    setTimeout(() => { GCController.collect(); }, 0);
-}
-
-async function load() {
-    let adapter = await navigator.gpu.requestAdapter();
-    device = await adapter.requestDevice();
-
-    await Promise.all([
-        createComputePipeline(),
-        createRenderPipeline(),
-    ]);
-
-    if (window.beforeTest)
-        await beforeTest();
-
-    runTest();
-}
-
-TestPage.registerInitializer(() => {
-    if (!InspectorTest.ShaderProgram)
-        InspectorTest.ShaderProgram = {};
-
-    InspectorTest.ShaderProgram.programForType = function(programType) {
-        for (let shaderProgram of WI.canvasManager.shaderPrograms) {
-            if (shaderProgram.programType === programType)
-                return shaderProgram;
-        }
-        return null;
-    };
-});
index d39ec30..657a3ab 100644 (file)
@@ -2,7 +2,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec3 position;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec3 position;
     void main(void) {
index 8a7943d..d4089c3 100644 (file)
@@ -2,7 +2,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec3 position;
     void main(void) {
 <script id="vertex-shader" type="x-shader/x-vertex">
     attribute vec3 position;
     void main(void) {
index 3c6311d..2ce79f2 100644 (file)
@@ -2,7 +2,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script>
 function test() {
     let suite = initializeTestSuite("webgl");
 <script>
 function test() {
     let suite = initializeTestSuite("webgl");
index 92fa306..263ffca 100644 (file)
@@ -2,7 +2,7 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
 <script>
 if (window.internals)
     internals.settings.setWebGL2Enabled(true);
 <script>
 if (window.internals)
     internals.settings.setWebGL2Enabled(true);
diff --git a/LayoutTests/inspector/canvas/shaderProgram-add-remove-webgpu-expected.txt b/LayoutTests/inspector/canvas/shaderProgram-add-remove-webgpu-expected.txt
deleted file mode 100644 (file)
index c68d1fb..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-CONSOLE MESSAGE: GPUDevice.createComputePipeline(): WHLSL compile error: Cannot lex: Cannot consume token
-CONSOLE MESSAGE: GPUDevice.createRenderPipeline(): WHLSL compile error: Cannot lex: Cannot consume token
-CONSOLE MESSAGE: GPUDevice.createComputePipeline(): WHLSL compile error: Cannot lex: Cannot consume token
-CONSOLE MESSAGE: GPUDevice.createRenderPipeline(): WHLSL compile error: Cannot lex: Cannot consume token
-Test that CanvasManager tracks creation and destruction of WebGPU shader programs.
-
-
-== Running test suite: Canvas.ShaderProgram.WebGPU
--- Running test case: Canvas.ShaderProgram.WebGPU.Existing
-PASS: Added "compute" ShaderProgram.
-PASS: Added "render" ShaderProgram.
-PASS: There should be two ShaderProgram.
-
--- Running test case: Canvas.ShaderProgram.WebGPU.Added.Compute.Valid
-PASS: Added "compute" ShaderProgram.
-
--- Running test case: Canvas.ShaderProgram.WebGPU.Added.Compute.Invalid
-PASS: Should not create a ShaderProgram for an invalid descriptor.
-
--- Running test case: Canvas.ShaderProgram.WebGPU.Added.Render.Valid
-PASS: Added "render" ShaderProgram.
-
--- Running test case: Canvas.ShaderProgram.WebGPU.Added.Render.Invalid
-PASS: Should not create a ShaderProgram for an invalid descriptor.
-
--- Running test case: Canvas.ShaderProgram.WebGPU.ParentDeviceRemoved
-PASS: Removed ShaderProgram before Canvas.
-
diff --git a/LayoutTests/inspector/canvas/shaderProgram-add-remove-webgpu.html b/LayoutTests/inspector/canvas/shaderProgram-add-remove-webgpu.html
deleted file mode 100644 (file)
index 678710e..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script src="resources/shaderProgram-utilities-webgpu.js"></script>
-<script>
-window.beforeTest = async function() {
-    await Promise.all([
-        createComputePipeline("INVALID"),
-        createRenderPipeline("INVALID", "INVALID"),
-    ]);
-};
-
-function test() {
-    let suite = InspectorTest.createAsyncSuite(`Canvas.ShaderProgram.WebGPU`);
-
-    let canvas = WI.canvasManager.canvases[0];
-    InspectorTest.assert(canvas, "There should be a canvas.");
-    InspectorTest.assert(WI.canvasManager.canvases.length === 1, "There should only be one canvas.");
-    InspectorTest.assert(canvas.contextType === WI.Canvas.ContextType.WebGPU, "Canvas should be WebGPU.");
-
-    async function awaitProgramAdded(programType) {
-        return new Promise((resolve, reject) => {
-            let listenerItemAdded = canvas.shaderProgramCollection.addEventListener(WI.Collection.Event.ItemAdded, (event) => {
-                let program = event.data.item;
-                if (program.programType !== programType)
-                    return;
-
-                InspectorTest.expectThat(program instanceof WI.ShaderProgram, `Added "${programType}" ShaderProgram.`);
-                InspectorTest.assert(program.canvas === canvas, "ShaderProgram should be for the known Canvas.");
-
-                resolve(program);
-            });
-        });
-    }
-
-    suite.addTestCase({
-        name: "Canvas.ShaderProgram.WebGPU.Existing",
-        description: "Check that ShaderProgramAdded is sent for a program created before CanvasAgent is enabled.",
-        async test() {
-            async function checkExists(programType) {
-                if (InspectorTest.ShaderProgram.programForType(programType)) {
-                    InspectorTest.pass(`Added "${programType}" ShaderProgram.`);
-                    return;
-                }
-
-                await awaitProgramAdded(programType);
-            }
-
-            await Promise.all([
-                checkExists(WI.ShaderProgram.ProgramType.Compute),
-                checkExists(WI.ShaderProgram.ProgramType.Render),
-            ]);
-
-            InspectorTest.expectEqual(canvas.shaderProgramCollection.size, 2, "There should be two ShaderProgram.");
-        }
-    });
-
-    suite.addTestCase({
-        name: "Canvas.ShaderProgram.WebGPU.Added.Compute.Valid",
-        description: "Check that added/removed events are sent.",
-        async test() {
-            await Promise.all([
-                awaitProgramAdded(WI.ShaderProgram.ProgramType.Compute),
-                InspectorTest.evaluateInPage(`createComputePipeline()`),
-            ]);
-        }
-    });
-
-    suite.addTestCase({
-        name: "Canvas.ShaderProgram.WebGPU.Added.Compute.Invalid",
-        description: "Check that added/removed events are sent.",
-        async test() {
-            let shaderProgramAdded = false;
-
-            let listener = canvas.shaderProgramCollection.singleFireEventListener(WI.Collection.Event.ItemAdded, (event) => {
-                shaderProgramAdded = true;
-            });
-
-            await InspectorTest.evaluateInPage(`createComputePipeline("INVALID")`);
-
-            canvas.shaderProgramCollection.removeEventListener(WI.Collection.Event.ItemAdded, listener);
-            InspectorTest.expectFalse(shaderProgramAdded, "Should not create a ShaderProgram for an invalid descriptor.");
-        }
-    });
-
-    suite.addTestCase({
-        name: "Canvas.ShaderProgram.WebGPU.Added.Render.Valid",
-        description: "Check that added/removed events are sent.",
-        async test() {
-            await Promise.all([
-                awaitProgramAdded(WI.ShaderProgram.ProgramType.Render),
-                InspectorTest.evaluateInPage(`createRenderPipeline()`),
-            ]);
-        }
-    });
-
-    suite.addTestCase({
-        name: "Canvas.ShaderProgram.WebGPU.Added.Render.Invalid",
-        description: "Check that added/removed events are sent.",
-        async test() {
-            let shaderProgramAdded = false;
-
-            let listener = canvas.shaderProgramCollection.singleFireEventListener(WI.Collection.Event.ItemAdded, (event) => {
-                shaderProgramAdded = true;
-            });
-
-            await InspectorTest.evaluateInPage(`createRenderPipeline("INVALID", "INVALID")`);
-
-            canvas.shaderProgramCollection.removeEventListener(WI.Collection.Event.ItemAdded, listener);
-            InspectorTest.expectFalse(shaderProgramAdded, "Should not create a ShaderProgram for an invalid descriptor.");
-        }
-    });
-
-    suite.addTestCase({
-        name: "Canvas.ShaderProgram.WebGPU.ParentDeviceRemoved",
-        description: "Check that the ShaderProgram is removed before it's parent Canvas.",
-        test(resolve, reject) {
-            let canvasRemoved = false;
-
-            WI.canvasManager.singleFireEventListener(WI.CanvasManager.Event.CanvasRemoved, (event) => {
-                canvasRemoved = true;
-            });
-
-            let shaderProgramCount = canvas.shaderProgramCollection.size;
-            let listenerItemRemoved = canvas.shaderProgramCollection.addEventListener(WI.Collection.Event.ItemRemoved, (event) => {
-                if (--shaderProgramCount)
-                    return;
-
-                canvas.shaderProgramCollection.removeEventListener(WI.Collection.Event.ItemRemoved, listenerItemRemoved);
-                InspectorTest.expectFalse(canvasRemoved, "Removed ShaderProgram before Canvas.");
-                resolve();
-            });
-
-            InspectorTest.evaluateInPage(`deleteDevice()`);
-        }
-    });
-
-    suite.runTestCasesAndFinish();
-}
-</script>
-</head>
-<body onload="load()">
-    <p>Test that CanvasManager tracks creation and destruction of WebGPU shader programs.</p>
-</body>
-</html>
index ce37e8e..8f3fee9 100644 (file)
@@ -1,8 +1,38 @@
-Common tests for Canvas.updateShader command.
+CONSOLE MESSAGE: WebGL: ERROR: 0:1: 'INVALID' : syntax error
+CONSOLE MESSAGE: WebGL: ERROR: 0:1: 'INVALID' : syntax error
+Test compilation of shaders after being attached to a program, with and without syntax errors.
 
 
 == Running test suite: Canvas.updateShader
 
 
 == Running test suite: Canvas.updateShader
--- Running test case: Canvas.updateShader.ProgramId.Invalid
+-- Running test case: Canvas.updateShader.vertexShaderValid
+
+    void main(void) {
+        gl_Position = vec4(1, 2, 3, 4);
+    }
+
+
+-- Running test case: Canvas.updateShader.fragmentShaderValid
+
+    precision mediump float;
+
+    void main(void) {
+        gl_FragColor = vec4(0.1, 0.2, 0.3, 0.4);
+    }
+
+
+-- Running test case: Canvas.updateShader.invalidProgramId
 PASS: Should produce an error.
 Error: Missing program for given programId
 
 PASS: Should produce an error.
 Error: Missing program for given programId
 
+-- Running test case: Canvas.updateShader.invalidShaderType
+PASS: Should produce an error.
+Error: Missing shader for given shaderType
+
+-- Running test case: Canvas.updateShader.invalidVertexShaderSource
+PASS: Should produce error.
+Error: Failed to update shader
+
+-- Running test case: Canvas.updateShader.invalidFragmentShaderSource
+PASS: Should produce error.
+Error: Failed to update shader
+
diff --git a/LayoutTests/inspector/canvas/updateShader-webgl-expected.txt b/LayoutTests/inspector/canvas/updateShader-webgl-expected.txt
deleted file mode 100644 (file)
index 2bbba72..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-CONSOLE MESSAGE: WebGL: ERROR: 0:1: 'INVALID' : syntax error
-CONSOLE MESSAGE: WebGL: ERROR: 0:1: 'INVALID' : syntax error
-WebGL tests for Canvas.updateShader command.
-
-
-== Running test suite: Canvas.updateShader.WebGL
--- Running test case: Canvas.updateShader.WebGL.Vertex.Valid
-
-    void main(void) {
-        gl_Position = vec4(1, 2, 3, 4);
-    }
-
-
--- Running test case: Canvas.updateShader.WebGL.Fragment.Valid
-
-    precision mediump float;
-
-    void main(void) {
-        gl_FragColor = vec4(0.1, 0.2, 0.3, 0.4);
-    }
-
-
--- Running test case: Canvas.updateShader.WebGL.Vertex.Invalid
-PASS: Should produce error.
-Error: Failed to update shader of given shaderType for given programId
-
--- Running test case: Canvas.updateShader.WebGL.Fragment.Invalid
-PASS: Should produce error.
-Error: Failed to update shader of given shaderType for given programId
-
--- Running test case: Canvas.updateShader.WebGL.ShaderType.Invalid
-PASS: Should produce an error.
-Error: Unknown shaderType: INVALID_SHADER_TYPE
-
diff --git a/LayoutTests/inspector/canvas/updateShader-webgl.html b/LayoutTests/inspector/canvas/updateShader-webgl.html
deleted file mode 100644 (file)
index fd578e4..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script src="resources/shaderProgram-utilities-webgl.js"></script>
-<script id="vertex-shader" type="x-shader/x-vertex">
-    void main(void) {
-        gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
-    }
-</script>
-<script id="fragment-shader" type="x-shader/x-fragment">
-    precision mediump float;
-
-    void main(void) {
-        gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
-    }
-</script>
-<script>
-function load() {
-    createProgram("webgl");
-    linkProgram("vertex-shader", "fragment-shader");
-
-    runTest();
-}
-
-function test() {
-    let suite = InspectorTest.createAsyncSuite("Canvas.updateShader.WebGL");
-
-    function validSourceTest({name, shaderType, source}) {
-        suite.addTestCase({
-            name,
-            test(resolve, reject) {
-                let shaderProgram = WI.canvasManager.shaderPrograms[0];
-                if (!shaderProgram) {
-                    reject("Missing shader program")
-                    return;
-                }
-
-                let programId = shaderProgram.identifier;
-
-                CanvasAgent.updateShader(programId, shaderType, source)
-                .then(() => CanvasAgent.requestShaderSource(programId, shaderType))
-                .then(({source}) => InspectorTest.log(source))
-                .then(resolve, reject);
-            }
-        });
-    }
-
-    validSourceTest({
-        name: "Canvas.updateShader.WebGL.Vertex.Valid",
-        shaderType: CanvasAgent.ShaderType.Vertex,
-        source: `
-    void main(void) {
-        gl_Position = vec4(1, 2, 3, 4);
-    }
-`,
-    });
-
-    validSourceTest({
-        name: "Canvas.updateShader.WebGL.Fragment.Valid",
-        shaderType: CanvasAgent.ShaderType.Fragment,
-        source: `
-    precision mediump float;
-
-    void main(void) {
-        gl_FragColor = vec4(0.1, 0.2, 0.3, 0.4);
-    }
-`,
-    });
-
-    function invalidSourceTest({name, shaderType, source}) {
-        suite.addTestCase({
-            name,
-            test(resolve, reject) {
-                let shaderProgram = WI.canvasManager.shaderPrograms[0];
-                if (!shaderProgram) {
-                    reject("Missing shader program")
-                    return;
-                }
-
-                CanvasAgent.updateShader(shaderProgram.identifier, shaderType, source, (error) => {
-                    InspectorTest.expectThat(error, "Should produce error.");
-                    InspectorTest.log("Error: " + error);
-                    resolve();
-                });
-            }
-        });
-    }
-
-    invalidSourceTest({
-        name: "Canvas.updateShader.WebGL.Vertex.Invalid",
-        shaderType: CanvasAgent.ShaderType.Vertex,
-        source: "INVALID",
-    });
-
-    invalidSourceTest({
-        name: "Canvas.updateShader.WebGL.Fragment.Invalid",
-        shaderType: CanvasAgent.ShaderType.Fragment,
-        source: "INVALID",
-    });
-
-    suite.addTestCase({
-        name: "Canvas.updateShader.WebGL.ShaderType.Invalid",
-        description: "Invalid shader types should cause an error.",
-        test(resolve, reject) {
-            let shaderProgram = WI.canvasManager.shaderPrograms[0];
-            if (!shaderProgram) {
-                reject("Missing shader program")
-                return;
-            }
-
-            const shaderType = "INVALID_SHADER_TYPE";
-            const source = "INVALID_SOURCE";
-            CanvasAgent.updateShader(shaderProgram.identifier, shaderType, source, (error) => {
-                InspectorTest.expectThat(error, "Should produce an error.");
-                InspectorTest.log("Error: " + error);
-                resolve();
-            });
-        }
-    });
-
-    suite.runTestCasesAndFinish();
-}
-</script>
-</head>
-<body onload="load()">
-<p>WebGL tests for Canvas.updateShader command.</p>
-</body>
-</html>
diff --git a/LayoutTests/inspector/canvas/updateShader-webgpu-expected.txt b/LayoutTests/inspector/canvas/updateShader-webgpu-expected.txt
deleted file mode 100644 (file)
index bbed372..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-WebGPU tests for Canvas.updateShader command.
-
-
-== Running test suite: Canvas.updateShader.WebGPU
--- Running test case: Canvas.updateShader.WebGPU.Compute.Valid
-PASS: Source should have changed.
-
--- Running test case: Canvas.updateShader.WebGPU.Compute.Invalid
-PASS: Should produce an exception.
-Error: Failed to update shader of given shaderType for given programId
-PASS: Source should have changed.
-
--- Running test case: Canvas.updateShader.WebGPU.Vertex.Valid
-PASS: Source should have changed.
-
--- Running test case: Canvas.updateShader.WebGPU.Vertex.Invalid
-PASS: Should produce an exception.
-Error: Failed to update shader of given shaderType for given programId
-PASS: Source should have changed.
-
--- Running test case: Canvas.updateShader.WebGPU.Fragment.Valid
-PASS: Source should have changed.
-
--- Running test case: Canvas.updateShader.WebGPU.Fragment.Invalid
-PASS: Should produce an exception.
-Error: Failed to update shader of given shaderType for given programId
-PASS: Source should have changed.
-
diff --git a/LayoutTests/inspector/canvas/updateShader-webgpu.html b/LayoutTests/inspector/canvas/updateShader-webgpu.html
deleted file mode 100644 (file)
index 4d2addc..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script src="resources/shaderProgram-utilities-webgpu.js"></script>
-<script>
-function test() {
-    let suite = InspectorTest.createAsyncSuite("Canvas.updateShader.WebGPU");
-
-    function test({name, programType, shaderType, source, shouldThrow}) {
-        suite.addTestCase({
-            name,
-            async test() {
-                let shaderProgram = InspectorTest.ShaderProgram.programForType(programType);
-                if (!shaderProgram)
-                    throw "Missing shader program";
-
-                let originalSource = await CanvasAgent.requestShaderSource(shaderProgram.identifier, shaderType);
-
-                if (shouldThrow) {
-                    await InspectorTest.expectException(async () => {
-                        await CanvasAgent.updateShader(shaderProgram.identifier, shaderType, source);
-                    });
-                } else
-                    await CanvasAgent.updateShader(shaderProgram.identifier, shaderType, source);
-
-                let newSource = await CanvasAgent.requestShaderSource(shaderProgram.identifier, shaderType);
-
-                InspectorTest.expectNotShallowEqual(originalSource, newSource, "Source should have changed.");
-            }
-        });
-    }
-
-    test({
-        name: "Canvas.updateShader.WebGPU.Compute.Valid",
-        programType: WI.ShaderProgram.ProgramType.Compute,
-        shaderType: WI.ShaderProgram.ShaderType.Compute,
-        source: `
-[numthreads(2, 1, 1)]
-compute void newComputeShader(device float[] buffer : register(u0), float3 threadID : SV_DispatchThreadID) {
-    buffer[uint(threadID.x)] = buffer[uint(threadID.x)] * 2.0;
-}
-`,
-    });
-
-    test({
-        name: "Canvas.updateShader.WebGPU.Compute.Invalid",
-        programType: WI.ShaderProgram.ProgramType.Compute,
-        shaderType: WI.ShaderProgram.ShaderType.Compute,
-        source: "INVALID",
-        shouldThrow: true,
-    });
-
-    test({
-        name: "Canvas.updateShader.WebGPU.Vertex.Valid",
-        programType: WI.ShaderProgram.ProgramType.Render,
-        shaderType: WI.ShaderProgram.ShaderType.Vertex,
-        source: `
-vertex float4 newVertexShader(float4 position : attribute(0), float i : attribute(1)) : SV_Position {
-    return position;
-}
-`,
-    });
-
-    test({
-        name: "Canvas.updateShader.WebGPU.Vertex.Invalid",
-        programType: WI.ShaderProgram.ProgramType.Render,
-        shaderType: WI.ShaderProgram.ShaderType.Vertex,
-        source: "INVALID",
-        shouldThrow: true,
-    });
-
-    test({
-        name: "Canvas.updateShader.WebGPU.Fragment.Valid",
-        programType: WI.ShaderProgram.ProgramType.Render,
-        shaderType: WI.ShaderProgram.ShaderType.Fragment,
-        source: `
-fragment float4 newFragmentShader(float4 position : SV_Position) : SV_Target 0 {
-    return position;
-}
-`,
-    });
-
-    test({
-        name: "Canvas.updateShader.WebGPU.Fragment.Invalid",
-        programType: WI.ShaderProgram.ProgramType.Render,
-        shaderType: WI.ShaderProgram.ShaderType.Fragment,
-        source: "INVALID",
-        shouldThrow: true,
-    });
-
-    suite.runTestCasesAndFinish();
-}
-</script>
-</head>
-<body onload="load()">
-<p>WebGPU tests for Canvas.updateShader command.</p>
-</body>
-</html>
index 7b0a4cf..e49ad2b 100644 (file)
@@ -2,12 +2,74 @@
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
 <html>
 <head>
 <script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script src="resources/shaderProgram-utilities.js"></script>
+<script id="vertex-shader" type="x-shader/x-vertex">
+    void main(void) {
+        gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+    }
+</script>
+<script id="fragment-shader" type="x-shader/x-fragment">
+    precision mediump float;
+
+    void main(void) {
+        gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
+    }
+</script>
 <script>
 <script>
+function load() {
+    createProgram("webgl");
+    linkProgram("vertex-shader", "fragment-shader");
+
+    runTest();
+}
+
 function test() {
     let suite = InspectorTest.createAsyncSuite("Canvas.updateShader");
 
 function test() {
     let suite = InspectorTest.createAsyncSuite("Canvas.updateShader");
 
+    function validSourceTest({name, shaderType, source}) {
+        suite.addTestCase({
+            name,
+            test(resolve, reject) {
+                let shaderProgram = WI.canvasManager.shaderPrograms[0];
+                if (!shaderProgram) {
+                    reject("Missing shader program")
+                    return;
+                }
+
+                let programId = shaderProgram.identifier;
+
+                CanvasAgent.updateShader(programId, shaderType, source)
+                .then(() => CanvasAgent.requestShaderSource(programId, shaderType))
+                .then(({content}) => InspectorTest.log(content))
+                .then(resolve, reject);
+            }
+        });
+    }
+
+    validSourceTest({
+        name: "Canvas.updateShader.vertexShaderValid",
+        shaderType: CanvasAgent.ShaderType.Vertex,
+        source: `
+    void main(void) {
+        gl_Position = vec4(1, 2, 3, 4);
+    }
+`,
+    });
+
+    validSourceTest({
+        name: "Canvas.updateShader.fragmentShaderValid",
+        shaderType: CanvasAgent.ShaderType.Fragment,
+        source: `
+    precision mediump float;
+
+    void main(void) {
+        gl_FragColor = vec4(0.1, 0.2, 0.3, 0.4);
+    }
+`,
+    });
+
     suite.addTestCase({
     suite.addTestCase({
-        name: "Canvas.updateShader.ProgramId.Invalid",
+        name: "Canvas.updateShader.invalidProgramId",
         description: "Invalid program identifiers should cause an error.",
         test(resolve, reject) {
             const programId = "INVALID_PROGRAM_ID";
         description: "Invalid program identifiers should cause an error.",
         test(resolve, reject) {
             const programId = "INVALID_PROGRAM_ID";
@@ -21,11 +83,62 @@ function test() {
         }
     });
 
         }
     });
 
+    suite.addTestCase({
+        name: "Canvas.updateShader.invalidShaderType",
+        description: "Invalid shader types should cause an error.",
+        test(resolve, reject) {
+            let shaderProgram = WI.canvasManager.shaderPrograms[0];
+            if (!shaderProgram) {
+                reject("Missing shader program")
+                return;
+            }
+
+            const shaderType = "INVALID_SHADER_TYPE";
+            const source = "INVALID_SOURCE";
+            CanvasAgent.updateShader(shaderProgram.identifier, shaderType, source, (error) => {
+                InspectorTest.expectThat(error, "Should produce an error.");
+                InspectorTest.log("Error: " + error);
+                resolve();
+            });
+        }
+    });
+
+    function invalidSourceTest({name, shaderType, source}) {
+        suite.addTestCase({
+            name,
+            test(resolve, reject) {
+                let shaderProgram = WI.canvasManager.shaderPrograms[0];
+                if (!shaderProgram) {
+                    reject("Missing shader program")
+                    return;
+                }
+
+                CanvasAgent.updateShader(shaderProgram.identifier, shaderType, source, (error) => {
+                    InspectorTest.expectThat(error, "Should produce error.");
+                    InspectorTest.log("Error: " + error);
+                    resolve();
+                });
+            }
+        });
+    }
+
+    invalidSourceTest({
+        name: "Canvas.updateShader.invalidVertexShaderSource",
+        shaderType: CanvasAgent.ShaderType.Vertex,
+        source: "INVALID",
+    });
+
+    invalidSourceTest({
+        name: "Canvas.updateShader.invalidFragmentShaderSource",
+        shaderType: CanvasAgent.ShaderType.Fragment,
+        source: "INVALID",
+    });
+
     suite.runTestCasesAndFinish();
 }
 </script>
 </head>
     suite.runTestCasesAndFinish();
 }
 </script>
 </head>
-<body onload="runTest()">
-<p>Common tests for Canvas.updateShader command.</p>
+<body onload="load()">
+    <p>Test compilation of shaders after being attached to a program, with and without syntax errors.</p>
 </body>
 </html>
 </body>
 </html>
index 8d1f10e..6e19e15 100644 (file)
@@ -1150,10 +1150,7 @@ webkit.org/b/168466 http/tests/security/bypassing-cors-checks-for-extension-urls
 webkit.org/b/191005 webgpu/ [ Skip ]
 webkit.org/b/191005 inspector/canvas/create-context-webgpu.html [ Skip ]
 webkit.org/b/191005 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
 webkit.org/b/191005 webgpu/ [ Skip ]
 webkit.org/b/191005 inspector/canvas/create-context-webgpu.html [ Skip ]
 webkit.org/b/191005 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
-webkit.org/b/191005 inspector/canvas/requestShaderSource-webgpu.html [ Skip ]
 webkit.org/b/191005 inspector/canvas/resolveContext-webgpu.html [ Skip ]
 webkit.org/b/191005 inspector/canvas/resolveContext-webgpu.html [ Skip ]
-webkit.org/b/191005 inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ]
-webkit.org/b/191005 inspector/canvas/updateShader-webgpu.html [ Skip ]
 
 # No support for resource load statistics yet
 http/tests/resourceLoadStatistics/ [ Skip ]
 
 # No support for resource load statistics yet
 http/tests/resourceLoadStatistics/ [ Skip ]
index 31bfa98..0919735 100644 (file)
@@ -45,10 +45,7 @@ webkit.org/b/200308 fast/events/touch/ios/content-observation/non-visible-conten
 webgpu [ Skip ]
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
 webgpu [ Skip ]
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
-inspector/canvas/requestShaderSource-webgpu.html [ Skip ]
 inspector/canvas/resolveContext-webgpu.html [ Skip ]
 inspector/canvas/resolveContext-webgpu.html [ Skip ]
-inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ]
-inspector/canvas/updateShader-webgpu.html [ Skip ]
 
 # Encrypted Media Extensions are not enabled
 media/encrypted-media/
 
 # Encrypted Media Extensions are not enabled
 media/encrypted-media/
index b1fe5f0..d34932d 100644 (file)
@@ -47,10 +47,7 @@ css-dark-mode [ Skip ]
 webgpu [ Skip ]
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
 webgpu [ Skip ]
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
-inspector/canvas/requestShaderSource-webgpu.html [ Skip ]
 inspector/canvas/resolveContext-webgpu.html [ Skip ]
 inspector/canvas/resolveContext-webgpu.html [ Skip ]
-inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ]
-inspector/canvas/updateShader-webgpu.html [ Skip ]
 
 # Media Stream API testing is not supported for WK1 yet.
 fast/mediastream
 
 # Media Stream API testing is not supported for WK1 yet.
 fast/mediastream
index 372b5bd..1a5c4df 100644 (file)
@@ -1781,10 +1781,7 @@ webkit.org/b/190976 imported/w3c/web-platform-tests/media-source/mediasource-cha
 webkit.org/b/199275 [ HighSierra ] webgpu [ Skip ]
 webkit.org/b/199275 [ HighSierra ] inspector/canvas/create-context-webgpu.html [ Skip ]
 webkit.org/b/199275 [ HighSierra ] inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
 webkit.org/b/199275 [ HighSierra ] webgpu [ Skip ]
 webkit.org/b/199275 [ HighSierra ] inspector/canvas/create-context-webgpu.html [ Skip ]
 webkit.org/b/199275 [ HighSierra ] inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
-webkit.org/b/199275 [ HighSierra ] inspector/canvas/requestShaderSource-webgpu.html [ Skip ]
 webkit.org/b/199275 [ HighSierra ] inspector/canvas/resolveContext-webgpu.html [ Skip ]
 webkit.org/b/199275 [ HighSierra ] inspector/canvas/resolveContext-webgpu.html [ Skip ]
-webkit.org/b/199275 [ HighSierra ] inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ]
-webkit.org/b/199275 [ HighSierra ] inspector/canvas/updateShader-webgpu.html [ Skip ]
 
 webkit.org/b/189680 platform/mac/media/audio-session-category-video-paused.html [ Pass Timeout ]
 
 
 webkit.org/b/189680 platform/mac/media/audio-session-category-video-paused.html [ Pass Timeout ]
 
index 36d7fcf..7503ff4 100644 (file)
@@ -2001,13 +2001,12 @@ inspector/canvas/recording-webgl2-memoryLimit.html [ Skip ]
 inspector/canvas/recording-webgl2-snapshots.html [ Skip ]
 inspector/canvas/requestContent-webgl.html [ Skip ]
 inspector/canvas/requestContent-webgl2.html [ Skip ]
 inspector/canvas/recording-webgl2-snapshots.html [ Skip ]
 inspector/canvas/requestContent-webgl.html [ Skip ]
 inspector/canvas/requestContent-webgl2.html [ Skip ]
-inspector/canvas/requestShaderSource-webgl.html [ Skip ]
+inspector/canvas/requestShaderSource.html [ Skip ]
 inspector/canvas/resolveContext-webgl.html [ Skip ]
 inspector/canvas/resolveContext-webgl2.html [ Skip ]
 inspector/canvas/shaderProgram-add-remove-webgl.html [ Skip ]
 inspector/canvas/shaderProgram-add-remove-webgl2.html [ Skip ]
 inspector/canvas/resolveContext-webgl.html [ Skip ]
 inspector/canvas/resolveContext-webgl2.html [ Skip ]
 inspector/canvas/shaderProgram-add-remove-webgl.html [ Skip ]
 inspector/canvas/shaderProgram-add-remove-webgl2.html [ Skip ]
-inspector/canvas/updateShader-webgl.html [ Skip ]
-
+inspector/canvas/updateShader.html [ Skip ]
 ################################################################################
 #################          End WebGL Issues              #######################
 ################################################################################
 ################################################################################
 #################          End WebGL Issues              #######################
 ################################################################################
@@ -4247,10 +4246,7 @@ webkit.org/b/190520 editing/pasteboard/copy-paste-across-shadow-boundaries-with-
 webgpu [ Skip ]
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
 webgpu [ Skip ]
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
-inspector/canvas/requestShaderSource-webgpu.html [ Skip ]
 inspector/canvas/resolveContext-webgpu.html [ Skip ]
 inspector/canvas/resolveContext-webgpu.html [ Skip ]
-inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ]
-inspector/canvas/updateShader-webgpu.html [ Skip ]
 
 webkit.org/b/191194 fast/block/basic/inline-content-with-floating-image.html [ Failure ]
 webkit.org/b/191194 fast/block/basic/inline-content-with-floating-images2.html [ Failure ]
 
 webkit.org/b/191194 fast/block/basic/inline-content-with-floating-image.html [ Failure ]
 webkit.org/b/191194 fast/block/basic/inline-content-with-floating-images2.html [ Failure ]
index 8275d0e..abd8cc9 100644 (file)
@@ -298,10 +298,7 @@ webgl/webgl2-rendering-context-obtain.html [ Skip ]
 webgpu [ Skip ]
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
 webgpu [ Skip ]
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
-inspector/canvas/requestShaderSource-webgpu.html [ Skip ]
 inspector/canvas/resolveContext-webgpu.html [ Skip ]
 inspector/canvas/resolveContext-webgpu.html [ Skip ]
-inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ]
-inspector/canvas/updateShader-webgpu.html [ Skip ]
 
 # WIRELESS_PLAYBACK_TARGET is disabled
 media/airplay-target-availability.html [ Skip ]
 
 # WIRELESS_PLAYBACK_TARGET is disabled
 media/airplay-target-availability.html [ Skip ]
index 6860d78..2cd1d17 100644 (file)
@@ -302,10 +302,7 @@ Bug(WPE) js/stringimpl-to-jsstring-on-large-strings-3.html [ Skip ]
 webgpu [ Skip ]
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
 webgpu [ Skip ]
 inspector/canvas/create-context-webgpu.html [ Skip ]
 inspector/canvas/requestClientNodes-webgpu.html [ Skip ]
-inspector/canvas/requestShaderSource-webgpu.html [ Skip ]
 inspector/canvas/resolveContext-webgpu.html [ Skip ]
 inspector/canvas/resolveContext-webgpu.html [ Skip ]
-inspector/canvas/shaderProgram-add-remove-webgpu.html [ Skip ]
-inspector/canvas/updateShader-webgpu.html [ Skip ]
 
 # Skipped due to untestable DRM key system. ClearKey counterparts are tested instead.
 imported/w3c/web-platform-tests/encrypted-media/drm-check-initdata-type.https.html [ Skip ]
 
 # Skipped due to untestable DRM key system. ClearKey counterparts are tested instead.
 imported/w3c/web-platform-tests/encrypted-media/drm-check-initdata-type.https.html [ Skip ]
index 5759efa..bfbf21c 100644 (file)
@@ -1,3 +1,15 @@
+2019-09-20  Truitt Savell  <tsavell@apple.com>
+
+        Unreviewed, rolling out r250114.
+
+        Broke ~16 webgpu/ tests on Mojave wk2
+
+        Reverted changeset:
+
+        "Web Inspector: Canvas: show WebGPU shader pipelines"
+        https://bugs.webkit.org/show_bug.cgi?id=201675
+        https://trac.webkit.org/changeset/250114
+
 2019-09-20  Paulo Matos  <pmatos@igalia.com>
 
         Implement memory monitoring functions for Linux OS
 2019-09-20  Paulo Matos  <pmatos@igalia.com>
 
         Implement memory monitoring functions for Linux OS
index 8aee55e..798b991 100644 (file)
             "description": "The type of rendering context backing the canvas element."
         },
         {
             "description": "The type of rendering context backing the canvas element."
         },
         {
-            "id": "ProgramType",
-            "type": "string",
-            "enum": ["compute", "render"]
-        },
-        {
             "id": "ShaderType",
             "type": "string",
             "id": "ShaderType",
             "type": "string",
-            "enum": ["compute", "fragment", "vertex"]
+            "enum": ["fragment", "vertex"],
+            "description": "Shader type. WebGL supports vertex and fragment shaders."
         },
         {
             "id": "ContextAttributes",
         },
         {
             "id": "ContextAttributes",
                 { "name": "shaderType", "$ref": "ShaderType" }
             ],
             "returns": [
                 { "name": "shaderType", "$ref": "ShaderType" }
             ],
             "returns": [
-                { "name": "source", "type": "string" }
+                { "name": "content", "type": "string" }
             ]
         },
         {
             ]
         },
         {
         {
             "name": "programCreated",
             "parameters": [
         {
             "name": "programCreated",
             "parameters": [
-                { "name": "canvasId", "$ref": "CanvasId"} ,
-                { "name": "programId", "$ref": "ProgramId" },
-                { "name": "programType", "$ref": "ProgramType" }
+                { "name": "canvasId", "$ref": "CanvasId", "description": "Canvas identifier." },
+                { "name": "programId", "$ref": "ProgramId", "description": "Program identifier." }
             ]
         },
         {
             "name": "programDeleted",
             "parameters": [
             ]
         },
         {
             "name": "programDeleted",
             "parameters": [
-                { "name": "programId", "$ref": "ProgramId" }
+                { "name": "programId", "$ref": "ProgramId", "description": "Program identifier." }
             ]
         }
     ]
             ]
         }
     ]
index 261e2ba..942bf7b 100644 (file)
@@ -1,3 +1,15 @@
+2019-09-20  Truitt Savell  <tsavell@apple.com>
+
+        Unreviewed, rolling out r250114.
+
+        Broke ~16 webgpu/ tests on Mojave wk2
+
+        Reverted changeset:
+
+        "Web Inspector: Canvas: show WebGPU shader pipelines"
+        https://bugs.webkit.org/show_bug.cgi?id=201675
+        https://trac.webkit.org/changeset/250114
+
 2019-09-20  Antti Koivisto  <antti@apple.com>
 
         Implement Position::upstream and Position::downstream with line layout iterator
 2019-09-20  Antti Koivisto  <antti@apple.com>
 
         Implement Position::upstream and Position::downstream with line layout iterator
index 3535392..cd11ecb 100644 (file)
 
 #if ENABLE(WEBGPU)
 
 
 #if ENABLE(WEBGPU)
 
-#include "GPUComputePipeline.h"
-#include "GPUErrorScopes.h"
-#include "GPUPipeline.h"
-#include "GPUProgrammableStageDescriptor.h"
-#include "WebGPUDevice.h"
-#include <wtf/Optional.h>
-#include <wtf/Ref.h>
-
 namespace WebCore {
 
 namespace WebCore {
 
-Ref<WebGPUComputePipeline> WebGPUComputePipeline::create(WebGPUDevice& device, RefPtr<GPUComputePipeline>&& pipeline, GPUErrorScopes& errorScopes, Optional<WebGPUPipeline::ShaderData> computeShader)
+Ref<WebGPUComputePipeline> WebGPUComputePipeline::create(RefPtr<GPUComputePipeline>&& pipeline, GPUErrorScopes& errorScopes)
 {
 {
-    return adoptRef(*new WebGPUComputePipeline(device, WTFMove(pipeline), errorScopes, computeShader));
+    return adoptRef(*new WebGPUComputePipeline(WTFMove(pipeline), errorScopes));
 }
 
 }
 
-WebGPUComputePipeline::WebGPUComputePipeline(WebGPUDevice& device, RefPtr<GPUComputePipeline>&& pipeline, GPUErrorScopes& errorScopes, Optional<WebGPUPipeline::ShaderData> computeShader)
-    : WebGPUPipeline(device, errorScopes)
-    , m_computePipeline(WTFMove(pipeline))
-    , m_computeShader(computeShader)
-{
-}
-
-WebGPUComputePipeline::~WebGPUComputePipeline() = default;
-
-bool WebGPUComputePipeline::recompile(const WebGPUDevice& device)
+WebGPUComputePipeline::WebGPUComputePipeline(RefPtr<GPUComputePipeline>&& pipeline, GPUErrorScopes& errorScopes)
+    : GPUObjectBase(makeRef(errorScopes))
+    , m_computePipeline { WTFMove(pipeline) }
 {
 {
-    if (m_computePipeline && m_computeShader) {
-        if (auto& webGPUComputeShaderModule = m_computeShader.value().module) {
-            if (auto* gpuComputeShaderModule = webGPUComputeShaderModule->module()) {
-                GPUProgrammableStageDescriptor computeStage(makeRef(*gpuComputeShaderModule), { m_computeShader.value().entryPoint });
-                return m_computePipeline->recompile(device.device(), WTFMove(computeStage));
-            }
-        }
-    }
-    return false;
 }
 
 } // namespace WebCore
 }
 
 } // namespace WebCore
index c1a7180..2ed7c98 100644 (file)
 
 #if ENABLE(WEBGPU)
 
 
 #if ENABLE(WEBGPU)
 
-#include "WebGPUPipeline.h"
-#include <wtf/Forward.h>
+#include "GPUComputePipeline.h"
+#include "GPUObjectBase.h"
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
 
 namespace WebCore {
 
-class GPUComputePipeline;
-class GPUPipeline;
-class GPUErrorScopes;
-class WebGPUDevice;
-
-class WebGPUComputePipeline final : public WebGPUPipeline {
+class WebGPUComputePipeline : public GPUObjectBase {
 public:
 public:
-    virtual ~WebGPUComputePipeline();
-
-    static Ref<WebGPUComputePipeline> create(WebGPUDevice&, RefPtr<GPUComputePipeline>&&, GPUErrorScopes&, Optional<WebGPUPipeline::ShaderData> computeShader);
-
-    bool isComputePipeline() const { return true; }
+    static Ref<WebGPUComputePipeline> create(RefPtr<GPUComputePipeline>&&, GPUErrorScopes&);
 
 
-    bool isValid() const { return computePipeline(); }
     const GPUComputePipeline* computePipeline() const { return m_computePipeline.get(); }
     const GPUComputePipeline* computePipeline() const { return m_computePipeline.get(); }
-    Optional<WebGPUPipeline::ShaderData> computeShader() const { return m_computeShader; }
-
-    bool recompile(const WebGPUDevice&);
 
 private:
 
 private:
-    WebGPUComputePipeline(WebGPUDevice&, RefPtr<GPUComputePipeline>&&, GPUErrorScopes&, Optional<WebGPUPipeline::ShaderData> computeShader);
+    WebGPUComputePipeline(RefPtr<GPUComputePipeline>&&, GPUErrorScopes&);
 
     RefPtr<GPUComputePipeline> m_computePipeline;
 
     RefPtr<GPUComputePipeline> m_computePipeline;
-
-    // Preserved for Web Inspector recompilation.
-    Optional<WebGPUPipeline::ShaderData> m_computeShader;
 };
 
 } // namespace WebCore
 
 };
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_WEBGPUPIPELINE(WebCore::WebGPUComputePipeline, isComputePipeline())
-
 #endif // ENABLE(WEBGPU)
 #endif // ENABLE(WEBGPU)
index 4b8a77e..a552ba9 100644 (file)
@@ -27,6 +27,7 @@
 [
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU,
 [
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable,
     InterfaceName=GPUComputePipeline
 ] interface WebGPUComputePipeline {
 };
     InterfaceName=GPUComputePipeline
 ] interface WebGPUComputePipeline {
 };
index a7a491c..5ebf083 100644 (file)
 #include "GPUBufferBinding.h"
 #include "GPUBufferDescriptor.h"
 #include "GPUCommandBuffer.h"
 #include "GPUBufferBinding.h"
 #include "GPUBufferDescriptor.h"
 #include "GPUCommandBuffer.h"
-#include "GPUComputePipeline.h"
 #include "GPUComputePipelineDescriptor.h"
 #include "GPUProgrammableStageDescriptor.h"
 #include "GPUComputePipelineDescriptor.h"
 #include "GPUProgrammableStageDescriptor.h"
-#include "GPURenderPipeline.h"
 #include "GPURenderPipelineDescriptor.h"
 #include "GPUSampler.h"
 #include "GPUSamplerDescriptor.h"
 #include "GPURenderPipelineDescriptor.h"
 #include "GPUSampler.h"
 #include "GPUSamplerDescriptor.h"
@@ -207,47 +205,31 @@ Ref<WebGPUShaderModule> WebGPUDevice::createShaderModule(const WebGPUShaderModul
 {
     // FIXME: What can be validated here?
     auto module = m_device->tryCreateShaderModule(GPUShaderModuleDescriptor { descriptor.code });
 {
     // FIXME: What can be validated here?
     auto module = m_device->tryCreateShaderModule(GPUShaderModuleDescriptor { descriptor.code });
-    return WebGPUShaderModule::create(WTFMove(module), descriptor.code);
+    return WebGPUShaderModule::create(WTFMove(module));
 }
 
 }
 
-Ref<WebGPURenderPipeline> WebGPUDevice::createRenderPipeline(const WebGPURenderPipelineDescriptor& descriptor)
+Ref<WebGPURenderPipeline> WebGPUDevice::createRenderPipeline(const WebGPURenderPipelineDescriptor& descriptor) const
 {
     m_errorScopes->setErrorPrefix("GPUDevice.createRenderPipeline(): ");
 
     auto gpuDescriptor = descriptor.tryCreateGPURenderPipelineDescriptor(m_errorScopes);
     if (!gpuDescriptor)
 {
     m_errorScopes->setErrorPrefix("GPUDevice.createRenderPipeline(): ");
 
     auto gpuDescriptor = descriptor.tryCreateGPURenderPipelineDescriptor(m_errorScopes);
     if (!gpuDescriptor)
-        return WebGPURenderPipeline::create(*this, nullptr, m_errorScopes, WTF::nullopt, WTF::nullopt);
+        return WebGPURenderPipeline::create(nullptr, m_errorScopes);
 
 
-    auto gpuPipeline = m_device->tryCreateRenderPipeline(*gpuDescriptor, m_errorScopes);
-
-    WebGPUPipeline::ShaderData vertexShader = { descriptor.vertexStage.module, descriptor.vertexStage.entryPoint };
-
-    Optional<WebGPUPipeline::ShaderData> fragmentShader;
-    if (descriptor.fragmentStage)
-        fragmentShader = { { descriptor.fragmentStage.value().module, descriptor.fragmentStage.value().entryPoint } };
-
-    auto webGPUPipeline = WebGPURenderPipeline::create(*this, WTFMove(gpuPipeline), m_errorScopes, vertexShader, fragmentShader);
-    if (webGPUPipeline->isValid())
-        InspectorInstrumentation::didCreateWebGPUPipeline(*this, webGPUPipeline.get());
-    return webGPUPipeline;
+    auto pipeline = m_device->tryCreateRenderPipeline(*gpuDescriptor, m_errorScopes);
+    return WebGPURenderPipeline::create(WTFMove(pipeline), m_errorScopes);
 }
 
 }
 
-Ref<WebGPUComputePipeline> WebGPUDevice::createComputePipeline(const WebGPUComputePipelineDescriptor& descriptor)
+Ref<WebGPUComputePipeline> WebGPUDevice::createComputePipeline(const WebGPUComputePipelineDescriptor& descriptor) const
 {
     m_errorScopes->setErrorPrefix("GPUDevice.createComputePipeline(): ");
 
     auto gpuDescriptor = descriptor.tryCreateGPUComputePipelineDescriptor(m_errorScopes);
     if (!gpuDescriptor)
 {
     m_errorScopes->setErrorPrefix("GPUDevice.createComputePipeline(): ");
 
     auto gpuDescriptor = descriptor.tryCreateGPUComputePipelineDescriptor(m_errorScopes);
     if (!gpuDescriptor)
-        return WebGPUComputePipeline::create(*this, nullptr, m_errorScopes, WTF::nullopt);
-
-    auto gpuPipeline = m_device->tryCreateComputePipeline(*gpuDescriptor, m_errorScopes);
-
-    WebGPUPipeline::ShaderData computeShader = { descriptor.computeStage.module, descriptor.computeStage.entryPoint };
+        return WebGPUComputePipeline::create(nullptr, m_errorScopes);
 
 
-    auto webGPUPipeline = WebGPUComputePipeline::create(*this, WTFMove(gpuPipeline), m_errorScopes, computeShader);
-    if (webGPUPipeline->isValid())
-        InspectorInstrumentation::didCreateWebGPUPipeline(*this, webGPUPipeline.get());
-    return webGPUPipeline;
+    auto pipeline = m_device->tryCreateComputePipeline(*gpuDescriptor, m_errorScopes);
+    return WebGPUComputePipeline::create(WTFMove(pipeline), m_errorScopes);
 }
 
 Ref<WebGPUCommandEncoder> WebGPUDevice::createCommandEncoder() const
 }
 
 Ref<WebGPUCommandEncoder> WebGPUDevice::createCommandEncoder() const
index 21b5417..d98f23c 100644 (file)
@@ -99,8 +99,8 @@ public:
     Ref<WebGPUBindGroup> createBindGroup(const WebGPUBindGroupDescriptor&) const;
 
     Ref<WebGPUShaderModule> createShaderModule(const WebGPUShaderModuleDescriptor&) const;
     Ref<WebGPUBindGroup> createBindGroup(const WebGPUBindGroupDescriptor&) const;
 
     Ref<WebGPUShaderModule> createShaderModule(const WebGPUShaderModuleDescriptor&) const;
-    Ref<WebGPURenderPipeline> createRenderPipeline(const WebGPURenderPipelineDescriptor&);
-    Ref<WebGPUComputePipeline> createComputePipeline(const WebGPUComputePipelineDescriptor&);
+    Ref<WebGPURenderPipeline> createRenderPipeline(const WebGPURenderPipelineDescriptor&) const;
+    Ref<WebGPUComputePipeline> createComputePipeline(const WebGPUComputePipelineDescriptor&) const;
 
     Ref<WebGPUCommandEncoder> createCommandEncoder() const;
 
 
     Ref<WebGPUCommandEncoder> createCommandEncoder() const;
 
diff --git a/Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp b/Source/WebCore/Modules/webgpu/WebGPUPipeline.cpp
deleted file mode 100644 (file)
index eaee8bd..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2019 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 INC. 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 INC. 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"
-#include "WebGPUPipeline.h"
-
-#if ENABLE(WEBGPU)
-
-#include "GPUErrorScopes.h"
-#include "InspectorInstrumentation.h"
-#include "ScriptExecutionContext.h"
-#include "WebGPUDevice.h"
-#include <wtf/HashMap.h>
-#include <wtf/Lock.h>
-#include <wtf/NeverDestroyed.h>
-#include <wtf/Ref.h>
-
-namespace WebCore {
-
-HashMap<WebGPUPipeline*, WebGPUDevice*>& WebGPUPipeline::instances(const LockHolder&)
-{
-    static NeverDestroyed<HashMap<WebGPUPipeline*, WebGPUDevice*>> instances;
-    return instances;
-}
-
-Lock& WebGPUPipeline::instancesMutex()
-{
-    static LazyNeverDestroyed<Lock> mutex;
-    static std::once_flag initializeMutex;
-    std::call_once(initializeMutex, [] {
-        mutex.construct();
-    });
-    return mutex.get();
-}
-
-WebGPUPipeline::WebGPUPipeline(WebGPUDevice& device, GPUErrorScopes& errorScopes)
-    : GPUObjectBase(makeRef(errorScopes))
-    , m_scriptExecutionContext(device.scriptExecutionContext())
-{
-    LockHolder lock(instancesMutex());
-    instances(lock).add(this, &device);
-}
-
-WebGPUPipeline::~WebGPUPipeline()
-{
-    InspectorInstrumentation::willDestroyWebGPUPipeline(*this);
-
-    {
-        LockHolder lock(instancesMutex());
-        ASSERT(instances(lock).contains(this));
-        instances(lock).remove(this);
-    }
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/Modules/webgpu/WebGPUPipeline.h b/Source/WebCore/Modules/webgpu/WebGPUPipeline.h
deleted file mode 100644 (file)
index 1e323c7..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2019 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 INC. 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 INC. 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
-
-#if ENABLE(WEBGPU)
-
-#include "GPUObjectBase.h"
-#include "WebGPUShaderModule.h"
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-class ScriptExecutionContext;
-class GPUErrorScopes;
-class WebGPUDevice;
-
-class WebGPUPipeline : public GPUObjectBase {
-public:
-    virtual ~WebGPUPipeline();
-
-    static HashMap<WebGPUPipeline*, WebGPUDevice*>& instances(const LockHolder&);
-    static Lock& instancesMutex();
-
-    virtual bool isRenderPipeline() const { return false; }
-    virtual bool isComputePipeline() const { return false; }
-
-    ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }
-    virtual bool isValid() const = 0;
-
-    struct ShaderData {
-        RefPtr<WebGPUShaderModule> module;
-        String entryPoint;
-    };
-
-    virtual bool recompile(const WebGPUDevice&) = 0;
-
-protected:
-    WebGPUPipeline(WebGPUDevice&, GPUErrorScopes&);
-
-    ScriptExecutionContext* m_scriptExecutionContext;
-};
-
-} // namespace WebCore
-
-#define SPECIALIZE_TYPE_TRAITS_WEBGPUPIPELINE(ToValueTypeName, predicate) \
-SPECIALIZE_TYPE_TRAITS_BEGIN(ToValueTypeName) \
-    static bool isType(const WebCore::WebGPUPipeline& pipeline) { return pipeline.predicate; } \
-SPECIALIZE_TYPE_TRAITS_END()
-
-#endif // ENABLE(WEBGPU)
index 1a4414a..ffbc5b8 100644 (file)
@@ -37,7 +37,7 @@ namespace WebCore {
 struct WebGPUProgrammableStageDescriptor : GPUProgrammableStageDescriptorBase {
     Optional<GPUProgrammableStageDescriptor> tryCreateGPUProgrammableStageDescriptor() const;
 
 struct WebGPUProgrammableStageDescriptor : GPUProgrammableStageDescriptorBase {
     Optional<GPUProgrammableStageDescriptor> tryCreateGPUProgrammableStageDescriptor() const;
 
-    RefPtr<WebGPUShaderModule> module;
+    RefPtr<const WebGPUShaderModule> module;
 };
 
 } // namespace WebCore
 };
 
 } // namespace WebCore
index fe957f5..17aedc6 100644 (file)
 
 #if ENABLE(WEBGPU)
 
 
 #if ENABLE(WEBGPU)
 
-#include "GPUErrorScopes.h"
-#include "GPUPipeline.h"
-#include "GPUProgrammableStageDescriptor.h"
-#include "GPURenderPipeline.h"
-#include "WebGPUDevice.h"
-#include <wtf/Optional.h>
-#include <wtf/Ref.h>
-
 namespace WebCore {
 
 namespace WebCore {
 
-Ref<WebGPURenderPipeline> WebGPURenderPipeline::create(WebGPUDevice& device, RefPtr<GPURenderPipeline>&& pipeline, GPUErrorScopes& errorScopes, Optional<WebGPUPipeline::ShaderData> vertexShader, Optional<WebGPUPipeline::ShaderData> fragmentShader)
+Ref<WebGPURenderPipeline> WebGPURenderPipeline::create(RefPtr<GPURenderPipeline>&& pipeline, GPUErrorScopes& errorScopes)
 {
 {
-    return adoptRef(*new WebGPURenderPipeline(device, WTFMove(pipeline), errorScopes, vertexShader, fragmentShader));
+    return adoptRef(*new WebGPURenderPipeline(WTFMove(pipeline), errorScopes));
 }
 
 }
 
-WebGPURenderPipeline::WebGPURenderPipeline(WebGPUDevice& device, RefPtr<GPURenderPipeline>&& pipeline, GPUErrorScopes& errorScopes, Optional<WebGPUPipeline::ShaderData> vertexShader, Optional<WebGPUPipeline::ShaderData> fragmentShader)
-    : WebGPUPipeline(device, errorScopes)
+WebGPURenderPipeline::WebGPURenderPipeline(RefPtr<GPURenderPipeline>&& pipeline, GPUErrorScopes& errorScopes)
+    : GPUObjectBase(makeRef(errorScopes))
     , m_renderPipeline(WTFMove(pipeline))
     , m_renderPipeline(WTFMove(pipeline))
-    , m_vertexShader(vertexShader)
-    , m_fragmentShader(fragmentShader)
-{
-}
-
-WebGPURenderPipeline::~WebGPURenderPipeline() = default;
-
-bool WebGPURenderPipeline::recompile(const WebGPUDevice& device)
 {
 {
-    if (m_renderPipeline && m_vertexShader) {
-        if (auto& webGPUVertexShaderModule = m_vertexShader.value().module) {
-            if (auto* gpuVertexShaderModule = webGPUVertexShaderModule->module()) {
-                GPUProgrammableStageDescriptor vertexStage(makeRef(*gpuVertexShaderModule), { m_vertexShader.value().entryPoint });
-                Optional<GPUProgrammableStageDescriptor> fragmentStage;
-                if (m_fragmentShader) {
-                    if (auto& webGPUFragmentShaderModule = m_fragmentShader.value().module) {
-                        if (auto* gpuFragmentShaderModule = webGPUFragmentShaderModule->module())
-                            fragmentStage = GPUProgrammableStageDescriptor(makeRef(*gpuFragmentShaderModule), { m_fragmentShader.value().entryPoint });
-                    }
-                }
-                return m_renderPipeline->recompile(device.device(), WTFMove(vertexStage), WTFMove(fragmentStage));
-            }
-        }
-    }
-    return false;
 }
 
 } // namespace WebCore
 }
 
 } // namespace WebCore
index b2b8094..8f00ca6 100644 (file)
 
 #if ENABLE(WEBGPU)
 
 
 #if ENABLE(WEBGPU)
 
-#include "WebGPUPipeline.h"
-#include <wtf/Forward.h>
+#include "GPUObjectBase.h"
+#include "GPURenderPipeline.h"
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
 
 namespace WebCore {
 
-class GPUPipeline;
-class GPURenderPipeline;
-class GPUErrorScopes;
-class WebGPUDevice;
-
-class WebGPURenderPipeline final : public WebGPUPipeline {
+class WebGPURenderPipeline : public GPUObjectBase {
 public:
 public:
-    virtual ~WebGPURenderPipeline();
-
-    static Ref<WebGPURenderPipeline> create(WebGPUDevice&, RefPtr<GPURenderPipeline>&&, GPUErrorScopes&, Optional<WebGPUPipeline::ShaderData> vertexShader, Optional<WebGPUPipeline::ShaderData> fragmentShader);
-
-    bool isRenderPipeline() const { return true; }
+    static Ref<WebGPURenderPipeline> create(RefPtr<GPURenderPipeline>&&, GPUErrorScopes&);
 
 
-    bool isValid() const { return renderPipeline(); }
     const GPURenderPipeline* renderPipeline() const { return m_renderPipeline.get(); }
     const GPURenderPipeline* renderPipeline() const { return m_renderPipeline.get(); }
-    Optional<WebGPUPipeline::ShaderData> vertexShader() const { return m_vertexShader; }
-    Optional<WebGPUPipeline::ShaderData> fragmentShader() const { return m_fragmentShader; }
-
-    bool recompile(const WebGPUDevice&);
 
 private:
 
 private:
-    WebGPURenderPipeline(WebGPUDevice&, RefPtr<GPURenderPipeline>&&, GPUErrorScopes&, Optional<WebGPUPipeline::ShaderData> vertexShader, Optional<WebGPUPipeline::ShaderData> fragmentShader);
+    WebGPURenderPipeline(RefPtr<GPURenderPipeline>&&, GPUErrorScopes&);
 
     RefPtr<GPURenderPipeline> m_renderPipeline;
 
     RefPtr<GPURenderPipeline> m_renderPipeline;
-
-    // Preserved for Web Inspector recompilation.
-    Optional<WebGPUPipeline::ShaderData> m_vertexShader;
-    Optional<WebGPUPipeline::ShaderData> m_fragmentShader;
 };
 
 } // namespace WebCore
 
 };
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_WEBGPUPIPELINE(WebCore::WebGPURenderPipeline, isRenderPipeline())
-
 #endif // ENABLE(WEBGPU)
 #endif // ENABLE(WEBGPU)
index a9b4000..a989fd4 100644 (file)
@@ -27,6 +27,7 @@
 [
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU,
 [
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable,
     InterfaceName=GPURenderPipeline
 ] interface WebGPURenderPipeline {
 };
     InterfaceName=GPURenderPipeline
 ] interface WebGPURenderPipeline {
 };
index d314545..ee85f92 100644 (file)
 
 #if ENABLE(WEBGPU)
 
 
 #if ENABLE(WEBGPU)
 
-#include "GPUShaderModuleDescriptor.h"
-#include "WebGPUDevice.h"
-#include <wtf/RefPtr.h>
-
 namespace WebCore {
 
 namespace WebCore {
 
-Ref<WebGPUShaderModule> WebGPUShaderModule::create(RefPtr<GPUShaderModule>&& module, const String& source)
+Ref<WebGPUShaderModule> WebGPUShaderModule::create(RefPtr<GPUShaderModule>&& module)
 {
 {
-    return adoptRef(*new WebGPUShaderModule(WTFMove(module), source));
+    return adoptRef(*new WebGPUShaderModule(WTFMove(module)));
 }
 
 }
 
-WebGPUShaderModule::WebGPUShaderModule(RefPtr<GPUShaderModule>&& module, const String& source)
+WebGPUShaderModule::WebGPUShaderModule(RefPtr<GPUShaderModule>&& module)
     : m_module(WTFMove(module))
     : m_module(WTFMove(module))
-    , m_source(source)
-{
-}
-
-void WebGPUShaderModule::update(const WebGPUDevice& device, const String& source)
 {
 {
-    m_source = source;
-    m_module = GPUShaderModule::tryCreate(device.device(), { m_source });
 }
 
 } // namespace WebCore
 }
 
 } // namespace WebCore
index 7864611..8377053 100644 (file)
 #if ENABLE(WEBGPU)
 
 #include "GPUShaderModule.h"
 #if ENABLE(WEBGPU)
 
 #include "GPUShaderModule.h"
-#include <wtf/Forward.h>
+
 #include <wtf/RefCounted.h>
 #include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
 
 namespace WebCore {
 
-class WebGPUDevice;
-
 class WebGPUShaderModule : public RefCounted<WebGPUShaderModule> {
 public:
 class WebGPUShaderModule : public RefCounted<WebGPUShaderModule> {
 public:
-    static Ref<WebGPUShaderModule> create(RefPtr<GPUShaderModule>&&, const String& source);
+    static Ref<WebGPUShaderModule> create(RefPtr<GPUShaderModule>&&);
 
 
-    GPUShaderModule* module() const { return m_module.get(); }
-    const String& source() const { return m_source; }
-
-    void update(const WebGPUDevice&, const String& source);
+    const GPUShaderModule* module() const { return m_module.get(); }
 
 private:
 
 private:
-    WebGPUShaderModule(RefPtr<GPUShaderModule>&&, const String& source);
+    WebGPUShaderModule(RefPtr<GPUShaderModule>&&);
 
     RefPtr<GPUShaderModule> m_module;
 
     RefPtr<GPUShaderModule> m_module;
-
-    // Preserved for Web Inspector recompilation.
-    String m_source;
 };
 
 } // namespace WebCore
 };
 
 } // namespace WebCore
index f40384d..fd4dd31 100644 (file)
@@ -373,7 +373,6 @@ Modules/webgpu/WebGPUComputePipelineDescriptor.cpp
 Modules/webgpu/WebGPUDevice.cpp
 Modules/webgpu/WebGPUDeviceErrorScopes.cpp
 Modules/webgpu/WebGPUQueue.cpp
 Modules/webgpu/WebGPUDevice.cpp
 Modules/webgpu/WebGPUDeviceErrorScopes.cpp
 Modules/webgpu/WebGPUQueue.cpp
-Modules/webgpu/WebGPUPipeline.cpp
 Modules/webgpu/WebGPUPipelineLayout.cpp
 Modules/webgpu/WebGPUPipelineLayoutDescriptor.cpp
 Modules/webgpu/WebGPUProgrammableStageDescriptor.cpp
 Modules/webgpu/WebGPUPipelineLayout.cpp
 Modules/webgpu/WebGPUPipelineLayoutDescriptor.cpp
 Modules/webgpu/WebGPUProgrammableStageDescriptor.cpp
@@ -1899,7 +1898,6 @@ platform/graphics/gpu/GPUDevice.cpp
 platform/graphics/gpu/GPUError.cpp
 platform/graphics/gpu/GPUErrorScopes.cpp
 platform/graphics/gpu/GPUValidationError.cpp
 platform/graphics/gpu/GPUError.cpp
 platform/graphics/gpu/GPUErrorScopes.cpp
 platform/graphics/gpu/GPUValidationError.cpp
-platform/graphics/gpu/GPUPipeline.cpp
 platform/graphics/gpu/GPUPipelineLayout.cpp
 platform/graphics/gpu/GPUProgrammablePassEncoder.cpp
 
 platform/graphics/gpu/GPUPipelineLayout.cpp
 platform/graphics/gpu/GPUProgrammablePassEncoder.cpp
 
index 0be8607..7e4d307 100644 (file)
                9175CE5921E281EC00DF2C28 /* JSInspectorAuditAccessibilityObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorAuditAccessibilityObject.cpp; sourceTree = "<group>"; };
                9175CE5A21E281ED00DF2C27 /* InspectorAuditAccessibilityObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAuditAccessibilityObject.h; sourceTree = "<group>"; };
                9175CE5A21E281ED00DF2C28 /* JSInspectorAuditAccessibilityObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInspectorAuditAccessibilityObject.h; sourceTree = "<group>"; };
                9175CE5921E281EC00DF2C28 /* JSInspectorAuditAccessibilityObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorAuditAccessibilityObject.cpp; sourceTree = "<group>"; };
                9175CE5A21E281ED00DF2C27 /* InspectorAuditAccessibilityObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAuditAccessibilityObject.h; sourceTree = "<group>"; };
                9175CE5A21E281ED00DF2C28 /* JSInspectorAuditAccessibilityObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInspectorAuditAccessibilityObject.h; sourceTree = "<group>"; };
-               9186F3B32329FB0500AFF857 /* GPUPipeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPUPipeline.h; sourceTree = "<group>"; };
-               9186F3B62329FB4E00AFF857 /* WebGPUPipeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUPipeline.cpp; sourceTree = "<group>"; };
-               9186F3B72329FB4F00AFF857 /* WebGPUPipeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGPUPipeline.h; sourceTree = "<group>"; };
-               9186F3BA2329FE6800AFF857 /* GPUPipeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GPUPipeline.cpp; sourceTree = "<group>"; };
                91B8F0B321953D65000C2B00 /* CertificateInfoBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CertificateInfoBase.h; sourceTree = "<group>"; };
                91B952221F58A58000931DC2 /* RecordingSwizzleTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RecordingSwizzleTypes.h; sourceTree = "<group>"; };
                91C9F2F81AE3BE240095B61C /* AXTextStateChangeIntent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AXTextStateChangeIntent.h; sourceTree = "<group>"; };
                91B8F0B321953D65000C2B00 /* CertificateInfoBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CertificateInfoBase.h; sourceTree = "<group>"; };
                91B952221F58A58000931DC2 /* RecordingSwizzleTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RecordingSwizzleTypes.h; sourceTree = "<group>"; };
                91C9F2F81AE3BE240095B61C /* AXTextStateChangeIntent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AXTextStateChangeIntent.h; sourceTree = "<group>"; };
                                D08AA02F220D0BD50058C502 /* GPULoadOp.h */,
                                D09AFB3722D7D5C600C4538C /* GPUObjectBase.h */,
                                D09AFB1922D6698A00C4538C /* GPUOutOfMemoryError.h */,
                                D08AA02F220D0BD50058C502 /* GPULoadOp.h */,
                                D09AFB3722D7D5C600C4538C /* GPUObjectBase.h */,
                                D09AFB1922D6698A00C4538C /* GPUOutOfMemoryError.h */,
-                               9186F3BA2329FE6800AFF857 /* GPUPipeline.cpp */,
-                               9186F3B32329FB0500AFF857 /* GPUPipeline.h */,
                                312FF8C421A4C2F400EB199D /* GPUPipelineDescriptorBase.h */,
                                D003288721C9A4E500622AA6 /* GPUPipelineLayout.cpp */,
                                D003288621C9A4E500622AA6 /* GPUPipelineLayout.h */,
                                312FF8C421A4C2F400EB199D /* GPUPipelineDescriptorBase.h */,
                                D003288721C9A4E500622AA6 /* GPUPipelineLayout.cpp */,
                                D003288621C9A4E500622AA6 /* GPUPipelineLayout.h */,
                                D09AFB0322D40CC500C4538C /* WebGPUDeviceErrorScopes.idl */,
                                D09AC00A231735BE00187762 /* WebGPUDeviceEventHandler.h */,
                                D09AC00B231735BE00187762 /* WebGPUDeviceEventHandler.idl */,
                                D09AFB0322D40CC500C4538C /* WebGPUDeviceErrorScopes.idl */,
                                D09AC00A231735BE00187762 /* WebGPUDeviceEventHandler.h */,
                                D09AC00B231735BE00187762 /* WebGPUDeviceEventHandler.idl */,
-                               9186F3B62329FB4E00AFF857 /* WebGPUPipeline.cpp */,
-                               9186F3B72329FB4F00AFF857 /* WebGPUPipeline.h */,
                                D0C419F02183EB31009EC1DE /* WebGPUPipelineDescriptorBase.h */,
                                D0C419F12183EB31009EC1DE /* WebGPUPipelineDescriptorBase.idl */,
                                D05A99E521C9BF2C00032B75 /* WebGPUPipelineLayout.cpp */,
                                D0C419F02183EB31009EC1DE /* WebGPUPipelineDescriptorBase.h */,
                                D0C419F12183EB31009EC1DE /* WebGPUPipelineDescriptorBase.idl */,
                                D05A99E521C9BF2C00032B75 /* WebGPUPipelineLayout.cpp */,
index 5065494..6ba381a 100644 (file)
@@ -28,8 +28,6 @@
 
 #if ENABLE(WEBGL)
 
 
 #if ENABLE(WEBGL)
 
-#include "InspectorInstrumentation.h"
-#include "ScriptExecutionContext.h"
 #include "WebGLContextGroup.h"
 #include "WebGLRenderingContextBase.h"
 #include "WebGLShader.h"
 #include "WebGLContextGroup.h"
 #include "WebGLRenderingContextBase.h"
 #include "WebGLShader.h"
@@ -62,7 +60,6 @@ Ref<WebGLProgram> WebGLProgram::create(WebGLRenderingContextBase& ctx)
 
 WebGLProgram::WebGLProgram(WebGLRenderingContextBase& ctx)
     : WebGLSharedObject(ctx)
 
 WebGLProgram::WebGLProgram(WebGLRenderingContextBase& ctx)
     : WebGLSharedObject(ctx)
-    , m_scriptExecutionContext(ctx.scriptExecutionContext())
 {
     {
         LockHolder lock(instancesMutex());
 {
     {
         LockHolder lock(instancesMutex());
@@ -74,8 +71,6 @@ WebGLProgram::WebGLProgram(WebGLRenderingContextBase& ctx)
 
 WebGLProgram::~WebGLProgram()
 {
 
 WebGLProgram::~WebGLProgram()
 {
-    InspectorInstrumentation::willDestroyWebGLProgram(*this);
-
     deleteObject(0);
 
     {
     deleteObject(0);
 
     {
index 6769d1d..88a8979 100644 (file)
@@ -32,8 +32,6 @@
 
 namespace WebCore {
 
 
 namespace WebCore {
 
-class ScriptExecutionContext;
-class WebGLRenderingContextBase;
 class WebGLShader;
 
 class WebGLProgram final : public WebGLSharedObject {
 class WebGLShader;
 
 class WebGLProgram final : public WebGLSharedObject {
@@ -44,8 +42,6 @@ public:
     static HashMap<WebGLProgram*, WebGLRenderingContextBase*>& instances(const LockHolder&);
     static Lock& instancesMutex();
 
     static HashMap<WebGLProgram*, WebGLRenderingContextBase*>& instances(const LockHolder&);
     static Lock& instancesMutex();
 
-    ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; }
-
     unsigned numActiveAttribLocations();
     GC3Dint getActiveAttribLocation(GC3Duint index);
 
     unsigned numActiveAttribLocations();
     GC3Dint getActiveAttribLocation(GC3Duint index);
 
@@ -75,8 +71,6 @@ private:
     void cacheActiveAttribLocations(GraphicsContext3D*);
     void cacheInfoIfNeeded();
 
     void cacheActiveAttribLocations(GraphicsContext3D*);
     void cacheInfoIfNeeded();
 
-    ScriptExecutionContext* m_scriptExecutionContext;
-
     Vector<GC3Dint> m_activeAttribLocations;
 
     GC3Dint m_linkStatus { 0 };
     Vector<GC3Dint> m_activeAttribLocations;
 
     GC3Dint m_linkStatus { 0 };
index 6eea91f..224e34d 100644 (file)
@@ -411,7 +411,7 @@ public:
 private:
     void showHightlight()
     {
 private:
     void showHightlight()
     {
-        if (!m_program || LIKELY(!InspectorInstrumentation::isWebGLProgramHighlighted(m_context, *m_program)))
+        if (!m_program || LIKELY(!InspectorInstrumentation::isShaderProgramHighlighted(m_context, *m_program)))
             return;
 
         if (hasBufferBinding(GraphicsContext3D::FRAMEBUFFER_BINDING)) {
             return;
 
         if (hasBufferBinding(GraphicsContext3D::FRAMEBUFFER_BINDING)) {
@@ -1754,7 +1754,7 @@ RefPtr<WebGLProgram> WebGLRenderingContextBase::createProgram()
     auto program = WebGLProgram::create(*this);
     addSharedObject(program.get());
 
     auto program = WebGLProgram::create(*this);
     addSharedObject(program.get());
 
-    InspectorInstrumentation::didCreateWebGLProgram(*this, program.get());
+    InspectorInstrumentation::didCreateProgram(*this, program.get());
 
     return program;
 }
 
     return program;
 }
@@ -1840,7 +1840,7 @@ void WebGLRenderingContextBase::deleteFramebuffer(WebGLFramebuffer* framebuffer)
 void WebGLRenderingContextBase::deleteProgram(WebGLProgram* program)
 {
     if (program)
 void WebGLRenderingContextBase::deleteProgram(WebGLProgram* program)
 {
     if (program)
-        InspectorInstrumentation::willDestroyWebGLProgram(*program);
+        InspectorInstrumentation::willDeleteProgram(*this, *program);
 
     deleteObject(program);
     // We don't reset m_currentProgram to 0 here because the deletion of the
 
     deleteObject(program);
     // We don't reset m_currentProgram to 0 here because the deletion of the
@@ -2255,7 +2255,7 @@ void WebGLRenderingContextBase::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsiz
     if (!validateDrawArrays("drawArrays", mode, first, count, 0))
         return;
 
     if (!validateDrawArrays("drawArrays", mode, first, count, 0))
         return;
 
-    if (m_currentProgram && InspectorInstrumentation::isWebGLProgramDisabled(*this, *m_currentProgram))
+    if (m_currentProgram && InspectorInstrumentation::isShaderProgramDisabled(*this, *m_currentProgram))
         return;
 
     clearIfComposited();
         return;
 
     clearIfComposited();
@@ -2309,7 +2309,7 @@ void WebGLRenderingContextBase::drawElements(GC3Denum mode, GC3Dsizei count, GC3
     if (!validateDrawElements("drawElements", mode, count, type, offset, numElements, 0))
         return;
 
     if (!validateDrawElements("drawElements", mode, count, type, offset, numElements, 0))
         return;
 
-    if (m_currentProgram && InspectorInstrumentation::isWebGLProgramDisabled(*this, *m_currentProgram))
+    if (m_currentProgram && InspectorInstrumentation::isShaderProgramDisabled(*this, *m_currentProgram))
         return;
 
     clearIfComposited();
         return;
 
     clearIfComposited();
index 912c845..6964650 100644 (file)
@@ -1079,29 +1079,29 @@ void InspectorInstrumentation::didEnableExtensionImpl(InstrumentingAgents& instr
         canvasAgent->didEnableExtension(contextWebGLBase, extension);
 }
 
         canvasAgent->didEnableExtension(contextWebGLBase, extension);
 }
 
-void InspectorInstrumentation::didCreateWebGLProgramImpl(InstrumentingAgents& instrumentingAgents, WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
+void InspectorInstrumentation::didCreateProgramImpl(InstrumentingAgents& instrumentingAgents, WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
 {
     if (InspectorCanvasAgent* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
 {
     if (InspectorCanvasAgent* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
-        canvasAgent->didCreateWebGLProgram(contextWebGLBase, program);
+        canvasAgent->didCreateProgram(contextWebGLBase, program);
 }
 
 }
 
-void InspectorInstrumentation::willDestroyWebGLProgramImpl(InstrumentingAgents& instrumentingAgents, WebGLProgram& program)
+void InspectorInstrumentation::willDeleteProgramImpl(InstrumentingAgents& instrumentingAgents, WebGLProgram& program)
 {
     if (InspectorCanvasAgent* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
 {
     if (InspectorCanvasAgent* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
-        canvasAgent->willDestroyWebGLProgram(program);
+        canvasAgent->willDeleteProgram(program);
 }
 
 }
 
-bool InspectorInstrumentation::isWebGLProgramDisabledImpl(InstrumentingAgents& instrumentingAgents, WebGLProgram& program)
+bool InspectorInstrumentation::isShaderProgramDisabledImpl(InstrumentingAgents& instrumentingAgents, WebGLProgram& program)
 {
     if (InspectorCanvasAgent* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
 {
     if (InspectorCanvasAgent* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
-        return canvasAgent->isWebGLProgramDisabled(program);
+        return canvasAgent->isShaderProgramDisabled(program);
     return false;
 }
 
     return false;
 }
 
-bool InspectorInstrumentation::isWebGLProgramHighlightedImpl(InstrumentingAgents& instrumentingAgents, WebGLProgram& program)
+bool InspectorInstrumentation::isShaderProgramHighlightedImpl(InstrumentingAgents& instrumentingAgents, WebGLProgram& program)
 {
     if (InspectorCanvasAgent* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
 {
     if (InspectorCanvasAgent* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
-        return canvasAgent->isWebGLProgramHighlighted(program);
+        return canvasAgent->isShaderProgramHighlighted(program);
     return false;
 }
 #endif
     return false;
 }
 #endif
@@ -1124,18 +1124,6 @@ void InspectorInstrumentation::willConfigureSwapChainImpl(InstrumentingAgents& i
     if (auto* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
         canvasAgent->willConfigureSwapChain(contextGPU, newSwapChain);
 }
     if (auto* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
         canvasAgent->willConfigureSwapChain(contextGPU, newSwapChain);
 }
-
-void InspectorInstrumentation::didCreateWebGPUPipelineImpl(InstrumentingAgents& instrumentingAgents, WebGPUDevice& device, WebGPUPipeline& pipeline)
-{
-    if (auto* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
-        canvasAgent->didCreateWebGPUPipeline(device, pipeline);
-}
-
-void InspectorInstrumentation::willDestroyWebGPUPipelineImpl(InstrumentingAgents& instrumentingAgents, WebGPUPipeline& pipeline)
-{
-    if (auto* canvasAgent = instrumentingAgents.inspectorCanvasAgent())
-        canvasAgent->willDestroyWebGPUPipeline(pipeline);
-}
 #endif
 
 #if ENABLE(RESOURCE_USAGE)
 #endif
 
 #if ENABLE(RESOURCE_USAGE)
index 549aa17..81f3cdc 100644 (file)
@@ -63,7 +63,6 @@
 #if ENABLE(WEBGPU)
 #include "GPUCanvasContext.h"
 #include "WebGPUDevice.h"
 #if ENABLE(WEBGPU)
 #include "GPUCanvasContext.h"
 #include "WebGPUDevice.h"
-#include "WebGPUPipeline.h"
 #endif
 
 namespace Inspector {
 #endif
 
 namespace Inspector {
@@ -290,17 +289,15 @@ public:
     static void didFinishRecordingCanvasFrame(CanvasRenderingContext&, bool forceDispatch = false);
 #if ENABLE(WEBGL)
     static void didEnableExtension(WebGLRenderingContextBase&, const String&);
     static void didFinishRecordingCanvasFrame(CanvasRenderingContext&, bool forceDispatch = false);
 #if ENABLE(WEBGL)
     static void didEnableExtension(WebGLRenderingContextBase&, const String&);
-    static void didCreateWebGLProgram(WebGLRenderingContextBase&, WebGLProgram&);
-    static void willDestroyWebGLProgram(WebGLProgram&);
-    static bool isWebGLProgramDisabled(WebGLRenderingContextBase&, WebGLProgram&);
-    static bool isWebGLProgramHighlighted(WebGLRenderingContextBase&, WebGLProgram&);
+    static void didCreateProgram(WebGLRenderingContextBase&, WebGLProgram&);
+    static void willDeleteProgram(WebGLRenderingContextBase&, WebGLProgram&);
+    static bool isShaderProgramDisabled(WebGLRenderingContextBase&, WebGLProgram&);
+    static bool isShaderProgramHighlighted(WebGLRenderingContextBase&, WebGLProgram&);
 #endif
 #if ENABLE(WEBGPU)
     static void didCreateWebGPUDevice(WebGPUDevice&);
     static void willDestroyWebGPUDevice(WebGPUDevice&);
     static void willConfigureSwapChain(GPUCanvasContext&, WebGPUSwapChain&);
 #endif
 #if ENABLE(WEBGPU)
     static void didCreateWebGPUDevice(WebGPUDevice&);
     static void willDestroyWebGPUDevice(WebGPUDevice&);
     static void willConfigureSwapChain(GPUCanvasContext&, WebGPUSwapChain&);
-    static void didCreateWebGPUPipeline(WebGPUDevice&, WebGPUPipeline&);
-    static void willDestroyWebGPUPipeline(WebGPUPipeline&);
 #endif
 
     static void networkStateChanged(Page&);
 #endif
 
     static void networkStateChanged(Page&);
@@ -484,17 +481,15 @@ private:
     static void didFinishRecordingCanvasFrameImpl(InstrumentingAgents&, CanvasRenderingContext&, bool forceDispatch = false);
 #if ENABLE(WEBGL)
     static void didEnableExtensionImpl(InstrumentingAgents&, WebGLRenderingContextBase&, const String&);
     static void didFinishRecordingCanvasFrameImpl(InstrumentingAgents&, CanvasRenderingContext&, bool forceDispatch = false);
 #if ENABLE(WEBGL)
     static void didEnableExtensionImpl(InstrumentingAgents&, WebGLRenderingContextBase&, const String&);
-    static void didCreateWebGLProgramImpl(InstrumentingAgents&, WebGLRenderingContextBase&, WebGLProgram&);
-    static void willDestroyWebGLProgramImpl(InstrumentingAgents&, WebGLProgram&);
-    static bool isWebGLProgramDisabledImpl(InstrumentingAgents&, WebGLProgram&);
-    static bool isWebGLProgramHighlightedImpl(InstrumentingAgents&, WebGLProgram&);
+    static void didCreateProgramImpl(InstrumentingAgents&, WebGLRenderingContextBase&, WebGLProgram&);
+    static void willDeleteProgramImpl(InstrumentingAgents&, WebGLProgram&);
+    static bool isShaderProgramDisabledImpl(InstrumentingAgents&, WebGLProgram&);
+    static bool isShaderProgramHighlightedImpl(InstrumentingAgents&, WebGLProgram&);
 #endif
 #if ENABLE(WEBGPU)
     static void didCreateWebGPUDeviceImpl(InstrumentingAgents&, WebGPUDevice&);
     static void willDestroyWebGPUDeviceImpl(InstrumentingAgents&, WebGPUDevice&);
     static void willConfigureSwapChainImpl(InstrumentingAgents&, GPUCanvasContext&, WebGPUSwapChain&);
 #endif
 #if ENABLE(WEBGPU)
     static void didCreateWebGPUDeviceImpl(InstrumentingAgents&, WebGPUDevice&);
     static void willDestroyWebGPUDeviceImpl(InstrumentingAgents&, WebGPUDevice&);
     static void willConfigureSwapChainImpl(InstrumentingAgents&, GPUCanvasContext&, WebGPUSwapChain&);
-    static void didCreateWebGPUPipelineImpl(InstrumentingAgents&, WebGPUDevice&, WebGPUPipeline&);
-    static void willDestroyWebGPUPipelineImpl(InstrumentingAgents&, WebGPUPipeline&);
 #endif
 
     static void layerTreeDidChangeImpl(InstrumentingAgents&);
 #endif
 
     static void layerTreeDidChangeImpl(InstrumentingAgents&);
@@ -1389,33 +1384,33 @@ inline void InspectorInstrumentation::didEnableExtension(WebGLRenderingContextBa
         didEnableExtensionImpl(*instrumentingAgents, contextWebGLBase, extension);
 }
 
         didEnableExtensionImpl(*instrumentingAgents, contextWebGLBase, extension);
 }
 
-inline void InspectorInstrumentation::didCreateWebGLProgram(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
+inline void InspectorInstrumentation::didCreateProgram(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
-        didCreateWebGLProgramImpl(*instrumentingAgents, contextWebGLBase, program);
+        didCreateProgramImpl(*instrumentingAgents, contextWebGLBase, program);
 }
 
 }
 
-inline void InspectorInstrumentation::willDestroyWebGLProgram(WebGLProgram& program)
+inline void InspectorInstrumentation::willDeleteProgram(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
 {
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(program.scriptExecutionContext()))
-        willDestroyWebGLProgramImpl(*instrumentingAgents, program);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
+        willDeleteProgramImpl(*instrumentingAgents, program);
 }
 
 }
 
-inline bool InspectorInstrumentation::isWebGLProgramDisabled(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
+inline bool InspectorInstrumentation::isShaderProgramDisabled(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
 {
     FAST_RETURN_IF_NO_FRONTENDS(false);
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
 {
     FAST_RETURN_IF_NO_FRONTENDS(false);
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
-        return isWebGLProgramDisabledImpl(*instrumentingAgents, program);
+        return isShaderProgramDisabledImpl(*instrumentingAgents, program);
     return false;
 }
 
     return false;
 }
 
-inline bool InspectorInstrumentation::isWebGLProgramHighlighted(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
+inline bool InspectorInstrumentation::isShaderProgramHighlighted(WebGLRenderingContextBase& contextWebGLBase, WebGLProgram& program)
 {
     FAST_RETURN_IF_NO_FRONTENDS(false);
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
 {
     FAST_RETURN_IF_NO_FRONTENDS(false);
     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(contextWebGLBase.canvasBase().scriptExecutionContext()))
-        return isWebGLProgramHighlightedImpl(*instrumentingAgents, program);
+        return isShaderProgramHighlightedImpl(*instrumentingAgents, program);
     return false;
 }
 #endif
     return false;
 }
 #endif
@@ -1441,20 +1436,6 @@ inline void InspectorInstrumentation::willConfigureSwapChain(GPUCanvasContext& c
     if (auto* instrumentingAgents = instrumentingAgentsForContext(contextGPU.canvasBase().scriptExecutionContext()))
         willConfigureSwapChainImpl(*instrumentingAgents, contextGPU, newSwapChain);
 }
     if (auto* instrumentingAgents = instrumentingAgentsForContext(contextGPU.canvasBase().scriptExecutionContext()))
         willConfigureSwapChainImpl(*instrumentingAgents, contextGPU, newSwapChain);
 }
-
-inline void InspectorInstrumentation::didCreateWebGPUPipeline(WebGPUDevice& device, WebGPUPipeline& pipeline)
-{
-    FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (auto* instrumentingAgents = instrumentingAgentsForContext(device.scriptExecutionContext()))
-        didCreateWebGPUPipelineImpl(*instrumentingAgents, device, pipeline);
-}
-
-inline void InspectorInstrumentation::willDestroyWebGPUPipeline(WebGPUPipeline& pipeline)
-{
-    FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (auto* instrumentingAgents = instrumentingAgentsForContext(pipeline.scriptExecutionContext()))
-        willDestroyWebGPUPipelineImpl(*instrumentingAgents, pipeline);
-}
 #endif
 
 inline void InspectorInstrumentation::networkStateChanged(Page& page)
 #endif
 
 inline void InspectorInstrumentation::networkStateChanged(Page& page)
index b3df909..d529550 100644 (file)
 #include "config.h"
 #include "InspectorShaderProgram.h"
 
 #include "config.h"
 #include "InspectorShaderProgram.h"
 
-#include "InspectorCanvas.h"
-#include <JavaScriptCore/IdentifiersFactory.h>
-#include <wtf/Optional.h>
-#include <wtf/Ref.h>
-#include <wtf/Variant.h>
-#include <wtf/text/WTFString.h>
-
 #if ENABLE(WEBGL)
 #if ENABLE(WEBGL)
+
 #include "GraphicsContext3D.h"
 #include "GraphicsContext3D.h"
+#include "GraphicsTypes3D.h"
+#include "HTMLCanvasElement.h"
+#include "InspectorCanvas.h"
 #include "WebGLProgram.h"
 #include "WebGLRenderingContextBase.h"
 #include "WebGLShader.h"
 #include "WebGLProgram.h"
 #include "WebGLRenderingContextBase.h"
 #include "WebGLShader.h"
-#endif
-
-#if ENABLE(WEBGPU)
-#include "GPUShaderModule.h"
-#include "WHLSLPrepare.h"
-#include "WebGPUComputePipeline.h"
-#include "WebGPUPipeline.h"
-#include "WebGPURenderPipeline.h"
-#include "WebGPUShaderModule.h"
-#endif
+#include <JavaScriptCore/IdentifiersFactory.h>
 
 namespace WebCore {
 
 using namespace Inspector;
 
 
 namespace WebCore {
 
 using namespace Inspector;
 
-#if ENABLE(WEBGL)
 Ref<InspectorShaderProgram> InspectorShaderProgram::create(WebGLProgram& program, InspectorCanvas& inspectorCanvas)
 {
     return adoptRef(*new InspectorShaderProgram(program, inspectorCanvas));
 }
 Ref<InspectorShaderProgram> InspectorShaderProgram::create(WebGLProgram& program, InspectorCanvas& inspectorCanvas)
 {
     return adoptRef(*new InspectorShaderProgram(program, inspectorCanvas));
 }
-#endif
-
-#if ENABLE(WEBGPU)
-Ref<InspectorShaderProgram> InspectorShaderProgram::create(WebGPUPipeline& pipeline, InspectorCanvas& inspectorCanvas)
-{
-    return adoptRef(*new InspectorShaderProgram(pipeline, inspectorCanvas));
-}
-#endif
 
 
-#if ENABLE(WEBGL)
 InspectorShaderProgram::InspectorShaderProgram(WebGLProgram& program, InspectorCanvas& inspectorCanvas)
     : m_identifier("program:" + IdentifiersFactory::createIdentifier())
 InspectorShaderProgram::InspectorShaderProgram(WebGLProgram& program, InspectorCanvas& inspectorCanvas)
     : m_identifier("program:" + IdentifiersFactory::createIdentifier())
-    , m_canvas(inspectorCanvas)
     , m_program(program)
     , m_program(program)
-{
-    ASSERT(is<WebGLRenderingContextBase>(m_canvas.canvasContext()));
-}
-#endif
-
-#if ENABLE(WEBGPU)
-InspectorShaderProgram::InspectorShaderProgram(WebGPUPipeline& pipeline, InspectorCanvas& inspectorCanvas)
-    : m_identifier("pipeline:" + IdentifiersFactory::createIdentifier())
     , m_canvas(inspectorCanvas)
     , m_canvas(inspectorCanvas)
-    , m_program(pipeline)
-{
-    ASSERT(m_canvas.deviceContext());
-}
-#endif
-
-#if ENABLE(WEBGL)
-WebGLProgram* InspectorShaderProgram::program() const
 {
 {
-    if (auto* programWrapper = WTF::get_if<std::reference_wrapper<WebGLProgram>>(m_program))
-        return &programWrapper->get();
-    return nullptr;
 }
 }
-#endif
 
 
-#if ENABLE(WEBGPU)
-WebGPUPipeline* InspectorShaderProgram::pipeline() const
+WebGLRenderingContextBase& InspectorShaderProgram::context() const
 {
 {
-    if (auto* pipelineWrapper = WTF::get_if<std::reference_wrapper<WebGPUPipeline>>(m_program))
-        return &pipelineWrapper->get();
-    return nullptr;
+    ASSERT(m_canvas.canvasContext());
+    ASSERT(is<WebGLRenderingContextBase>(*m_canvas.canvasContext()));
+    return downcast<WebGLRenderingContextBase>(*m_canvas.canvasContext());
 }
 }
-#endif
 
 
-#if ENABLE(WEBGL)
-static WebGLShader* shaderForType(WebGLProgram& program, Inspector::Protocol::Canvas::ShaderType shaderType)
+WebGLShader* InspectorShaderProgram::shaderForType(const String& protocolType)
 {
 {
-    switch (shaderType) {
-    case Inspector::Protocol::Canvas::ShaderType::Fragment:
-        return program.getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER);
-
-    case Inspector::Protocol::Canvas::ShaderType::Vertex:
-        return program.getAttachedShader(GraphicsContext3D::VERTEX_SHADER);
-
-    // Compute shaders are a WebGPU concept.
-    case Inspector::Protocol::Canvas::ShaderType::Compute:
+    GC3Denum shaderType;
+    if (protocolType == "vertex")
+        shaderType = GraphicsContext3D::VERTEX_SHADER;
+    else if (protocolType == "fragment")
+        shaderType = GraphicsContext3D::FRAGMENT_SHADER;
+    else
         return nullptr;
         return nullptr;
-    }
-
-    ASSERT_NOT_REACHED();
-    return nullptr;
-}
-#endif
-
-#if ENABLE(WEBGPU)
-static Optional<WebGPUPipeline::ShaderData> shaderForType(WebGPUPipeline& pipeline, Inspector::Protocol::Canvas::ShaderType shaderType)
-{
-    switch (shaderType) {
-    case Inspector::Protocol::Canvas::ShaderType::Compute:
-        if (is<WebGPUComputePipeline>(pipeline))
-            return downcast<WebGPUComputePipeline>(pipeline).computeShader();
-        break;
-
-    case Inspector::Protocol::Canvas::ShaderType::Fragment:
-        if (is<WebGPURenderPipeline>(pipeline))
-            return downcast<WebGPURenderPipeline>(pipeline).fragmentShader();
-        break;
-
-    case Inspector::Protocol::Canvas::ShaderType::Vertex:
-        if (is<WebGPURenderPipeline>(pipeline))
-            return downcast<WebGPURenderPipeline>(pipeline).vertexShader();
-        break;
-    }
-
-    ASSERT_NOT_REACHED();
-    return WTF::nullopt;
-}
-#endif
-
-String InspectorShaderProgram::requestShaderSource(Inspector::Protocol::Canvas::ShaderType shaderType)
-{
-#if !ENABLE(WEBGL) && !ENABLE(WEBGPU)
-    UNUSED_PARAM(shaderType);
-#endif
-
-    return WTF::switchOn(m_program,
-#if ENABLE(WEBGL)
-        [&] (std::reference_wrapper<WebGLProgram> programWrapper) {
-            auto& program = programWrapper.get();
-            if (auto* shader = shaderForType(program, shaderType))
-                return shader->getSource();
-            return String();
-        },
-#endif
-#if ENABLE(WEBGPU)
-        [&] (std::reference_wrapper<WebGPUPipeline> pipelineWrapper) {
-            auto& pipeline = pipelineWrapper.get();
-            if (auto shaderData = shaderForType(pipeline, shaderType)) {
-                if (auto module = shaderData.value().module)
-                    return module->source();
-            }
-            return String();
-        },
-#endif
-        [&] (Monostate) {
-#if ENABLE(WEBGL) || ENABLE(WEBGPU)
-            ASSERT_NOT_REACHED();
-#endif
-            return String();
-        }
-    );
-}
-
-bool InspectorShaderProgram::updateShader(Inspector::Protocol::Canvas::ShaderType shaderType, const String& source)
-{
-#if !ENABLE(WEBGL) && !ENABLE(WEBGPU)
-    UNUSED_PARAM(shaderType);
-    UNUSED_PARAM(source);
-#endif
 
 
-    return WTF::switchOn(m_program,
-#if ENABLE(WEBGL)
-        [&] (std::reference_wrapper<WebGLProgram> programWrapper) {
-            auto& program = programWrapper.get();
-            if (auto* shader = shaderForType(program, shaderType)) {
-                if (auto* context = m_canvas.canvasContext()) {
-                    if (is<WebGLRenderingContextBase>(context)) {
-                        auto& contextWebGLBase = downcast<WebGLRenderingContextBase>(*context);
-                        contextWebGLBase.shaderSource(shader, source);
-                        contextWebGLBase.compileShader(shader);
-                        if (shader->isValid()) {
-                            contextWebGLBase.linkProgramWithoutInvalidatingAttribLocations(&program);
-                            return true;
-                        }
-                    }
-                }
-            }
-            return false;
-        },
-#endif
-#if ENABLE(WEBGPU)
-        [&] (std::reference_wrapper<WebGPUPipeline> pipelineWrapper) {
-            auto& pipeline = pipelineWrapper.get();
-            if (auto* device = m_canvas.deviceContext()) {
-                if (auto shaderData = shaderForType(pipeline, shaderType)) {
-                    if (auto module = shaderData.value().module) {
-                        module->update(*device, source);
-                        if (pipeline.recompile(*device))
-                            return true;
-                    }
-                }
-            }
-            return false;
-        },
-#endif
-        [&] (Monostate) {
-#if ENABLE(WEBGL) || ENABLE(WEBGPU)
-            ASSERT_NOT_REACHED();
-#endif
-            return false;
-        }
-    );
+    return m_program.getAttachedShader(shaderType);
 }
 
 } // namespace WebCore
 }
 
 } // namespace WebCore
+
+#endif // ENABLE(WEBGL)
index 0e0e116..9467e84 100644 (file)
 #pragma once
 
 #include <JavaScriptCore/InspectorProtocolObjects.h>
 #pragma once
 
 #include <JavaScriptCore/InspectorProtocolObjects.h>
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
 class InspectorCanvas;
 
 namespace WebCore {
 
 class InspectorCanvas;
-
-#if ENABLE(WEBGL)
 class WebGLProgram;
 class WebGLRenderingContextBase;
 class WebGLProgram;
 class WebGLRenderingContextBase;
-#endif
+class WebGLShader;
 
 
-#if ENABLE(WEBGPU)
-class WebGPUPipeline;
-#endif
+typedef String ErrorString;
 
 class InspectorShaderProgram final : public RefCounted<InspectorShaderProgram> {
 public:
 
 class InspectorShaderProgram final : public RefCounted<InspectorShaderProgram> {
 public:
-#if ENABLE(WEBGL)
     static Ref<InspectorShaderProgram> create(WebGLProgram&, InspectorCanvas&);
     static Ref<InspectorShaderProgram> create(WebGLProgram&, InspectorCanvas&);
-#endif
-#if ENABLE(WEBGPU)
-    static Ref<InspectorShaderProgram> create(WebGPUPipeline&, InspectorCanvas&);
-#endif
 
     const String& identifier() const { return m_identifier; }
     InspectorCanvas& canvas() const { return m_canvas; }
 
     const String& identifier() const { return m_identifier; }
     InspectorCanvas& canvas() const { return m_canvas; }
-
-#if ENABLE(WEBGL)
-    WebGLProgram* program() const;
-#endif
-#if ENABLE(WEBGPU)
-    WebGPUPipeline* pipeline() const;
-#endif
-
-    String requestShaderSource(Inspector::Protocol::Canvas::ShaderType);
-    bool updateShader(Inspector::Protocol::Canvas::ShaderType, const String& source);
+    WebGLRenderingContextBase& context() const;
+    WebGLProgram& program() const { return m_program; }
+    WebGLShader* shaderForType(const String&);
 
     bool disabled() const { return m_disabled; }
     void setDisabled(bool disabled) { m_disabled = disabled; }
 
     bool disabled() const { return m_disabled; }
     void setDisabled(bool disabled) { m_disabled = disabled; }
@@ -70,27 +52,15 @@ public:
     bool highlighted() const { return m_highlighted; }
     void setHighlighted(bool value) { m_highlighted = value; }
 
     bool highlighted() const { return m_highlighted; }
     void setHighlighted(bool value) { m_highlighted = value; }
 
+    ~InspectorShaderProgram() = default;
+
 private:
 private:
-#if ENABLE(WEBGL)
     InspectorShaderProgram(WebGLProgram&, InspectorCanvas&);
     InspectorShaderProgram(WebGLProgram&, InspectorCanvas&);
-#endif
-#if ENABLE(WEBGPU)
-    InspectorShaderProgram(WebGPUPipeline&, InspectorCanvas&);
-#endif
 
     String m_identifier;
 
     String m_identifier;
+    WebGLProgram& m_program;
     InspectorCanvas& m_canvas;
 
     InspectorCanvas& m_canvas;
 
-    Variant<
-#if ENABLE(WEBGL)
-        std::reference_wrapper<WebGLProgram>,
-#endif
-#if ENABLE(WEBGPU)
-        std::reference_wrapper<WebGPUPipeline>,
-#endif
-        Monostate
-    > m_program;
-
     bool m_disabled { false };
     bool m_highlighted { false };
 };
     bool m_disabled { false };
     bool m_highlighted { false };
 };
index 30321a6..1852248 100644 (file)
@@ -35,7 +35,6 @@
 #include "HTMLCanvasElement.h"
 #include "ImageBitmapRenderingContext.h"
 #include "InspectorDOMAgent.h"
 #include "HTMLCanvasElement.h"
 #include "ImageBitmapRenderingContext.h"
 #include "InspectorDOMAgent.h"
-#include "InspectorShaderProgram.h"
 #include "InstrumentingAgents.h"
 #include "JSExecState.h"
 #include "Microtasks.h"
 #include "InstrumentingAgents.h"
 #include "JSExecState.h"
 #include "Microtasks.h"
 #include <JavaScriptCore/InjectedScriptManager.h>
 #include <JavaScriptCore/InspectorProtocolObjects.h>
 #include <JavaScriptCore/JSCInlines.h>
 #include <JavaScriptCore/InjectedScriptManager.h>
 #include <JavaScriptCore/InspectorProtocolObjects.h>
 #include <JavaScriptCore/JSCInlines.h>
-#include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/Lock.h>
 #include <wtf/HashSet.h>
 #include <wtf/Lock.h>
-#include <wtf/Optional.h>
-#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
-#include <wtf/text/WTFString.h>
 
 #if ENABLE(WEBGL)
 #include "WebGLProgram.h"
 #include "WebGLRenderingContext.h"
 #include "WebGLRenderingContextBase.h"
 
 #if ENABLE(WEBGL)
 #include "WebGLProgram.h"
 #include "WebGLRenderingContext.h"
 #include "WebGLRenderingContextBase.h"
+#include "WebGLShader.h"
 #endif
 
 #if ENABLE(WEBGL2)
 #endif
 
 #if ENABLE(WEBGL2)
 
 #if ENABLE(WEBGPU)
 #include "GPUCanvasContext.h"
 
 #if ENABLE(WEBGPU)
 #include "GPUCanvasContext.h"
-#include "WebGPUComputePipeline.h"
 #include "WebGPUDevice.h"
 #include "WebGPUDevice.h"
-#include "WebGPUPipeline.h"
-#include "WebGPURenderPipeline.h"
-#include "WebGPUSwapChain.h"
 #endif
 
 namespace WebCore {
 #endif
 
 namespace WebCore {
@@ -85,7 +76,6 @@ InspectorCanvasAgent::InspectorCanvasAgent(PageAgentContext& context)
     , m_injectedScriptManager(context.injectedScriptManager)
     , m_inspectedPage(context.inspectedPage)
     , m_canvasDestroyedTimer(*this, &InspectorCanvasAgent::canvasDestroyedTimerFired)
     , m_injectedScriptManager(context.injectedScriptManager)
     , m_inspectedPage(context.inspectedPage)
     , m_canvasDestroyedTimer(*this, &InspectorCanvasAgent::canvasDestroyedTimerFired)
-    , m_programDestroyedTimer(*this, &InspectorCanvasAgent::programDestroyedTimerFired)
 {
 }
 
 {
 }
 
@@ -103,7 +93,7 @@ void InspectorCanvasAgent::willDestroyFrontendAndBackend(Inspector::DisconnectRe
 
 void InspectorCanvasAgent::discardAgent()
 {
 
 void InspectorCanvasAgent::discardAgent()
 {
-    reset();
+    clearCanvasData();
 }
 
 void InspectorCanvasAgent::enable(ErrorString&)
 }
 
 void InspectorCanvasAgent::enable(ErrorString&)
@@ -151,17 +141,7 @@ void InspectorCanvasAgent::enable(ErrorString&)
         LockHolder lock(WebGLProgram::instancesMutex());
         for (auto& [program, contextWebGLBase] : WebGLProgram::instances(lock)) {
             if (contextWebGLBase && existsInCurrentPage(contextWebGLBase->canvasBase().scriptExecutionContext()))
         LockHolder lock(WebGLProgram::instancesMutex());
         for (auto& [program, contextWebGLBase] : WebGLProgram::instances(lock)) {
             if (contextWebGLBase && existsInCurrentPage(contextWebGLBase->canvasBase().scriptExecutionContext()))
-                didCreateWebGLProgram(*contextWebGLBase, *program);
-        }
-    }
-#endif
-
-#if ENABLE(WEBGPU)
-    {
-        LockHolder lock(WebGPUPipeline::instancesMutex());
-        for (auto& [pipeline, device] : WebGPUPipeline::instances(lock)) {
-            if (device && existsInCurrentPage(device->scriptExecutionContext()) && pipeline->isValid())
-                didCreateWebGPUPipeline(*device, *pipeline);
+                didCreateProgram(*contextWebGLBase, *program);
         }
     }
 #endif
         }
     }
 #endif
@@ -171,7 +151,7 @@ void InspectorCanvasAgent::disable(ErrorString&)
 {
     m_instrumentingAgents.setInspectorCanvasAgent(nullptr);
 
 {
     m_instrumentingAgents.setInspectorCanvasAgent(nullptr);
 
-    reset();
+    clearCanvasData();
 
     m_recordingAutoCaptureFrameCount = WTF::nullopt;
 }
 
     m_recordingAutoCaptureFrameCount = WTF::nullopt;
 }
@@ -300,65 +280,93 @@ void InspectorCanvasAgent::stopRecording(ErrorString& errorString, const String&
     didFinishRecordingCanvasFrame(*context, true);
 }
 
     didFinishRecordingCanvasFrame(*context, true);
 }
 
-void InspectorCanvasAgent::requestShaderSource(ErrorString& errorString, const String& programId, const String& shaderTypeString, String* outSource)
+void InspectorCanvasAgent::requestShaderSource(ErrorString& errorString, const String& programId, const String& shaderType, String* content)
 {
 {
+#if ENABLE(WEBGL)
     auto inspectorProgram = assertInspectorProgram(errorString, programId);
     if (!inspectorProgram)
         return;
 
     auto inspectorProgram = assertInspectorProgram(errorString, programId);
     if (!inspectorProgram)
         return;
 
-    auto shaderType = Inspector::Protocol::InspectorHelpers::parseEnumValueFromString<Inspector::Protocol::Canvas::ShaderType>(shaderTypeString);
-    if (!shaderType) {
-        errorString = makeString("Unknown shaderType: "_s, shaderTypeString);
+    auto* shader = inspectorProgram->shaderForType(shaderType);
+    if (!shader) {
+        errorString = "Missing shader for given shaderType"_s;
         return;
     }
 
         return;
     }
 
-    auto source = inspectorProgram->requestShaderSource(shaderType.value());
-    if (!source) {
-        errorString = "Missing shader of given shaderType for given programId"_s;
-        return;
-    }
-
-    *outSource = source;
+    *content = shader->getSource();
+#else
+    UNUSED_PARAM(programId);
+    UNUSED_PARAM(shaderType);
+    UNUSED_PARAM(content);
+    errorString = "Not supported"_s;
+#endif
 }
 
 }
 
-void InspectorCanvasAgent::updateShader(ErrorString& errorString, const String& programId, const String& shaderTypeString, const String& source)
+void InspectorCanvasAgent::updateShader(ErrorString& errorString, const String& programId, const String& shaderType, const String& source)
 {
 {
+#if ENABLE(WEBGL)
     auto inspectorProgram = assertInspectorProgram(errorString, programId);
     if (!inspectorProgram)
         return;
 
     auto inspectorProgram = assertInspectorProgram(errorString, programId);
     if (!inspectorProgram)
         return;
 
-    auto shaderType = Inspector::Protocol::InspectorHelpers::parseEnumValueFromString<Inspector::Protocol::Canvas::ShaderType>(shaderTypeString);
-    if (!shaderType) {
-        errorString = makeString("Unknown shaderType: "_s, shaderTypeString);
+    auto* shader = inspectorProgram->shaderForType(shaderType);
+    if (!shader) {
+        errorString = "Missing shader for given shaderType"_s;
+        return;
+    }
+
+    WebGLRenderingContextBase& contextWebGL = inspectorProgram->context();
+    contextWebGL.shaderSource(shader, source);
+    contextWebGL.compileShader(shader);
+
+    if (!shader->isValid()) {
+        errorString = "Failed to update shader"_s;
         return;
     }
 
         return;
     }
 
-    if (!inspectorProgram->updateShader(shaderType.value(), source))
-        errorString = "Failed to update shader of given shaderType for given programId"_s;
+    contextWebGL.linkProgramWithoutInvalidatingAttribLocations(&inspectorProgram->program());
+#else
+    UNUSED_PARAM(programId);
+    UNUSED_PARAM(shaderType);
+    UNUSED_PARAM(source);
+    errorString = "Not supported"_s;
+#endif
 }
 
 void InspectorCanvasAgent::setShaderProgramDisabled(ErrorString& errorString, const String& programId, bool disabled)
 {
 }
 
 void InspectorCanvasAgent::setShaderProgramDisabled(ErrorString& errorString, const String& programId, bool disabled)
 {
+#if ENABLE(WEBGL)
     auto inspectorProgram = assertInspectorProgram(errorString, programId);
     if (!inspectorProgram)
         return;
 
     inspectorProgram->setDisabled(disabled);
     auto inspectorProgram = assertInspectorProgram(errorString, programId);
     if (!inspectorProgram)
         return;
 
     inspectorProgram->setDisabled(disabled);
+#else
+    UNUSED_PARAM(programId);
+    UNUSED_PARAM(disabled);
+    errorString = "Not supported"_s;
+#endif
 }
 
 void InspectorCanvasAgent::setShaderProgramHighlighted(ErrorString& errorString, const String& programId, bool highlighted)
 {
 }
 
 void InspectorCanvasAgent::setShaderProgramHighlighted(ErrorString& errorString, const String& programId, bool highlighted)
 {
+#if ENABLE(WEBGL)
     auto inspectorProgram = assertInspectorProgram(errorString, programId);
     if (!inspectorProgram)
         return;
 
     inspectorProgram->setHighlighted(highlighted);
     auto inspectorProgram = assertInspectorProgram(errorString, programId);
     if (!inspectorProgram)
         return;
 
     inspectorProgram->setHighlighted(highlighted);
+#else
+    UNUSED_PARAM(programId);
+    UNUSED_PARAM(highlighted);
+    errorString = "Not supported"_s;
+#endif
 }
 
 void InspectorCanvasAgent::frameNavigated(Frame& frame)
 {
     if (frame.isMainFrame()) {
 }
 
 void InspectorCanvasAgent::frameNavigated(Frame& frame)
 {
     if (frame.isMainFrame()) {
-        reset();
+        clearCanvasData();
         return;
     }
 
         return;
     }
 
@@ -560,7 +568,7 @@ void InspectorCanvasAgent::didEnableExtension(WebGLRenderingContextBase& context
     m_frontendDispatcher->extensionEnabled(inspectorCanvas->identifier(), extension);
 }
 
     m_frontendDispatcher->extensionEnabled(inspectorCanvas->identifier(), extension);
 }
 
-void InspectorCanvasAgent::didCreateWebGLProgram(WebGLRenderingContextBase& context, WebGLProgram& program)
+void InspectorCanvasAgent::didCreateProgram(WebGLRenderingContextBase& context, WebGLProgram& program)
 {
     auto inspectorCanvas = findInspectorCanvas(context);
     ASSERT(inspectorCanvas);
 {
     auto inspectorCanvas = findInspectorCanvas(context);
     ASSERT(inspectorCanvas);
@@ -570,19 +578,20 @@ void InspectorCanvasAgent::didCreateWebGLProgram(WebGLRenderingContextBase& cont
     auto inspectorProgram = InspectorShaderProgram::create(program, *inspectorCanvas);
     String programIdentifier = inspectorProgram->identifier();
     m_identifierToInspectorProgram.set(programIdentifier, WTFMove(inspectorProgram));
     auto inspectorProgram = InspectorShaderProgram::create(program, *inspectorCanvas);
     String programIdentifier = inspectorProgram->identifier();
     m_identifierToInspectorProgram.set(programIdentifier, WTFMove(inspectorProgram));
-    m_frontendDispatcher->programCreated(inspectorCanvas->identifier(), programIdentifier, Inspector::Protocol::Canvas::ProgramType::Render);
+    m_frontendDispatcher->programCreated(inspectorCanvas->identifier(), programIdentifier);
 }
 
 }
 
-void InspectorCanvasAgent::willDestroyWebGLProgram(WebGLProgram& program)
+void InspectorCanvasAgent::willDeleteProgram(WebGLProgram& program)
 {
     auto inspectorProgram = findInspectorProgram(program);
     if (!inspectorProgram)
         return;
 
 {
     auto inspectorProgram = findInspectorProgram(program);
     if (!inspectorProgram)
         return;
 
-    unbindProgram(*inspectorProgram);
+    String identifier = unbindProgram(*inspectorProgram);
+    m_frontendDispatcher->programDeleted(identifier);
 }
 
 }
 
-bool InspectorCanvasAgent::isWebGLProgramDisabled(WebGLProgram& program)
+bool InspectorCanvasAgent::isShaderProgramDisabled(WebGLProgram& program)
 {
     auto inspectorProgram = findInspectorProgram(program);
     ASSERT(inspectorProgram);
 {
     auto inspectorProgram = findInspectorProgram(program);
     ASSERT(inspectorProgram);
@@ -592,7 +601,7 @@ bool InspectorCanvasAgent::isWebGLProgramDisabled(WebGLProgram& program)
     return inspectorProgram->disabled();
 }
 
     return inspectorProgram->disabled();
 }
 
-bool InspectorCanvasAgent::isWebGLProgramHighlighted(WebGLProgram& program)
+bool InspectorCanvasAgent::isShaderProgramHighlighted(WebGLProgram& program)
 {
     auto inspectorProgram = findInspectorProgram(program);
     ASSERT(inspectorProgram);
 {
     auto inspectorProgram = findInspectorProgram(program);
     ASSERT(inspectorProgram);
@@ -640,38 +649,6 @@ void InspectorCanvasAgent::willConfigureSwapChain(GPUCanvasContext& contextGPU,
 
     notifyDeviceForSwapChain(newSwapChain);
 }
 
     notifyDeviceForSwapChain(newSwapChain);
 }
-
-void InspectorCanvasAgent::didCreateWebGPUPipeline(WebGPUDevice& device, WebGPUPipeline& pipeline)
-{
-    auto inspectorCanvas = findInspectorCanvas(device);
-    ASSERT(inspectorCanvas);
-    if (!inspectorCanvas)
-        return;
-
-    ASSERT(pipeline.isValid());
-
-    auto inspectorProgram = InspectorShaderProgram::create(pipeline, *inspectorCanvas);
-    String programIdentifier = inspectorProgram->identifier();
-    m_identifierToInspectorProgram.set(programIdentifier, WTFMove(inspectorProgram));
-
-    Optional<Inspector::Protocol::Canvas::ProgramType> programType;
-    if (is<WebGPUComputePipeline>(pipeline))
-        programType = Inspector::Protocol::Canvas::ProgramType::Compute;
-    else if (is<WebGPURenderPipeline>(pipeline))
-        programType = Inspector::Protocol::Canvas::ProgramType::Render;
-    ASSERT(programType);
-
-    m_frontendDispatcher->programCreated(inspectorCanvas->identifier(), programIdentifier, programType.value());
-}
-
-void InspectorCanvasAgent::willDestroyWebGPUPipeline(WebGPUPipeline& pipeline)
-{
-    auto inspectorProgram = findInspectorProgram(pipeline);
-    if (!inspectorProgram)
-        return;
-
-    unbindProgram(*inspectorProgram);
-}
 #endif
 
 void InspectorCanvasAgent::startRecording(InspectorCanvas& inspectorCanvas, Inspector::Protocol::Recording::Initiator initiator, RecordingOptions&& recordingOptions)
 #endif
 
 void InspectorCanvasAgent::startRecording(InspectorCanvas& inspectorCanvas, Inspector::Protocol::Recording::Initiator initiator, RecordingOptions&& recordingOptions)
@@ -717,18 +694,7 @@ void InspectorCanvasAgent::canvasDestroyedTimerFired()
     m_removedCanvasIdentifiers.clear();
 }
 
     m_removedCanvasIdentifiers.clear();
 }
 
-void InspectorCanvasAgent::programDestroyedTimerFired()
-{
-    if (!m_removedProgramIdentifiers.size())
-        return;
-
-    for (auto& identifier : m_removedProgramIdentifiers)
-        m_frontendDispatcher->programDeleted(identifier);
-
-    m_removedProgramIdentifiers.clear();
-}
-
-void InspectorCanvasAgent::reset()
+void InspectorCanvasAgent::clearCanvasData()
 {
     for (auto& inspectorCanvas : m_identifierToInspectorCanvas.values()) {
         if (auto* context = inspectorCanvas->canvasContext())
 {
     for (auto& inspectorCanvas : m_identifierToInspectorCanvas.values()) {
         if (auto* context = inspectorCanvas->canvasContext())
@@ -736,14 +702,13 @@ void InspectorCanvasAgent::reset()
     }
 
     m_identifierToInspectorCanvas.clear();
     }
 
     m_identifierToInspectorCanvas.clear();
+#if ENABLE(WEBGL)
+    m_identifierToInspectorProgram.clear();
     m_removedCanvasIdentifiers.clear();
     m_removedCanvasIdentifiers.clear();
+#endif
+
     if (m_canvasDestroyedTimer.isActive())
         m_canvasDestroyedTimer.stop();
     if (m_canvasDestroyedTimer.isActive())
         m_canvasDestroyedTimer.stop();
-
-    m_identifierToInspectorProgram.clear();
-    m_removedProgramIdentifiers.clear();
-    if (m_programDestroyedTimer.isActive())
-        m_programDestroyedTimer.stop();
 }
 
 InspectorCanvas& InspectorCanvasAgent::bindCanvas(CanvasRenderingContext& context, bool captureBacktrace)
 }
 
 InspectorCanvas& InspectorCanvasAgent::bindCanvas(CanvasRenderingContext& context, bool captureBacktrace)
@@ -840,18 +805,13 @@ RefPtr<InspectorCanvas> InspectorCanvasAgent::findInspectorCanvas(WebGPUDevice&
 }
 #endif
 
 }
 #endif
 
-void InspectorCanvasAgent::unbindProgram(InspectorShaderProgram& inspectorProgram)
+#if ENABLE(WEBGL)
+String InspectorCanvasAgent::unbindProgram(InspectorShaderProgram& inspectorProgram)
 {
     String identifier = inspectorProgram.identifier();
     m_identifierToInspectorProgram.remove(identifier);
 
 {
     String identifier = inspectorProgram.identifier();
     m_identifierToInspectorProgram.remove(identifier);
 
-    // This can be called in response to GC. Due to the single-process model used in WebKit1, the
-    // event must be dispatched from a timer to prevent the frontend from making JS allocations
-    // while the GC is still active.
-    m_removedProgramIdentifiers.append(identifier);
-
-    if (!m_programDestroyedTimer.isActive())
-        m_programDestroyedTimer.startOneShot(0_s);
+    return identifier;
 }
 
 RefPtr<InspectorShaderProgram> InspectorCanvasAgent::assertInspectorProgram(ErrorString& errorString, const String& programId)
 }
 
 RefPtr<InspectorShaderProgram> InspectorCanvasAgent::assertInspectorProgram(ErrorString& errorString, const String& programId)
@@ -864,22 +824,10 @@ RefPtr<InspectorShaderProgram> InspectorCanvasAgent::assertInspectorProgram(Erro
     return inspectorProgram;
 }
 
     return inspectorProgram;
 }
 
-#if ENABLE(WEBGL)
 RefPtr<InspectorShaderProgram> InspectorCanvasAgent::findInspectorProgram(WebGLProgram& program)
 {
     for (auto& inspectorProgram : m_identifierToInspectorProgram.values()) {
 RefPtr<InspectorShaderProgram> InspectorCanvasAgent::findInspectorProgram(WebGLProgram& program)
 {
     for (auto& inspectorProgram : m_identifierToInspectorProgram.values()) {
-        if (inspectorProgram->program() == &program)
-            return inspectorProgram;
-    }
-    return nullptr;
-}
-#endif
-
-#if ENABLE(WEBGPU)
-RefPtr<InspectorShaderProgram> InspectorCanvasAgent::findInspectorProgram(WebGPUPipeline& pipeline)
-{
-    for (auto& inspectorProgram : m_identifierToInspectorProgram.values()) {
-        if (inspectorProgram->pipeline() == &pipeline)
+        if (&inspectorProgram->program() == &program)
             return inspectorProgram;
     }
     return nullptr;
             return inspectorProgram;
     }
     return nullptr;
index 60c56e9..baedd46 100644 (file)
 #include <JavaScriptCore/InspectorBackendDispatchers.h>
 #include <JavaScriptCore/InspectorFrontendDispatchers.h>
 #include <initializer_list>
 #include <JavaScriptCore/InspectorBackendDispatchers.h>
 #include <JavaScriptCore/InspectorFrontendDispatchers.h>
 #include <initializer_list>
-#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+#if ENABLE(WEBGL)
+#include "InspectorShaderProgram.h"
+#endif
 
 namespace Inspector {
 class InjectedScriptManager;
 
 namespace Inspector {
 class InjectedScriptManager;
@@ -42,7 +49,6 @@ class InjectedScriptManager;
 namespace WebCore {
 
 class CanvasRenderingContext;
 namespace WebCore {
 
 class CanvasRenderingContext;
-class InspectorShaderProgram;
 #if ENABLE(WEBGL)
 class WebGLProgram;
 class WebGLRenderingContextBase;
 #if ENABLE(WEBGL)
 class WebGLProgram;
 class WebGLRenderingContextBase;
@@ -50,7 +56,6 @@ class WebGLRenderingContextBase;
 #if ENABLE(WEBGPU)
 class GPUCanvasContext;
 class WebGPUDevice;
 #if ENABLE(WEBGPU)
 class GPUCanvasContext;
 class WebGPUDevice;
-class WebGPUPipeline;
 class WebGPUSwapChain;
 #endif
 
 class WebGPUSwapChain;
 #endif
 
@@ -78,7 +83,7 @@ public:
     void setRecordingAutoCaptureFrameCount(ErrorString&, int count);
     void startRecording(ErrorString&, const String& canvasId, const int* frameCount, const int* memoryLimit);
     void stopRecording(ErrorString&, const String& canvasId);
     void setRecordingAutoCaptureFrameCount(ErrorString&, int count);
     void startRecording(ErrorString&, const String& canvasId, const int* frameCount, const int* memoryLimit);
     void stopRecording(ErrorString&, const String& canvasId);
-    void requestShaderSource(ErrorString&, const String& programId, const String& shaderType, String* source);
+    void requestShaderSource(ErrorString&, const String& programId, const String& shaderType, String*);
     void updateShader(ErrorString&, const String& programId, const String& shaderType, const String& source);
     void setShaderProgramDisabled(ErrorString&, const String& programId, bool disabled);
     void setShaderProgramHighlighted(ErrorString&, const String& programId, bool highlighted);
     void updateShader(ErrorString&, const String& programId, const String& shaderType, const String& source);
     void setShaderProgramDisabled(ErrorString&, const String& programId, bool disabled);
     void setShaderProgramHighlighted(ErrorString&, const String& programId, bool highlighted);
@@ -98,17 +103,15 @@ public:
     void consoleStartRecordingCanvas(CanvasRenderingContext&, JSC::ExecState&, JSC::JSObject* options);
 #if ENABLE(WEBGL)
     void didEnableExtension(WebGLRenderingContextBase&, const String&);
     void consoleStartRecordingCanvas(CanvasRenderingContext&, JSC::ExecState&, JSC::JSObject* options);
 #if ENABLE(WEBGL)
     void didEnableExtension(WebGLRenderingContextBase&, const String&);
-    void didCreateWebGLProgram(WebGLRenderingContextBase&, WebGLProgram&);
-    void willDestroyWebGLProgram(WebGLProgram&);
-    bool isWebGLProgramDisabled(WebGLProgram&);
-    bool isWebGLProgramHighlighted(WebGLProgram&);
+    void didCreateProgram(WebGLRenderingContextBase&, WebGLProgram&);
+    void willDeleteProgram(WebGLProgram&);
+    bool isShaderProgramDisabled(WebGLProgram&);
+    bool isShaderProgramHighlighted(WebGLProgram&);
 #endif
 #if ENABLE(WEBGPU)
     void didCreateWebGPUDevice(WebGPUDevice&);
     void willDestroyWebGPUDevice(WebGPUDevice&);
     void willConfigureSwapChain(GPUCanvasContext&, WebGPUSwapChain&);
 #endif
 #if ENABLE(WEBGPU)
     void didCreateWebGPUDevice(WebGPUDevice&);
     void willDestroyWebGPUDevice(WebGPUDevice&);
     void willConfigureSwapChain(GPUCanvasContext&, WebGPUSwapChain&);
-    void didCreateWebGPUPipeline(WebGPUDevice&, WebGPUPipeline&);
-    void willDestroyWebGPUPipeline(WebGPUPipeline&);
 #endif
 
 private:
 #endif
 
 private:
@@ -120,9 +123,7 @@ private:
     void startRecording(InspectorCanvas&, Inspector::Protocol::Recording::Initiator, RecordingOptions&& = { });
 
     void canvasDestroyedTimerFired();
     void startRecording(InspectorCanvas&, Inspector::Protocol::Recording::Initiator, RecordingOptions&& = { });
 
     void canvasDestroyedTimerFired();
-    void programDestroyedTimerFired();
-    void reset();
-
+    void clearCanvasData();
     InspectorCanvas& bindCanvas(CanvasRenderingContext&, bool captureBacktrace);
 #if ENABLE(WEBGPU)
     InspectorCanvas& bindCanvas(WebGPUDevice&, bool captureBacktrace);
     InspectorCanvas& bindCanvas(CanvasRenderingContext&, bool captureBacktrace);
 #if ENABLE(WEBGPU)
     InspectorCanvas& bindCanvas(WebGPUDevice&, bool captureBacktrace);
@@ -134,14 +135,11 @@ private:
     RefPtr<InspectorCanvas> findInspectorCanvas(WebGPUDevice&);
 #endif
 
     RefPtr<InspectorCanvas> findInspectorCanvas(WebGPUDevice&);
 #endif
 
-    void unbindProgram(InspectorShaderProgram&);
-    RefPtr<InspectorShaderProgram> assertInspectorProgram(ErrorString&, const String& programId);
 #if ENABLE(WEBGL)
 #if ENABLE(WEBGL)
+    String unbindProgram(InspectorShaderProgram&);
+    RefPtr<InspectorShaderProgram> assertInspectorProgram(ErrorString&, const String& programId);
     RefPtr<InspectorShaderProgram> findInspectorProgram(WebGLProgram&);
 #endif
     RefPtr<InspectorShaderProgram> findInspectorProgram(WebGLProgram&);
 #endif
-#if ENABLE(WEBGPU)
-    RefPtr<InspectorShaderProgram> findInspectorProgram(WebGPUPipeline&);
-#endif
 
     std::unique_ptr<Inspector::CanvasFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::CanvasBackendDispatcher> m_backendDispatcher;
 
     std::unique_ptr<Inspector::CanvasFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::CanvasBackendDispatcher> m_backendDispatcher;
@@ -150,14 +148,14 @@ private:
     Page& m_inspectedPage;
 
     HashMap<String, RefPtr<InspectorCanvas>> m_identifierToInspectorCanvas;
     Page& m_inspectedPage;
 
     HashMap<String, RefPtr<InspectorCanvas>> m_identifierToInspectorCanvas;
-    Vector<String> m_removedCanvasIdentifiers;
-    Timer m_canvasDestroyedTimer;
-
+#if ENABLE(WEBGL)
     HashMap<String, RefPtr<InspectorShaderProgram>> m_identifierToInspectorProgram;
     HashMap<String, RefPtr<InspectorShaderProgram>> m_identifierToInspectorProgram;
-    Vector<String> m_removedProgramIdentifiers;
-    Timer m_programDestroyedTimer;
+#endif
+    Vector<String> m_removedCanvasIdentifiers;
 
     Optional<size_t> m_recordingAutoCaptureFrameCount;
 
     Optional<size_t> m_recordingAutoCaptureFrameCount;
+
+    Timer m_canvasDestroyedTimer;
 };
 
 } // namespace WebCore
 };
 
 } // namespace WebCore
index b5699d4..cafc6e4 100644 (file)
@@ -27,8 +27,6 @@
 
 #if ENABLE(WEBGPU)
 
 
 #if ENABLE(WEBGPU)
 
-#include "GPUPipeline.h"
-#include "GPUProgrammableStageDescriptor.h"
 #include "WHLSLPrepare.h"
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
 #include "WHLSLPrepare.h"
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
@@ -40,39 +38,27 @@ namespace WebCore {
 
 class GPUDevice;
 class GPUErrorScopes;
 
 class GPUDevice;
 class GPUErrorScopes;
-class GPUPipelineLayout;
 
 struct GPUComputePipelineDescriptor;
 
 using PlatformComputePipeline = MTLComputePipelineState;
 using PlatformComputePipelineSmartPtr = RetainPtr<MTLComputePipelineState>;
 
 
 struct GPUComputePipelineDescriptor;
 
 using PlatformComputePipeline = MTLComputePipelineState;
 using PlatformComputePipelineSmartPtr = RetainPtr<MTLComputePipelineState>;
 
-class GPUComputePipeline final : public GPUPipeline {
+class GPUComputePipeline : public RefCounted<GPUComputePipeline> {
 public:
 public:
-    virtual ~GPUComputePipeline();
-
     static RefPtr<GPUComputePipeline> tryCreate(const GPUDevice&, const GPUComputePipelineDescriptor&, GPUErrorScopes&);
 
     static RefPtr<GPUComputePipeline> tryCreate(const GPUDevice&, const GPUComputePipelineDescriptor&, GPUErrorScopes&);
 
-    bool isComputePipeline() const { return true; }
-
-    bool recompile(const GPUDevice&, GPUProgrammableStageDescriptor&& computeStage);
-
     const PlatformComputePipeline* platformComputePipeline() const { return m_platformComputePipeline.get(); }
 
     WHLSL::ComputeDimensions computeDimensions() const { return m_computeDimensions; }
 
 private:
     const PlatformComputePipeline* platformComputePipeline() const { return m_platformComputePipeline.get(); }
 
     WHLSL::ComputeDimensions computeDimensions() const { return m_computeDimensions; }
 
 private:
-    GPUComputePipeline(PlatformComputePipelineSmartPtr&&, WHLSL::ComputeDimensions, GPUPipelineLayout&);
+    GPUComputePipeline(PlatformComputePipelineSmartPtr&&, WHLSL::ComputeDimensions);
 
     PlatformComputePipelineSmartPtr m_platformComputePipeline;
     WHLSL::ComputeDimensions m_computeDimensions { 0, 0, 0 };
 
     PlatformComputePipelineSmartPtr m_platformComputePipeline;
     WHLSL::ComputeDimensions m_computeDimensions { 0, 0, 0 };
-
-    // Preserved for Web Inspector recompilation.
-    RefPtr<GPUPipelineLayout> m_layout;
 };
 
 } // namespace WebCore
 
 };
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_GPUPIPELINE(WebCore::GPUComputePipeline, isComputePipeline())
-
 #endif // ENABLE(WEBGPU)
 #endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/platform/graphics/gpu/GPUPipeline.cpp b/Source/WebCore/platform/graphics/gpu/GPUPipeline.cpp
deleted file mode 100644 (file)
index 7c88165..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2019 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 INC. 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 INC. 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"
-#include "GPUPipeline.h"
-
-#if ENABLE(WEBGPU)
-
-namespace WebCore {
-
-GPUPipeline::~GPUPipeline() = default;
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/platform/graphics/gpu/GPUPipeline.h b/Source/WebCore/platform/graphics/gpu/GPUPipeline.h
deleted file mode 100644 (file)
index 942ee8d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2019 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 INC. 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 INC. 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
-
-#if ENABLE(WEBGPU)
-
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class GPUPipeline : public RefCounted<GPUPipeline> {
-public:
-    virtual ~GPUPipeline();
-
-    virtual bool isRenderPipeline() const { return false; }
-    virtual bool isComputePipeline() const { return false; }
-};
-
-} // namespace WebCore
-
-#define SPECIALIZE_TYPE_TRAITS_GPUPIPELINE(ToValueTypeName, predicate) \
-SPECIALIZE_TYPE_TRAITS_BEGIN(ToValueTypeName) \
-    static bool isType(const WebCore::GPUPipeline& pipeline) { return pipeline.predicate; } \
-SPECIALIZE_TYPE_TRAITS_END()
-
-#endif // ENABLE(WEBGPU)
index 27c0628..0ee1afa 100644 (file)
@@ -38,13 +38,13 @@ struct GPUProgrammableStageDescriptorBase {
 };
 
 struct GPUProgrammableStageDescriptor : GPUProgrammableStageDescriptorBase {
 };
 
 struct GPUProgrammableStageDescriptor : GPUProgrammableStageDescriptorBase {
-    GPUProgrammableStageDescriptor(Ref<GPUShaderModule>&& module, const GPUProgrammableStageDescriptorBase& base)
+    GPUProgrammableStageDescriptor(Ref<const GPUShaderModule>&& module, const GPUProgrammableStageDescriptorBase& base)
         : GPUProgrammableStageDescriptorBase(base)
         , module { WTFMove(module) }
     {
     }
 
         : GPUProgrammableStageDescriptorBase(base)
         , module { WTFMove(module) }
     {
     }
 
-    Ref<GPUShaderModule> module;
+    Ref<const GPUShaderModule> module;
 };
 
 } // namespace WebCore
 };
 
 } // namespace WebCore
index a0800d4..83c8e1d 100644 (file)
@@ -27,8 +27,6 @@
 
 #if ENABLE(WEBGPU)
 
 
 #if ENABLE(WEBGPU)
 
-#include "GPUPipeline.h"
-#include "GPUProgrammableStageDescriptor.h"
 #include "GPURenderPipelineDescriptor.h"
 #include <wtf/Optional.h>
 #include <wtf/RefCounted.h>
 #include "GPURenderPipelineDescriptor.h"
 #include <wtf/Optional.h>
 #include <wtf/RefCounted.h>
@@ -48,16 +46,10 @@ class GPUErrorScopes;
 using PlatformRenderPipeline = MTLRenderPipelineState;
 using PlatformRenderPipelineSmartPtr = RetainPtr<MTLRenderPipelineState>;
 
 using PlatformRenderPipeline = MTLRenderPipelineState;
 using PlatformRenderPipelineSmartPtr = RetainPtr<MTLRenderPipelineState>;
 
-class GPURenderPipeline final : public GPUPipeline {
+class GPURenderPipeline : public RefCounted<GPURenderPipeline> {
 public:
 public:
-    virtual ~GPURenderPipeline();
-
     static RefPtr<GPURenderPipeline> tryCreate(const GPUDevice&, const GPURenderPipelineDescriptor&, GPUErrorScopes&);
 
     static RefPtr<GPURenderPipeline> tryCreate(const GPUDevice&, const GPURenderPipelineDescriptor&, GPUErrorScopes&);
 
-    bool isRenderPipeline() const { return true; }
-
-    bool recompile(const GPUDevice&, GPUProgrammableStageDescriptor&& vertexStage, Optional<GPUProgrammableStageDescriptor>&& fragmentStage);
-
 #if USE(METAL)
     MTLDepthStencilState *depthStencilState() const { return m_depthStencilState.get(); }
 #endif
 #if USE(METAL)
     MTLDepthStencilState *depthStencilState() const { return m_depthStencilState.get(); }
 #endif
@@ -67,21 +59,15 @@ public:
 
 private:
 #if USE(METAL)
 
 private:
 #if USE(METAL)
-    GPURenderPipeline(RetainPtr<MTLDepthStencilState>&&, PlatformRenderPipelineSmartPtr&&, GPUPrimitiveTopology, Optional<GPUIndexFormat>, GPUPipelineLayout&, const GPURenderPipelineDescriptorBase&);
+    GPURenderPipeline(RetainPtr<MTLDepthStencilState>&&, PlatformRenderPipelineSmartPtr&&, GPUPrimitiveTopology, Optional<GPUIndexFormat>);
 
     RetainPtr<MTLDepthStencilState> m_depthStencilState;
 #endif // USE(METAL)
     PlatformRenderPipelineSmartPtr m_platformRenderPipeline;
     GPUPrimitiveTopology m_primitiveTopology;
     Optional<GPUIndexFormat> m_indexFormat;
 
     RetainPtr<MTLDepthStencilState> m_depthStencilState;
 #endif // USE(METAL)
     PlatformRenderPipelineSmartPtr m_platformRenderPipeline;
     GPUPrimitiveTopology m_primitiveTopology;
     Optional<GPUIndexFormat> m_indexFormat;
-
-    // Preserved for Web Inspector recompilation.
-    RefPtr<GPUPipelineLayout> m_layout;
-    GPURenderPipelineDescriptorBase m_renderDescriptorBase;
 };
 
 } // namespace WebCore
 
 };
 
 } // namespace WebCore
 
-SPECIALIZE_TYPE_TRAITS_GPUPIPELINE(WebCore::GPURenderPipeline, isRenderPipeline())
-
 #endif // ENABLE(WEBGPU)
 #endif // ENABLE(WEBGPU)
index 25829ea..7d8f8b2 100644 (file)
@@ -31,7 +31,6 @@
 #import "GPUComputePipelineDescriptor.h"
 #import "GPUDevice.h"
 #import "GPUErrorScopes.h"
 #import "GPUComputePipelineDescriptor.h"
 #import "GPUDevice.h"
 #import "GPUErrorScopes.h"
-#import "GPUPipelineLayout.h"
 #import "GPUPipelineMetalConvertLayout.h"
 #import "WHLSLPrepare.h"
 #import <Metal/Metal.h>
 #import "GPUPipelineMetalConvertLayout.h"
 #import "WHLSLPrepare.h"
 #import <Metal/Metal.h>
@@ -195,35 +194,15 @@ RefPtr<GPUComputePipeline> GPUComputePipeline::tryCreate(const GPUDevice& device
     if (!createResult)
         return nullptr;
 
     if (!createResult)
         return nullptr;
 
-    ASSERT(descriptor.layout);
-    return adoptRef(new GPUComputePipeline(WTFMove(createResult->pipelineState), createResult->computeDimensions, *descriptor.layout));
+    return adoptRef(new GPUComputePipeline(WTFMove(createResult->pipelineState), createResult->computeDimensions));
 }
 
 }
 
-GPUComputePipeline::GPUComputePipeline(RetainPtr<MTLComputePipelineState>&& pipeline, WHLSL::ComputeDimensions computeDimensions, GPUPipelineLayout& layout)
-    : GPUPipeline()
-    , m_platformComputePipeline(WTFMove(pipeline))
+GPUComputePipeline::GPUComputePipeline(RetainPtr<MTLComputePipelineState>&& pipeline, WHLSL::ComputeDimensions computeDimensions)
+    : m_platformComputePipeline(WTFMove(pipeline))
     , m_computeDimensions(computeDimensions)
     , m_computeDimensions(computeDimensions)
-    , m_layout(makeRef(layout))
 {
 }
 
 {
 }
 
-GPUComputePipeline::~GPUComputePipeline() = default;
-
-bool GPUComputePipeline::recompile(const GPUDevice& device, GPUProgrammableStageDescriptor&& computeStage)
-{
-    if (m_layout) {
-        GPUComputePipelineDescriptor descriptor(makeRef(*m_layout), WTFMove(computeStage));
-        auto errorScopes = GPUErrorScopes::create([] (GPUError&&) { });
-        if (auto createResult = tryCreateMTLComputePipelineState(device, descriptor, errorScopes)) {
-            m_platformComputePipeline = WTFMove(createResult->pipelineState);
-            m_computeDimensions = createResult->computeDimensions;
-            return true;
-        }
-    }
-
-    return false;
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)
index 9f4d073..2824087 100644 (file)
@@ -32,7 +32,6 @@
 #import "GPUErrorScopes.h"
 #import "GPULimits.h"
 #import "GPUPipelineMetalConvertLayout.h"
 #import "GPUErrorScopes.h"
 #import "GPULimits.h"
 #import "GPUPipelineMetalConvertLayout.h"
-#import "GPURenderPipelineDescriptor.h"
 #import "GPUUtils.h"
 #import "WHLSLPrepare.h"
 #import "WHLSLVertexBufferIndexCalculator.h"
 #import "GPUUtils.h"
 #import "WHLSLPrepare.h"
 #import "WHLSLVertexBufferIndexCalculator.h"
@@ -484,7 +483,7 @@ static RetainPtr<MTLRenderPipelineDescriptor> convertRenderPipelineDescriptor(co
     return mtlDescriptor;
 }
 
     return mtlDescriptor;
 }
 
-static RetainPtr<MTLRenderPipelineState> tryCreateMtlRenderPipelineState(const GPUDevice& device, const GPURenderPipelineDescriptor& descriptor, GPUErrorScopes& errorScopes)
+static RetainPtr<MTLRenderPipelineState> tryCreateMtlRenderPipelineState(const GPURenderPipelineDescriptor& descriptor, const GPUDevice& device, GPUErrorScopes& errorScopes)
 {
     if (!device.platformDevice()) {
         errorScopes.generatePrefixedError("Invalid GPUDevice!");
 {
     if (!device.platformDevice()) {
         errorScopes.generatePrefixedError("Invalid GPUDevice!");
@@ -523,41 +522,21 @@ RefPtr<GPURenderPipeline> GPURenderPipeline::tryCreate(const GPUDevice& device,
 
     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=198387 depthStencilAttachmentDescriptor isn't implemented yet for WHLSL compiler.
 
 
     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=198387 depthStencilAttachmentDescriptor isn't implemented yet for WHLSL compiler.
 
-    auto pipeline = tryCreateMtlRenderPipelineState(device, descriptor, errorScopes);
+    auto pipeline = tryCreateMtlRenderPipelineState(descriptor, device, errorScopes);
     if (!pipeline)
         return nullptr;
 
     if (!pipeline)
         return nullptr;
 
-    ASSERT(descriptor.layout);
-    return adoptRef(new GPURenderPipeline(WTFMove(depthStencil), WTFMove(pipeline), descriptor.primitiveTopology, descriptor.vertexInput.indexFormat, *descriptor.layout, descriptor));
+    return adoptRef(new GPURenderPipeline(WTFMove(depthStencil), WTFMove(pipeline), descriptor.primitiveTopology, descriptor.vertexInput.indexFormat));
 }
 
 }
 
-GPURenderPipeline::GPURenderPipeline(RetainPtr<MTLDepthStencilState>&& depthStencil, RetainPtr<MTLRenderPipelineState>&& pipeline, GPUPrimitiveTopology topology, Optional<GPUIndexFormat> format, GPUPipelineLayout& layout, const GPURenderPipelineDescriptorBase& renderDescriptorBase)
-    : GPUPipeline()
-    , m_depthStencilState(WTFMove(depthStencil))
+GPURenderPipeline::GPURenderPipeline(RetainPtr<MTLDepthStencilState>&& depthStencil, RetainPtr<MTLRenderPipelineState>&& pipeline, GPUPrimitiveTopology topology, Optional<GPUIndexFormat> format)
+    : m_depthStencilState(WTFMove(depthStencil))
     , m_platformRenderPipeline(WTFMove(pipeline))
     , m_primitiveTopology(topology)
     , m_indexFormat(format)
     , m_platformRenderPipeline(WTFMove(pipeline))
     , m_primitiveTopology(topology)
     , m_indexFormat(format)
-    , m_layout(makeRef(layout))
-    , m_renderDescriptorBase(renderDescriptorBase)
 {
 }
 
 {
 }
 
-GPURenderPipeline::~GPURenderPipeline() = default;
-
-bool GPURenderPipeline::recompile(const GPUDevice& device, GPUProgrammableStageDescriptor&& vertexStage, Optional<GPUProgrammableStageDescriptor>&& fragmentStage)
-{
-    if (m_layout) {
-        GPURenderPipelineDescriptor descriptor(makeRef(*m_layout), WTFMove(vertexStage), WTFMove(fragmentStage), m_renderDescriptorBase);
-        auto errorScopes = GPUErrorScopes::create([] (GPUError&&) { });
-        if (auto pipeline = tryCreateMtlRenderPipelineState(device, descriptor, errorScopes)) {
-            m_platformRenderPipeline = WTFMove(pipeline);
-            return true;
-        }
-    }
-
-    return false;
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)
index da89c3e..726e08a 100644 (file)
@@ -1,3 +1,15 @@
+2019-09-20  Truitt Savell  <tsavell@apple.com>
+
+        Unreviewed, rolling out r250114.
+
+        Broke ~16 webgpu/ tests on Mojave wk2
+
+        Reverted changeset:
+
+        "Web Inspector: Canvas: show WebGPU shader pipelines"
+        https://bugs.webkit.org/show_bug.cgi?id=201675
+        https://trac.webkit.org/changeset/250114
+
 2019-09-19  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: searching in overrides doesn't work
 2019-09-19  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: searching in overrides doesn't work
index 4499e81..73adbf7 100644 (file)
@@ -266,9 +266,6 @@ localizedStrings["Composited"] = "Composited";
 localizedStrings["Compressed"] = "Compressed";
 localizedStrings["Compression"] = "Compression";
 localizedStrings["Compression:"] = "Compression:";
 localizedStrings["Compressed"] = "Compressed";
 localizedStrings["Compression"] = "Compression";
 localizedStrings["Compression:"] = "Compression:";
-localizedStrings["Compute"] = "Compute";
-localizedStrings["Compute Pipeline %d"] = "Compute Pipeline %d";
-localizedStrings["Compute Shader"] = "Compute Shader";
 localizedStrings["Computed"] = "Computed";
 localizedStrings["Condition"] = "Condition";
 localizedStrings["Conditional expression"] = "Conditional expression";
 localizedStrings["Computed"] = "Computed";
 localizedStrings["Condition"] = "Condition";
 localizedStrings["Conditional expression"] = "Conditional expression";
@@ -466,7 +463,6 @@ localizedStrings["Ensure that only one main content section is used on the page.
 localizedStrings["Ensure that values for \u0022%s\u0022 are valid."] = "Ensure that values for \u0022%s\u0022 are valid.";
 localizedStrings["Entered Full-Screen Mode"] = "Entered Full-Screen Mode";
 localizedStrings["Entire Recording"] = "Entire Recording";
 localizedStrings["Ensure that values for \u0022%s\u0022 are valid."] = "Ensure that values for \u0022%s\u0022 are valid.";
 localizedStrings["Entered Full-Screen Mode"] = "Entered Full-Screen Mode";
 localizedStrings["Entire Recording"] = "Entire Recording";
-localizedStrings["Entry point: "] = "Entry point: ";
 localizedStrings["Error"] = "Error";
 localizedStrings["Error: "] = "Error: ";
 localizedStrings["Errors"] = "Errors";
 localizedStrings["Error"] = "Error";
 localizedStrings["Error: "] = "Error: ";
 localizedStrings["Errors"] = "Errors";
@@ -885,7 +881,6 @@ localizedStrings["Remove Watch Expression"] = "Remove Watch Expression";
 localizedStrings["Remove probe"] = "Remove probe";
 localizedStrings["Remove this breakpoint action"] = "Remove this breakpoint action";
 localizedStrings["Removed descendant "] = "Removed descendant ";
 localizedStrings["Remove probe"] = "Remove probe";
 localizedStrings["Remove this breakpoint action"] = "Remove this breakpoint action";
 localizedStrings["Removed descendant "] = "Removed descendant ";
-localizedStrings["Render Pipeline %d"] = "Render Pipeline %d";
 localizedStrings["Rendering Frames"] = "Rendering Frames";
 localizedStrings["Repeating Linear Gradient"] = "Repeating Linear Gradient";
 localizedStrings["Repeating Radial Gradient"] = "Repeating Radial Gradient";
 localizedStrings["Rendering Frames"] = "Rendering Frames";
 localizedStrings["Repeating Linear Gradient"] = "Repeating Linear Gradient";
 localizedStrings["Repeating Radial Gradient"] = "Repeating Radial Gradient";
@@ -1002,6 +997,7 @@ localizedStrings["Session Storage"] = "Session Storage";
 localizedStrings["Set to Automatically Continue"] = "Set to Automatically Continue";
 localizedStrings["Setter"] = "Setter";
 localizedStrings["Settings"] = "Settings";
 localizedStrings["Set to Automatically Continue"] = "Set to Automatically Continue";
 localizedStrings["Setter"] = "Setter";
 localizedStrings["Settings"] = "Settings";
+localizedStrings["Shader"] = "Shader";
 localizedStrings["Shader Programs"] = "Shader Programs";
 localizedStrings["Shadow Content"] = "Shadow Content";
 localizedStrings["Shadow Content (%s)"] = "Shadow Content (%s)";
 localizedStrings["Shader Programs"] = "Shader Programs";
 localizedStrings["Shadow Content"] = "Shadow Content";
 localizedStrings["Shadow Content (%s)"] = "Shadow Content (%s)";
index 38f01bb..389cb71 100644 (file)
@@ -234,7 +234,7 @@ WI.CanvasManager = class CanvasManager extends WI.Object
         canvas.enableExtension(extension);
     }
 
         canvas.enableExtension(extension);
     }
 
-    programCreated(canvasIdentifier, programIdentifier, programType)
+    programCreated(canvasIdentifier, programIdentifier)
     {
         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
         console.assert(canvas);
     {
         let canvas = this._canvasIdentifierMap.get(canvasIdentifier);
         console.assert(canvas);
@@ -243,11 +243,7 @@ WI.CanvasManager = class CanvasManager extends WI.Object
 
         console.assert(!this._shaderProgramIdentifierMap.has(programIdentifier), `ShaderProgram already exists with id ${programIdentifier}.`);
 
 
         console.assert(!this._shaderProgramIdentifierMap.has(programIdentifier), `ShaderProgram already exists with id ${programIdentifier}.`);
 
-        // COMPATIBILITY (iOS 13): `programType` did not exist yet.
-        if (!programType)
-            programType = WI.ShaderProgram.ProgramType.Render;
-
-        let program = new WI.ShaderProgram(programIdentifier, programType, canvas);
+        let program = new WI.ShaderProgram(programIdentifier, canvas);
         this._shaderProgramIdentifierMap.set(program.identifier, program);
 
         canvas.shaderProgramCollection.add(program);
         this._shaderProgramIdentifierMap.set(program.identifier, program);
 
         canvas.shaderProgramCollection.add(program);
index 7d56ec1..b929f06 100644 (file)
@@ -45,7 +45,7 @@ WI.Canvas = class Canvas extends WI.Object
         this._shaderProgramCollection = new WI.ShaderProgramCollection;
         this._recordingCollection = new WI.RecordingCollection;
 
         this._shaderProgramCollection = new WI.ShaderProgramCollection;
         this._recordingCollection = new WI.RecordingCollection;
 
-        this._nextShaderProgramDisplayNumber = null;
+        this._nextShaderProgramDisplayNumber = 1;
 
         this._requestNodePromise = null;
 
 
         this._requestNodePromise = null;
 
@@ -409,15 +409,11 @@ WI.Canvas = class Canvas extends WI.Object
         this.dispatchEventToListeners(WI.Canvas.Event.RecordingStopped, {recording, initiatedByUser});
     }
 
         this.dispatchEventToListeners(WI.Canvas.Event.RecordingStopped, {recording, initiatedByUser});
     }
 
-    nextShaderProgramDisplayNumberForProgramType(programType)
+    nextShaderProgramDisplayNumber()
     {
         // Called from WI.ShaderProgram.
 
     {
         // Called from WI.ShaderProgram.
 
-        if (!this._nextShaderProgramDisplayNumber)
-            this._nextShaderProgramDisplayNumber = {};
-
-        this._nextShaderProgramDisplayNumber[programType] = (this._nextShaderProgramDisplayNumber[programType] || 0) + 1;
-        return this._nextShaderProgramDisplayNumber[programType];
+        return this._nextShaderProgramDisplayNumber++;
     }
 };
 
     }
 };
 
index 67f4984..c1ed9c8 100644 (file)
 
 WI.ShaderProgram = class ShaderProgram extends WI.Object
 {
 
 WI.ShaderProgram = class ShaderProgram extends WI.Object
 {
-    constructor(identifier, programType, canvas)
+    constructor(identifier, canvas)
     {
         console.assert(identifier);
     {
         console.assert(identifier);
-        console.assert(Object.values(ShaderProgram.ProgramType).includes(programType));
         console.assert(canvas instanceof WI.Canvas);
         console.assert(canvas instanceof WI.Canvas);
-        console.assert(ShaderProgram.contextTypeSupportsProgramType(canvas.contextType, programType));
 
         super();
 
         this._identifier = identifier;
 
         super();
 
         this._identifier = identifier;
-        this._programType = programType;
         this._canvas = canvas;
         this._canvas = canvas;
+        this._uniqueDisplayNumber = canvas.nextShaderProgramDisplayNumber();
         this._disabled = false;
     }
 
         this._disabled = false;
     }
 
-    // Static
-
-    static contextTypeSupportsProgramType(contextType, programType)
-    {
-        switch (contextType) {
-        case WI.Canvas.ContextType.WebGL:
-        case WI.Canvas.ContextType.WebGL2:
-            return programType === ShaderProgram.ProgramType.Render;
-
-        case WI.Canvas.ContextType.WebGPU:
-            return programType === ShaderProgram.ProgramType.Compute
-                || programType === ShaderProgram.ProgramType.Render;
-        }
-
-        console.assert();
-        return false;
-    }
-
-    static programTypeSupportsShaderType(programType, shaderType)
-    {
-        switch (programType) {
-        case ShaderProgram.ProgramType.Compute:
-            return shaderType === ShaderProgram.ShaderType.Compute;
-
-        case ShaderProgram.ProgramType.Render:
-            return shaderType === ShaderProgram.ShaderType.Fragment
-                || shaderType === ShaderProgram.ShaderType.Vertex;
-        }
-
-        console.assert();
-        return false;
-    }
-
     // Public
 
     get identifier() { return this._identifier; }
     // Public
 
     get identifier() { return this._identifier; }
-    get programType() { return this._programType; }
     get canvas() { return this._canvas; }
 
     get displayName()
     {
     get canvas() { return this._canvas; }
 
     get displayName()
     {
-        let format = null;
-        switch (this._canvas.contextType) {
-        case WI.Canvas.ContextType.WebGL:
-        case WI.Canvas.ContextType.WebGL2:
-            format = WI.UIString("Program %d");
-            break;
-        case WI.Canvas.ContextType.WebGPU:
-            switch (this._programType) {
-            case ShaderProgram.ProgramType.Compute:
-                format = WI.UIString("Compute Pipeline %d");
-                break;
-            case ShaderProgram.ProgramType.Render:
-                format = WI.UIString("Render Pipeline %d");
-                break;
-            }
-            break;
-        }
-        console.assert(format);
-        if (!this._uniqueDisplayNumber)
-            this._uniqueDisplayNumber = this._canvas.nextShaderProgramDisplayNumberForProgramType(this._programType);
-        return format.format(this._uniqueDisplayNumber);
+        return WI.UIString("Program %d").format(this._uniqueDisplayNumber);
     }
 
     get disabled()
     }
 
     get disabled()
@@ -111,12 +55,6 @@ WI.ShaderProgram = class ShaderProgram extends WI.Object
 
     set disabled(disabled)
     {
 
     set disabled(disabled)
     {
-        console.assert(this._programType === ShaderProgram.ProgramType.Render);
-        console.assert(this._canvas.contextType === WI.Canvas.ContextType.WebGL || this._canvas.contextType === WI.Canvas.ContextType.WebGL2);
-
-        if (this._canvas.contextType === WI.Canvas.ContextType.WebGPU)
-            return;
-
         if (this._disabled === disabled)
             return;
 
         if (this._disabled === disabled)
             return;
 
@@ -127,57 +65,67 @@ WI.ShaderProgram = class ShaderProgram extends WI.Object
         this.dispatchEventToListeners(ShaderProgram.Event.DisabledChanged);
     }
 
         this.dispatchEventToListeners(ShaderProgram.Event.DisabledChanged);
     }
 
-    requestShaderSource(shaderType, callback)
+    requestVertexShaderSource(callback)
     {
     {
-        console.assert(Object.values(ShaderProgram.ShaderType).includes(shaderType));
-        console.assert(ShaderProgram.programTypeSupportsShaderType(this._programType, shaderType));
-
-        // COMPATIBILITY (iOS 13): `content` was renamed to `source`.
-        CanvasAgent.requestShaderSource(this._identifier, shaderType, (error, source) => {
-            if (error) {
-                WI.reportInternalError(error);
-                callback(null, null);
-                return;
-            }
+        this._requestShaderSource(CanvasAgent.ShaderType.Vertex, callback);
+    }
 
 
-            callback(source);
-        });
+    requestFragmentShaderSource(callback)
+    {
+        this._requestShaderSource(CanvasAgent.ShaderType.Fragment, callback);
     }
 
     }
 
-    updateShader(shaderType, source)
+    updateVertexShader(source)
     {
     {
-        console.assert(Object.values(ShaderProgram.ShaderType).includes(shaderType));
-        console.assert(ShaderProgram.programTypeSupportsShaderType(this._programType, shaderType));
+        this._updateShader(CanvasAgent.ShaderType.Vertex, source);
+    }
 
 
-        CanvasAgent.updateShader(this._identifier, shaderType, source);
+    updateFragmentShader(source)
+    {
+        this._updateShader(CanvasAgent.ShaderType.Fragment, source);
     }
 
     showHighlight()
     {
     }
 
     showHighlight()
     {
-        console.assert(this._programType === ShaderProgram.ProgramType.Render);
-        console.assert(this._canvas.contextType === WI.Canvas.ContextType.WebGL || this._canvas.contextType === WI.Canvas.ContextType.WebGL2);
-
-        CanvasAgent.setShaderProgramHighlighted(this._identifier, true);
+        const highlighted = true;
+        CanvasAgent.setShaderProgramHighlighted(this._identifier, highlighted, (error) => {
+            console.assert(!error, error);
+        });
     }
 
     hideHighlight()
     {
     }
 
     hideHighlight()
     {
-        console.assert(this._programType === ShaderProgram.ProgramType.Render);
-        console.assert(this._canvas.contextType === WI.Canvas.ContextType.WebGL || this._canvas.contextType === WI.Canvas.ContextType.WebGL2);
+        const highlighted = false;
+        CanvasAgent.setShaderProgramHighlighted(this._identifier, highlighted, (error) => {
+            console.assert(!error, error);
+        });
+    }
+
+    // Private
+
+    _requestShaderSource(shaderType, callback)
+    {
+        CanvasAgent.requestShaderSource(this._identifier, shaderType, (error, content) => {
+            if (error) {
+                callback(null);
+                return;
+            }
 
 
-        CanvasAgent.setShaderProgramHighlighted(this._identifier, false);
+            callback(content);
+        });
     }
     }
-};
 
 
-WI.ShaderProgram.ProgramType = {
-    Compute: "compute",
-    Render: "render",
+    _updateShader(shaderType, source)
+    {
+        CanvasAgent.updateShader(this._identifier, shaderType, source, (error) => {
+            console.assert(!error, error);
+        });
+    }
 };
 
 WI.ShaderProgram.ShaderType = {
 };
 
 WI.ShaderProgram.ShaderType = {
-    Compute: "compute",
-    Fragment: "fragment",
-    Vertex: "vertex",
+    Fragment: "shader-type-fragment",
+    Vertex: "shader-type-vertex",
 };
 
 WI.ShaderProgram.Event = {
 };
 
 WI.ShaderProgram.Event = {
index 6f53574..3e5dd6c 100644 (file)
@@ -67,9 +67,9 @@ WI.CanvasObserver = class CanvasObserver
         WI.canvasManager.extensionEnabled(canvasId, extension);
     }
 
         WI.canvasManager.extensionEnabled(canvasId, extension);
     }
 
-    programCreated(canvasId, programId, programType)
+    programCreated(canvasId, programId)
     {
     {
-        WI.canvasManager.programCreated(canvasId, programId, programType);
+        WI.canvasManager.programCreated(canvasId, programId);
     }
 
     programDeleted(programId)
     }
 
     programDeleted(programId)
index 3a3aadf..9afc4ab 100644 (file)
     extraJSONTypes.forEach(function(type) {
         CodeMirror.defineMIME(type, {name: "javascript", json: true});
     });
     extraJSONTypes.forEach(function(type) {
         CodeMirror.defineMIME(type, {name: "javascript", json: true});
     });
-
-    // FIXME: Add WHLSL specific modes.
-    CodeMirror.defineMIME("x-pipeline/x-compute", "x-shader/x-vertex");
-    CodeMirror.defineMIME("x-pipeline/x-fragment", "x-shader/x-fragment");
-    CodeMirror.defineMIME("x-pipeline/x-vertex", "x-shader/x-vertex");
 })();
 
 WI.compareCodeMirrorPositions = function(a, b)
 })();
 
 WI.compareCodeMirrorPositions = function(a, b)
index 0d0a77a..55ef41f 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-.content-view.shader-program > .shader {
-    display: flex;
-    flex-direction: column;
+.content-view.shader-program > .text-editor.shader {
     position: absolute;
     top: 0;
     bottom: 0;
     position: absolute;
     top: 0;
     bottom: 0;
-}
 
 
-.content-view.shader-program > .shader.compute {
-    right: 0;
-    left: 0;
+    --border-start-style: 1px solid lightgrey;
 }
 
 }
 
-body[dir=ltr] .content-view.shader-program > .shader.vertex,
-body[dir=rtl] .content-view.shader-program > .shader.fragment {
+body[dir=ltr] .content-view.shader-program > .text-editor.shader.vertex,
+body[dir=rtl] .content-view.shader-program > .text-editor.shader.fragment {
     width: calc(50% - 1px);
     left: 0;
 }
 
     width: calc(50% - 1px);
     left: 0;
 }
 
-body[dir=ltr] .content-view.shader-program > .shader.fragment,
-body[dir=rtl] .content-view.shader-program > .shader.vertex {
+body[dir=ltr] .content-view.shader-program > .text-editor.shader.fragment,
+body[dir=rtl] .content-view.shader-program > .text-editor.shader.vertex {
     width: calc(50% + 1px);
     right: 0;
 }
 
     width: calc(50% + 1px);
     right: 0;
 }
 
-.content-view.shader-program > .shader + .shader {
-    border-left: 1px solid var(--border-color);
+body[dir=ltr] .content-view.shader-program > .text-editor.shader + .text-editor.shader {
+    border-left: var(--border-start-style);
+}
+
+body[dir=rtl] .content-view.shader-program > .text-editor.shader + .text-editor.shader {
+    border-right: var(--border-start-style);
 }
 
 }
 
-.content-view.shader-program > .shader > header > * {
+.content-view.shader-program > .text-editor.shader > .type-title {
     padding: 2px 4px;
     padding: 2px 4px;
+    background-color: hsl(0, 0%, 95%);
     border-bottom: 1px solid lightgrey;
 }
 
     border-bottom: 1px solid lightgrey;
 }
 
-.content-view.shader-program > .shader > header > .shader-type {
-    background-color: hsl(0, 0%, 95%);
+.content-view.shader-program > .text-editor.shader > .CodeMirror {
+    top: 18px;
 }
 
 @media (prefers-color-scheme: dark) {
 }
 
 @media (prefers-color-scheme: dark) {
-    .content-view.shader-program > .shader > header {
+    .content-view.shader-program > .text-editor.shader {
+        --border-start-style: 1px solid var(--text-color-quaternary);
+    }
+
+    .content-view.shader-program > .text-editor.shader > .type-title {
         background-color: var(--background-color);
         border-bottom-color: var(--text-color-quaternary);
     }
         background-color: var(--background-color);
         border-bottom-color: var(--text-color-quaternary);
     }
index 96952a9..dd9254e 100644 (file)
@@ -31,26 +31,13 @@ WI.ShaderProgramContentView = class ShaderProgramContentView extends WI.ContentV
 
         super(shaderProgram);
 
 
         super(shaderProgram);
 
-        let isWebGPU = this.representedObject.contextType === WI.Canvas.ContextType.WebGPU;
-
-        this._refreshButtonNavigationItem = new WI.ButtonNavigationItem("refresh", WI.UIString("Refresh"), "Images/ReloadFull.svg", 13, 13);
-        this._refreshButtonNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
-        this._refreshButtonNavigationItem.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._refreshContent, this);
-
         let contentDidChangeDebouncer = new Debouncer((event) => {
             this._contentDidChange(event);
         });
 
         let contentDidChangeDebouncer = new Debouncer((event) => {
             this._contentDidChange(event);
         });
 
-        this.element.classList.add("shader-program", this.representedObject.programType);
+        this.element.classList.add("shader-program");
 
         let createEditor = (shaderType) => {
 
         let createEditor = (shaderType) => {
-            let container = this.element.appendChild(document.createElement("div"));
-
-            let header = container.appendChild(document.createElement("header"));
-
-            let shaderTypeContainer = header.appendChild(document.createElement("div"));
-            shaderTypeContainer.classList.add("shader-type");
-
             let textEditor = new WI.TextEditor;
             textEditor.readOnly = false;
             textEditor.addEventListener(WI.TextEditor.Event.Focused, this._editorFocused, this);
             let textEditor = new WI.TextEditor;
             textEditor.readOnly = false;
             textEditor.addEventListener(WI.TextEditor.Event.Focused, this._editorFocused, this);
@@ -58,61 +45,32 @@ WI.ShaderProgramContentView = class ShaderProgramContentView extends WI.ContentV
             textEditor.addEventListener(WI.TextEditor.Event.ContentDidChange, (event) => {
                 contentDidChangeDebouncer.delayForTime(250, event);
             }, this);
             textEditor.addEventListener(WI.TextEditor.Event.ContentDidChange, (event) => {
                 contentDidChangeDebouncer.delayForTime(250, event);
             }, this);
+            textEditor.element.classList.add("shader");
+
+            let shaderTypeContainer = textEditor.element.insertAdjacentElement("afterbegin", document.createElement("div"));
+            shaderTypeContainer.classList.add("type-title");
 
             switch (shaderType) {
 
             switch (shaderType) {
-            case WI.ShaderProgram.ShaderType.Compute:
-                shaderTypeContainer.textContent = WI.UIString("Compute Shader");
-                textEditor.mimeType = isWebGPU ? "x-pipeline/x-compute" : "x-shader/x-compute";
+            case WI.ShaderProgram.ShaderType.Vertex:
+                shaderTypeContainer.textContent = WI.UIString("Vertex Shader");
+                textEditor.mimeType = "x-shader/x-vertex";
+                textEditor.element.classList.add("vertex");
                 break;
 
             case WI.ShaderProgram.ShaderType.Fragment:
                 shaderTypeContainer.textContent = WI.UIString("Fragment Shader");
                 break;
 
             case WI.ShaderProgram.ShaderType.Fragment:
                 shaderTypeContainer.textContent = WI.UIString("Fragment Shader");
-                textEditor.mimeType = isWebGPU ? "x-pipeline/x-fragment" : "x-shader/x-fragment";
-                break;
-
-            case WI.ShaderProgram.ShaderType.Vertex:
-                shaderTypeContainer.textContent = WI.UIString("Vertex Shader");
-                textEditor.mimeType = isWebGPU ? "x-pipeline/x-vertex" : "x-shader/x-vertex";
+                textEditor.mimeType = "x-shader/x-fragment";
+                textEditor.element.classList.add("fragment");
                 break;
             }
 
             this.addSubview(textEditor);
                 break;
             }
 
             this.addSubview(textEditor);
-            container.appendChild(textEditor.element);
-            container.classList.add("shader", shaderType);
-
-            return {container, textEditor};
+            return textEditor;
         };
 
         };
 
-        switch (this.representedObject.programType) {
-        case WI.ShaderProgram.ProgramType.Compute: {
-            let computeEditor = createEditor(WI.ShaderProgram.ShaderType.Compute);
-            this._computeContainer = computeEditor.container;
-            this._computeEditor = computeEditor.textEditor;
-
-            this._lastActiveEditor = this._computeEditor;
-            break;
-        }
-
-        case WI.ShaderProgram.ProgramType.Render: {
-            let vertexEditor = createEditor(WI.ShaderProgram.ShaderType.Vertex);
-            this._vertexContainer = vertexEditor.container;
-            this._vertexEditor = vertexEditor.textEditor;
-
-            let fragmentEditor = createEditor(WI.ShaderProgram.ShaderType.Fragment);
-            this._fragmentContainer = fragmentEditor.container;
-            this._fragmentEditor = fragmentEditor.textEditor;
-
-            this._lastActiveEditor = this._vertexEditor;
-            break;
-        }
-        }
-    }
-
-    // Public
-
-    get navigationItems()
-    {
-        return [this._refreshButtonNavigationItem];
+        this._vertexEditor = createEditor(WI.ShaderProgram.ShaderType.Vertex);
+        this._fragmentEditor = createEditor(WI.ShaderProgram.ShaderType.Fragment);
+        this._lastActiveEditor = this._vertexEditor;
     }
 
     // Protected
     }
 
     // Protected
@@ -121,32 +79,22 @@ WI.ShaderProgramContentView = class ShaderProgramContentView extends WI.ContentV
     {
         super.shown();
 
     {
         super.shown();
 
-        switch (this.representedObject.programType) {
-        case WI.ShaderProgram.ProgramType.Compute:
-            this._computeEditor.shown();
-            break;
+        this._vertexEditor.shown();
+        this._fragmentEditor.shown();
 
 
-        case WI.ShaderProgram.ProgramType.Render:
-            this._vertexEditor.shown();
-            this._fragmentEditor.shown();
-            break;
-        }
+        this.representedObject.requestVertexShaderSource((content) => {
+            this._vertexEditor.string = content || "";
+        });
 
 
-        this._refreshContent();
+        this.representedObject.requestFragmentShaderSource((content) => {
+            this._fragmentEditor.string = content || "";
+        });
     }
 
     hidden()
     {
     }
 
     hidden()
     {
-        switch (this.representedObject.programType) {
-        case WI.ShaderProgram.ProgramType.Compute:
-            this._computeEditor.hidden();
-            break;
-
-        case WI.ShaderProgram.ProgramType.Render:
-            this._vertexEditor.hidden();
-            this._fragmentEditor.hidden();
-            break;
-        }
+        this._vertexEditor.hidden();
+        this._fragmentEditor.hidden();
 
         super.hidden();
     }
 
         super.hidden();
     }
@@ -158,34 +106,14 @@ WI.ShaderProgramContentView = class ShaderProgramContentView extends WI.ContentV
 
     get saveData()
     {
 
     get saveData()
     {
-        let filename = "";
-        switch (this._lastActiveEditor) {
-        case this._computeEditor:
-            filename = WI.UIString("Compute");
-            break;
-        case this._fragmentEditor:
-            filename = WI.UIString("Fragment");
-            break;
-        case this._vertexEditor:
+        let filename = WI.UIString("Shader");
+        if (this._lastActiveEditor === this._vertexEditor)
             filename = WI.UIString("Vertex");
             filename = WI.UIString("Vertex");
-            break;
-        }
-        console.assert(filename);
-
-        let extension = "";
-        switch (this.representedObject.canvas.contextType) {
-        case WI.Canvas.ContextType.WebGL:
-        case WI.Canvas.ContextType.WebGL2:
-            extension = WI.unlocalizedString(".glsl");
-            break;
-        case WI.Canvas.ContextType.WebGPU:
-            extension = WI.unlocalizedString(".wsl");
-            break;
-        }
-        console.assert(extension);
+        else if (this._lastActiveEditor === this._fragmentEditor)
+            filename = WI.UIString("Fragment");
 
         return {
 
         return {
-            url: WI.FileUtilities.inspectorURLForFilename(filename + extension),
+            url: WI.FileUtilities.inspectorURLForFilename(filename + ".glsl"),
             content: this._lastActiveEditor.string,
             forceSaveAs: true,
         };
             content: this._lastActiveEditor.string,
             forceSaveAs: true,
         };
@@ -243,65 +171,6 @@ WI.ShaderProgramContentView = class ShaderProgramContentView extends WI.ContentV
 
     // Private
 
 
     // Private
 
-    _refreshContent()
-    {
-        let createCallback = (container, textEditor) => {
-            return (source, entryPoint) => {
-                if (source === null) {
-                    container.remove();
-                    return;
-                }
-
-                if (!container.parentNode) {
-                    switch (container) {
-                    case this._computeContainer:
-                    case this._vertexContainer:
-                        this.element.insertAdjacentElement("afterbegin", container);
-                        break;
-
-                    case this._fragmentContainer:
-                        this.element.insertAdjacentElement("beforeend", container);
-                        break;
-                    }
-                }
-
-                textEditor.string = source || "";
-            };
-        };
-
-        switch (this.representedObject.programType) {
-        case WI.ShaderProgram.ProgramType.Compute:
-            this.representedObject.requestShaderSource(WI.ShaderProgram.ShaderType.Compute, createCallback(this._computeContainer, this._computeEditor));
-            return;
-
-        case WI.ShaderProgram.ProgramType.Render:
-            this.representedObject.requestShaderSource(WI.ShaderProgram.ShaderType.Vertex, createCallback(this._vertexContainer, this._vertexEditor));
-            this.representedObject.requestShaderSource(WI.ShaderProgram.ShaderType.Fragment, createCallback(this._fragmentContainer, this._fragmentEditor));
-            return;
-        }
-
-        console.assert();
-    }
-
-    _updateShader(shaderType)
-    {
-        switch (shaderType) {
-        case WI.ShaderProgram.ShaderType.Compute:
-            this.representedObject.updateShader(shaderType, this._computeEditor.string);
-            return;
-
-        case WI.ShaderProgram.ShaderType.Fragment:
-            this.representedObject.updateShader(shaderType, this._fragmentEditor.string);
-            return;
-
-        case WI.ShaderProgram.ShaderType.Vertex:
-            this.representedObject.updateShader(shaderType, this._vertexEditor.string);
-            return;
-        }
-
-        console.assert();
-    }
-
     _editorFocused(event)
     {
         if (this._lastActiveEditor === event.target)
     _editorFocused(event)
     {
         if (this._lastActiveEditor === event.target)
@@ -328,20 +197,9 @@ WI.ShaderProgramContentView = class ShaderProgramContentView extends WI.ContentV
 
     _contentDidChange(event)
     {
 
     _contentDidChange(event)
     {
-        switch (event.target) {
-        case this._computeEditor:
-            this._updateShader(WI.ShaderProgram.ShaderType.Compute);
-            return;
-
-        case this._fragmentEditor:
-            this._updateShader(WI.ShaderProgram.ShaderType.Fragment);
-            return;
-
-        case this._vertexEditor:
-            this._updateShader(WI.ShaderProgram.ShaderType.Vertex);
-            return;
-        }
-
-        console.assert();
+        if (event.target === this._vertexEditor)
+            this.representedObject.updateVertexShader(this._vertexEditor.string);
+        else if (event.target === this._fragmentEditor)
+            this.representedObject.updateFragmentShader(this._fragmentEditor.string);
     }
 };
     }
 };
index c2d3f75..cda75b4 100644 (file)
@@ -32,14 +32,10 @@ WI.ShaderProgramTreeElement = class ShaderProgramTreeElement extends WI.GeneralT
         const subtitle = null;
         super("shader-program", shaderProgram.displayName, subtitle, shaderProgram);
 
         const subtitle = null;
         super("shader-program", shaderProgram.displayName, subtitle, shaderProgram);
 
-        // FIXME: add support for disabling/highlighting WebGPU shader pipelines.
-        let contextType = this.representedObject.canvas.contextType;
-        if (contextType === WI.Canvas.ContextType.WebGL || contextType === WI.Canvas.ContextType.WebGL2) {
-            this._disabledImageElement = document.createElement("img");
-            this._disabledImageElement.title = WI.UIString("Disable Program");
-            this._disabledImageElement.addEventListener("click", this._disabledImageElementClicked.bind(this));
-            this.status = this._disabledImageElement;
-        }
+        this._disabledImageElement = document.createElement("img");
+        this._disabledImageElement.title = WI.UIString("Disable Program");
+        this._disabledImageElement.addEventListener("click", this._disabledImageElementClicked.bind(this));
+        this.status = this._disabledImageElement;
     }
 
     // Protected
     }
 
     // Protected
@@ -48,45 +44,34 @@ WI.ShaderProgramTreeElement = class ShaderProgramTreeElement extends WI.GeneralT
     {
         super.onattach();
 
     {
         super.onattach();
 
-        // FIXME: add support for disabling/highlighting WebGPU shader pipelines.
-        let contextType = this.representedObject.canvas.contextType;
-        if (contextType === WI.Canvas.ContextType.WebGL || contextType === WI.Canvas.ContextType.WebGL2) {
-            this.representedObject.addEventListener(WI.ShaderProgram.Event.DisabledChanged, this._handleShaderProgramDisabledChanged, this);
+        this.representedObject.addEventListener(WI.ShaderProgram.Event.DisabledChanged, this._handleShaderProgramDisabledChanged, this);
 
 
-            this.element.addEventListener("mouseover", this._handleMouseOver.bind(this));
-            this.element.addEventListener("mouseout", this._handleMouseOut.bind(this));
-        }
+        this.element.addEventListener("mouseover", this._handleMouseOver.bind(this));
+        this.element.addEventListener("mouseout", this._handleMouseOut.bind(this));
     }
 
     ondetach()
     {
     }
 
     ondetach()
     {
-        // FIXME: add support for disabling/highlighting WebGPU shader pipelines.
-        let contextType = this.representedObject.canvas.contextType;
-        if (contextType === WI.Canvas.ContextType.WebGL || contextType === WI.Canvas.ContextType.WebGL2)
-            this.representedObject.removeEventListener(WI.ShaderProgram.Event.DisabledChanged, this._handleShaderProgramDisabledChanged, this);
+        this.representedObject.removeEventListener(WI.ShaderProgram.Event.DisabledChanged, this._handleShaderProgramDisabledChanged, this);
 
         super.ondetach();
     }
 
     canSelectOnMouseDown(event)
     {
 
         super.ondetach();
     }
 
     canSelectOnMouseDown(event)
     {
-        if (this._disabledImageElement && this._disabledImageElement.contains(event.target))
+        if (this._disabledImageElement.contains(event.target))
             return false;
         return super.canSelectOnMouseDown(event);
     }
 
     populateContextMenu(contextMenu, event)
     {
             return false;
         return super.canSelectOnMouseDown(event);
     }
 
     populateContextMenu(contextMenu, event)
     {
-        // FIXME: add support for disabling/highlighting WebGPU shader pipelines.
-        let contextType = this.representedObject.canvas.contextType;
-        if (contextType === WI.Canvas.ContextType.WebGL || contextType === WI.Canvas.ContextType.WebGL2) {
-            let disabled = this.representedObject.disabled;
-            contextMenu.appendItem(disabled ? WI.UIString("Enable Program") : WI.UIString("Disable Program"), () => {
-                this.representedObject.disabled = !disabled;
-            });
-
-            contextMenu.appendSeparator();
-        }
+        let disabled = this.representedObject.disabled;
+        contextMenu.appendItem(disabled ? WI.UIString("Enable Program") : WI.UIString("Disable Program"), () => {
+            this.representedObject.disabled = !disabled;
+        });
+
+        contextMenu.appendSeparator();
 
         super.populateContextMenu(contextMenu, event);
     }
 
         super.populateContextMenu(contextMenu, event);
     }