[WebGPU] Remove WebGPUBufferDescriptor/Usage and use GPU versions
authorjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Feb 2019 00:23:10 +0000 (00:23 +0000)
committerjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Feb 2019 00:23:10 +0000 (00:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194552

Reviewed by Dean Jackson.

WebGPUBufferDescriptor/Usage have been renamed to GPUBufferDescriptor/Usage in the Web GPU API.
Source/WebCore:

Consolidate the two versions of these classes in our implementation.

Affected layout tests updated with new names. No change in behavior.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webgpu/GPUBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferDescriptor.idl.
* Modules/webgpu/GPUBufferUsage.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferUsage.idl.
* Modules/webgpu/WebGPUBufferUsage.h: Removed.
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::createBuffer const):
* Modules/webgpu/WebGPUDevice.h:
* Modules/webgpu/WebGPUDevice.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* platform/graphics/gpu/GPUBufferDescriptor.h: Moved out GPUBufferUsage.
* platform/graphics/gpu/GPUBufferUsage.h: Moved from GPUBufferDescriptor.h.

LayoutTests:

Update affected tests to match.

* webgpu/bind-groups.html:
* webgpu/buffer-resource-triangles.html:
* webgpu/buffers.html:
* webgpu/depth-enabled-triangle-strip.html:
* webgpu/vertex-buffer-triangle-strip.html:

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

22 files changed:
LayoutTests/ChangeLog
LayoutTests/webgpu/bind-groups.html
LayoutTests/webgpu/buffer-resource-triangles.html
LayoutTests/webgpu/buffers.html
LayoutTests/webgpu/depth-enabled-triangle-strip.html
LayoutTests/webgpu/vertex-buffer-triangle-strip.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources-input.xcfilelist
Source/WebCore/DerivedSources-output.xcfilelist
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/webgpu/GPUBufferDescriptor.idl [moved from Source/WebCore/Modules/webgpu/WebGPUBufferDescriptor.idl with 90% similarity]
Source/WebCore/Modules/webgpu/GPUBufferUsage.idl [moved from Source/WebCore/Modules/webgpu/WebGPUBufferUsage.idl with 94% similarity]
Source/WebCore/Modules/webgpu/WebGPUBufferUsage.h [deleted file]
Source/WebCore/Modules/webgpu/WebGPUDevice.cpp
Source/WebCore/Modules/webgpu/WebGPUDevice.h
Source/WebCore/Modules/webgpu/WebGPUDevice.idl
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/platform/graphics/gpu/GPUBufferDescriptor.h
Source/WebCore/platform/graphics/gpu/GPUBufferUsage.h [moved from Source/WebCore/Modules/webgpu/WebGPUBufferDescriptor.h with 76% similarity]

index ace72cb..c9dbfb9 100644 (file)
@@ -1,3 +1,19 @@
+2019-02-12  Justin Fan  <justin_fan@apple.com>
+
+        [WebGPU] Remove WebGPUBufferDescriptor/Usage and use GPU versions
+        https://bugs.webkit.org/show_bug.cgi?id=194552
+
+        Reviewed by Dean Jackson.
+
+        WebGPUBufferDescriptor/Usage have been renamed to GPUBufferDescriptor/Usage in the Web GPU API.
+        Update affected tests to match.
+
+        * webgpu/bind-groups.html:
+        * webgpu/buffer-resource-triangles.html:
+        * webgpu/buffers.html:
+        * webgpu/depth-enabled-triangle-strip.html:
+        * webgpu/vertex-buffer-triangle-strip.html:
+
 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Allow pages to trigger programmatic paste from script on iOS
