Title: [237912] trunk
Revision
237912
Author
justin_...@apple.com
Date
2018-11-06 20:37:04 -0800 (Tue, 06 Nov 2018)

Log Message

[WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
https://bugs.webkit.org/show_bug.cgi?id=191291

Reviewed by Myles Maxfield.

Source/_javascript_Core:

Properly disable WEBGPU on all non-Metal platforms for now.

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Test: webgpu/render-pipelines.html
Also update test webgpu/webgpu-basics.html to create a WebGPURenderPipeline.

Begin implementation of WebGPURenderPipeline and WebGPUSwapChain. A WebGPURenderPipeline is backed by a
GPURenderPipeline, created lazily using the properties of the passed-in WebGPURenderPipelineDescriptor.
On Metal-supported systems, GPURenderPipeline is an interface to a MTLRenderPipelineState.
The MTLRenderPipelineState is created with the WebGPUDevice currently configured on the WebGPURenderingContext.

* CMakeLists.txt:
* Configurations/FeatureDefines.xcconfig:
* DerivedSources.make:
* Modules/webgpu/GPUDevice.cpp:
(WebCore::GPUDevice::createRenderPipeline const):
* Modules/webgpu/GPUDevice.h:
* Modules/webgpu/GPUPipelineDescriptorBase.h:
* Modules/webgpu/GPUPipelineStageDescriptor.h:
* Modules/webgpu/GPURenderPipelineDescriptor.h:
(WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
(WebCore::GPURenderPipelineDescriptor::primitiveTopology):
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::createRenderPipeline const):
* Modules/webgpu/WebGPUDevice.h:
(WebCore::WebGPUDevice::adapter const):
(WebCore::WebGPUDevice::device const):
* Modules/webgpu/WebGPUDevice.idl:
* Modules/webgpu/WebGPUPipelineDescriptorBase.h:
* Modules/webgpu/WebGPUPipelineDescriptorBase.idl:
* Modules/webgpu/WebGPUPipelineStageDescriptor.h:
* Modules/webgpu/WebGPUPipelineStageDescriptor.idl:
* Modules/webgpu/WebGPURenderPipeline.cpp:
(WebCore::WebGPURenderPipeline::create):
(WebCore::WebGPURenderPipeline::WebGPURenderPipeline):
* Modules/webgpu/WebGPURenderPipeline.h:
* Modules/webgpu/WebGPURenderPipeline.idl:
* Modules/webgpu/WebGPURenderPipelineDescriptor.h:
* Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
* Modules/webgpu/WebGPURenderingContext.cpp:
(WebCore::WebGPURenderingContext::create):
(WebCore::WebGPURenderingContext::WebGPURenderingContext):
* Modules/webgpu/WebGPURenderingContext.h:
* Modules/webgpu/WebGPUShaderModule.h:
(WebCore::WebGPUShaderModule::module const):
* Modules/webgpu/WebGPUShaderStage.h:
* Modules/webgpu/WebGPUShaderStage.idl:
* Modules/webgpu/WebGPUSwapChain.cpp:
(WebCore::WebGPUSwapChain::configure):
(WebCore::WebGPUSwapChain::reshape):
(WebCore::WebGPUSwapChain::markLayerComposited):
* Modules/webgpu/WebGPUSwapChain.h:
(WebCore::WebGPUSwapChain::WebGPUSwapChain):
* Modules/webgpu/WebGPUSwapChain.idl:
* Modules/webgpu/cocoa/GPURenderPipeline.h:
(WebCore::GPURenderPipeline::platformRenderPipeline const):
* Modules/webgpu/cocoa/GPURenderPipelineMetal.mm: Added.
(WebCore::setFunctionsForPipelineDescriptor):
(WebCore::GPURenderPipeline::create):
(WebCore::GPURenderPipeline::GPURenderPipeline):
* Modules/webgpu/cocoa/GPUSwapChain.h:
(WebCore::GPUSwapChain::platformLayer const):
* Modules/webgpu/cocoa/GPUSwapChainMetal.mm:
(WebCore::GPUSwapChain::create):
(WebCore::GPUSwapChain::GPUSwapChain):
(WebCore::GPUSwapChain::setDevice):
(WebCore::GPUSwapChain::reshape):
(WebCore::GPUSwapChain::present):
* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:

Source/WebCore/PAL:

Properly disable WEBGPU on all non-Metal platforms for now.

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

Properly disable WEBGPU on all non-Metal platforms for now.

* Configurations/FeatureDefines.xcconfig:

Source/WebKitLegacy/mac:

Properly disable WEBGPU on all non-Metal platforms for now.

* Configurations/FeatureDefines.xcconfig:

Source/WTF:

Properly disable WEBGPU on all non-Metal platforms for now.

* wtf/Platform.h:

Tools:

Properly disable WEBGPU on all non-Metal platforms for now.

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

LayoutTests:

* webgpu/js/set-up-webgpu-contexts.js: Added helper script for running different webgpu tests.
(runWebGPUTests):
(async.runWebGPUTestsOnCanvas):
(async.setUpContexts):
* webgpu/render-pipelines-expected.txt: Added.
* webgpu/render-pipelines.html: Added.
* webgpu/shader-modules-expected.txt:
* webgpu/shader-modules.html: Updated to use functions in set-up-webgpu-contexts.js.
* webgpu/webgpu-basics-expected.txt:
* webgpu/webgpu-basics.html: Updated through creating a WebGPURenderPipeline.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237911 => 237912)


--- trunk/LayoutTests/ChangeLog	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/LayoutTests/ChangeLog	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,3 +1,21 @@
+2018-11-06  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
+        https://bugs.webkit.org/show_bug.cgi?id=191291
+
+        Reviewed by Myles Maxfield.
+
+        * webgpu/js/set-up-webgpu-contexts.js: Added helper script for running different webgpu tests.
+        (runWebGPUTests):
+        (async.runWebGPUTestsOnCanvas):
+        (async.setUpContexts):
+        * webgpu/render-pipelines-expected.txt: Added.
+        * webgpu/render-pipelines.html: Added.
+        * webgpu/shader-modules-expected.txt:
+        * webgpu/shader-modules.html: Updated to use functions in set-up-webgpu-contexts.js.
+        * webgpu/webgpu-basics-expected.txt:
+        * webgpu/webgpu-basics.html: Updated through creating a WebGPURenderPipeline.
+
 2018-11-06  Youenn Fablet  <you...@apple.com>
 
         Calling sender.replaceTrack() twice produces a new transceiver and its corresponding m= section

Added: trunk/LayoutTests/webgpu/js/set-up-webgpu-contexts.js (0 => 237912)


--- trunk/LayoutTests/webgpu/js/set-up-webgpu-contexts.js	                        (rev 0)
+++ trunk/LayoutTests/webgpu/js/set-up-webgpu-contexts.js	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,46 @@
+'use strict';
+
+let context, adapter, defaultDevice;
+
+function runWebGPUTests(tests) {
+    runWebGPUTestsOnCanvas(document.createElement("canvas"), tests);
+}
+
+async function runWebGPUTestsOnCanvas(canvas, tests) {
+    try {
+        await setUpContexts(canvas);
+
+        for (let test of tests)
+            test();
+
+        debug("All tests complete.");
+    } catch (error) {
+        console.error(error);
+        testFailed(`[${error}]: See console!`);
+    }
+}
+
+async function setUpContexts(canvas) {
+    context = canvas.getContext("webgpu");
+    if (!context)
+        testFailed("Could not create WebGPU context!");
+
+    shouldBeDefined(window.webgpu);
+    
+    // FIXME: requestAdapter should take a WebGPUAdapterDescriptor.
+    adapter = await window.webgpu.requestAdapter({});
+    if (!adapter) {
+        testFailed("Could not create default WebGPUAdapter!")
+        return;
+    }
+
+    // FIXME: requestDevice should take a WebGPUDeviceDescriptor.
+    defaultDevice = adapter.createDevice();
+    if (!defaultDevice) {
+        testFailed("Could not create WebGPUDevice!");
+        return;
+    }
+
+    // FIXME: Default to "B8G8R8A8Unorm" format for now.
+    context.configure({ device: defaultDevice, width: canvas.width, height: canvas.height });
+}
\ No newline at end of file

Added: trunk/LayoutTests/webgpu/render-pipelines-expected.txt (0 => 237912)


--- trunk/LayoutTests/webgpu/render-pipelines-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/render-pipelines-expected.txt	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,12 @@
+PASS [object WebGPU] is defined.
+PASS Successfully created WebGPURenderPipeline.
+PASS WebGPURenderPipeline with invalid WebGPURenderPipelineDescriptor was not created.
+PASS WebGPURenderPipeline with invalid shader module was not created.
+PASS WebGPURenderPipeline with invalid vertex shader stage was not created.
+PASS WebGPURenderPipeline with invalid vertex shader entry point was not created.
+PASS WebGPURenderPipeline with invalid WebGPUShaderStageEnum was not created.
+All tests complete.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/webgpu/render-pipelines.html (0 => 237912)


