Title: [237723] trunk
Revision
237723
Author
justin_...@apple.com
Date
2018-11-02 00:09:09 -0700 (Fri, 02 Nov 2018)

Log Message

[WebGPU] Experimental prototype for MSL shaders
https://bugs.webkit.org/show_bug.cgi?id=191084

Reviewed by Dean Jackson.

Source/WebCore:

Begin implementation for WebGPUDevice and WebGPUShaderModule and associated descriptor objects.

Test: webgpu/webgpu-basics.html
Test: webgpu/shader-modules.html

* CMakeLists.txt:
* DerivedSources.make:
* Modules/webgpu/GPUDevice.cpp:
(WebCore::GPUDevice::createShaderModule const):
* Modules/webgpu/GPUDevice.h:
(WebCore::GPUDevice::platformDevice const):
* Modules/webgpu/GPUShaderModule.h:
(WebCore::GPUShaderModule::platformShaderModule const):
* Modules/webgpu/GPUShaderModuleDescriptor.h:
* Modules/webgpu/WebGPU.cpp:
(WebCore::WebGPU::requestAdapter const):
* Modules/webgpu/WebGPUAdapter.cpp:
(WebCore::WebGPUAdapter::create):
(WebCore::WebGPUAdapter::createDevice):
* Modules/webgpu/WebGPUAdapter.h:
* Modules/webgpu/WebGPUAdapter.idl:
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::create):
(WebCore::WebGPUDevice::WebGPUDevice):
(WebCore::WebGPUDevice::createShaderModule const):
* Modules/webgpu/WebGPUDevice.h:
* Modules/webgpu/WebGPUDevice.idl:
* Modules/webgpu/WebGPUShaderModule.cpp:
(WebCore::WebGPUShaderModule::create):
(WebCore::WebGPUShaderModule::WebGPUShaderModule):
* Modules/webgpu/WebGPUShaderModule.h:
* Modules/webgpu/WebGPUShaderModule.idl:
* Modules/webgpu/WebGPUShaderModuleDescriptor.h:
* Modules/webgpu/WebGPUShaderModuleDescriptor.idl:
* Modules/webgpu/WebGPUSwapChain.cpp:
(WebCore::WebGPUSwapChain::configure):
* Modules/webgpu/WebGPUSwapChain.h:
* Modules/webgpu/WebGPUSwapChain.idl:
* Modules/webgpu/cocoa/GPUDeviceMetal.mm:
(WebCore::GPUDevice::create):
(WebCore::GPUDevice::GPUDevice):
* Modules/webgpu/cocoa/GPUShaderModuleMetal.mm:
(WebCore::GPUShaderModule::create):
(WebCore::GPUShaderModule::GPUShaderModule):
* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* platform/Logging.h:

Source/WTF:

Disabling WebGPU on non-Cocoa platforms and iOS Simulator.

* wtf/Platform.h:

LayoutTests:

* webgpu/shader-modules.html: Added.
* webgpu/shader-modules-expected.html: Added.
* webgpu/webgpu-basics.html: Added.
* webgpu/webgpu-basics-expected.html: Added.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237722 => 237723)


--- trunk/LayoutTests/ChangeLog	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/LayoutTests/ChangeLog	2018-11-02 07:09:09 UTC (rev 237723)
@@ -1,3 +1,15 @@
+2018-11-02  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for MSL shaders
+        https://bugs.webkit.org/show_bug.cgi?id=191084
+
+        Reviewed by Dean Jackson.
+
+        * webgpu/shader-modules.html: Added.
+        * webgpu/shader-modules-expected.html: Added.
+        * webgpu/webgpu-basics.html: Added.
+        * webgpu/webgpu-basics-expected.html: Added.
+
 2018-11-01  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: View: introduce a didLayoutSubtree

Added: trunk/LayoutTests/webgpu/shader-modules-expected.txt (0 => 237723)


--- trunk/LayoutTests/webgpu/shader-modules-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/shader-modules-expected.txt	2018-11-02 07:09:09 UTC (rev 237723)
@@ -0,0 +1,7 @@
+PASS Bad shader code should not create a module.
+PASS Incomplete shader code should not create a module.
+PASS Shader module created successfully.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/webgpu/shader-modules.html (0 => 237723)


--- trunk/LayoutTests/webgpu/shader-modules.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/shader-modules.html	2018-11-02 07:09:09 UTC (rev 237723)
@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<html>
+<script src=""
+<script id="library_full" 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 id="library_incomplete" type="x-shader/x-metal">
+    #include <metal_stdlib>
+    
+    using namespace metal;
+    
+    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 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"
+    };
+    let shaderModule = defaultDevice.createShaderModule(shaderDescriptor0);
+    if (!shaderModule)
+        testPassed("Bad shader code should not create a module.");
+    else
+        testFailed("Bad shader code created a valid module!");
+
+    let shaderDescriptor1 = {
+        code : document.getElementById("library_incomplete").text
+    };
+
+    shaderModule = defaultDevice.createShaderModule(shaderDescriptor1);
+    if (!shaderModule)
+        testPassed("Incomplete shader code should not create a module.");
+    else
+        testFailed("Incomplete shader code created a valid module!");
+    
+    let shaderDescriptor2 = {
+        code : document.getElementById("library_full").text
+    };
+
+    shaderModule = defaultDevice.createShaderModule(shaderDescriptor2);
+    if (shaderModule)
+        testPassed("Shader module created successfully.");
+    else 
+        testFailed("Shader module not created successfully!");
+}
+
+setUpContexts();
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/webgpu/webgpu-basics-expected.txt (0 => 237723)


