Title: [239288] trunk
Revision
239288
Author
justin_...@apple.com
Date
2018-12-17 13:34:18 -0800 (Mon, 17 Dec 2018)

Log Message

[WebGPU] Implement WebGPUBindGroupLayoutDescriptor and its supporting dictionaries
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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239287 => 239288)


--- trunk/LayoutTests/ChangeLog	2018-12-17 21:32:39 UTC (rev 239287)
+++ trunk/LayoutTests/ChangeLog	2018-12-17 21:34:18 UTC (rev 239288)
@@ -1,3 +1,15 @@
+2018-12-17  Justin Fan  <justin_...@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  <za...@apple.com>
 
         Reproducible ASSERTion failure when toggling layer borders with find-in-page up

Added: trunk/LayoutTests/webgpu/bind-group-layouts-expected.txt (0 => 239288)


--- trunk/LayoutTests/webgpu/bind-group-layouts-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webgpu/bind-group-layouts-expected.txt	2018-12-17 21:34:18 UTC (rev 239288)
@@ -0,0 +1,3 @@
+
+PASS Create WebGPUBindGroupLayoutDescriptor. 
+

Added: trunk/LayoutTests/webgpu/bind-group-layouts.html (0 => 239288)


--- trunk/LayoutTests/webgpu/bind-group-layouts.html	                        (rev 0)
+++ trunk/LayoutTests/webgpu/bind-group-layouts.html	2018-12-17 21:34:18 UTC (rev 239288)
@@ -0,0 +1,25 @@
+<!DOCTYPE html><!-- webkit-test-runner [ experimental:WebGPUEnabled=true ] -->
+<meta charset=utf-8>
+<title>Create WebGPUBindGroupLayoutDescriptor.</title>
+<body>
+<script src=""
+<script src=""
+<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

Modified: trunk/Source/WebCore/CMakeLists.txt (239287 => 239288)


--- trunk/Source/WebCore/CMakeLists.txt	2018-12-17 21:32:39 UTC (rev 239287)
+++ trunk/Source/WebCore/CMakeLists.txt	2018-12-17 21:34:18 UTC (rev 239288)
@@ -458,6 +458,8 @@
     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 @@
     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

Modified: trunk/Source/WebCore/ChangeLog (239287 => 239288)


--- trunk/Source/WebCore/ChangeLog	2018-12-17 21:32:39 UTC (rev 239287)
+++ trunk/Source/WebCore/ChangeLog	2018-12-17 21:34:18 UTC (rev 239288)
@@ -1,3 +1,32 @@
+2018-12-17  Justin Fan  <justin_...@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  <za...@apple.com>
 
         Unreviewed build fix.

Modified: trunk/Source/WebCore/DerivedSources.make (239287 => 239288)


--- trunk/Source/WebCore/DerivedSources.make	2018-12-17 21:32:39 UTC (rev 239287)
+++ trunk/Source/WebCore/DerivedSources.make	2018-12-17 21:34:18 UTC (rev 239288)
@@ -375,6 +375,8 @@
     $(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 @@
     $(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 \

Added: trunk/Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h (0 => 239288)


--- trunk/Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h	2018-12-17 21:34:18 UTC (rev 239288)
@@ -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)

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.h (0 => 239288)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.h	2018-12-17 21:34:18 UTC (rev 239288)
@@ -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)

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl (0 => 239288)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl	2018-12-17 21:34:18 UTC (rev 239288)
@@ -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;
+};
+

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl (0 => 239288)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl	2018-12-17 21:34:18 UTC (rev 239288)
@@ -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;
+};

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h (0 => 239288)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h	2018-12-17 21:34:18 UTC (rev 239288)
@@ -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)

Added: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl (0 => 239288)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl	2018-12-17 21:34:18 UTC (rev 239288)
@@ -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;
+};

Modified: trunk/Source/WebCore/Sources.txt (239287 => 239288)