--- trunk/LayoutTests/webgpu/render-pipelines.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/render-pipelines.html	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,139 @@
+<!DOCTYPE html>
+<html>
+<script src=""
+<script src=""
+<script id="library" type="x-shader/x-metal">
+    #include <metal_stdlib>
+    
+    using namespace metal;
+    
+    struct Vertex
+    {
+        float4 position [[position]];
+    };
+    
+    vertex Vertex vertex_main(uint vid [[vertex_id]])
+    {
+        Vertex v;
+        switch (vid) {
+        case 0:
+            v.position = float4(-.75, -.75, 0, 1);
+            break;
+        case 1:
+            v.position = float4(.75, -.75, 0, 1);
+            break;
+        case 2:
+            v.position = float4(0, .75, 0, 1);
+            break;
+        default:
+            v.position = float4(0, 0, 0, 1);
+        }
+        return v;
+    }
+    
+    fragment float4 fragment_main(Vertex vertexIn [[stage_in]])
+    {
+        return float4(1.0, 0.0, 0.0, 1.0);
+    }
+</script>
+<script>
+'use strict';
+
+if (window.testRunner)
+    window.testRunner.dumpAsText();
+
+let shaderDescriptor, shaderModule, vertexStageDescriptor, fragmentStageDescriptor;
+
+function setUpPipeline() {
+    shaderDescriptor = {
+        code: document.getElementById("library").text
+    };
+
+    shaderModule = defaultDevice.createShaderModule(shaderDescriptor);
+    if (!shaderModule) {
+        testFailed("Could not create WebGPUShaderModule!");
+        return;
+    }
+
+    vertexStageDescriptor = { 
+        module: shaderModule, 
+        stage: WebGPUShaderStage.VERTEX, 
+        entryPoint: "vertex_main" 
+    };
+
+    fragmentStageDescriptor = {
+        module: shaderModule,
+        stage: WebGPUShaderStage.FRAGMENT,
+        entryPoint: "fragment_main"
+    };
+
+    let pipelineDescriptor = {
+        stages: [vertexStageDescriptor, fragmentStageDescriptor],
+        primitiveTopology: "triangleList"
+    };
+
+    let renderPipeline = defaultDevice.createRenderPipeline(pipelineDescriptor);
+    if (renderPipeline)
+        testPassed("Successfully created WebGPURenderPipeline.")
+    else
+        testFailed("Could not create WebGPURenderPipeline!");
+}
+
+function checkBadRenderPipeline(descriptor, testSubjectName) {
+    let pipeline = defaultDevice.createRenderPipeline(descriptor);
+
+    if (pipeline)
+        testFailed(`WebGPURenderPipeline was created with an invalid ${testSubjectName}!`);
+    else
+        testPassed(`WebGPURenderPipeline with invalid ${testSubjectName} was not created.`);
+}
+
+function setUpBadPipelines() {
+    checkBadRenderPipeline({}, "WebGPURenderPipelineDescriptor");
+
+    let noModuleVertexDescriptor = {
+        stage: WebGPUShaderStage.VERTEX,
+        entryPoint: "vertex_main"
+    }
+    let noModulePipelineDescriptor = {
+        stages: [noModuleVertexDescriptor, fragmentStageDescriptor],
+        primitiveTopology: "triangleList"
+    }
+    checkBadRenderPipeline(noModulePipelineDescriptor, "shader module");
+
+    // A (Metal) renderpipeline must have a vertex function.
+    let noVertexPipelineDescriptor = {
+        stages: [fragmentStageDescriptor],
+        primitiveTopology: "triangleList"
+    }
+    checkBadRenderPipeline(noVertexPipelineDescriptor, "vertex shader stage")
+
+    let badEntryPointDescriptor = { 
+        module: shaderModule, 
+        stage: WebGPUShaderStage.VERTEX, 
+        entryPoint: "Vertex_Main" 
+    };
+    let badEntryPointPipelineDescsriptor = {
+        stages: [badEntryPointDescriptor, fragmentStageDescriptor],
+        primitiveTopology: "triangleList"
+    }
+    checkBadRenderPipeline(badEntryPointPipelineDescsriptor, "vertex shader entry point");
+
+    let badStageEnumDescriptor = { 
+        module: shaderModule, 
+        stage: WebGPUShaderStage.COMPUTE, 
+        entryPoint: "vertex_main" 
+    };
+    let badStageEnumPipelineDescriptor = {
+        stages: [badStageEnumDescriptor, fragmentStageDescriptor],
+        primitiveTopology: "triangleList"
+    }
+    checkBadRenderPipeline(badStageEnumPipelineDescriptor, "WebGPUShaderStageEnum");
+}
+
+runWebGPUTests([setUpPipeline, setUpBadPipelines]);
+
+successfullyParsed = true;
+</script>
+<script src=""
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/webgpu/shader-modules-expected.txt (237911 => 237912)


--- trunk/LayoutTests/webgpu/shader-modules-expected.txt	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/LayoutTests/webgpu/shader-modules-expected.txt	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,6 +1,8 @@
+PASS [object WebGPU] is defined.
 PASS Bad shader code should not create a module.
 PASS Incomplete shader code should not create a module.
 PASS Shader module created successfully.
+All tests complete.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/webgpu/shader-modules.html (237911 => 237912)


--- trunk/LayoutTests/webgpu/shader-modules.html	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/LayoutTests/webgpu/shader-modules.html	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
 <script src=""
+<script src=""
 <script id="library_full" type="x-shader/x-metal">
     #include <metal_stdlib>
     
@@ -70,20 +71,6 @@
 if (window.testRunner)
     window.testRunner.dumpAsText();
 