--- trunk/LayoutTests/webgpu/webgpu-basics-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/webgpu-basics-expected.txt	2018-11-02 07:09:09 UTC (rev 237723)
@@ -0,0 +1,5 @@
+PASS [object WebGPU] is defined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/webgpu/webgpu-basics.html (0 => 237723)


--- trunk/LayoutTests/webgpu/webgpu-basics.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/webgpu-basics.html	2018-11-02 07:09:09 UTC (rev 237723)
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+<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 canvas;
+let context;
+let adapter;
+let defaultDevice;
+
+async function setUpContexts() {
+    canvas = document.createElement("canvas");
+    context = canvas.getContext("webgpu");
+    if (!context)
+        testFailed("Could not create WebGPU context!");
+
+    shouldBeDefined(window.webgpu);
+    
+    adapter = await window.webgpu.requestAdapter({});
+    if (!adapter) {
+        testFailed("Could not create default WebGPUAdapter!")
+        return;
+    }
+
+    defaultDevice = adapter.createDevice();
+    if (!defaultDevice) {
+        testFailed("Could not create WebGPUDevice!");
+        return;
+    }
+
+    setUpShaders();
+}
+
+function setUpShaders() {
+    let shaderDescriptor = {
+        code: document.getElementById("library").text
+    };
+    let shaderModule = defaultDevice.createShaderModule(shaderDescriptor);
+    if (!shaderModule)
+        testFailed("Could not create WebGPUShaderModule!");
+}
+
+setUpContexts();
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</html>
\ No newline at end of file

Modified: trunk/Source/WTF/ChangeLog (237722 => 237723)


--- trunk/Source/WTF/ChangeLog	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WTF/ChangeLog	2018-11-02 07:09:09 UTC (rev 237723)
@@ -1,3 +1,14 @@
+2018-11-02  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for MSL shaders
+        https://bugs.webkit.org/show_bug.cgi?id=191084
+
+        Reviewed by Dean Jackson.
+
+        Disabling WebGPU on non-Cocoa platforms and iOS Simulator.
+
+        * wtf/Platform.h:
+
 2018-11-01  Jiewen Tan  <jiewen_...@apple.com>
 
         Replace CommonRandom SPI with API

Modified: trunk/Source/WTF/wtf/Platform.h (237722 => 237723)


--- trunk/Source/WTF/wtf/Platform.h	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WTF/wtf/Platform.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -1378,3 +1378,7 @@
 #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 (237722 => 237723)


--- trunk/Source/WebCore/CMakeLists.txt	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/CMakeLists.txt	2018-11-02 07:09:09 UTC (rev 237723)
@@ -453,8 +453,9 @@
     Modules/webgpu/WebGPUAdapterDescriptor.idl
     Modules/webgpu/WebGPUDevice.idl
     Modules/webgpu/WebGPURenderingContext.idl
+    Modules/webgpu/WebGPUShaderModule.idl
+    Modules/webgpu/WebGPUShaderModuleDescriptor.idl
     Modules/webgpu/WebGPUSwapChain.idl
-    Modules/webgpu/WebGPUSwapChainDescriptor.idl
 
     Modules/websockets/CloseEvent.idl
     Modules/websockets/WebSocket.idl

Modified: trunk/Source/WebCore/ChangeLog (237722 => 237723)


--- trunk/Source/WebCore/ChangeLog	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/ChangeLog	2018-11-02 07:09:09 UTC (rev 237723)
@@ -1,3 +1,60 @@
+2018-11-02  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Experimental prototype for MSL shaders
+        https://bugs.webkit.org/show_bug.cgi?id=191084
+
+        Reviewed by Dean Jackson.
+
+        Begin implementation for WebGPUDevice and WebGPUShaderModule and associated descriptor objects.
+
+        Test: webgpu/webgpu-basics.html
+        Test: webgpu/shader-modules.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Modules/webgpu/GPUDevice.cpp: 
+        (WebCore::GPUDevice::createShaderModule const):
+        * Modules/webgpu/GPUDevice.h: 
+        (WebCore::GPUDevice::platformDevice const):
+        * Modules/webgpu/GPUShaderModule.h:
+        (WebCore::GPUShaderModule::platformShaderModule const):
+        * Modules/webgpu/GPUShaderModuleDescriptor.h:
+        * Modules/webgpu/WebGPU.cpp:
+        (WebCore::WebGPU::requestAdapter const):
+        * Modules/webgpu/WebGPUAdapter.cpp:
+        (WebCore::WebGPUAdapter::create):
+        (WebCore::WebGPUAdapter::createDevice):
+        * Modules/webgpu/WebGPUAdapter.h:
+        * Modules/webgpu/WebGPUAdapter.idl:
+        * Modules/webgpu/WebGPUDevice.cpp:
+        (WebCore::WebGPUDevice::create):
+        (WebCore::WebGPUDevice::WebGPUDevice):
+        (WebCore::WebGPUDevice::createShaderModule const):
+        * Modules/webgpu/WebGPUDevice.h:
+        * Modules/webgpu/WebGPUDevice.idl:
+        * Modules/webgpu/WebGPUShaderModule.cpp:
+        (WebCore::WebGPUShaderModule::create):
+        (WebCore::WebGPUShaderModule::WebGPUShaderModule):
+        * Modules/webgpu/WebGPUShaderModule.h:
+        * Modules/webgpu/WebGPUShaderModule.idl:
+        * Modules/webgpu/WebGPUShaderModuleDescriptor.h:
+        * Modules/webgpu/WebGPUShaderModuleDescriptor.idl:
+        * Modules/webgpu/WebGPUSwapChain.cpp:
+        (WebCore::WebGPUSwapChain::configure):
+        * Modules/webgpu/WebGPUSwapChain.h:
+        * Modules/webgpu/WebGPUSwapChain.idl:
+        * Modules/webgpu/cocoa/GPUDeviceMetal.mm:
+        (WebCore::GPUDevice::create):
+        (WebCore::GPUDevice::GPUDevice):
+        * Modules/webgpu/cocoa/GPUShaderModuleMetal.mm:
+        (WebCore::GPUShaderModule::create):
+        (WebCore::GPUShaderModule::GPUShaderModule):
+        * Sources.txt:
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+        * platform/Logging.h:
+
 2018-11-01  Jiewen Tan  <jiewen_...@apple.com>
 
         Replace CommonRandom SPI with API