index 6f52f66..b572176 100644 (file)
@@ -19,7 +19,7 @@ promise_test(async () => {
 
     const bindGroupLayout = device.createBindGroupLayout({ bindings: [bufferLayoutBinding] });
 
-    const buffer = device.createBuffer({ size: 16, usage: WebGPUBufferUsage.STORAGE });
+    const buffer = device.createBuffer({ size: 16, usage: GPUBufferUsage.STORAGE });
     const bufferBinding = { buffer: buffer, offset: 0, size: 16 };
     const bindGroupBinding = { binding: 1, resource: bufferBinding };
 
index c196499..0f3a147 100644 (file)
@@ -82,7 +82,7 @@ const verticesBufferSize = vertexSize * 3;
 
 // FIXME: Keep up to date with buffer upload decisions.
 function createVerticesBuffer(device) {
-    const buffer = device.createBuffer({ size:verticesBufferSize, usage: WebGPUBufferUsage.VERTEX });
+    const buffer = device.createBuffer({ size:verticesBufferSize, usage: GPUBufferUsage.VERTEX });
 
     const vertices = [
         0, 1, 0, 1,
@@ -97,7 +97,7 @@ function createVerticesBuffer(device) {
 }
 
 function createFloat4Buffer(device, a, b) {
-    const buffer = device.createBuffer({ size: vertexSize, usage: WebGPUBufferUsage.UNIFORM });
+    const buffer = device.createBuffer({ size: vertexSize, usage: GPUBufferUsage.UNIFORM });
     
     const arrayBuffer = buffer.mapping;
     const floatArray = new Float32Array(arrayBuffer);
index 90024c9..6f70f4b 100644 (file)
@@ -8,7 +8,7 @@
 <script src="js/basic-webgpu-functions.js"></script>
 <script>
 function createBuffer() {
-    const buffer = defaultDevice.createBuffer({ size: 16, usage: WebGPUBufferUsage.MAP_WRITE });
+    const buffer = defaultDevice.createBuffer({ size: 16, usage: GPUBufferUsage.MAP_WRITE });
     assert_true(buffer instanceof WebGPUBuffer, "createBuffer returned a WebGPUBuffer");
     
     let arrayBuffer = buffer.mapping;
index a68d9d8..03e6a72 100644 (file)
@@ -46,7 +46,7 @@ fragment float4 fragment_main(VertexOut v [[stage_in]])
 
 function createVertexBuffer(device) {
     const bufferSize = 4 * 4 * 4;
-    const buffer = device.createBuffer({ size: bufferSize, usage: WebGPUBufferUsage.MAP_WRITE });
+    const buffer = device.createBuffer({ size: bufferSize, usage: GPUBufferUsage.MAP_WRITE });
     
     let floatArray = new Float32Array(buffer.mapping);
 
index 667a0a5..86f923f 100644 (file)
@@ -40,7 +40,7 @@ fragment float4 fragment_main(VertexOut v [[stage_in]])
 
 function createVertexBuffer(device) {
     const bufferSize = 4 * 5 * 4;
-    const buffer = device.createBuffer({ size: bufferSize, usage: WebGPUBufferUsage.MAP_WRITE });
+    const buffer = device.createBuffer({ size: bufferSize, usage: GPUBufferUsage.MAP_WRITE });
     
     let floatArray = new Float32Array(buffer.mapping);
 
index b2f7d51..64eab57 100644 (file)
@@ -462,6 +462,8 @@ set(WebCore_NON_SVG_IDL_FILES
     Modules/webdriver/NavigatorWebDriver.idl
 
     Modules/webgpu/DOMWindowWebGPU.idl
+    Modules/webgpu/GPUBufferDescriptor.idl
+    Modules/webgpu/GPUBufferUsage.idl
     Modules/webgpu/GPUColor.idl
     Modules/webgpu/GPUCompareFunction.idl
     Modules/webgpu/GPUDepthStencilStateDescriptor.idl
@@ -483,8 +485,6 @@ set(WebCore_NON_SVG_IDL_FILES
     Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl
     Modules/webgpu/WebGPUBuffer.idl
     Modules/webgpu/WebGPUBufferBinding.idl
-    Modules/webgpu/WebGPUBufferDescriptor.idl
-    Modules/webgpu/WebGPUBufferUsage.idl
     Modules/webgpu/WebGPUCommandBuffer.idl
     Modules/webgpu/WebGPUDevice.idl
     Modules/webgpu/WebGPUIndexFormat.idl
index c051a7b..a420326 100644 (file)
@@ -1,3 +1,32 @@
+2019-02-12  Justin Fan  <justin_fan@apple.com>
+
+        [WebGPU] Remove WebGPUBufferDescriptor/Usage and use GPU versions
+        https://bugs.webkit.org/show_bug.cgi?id=194552
+
+        Reviewed by Dean Jackson.
+
+        WebGPUBufferDescriptor/Usage have been renamed to GPUBufferDescriptor/Usage in the Web GPU API.
+        Consolidate the two versions of these classes in our implementation.
+
+        Affected layout tests updated with new names. No change in behavior.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/webgpu/GPUBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferDescriptor.idl.
+        * Modules/webgpu/GPUBufferUsage.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBufferUsage.idl.
+        * Modules/webgpu/WebGPUBufferUsage.h: Removed.
+        * Modules/webgpu/WebGPUDevice.cpp:
+        (WebCore::WebGPUDevice::createBuffer const):
+        * Modules/webgpu/WebGPUDevice.h:
+        * Modules/webgpu/WebGPUDevice.idl:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+        * platform/graphics/gpu/GPUBufferDescriptor.h: Moved out GPUBufferUsage.
+        * platform/graphics/gpu/GPUBufferUsage.h: Moved from GPUBufferDescriptor.h.
+
 2019-02-12  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Unreviewed, try to fix the internal iOS build after r241321
index d409cb8..540356d 100644 (file)
@@ -322,6 +322,8 @@ $(PROJECT_DIR)/Modules/webdatabase/SQLTransactionErrorCallback.idl
 $(PROJECT_DIR)/Modules/webdriver/NavigatorWebDriver.idl
 $(PROJECT_DIR)/Modules/webgpu/DOMWindowWebGPU.idl
 $(PROJECT_DIR)/Modules/webgpu/GPUColor.idl
+$(PROJECT_DIR)/Modules/webgpu/GPUBufferDescriptor.idl
+$(PROJECT_DIR)/Modules/webgpu/GPUBufferUsage.idl
 $(PROJECT_DIR)/Modules/webgpu/GPUCompareFunction.idl
 $(PROJECT_DIR)/Modules/webgpu/GPUDepthStencilStateDescriptor.idl
 $(PROJECT_DIR)/Modules/webgpu/GPUExtent3D.idl
index eeea5fe..c5782c3 100644 (file)
@@ -580,6 +580,10 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGCObservation.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGCObservation.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUColor.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUColor.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBufferDescriptor.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBufferDescriptor.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBufferUsage.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBufferUsage.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUCompareFunction.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUCompareFunction.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUDepthStencilStateDescriptor.cpp
index 22927ed..ab15904 100644 (file)
@@ -373,6 +373,8 @@ JS_BINDING_IDLS = \
     $(WebCore)/Modules/webdriver/NavigatorWebDriver.idl \
     $(WebCore)/Modules/webgpu/DOMWindowWebGPU.idl \
     $(WebCore)/Modules/webgpu/GPUColor.idl \
+    $(WebCore)/Modules/webgpu/GPUBufferDescriptor.idl \
+    $(WebCore)/Modules/webgpu/GPUBufferUsage.idl \
     $(WebCore)/Modules/webgpu/GPUCompareFunction.idl \
     $(WebCore)/Modules/webgpu/GPUDepthStencilStateDescriptor.idl \
     $(WebCore)/Modules/webgpu/GPUExtent3D.idl \
@@ -393,8 +395,6 @@ JS_BINDING_IDLS = \
     $(WebCore)/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl \
     $(WebCore)/Modules/webgpu/WebGPUBuffer.idl \
        $(WebCore)/Modules/webgpu/WebGPUBufferBinding.idl \
-    $(WebCore)/Modules/webgpu/WebGPUBufferDescriptor.idl \
-    $(WebCore)/Modules/webgpu/WebGPUBufferUsage.idl \
     $(WebCore)/Modules/webgpu/WebGPUCommandBuffer.idl \
     $(WebCore)/Modules/webgpu/WebGPUDevice.idl \
     $(WebCore)/Modules/webgpu/WebGPUIndexFormat.idl \
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 // https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
 
 typedef unsigned long u32;
-typedef u32 WebGPUBufferUsageFlags;
+typedef u32 GPUBufferUsageFlags;
 
 [
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
-] dictionary WebGPUBufferDescriptor {
+] dictionary GPUBufferDescriptor {
     u32 size;
-    WebGPUBufferUsageFlags usage;
+    GPUBufferUsageFlags usage;
 };
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  */
 // https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
 
+typedef unsigned long u32;
+
 [
     Conditional=WEBGPU,
     DoNotCheckConstants,
     EnabledAtRuntime=WebGPU,
     ImplementationLacksVTable
-] interface WebGPUBufferUsage {
+] interface GPUBufferUsage {
     const u32 NONE = 0;
     const u32 MAP_READ = 1;
     const u32 MAP_WRITE = 2;
diff --git a/Source/WebCore/Modules/webgpu/WebGPUBufferUsage.h b/Source/WebCore/Modules/webgpu/WebGPUBufferUsage.h
deleted file mode 100644 (file)
index b958cf3..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGPU)
-
-#include "GPUBufferDescriptor.h"
-
-namespace WebCore {
-
-using WebGPUBufferUsage = GPUBufferUsage;
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
index 3c68028..ea3b3c7 100644 (file)
@@ -32,6 +32,7 @@
 #include "GPUBindGroupBinding.h"
 #include "GPUBindGroupDescriptor.h"
 #include "GPUBufferBinding.h"
+#include "GPUBufferDescriptor.h"
 #include "GPUCommandBuffer.h"
 #include "GPUPipelineStageDescriptor.h"
 #include "GPURenderPipelineDescriptor.h"
@@ -72,10 +73,9 @@ WebGPUDevice::WebGPUDevice(Ref<WebGPUAdapter>&& adapter, Ref<GPUDevice>&& device
     UNUSED_PARAM(m_adapter);
 }
 
-RefPtr<WebGPUBuffer> WebGPUDevice::createBuffer(WebGPUBufferDescriptor&& descriptor) const
+RefPtr<WebGPUBuffer> WebGPUDevice::createBuffer(GPUBufferDescriptor&& descriptor) const
 {
-    // FIXME: Validation on descriptor needed?
-    if (auto buffer = m_device->createBuffer(GPUBufferDescriptor { descriptor.size, descriptor.usage }))
+    if (auto buffer = m_device->createBuffer(WTFMove(descriptor)))
         return WebGPUBuffer::create(buffer.releaseNonNull());
     return nullptr;
 }
index 9cae3ae..a97485f 100644 (file)
@@ -30,7 +30,6 @@
 #include "GPUDevice.h"
 #include "WebGPUAdapter.h"
 #include "WebGPUBindGroupLayoutDescriptor.h"
-#include "WebGPUBufferDescriptor.h"
 #include "WebGPUQueue.h"
 
 #include <wtf/Ref.h>
@@ -49,6 +48,7 @@ class WebGPURenderPipeline;
 class WebGPUShaderModule;
 class WebGPUTexture;
 
+struct GPUBufferDescriptor;
 struct GPUTextureDescriptor;
 struct WebGPUBindGroupDescriptor;
 struct WebGPUPipelineLayoutDescriptor;
@@ -62,7 +62,7 @@ public:
     const WebGPUAdapter& adapter() const { return m_adapter.get(); }
     const GPUDevice& device() const { return m_device.get(); }
 
-    RefPtr<WebGPUBuffer> createBuffer(WebGPUBufferDescriptor&&) const;
+    RefPtr<WebGPUBuffer> createBuffer(GPUBufferDescriptor&&) const;
     Ref<WebGPUTexture> createTexture(GPUTextureDescriptor&&) const;
 
     Ref<WebGPUBindGroupLayout> createBindGroupLayout(WebGPUBindGroupLayoutDescriptor&&) const;
index 8342a5d..ffb5748 100644 (file)
@@ -31,7 +31,7 @@
 ] interface WebGPUDevice {
     readonly attribute WebGPUAdapter adapter;
 
-    WebGPUBuffer createBuffer(WebGPUBufferDescriptor descriptor);
+    WebGPUBuffer createBuffer(GPUBufferDescriptor descriptor);
     WebGPUTexture createTexture(GPUTextureDescriptor descriptor);
 
     WebGPUBindGroupLayout createBindGroupLayout(WebGPUBindGroupLayoutDescriptor descriptor);
index fa0706b..ccf6b3a 100644 (file)
@@ -2767,6 +2767,8 @@ JSFocusEvent.cpp
 JSFontFace.cpp
 JSFontFaceSet.cpp
 JSGPUColor.cpp
+JSGPUBufferDescriptor.cpp
+JSGPUBufferUsage.cpp
 JSGPUCompareFunction.cpp
 JSGPUDepthStencilStateDescriptor.cpp
 JSGPUExtent3D.cpp
@@ -3315,8 +3317,6 @@ JSWebGPUBindGroupLayoutBinding.cpp
 JSWebGPUBindGroupLayoutDescriptor.cpp
 JSWebGPUBuffer.cpp
 JSWebGPUBufferBinding.cpp
-JSWebGPUBufferDescriptor.cpp
-JSWebGPUBufferUsage.cpp
 JSWebGPUCommandBuffer.cpp
 JSWebGPUDevice.cpp
 JSWebGPUIndexFormat.cpp
index 9e58526..13e6df6 100644 (file)
                D0B0556809C6700100307E43 /* CreateLinkCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D0B0556609C6700100307E43 /* CreateLinkCommand.h */; };
                D0BC54491443AC4A00E105DA /* CachedStyleSheetClient.h in Headers */ = {isa = PBXBuildFile; fileRef = D0BC54481443AC4A00E105DA /* CachedStyleSheetClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                D0BD4F5D1408850F006839B6 /* DictationCommandIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = D0BD4F5B1408850F006839B6 /* DictationCommandIOS.h */; };
-               D0D8648421B61727003C983C /* WebGPUBufferDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = D0D8648221B61727003C983C /* WebGPUBufferDescriptor.h */; };
                D0EDA775143E303C0028E383 /* CachedRawResource.h in Headers */ = {isa = PBXBuildFile; fileRef = D0EDA773143E303C0028E383 /* CachedRawResource.h */; settings = {ATTRIBUTES = (Private, ); }; };
                D0FF2A5E11F8C45A007E74E0 /* PingLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = D0FF2A5C11F8C45A007E74E0 /* PingLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
                D302754A12A5FE84004BD828 /* RenderDetailsMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = D302754612A5FE84004BD828 /* RenderDetailsMarker.h */; };
                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>"; };
                D01B811222125AFC00627B6C /* GPUColor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUColor.idl; sourceTree = "<group>"; };
+               D01B811922135EB900627B6C /* GPUBufferDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUBufferDescriptor.idl; sourceTree = "<group>"; };
+               D01B811C2213627300627B6C /* GPUBufferUsage.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUBufferUsage.idl; sourceTree = "<group>"; };
+               D01B811D2213636E00627B6C /* GPUBufferUsage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUBufferUsage.h; sourceTree = "<group>"; };
                D0232B5821CB49B7009483B9 /* GPUBindGroupLayoutMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUBindGroupLayoutMetal.mm; sourceTree = "<group>"; };
                D02454D021C4A41C00B73628 /* GPUBindGroupLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUBindGroupLayout.h; sourceTree = "<group>"; };
                D026F47D220A2AC600AC5F49 /* GPUExtent3D.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUExtent3D.h; sourceTree = "<group>"; };
                D0615FCC217FE5C6008A48A8 /* WebGPUShaderModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUShaderModule.h; sourceTree = "<group>"; };
                D0615FCD217FE5C6008A48A8 /* WebGPUShaderModule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUShaderModule.cpp; sourceTree = "<group>"; };
                D0615FCE217FE5C6008A48A8 /* WebGPUShaderModule.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUShaderModule.idl; sourceTree = "<group>"; };
-               D063AE3F21C05DDD000E6A35 /* WebGPUBufferUsage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUBufferUsage.h; sourceTree = "<group>"; };
-               D063AE4021C05DDD000E6A35 /* WebGPUBufferUsage.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBufferUsage.idl; sourceTree = "<group>"; };
                D063AE4421C0617D000E6A35 /* WebGPUVertexFormat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUVertexFormat.h; sourceTree = "<group>"; };
                D063AE4521C0617D000E6A35 /* WebGPUVertexFormat.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUVertexFormat.idl; sourceTree = "<group>"; };
                D063AE4621C06626000E6A35 /* WebGPUInputStepMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUInputStepMode.h; sourceTree = "<group>"; };
                D0CAAE9C216824A7001C91C7 /* WebMetalComputeCommandEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebMetalComputeCommandEncoder.cpp; sourceTree = "<group>"; };
                D0CAAE9D216824A7001C91C7 /* WebMetalBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebMetalBuffer.h; sourceTree = "<group>"; };
                D0CAAE9E216824A8001C91C7 /* WebMetalCommandBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebMetalCommandBuffer.cpp; sourceTree = "<group>"; };
-               D0D8648221B61727003C983C /* WebGPUBufferDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUBufferDescriptor.h; sourceTree = "<group>"; };
-               D0D8648321B61727003C983C /* WebGPUBufferDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBufferDescriptor.idl; sourceTree = "<group>"; };
                D0D8648721B64CAA003C983C /* GPUBufferDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUBufferDescriptor.h; sourceTree = "<group>"; };
                D0D8648C21B70676003C983C /* WebGPUBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUBuffer.h; sourceTree = "<group>"; };
                D0D8648D21B70676003C983C /* WebGPUBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUBuffer.cpp; sourceTree = "<group>"; };
                                D0D8649221B760F2003C983C /* GPUBuffer.h */,
                                D0BE104A21E6872F00E42A89 /* GPUBufferBinding.h */,
                                D0D8648721B64CAA003C983C /* GPUBufferDescriptor.h */,
+                               D01B811D2213636E00627B6C /* GPUBufferUsage.h */,
                                D001D9AB21B0C7BF0023B9BC /* GPUColor.h */,
                                312FF8BD21A4C2F100EB199D /* GPUCommandBuffer.h */,
                                D03C849C21FFC7FC0002227F /* GPUCompareFunction.h */,
                                D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */,
                                D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */,
                                D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */,
+                               D01B811922135EB900627B6C /* GPUBufferDescriptor.idl */,
+                               D01B811C2213627300627B6C /* GPUBufferUsage.idl */,
                                D01B811222125AFC00627B6C /* GPUColor.idl */,
                                D03C849E21FFCF000002227F /* GPUCompareFunction.idl */,
                                D03C84A221FFD7230002227F /* GPUDepthStencilStateDescriptor.idl */,
                                D0D8648E21B70676003C983C /* WebGPUBuffer.idl */,
                                D0BE104C21E68F1500E42A89 /* WebGPUBufferBinding.h */,
                                D0BE104D21E68F1500E42A89 /* WebGPUBufferBinding.idl */,
-                               D0D8648221B61727003C983C /* WebGPUBufferDescriptor.h */,
-                               D0D8648321B61727003C983C /* WebGPUBufferDescriptor.idl */,
-                               D063AE3F21C05DDD000E6A35 /* WebGPUBufferUsage.h */,
-                               D063AE4021C05DDD000E6A35 /* WebGPUBufferUsage.idl */,
                                D0EACF7721937228000FA75C /* WebGPUCommandBuffer.cpp */,
                                D0EACF7621937228000FA75C /* WebGPUCommandBuffer.h */,
                                D0EACF7821937228000FA75C /* WebGPUCommandBuffer.idl */,
                                0C3F1F5B10C8871200D72CE1 /* WebGLUniformLocation.h in Headers */,
                                6F995A261A7078B100A735F4 /* WebGLVertexArrayObject.h in Headers */,
                                77A17A7812F28642004E02F6 /* WebGLVertexArrayObjectOES.h in Headers */,
-                               D0D8648421B61727003C983C /* WebGPUBufferDescriptor.h in Headers */,
                                318436DE21B9DAAF00ED383E /* WebGPULayer.h in Headers */,
                                A5B81CB71FAA44620037D1E6 /* WebHeapAgent.h in Headers */,
                                A5840E25187B8AC200843B10 /* WebInjectedScriptHost.h in Headers */,
index 7af8652..7be243e 100644 (file)
@@ -81,6 +81,7 @@ namespace WebCore {
     macro(Gamepad) \
     macro(GamepadButton) \
     macro(GamepadEvent) \
+    macro(GPUBufferUsage) \
     macro(GPUTextureUsage) \
     macro(HTMLAttachmentElement) \
     macro(HTMLAudioElement) \
@@ -196,7 +197,6 @@ namespace WebCore {
     macro(WebGPUBindGroup) \
     macro(WebGPUBindGroupLayout) \
     macro(WebGPUBuffer) \
-    macro(WebGPUBufferUsage) \
     macro(WebGPUCommandBuffer) \
     macro(WebGPUDevice) \
     macro(WebGPUIndexFormat) \
index c04e525..1d22bdf 100644 (file)
 
 #if ENABLE(WEBGPU)
 
-#include <wtf/RefCounted.h>
+#include "GPUBufferUsage.h"
 
 namespace WebCore {
 
-using GPUBufferUsageFlags = unsigned long;
-
 struct GPUBufferDescriptor {
     unsigned long size;
     GPUBufferUsageFlags usage;
 };
 
-class GPUBufferUsage : public RefCounted<GPUBufferUsage> {
-public:
-    enum Flags : GPUBufferUsageFlags {
-        None = 0,
-        MapRead = 1,
-        MapWrite = 2,
-        TransferSrc = 4,
-        TransferDst = 8,
-        Index = 16,
-        Vertex = 32,
-        Uniform = 64,
-        Storage = 128
-    };
-};
-
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #if ENABLE(WEBGPU)
 
-#include "GPUBufferDescriptor.h"
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
-using WebGPUBufferDescriptor = GPUBufferDescriptor;
-using WebGPUBufferUsageFlags = GPUBufferUsageFlags;
+using GPUBufferUsageFlags = unsigned long;
+
+class GPUBufferUsage : public RefCounted<GPUBufferUsage> {
+public:
+    enum class Flags : GPUBufferUsageFlags {
+        None = 0,
+        MapRead = 1,
+        MapWrite = 2,
+        TransferSrc = 4,
+        TransferDst = 8,
+        Index = 16,
+        Vertex = 32,
+        Uniform = 64,
+        Storage = 128
+    };
+};
 
 } // namespace WebCore