Title: [237239] trunk
Revision
237239
Author
justin_...@apple.com
Date
2018-10-17 16:30:56 -0700 (Wed, 17 Oct 2018)

Log Message

[WebGPU] Implement WebGPU bindings up through WebGPUDevice creation
https://bugs.webkit.org/show_bug.cgi?id=190653

Reviewed by Dean Jackson.

Source/WebCore:

Test: webgpu/webgpu-enabled.html

Add WebGPU Sketch bindings for window.webgpu, WebGPUAdapter, WebGPUAdapterDescriptor,
and WebGPUDevice creation. Based off IDL commit version b6c61ee.
https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl

* CMakeLists.txt:
* DerivedSources.make:
* Modules/webgpu/DOMWindowWebGPU.cpp: Added.
(WebCore::DOMWindowWebGPU::DOMWindowWebGPU):
(WebCore::DOMWindowWebGPU::supplementName):
(WebCore::DOMWindowWebGPU::from):
(WebCore::DOMWindowWebGPU::webgpu):
(WebCore::DOMWindowWebGPU::webgpu const):
* Modules/webgpu/DOMWindowWebGPU.h: Added.
* Modules/webgpu/DOMWindowWebGPU.idl: Added.
* Modules/webgpu/WebGPU.cpp: Added.
(WebCore::WebGPU::create):
(WebCore::WebGPU::requestAdapter const):
* Modules/webgpu/WebGPU.h: Added.
* Modules/webgpu/WebGPU.idl: Added.
* Modules/webgpu/WebGPUAdapter.cpp: Added.
(WebCore::WebGPUAdapter::create):
(WebCore::WebGPUAdapter::WebGPUAdapter):
(WebCore::WebGPUAdapter::createDevice):
* Modules/webgpu/WebGPUAdapter.h: Added.
* Modules/webgpu/WebGPUAdapter.idl: Added.
* Modules/webgpu/WebGPUAdapterDescriptor.h: Added.
* Modules/webgpu/WebGPUAdapterDescriptor.idl: Added.
* Modules/webgpu/WebGPUDevice.cpp: Added.
(WebCore::WebGPUDevice::create):
(WebCore::WebGPUDevice::WebGPUDevice):
* Modules/webgpu/WebGPUDevice.h: Added.
(WebCore::WebGPUDevice::adapter const):
* Modules/webgpu/WebGPUDevice.idl: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:

LayoutTests:

Small test to validate creation of a WebGPUDevice when WebGPU is enabled.

* webgpu/webgpu-enabled.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237238 => 237239)


--- trunk/LayoutTests/ChangeLog	2018-10-17 23:10:33 UTC (rev 237238)
+++ trunk/LayoutTests/ChangeLog	2018-10-17 23:30:56 UTC (rev 237239)
@@ -1,3 +1,14 @@
+2018-10-17  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Implement WebGPU bindings up through WebGPUDevice creation
+        https://bugs.webkit.org/show_bug.cgi?id=190653
+
+        Reviewed by Dean Jackson.
+
+        Small test to validate creation of a WebGPUDevice when WebGPU is enabled.
+
+        * webgpu/webgpu-enabled.html: Added.
+
 2018-10-17  Andy Estes  <aes...@apple.com>
 
         [Apple Pay] Increment the API version to 5

Added: trunk/LayoutTests/webgpu/webgpu-enabled.html (0 => 237239)


--- trunk/LayoutTests/webgpu/webgpu-enabled.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/webgpu-enabled.html	2018-10-17 23:30:56 UTC (rev 237239)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<script src=""
+
+<script>
+if (window.testRunner)
+    window.testRunner.dumpAsText();
+
+function runTest() {
+    shouldBeDefined(window.webgpu);
+    window.webgpu.requestAdapter({ powerPreference: "default" }).then(adapter => {
+        shouldBeDefined(adapter);
+        let defaultDevice = adapter.createDevice();
+        shouldBeDefined(defaultDevice);
+    }).catch(error => {
+        testFailed(error);
+    });
+}
+
+runTest();
+
+var successfullyParsed = true;
+</script>
+
+<script src=""
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/CMakeLists.txt (237238 => 237239)