Modified: trunk/Source/WebCore/DerivedSources.make (237722 => 237723)


--- trunk/Source/WebCore/DerivedSources.make	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/DerivedSources.make	2018-11-02 07:09:09 UTC (rev 237723)
@@ -373,8 +373,9 @@
     $(WebCore)/Modules/webgpu/WebGPUAdapterDescriptor.idl \
     $(WebCore)/Modules/webgpu/WebGPUDevice.idl \
     $(WebCore)/Modules/webgpu/WebGPURenderingContext.idl \
+    $(WebCore)/Modules/webgpu/WebGPUShaderModule.idl \
+    $(WebCore)/Modules/webgpu/WebGPUShaderModuleDescriptor.idl \
     $(WebCore)/Modules/webgpu/WebGPUSwapChain.idl \
-    $(WebCore)/Modules/webgpu/WebGPUSwapChainDescriptor.idl \
     $(WebCore)/Modules/websockets/CloseEvent.idl \
     $(WebCore)/Modules/websockets/WebSocket.idl \
     $(WebCore)/Modules/webvr/DOMWindowWebVR.idl \

Copied: trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPU.cpp) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp	2018-11-02 07:09:09 UTC (rev 237723)
@@ -0,0 +1,43 @@
+/*
+ * 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 "GPUDevice.h"
+
+#if ENABLE(WEBGPU)
+
+#include "GPUShaderModule.h"
+#include "GPUShaderModuleDescriptor.h"
+
+namespace WebCore {
+
+RefPtr<GPUShaderModule> GPUDevice::createShaderModule(GPUShaderModuleDescriptor&& descriptor) const
+{
+    return GPUShaderModule::create(*this, WTFMove(descriptor));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/GPUDevice.h (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.h) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/GPUDevice.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUDevice.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -0,0 +1,68 @@
+/*
+ * 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(MTLDevice);
+#endif
+
+namespace WebCore {
+
+#if USE(METAL)
+using PlatformDevice = MTLDevice;
+using PlatformDeviceSmartPtr = RetainPtr<MTLDevice>;
+#else
+using PlatformDevice = void;
+using PlatformDeviceSmartPtr = RefPtr<void>;
+#endif
+
+class GPUShaderModule;
+
+struct GPUShaderModuleDescriptor;
+
+class GPUDevice : public RefCounted<GPUDevice> {
+public:
+    static RefPtr<GPUDevice> create();
+
+    RefPtr<GPUShaderModule> createShaderModule(GPUShaderModuleDescriptor&&) const;
+
+    PlatformDevice *platformDevice() const { return m_platformDevice.get(); }
+
+private:
+    GPUDevice(PlatformDeviceSmartPtr&&);
+
+    PlatformDeviceSmartPtr m_platformDevice;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/GPUShaderModule.h (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.h) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/GPUShaderModule.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUShaderModule.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -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(MTLLibrary);
+#endif
+
+namespace WebCore {
+
+class GPUDevice;
+
+struct GPUShaderModuleDescriptor;
+
+#if USE(METAL)
+using PlatformShaderModule = MTLLibrary;
+using PlatformShaderModuleSmartPtr = RetainPtr<MTLLibrary>;
+#else
+using PlatformShaderModule = void;
+using PlatformShaderModuleSmartPtr = RefPtr<void>;
+#endif
+
+class GPUShaderModule : public RefCounted<GPUShaderModule> {
+public:
+    static RefPtr<GPUShaderModule> create(const GPUDevice&, GPUShaderModuleDescriptor&&);
+
+    PlatformShaderModule *platformShaderModule() const { return m_platformShaderModule.get(); }
+
+private:
+    GPUShaderModule(PlatformShaderModuleSmartPtr&&);
+
+    PlatformShaderModuleSmartPtr m_platformShaderModule;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/GPUShaderModuleDescriptor.h (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChainDescriptor.h) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/GPUShaderModuleDescriptor.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUShaderModuleDescriptor.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -0,0 +1,40 @@
+/*
+ * 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/text/WTFString.h>
+
+namespace WebCore {
+
+struct GPUShaderModuleDescriptor {
+    String code;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPU.cpp (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPU.cpp	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPU.cpp	2018-11-02 07:09:09 UTC (rev 237723)
@@ -39,7 +39,11 @@
 
 void WebGPU::requestAdapter(const WebGPUAdapterDescriptor& descriptor, WebGPUAdapterPromise&& deferred) const
 {
-    deferred.resolve(WebGPUAdapter::create(descriptor));
+    auto adapter = WebGPUAdapter::create(descriptor);
+    if (!adapter)
+        deferred.reject();
+
+    deferred.resolve(*adapter);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.cpp (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.cpp	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.cpp	2018-11-02 07:09:09 UTC (rev 237723)
@@ -34,9 +34,10 @@
 
 namespace WebCore {
 
-Ref<WebGPUAdapter> WebGPUAdapter::create(const WebGPUAdapterDescriptor& descriptor)
+RefPtr<WebGPUAdapter> WebGPUAdapter::create(const WebGPUAdapterDescriptor& descriptor)
 {
-    return adoptRef(*new WebGPUAdapter(descriptor));
+    // FIXME: Validation on descriptor.
+    return adoptRef(new WebGPUAdapter(descriptor));
 }
 
 WebGPUAdapter::WebGPUAdapter(const WebGPUAdapterDescriptor& descriptor)
@@ -45,9 +46,9 @@
     UNUSED_PARAM(m_descriptor);
 }
 
-Ref<WebGPUDevice> WebGPUAdapter::createDevice(ScriptExecutionContext& context)
+RefPtr<WebGPUDevice> WebGPUAdapter::createDevice()
 {
-    return WebGPUDevice::create(context, *this);
+    return WebGPUDevice::create(*this);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.h (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.h	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -28,6 +28,7 @@
 #if ENABLE(WEBGPU)
 
 #include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
@@ -38,9 +39,9 @@
 
 class WebGPUAdapter : public RefCounted<WebGPUAdapter> {
 public:
-    static Ref<WebGPUAdapter> create(const WebGPUAdapterDescriptor&);
+    static RefPtr<WebGPUAdapter> create(const WebGPUAdapterDescriptor&);
 
-    Ref<WebGPUDevice> createDevice(ScriptExecutionContext&);
+    RefPtr<WebGPUDevice> createDevice();
 
 private:
     WebGPUAdapter(const WebGPUAdapterDescriptor&);

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.idl (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.idl	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.idl	2018-11-02 07:09:09 UTC (rev 237723)
@@ -33,5 +33,5 @@
     // readonly attribute WebGPUExtensions extensions;
     // readonly attribute WebGPULimits limits; Don't expose higher limits for now.
 
-    [CallWith=ScriptExecutionContext] WebGPUDevice createDevice(/*WebGPUDeviceDescriptor descriptor*/);
+    WebGPUDevice createDevice(/*WebGPUDeviceDescriptor descriptor*/);
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp	2018-11-02 07:09:09 UTC (rev 237723)
@@ -30,19 +30,34 @@
 
 #include "WebGPUAdapter.h"
 