--- trunk/Source/WebCore/Sources.txt	2018-12-17 21:32:39 UTC (rev 239287)
+++ trunk/Source/WebCore/Sources.txt	2018-12-17 21:34:18 UTC (rev 239288)
@@ -3222,6 +3222,8 @@
 JSWebGPU.cpp
 JSWebGPUAdapter.cpp
 JSWebGPUAdapterDescriptor.cpp
+JSWebGPUBindGroupLayoutBinding.cpp
+JSWebGPUBindGroupLayoutDescriptor.cpp
 JSWebGPUBuffer.cpp
 JSWebGPUBufferDescriptor.cpp
 JSWebGPUBufferUsage.cpp
@@ -3243,6 +3245,7 @@
 JSWebGPURenderPipelineDescriptor.cpp
 JSWebGPUShaderModule.cpp
 JSWebGPUShaderModuleDescriptor.cpp
+JSWebGPUShaderStageBit.cpp
 JSWebGPUSwapChain.cpp
 JSWebGPUTexture.cpp
 JSWebGPUTextureFormatEnum.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (239287 => 239288)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-12-17 21:32:39 UTC (rev 239287)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-12-17 21:34:18 UTC (rev 239288)
@@ -13727,6 +13727,7 @@
 		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>"; };
@@ -13817,6 +13818,8 @@
 		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>"; };
@@ -13838,6 +13841,11 @@
 		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>"; };
@@ -18039,6 +18047,8 @@
 			children = (
 				D087CE3721ACA94200BDE174 /* cocoa */,
 				312FF8CE21A4C33F00EB199D /* legacy */,
+				D0B8BB0121C46E78000C7681 /* GPUBindGroupLayoutBinding.h */,
+				D083D98421C48050008E8EFF /* GPUBindGroupLayoutDescriptor.h */,
 				D0D8649221B760F2003C983C /* GPUBuffer.h */,
 				D0D8648721B64CAA003C983C /* GPUBufferDescriptor.h */,
 				D001D9AB21B0C7BF0023B9BC /* GPUColor.h */,
@@ -25546,6 +25556,10 @@
 				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 */,
@@ -25597,6 +25611,8 @@
 				D0615FCE217FE5C6008A48A8 /* WebGPUShaderModule.idl */,
 				D060D8872182697000339318 /* WebGPUShaderModuleDescriptor.h */,
 				D060D88421825D5F00339318 /* WebGPUShaderModuleDescriptor.idl */,
+				D0B8BB0321C4711D000C7681 /* WebGPUShaderStageBit.h */,
+				D0B8BB0421C4711D000C7681 /* WebGPUShaderStageBit.idl */,
 				D0DA0BE5217930E2007FE2AC /* WebGPUSwapChain.cpp */,
 				D0DA0BE4217930E2007FE2AC /* WebGPUSwapChain.h */,
 				D0DA0BE6217930E2007FE2AC /* WebGPUSwapChain.idl */,

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (239287 => 239288)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2018-12-17 21:32:39 UTC (rev 239287)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2018-12-17 21:34:18 UTC (rev 239288)
@@ -201,6 +201,7 @@
     macro(WebGPURenderPassEncoder) \
     macro(WebGPURenderPipeline) \
     macro(WebGPUShaderModule) \
+    macro(WebGPUShaderStageBit) \
     macro(WebGPUSwapChain) \
     macro(WebGPUTexture) \
     macro(WebGPUTextureView) \

Added: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h (0 => 239288)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h	2018-12-17 21:34:18 UTC (rev 239288)
@@ -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)

Added: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h (0 => 239288)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h	2018-12-17 21:34:18 UTC (rev 239288)
@@ -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)
+

Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm (239287 => 239288)


--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm	2018-12-17 21:32:39 UTC (rev 239287)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm	2018-12-17 21:34:18 UTC (rev 239288)
@@ -88,6 +88,7 @@
 {
     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];
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to