--- trunk/Source/WebCore/CMakeLists.txt	2018-10-17 23:10:33 UTC (rev 237238)
+++ trunk/Source/WebCore/CMakeLists.txt	2018-10-17 23:30:56 UTC (rev 237239)
@@ -51,6 +51,7 @@
     "${WEBCORE_DIR}/Modules/webauthn"
     "${WEBCORE_DIR}/Modules/webdatabase"
     "${WEBCORE_DIR}/Modules/webdriver"
+    "${WEBCORE_DIR}/Modules/webgpu"
     "${WEBCORE_DIR}/Modules/websockets"
     "${WEBCORE_DIR}/Modules/webvr"
     "${WEBCORE_DIR}/accessibility"
@@ -187,6 +188,7 @@
     Modules/streams
     Modules/webaudio
     Modules/webdatabase
+    Modules/webgpu
     Modules/websockets
     Modules/webvr
 
@@ -444,6 +446,12 @@
 
     Modules/webdriver/NavigatorWebDriver.idl
 
+    Modules/webgpu/DOMWindowWebGPU.idl
+    Modules/webgpu/WebGPU.idl
+    Modules/webgpu/WebGPUAdapter.idl
+    Modules/webgpu/WebGPUAdapterDescriptor.idl
+    Modules/webgpu/WebGPUDevice.idl
+
     Modules/websockets/CloseEvent.idl
     Modules/websockets/WebSocket.idl
 

Modified: trunk/Source/WebCore/ChangeLog (237238 => 237239)


--- trunk/Source/WebCore/ChangeLog	2018-10-17 23:10:33 UTC (rev 237238)
+++ trunk/Source/WebCore/ChangeLog	2018-10-17 23:30:56 UTC (rev 237239)
@@ -1,3 +1,49 @@
+2018-10-17  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Implement WebGPU bindings up through WebGPUDevice creation
+        https://bugs.webkit.org/show_bug.cgi?id=190653
+
+        Reviewed by Dean Jackson.
+
+        Test: webgpu/webgpu-enabled.html
+
+        Add WebGPU Sketch bindings for window.webgpu, WebGPUAdapter, WebGPUAdapterDescriptor,
+        and WebGPUDevice creation. Based off IDL commit version b6c61ee. 
+        https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Modules/webgpu/DOMWindowWebGPU.cpp: Added.
+        (WebCore::DOMWindowWebGPU::DOMWindowWebGPU):
+        (WebCore::DOMWindowWebGPU::supplementName):
+        (WebCore::DOMWindowWebGPU::from):
+        (WebCore::DOMWindowWebGPU::webgpu):
+        (WebCore::DOMWindowWebGPU::webgpu const):
+        * Modules/webgpu/DOMWindowWebGPU.h: Added.
+        * Modules/webgpu/DOMWindowWebGPU.idl: Added.
+        * Modules/webgpu/WebGPU.cpp: Added.
+        (WebCore::WebGPU::create):
+        (WebCore::WebGPU::requestAdapter const):
+        * Modules/webgpu/WebGPU.h: Added.
+        * Modules/webgpu/WebGPU.idl: Added.
+        * Modules/webgpu/WebGPUAdapter.cpp: Added.
+        (WebCore::WebGPUAdapter::create):
+        (WebCore::WebGPUAdapter::WebGPUAdapter):
+        (WebCore::WebGPUAdapter::createDevice):
+        * Modules/webgpu/WebGPUAdapter.h: Added.
+        * Modules/webgpu/WebGPUAdapter.idl: Added.
+        * Modules/webgpu/WebGPUAdapterDescriptor.h: Added.
+        * Modules/webgpu/WebGPUAdapterDescriptor.idl: Added.
+        * Modules/webgpu/WebGPUDevice.cpp: Added.
+        (WebCore::WebGPUDevice::create):
+        (WebCore::WebGPUDevice::WebGPUDevice):
+        * Modules/webgpu/WebGPUDevice.h: Added.
+        (WebCore::WebGPUDevice::adapter const):
+        * Modules/webgpu/WebGPUDevice.idl: Added.
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+
 2018-10-17  Andy Estes  <aes...@apple.com>
 
         [Apple Pay] Increment the API version to 5

Modified: trunk/Source/WebCore/DerivedSources.make (237238 => 237239)


--- trunk/Source/WebCore/DerivedSources.make	2018-10-17 23:10:33 UTC (rev 237238)
+++ trunk/Source/WebCore/DerivedSources.make	2018-10-17 23:30:56 UTC (rev 237239)
@@ -59,6 +59,7 @@
     $(WebCore)/Modules/webdatabase \
     $(WebCore)/Modules/webdriver \
     $(WebCore)/Modules/websockets \