+#include "GPUShaderModuleDescriptor.h"
+#include "WebGPUShaderModule.h"
+#include "WebGPUShaderModuleDescriptor.h"
+
 namespace WebCore {
 
-Ref<WebGPUDevice> WebGPUDevice::create(ScriptExecutionContext&, Ref<WebGPUAdapter>&& adapter)
+RefPtr<WebGPUDevice> WebGPUDevice::create(Ref<WebGPUAdapter>&& adapter)
 {
-    return adoptRef(*new WebGPUDevice(WTFMove(adapter)));
+    auto device = GPUDevice::create(); // FIXME: Take adapter into account when creating m_device.
+    if (!device)
+        return nullptr;
+
+    return adoptRef(new WebGPUDevice(WTFMove(adapter), WTFMove(device)));
 }
 
-WebGPUDevice::WebGPUDevice(Ref<WebGPUAdapter>&& adapter)
+WebGPUDevice::WebGPUDevice(Ref<WebGPUAdapter>&& adapter, RefPtr<GPUDevice>&& device)
     : m_adapter(WTFMove(adapter))
+    , m_device(device)
 {
     UNUSED_PARAM(m_adapter);
 }
 
+RefPtr<WebGPUShaderModule> WebGPUDevice::createShaderModule(WebGPUShaderModuleDescriptor&& descriptor) const
+{
+    return WebGPUShaderModule::create(m_device->createShaderModule(GPUShaderModuleDescriptor { descriptor.code }));
+}
+
+
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -27,23 +27,34 @@
 
 #if ENABLE(WEBGPU)
 
+#include "GPUDevice.h"
+
+#include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
 class ScriptExecutionContext;
 class WebGPUAdapter;
+class WebGPUShaderModule;
 
+struct WebGPUShaderModuleDescriptor;
+
 class WebGPUDevice : public RefCounted<WebGPUDevice> {
 public:
-    static Ref<WebGPUDevice> create(ScriptExecutionContext&, Ref<WebGPUAdapter>&&);
+    static RefPtr<WebGPUDevice> create(Ref<WebGPUAdapter>&&);
 
     WebGPUAdapter& adapter() const { return m_adapter.get(); }
 
+    RefPtr<WebGPUShaderModule> createShaderModule(WebGPUShaderModuleDescriptor&&) const;
+
 private:
-    WebGPUDevice(Ref<WebGPUAdapter>&&);
+    WebGPUDevice(Ref<WebGPUAdapter>&&, RefPtr<GPUDevice>&&);
 
     Ref<WebGPUAdapter> m_adapter;
+
+    RefPtr<GPUDevice> m_device;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl	2018-11-02 07:09:09 UTC (rev 237723)
@@ -33,7 +33,9 @@
     // readonly attribute WebGPULimits limits;
     readonly attribute WebGPUAdapter adapter;
 
-/*
+    WebGPUShaderModule createShaderModule(WebGPUShaderModuleDescriptor descriptor);
+
+/* To Be Implemented:
     WebGPUBuffer createBuffer(WebGPUBufferDescriptor descriptor);
     WebGPUTexture createTexture(WebGPUTextureDescriptor descriptor);
     WebGPUSampler createSampler(WebGPUSamplerDescriptor descriptor);
@@ -45,7 +47,6 @@
     WebGPUBlendState createBlendState(WebGPUBlendStateDescriptor descriptor);
     WebGPUDepthStencilState createDepthStencilState(WebGPUDepthStencilStateDescriptor descriptor);
     WebGPUInputState createInputState(WebGPUInputStateDescriptor descriptor);
-    WebGPUShaderModule createShaderModule(WebGPUShaderModuleDescriptor descriptor);
     WebGPUAttachmentState createAttachmentState(WebGPUAttachmentStateDescriptor descriptor);
     WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor);
     WebGPURenderPipeline createRenderPipeline(WebGPURenderPipelineDescriptor descriptor);

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.cpp (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.cpp	2018-11-02 07:09:09 UTC (rev 237723)
@@ -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.
+ */
+
+#include "config.h"
+#include "WebGPUShaderModule.h"
+
+#if ENABLE(WEBGPU)
+
+namespace WebCore {
+
+RefPtr<WebGPUShaderModule> WebGPUShaderModule::create(RefPtr<GPUShaderModule>&& module)
+{
+    if (!module)
+        return nullptr;
+
+    return adoptRef(new WebGPUShaderModule(WTFMove(module)));
+}
+
+WebGPUShaderModule::WebGPUShaderModule(RefPtr<GPUShaderModule>&& module)
+    : m_module(WTFMove(module))
+{
+    UNUSED_PARAM(m_module);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.h (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -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 "GPUShaderModule.h"
+#include <_javascript_Core/ArrayBuffer.h>
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class WebGPUShaderModule : public RefCounted<WebGPUShaderModule> {
+public:
+    static RefPtr<WebGPUShaderModule> create(RefPtr<GPUShaderModule>&&);
+
+private:
+    WebGPUShaderModule(RefPtr<GPUShaderModule>&&);
+
+    RefPtr<GPUShaderModule> m_module;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.idl (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModule.idl	2018-11-02 07:09:09 UTC (rev 237723)
@@ -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 WebGPUShaderModule {
+};

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModuleDescriptor.h (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChainDescriptor.h) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModuleDescriptor.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModuleDescriptor.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -0,0 +1,40 @@
+/*
+ * 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/text/WTFString.h>
+
+namespace WebCore {
+
+struct WebGPUShaderModuleDescriptor {
+    String code;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModuleDescriptor.idl (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChainDescriptor.idl) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModuleDescriptor.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModuleDescriptor.idl	2018-11-02 07:09:09 UTC (rev 237723)
@@ -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
+] dictionary WebGPUShaderModuleDescriptor {
+    /*ArrayBuffer*/ DOMString code; // FIXME: DOMString for MTL prototyping only.
+};

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp	2018-11-02 07:09:09 UTC (rev 237723)
@@ -28,13 +28,11 @@
 
 #if ENABLE(WEBGPU)
 
-#include "WebGPUSwapChainDescriptor.h"
-
 namespace WebCore {
 
 WebGPUSwapChain::~WebGPUSwapChain() = default;
 
-void WebGPUSwapChain::configure(const WebGPUSwapChainDescriptor& descriptor)
+void WebGPUSwapChain::configure(const Descriptor& descriptor)
 {
     reshape(descriptor.width, descriptor.height);
 }

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.h (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.h	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -31,12 +31,16 @@
 
 namespace WebCore {
 
-struct WebGPUSwapChainDescriptor;
-
 class WebGPUSwapChain : public GPUBasedCanvasRenderingContext {
 public:
+    struct Descriptor {
+        // FIXME: More texture properties.
+        unsigned long width;
+        unsigned long height;
+    };
+
     virtual ~WebGPUSwapChain() = 0;
-    void configure(const WebGPUSwapChainDescriptor&);
+    void configure(const Descriptor&);
     // FIXME: WebGPUTexture getNextTexture();
     void present();
 

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.idl	2018-11-02 07:09:09 UTC (rev 237723)
@@ -33,3 +33,13 @@
     // WebGPUTexture getNextTexture();
     void present();
 };
+
+typedef unsigned long u32;
+
+dictionary WebGPUSwapChainDescriptor {
+    // WebGPUTextureUsageFlags usage;
+    // WebGPUTextureFormatEnum format;
+    u32 width;
+    u32 height;
+};
+

Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChainDescriptor.h (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChainDescriptor.h	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChainDescriptor.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -1,40 +0,0 @@
-/*
- * 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)
-
-namespace WebCore {
-
-struct WebGPUSwapChainDescriptor {
-    // FIXME: More texture properties.
-    unsigned long width;
-    unsigned long height;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)

Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChainDescriptor.idl (237722 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChainDescriptor.idl	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChainDescriptor.idl	2018-11-02 07:09:09 UTC (rev 237723)
@@ -1,37 +0,0 @@
-/*
- * 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
-] dictionary WebGPUSwapChainDescriptor {
-    // WebGPUTextureUsageFlags usage;
-    // WebGPUTextureFormatEnum format;
-    u32 width;
-    u32 height;
-};

Copied: trunk/Source/WebCore/Modules/webgpu/cocoa/GPUDeviceMetal.mm (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPUDeviceMetal.mm	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPUDeviceMetal.mm	2018-11-02 07:09:09 UTC (rev 237723)
@@ -0,0 +1,65 @@
+/*
+ * 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 "GPUDevice.h"
+
+#if ENABLE(WEBGPU)
+
+#import "Logging.h"
+
+#import <Metal/Metal.h>
+#import <wtf/BlockObjCExceptions.h>
+
+namespace WebCore {
+
+RefPtr<GPUDevice> GPUDevice::create()
+{
+    PlatformDeviceSmartPtr device;
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    device = adoptNS(MTLCreateSystemDefaultDevice()); // FIXME: Take WebGPUPowerPreference into account.
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    if (!device) {
+        LOG(WebGPU, "GPUDevice::GPUDevice(): Unable to create GPUDevice!");
+        return nullptr;
+    }
+
+    LOG(WebGPU, "GPUDevice::GPUDevice(): MTLDevice is %p", device.get());
+    return adoptRef(new GPUDevice(WTFMove(device)));
+}
+
+GPUDevice::GPUDevice(PlatformDeviceSmartPtr&& device)
+    : m_platformDevice(WTFMove(device))
+{
+    UNUSED_PARAM(m_platformDevice);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Copied: trunk/Source/WebCore/Modules/webgpu/cocoa/GPUShaderModuleMetal.mm (from rev 237722, trunk/Source/WebCore/Modules/webgpu/WebGPUSwapChain.cpp) (0 => 237723)


--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPUShaderModuleMetal.mm	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPUShaderModuleMetal.mm	2018-11-02 07:09:09 UTC (rev 237723)
@@ -0,0 +1,70 @@
+/*
+ * 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 "GPUShaderModule.h"
+
+#if ENABLE(WEBGPU)
+
+#import "GPUDevice.h"
+#import "GPUShaderModuleDescriptor.h"
+#import "Logging.h"
+
+#import <Metal/Metal.h>
+#import <wtf/BlockObjCExceptions.h>
+
+namespace WebCore {
+
+RefPtr<GPUShaderModule> GPUShaderModule::create(const GPUDevice& device, GPUShaderModuleDescriptor&& descriptor)
+{
+    if (!device.platformDevice())
+        return nullptr;
+
+    PlatformShaderModuleSmartPtr module;
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS
+
+    NSError *error = [NSError errorWithDomain:@"com.apple.WebKit.GPU" code:1 userInfo:nil];
+    module = adoptNS([device.platformDevice() newLibraryWithSource:descriptor.code options:nil error:&error]);
+    if (!module)
+        LOG(WebGPU, "Shader compilation error: %s", [[error localizedDescription] UTF8String]);
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    if (!module)
+        return nullptr;
+
+    return adoptRef(new GPUShaderModule(WTFMove(module)));
+}
+
+GPUShaderModule::GPUShaderModule(PlatformShaderModuleSmartPtr&& module)
+    : m_platformShaderModule(WTFMove(module))
+{
+    UNUSED_PARAM(m_platformShaderModule);
+}
+
+}
+
+#endif // ENABLE(WEBGPU)

Modified: trunk/Source/WebCore/Sources.txt (237722 => 237723)


--- trunk/Source/WebCore/Sources.txt	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/Sources.txt	2018-11-02 07:09:09 UTC (rev 237723)
@@ -297,10 +297,12 @@
 Modules/websockets/WorkerThreadableWebSocketChannel.cpp
 
 Modules/webgpu/DOMWindowWebGPU.cpp
+Modules/webgpu/GPUDevice.cpp
 Modules/webgpu/WebGPU.cpp
 Modules/webgpu/WebGPUAdapter.cpp
 Modules/webgpu/WebGPUDevice.cpp
 Modules/webgpu/WebGPURenderingContext.cpp
+Modules/webgpu/WebGPUShaderModule.cpp
 Modules/webgpu/WebGPUSwapChain.cpp
 
 Modules/webvr/NavigatorWebVR.cpp
@@ -3186,8 +3188,9 @@
 JSWebGPUAdapterDescriptor.cpp
 JSWebGPUDevice.cpp
 JSWebGPURenderingContext.cpp
+JSWebGPUShaderModule.cpp
+JSWebGPUShaderModuleDescriptor.cpp
 JSWebGPUSwapChain.cpp
-JSWebGPUSwapChainDescriptor.cpp
 JSWebMetalBuffer.cpp
 JSWebMetalCommandBuffer.cpp
 JSWebMetalCommandQueue.cpp

Modified: trunk/Source/WebCore/SourcesCocoa.txt (237722 => 237723)


--- trunk/Source/WebCore/SourcesCocoa.txt	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2018-11-02 07:09:09 UTC (rev 237723)
@@ -27,6 +27,9 @@
 Modules/plugins/YouTubePluginReplacement.cpp
 Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm
 
+Modules/webgpu/cocoa/GPUDeviceMetal.mm
+Modules/webgpu/cocoa/GPUShaderModuleMetal.mm
+
 accessibility/ios/AccessibilityObjectIOS.mm
 accessibility/ios/AXObjectCacheIOS.mm
 accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (237722 => 237723)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-11-02 07:09:09 UTC (rev 237723)
@@ -13680,8 +13680,6 @@
 		D00F5946216EFE54000D71DB /* WebGPU.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPU.h; sourceTree = "<group>"; };
 		D00F5947216EFE54000D71DB /* WebGPU.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPU.cpp; sourceTree = "<group>"; };
 		D00F5948216EFE54000D71DB /* WebGPU.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPU.idl; sourceTree = "<group>"; };
-		D00F594C216FDF8E000D71DB /* WebGPUAdapterDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUAdapterDescriptor.idl; sourceTree = "<group>"; };
-		D00F594E216FF6F0000D71DB /* WebGPUAdapterDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUAdapterDescriptor.h; sourceTree = "<group>"; };
 		D00F594F216FFAC2000D71DB /* WebGPUAdapter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUAdapter.h; sourceTree = "<group>"; };
 		D00F5950216FFAC2000D71DB /* WebGPUAdapter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUAdapter.cpp; sourceTree = "<group>"; };
 		D00F5951216FFAC2000D71DB /* WebGPUAdapter.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUAdapter.idl; sourceTree = "<group>"; };
@@ -13690,6 +13688,8 @@
 		D00F595421701D8C000D71DB /* WebGPUDevice.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUDevice.idl; sourceTree = "<group>"; };
 		D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpaceSplitString.cpp; sourceTree = "<group>"; };
 		D01A27AC10C9BFD800026A42 /* SpaceSplitString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpaceSplitString.h; sourceTree = "<group>"; };
+		D02C26912181416D00D818E4 /* WebGPUAdapterDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUAdapterDescriptor.h; sourceTree = "<group>"; };
+		D02C26922181416D00D818E4 /* WebGPUAdapterDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUAdapterDescriptor.idl; sourceTree = "<group>"; };
 		D02F854E21682A4A0088EE74 /* WebMetalCommandQueue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebMetalCommandQueue.idl; sourceTree = "<group>"; };
 		D02F855021682A560088EE74 /* WebMetalComputeCommandEncoder.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebMetalComputeCommandEncoder.idl; sourceTree = "<group>"; };
 		D02F855121682A560088EE74 /* WebMetalComputePipelineState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebMetalComputePipelineState.h; sourceTree = "<group>"; };
@@ -13759,6 +13759,15 @@
 		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>"; };
+		D060D88421825D5F00339318 /* WebGPUShaderModuleDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUShaderModuleDescriptor.idl; sourceTree = "<group>"; };
+		D060D8872182697000339318 /* WebGPUShaderModuleDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUShaderModuleDescriptor.h; sourceTree = "<group>"; };
+		D060D888218280C100339318 /* GPUShaderModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUShaderModule.h; sourceTree = "<group>"; };
+		D060D889218280C100339318 /* GPUShaderModuleMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUShaderModuleMetal.mm; sourceTree = "<group>"; };
+		D0615FCC217FE5C6008A48A8 /* WebGPUShaderModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUShaderModule.h; sourceTree = "<group>"; };
+		D0615FCD217FE5C6008A48A8 /* WebGPUShaderModule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUShaderModule.cpp; sourceTree = "<group>"; };
+		D0615FCE217FE5C6008A48A8 /* WebGPUShaderModule.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUShaderModule.idl; sourceTree = "<group>"; };
+		D0615FCF217FF185008A48A8 /* GPUDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUDevice.h; sourceTree = "<group>"; };
+		D0615FD1217FF1E1008A48A8 /* GPUDeviceMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUDeviceMetal.mm; sourceTree = "<group>"; };
 		D06C0D8D0CFD11460065F43F /* RemoveFormatCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoveFormatCommand.h; sourceTree = "<group>"; };
 		D06C0D8E0CFD11460065F43F /* RemoveFormatCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveFormatCommand.cpp; sourceTree = "<group>"; };
 		D07DEAB70A36554A00CA30F8 /* InsertListCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = InsertListCommand.cpp; sourceTree = "<group>"; };
@@ -13770,6 +13779,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>"; };
+		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>"; };
 		D0A20D562092A0A600E0C259 /* WebGLCompressedTextureASTC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLCompressedTextureASTC.cpp; sourceTree = "<group>"; };
 		D0A3A7301405A39800FB8ED3 /* ResourceLoaderOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoaderOptions.h; sourceTree = "<group>"; };
@@ -13787,8 +13798,6 @@
 		D0DA0BE4217930E2007FE2AC /* WebGPUSwapChain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUSwapChain.h; sourceTree = "<group>"; };
 		D0DA0BE5217930E2007FE2AC /* WebGPUSwapChain.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUSwapChain.cpp; sourceTree = "<group>"; };
 		D0DA0BE6217930E2007FE2AC /* WebGPUSwapChain.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUSwapChain.idl; sourceTree = "<group>"; };
-		D0DA0BE821793B56007FE2AC /* WebGPUSwapChainDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUSwapChainDescriptor.h; sourceTree = "<group>"; };
-		D0DA0BE921793B56007FE2AC /* WebGPUSwapChainDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUSwapChainDescriptor.idl; sourceTree = "<group>"; };
 		D0EDA772143E303C0028E383 /* CachedRawResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedRawResource.cpp; sourceTree = "<group>"; };
 		D0EDA773143E303C0028E383 /* CachedRawResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedRawResource.h; sourceTree = "<group>"; };
 		D0FF2A5B11F8C45A007E74E0 /* PingLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PingLoader.cpp; sourceTree = "<group>"; };
@@ -25383,9 +25392,14 @@
 		D00F593E216ECC43000D71DB /* webgpu */ = {
 			isa = PBXGroup;
 			children = (
+				D0615FD2217FFEE3008A48A8 /* cocoa */,
 				D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */,
 				D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */,
 				D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */,
+				D09727CA218BD7A500942F3A /* GPUDevice.cpp */,
+				D0615FCF217FF185008A48A8 /* GPUDevice.h */,
+				D060D888218280C100339318 /* GPUShaderModule.h */,
+				D09727C2218A472900942F3A /* GPUShaderModuleDescriptor.h */,
 				D00F5947216EFE54000D71DB /* WebGPU.cpp */,
 				D00F5946216EFE54000D71DB /* WebGPU.h */,
 				D00F5948216EFE54000D71DB /* WebGPU.idl */,
@@ -25392,8 +25406,8 @@
 				D00F5950216FFAC2000D71DB /* WebGPUAdapter.cpp */,
 				D00F594F216FFAC2000D71DB /* WebGPUAdapter.h */,
 				D00F5951216FFAC2000D71DB /* WebGPUAdapter.idl */,
-				D00F594E216FF6F0000D71DB /* WebGPUAdapterDescriptor.h */,
-				D00F594C216FDF8E000D71DB /* WebGPUAdapterDescriptor.idl */,
+				D02C26912181416D00D818E4 /* WebGPUAdapterDescriptor.h */,
+				D02C26922181416D00D818E4 /* WebGPUAdapterDescriptor.idl */,
 				D00F595321701D8C000D71DB /* WebGPUDevice.cpp */,
 				D00F595221701D8C000D71DB /* WebGPUDevice.h */,
 				D00F595421701D8C000D71DB /* WebGPUDevice.idl */,
@@ -25400,15 +25414,27 @@
 				D093D2292179541600329217 /* WebGPURenderingContext.cpp */,
 				D093D225217951D400329217 /* WebGPURenderingContext.h */,
 				D093D227217951D400329217 /* WebGPURenderingContext.idl */,
+				D0615FCD217FE5C6008A48A8 /* WebGPUShaderModule.cpp */,
+				D0615FCC217FE5C6008A48A8 /* WebGPUShaderModule.h */,
+				D0615FCE217FE5C6008A48A8 /* WebGPUShaderModule.idl */,
+				D060D8872182697000339318 /* WebGPUShaderModuleDescriptor.h */,
+				D060D88421825D5F00339318 /* WebGPUShaderModuleDescriptor.idl */,
 				D0DA0BE5217930E2007FE2AC /* WebGPUSwapChain.cpp */,
 				D0DA0BE4217930E2007FE2AC /* WebGPUSwapChain.h */,
 				D0DA0BE6217930E2007FE2AC /* WebGPUSwapChain.idl */,
-				D0DA0BE821793B56007FE2AC /* WebGPUSwapChainDescriptor.h */,
-				D0DA0BE921793B56007FE2AC /* WebGPUSwapChainDescriptor.idl */,
 			);
 			path = webgpu;
 			sourceTree = "<group>";
 		};
+		D0615FD2217FFEE3008A48A8 /* cocoa */ = {
+			isa = PBXGroup;
+			children = (
+				D0615FD1217FF1E1008A48A8 /* GPUDeviceMetal.mm */,
+				D060D889218280C100339318 /* GPUShaderModuleMetal.mm */,
+			);
+			path = cocoa;
+			sourceTree = "<group>";
+		};
 		DF9AFD6F13FC31B00015FEB7 /* objc */ = {
 			isa = PBXGroup;
 			children = (

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (237722 => 237723)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -176,11 +176,10 @@
     macro(WebGLVertexArrayObject) \
     macro(WebGPU) \
     macro(WebGPUAdapter) \
-    macro(WebGPUAdapterDescriptor) \
     macro(WebGPUDevice) \
     macro(WebGPURenderingContext) \
+    macro(WebGPUShaderModule) \
     macro(WebGPUSwapChain) \
-    macro(WebGPUSwapChainDescriptor) \
     macro(WebMetalBuffer) \
     macro(WebMetalCommandBuffer) \
     macro(WebMetalCommandQueue) \

Modified: trunk/Source/WebCore/platform/Logging.h (237722 => 237723)


--- trunk/Source/WebCore/platform/Logging.h	2018-11-02 07:04:30 UTC (rev 237722)
+++ trunk/Source/WebCore/platform/Logging.h	2018-11-02 07:09:09 UTC (rev 237723)
@@ -100,6 +100,7 @@
     M(Viewports) \
     M(WebAudio) \
     M(WebGL) \
+    M(WebGPU) \
     M(WebMetal) \
     M(WebRTC) \
     M(WheelEventTestTriggers) \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to