[WebGPU] Implement WebGPUBindGroupLayoutDescriptor and its supporting dictionaries
authorjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Dec 2018 21:34:18 +0000 (21:34 +0000)
committerjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Dec 2018 21:34:18 +0000 (21:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192726

Reviewed by Myles C. Maxfield.

Source/WebCore:

Test: webgpu/bind-group-layouts.html
Implement the WebGPUBindGroupLayoutDescriptor struct and its sub-structs:
* Modules/streams/WebGPUBindGroupLayoutDescriptor.h: Added.
* Modules/streams/WebGPUBindGroupLayoutDescriptor.idl: Added.
* Modules/webgpu/WebGPUBindGroupLayoutBinding.h: Added.
* Modules/webgpu/WebGPUBindGroupLayoutBinding.idl: Added.
* Modules/webgpu/WebGPUShaderStageBit.h: Added.
* Modules/webgpu/WebGPUShaderStageBit.idl: Added.
* platform/graphics/gpu/GPUBindGroupLayoutBinding.h: Added.
* platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h: Added.

Add the new symbols and files to the project:
* CMakeLists.txt:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:

Small FIXME update for later:
* platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
(WebCore::GPURenderPassEncoder::setVertexBuffers):

LayoutTests:

Add simple test to ensure a WebGPUBindGroupLayoutDescriptor can be created.

* webgpu/bind-group-layouts-expected.txt: Added.
* webgpu/bind-group-layouts.html: Added.

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

18 files changed:
LayoutTests/ChangeLog
LayoutTests/webgpu/bind-group-layouts-expected.txt [new file with mode: 0644]
LayoutTests/webgpu/bind-group-layouts.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl [new file with mode: 0644]
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm

index e57880b..09e1a8e 100644 (file)
@@ -1,3 +1,15 @@
+2018-12-17  Justin Fan  <justin_fan@apple.com>
+
+        [WebGPU] Implement WebGPUBindGroupLayoutDescriptor and its supporting dictionaries
+        https://bugs.webkit.org/show_bug.cgi?id=192726
+
+        Reviewed by Myles C. Maxfield.
+
+        Add simple test to ensure a WebGPUBindGroupLayoutDescriptor can be created.
+
+        * webgpu/bind-group-layouts-expected.txt: Added.
+        * webgpu/bind-group-layouts.html: Added.
+
 2018-12-17  Zalan Bujtas  <zalan@apple.com>
 
         Reproducible ASSERTion failure when toggling layer borders with find-in-page up
diff --git a/LayoutTests/webgpu/bind-group-layouts-expected.txt b/LayoutTests/webgpu/bind-group-layouts-expected.txt
new file mode 100644 (file)
index 0000000..b591f51
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Create WebGPUBindGroupLayoutDescriptor. 
+
diff --git a/LayoutTests/webgpu/bind-group-layouts.html b/LayoutTests/webgpu/bind-group-layouts.html
new file mode 100644 (file)
index 0000000..3191b20
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] -->
+<meta charset=utf-8>
+<title>Create WebGPUBindGroupLayoutDescriptor.</title>
+<body>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+function createBindGroupLayoutBinding() {
+    return {
+        binding: 0,
+        visibility: WebGPUShaderStageBit.FRAGMENT | WebGPUShaderStageBit.VERTEX,
+        type: "storageBuffer"
+    };
+}
+
+test(() => {
+    const bindGroupLayoutBinding = createBindGroupLayoutBinding();
+    const bindGroupLayoutDescriptor = { bindings: [bindGroupLayoutBinding] };
+    assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & WebGPUShaderStageBit.FRAGMENT, 0);
+    assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & WebGPUShaderStageBit.VERTEX, 0);
+    assert_equals(bindGroupLayoutDescriptor.bindings[0].type, "storageBuffer");
+});
+
+</script>
+</body>
\ No newline at end of file
index 0bdd29c..df7da0f 100644 (file)
@@ -458,6 +458,8 @@ set(WebCore_NON_SVG_IDL_FILES
     Modules/webgpu/WebGPU.idl
     Modules/webgpu/WebGPUAdapter.idl
     Modules/webgpu/WebGPUAdapterDescriptor.idl
+    Modules/webgpu/WebGPUBindGroupLayoutBinding.idl
+    Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl
     Modules/webgpu/WebGPUBuffer.idl
     Modules/webgpu/WebGPUBufferDescriptor.idl
     Modules/webgpu/WebGPUBufferUsage.idl
@@ -479,6 +481,7 @@ set(WebCore_NON_SVG_IDL_FILES
     Modules/webgpu/WebGPURenderingContext.idl
     Modules/webgpu/WebGPUShaderModule.idl
     Modules/webgpu/WebGPUShaderModuleDescriptor.idl
+    Modules/webgpu/WebGPUShaderStageBit.idl
     Modules/webgpu/WebGPUSwapChain.idl
     Modules/webgpu/WebGPUTexture.idl
     Modules/webgpu/WebGPUTextureFormatEnum.idl
index 180f781..90a2265 100644 (file)
@@ -1,3 +1,32 @@
+2018-12-17  Justin Fan  <justin_fan@apple.com>
+
+        [WebGPU] Implement WebGPUBindGroupLayoutDescriptor and its supporting dictionaries
+        https://bugs.webkit.org/show_bug.cgi?id=192726
+
+        Reviewed by Myles C. Maxfield.
+
+        Test: webgpu/bind-group-layouts.html
+        Implement the WebGPUBindGroupLayoutDescriptor struct and its sub-structs:
+        * Modules/streams/WebGPUBindGroupLayoutDescriptor.h: Added.
+        * Modules/streams/WebGPUBindGroupLayoutDescriptor.idl: Added.
+        * Modules/webgpu/WebGPUBindGroupLayoutBinding.h: Added.
+        * Modules/webgpu/WebGPUBindGroupLayoutBinding.idl: Added.
+        * Modules/webgpu/WebGPUShaderStageBit.h: Added.
+        * Modules/webgpu/WebGPUShaderStageBit.idl: Added.
+        * platform/graphics/gpu/GPUBindGroupLayoutBinding.h: Added.
+        * platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h: Added.
+
+        Add the new symbols and files to the project:
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+
+        Small FIXME update for later:
+        * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
+        (WebCore::GPURenderPassEncoder::setVertexBuffers):
+
 2018-12-17  Zalan Bujtas  <zalan@apple.com>
 
         Unreviewed build fix.
index f6f7e35..321bd43 100644 (file)
@@ -375,6 +375,8 @@ JS_BINDING_IDLS = \
     $(WebCore)/Modules/webgpu/WebGPU.idl \
     $(WebCore)/Modules/webgpu/WebGPUAdapter.idl \
     $(WebCore)/Modules/webgpu/WebGPUAdapterDescriptor.idl \
+    $(WebCore)/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl \
+    $(WebCore)/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl \
     $(WebCore)/Modules/webgpu/WebGPUBuffer.idl \
     $(WebCore)/Modules/webgpu/WebGPUBufferDescriptor.idl \
     $(WebCore)/Modules/webgpu/WebGPUBufferUsage.idl \
@@ -396,6 +398,7 @@ JS_BINDING_IDLS = \
     $(WebCore)/Modules/webgpu/WebGPURenderingContext.idl \
     $(WebCore)/Modules/webgpu/WebGPUShaderModule.idl \
     $(WebCore)/Modules/webgpu/WebGPUShaderModuleDescriptor.idl \
+    $(WebCore)/Modules/webgpu/WebGPUShaderStageBit.idl \
     $(WebCore)/Modules/webgpu/WebGPUSwapChain.idl \
     $(WebCore)/Modules/webgpu/WebGPUTexture.idl \
     $(WebCore)/Modules/webgpu/WebGPUTextureFormatEnum.idl \
diff --git a/Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h b/Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h
new file mode 100644 (file)
index 0000000..a26fbfa
--- /dev/null
@@ -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.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include "GPUBindGroupLayoutDescriptor.h"
+
+namespace WebCore {
+
+using WebGPUBindGroupLayoutDescriptor = GPUBindGroupLayoutDescriptor;
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.h b/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.h
new file mode 100644 (file)
index 0000000..fa6ba2f
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include "GPUBindGroupLayoutBinding.h"
+#include "WebGPUShaderStageBit.h"
+
+namespace WebCore {
+
+using WebGPUBindGroupLayoutBinding = GPUBindGroupLayoutBinding;
+using WebGPUBindingType = GPUBindGroupLayoutBinding::BindingType;
+using WebGPUShaderStageFlags = GPUShaderStageFlags;
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl b/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl
new file mode 100644 (file)
index 0000000..65bf05b
--- /dev/null
@@ -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.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+typedef unsigned long u32;
+typedef u32 WebGPUShaderStageFlags;
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] enum WebGPUBindingType {
+    "uniformBuffer",
+    "sampler",
+    "sampledTexture",
+    "storageBuffer"
+    // TODO other binding types
+};
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] dictionary WebGPUBindGroupLayoutBinding {
+    u32 binding;
+    WebGPUShaderStageFlags visibility;
+    WebGPUBindingType type;
+};
+
diff --git a/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl b/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl
new file mode 100644 (file)
index 0000000..bc89ab9
--- /dev/null
@@ -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 WebGPUBindGroupLayoutDescriptor {
+    sequence<WebGPUBindGroupLayoutBinding> bindings;
+};
diff --git a/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h b/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h
new file mode 100644 (file)
index 0000000..841320a
--- /dev/null
@@ -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.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include "GPUBindGroupLayoutBinding.h"
+
+namespace WebCore {
+
+using WebGPUShaderStageBit = GPUShaderStageBit;
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl b/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl
new file mode 100644 (file)
index 0000000..9eea7a4
--- /dev/null
@@ -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
+
+typedef unsigned long u32;
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
+] interface WebGPUShaderStageBit {
+    const u32 NONE = 0;
+    const u32 VERTEX = 1;
+    const u32 FRAGMENT = 2;
+    const u32 COMPUTE = 4;
+};
index b4bdb25..7352f33 100644 (file)
@@ -3222,6 +3222,8 @@ JSWebAnimation.cpp
 JSWebGPU.cpp
 JSWebGPUAdapter.cpp
 JSWebGPUAdapterDescriptor.cpp
+JSWebGPUBindGroupLayoutBinding.cpp
+JSWebGPUBindGroupLayoutDescriptor.cpp
 JSWebGPUBuffer.cpp
 JSWebGPUBufferDescriptor.cpp
 JSWebGPUBufferUsage.cpp
@@ -3243,6 +3245,7 @@ JSWebGPURenderPipeline.cpp
 JSWebGPURenderPipelineDescriptor.cpp
 JSWebGPUShaderModule.cpp
 JSWebGPUShaderModuleDescriptor.cpp
+JSWebGPUShaderStageBit.cpp
 JSWebGPUSwapChain.cpp
 JSWebGPUTexture.cpp
 JSWebGPUTextureFormatEnum.cpp
index ea4e41b..c924a49 100644 (file)
                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>"; };
+               D02B83ED21C8397A00F85473 /* WebGPUBindGroupLayoutDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBindGroupLayoutDescriptor.idl; 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>"; };
                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>"; };
                D07DEAB80A36554A00CA30F8 /* InsertListCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = InsertListCommand.h; sourceTree = "<group>"; };
+               D083D98421C48050008E8EFF /* GPUBindGroupLayoutDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUBindGroupLayoutDescriptor.h; sourceTree = "<group>"; };
+               D083D98621C4813E008E8EFF /* WebGPUBindGroupLayoutDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebGPUBindGroupLayoutDescriptor.h; path = Modules/streams/WebGPUBindGroupLayoutDescriptor.h; sourceTree = SOURCE_ROOT; };
                D0843A4A20FEBE3D00FE860E /* GraphicsContext3DManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContext3DManager.h; sourceTree = "<group>"; };
                D0843A4C20FEC16500FE860E /* GraphicsContext3DManager.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DManager.cpp; sourceTree = "<group>"; };
                D086FE9609D53AAB005BC74D /* UnlinkCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnlinkCommand.h; sourceTree = "<group>"; };
                D0A3A7301405A39800FB8ED3 /* ResourceLoaderOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoaderOptions.h; sourceTree = "<group>"; };
                D0B0556609C6700100307E43 /* CreateLinkCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CreateLinkCommand.h; sourceTree = "<group>"; };
                D0B0556709C6700100307E43 /* CreateLinkCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CreateLinkCommand.cpp; sourceTree = "<group>"; };
+               D0B8BB0121C46E78000C7681 /* GPUBindGroupLayoutBinding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUBindGroupLayoutBinding.h; sourceTree = "<group>"; };
+               D0B8BB0321C4711D000C7681 /* WebGPUShaderStageBit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUShaderStageBit.h; sourceTree = "<group>"; };
+               D0B8BB0421C4711D000C7681 /* WebGPUShaderStageBit.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUShaderStageBit.idl; sourceTree = "<group>"; };
+               D0B8BB0521C47256000C7681 /* WebGPUBindGroupLayoutBinding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUBindGroupLayoutBinding.h; sourceTree = "<group>"; };
+               D0B8BB0621C47256000C7681 /* WebGPUBindGroupLayoutBinding.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBindGroupLayoutBinding.idl; sourceTree = "<group>"; };
                D0BC54481443AC4A00E105DA /* CachedStyleSheetClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedStyleSheetClient.h; sourceTree = "<group>"; };
                D0BD4F5A1408850F006839B6 /* DictationCommandIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DictationCommandIOS.cpp; sourceTree = "<group>"; };
                D0BD4F5B1408850F006839B6 /* DictationCommandIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictationCommandIOS.h; sourceTree = "<group>"; };
                        children = (
                                D087CE3721ACA94200BDE174 /* cocoa */,
                                312FF8CE21A4C33F00EB199D /* legacy */,
+                               D0B8BB0121C46E78000C7681 /* GPUBindGroupLayoutBinding.h */,
+                               D083D98421C48050008E8EFF /* GPUBindGroupLayoutDescriptor.h */,
                                D0D8649221B760F2003C983C /* GPUBuffer.h */,
                                D0D8648721B64CAA003C983C /* GPUBufferDescriptor.h */,
                                D001D9AB21B0C7BF0023B9BC /* GPUColor.h */,
                                D00F5951216FFAC2000D71DB /* WebGPUAdapter.idl */,
                                D02C26912181416D00D818E4 /* WebGPUAdapterDescriptor.h */,
                                D02C26922181416D00D818E4 /* WebGPUAdapterDescriptor.idl */,
+                               D0B8BB0521C47256000C7681 /* WebGPUBindGroupLayoutBinding.h */,
+                               D0B8BB0621C47256000C7681 /* WebGPUBindGroupLayoutBinding.idl */,
+                               D083D98621C4813E008E8EFF /* WebGPUBindGroupLayoutDescriptor.h */,
+                               D02B83ED21C8397A00F85473 /* WebGPUBindGroupLayoutDescriptor.idl */,
                                D0D8648D21B70676003C983C /* WebGPUBuffer.cpp */,
                                D0D8648C21B70676003C983C /* WebGPUBuffer.h */,
                                D0D8648E21B70676003C983C /* WebGPUBuffer.idl */,
                                D0615FCE217FE5C6008A48A8 /* WebGPUShaderModule.idl */,
                                D060D8872182697000339318 /* WebGPUShaderModuleDescriptor.h */,
                                D060D88421825D5F00339318 /* WebGPUShaderModuleDescriptor.idl */,
+                               D0B8BB0321C4711D000C7681 /* WebGPUShaderStageBit.h */,
+                               D0B8BB0421C4711D000C7681 /* WebGPUShaderStageBit.idl */,
                                D0DA0BE5217930E2007FE2AC /* WebGPUSwapChain.cpp */,
                                D0DA0BE4217930E2007FE2AC /* WebGPUSwapChain.h */,
                                D0DA0BE6217930E2007FE2AC /* WebGPUSwapChain.idl */,
index e0b397f..6d1c518 100644 (file)
@@ -201,6 +201,7 @@ namespace WebCore {
     macro(WebGPURenderPassEncoder) \
     macro(WebGPURenderPipeline) \
     macro(WebGPUShaderModule) \
+    macro(WebGPUShaderStageBit) \
     macro(WebGPUSwapChain) \
     macro(WebGPUTexture) \
     macro(WebGPUTextureView) \
diff --git a/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h b/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h
new file mode 100644 (file)
index 0000000..ae10d9b
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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 {
+
+using GPUShaderStageFlags = unsigned long;
+
+class GPUShaderStageBit : public RefCounted<GPUShaderStageBit> {
+public:
+    static const GPUShaderStageFlags NONE = 0;
+    static const GPUShaderStageFlags VERTEX = 1;
+    static const GPUShaderStageFlags FRAGMENT = 2;
+    static const GPUShaderStageFlags COMPUTE = 4;
+};
+
+struct GPUBindGroupLayoutBinding {
+    enum class BindingType {
+        UniformBuffer,
+        Sampler,
+        SampledTexture,
+        StorageBuffer
+    };
+
+    unsigned long binding;
+    GPUShaderStageFlags visibility;
+    BindingType type;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h b/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h
new file mode 100644 (file)
index 0000000..b347645
--- /dev/null
@@ -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.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include "GPUBindGroupLayoutBinding.h"
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+struct GPUBindGroupLayoutDescriptor {
+    Vector<GPUBindGroupLayoutBinding> bindings;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
+
index 5a73bee..5565063 100644 (file)
@@ -88,6 +88,7 @@ void GPURenderPassEncoder::setVertexBuffers(unsigned long index, Vector<Ref<cons
 {
     ASSERT(buffers.size() && offsets.size() == buffers.size());
     // FIXME: Only worry about the first buffer for now, and treat startSlot as the index.
+    // FIXME: Replace with MTLRenderPassEncoder::setVertexBuffers.
     [m_platformRenderPassEncoder setVertexBuffer:buffers[0]->platformBuffer() offset:offsets[0] atIndex:index];
 }