+    $(WebCore)/Modules/webgpu \
     $(WebCore)/Modules/webvr \
     $(WebCore)/accessibility \
     $(WebCore)/animation \
@@ -365,6 +366,11 @@
     $(WebCore)/Modules/webdatabase/SQLTransactionCallback.idl \
     $(WebCore)/Modules/webdatabase/SQLTransactionErrorCallback.idl \
     $(WebCore)/Modules/webdriver/NavigatorWebDriver.idl \
+    $(WebCore)/Modules/webgpu/DOMWindowWebGPU.idl \
+    $(WebCore)/Modules/webgpu/WebGPU.idl \
+    $(WebCore)/Modules/webgpu/WebGPUAdapter.idl \
+    $(WebCore)/Modules/webgpu/WebGPUAdapterDescriptor.idl \
+    $(WebCore)/Modules/webgpu/WebGPUDevice.idl \
     $(WebCore)/Modules/websockets/CloseEvent.idl \
     $(WebCore)/Modules/websockets/WebSocket.idl \
     $(WebCore)/Modules/webvr/DOMWindowWebVR.idl \

Added: trunk/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.cpp (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.cpp	2018-10-17 23:30:56 UTC (rev 237239)
@@ -0,0 +1,74 @@
+/*
+ * 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 "DOMWindowWebGPU.h"
+
+#if ENABLE(WEBGPU)
+
+#include "DOMWindow.h"
+#include "RuntimeEnabledFeatures.h"
+#include "WebGPU.h"
+
+namespace WebCore {
+
+DOMWindowWebGPU::DOMWindowWebGPU(DOMWindow* window)
+    : DOMWindowProperty(window)
+{
+}
+
+const char* DOMWindowWebGPU::supplementName()
+{
+    return "DOMWindowWebGPU";
+}
+
+DOMWindowWebGPU* DOMWindowWebGPU::from(DOMWindow* window)
+{
+    DOMWindowWebGPU* supplement = static_cast<DOMWindowWebGPU*>(Supplement<DOMWindow>::from(window, supplementName()));
+    if (!supplement) {
+        auto newSupplement = std::make_unique<DOMWindowWebGPU>(window);
+        supplement = newSupplement.get();
+        provideTo(window, supplementName(), WTFMove(newSupplement));
+    }
+    return supplement;
+}
+
+WebGPU* DOMWindowWebGPU::webgpu(DOMWindow& window)
+{
+    return DOMWindowWebGPU::from(&window)->webgpu();
+}
+
+WebGPU* DOMWindowWebGPU::webgpu() const
+{
+    ASSERT(RuntimeEnabledFeatures::sharedFeatures().webGPUEnabled());
+
+    if (!m_webgpu && frame())
+        m_webgpu = WebGPU::create();
+    return m_webgpu.get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Added: trunk/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.h (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.h	2018-10-17 23:30:56 UTC (rev 237239)
@@ -0,0 +1,54 @@
+/*
+ * 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 "DOMWindowProperty.h"
+#include "Supplementable.h"
+
+namespace WebCore {
+
+class DOMWindow;
+class WebGPU;
+
+class DOMWindowWebGPU : public Supplement<DOMWindow>, public DOMWindowProperty {
+public:
+    explicit DOMWindowWebGPU(DOMWindow*);
+    virtual ~DOMWindowWebGPU() = default;
+    static DOMWindowWebGPU* from(DOMWindow*);
+    static WebGPU* webgpu(DOMWindow&);
+    WebGPU* webgpu() const;
+
+private:
+    static const char* supplementName();
+
+    mutable RefPtr<WebGPU> m_webgpu;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Added: trunk/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.idl (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.idl	2018-10-17 23:30:56 UTC (rev 237239)
@@ -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
+] partial interface DOMWindow {
+    [Replaceable, SameObject] readonly attribute WebGPU webgpu;
+};

Added: trunk/Source/WebCore/Modules/webgpu/WebGPU.cpp (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPU.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPU.cpp	2018-10-17 23:30:56 UTC (rev 237239)
@@ -0,0 +1,47 @@
+/*
+ * 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 "WebGPU.h"
+
+#if ENABLE(WEBGPU)
+
+#include "JSWebGPUAdapter.h"
+
+namespace WebCore {
+
+Ref<WebGPU> WebGPU::create()
+{
+    return adoptRef(*new WebGPU);
+}
+
+void WebGPU::requestAdapter(const WebGPUAdapterDescriptor& descriptor, WebGPUAdapterPromise&& deferred) const
+{
+    deferred.resolve(WebGPUAdapter::create(descriptor));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Added: trunk/Source/WebCore/Modules/webgpu/WebGPU.h (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPU.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPU.h	2018-10-17 23:30:56 UTC (rev 237239)
@@ -0,0 +1,52 @@
+/*
+ * 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 "JSDOMPromiseDeferred.h"
+
+namespace WebCore {
+
+class WebGPUAdapter;
+
+struct WebGPUAdapterDescriptor;
+
+class WebGPU : public RefCounted<WebGPU> {
+public:
+    static Ref<WebGPU> create();
+
+    using WebGPUAdapterPromise = DOMPromiseDeferred<IDLInterface<WebGPUAdapter>>;
+
+    void requestAdapter(const WebGPUAdapterDescriptor&, WebGPUAdapterPromise&&) const;
+
+private:
+    WebGPU() = default;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Added: trunk/Source/WebCore/Modules/webgpu/WebGPU.idl (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPU.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPU.idl	2018-10-17 23:30:56 UTC (rev 237239)
@@ -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,
+    ImplementationLacksVTable
+] interface WebGPU {
+    Promise<WebGPUAdapter> requestAdapter(WebGPUAdapterDescriptor desc);
+};

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.cpp (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.cpp	2018-10-17 23:30:56 UTC (rev 237239)
@@ -0,0 +1,55 @@
+/*
+ * 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 "WebGPUAdapter.h"
+
+#if ENABLE(WEBGPU)
+
+#include "ScriptExecutionContext.h"
+#include "WebGPUAdapterDescriptor.h"
+#include "WebGPUDevice.h"
+
+namespace WebCore {
+
+Ref<WebGPUAdapter> WebGPUAdapter::create(const WebGPUAdapterDescriptor& descriptor)
+{
+    return adoptRef(*new WebGPUAdapter(descriptor));
+}
+
+WebGPUAdapter::WebGPUAdapter(const WebGPUAdapterDescriptor& descriptor)
+    : m_descriptor(descriptor)
+{
+    UNUSED_PARAM(m_descriptor);
+}
+
+Ref<WebGPUDevice> WebGPUAdapter::createDevice(ScriptExecutionContext& context)
+{
+    return WebGPUDevice::create(context, *this);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.h (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.h	2018-10-17 23:30:56 UTC (rev 237239)
@@ -0,0 +1,53 @@
+/*
+ * 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 ScriptExecutionContext;
+class WebGPUDevice;
+
+struct WebGPUAdapterDescriptor;
+
+class WebGPUAdapter : public RefCounted<WebGPUAdapter> {
+public:
+    static Ref<WebGPUAdapter> create(const WebGPUAdapterDescriptor&);
+
+    Ref<WebGPUDevice> createDevice(ScriptExecutionContext&);
+
+private:
+    WebGPUAdapter(const WebGPUAdapterDescriptor&);
+
+    const WebGPUAdapterDescriptor& m_descriptor;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.idl (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUAdapter.idl	2018-10-17 23:30:56 UTC (rev 237239)
@@ -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
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
+] interface WebGPUAdapter {
+    // readonly attribute DOMString name;
+    // readonly attribute WebGPUExtensions extensions;
+    // readonly attribute WebGPULimits limits; Don't expose higher limits for now.
+
+    [CallWith=ScriptExecutionContext] WebGPUDevice createDevice(/*WebGPUDeviceDescriptor descriptor*/);
+};

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUAdapterDescriptor.h (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUAdapterDescriptor.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUAdapterDescriptor.h	2018-10-17 23:30:56 UTC (rev 237239)
@@ -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)
+
+namespace WebCore {
+
+struct WebGPUAdapterDescriptor {
+    enum class PowerPreference {
+        Default,
+        LowPower,
+        HighPerformance
+    };
+
+    PowerPreference powerPreference = PowerPreference::Default;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUAdapterDescriptor.idl (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUAdapterDescriptor.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUAdapterDescriptor.idl	2018-10-17 23:30:56 UTC (rev 237239)
@@ -0,0 +1,38 @@
+/*
+ * 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 WebGPUPowerPreference {
+    "default",
+    "low-power",
+    "high-performance"
+};
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] dictionary WebGPUAdapterDescriptor {
+    WebGPUPowerPreference powerPreference = "default";
+};

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp	2018-10-17 23:30:56 UTC (rev 237239)
@@ -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.
+ */
+
+#include "config.h"
+#include "WebGPUDevice.h"
+
+#if ENABLE(WEBGPU)
+
+namespace WebCore {
+
+Ref<WebGPUDevice> WebGPUDevice::create(ScriptExecutionContext&, Ref<WebGPUAdapter>&& adapter)
+{
+    return adoptRef(*new WebGPUDevice(WTFMove(adapter)));
+}
+
+WebGPUDevice::WebGPUDevice(Ref<WebGPUAdapter>&& adapter)
+    : m_adapter(WTFMove(adapter))
+{
+    UNUSED_PARAM(m_adapter);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h	2018-10-17 23:30:56 UTC (rev 237239)
@@ -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.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class ScriptExecutionContext;
+class WebGPUAdapter;
+
+class WebGPUDevice : public RefCounted<WebGPUDevice> {
+public:
+    static Ref<WebGPUDevice> create(ScriptExecutionContext&, Ref<WebGPUAdapter>&&);
+
+    WebGPUAdapter& adapter() const { return m_adapter.get(); }
+
+private:
+    WebGPUDevice(Ref<WebGPUAdapter>&&);
+
+    Ref<WebGPUAdapter> m_adapter;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl (0 => 237239)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl	2018-10-17 23:30:56 UTC (rev 237239)
@@ -0,0 +1,61 @@
+/*
+ * 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 WebGPUDevice {
+    // readonly attribute WebGPUExtensions extensions;
+    // readonly attribute WebGPULimits limits;
+    readonly attribute WebGPUAdapter adapter;
+
+/*
+    WebGPUBuffer createBuffer(WebGPUBufferDescriptor descriptor);
+    WebGPUTexture createTexture(WebGPUTextureDescriptor descriptor);
+    WebGPUSampler createSampler(WebGPUSamplerDescriptor descriptor);
+
+    WebGPUBindGroupLayout createBindGroupLayout(WebGPUBindGroupLayoutDescriptor descriptor);
+    WebGPUPipelineLayout createPipelineLayout(WebGPUPipelineLayoutDescriptor descriptor);
+    WebGPUBindGroup createBindGroup(WebGPUBindGroupDescriptor descriptor);
+
+    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);
+
+    WebGPUCommandBuffer createCommandBuffer(WebGPUCommandBufferDescriptor descriptor);
+    WebGPUFence createFence(WebGPUFenceDescriptor descriptor);
+
+    WebGPUQueue getQueue();
+
+    attribute WebGPULogCallback onLog;
+    WebGPUObjectStatusQuery getObjectStatus(StatusableObject statusableObject);
+*/
+};

Modified: trunk/Source/WebCore/Sources.txt (237238 => 237239)


--- trunk/Source/WebCore/Sources.txt	2018-10-17 23:10:33 UTC (rev 237238)
+++ trunk/Source/WebCore/Sources.txt	2018-10-17 23:30:56 UTC (rev 237239)
@@ -295,6 +295,11 @@
 Modules/websockets/WebSocketHandshake.cpp
 Modules/websockets/WorkerThreadableWebSocketChannel.cpp
 
+Modules/webgpu/DOMWindowWebGPU.cpp
+Modules/webgpu/WebGPU.cpp
+Modules/webgpu/WebGPUAdapter.cpp
+Modules/webgpu/WebGPUDevice.cpp
+
 Modules/webvr/NavigatorWebVR.cpp
 Modules/webvr/VRDisplay.cpp
 Modules/webvr/VRDisplayEvent.cpp
@@ -2576,6 +2581,7 @@
 JSDOMWindowIndexedDatabase.cpp
 JSDOMWindowSpeechSynthesis.cpp
 JSDOMWindowWebDatabase.cpp
+JSDOMWindowWebGPU.cpp
 JSDOMWindowWebVR.cpp
 JSDataTransfer.cpp
 JSDataTransferItem.cpp
@@ -3160,6 +3166,10 @@
 JSVoidCallback.cpp
 JSWaveShaperNode.cpp
 JSWebAnimation.cpp
+JSWebGPU.cpp
+JSWebGPUAdapter.cpp
+JSWebGPUAdapterDescriptor.cpp
+JSWebGPUDevice.cpp
 JSWebMetalBuffer.cpp
 JSWebMetalCommandBuffer.cpp
 JSWebMetalCommandQueue.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (237238 => 237239)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-10-17 23:10:33 UTC (rev 237238)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-10-17 23:30:56 UTC (rev 237239)
@@ -13637,6 +13637,20 @@
 		D000EBA111BDAFD400C47726 /* FrameLoaderStateMachine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameLoaderStateMachine.h; sourceTree = "<group>"; };
 		D000ED2511C1B9CD00C47726 /* SubframeLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubframeLoader.cpp; sourceTree = "<group>"; };
 		D000ED2611C1B9CD00C47726 /* SubframeLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubframeLoader.h; sourceTree = "<group>"; };
+		D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMWindowWebGPU.h; sourceTree = "<group>"; };
+		D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowWebGPU.cpp; sourceTree = "<group>"; };
+		D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMWindowWebGPU.idl; sourceTree = "<group>"; };
+		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>"; };
+		D00F595221701D8C000D71DB /* WebGPUDevice.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUDevice.h; sourceTree = "<group>"; };
+		D00F595321701D8C000D71DB /* WebGPUDevice.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUDevice.cpp; sourceTree = "<group>"; };
+		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>"; };
 		D02F854E21682A4A0088EE74 /* WebMetalCommandQueue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebMetalCommandQueue.idl; sourceTree = "<group>"; };
@@ -21243,6 +21257,7 @@
 				57D8462A1FEAF57F00CA3682 /* webauthn */,
 				97BC69D51505F054001B74AC /* webdatabase */,
 				996E59DA1DF00D45006612B9 /* webdriver */,
+				D00F593E216ECC43000D71DB /* webgpu */,
 				97AABCF714FA09B5007457AE /* websockets */,
 				2DDE1CAB1F57475900D1A365 /* webvr */,
 			);
@@ -25295,6 +25310,27 @@
 			path = ios;
 			sourceTree = "<group>";
 		};
+		D00F593E216ECC43000D71DB /* webgpu */ = {
+			isa = PBXGroup;
+			children = (
+				D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */,
+				D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */,
+				D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */,
+				D00F5947216EFE54000D71DB /* WebGPU.cpp */,
+				D00F5946216EFE54000D71DB /* WebGPU.h */,
+				D00F5948216EFE54000D71DB /* WebGPU.idl */,
+				D00F5950216FFAC2000D71DB /* WebGPUAdapter.cpp */,
+				D00F594F216FFAC2000D71DB /* WebGPUAdapter.h */,
+				D00F5951216FFAC2000D71DB /* WebGPUAdapter.idl */,
+				D00F594E216FF6F0000D71DB /* WebGPUAdapterDescriptor.h */,
+				D00F594C216FDF8E000D71DB /* WebGPUAdapterDescriptor.idl */,
+				D00F595321701D8C000D71DB /* WebGPUDevice.cpp */,
+				D00F595221701D8C000D71DB /* WebGPUDevice.h */,
+				D00F595421701D8C000D71DB /* WebGPUDevice.idl */,
+			);
+			path = webgpu;
+			sourceTree = "<group>";
+		};
 		DF9AFD6F13FC31B00015FEB7 /* objc */ = {
 			isa = PBXGroup;
 			children = (

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (237238 => 237239)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2018-10-17 23:10:33 UTC (rev 237238)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2018-10-17 23:30:56 UTC (rev 237239)
@@ -172,6 +172,10 @@
     macro(VisualViewport) \
     macro(WebGL2RenderingContext) \
     macro(WebGLVertexArrayObject) \
+    macro(WebGPU) \
+    macro(WebGPUAdapter) \
+    macro(WebGPUAdapterDescriptor) \
+    macro(WebGPUDevice) \
     macro(WebMetalBuffer) \
     macro(WebMetalCommandBuffer) \
     macro(WebMetalCommandQueue) \
@@ -318,6 +322,7 @@
     macro(webkitIDBRequest) \
     macro(webkitIDBTransaction) \
     macro(webkitIndexedDB) \
+    macro(webgpu) \
     macro(window) \
     macro(writing)
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to