-let canvas;
-let context;
-let adapter;
-let defaultDevice;
-
-async function setUpContexts() {
-    canvas = document.createElement("canvas");
-    context = canvas.getContext("webgpu");
-    adapter = await window.webgpu.requestAdapter({});
-    defaultDevice = adapter.createDevice();
-
-    setUpShaders();
-}
-
 function setUpShaders() {
     let shaderDescriptor0 = {
         code : "Hello World"
@@ -115,9 +102,9 @@
         testFailed("Shader module not created successfully!");
 }
 
-setUpContexts();
+runWebGPUTests([setUpShaders]);
 
-var successfullyParsed = true;
+successfullyParsed = true;
 </script>
 <script src=""
 </html>
\ No newline at end of file

Modified: trunk/LayoutTests/webgpu/webgpu-basics-expected.txt (237911 => 237912)


--- trunk/LayoutTests/webgpu/webgpu-basics-expected.txt	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/LayoutTests/webgpu/webgpu-basics-expected.txt	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,4 +1,5 @@
 PASS [object WebGPU] is defined.
+All tests complete.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/webgpu/webgpu-basics.html (237911 => 237912)


--- trunk/LayoutTests/webgpu/webgpu-basics.html	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/LayoutTests/webgpu/webgpu-basics.html	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
 <script src=""
+<script src=""
 <script id="library" type="x-shader/x-metal">
     #include <metal_stdlib>
     
@@ -41,46 +42,55 @@
 if (window.testRunner)
     window.testRunner.dumpAsText();
 
-let canvas;
-let context;
-let adapter;
-let defaultDevice;
+let renderPipeline;
 
-async function setUpContexts() {
-    canvas = document.createElement("canvas");
-    context = canvas.getContext("webgpu");
-    if (!context)
-        testFailed("Could not create WebGPU context!");
+function setUpPipeline() {
+    let shaderDescriptor = {
+        code: document.getElementById("library").text
+    };
+    let shaderModule = defaultDevice.createShaderModule(shaderDescriptor);
+    if (!shaderModule) {
+        testFailed("Could not create WebGPUShaderModule!");
+        return;
+    }
 
-    shouldBeDefined(window.webgpu);
-    
-    adapter = await window.webgpu.requestAdapter({});
-    if (!adapter) {
-        testFailed("Could not create default WebGPUAdapter!")
+    let vertexStageDescriptor = { 
+        module: shaderModule, 
+        stage: WebGPUShaderStage.VERTEX, 
+        entryPoint: "vertex_main" 
+    };
+
+    let fragmentStageDescriptor = {
+        module: shaderModule,
+        stage: WebGPUShaderStage.FRAGMENT,
+        entryPoint: "fragment_main"
+    };
+
+    if (!vertexStageDescriptor || !fragmentStageDescriptor) {
+        testFailed("Could not create WebGPUPipelineStageDescriptor!");
         return;
     }
 
-    defaultDevice = adapter.createDevice();
-    if (!defaultDevice) {
-        testFailed("Could not create WebGPUDevice!");
+    let pipelineDescriptor = {
+        stages: [vertexStageDescriptor, fragmentStageDescriptor],
+        primitiveTopology: "triangleList"
+    };
+
+    if (!pipelineDescriptor) {
+        testFailed("Could not create WebGPURenderPipelineDescriptor!");
         return;
     }
 
-    setUpShaders();
+    renderPipeline = defaultDevice.createRenderPipeline(pipelineDescriptor);
+    if (!renderPipeline) {
+        testFailed("Could not create WebGPURenderPipeline!");
+        return;
+    }
 }
 
-function setUpShaders() {
-    let shaderDescriptor = {
-        code: document.getElementById("library").text
-    };
-    let shaderModule = defaultDevice.createShaderModule(shaderDescriptor);
-    if (!shaderModule)
-        testFailed("Could not create WebGPUShaderModule!");
-}
+runWebGPUTests([setUpPipeline]);
 
-setUpContexts();
-
-var successfullyParsed = true;
+successfullyParsed = true;
 </script>
 <script src=""
 </html>
\ No newline at end of file

Modified: trunk/Source/_javascript_Core/ChangeLog (237911 => 237912)


--- trunk/Source/_javascript_Core/ChangeLog	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,3 +1,14 @@
+2018-11-06  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
+        https://bugs.webkit.org/show_bug.cgi?id=191291
+
+        Reviewed by Myles Maxfield.
+
+        Properly disable WEBGPU on all non-Metal platforms for now.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2018-11-06  Keith Rollin  <krol...@apple.com>
 
         Adjust handling of Include paths that need quoting

Modified: trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig (237911 => 237912)


--- trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig	2018-11-07 04:37:04 UTC (rev 237912)
@@ -366,7 +366,11 @@
 
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 
-ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU = $(ENABLE_WEBGPU_$(WK_PLATFORM_NAME));
+ENABLE_WEBGPU_iphoneos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_watchos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_macosx = ENABLE_WEBGPU;
 
 ENABLE_WEBMETAL = $(ENABLE_WEBMETAL_$(WK_PLATFORM_NAME));
 ENABLE_WEBMETAL_iphoneos = ENABLE_WEBMETAL;

Modified: trunk/Source/WTF/ChangeLog (237911 => 237912)


--- trunk/Source/WTF/ChangeLog	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WTF/ChangeLog	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,3 +1,14 @@
+2018-11-06  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
+        https://bugs.webkit.org/show_bug.cgi?id=191291
+
+        Reviewed by Myles Maxfield.
+
+        Properly disable WEBGPU on all non-Metal platforms for now.
+
+        * wtf/Platform.h:
+
 2018-11-05  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         Cache glyph paths and share underline skipping code between all the ports

Modified: trunk/Source/WTF/wtf/Platform.h (237911 => 237912)


--- trunk/Source/WTF/wtf/Platform.h	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WTF/wtf/Platform.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1376,7 +1376,3 @@
 #if PLATFORM(COCOA) && USE(CA) && !PLATFORM(IOS_FAMILY_SIMULATOR)
 #define USE_IOSURFACE_CANVAS_BACKING_STORE 1
 #endif
-
-#if PLATFORM(COCOA) && !PLATFORM(IOS_FAMILY_SIMULATOR)
-#define ENABLE_WEBGPU 1
-#endif

Modified: trunk/Source/WebCore/CMakeLists.txt (237911 => 237912)


--- trunk/Source/WebCore/CMakeLists.txt	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/CMakeLists.txt	2018-11-07 04:37:04 UTC (rev 237912)
@@ -455,9 +455,14 @@
     Modules/webgpu/WebGPUAdapter.idl
     Modules/webgpu/WebGPUAdapterDescriptor.idl
     Modules/webgpu/WebGPUDevice.idl
+    Modules/webgpu/WebGPUPipelineDescriptorBase.idl
+    Modules/webgpu/WebGPUPipelineStageDescriptor.idl
+    Modules/webgpu/WebGPURenderPipeline.idl
+    Modules/webgpu/WebGPURenderPipelineDescriptor.idl
     Modules/webgpu/WebGPURenderingContext.idl
     Modules/webgpu/WebGPUShaderModule.idl
     Modules/webgpu/WebGPUShaderModuleDescriptor.idl
+    Modules/webgpu/WebGPUShaderStage.idl
     Modules/webgpu/WebGPUSwapChain.idl
 
     Modules/websockets/CloseEvent.idl

Modified: trunk/Source/WebCore/ChangeLog (237911 => 237912)


--- trunk/Source/WebCore/ChangeLog	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/ChangeLog	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,3 +1,80 @@
+2018-11-06  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
+        https://bugs.webkit.org/show_bug.cgi?id=191291
+
+        Reviewed by Myles Maxfield.
+
+        Test: webgpu/render-pipelines.html
+        Also update test webgpu/webgpu-basics.html to create a WebGPURenderPipeline.
+
+        Begin implementation of WebGPURenderPipeline and WebGPUSwapChain. A WebGPURenderPipeline is backed by a
+        GPURenderPipeline, created lazily using the properties of the passed-in WebGPURenderPipelineDescriptor.
+        On Metal-supported systems, GPURenderPipeline is an interface to a MTLRenderPipelineState.
+        The MTLRenderPipelineState is created with the WebGPUDevice currently configured on the WebGPURenderingContext.
+
+        * CMakeLists.txt:
+        * Configurations/FeatureDefines.xcconfig:
+        * DerivedSources.make:
+        * Modules/webgpu/GPUDevice.cpp:
+        (WebCore::GPUDevice::createRenderPipeline const):
+        * Modules/webgpu/GPUDevice.h:
+        * Modules/webgpu/GPUPipelineDescriptorBase.h:
+        * Modules/webgpu/GPUPipelineStageDescriptor.h:
+        * Modules/webgpu/GPURenderPipelineDescriptor.h:
+        (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
+        (WebCore::GPURenderPipelineDescriptor::primitiveTopology):
+        * Modules/webgpu/WebGPUDevice.cpp:
+        (WebCore::WebGPUDevice::createRenderPipeline const):
+        * Modules/webgpu/WebGPUDevice.h:
+        (WebCore::WebGPUDevice::adapter const):
+        (WebCore::WebGPUDevice::device const):
+        * Modules/webgpu/WebGPUDevice.idl:
+        * Modules/webgpu/WebGPUPipelineDescriptorBase.h:
+        * Modules/webgpu/WebGPUPipelineDescriptorBase.idl:
+        * Modules/webgpu/WebGPUPipelineStageDescriptor.h:
+        * Modules/webgpu/WebGPUPipelineStageDescriptor.idl:
+        * Modules/webgpu/WebGPURenderPipeline.cpp:
+        (WebCore::WebGPURenderPipeline::create):
+        (WebCore::WebGPURenderPipeline::WebGPURenderPipeline):
+        * Modules/webgpu/WebGPURenderPipeline.h:
+        * Modules/webgpu/WebGPURenderPipeline.idl:
+        * Modules/webgpu/WebGPURenderPipelineDescriptor.h:
+        * Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
+        * Modules/webgpu/WebGPURenderingContext.cpp:
+        (WebCore::WebGPURenderingContext::create):
+        (WebCore::WebGPURenderingContext::WebGPURenderingContext):
+        * Modules/webgpu/WebGPURenderingContext.h:
+        * Modules/webgpu/WebGPUShaderModule.h:
+        (WebCore::WebGPUShaderModule::module const):
+        * Modules/webgpu/WebGPUShaderStage.h:
+        * Modules/webgpu/WebGPUShaderStage.idl:
+        * Modules/webgpu/WebGPUSwapChain.cpp:
+        (WebCore::WebGPUSwapChain::configure):
+        (WebCore::WebGPUSwapChain::reshape):
+        (WebCore::WebGPUSwapChain::markLayerComposited):
+        * Modules/webgpu/WebGPUSwapChain.h:
+        (WebCore::WebGPUSwapChain::WebGPUSwapChain):
+        * Modules/webgpu/WebGPUSwapChain.idl:
+        * Modules/webgpu/cocoa/GPURenderPipeline.h:
+        (WebCore::GPURenderPipeline::platformRenderPipeline const):
+        * Modules/webgpu/cocoa/GPURenderPipelineMetal.mm: Added.
+        (WebCore::setFunctionsForPipelineDescriptor):
+        (WebCore::GPURenderPipeline::create):
+        (WebCore::GPURenderPipeline::GPURenderPipeline):
+        * Modules/webgpu/cocoa/GPUSwapChain.h:
+        (WebCore::GPUSwapChain::platformLayer const):
+        * Modules/webgpu/cocoa/GPUSwapChainMetal.mm:
+        (WebCore::GPUSwapChain::create):
+        (WebCore::GPUSwapChain::GPUSwapChain):
+        (WebCore::GPUSwapChain::setDevice):
+        (WebCore::GPUSwapChain::reshape):
+        (WebCore::GPUSwapChain::present):
+        * Sources.txt:
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+
 2018-11-06  Youenn Fablet  <you...@apple.com>
 
         Add support for sender/receiver getCapabilities

Modified: trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig (237911 => 237912)


--- trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig	2018-11-07 04:37:04 UTC (rev 237912)
@@ -366,7 +366,11 @@
 
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 
-ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU = $(ENABLE_WEBGPU_$(WK_PLATFORM_NAME));
+ENABLE_WEBGPU_iphoneos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_watchos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_macosx = ENABLE_WEBGPU;
 
 ENABLE_WEBMETAL = $(ENABLE_WEBMETAL_$(WK_PLATFORM_NAME));
 ENABLE_WEBMETAL_iphoneos = ENABLE_WEBMETAL;

Modified: trunk/Source/WebCore/DerivedSources.make (237911 => 237912)


--- trunk/Source/WebCore/DerivedSources.make	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/DerivedSources.make	2018-11-07 04:37:04 UTC (rev 237912)
@@ -374,9 +374,14 @@
     $(WebCore)/Modules/webgpu/WebGPUAdapter.idl \
     $(WebCore)/Modules/webgpu/WebGPUAdapterDescriptor.idl \
     $(WebCore)/Modules/webgpu/WebGPUDevice.idl \
+    $(WebCore)/Modules/webgpu/WebGPUPipelineDescriptorBase.idl \
+    $(WebCore)/Modules/webgpu/WebGPUPipelineStageDescriptor.idl \
     $(WebCore)/Modules/webgpu/WebGPURenderingContext.idl \
+    $(WebCore)/Modules/webgpu/WebGPURenderPipeline.idl \
+    $(WebCore)/Modules/webgpu/WebGPURenderPipelineDescriptor.idl \
     $(WebCore)/Modules/webgpu/WebGPUShaderModule.idl \
     $(WebCore)/Modules/webgpu/WebGPUShaderModuleDescriptor.idl \
+    $(WebCore)/Modules/webgpu/WebGPUShaderStage.idl \
     $(WebCore)/Modules/webgpu/WebGPUSwapChain.idl \
     $(WebCore)/Modules/websockets/CloseEvent.idl \
     $(WebCore)/Modules/websockets/WebSocket.idl \

Modified: trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp	2018-11-07 04:37:04 UTC (rev 237912)
@@ -28,6 +28,8 @@
 
 #if ENABLE(WEBGPU)
 
+#include "GPURenderPipeline.h"
+#include "GPURenderPipelineDescriptor.h"
 #include "GPUShaderModule.h"
 #include "GPUShaderModuleDescriptor.h"
 
@@ -38,6 +40,11 @@
     return GPUShaderModule::create(*this, WTFMove(descriptor));
 }
 
+RefPtr<GPURenderPipeline> GPUDevice::createRenderPipeline(GPURenderPipelineDescriptor&& descriptor) const
+{
+    return GPURenderPipeline::create(*this, WTFMove(descriptor));
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)

Modified: trunk/Source/WebCore/Modules/webgpu/GPUDevice.h (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/GPUDevice.h	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/GPUDevice.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -46,8 +46,10 @@
 #endif
 
 class GPUShaderModule;
+class GPURenderPipeline;
 
 struct GPUShaderModuleDescriptor;
+struct GPURenderPipelineDescriptor;
 
 class GPUDevice : public RefCounted<GPUDevice> {
 public:
@@ -54,6 +56,7 @@
     static RefPtr<GPUDevice> create();
 
     RefPtr<GPUShaderModule> createShaderModule(GPUShaderModuleDescriptor&&) const;
+    RefPtr<GPURenderPipeline> createRenderPipeline(GPURenderPipelineDescriptor&&) const;
 
     PlatformDevice *platformDevice() const { return m_platformDevice.get(); }
 

Copied: trunk/Source/WebCore/Modules/webgpu/GPUPipelineDescriptorBase.h (from rev 237911, trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/GPUPipelineDescriptorBase.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUPipelineDescriptorBase.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 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 "GPUPipelineStageDescriptor.h"
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+struct GPUPipelineDescriptorBase {
+    Vector<GPUPipelineStageDescriptor> stages;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/GPUPipelineStageDescriptor.h (from rev 237911, trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/GPUPipelineStageDescriptor.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUPipelineStageDescriptor.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2018 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 "GPUShaderModule.h"
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+struct GPUPipelineStageDescriptor {
+    const GPUShaderModule& module;
+    unsigned long stage;
+    String entryPoint;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/GPURenderPipelineDescriptor.h (from rev 237911, trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.h) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/GPURenderPipelineDescriptor.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPURenderPipelineDescriptor.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2018 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 "GPUPipelineDescriptorBase.h"
+#include "GPUPipelineStageDescriptor.h"
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+struct GPURenderPipelineDescriptor : GPUPipelineDescriptorBase {
+    enum {
+        PointList,
+        LineList,
+        LineStrip,
+        TriangleList,
+        TriangleStrip
+    };
+
+    GPURenderPipelineDescriptor(Vector<GPUPipelineStageDescriptor>&& stages, int topology)
+        : GPUPipelineDescriptorBase { WTFMove(stages) }
+        , primitiveTopology(topology)
+    {
+    }
+
+    int primitiveTopology;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp	2018-11-07 04:37:04 UTC (rev 237912)
@@ -28,9 +28,13 @@
 
 #if ENABLE(WEBGPU)
 
-#include "WebGPUAdapter.h"
-
+#include "GPUPipelineStageDescriptor.h"
+#include "GPURenderPipelineDescriptor.h"
 #include "GPUShaderModuleDescriptor.h"
+#include "Logging.h"
+#include "WebGPUPipelineStageDescriptor.h"
+#include "WebGPURenderPipeline.h"
+#include "WebGPURenderPipelineDescriptor.h"
 #include "WebGPUShaderModule.h"
 #include "WebGPUShaderModuleDescriptor.h"
 
@@ -57,7 +61,21 @@
     return WebGPUShaderModule::create(m_device->createShaderModule(GPUShaderModuleDescriptor { descriptor.code }));
 }
 
+RefPtr<WebGPURenderPipeline> WebGPUDevice::createRenderPipeline(WebGPURenderPipelineDescriptor&& descriptor) const
+{
+    Vector<GPUPipelineStageDescriptor> stages;
+    for (const auto& stageDescriptor : descriptor.stages) {
+        if (!stageDescriptor.module) {
+            LOG(WebGPU, "WebGPUDevice::createRenderPipeline(): WebGPUShaderModule not found!");
+            return nullptr;
+        }
+        stages.append({ stageDescriptor.module->module(), stageDescriptor.stage, stageDescriptor.entryPoint });
+    }
 
+    return WebGPURenderPipeline::create(m_device->createRenderPipeline(GPURenderPipelineDescriptor { WTFMove(stages), static_cast<int>(descriptor.primitiveTopology) }));
+}
+
+
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -28,6 +28,7 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUDevice.h"
+#include "WebGPUAdapter.h"
 
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
@@ -37,8 +38,10 @@
 
 class ScriptExecutionContext;
 class WebGPUAdapter;
+class WebGPURenderPipeline;
 class WebGPUShaderModule;
 
+struct WebGPURenderPipelineDescriptor;
 struct WebGPUShaderModuleDescriptor;
 
 class WebGPUDevice : public RefCounted<WebGPUDevice> {
@@ -45,9 +48,11 @@
 public:
     static RefPtr<WebGPUDevice> create(Ref<WebGPUAdapter>&&);
 
-    WebGPUAdapter& adapter() const { return m_adapter.get(); }
+    const WebGPUAdapter& adapter() const { return m_adapter.get(); }
+    const GPUDevice& device() const { return *m_device; }
 
     RefPtr<WebGPUShaderModule> createShaderModule(WebGPUShaderModuleDescriptor&&) const;
+    RefPtr<WebGPURenderPipeline> createRenderPipeline(WebGPURenderPipelineDescriptor&&) const;
 
 private:
     WebGPUDevice(Ref<WebGPUAdapter>&&, RefPtr<GPUDevice>&&);

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl	2018-11-07 04:37:04 UTC (rev 237912)
@@ -34,6 +34,7 @@
     readonly attribute WebGPUAdapter adapter;
 
     WebGPUShaderModule createShaderModule(WebGPUShaderModuleDescriptor descriptor);
+    WebGPURenderPipeline createRenderPipeline(WebGPURenderPipelineDescriptor descriptor);
 
 /* To Be Implemented:
     WebGPUBuffer createBuffer(WebGPUBufferDescriptor descriptor);
@@ -49,8 +50,6 @@
     WebGPUInputState createInputState(WebGPUInputStateDescriptor descriptor);
     WebGPUAttachmentState createAttachmentState(WebGPUAttachmentStateDescriptor descriptor);
     WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor);
-    WebGPURenderPipeline createRenderPipeline(WebGPURenderPipelineDescriptor descriptor);
-
     WebGPUCommandBuffer createCommandBuffer(WebGPUCommandBufferDescriptor descriptor);
     WebGPUFence createFence(WebGPUFenceDescriptor descriptor);
 

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.h (from rev 237911, trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 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 "WebGPUPipelineStageDescriptor.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+struct WebGPUPipelineDescriptorBase {
+    Vector<WebGPUPipelineStageDescriptor> stages;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.idl (from rev 237911, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.idl	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] dictionary WebGPUPipelineDescriptorBase {
+    // WebGPUPipelineLayout layout;
+    sequence<WebGPUPipelineStageDescriptor> stages;
+};

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.h (from rev 237911, trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 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 "WebGPUShaderModule.h"
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+using WebGPUShaderStageEnum = unsigned long;
+
+struct WebGPUPipelineStageDescriptor {
+    const WebGPUShaderModule* module = nullptr;
+    WebGPUShaderStageEnum stage;
+    String entryPoint;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.idl (from rev 237911, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.idl	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+typedef unsigned long WebGPUShaderStageEnum;
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] dictionary WebGPUPipelineStageDescriptor {
+    WebGPUShaderModule module;
+    WebGPUShaderStageEnum stage;
+    DOMString entryPoint;
+};

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.cpp (from rev 237911, trunk/Source/WebCore/Modules/webgpu/WebGPURenderingContext.cpp) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.cpp	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2018 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 "WebGPURenderPipeline.h"
+
+#if ENABLE(WEBGPU)
+
+#include "GPURenderPipeline.h"
+
+namespace WebCore {
+
+RefPtr<WebGPURenderPipeline> WebGPURenderPipeline::create(RefPtr<GPURenderPipeline>&& pipeline)
+{
+    if (!pipeline)
+        return nullptr;
+
+    return adoptRef(new WebGPURenderPipeline(WTFMove(pipeline)));
+}
+
+WebGPURenderPipeline::WebGPURenderPipeline(RefPtr<GPURenderPipeline>&& pipeline)
+    : m_renderPipeline(pipeline)
+{
+    UNUSED_PARAM(m_renderPipeline);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.h (from rev 237911, trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.h) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2018 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 "GPURenderPipeline.h"
+
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class WebGPURenderPipeline : public RefCounted<WebGPURenderPipeline> {
+public:
+    static RefPtr<WebGPURenderPipeline> create(RefPtr<GPURenderPipeline>&&);
+
+private:
+    WebGPURenderPipeline(RefPtr<GPURenderPipeline>&&);
+
+    RefPtr<GPURenderPipeline> m_renderPipeline;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.idl (from rev 237911, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipeline.idl	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
+] interface WebGPURenderPipeline {
+};

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h (from rev 237911, trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2018 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 "WebGPUPipelineDescriptorBase.h"
+
+namespace WebCore {
+
+struct WebGPURenderPipelineDescriptor : WebGPUPipelineDescriptorBase {
+    enum class PrimitiveTopology {
+        PointList,
+        LineList,
+        LineStrip,
+        TriangleList,
+        TriangleStrip
+    };
+
+    PrimitiveTopology primitiveTopology;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl (from rev 237911, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+enum WebGPUPrimitiveTopology {
+    "pointList",
+    "lineList",
+    "lineStrip",
+    "triangleList",
+    "triangleStrip"
+};
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] dictionary WebGPURenderPipelineDescriptor : WebGPUPipelineDescriptorBase {
+    WebGPUPrimitiveTopology primitiveTopology;
+    /* To Be Implemented:
+    sequence<WebGPUBlendState> blendStates;
+    WebGPUDepthStencilState depthStencilState;
+    WebGPUInputState inputState;
+    WebGPUAttachmentsState attachmentsState; */
+    // TODO other properties
+};

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderingContext.cpp (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderingContext.cpp	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderingContext.cpp	2018-11-07 04:37:04 UTC (rev 237912)
@@ -32,13 +32,18 @@
 
 std::unique_ptr<WebGPURenderingContext> WebGPURenderingContext::create(CanvasBase& canvas)
 {
-    auto context = std::unique_ptr<WebGPURenderingContext>(new WebGPURenderingContext(canvas));
+    auto swapChain = GPUSwapChain::create();
+
+    if (!swapChain)
+        return nullptr;
+
+    auto context = std::unique_ptr<WebGPURenderingContext>(new WebGPURenderingContext(canvas, WTFMove(swapChain)));
     context->suspendIfNeeded();
     return context;
 }
 
-WebGPURenderingContext::WebGPURenderingContext(CanvasBase& canvas)
-    : WebGPUSwapChain(canvas)
+WebGPURenderingContext::WebGPURenderingContext(CanvasBase& canvas, RefPtr<GPUSwapChain>&& swapChain)
+    : WebGPUSwapChain(canvas, WTFMove(swapChain))
 {
 }
 

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderingContext.h (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderingContext.h	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderingContext.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -36,7 +36,7 @@
     static std::unique_ptr<WebGPURenderingContext> create(CanvasBase&);
 
 private:
-    WebGPURenderingContext(CanvasBase&);
+    WebGPURenderingContext(CanvasBase&, RefPtr<GPUSwapChain>&&);
     // CanvasRenderingContext
     bool isWebGPU() const final { return true; }
     // ActiveDOMObject

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.h (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.h	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -28,7 +28,7 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUShaderModule.h"
-#include <_javascript_Core/ArrayBuffer.h>
+
 #include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
 
@@ -38,6 +38,8 @@
 public:
     static RefPtr<WebGPUShaderModule> create(RefPtr<GPUShaderModule>&&);
 
+    const GPUShaderModule& module() const { return *m_module; }
+
 private:
     WebGPUShaderModule(RefPtr<GPUShaderModule>&&);
 
@@ -47,3 +49,4 @@
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)
+

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStage.h (from rev 237911, trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStage.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStage.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2018 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 WebGPUShaderStage : public RefCounted<WebGPUShaderStage> {
+public:
+    enum {
+        VERTEX = 0,
+        FRAGMENT = 1,
+        COMPUTE = 2
+    };
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStage.idl (from rev 237911, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStage.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStage.idl	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+typedef unsigned long u32;
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
+] interface WebGPUShaderStage {
+    const u32 VERTEX = 0;
+    const u32 FRAGMENT = 1;
+    const u32 COMPUTE = 2;
+};

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp	2018-11-07 04:37:04 UTC (rev 237912)
@@ -28,12 +28,17 @@
 
 #if ENABLE(WEBGPU)
 
+#include "WebGPUDevice.h"
+
 namespace WebCore {
 
 WebGPUSwapChain::~WebGPUSwapChain() = default;
 
-void WebGPUSwapChain::configure(const Descriptor& descriptor)
+void WebGPUSwapChain::configure(Descriptor&& descriptor)
 {
+    if (descriptor.device)
+        m_swapChain->setDevice(descriptor.device->device());
+
     reshape(descriptor.width, descriptor.height);
 }
 
@@ -44,13 +49,12 @@
 
 void WebGPUSwapChain::reshape(int width, int height)
 {
-    m_width = width;
-    m_height = height;
+    m_swapChain->reshape(width, height);
 }
 
 void WebGPUSwapChain::markLayerComposited()
 {
-    // FIXME: Unimplemented stub.
+    m_swapChain->present();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.h (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.h	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -28,6 +28,8 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUBasedCanvasRenderingContext.h"
+#include "GPUSwapChain.h"
+#include "WebGPUDevice.h"
 
 namespace WebCore {
 
@@ -34,6 +36,7 @@
 class WebGPUSwapChain : public GPUBasedCanvasRenderingContext {
 public:
     struct Descriptor {
+        const WebGPUDevice* device = nullptr;
         // FIXME: More texture properties.
         unsigned long width;
         unsigned long height;
@@ -40,13 +43,14 @@
     };
 
     virtual ~WebGPUSwapChain() = 0;
-    void configure(const Descriptor&);
+    void configure(Descriptor&&);
     // FIXME: WebGPUTexture getNextTexture();
     void present();
 
 protected:
-    WebGPUSwapChain(CanvasBase& canvas)
+    WebGPUSwapChain(CanvasBase& canvas, RefPtr<GPUSwapChain>&& swapChain)
         : GPUBasedCanvasRenderingContext(canvas)
+        , m_swapChain(WTFMove(swapChain))
     {
     }
 
@@ -63,8 +67,7 @@
     void stop() override { }
     bool canSuspendForDocumentSuspension() const override { return false; }
 
-    unsigned long m_width;
-    unsigned long m_height;
+    RefPtr<GPUSwapChain> m_swapChain;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl (237911 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl	2018-11-07 04:37:04 UTC (rev 237912)
@@ -36,7 +36,11 @@
 
 typedef unsigned long u32;
 
-dictionary WebGPUSwapChainDescriptor {
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] dictionary WebGPUSwapChainDescriptor {
+    WebGPUDevice device; // FIXME: Propose this addition to IDL.
     // WebGPUTextureUsageFlags usage;
     // WebGPUTextureFormatEnum format;
     u32 width;

Copied: trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipeline.h (from rev 237911, trunk/Source/WebCore/Modules/webgpu/GPUDevice.h) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipeline.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipeline.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2018 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>
+#include <wtf/RefPtr.h>
+#include <wtf/RetainPtr.h>
+
+#if USE(METAL)
+OBJC_PROTOCOL(MTLRenderPipelineState);
+#endif
+
+namespace WebCore {
+
+class GPUDevice;
+
+struct GPURenderPipelineDescriptor;
+
+#if USE(METAL)
+using PlatformRenderPipeline = MTLRenderPipelineState;
+using PlatformRenderPipelineSmartPtr = RetainPtr<MTLRenderPipelineState>;
+#else
+using PlatformRenderPipeline = void;
+using PlatformRenderPipelineSmartPtr = RefPtr<void>;
+#endif
+
+class GPURenderPipeline : public RefCounted<GPURenderPipeline> {
+public:
+    static RefPtr<GPURenderPipeline> create(const GPUDevice&, GPURenderPipelineDescriptor&&);
+
+    PlatformRenderPipeline *platformRenderPipeline() const { return m_platformRenderPipeline.get(); }
+
+private:
+    GPURenderPipeline(PlatformRenderPipelineSmartPtr&&);
+
+    PlatformRenderPipelineSmartPtr m_platformRenderPipeline;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Added: trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipelineMetal.mm (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipelineMetal.mm	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipelineMetal.mm	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#import "config.h"
+#import "GPURenderPipeline.h"
+
+#if ENABLE(WEBGPU)
+
+#import "GPURenderPipelineDescriptor.h"
+#import "Logging.h"
+#import "WebGPUShaderStage.h"
+
+#import <Metal/Metal.h>
+#import <wtf/BlockObjCExceptions.h>
+
+namespace WebCore {
+
+static bool setFunctionsForPipelineDescriptor(const char* const functionName, MTLRenderPipelineDescriptor *mtlDescriptor, GPURenderPipelineDescriptor&& descriptor)
+{
+#if LOG_DISABLED
+    UNUSED_PARAM(functionName);
+#endif
+    for (const auto& stageDescriptor : descriptor.stages) {
+        auto mtlLibrary = retainPtr(stageDescriptor.module.platformShaderModule());
+
+        if (!mtlLibrary) {
+            LOG(WebGPU, "%s: MTLLibrary does not exist!", functionName);
+            return false;
+        }
+
+        auto function = adoptNS([mtlLibrary newFunctionWithName:stageDescriptor.entryPoint]);
+
+        if (!function) {
+            LOG(WebGPU, "%s: MTLFunction %s not found!", functionName, stageDescriptor.entryPoint.utf8().data());
+            return false;
+        }
+
+        switch (stageDescriptor.stage) {
+        case WebGPUShaderStage::VERTEX:
+            [mtlDescriptor setVertexFunction:function.get()];
+            break;
+        case WebGPUShaderStage::FRAGMENT:
+            [mtlDescriptor setFragmentFunction:function.get()];
+            break;
+        default:
+            LOG(WebGPU, "%s: Invalid shader stage specified!", functionName);
+            return false;
+            break;
+        }
+    }
+
+    return true;
+}
+
+RefPtr<GPURenderPipeline> GPURenderPipeline::create(const GPUDevice& device, GPURenderPipelineDescriptor&& descriptor)
+{
+    const char* const functionName = "GPURenderPipeline::create()";
+
+    if (!device.platformDevice()) {
+        LOG(WebGPU, "%s: MTLDevice does not exist!", functionName);
+        return nullptr;
+    }
+
+    RetainPtr<MTLRenderPipelineDescriptor> mtlDescriptor;
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    mtlDescriptor = adoptNS([MTLRenderPipelineDescriptor new]);
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    if (!mtlDescriptor) {
+        LOG(WebGPU, "%s: Error creating MTLDescriptor!", functionName);
+        return nullptr;
+    }
+
+    if (!setFunctionsForPipelineDescriptor(functionName, mtlDescriptor.get(), WTFMove(descriptor)))
+        return nullptr;
+
+    // FIXME: Get the pixelFormat as configured for the context/CAMetalLayer.
+    mtlDescriptor.get().colorAttachments[0].pixelFormat = MTLPixelFormatBGRA8Unorm;
+
+    PlatformRenderPipelineSmartPtr pipeline;
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    if ([mtlDescriptor vertexFunction])
+        pipeline = adoptNS([device.platformDevice() newRenderPipelineStateWithDescriptor:mtlDescriptor.get() error:nil]);
+    else
+        LOG(WebGPU, "%s: No vertex function assigned for MTLRenderPipelineDescriptor!", functionName);
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    if (!pipeline) {
+        LOG(WebGPU, "%s: Error creating MTLRenderPipelineState!", functionName);
+        return nullptr;
+    }
+
+    return adoptRef(new GPURenderPipeline(WTFMove(pipeline)));
+}
+
+GPURenderPipeline::GPURenderPipeline(PlatformRenderPipelineSmartPtr&& pipeline)
+    : m_platformRenderPipeline(WTFMove(pipeline))
+{
+    UNUSED_PARAM(m_platformRenderPipeline);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h (from rev 237911, trunk/Source/WebCore/Modules/webgpu/GPUDevice.h) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2018 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/RefPtr.h>
+#include <wtf/RetainPtr.h>
+
+#if USE(METAL)
+OBJC_CLASS CAMetalLayer;
+#endif
+
+namespace WebCore {
+
+class GPUDevice;
+
+#if USE(METAL)
+using PlatformSwapLayer = CAMetalLayer;
+using PlatformSwapLayerSmartPtr = RetainPtr<CAMetalLayer>;
+#else
+using PlatformSwapLayer = void;
+using PlatformSwapLayerSmartPtr = RefPtr<void>;
+#endif
+
+class GPUSwapChain : public RefCounted<GPUSwapChain> {
+public:
+    static RefPtr<GPUSwapChain> create();
+
+    void setDevice(const GPUDevice&);
+    void reshape(int width, int height);
+    void present();
+
+    PlatformSwapLayer *platformLayer() const { return m_platformSwapLayer.get(); }
+
+private:
+    GPUSwapChain(PlatformSwapLayerSmartPtr&&);
+
+    PlatformSwapLayerSmartPtr m_platformSwapLayer;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChainMetal.mm (from rev 237911, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp) (0 => 237912)


--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChainMetal.mm	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChainMetal.mm	2018-11-07 04:37:04 UTC (rev 237912)
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#import "config.h"
+#import "GPUSwapChain.h"
+
+#if ENABLE(WEBGPU)
+
+#import "GPUDevice.h"
+#import "Logging.h"
+
+#import <Metal/Metal.h>
+#import <QuartzCore/QuartzCore.h>
+#import <wtf/BlockObjCExceptions.h>
+
+namespace WebCore {
+
+RefPtr<GPUSwapChain> GPUSwapChain::create()
+{
+    PlatformSwapLayerSmartPtr platformLayer;
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    platformLayer = adoptNS([[CAMetalLayer alloc] init]);
+
+    [platformLayer setOpaque:0];
+    [platformLayer setName:@"WebGPU Layer"];
+
+    // FIXME: For now, default to these settings.
+    [platformLayer setPixelFormat:MTLPixelFormatBGRA8Unorm];
+    [platformLayer setFramebufferOnly:YES];
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    if (!platformLayer) {
+        LOG(WebGPU, "GPUSwapChain::create(): Unable to create CAMetalLayer!");
+        return nullptr;
+    }
+
+    return adoptRef(new GPUSwapChain(WTFMove(platformLayer)));
+}
+
+GPUSwapChain::GPUSwapChain(PlatformSwapLayerSmartPtr&& platformLayer)
+    : m_platformSwapLayer(WTFMove(platformLayer))
+{
+}
+
+void GPUSwapChain::setDevice(const GPUDevice& device)
+{
+    if (!device.platformDevice()) {
+        LOG(WebGPU, "GPUSwapChain::setDevice(): MTLDevice does not exist!");
+        return;
+    }
+
+    [m_platformSwapLayer setDevice:device.platformDevice()];
+}
+
+void GPUSwapChain::reshape(int width, int height)
+{
+    [m_platformSwapLayer setBounds:CGRectMake(0, 0, width, height)];
+    [m_platformSwapLayer setDrawableSize:CGSizeMake(width, height)];
+}
+
+void GPUSwapChain::present()
+{
+    // FIXME: Unimplemented stub.
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Modified: trunk/Source/WebCore/PAL/ChangeLog (237911 => 237912)


--- trunk/Source/WebCore/PAL/ChangeLog	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/PAL/ChangeLog	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,3 +1,14 @@
+2018-11-06  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
+        https://bugs.webkit.org/show_bug.cgi?id=191291
+
+        Reviewed by Myles Maxfield.
+
+        Properly disable WEBGPU on all non-Metal platforms for now.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2018-11-02  Daniel Bates  <daba...@apple.com>
 
         [iOS] Normalize character string based on key code

Modified: trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig (237911 => 237912)


--- trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig	2018-11-07 04:37:04 UTC (rev 237912)
@@ -366,7 +366,11 @@
 
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 
-ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU = $(ENABLE_WEBGPU_$(WK_PLATFORM_NAME));
+ENABLE_WEBGPU_iphoneos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_watchos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_macosx = ENABLE_WEBGPU;
 
 ENABLE_WEBMETAL = $(ENABLE_WEBMETAL_$(WK_PLATFORM_NAME));
 ENABLE_WEBMETAL_iphoneos = ENABLE_WEBMETAL;

Modified: trunk/Source/WebCore/Sources.txt (237911 => 237912)


--- trunk/Source/WebCore/Sources.txt	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/Sources.txt	2018-11-07 04:37:04 UTC (rev 237912)
@@ -302,6 +302,7 @@
 Modules/webgpu/WebGPUAdapter.cpp
 Modules/webgpu/WebGPUDevice.cpp
 Modules/webgpu/WebGPURenderingContext.cpp
+Modules/webgpu/WebGPURenderPipeline.cpp
 Modules/webgpu/WebGPUShaderModule.cpp
 Modules/webgpu/WebGPUSwapChain.cpp
 
@@ -3193,9 +3194,14 @@
 JSWebGPUAdapter.cpp
 JSWebGPUAdapterDescriptor.cpp
 JSWebGPUDevice.cpp
+JSWebGPUPipelineDescriptorBase.cpp
+JSWebGPUPipelineStageDescriptor.cpp
 JSWebGPURenderingContext.cpp
+JSWebGPURenderPipeline.cpp
+JSWebGPURenderPipelineDescriptor.cpp
 JSWebGPUShaderModule.cpp
 JSWebGPUShaderModuleDescriptor.cpp
+JSWebGPUShaderStage.cpp
 JSWebGPUSwapChain.cpp
 JSWebMetalBuffer.cpp
 JSWebMetalCommandBuffer.cpp

Modified: trunk/Source/WebCore/SourcesCocoa.txt (237911 => 237912)


--- trunk/Source/WebCore/SourcesCocoa.txt	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2018-11-07 04:37:04 UTC (rev 237912)
@@ -28,7 +28,9 @@
 Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm
 
 Modules/webgpu/cocoa/GPUDeviceMetal.mm
+Modules/webgpu/cocoa/GPURenderPipelineMetal.mm
 Modules/webgpu/cocoa/GPUShaderModuleMetal.mm
+Modules/webgpu/cocoa/GPUSwapChainMetal.mm
 
 accessibility/ios/AccessibilityObjectIOS.mm
 accessibility/ios/AXObjectCacheIOS.mm

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (237911 => 237912)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-11-07 04:37:04 UTC (rev 237912)
@@ -13773,6 +13773,9 @@
 		D045AD2121682474000A6E9B /* WebMetalBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebMetalBuffer.cpp; sourceTree = "<group>"; };
 		D045AD2221682474000A6E9B /* WebMetalCommandBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebMetalCommandBuffer.h; sourceTree = "<group>"; };
 		D045AD2321682475000A6E9B /* WebMetalCommandQueue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebMetalCommandQueue.cpp; sourceTree = "<group>"; };
+		D046FB65218D073C00CB8F62 /* GPURenderPipelineDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPURenderPipelineDescriptor.h; sourceTree = "<group>"; };
+		D046FB67218D180300CB8F62 /* GPUPipelineStageDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUPipelineStageDescriptor.h; sourceTree = "<group>"; };
+		D046FB68218D18CD00CB8F62 /* GPUPipelineDescriptorBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUPipelineDescriptorBase.h; sourceTree = "<group>"; };
 		D0573D42217EB81E00D1BE91 /* GPULegacyTextureMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyTextureMetal.mm; sourceTree = "<group>"; };
 		D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FormatBlockCommand.cpp; sourceTree = "<group>"; };
 		D05CED280A40BB2C00C5AF38 /* FormatBlockCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FormatBlockCommand.h; sourceTree = "<group>"; };
@@ -13796,6 +13799,8 @@
 		D093D225217951D400329217 /* WebGPURenderingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPURenderingContext.h; sourceTree = "<group>"; };
 		D093D227217951D400329217 /* WebGPURenderingContext.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderingContext.idl; sourceTree = "<group>"; };
 		D093D2292179541600329217 /* WebGPURenderingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPURenderingContext.cpp; sourceTree = "<group>"; };
+		D09727B52187F44300942F3A /* GPUSwapChain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GPUSwapChain.h; path = cocoa/GPUSwapChain.h; sourceTree = "<group>"; };
+		D09727B62187F44300942F3A /* GPUSwapChainMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUSwapChainMetal.mm; sourceTree = "<group>"; };
 		D09727C2218A472900942F3A /* GPUShaderModuleDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUShaderModuleDescriptor.h; sourceTree = "<group>"; };
 		D09727CA218BD7A500942F3A /* GPUDevice.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUDevice.cpp; sourceTree = "<group>"; };
 		D0A20D542092A0A600E0C259 /* WebGLCompressedTextureASTC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLCompressedTextureASTC.h; sourceTree = "<group>"; };
@@ -13806,6 +13811,19 @@
 		D0BC54481443AC4A00E105DA /* CachedStyleSheetClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedStyleSheetClient.h; sourceTree = "<group>"; };
 		D0BD4F5A1408850F006839B6 /* DictationCommandIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DictationCommandIOS.cpp; sourceTree = "<group>"; };
 		D0BD4F5B1408850F006839B6 /* DictationCommandIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictationCommandIOS.h; sourceTree = "<group>"; };
+		D0C419EB2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUPipelineStageDescriptor.h; sourceTree = "<group>"; };
+		D0C419EC2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUPipelineStageDescriptor.idl; sourceTree = "<group>"; };
+		D0C419EE2183D9C8009EC1DE /* WebGPUShaderStage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUShaderStage.h; sourceTree = "<group>"; };
+		D0C419EF2183D9C8009EC1DE /* WebGPUShaderStage.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUShaderStage.idl; sourceTree = "<group>"; };
+		D0C419F02183EB31009EC1DE /* WebGPUPipelineDescriptorBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUPipelineDescriptorBase.h; sourceTree = "<group>"; };
+		D0C419F12183EB31009EC1DE /* WebGPUPipelineDescriptorBase.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUPipelineDescriptorBase.idl; sourceTree = "<group>"; };
+		D0C419F22183EFEC009EC1DE /* WebGPURenderPipelineDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPURenderPipelineDescriptor.h; sourceTree = "<group>"; };
+		D0C419F32183EFEC009EC1DE /* WebGPURenderPipelineDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderPipelineDescriptor.idl; sourceTree = "<group>"; };
+		D0C419F7218404DA009EC1DE /* WebGPURenderPipeline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPURenderPipeline.h; sourceTree = "<group>"; };
+		D0C419F8218404DA009EC1DE /* WebGPURenderPipeline.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPURenderPipeline.cpp; sourceTree = "<group>"; };
+		D0C419F9218404DA009EC1DE /* WebGPURenderPipeline.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderPipeline.idl; sourceTree = "<group>"; };
+		D0C419FA21840F6C009EC1DE /* GPURenderPipeline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GPURenderPipeline.h; path = cocoa/GPURenderPipeline.h; sourceTree = "<group>"; };
+		D0C419FB21840F6C009EC1DE /* GPURenderPipelineMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPURenderPipelineMetal.mm; sourceTree = "<group>"; };
 		D0CAAE98216824A6001C91C7 /* WebMetalBuffer.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebMetalBuffer.idl; sourceTree = "<group>"; };
 		D0CAAE9A216824A6001C91C7 /* WebMetalCommandBuffer.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebMetalCommandBuffer.idl; sourceTree = "<group>"; };
 		D0CAAE9B216824A7001C91C7 /* WebMetalCommandQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebMetalCommandQueue.h; sourceTree = "<group>"; };
@@ -25437,8 +25455,13 @@
 				D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */,
 				D09727CA218BD7A500942F3A /* GPUDevice.cpp */,
 				D0615FCF217FF185008A48A8 /* GPUDevice.h */,
+				D046FB68218D18CD00CB8F62 /* GPUPipelineDescriptorBase.h */,
+				D046FB67218D180300CB8F62 /* GPUPipelineStageDescriptor.h */,
+				D0C419FA21840F6C009EC1DE /* GPURenderPipeline.h */,
+				D046FB65218D073C00CB8F62 /* GPURenderPipelineDescriptor.h */,
 				D060D888218280C100339318 /* GPUShaderModule.h */,
 				D09727C2218A472900942F3A /* GPUShaderModuleDescriptor.h */,
+				D09727B52187F44300942F3A /* GPUSwapChain.h */,
 				D00F5947216EFE54000D71DB /* WebGPU.cpp */,
 				D00F5946216EFE54000D71DB /* WebGPU.h */,
 				D00F5948216EFE54000D71DB /* WebGPU.idl */,
@@ -25450,14 +25473,25 @@
 				D00F595321701D8C000D71DB /* WebGPUDevice.cpp */,
 				D00F595221701D8C000D71DB /* WebGPUDevice.h */,
 				D00F595421701D8C000D71DB /* WebGPUDevice.idl */,
+				D0C419F02183EB31009EC1DE /* WebGPUPipelineDescriptorBase.h */,
+				D0C419F12183EB31009EC1DE /* WebGPUPipelineDescriptorBase.idl */,
+				D0C419EB2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.h */,
+				D0C419EC2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.idl */,
 				D093D2292179541600329217 /* WebGPURenderingContext.cpp */,
 				D093D225217951D400329217 /* WebGPURenderingContext.h */,
 				D093D227217951D400329217 /* WebGPURenderingContext.idl */,
+				D0C419F8218404DA009EC1DE /* WebGPURenderPipeline.cpp */,
+				D0C419F7218404DA009EC1DE /* WebGPURenderPipeline.h */,
+				D0C419F9218404DA009EC1DE /* WebGPURenderPipeline.idl */,
+				D0C419F22183EFEC009EC1DE /* WebGPURenderPipelineDescriptor.h */,
+				D0C419F32183EFEC009EC1DE /* WebGPURenderPipelineDescriptor.idl */,
 				D0615FCD217FE5C6008A48A8 /* WebGPUShaderModule.cpp */,
 				D0615FCC217FE5C6008A48A8 /* WebGPUShaderModule.h */,
 				D0615FCE217FE5C6008A48A8 /* WebGPUShaderModule.idl */,
 				D060D8872182697000339318 /* WebGPUShaderModuleDescriptor.h */,
 				D060D88421825D5F00339318 /* WebGPUShaderModuleDescriptor.idl */,
+				D0C419EE2183D9C8009EC1DE /* WebGPUShaderStage.h */,
+				D0C419EF2183D9C8009EC1DE /* WebGPUShaderStage.idl */,
 				D0DA0BE5217930E2007FE2AC /* WebGPUSwapChain.cpp */,
 				D0DA0BE4217930E2007FE2AC /* WebGPUSwapChain.h */,
 				D0DA0BE6217930E2007FE2AC /* WebGPUSwapChain.idl */,
@@ -25469,7 +25503,9 @@
 			isa = PBXGroup;
 			children = (
 				D0615FD1217FF1E1008A48A8 /* GPUDeviceMetal.mm */,
+				D0C419FB21840F6C009EC1DE /* GPURenderPipelineMetal.mm */,
 				D060D889218280C100339318 /* GPUShaderModuleMetal.mm */,
+				D09727B62187F44300942F3A /* GPUSwapChainMetal.mm */,
 			);
 			path = cocoa;
 			sourceTree = "<group>";

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (237911 => 237912)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2018-11-07 04:37:04 UTC (rev 237912)
@@ -175,6 +175,8 @@
     macro(WebGPUAdapter) \
     macro(WebGPUDevice) \
     macro(WebGPURenderingContext) \
+    macro(WebGPURenderPipeline) \
+    macro(WebGPUShaderStage) \
     macro(WebGPUShaderModule) \
     macro(WebGPUSwapChain) \
     macro(WebMetalBuffer) \

Modified: trunk/Source/WebKit/ChangeLog (237911 => 237912)


--- trunk/Source/WebKit/ChangeLog	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebKit/ChangeLog	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,3 +1,14 @@
+2018-11-06  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
+        https://bugs.webkit.org/show_bug.cgi?id=191291
+
+        Reviewed by Myles Maxfield.
+
+        Properly disable WEBGPU on all non-Metal platforms for now.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2018-11-06  Youenn Fablet  <you...@apple.com>
 
         Make mDNS ICE Candidate an experimental flag again

Modified: trunk/Source/WebKit/Configurations/FeatureDefines.xcconfig (237911 => 237912)


--- trunk/Source/WebKit/Configurations/FeatureDefines.xcconfig	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebKit/Configurations/FeatureDefines.xcconfig	2018-11-07 04:37:04 UTC (rev 237912)
@@ -366,7 +366,11 @@
 
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 
-ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU = $(ENABLE_WEBGPU_$(WK_PLATFORM_NAME));
+ENABLE_WEBGPU_iphoneos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_watchos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_macosx = ENABLE_WEBGPU;
 
 ENABLE_WEBMETAL = $(ENABLE_WEBMETAL_$(WK_PLATFORM_NAME));
 ENABLE_WEBMETAL_iphoneos = ENABLE_WEBMETAL;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (237911 => 237912)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,3 +1,14 @@
+2018-11-06  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
+        https://bugs.webkit.org/show_bug.cgi?id=191291
+
+        Reviewed by Myles Maxfield.
+
+        Properly disable WEBGPU on all non-Metal platforms for now.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2018-11-02  Daniel Bates  <daba...@apple.com>
 
         [iOS] WebKit should dispatch DOM events when a modifier key is pressed

Modified: trunk/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig (237911 => 237912)


--- trunk/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig	2018-11-07 04:37:04 UTC (rev 237912)
@@ -366,7 +366,11 @@
 
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 
-ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU = $(ENABLE_WEBGPU_$(WK_PLATFORM_NAME));
+ENABLE_WEBGPU_iphoneos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_watchos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_macosx = ENABLE_WEBGPU;
 
 ENABLE_WEBMETAL = $(ENABLE_WEBMETAL_$(WK_PLATFORM_NAME));
 ENABLE_WEBMETAL_iphoneos = ENABLE_WEBMETAL;

Modified: trunk/Tools/ChangeLog (237911 => 237912)


--- trunk/Tools/ChangeLog	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Tools/ChangeLog	2018-11-07 04:37:04 UTC (rev 237912)
@@ -1,3 +1,14 @@
+2018-11-06  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for WebGPURenderPipeline and WebGPUSwapChain
+        https://bugs.webkit.org/show_bug.cgi?id=191291
+
+        Reviewed by Myles Maxfield.
+
+        Properly disable WEBGPU on all non-Metal platforms for now.
+
+        * TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
+
 2018-11-06  Aakash Jain  <aakash_j...@apple.com>
 
         [ews-app] Add URL configuration for OpenSource EWS Django app

Modified: trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig (237911 => 237912)


--- trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig	2018-11-07 04:01:49 UTC (rev 237911)
+++ trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig	2018-11-07 04:37:04 UTC (rev 237912)
@@ -366,7 +366,11 @@
 
 ENABLE_WEBGL2 = ENABLE_WEBGL2;
 
-ENABLE_WEBGPU = ENABLE_WEBGPU;
+ENABLE_WEBGPU = $(ENABLE_WEBGPU_$(WK_PLATFORM_NAME));
+ENABLE_WEBGPU_iphoneos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_watchos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_appletvos = ENABLE_WEBGPU;
+ENABLE_WEBGPU_macosx = ENABLE_WEBGPU;
 
 ENABLE_WEBMETAL = $(ENABLE_WEBMETAL_$(WK_PLATFORM_NAME));
 ENABLE_WEBMETAL_iphoneos = ENABLE_WEBMETAL;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to