[WebGPU] Begin implementation of WebGPURenderPassEncoder and barebones WebGPURenderPa...
authorjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Nov 2018 20:53:17 +0000 (20:53 +0000)
committerjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Nov 2018 20:53:17 +0000 (20:53 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191990

Reviewed by Dean Jackson.

Source/WebCore:

Begin implementation of WebGPURenderPassEncoder and its parent interface, WebGPUProgrammablePassEncoder.
Also add code to allow creation of a primitive WebGPURenderPassDescriptor with the sole purpose of providing
a WebGPUTextureView reference to the render pass creation function, WebGPUCommandBuffer::beginRenderPass().

Test: webgpu/render-passes.html

* CMakeLists.txt:
* DerivedSources.make:
* Modules/webgpu/WebGPUCommandBuffer.cpp:
(WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer):
(WebCore::WebGPUCommandBuffer::beginRenderPass): Added. Returns a WebGPURenderPassEncoder upon success.
* Modules/webgpu/WebGPUCommandBuffer.h:
* Modules/webgpu/WebGPUCommandBuffer.idl:
* Modules/webgpu/WebGPUProgrammablePassEncoder.cpp: Added.
* Modules/webgpu/WebGPUProgrammablePassEncoder.h: Added.
* Modules/webgpu/WebGPUProgrammablePassEncoder.idl: Added. Empty (for now) interface parenting WebGPURenderPassEncoder.
* Modules/webgpu/WebGPURenderPassDescriptor.h:
* Modules/webgpu/WebGPURenderPassDescriptor.idl: Added. Directly handles a WebGPUTextureView attachment; all other color attachment properties set by implementation for now.
* Modules/webgpu/WebGPURenderPassEncoder.cpp: Added.
(WebCore::WebGPURenderPassEncoder::create):
(WebCore::WebGPURenderPassEncoder::WebGPURenderPassEncoder):
(WebCore::WebGPURenderPassEncoder::passEncoder const):
* Modules/webgpu/WebGPURenderPassEncoder.h: Added. Interface to GPURenderPassEncoder.
* Modules/webgpu/WebGPURenderPassEncoder.idl: Added. Allows WebGPU developer to encode commands for the WebGPUCommandBuffer.
* Modules/webgpu/WebGPUTextureView.cpp:
(WebCore::WebGPUTextureView::WebGPUTextureView):
* Modules/webgpu/WebGPUTextureView.h:
(WebCore::WebGPUTextureView::texture):
* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* platform/graphics/gpu/GPUCommandBuffer.h:
(WebCore::GPUCommandBuffer::platformCommandBuffer const):
* platform/graphics/gpu/GPUProgrammablePassEncoder.h: Added. Base class for GPURenderPassEncoder.
* platform/graphics/gpu/GPURenderPassDescriptor.h: Added.
* platform/graphics/gpu/GPURenderPassEncoder.h: Added. Wrapper class for MTLRenderCommandEncoder.
* platform/graphics/gpu/GPUTexture.h:
(WebCore::GPUTexture::platformTexture const):
* platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm: Added.
* platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: Added.
(WebCore::GPURenderPassEncoder::create): Creates the backing MTLRenderCommandEncoder; returns null if this fails.
(WebCore::GPURenderPassEncoder::GPURenderPassEncoder):
(WebCore::GPURenderPassEncoder::~GPURenderPassEncoder): End encoding before destroying the MTLCommandEncoder to prevent an exception.
(WebCore::GPURenderPassEncoder::platformPassEncoder const):

LayoutTests:

Add tests to ensure proper WebGPURenderPassEncoder creation. To be updated as WebGPURenderPassDescriptor is updated.

* webgpu/js/basic-webgpu-functions.js:
(render):
* webgpu/render-passes-expected.txt: Added.
* webgpu/render-passes.html: Added.

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

31 files changed:
LayoutTests/ChangeLog
LayoutTests/webgpu/js/basic-webgpu-functions.js
LayoutTests/webgpu/render-passes-expected.txt [new file with mode: 0644]
LayoutTests/webgpu/render-passes.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp
Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h
Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.idl
Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.idl [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.idl [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.idl [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WebGPUTextureView.cpp
Source/WebCore/Modules/webgpu/WebGPUTextureView.h
Source/WebCore/Sources.txt
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h
Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPURenderPassDescriptor.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/GPUTexture.h
Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm [new file with mode: 0644]
Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm [new file with mode: 0644]

index 7768961..2e5219e 100644 (file)
@@ -1,3 +1,17 @@
+2018-11-28  Justin Fan  <justin_fan@apple.com>
+
+        [WebGPU] Begin implementation of WebGPURenderPassEncoder and barebones WebGPURenderPassDescriptor
+        https://bugs.webkit.org/show_bug.cgi?id=191990
+
+        Reviewed by Dean Jackson.
+
+        Add tests to ensure proper WebGPURenderPassEncoder creation. To be updated as WebGPURenderPassDescriptor is updated.
+
+        * webgpu/js/basic-webgpu-functions.js:
+        (render):
+        * webgpu/render-passes-expected.txt: Added.
+        * webgpu/render-passes.html: Added.
+
 2018-11-28  Rob Buis  <rbuis@igalia.com>
 
         [XHR] Document.lastModified doesn't work for non-rendered documents
index ac5aa64..41f5bce 100644 (file)
@@ -137,5 +137,17 @@ function render() {
         return;
     }
 
+    // FIXME: Flesh out the rest of WebGPURenderPassDescriptor. 
+    // Default a loadOp, storeOp, and clearColor in the implementation for now.
+    let renderPassDescriptor = {
+        attachment : textureView
+    }
+
+    let renderPassEncoder = commandBuffer.beginRenderPass(renderPassDescriptor);
+    if (!renderPassEncoder) {
+        testFailed("Could not create WebGPURenderPassEncoder!");
+        return;
+    }
+
     // FIXME: Rest of rendering commands to follow.
 }
\ No newline at end of file
diff --git a/LayoutTests/webgpu/render-passes-expected.txt b/LayoutTests/webgpu/render-passes-expected.txt
new file mode 100644 (file)
index 0000000..31e808d
--- /dev/null
@@ -0,0 +1,9 @@
+PASS [object WebGPU] is defined.
+PASS Successfully created basic WebGPURenderPassEncoder.
+PASS WebGPURenderPassEncoder with invalid WebGPURenderPassDescriptor was not created.
+PASS WebGPURenderPassEncoder with invalid WebGPURenderPassDescriptor was not created.
+All tests complete.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/webgpu/render-passes.html b/LayoutTests/webgpu/render-passes.html
new file mode 100644 (file)
index 0000000..dc94050
--- /dev/null
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<script src="../resources/js-test-pre.js"></script>
+<script src="js/basic-webgpu-functions.js"></script>
+<script>
+if (window.testRunner)
+    window.testRunner.dumpAsText();
+
+let commandBuffer, texture, textureView, renderPassDescriptor, renderPassEncoder;
+
+function setUpBasicRenderPassEncoder() {
+    commandBuffer = defaultDevice.createCommandBuffer();
+    texture = context.getNextTexture();
+    textureView = texture.createDefaultTextureView();
+
+    // FIXME: Flesh out the rest of WebGPURenderPassDescriptor. 
+    // Default a loadOp, storeOp, and clearColor in the implementation for now.
+    renderPassDescriptor = {
+        attachment : textureView
+    }
+
+    renderPassEncoder = commandBuffer.beginRenderPass(renderPassDescriptor);
+    if (renderPassEncoder)
+        testPassed("Successfully created basic WebGPURenderPassEncoder.");
+    else
+        testFailed("Could not create WebGPURenderPassEncoder!");
+}
+
+function checkBadRenderPassDescriptor(descriptor, testSubjectName) {
+    renderPassEncoder = commandBuffer.beginRenderPass(descriptor);
+
+    if (renderPassEncoder)
+        testFailed(`WebGPURenderPassEncoder was created with an invalid ${testSubjectName}!`);
+    else 
+        testPassed(`WebGPURenderPassEncoder with invalid ${testSubjectName} was not created.`);
+}
+
+function noAttachmentDescriptors() {
+    checkBadRenderPassDescriptor(null, "WebGPURenderPassDescriptor");
+    checkBadRenderPassDescriptor({}, "WebGPURenderPassDescriptor");
+}
+
+runWebGPUTests([setUpBasicRenderPassEncoder, noAttachmentDescriptors]);
+
+successfullyParsed = true;
+</script>
+<script src="../resources/js-test-post.js"></script>
+</html>
\ No newline at end of file
index 62d7f9e..b181517 100644 (file)
@@ -462,7 +462,10 @@ set(WebCore_NON_SVG_IDL_FILES
     Modules/webgpu/WebGPUDevice.idl
     Modules/webgpu/WebGPUPipelineDescriptorBase.idl
     Modules/webgpu/WebGPUPipelineStageDescriptor.idl
+    Modules/webgpu/WebGPUProgrammablePassEncoder.idl
     Modules/webgpu/WebGPUQueue.idl
+    Modules/webgpu/WebGPURenderPassDescriptor.idl
+    Modules/webgpu/WebGPURenderPassEncoder.idl
     Modules/webgpu/WebGPURenderPipeline.idl
     Modules/webgpu/WebGPURenderPipelineDescriptor.idl
     Modules/webgpu/WebGPURenderingContext.idl
index 3e93157..df1df46 100644 (file)
@@ -1,3 +1,56 @@
+2018-11-28  Justin Fan  <justin_fan@apple.com>
+
+        [WebGPU] Begin implementation of WebGPURenderPassEncoder and barebones WebGPURenderPassDescriptor
+        https://bugs.webkit.org/show_bug.cgi?id=191990
+
+        Reviewed by Dean Jackson.
+
+        Begin implementation of WebGPURenderPassEncoder and its parent interface, WebGPUProgrammablePassEncoder.
+        Also add code to allow creation of a primitive WebGPURenderPassDescriptor with the sole purpose of providing 
+        a WebGPUTextureView reference to the render pass creation function, WebGPUCommandBuffer::beginRenderPass().
+
+        Test: webgpu/render-passes.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * Modules/webgpu/WebGPUCommandBuffer.cpp:
+        (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer):
+        (WebCore::WebGPUCommandBuffer::beginRenderPass): Added. Returns a WebGPURenderPassEncoder upon success.
+        * Modules/webgpu/WebGPUCommandBuffer.h:
+        * Modules/webgpu/WebGPUCommandBuffer.idl:
+        * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp: Added.
+        * Modules/webgpu/WebGPUProgrammablePassEncoder.h: Added.
+        * Modules/webgpu/WebGPUProgrammablePassEncoder.idl: Added. Empty (for now) interface parenting WebGPURenderPassEncoder.
+        * Modules/webgpu/WebGPURenderPassDescriptor.h:
+        * Modules/webgpu/WebGPURenderPassDescriptor.idl: Added. Directly handles a WebGPUTextureView attachment; all other color attachment properties set by implementation for now.
+        * Modules/webgpu/WebGPURenderPassEncoder.cpp: Added.
+        (WebCore::WebGPURenderPassEncoder::create):
+        (WebCore::WebGPURenderPassEncoder::WebGPURenderPassEncoder):
+        (WebCore::WebGPURenderPassEncoder::passEncoder const):
+        * Modules/webgpu/WebGPURenderPassEncoder.h: Added. Interface to GPURenderPassEncoder.
+        * Modules/webgpu/WebGPURenderPassEncoder.idl: Added. Allows WebGPU developer to encode commands for the WebGPUCommandBuffer.
+        * Modules/webgpu/WebGPUTextureView.cpp:
+        (WebCore::WebGPUTextureView::WebGPUTextureView):
+        * Modules/webgpu/WebGPUTextureView.h:
+        (WebCore::WebGPUTextureView::texture):
+        * Sources.txt:
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+        * platform/graphics/gpu/GPUCommandBuffer.h:
+        (WebCore::GPUCommandBuffer::platformCommandBuffer const):
+        * platform/graphics/gpu/GPUProgrammablePassEncoder.h: Added. Base class for GPURenderPassEncoder.
+        * platform/graphics/gpu/GPURenderPassDescriptor.h: Added.
+        * platform/graphics/gpu/GPURenderPassEncoder.h: Added. Wrapper class for MTLRenderCommandEncoder.
+        * platform/graphics/gpu/GPUTexture.h:
+        (WebCore::GPUTexture::platformTexture const):
+        * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm: Added.
+        * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm: Added.
+        (WebCore::GPURenderPassEncoder::create): Creates the backing MTLRenderCommandEncoder; returns null if this fails. 
+        (WebCore::GPURenderPassEncoder::GPURenderPassEncoder):
+        (WebCore::GPURenderPassEncoder::~GPURenderPassEncoder): End encoding before destroying the MTLCommandEncoder to prevent an exception.
+        (WebCore::GPURenderPassEncoder::platformPassEncoder const):
+
 2018-11-28  Rob Buis  <rbuis@igalia.com>
 
         [XHR] Document.lastModified doesn't work for non-rendered documents
index cbe5e00..308d759 100644 (file)
@@ -380,6 +380,9 @@ JS_BINDING_IDLS = \
     $(WebCore)/Modules/webgpu/WebGPUQueue.idl \
     $(WebCore)/Modules/webgpu/WebGPUPipelineDescriptorBase.idl \
     $(WebCore)/Modules/webgpu/WebGPUPipelineStageDescriptor.idl \
+    $(WebCore)/Modules/webgpu/WebGPUProgrammablePassEncoder.idl \
+    $(WebCore)/Modules/webgpu/WebGPURenderPassDescriptor.idl \
+    $(WebCore)/Modules/webgpu/WebGPURenderPassEncoder.idl \
     $(WebCore)/Modules/webgpu/WebGPURenderPipeline.idl \
     $(WebCore)/Modules/webgpu/WebGPURenderPipelineDescriptor.idl \
     $(WebCore)/Modules/webgpu/WebGPURenderingContext.idl \
index 4e77aec..53fa1de 100644 (file)
 #if ENABLE(WEBGPU)
 
 #include "GPUCommandBuffer.h"
+#include "GPURenderPassDescriptor.h"
+#include "GPURenderPassEncoder.h"
+#include "Logging.h"
+#include "WebGPURenderPassDescriptor.h"
+#include "WebGPURenderPassEncoder.h"
 
 namespace WebCore {
 
@@ -43,8 +48,24 @@ RefPtr<WebGPUCommandBuffer> WebGPUCommandBuffer::create(RefPtr<GPUCommandBuffer>
 WebGPUCommandBuffer::WebGPUCommandBuffer(Ref<GPUCommandBuffer>&& buffer)
     : m_commandBuffer(WTFMove(buffer))
 {
-    UNUSED_PARAM(m_commandBuffer);
 }
+
+RefPtr<WebGPURenderPassEncoder> WebGPUCommandBuffer::beginRenderPass(WebGPURenderPassDescriptor&& descriptor)
+{
+    // FIXME: Improve error checking as WebGPURenderPassDescriptor is implemented.
+    if (!descriptor.attachment) {
+        LOG(WebGPU, "WebGPUCommandBuffer::create(): No attachment specified for WebGPURenderPassDescriptor!");
+        return nullptr;
+    }
+    
+    auto encoder = GPURenderPassEncoder::create(m_commandBuffer.get(), GPURenderPassDescriptor { descriptor.attachment->texture() });
+
+    if (!encoder)
+        return nullptr;
+
+    return WebGPURenderPassEncoder::create(encoder.releaseNonNull());
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(WEBGPU)
index 387885e..48d63ee 100644 (file)
 namespace WebCore {
 
 class GPUCommandBuffer;
+class WebGPURenderPassEncoder;
+
+struct WebGPURenderPassDescriptor;
 
 class WebGPUCommandBuffer : public RefCounted<WebGPUCommandBuffer> {
 public:
     static RefPtr<WebGPUCommandBuffer> create(RefPtr<GPUCommandBuffer>&&);
 
     const GPUCommandBuffer& commandBuffer() const { return m_commandBuffer.get(); }
+    RefPtr<WebGPURenderPassEncoder> beginRenderPass(WebGPURenderPassDescriptor&&);
 
 private:
     WebGPUCommandBuffer(Ref<GPUCommandBuffer>&&);
index 50336c8..0faa3f9 100644 (file)
@@ -29,8 +29,9 @@
     EnabledAtRuntime=WebGPU,
     ImplementationLacksVTable
 ] interface WebGPUCommandBuffer {
-/* Not Yet Implemented
     WebGPURenderPassEncoder beginRenderPass(WebGPURenderPassDescriptor descriptor);
+
+/* Not Yet Implemented
     WebGPUComputePassEncoder beginComputePass();
 
     // Commands allowed outside of "passes"
diff --git a/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp b/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp
new file mode 100644 (file)
index 0000000..5851578
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebGPUProgrammablePassEncoder.h"
+
+#if ENABLE(WEBGPU)
+
+namespace WebCore {
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h b/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h
new file mode 100644 (file)
index 0000000..e73e7d0
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class GPUProgrammablePassEncoder;
+
+class WebGPUProgrammablePassEncoder : public RefCounted<WebGPUProgrammablePassEncoder> {
+public:
+    virtual ~WebGPUProgrammablePassEncoder() = default;
+
+protected:
+    virtual GPUProgrammablePassEncoder& passEncoder() const = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.idl b/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.idl
new file mode 100644 (file)
index 0000000..69ca850
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * 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,
+    SkipVTableValidation
+] interface WebGPUProgrammablePassEncoder {
+/* Not Yet Implemented
+    WebGPUCommandBuffer endPass();
+    // Allowed in both compute and render passes
+    // TODO: setPushConstants() ?
+    void setBindGroup(u32 index, WebGPUBindGroup bindGroup);
+    void setPipeline((WebGPUComputePipeline or WebGPURenderPipeline) pipeline);
+*/
+};
diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.h b/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.h
new file mode 100644 (file)
index 0000000..747e39e
--- /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 "WebGPUTextureView.h"
+
+namespace WebCore {
+
+struct WebGPURenderPassDescriptor {
+    // FIXME: Temporary shortcut implementation for prototyping.
+    RefPtr<WebGPUTextureView> attachment;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.idl b/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.idl
new file mode 100644 (file)
index 0000000..21dea2d
--- /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
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] dictionary WebGPURenderPassDescriptor {
+    // FIXME: Temporary shortcut implementation for prototyping.
+    WebGPUTextureView attachment;
+
+/* Not Yet Implemented:
+    sequence<WebGPURenderPassColorAttachmentDescriptor> colorAttachments;
+    WebGPURenderPassDepthStencilAttachmentDescriptor depthStencilAttachment;
+*/
+};
diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp b/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.cpp
new file mode 100644 (file)
index 0000000..3dd169b
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebGPURenderPassEncoder.h"
+
+#if ENABLE(WEBGPU)
+
+#include "GPUProgrammablePassEncoder.h"
+
+namespace WebCore {
+
+Ref<WebGPURenderPassEncoder> WebGPURenderPassEncoder::create(Ref<GPURenderPassEncoder>&& encoder)
+{
+    return adoptRef(*new WebGPURenderPassEncoder(WTFMove(encoder)));
+}
+
+WebGPURenderPassEncoder::WebGPURenderPassEncoder(Ref<GPURenderPassEncoder>&& encoder)
+    : m_passEncoder(WTFMove(encoder))
+{
+}
+
+GPUProgrammablePassEncoder& WebGPURenderPassEncoder::passEncoder() const
+{
+    return m_passEncoder.get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h b/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.h
new file mode 100644 (file)
index 0000000..407c675
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include "GPURenderPassEncoder.h"
+#include "WebGPUProgrammablePassEncoder.h"
+
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class GPUProgrammablePassEncoder;
+
+class WebGPURenderPassEncoder final : public WebGPUProgrammablePassEncoder {
+public:
+    static Ref<WebGPURenderPassEncoder> create(Ref<GPURenderPassEncoder>&&);
+
+private:
+    WebGPURenderPassEncoder(Ref<GPURenderPassEncoder>&&);
+
+    GPUProgrammablePassEncoder& passEncoder() const final;
+
+    Ref<GPURenderPassEncoder> m_passEncoder;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.idl b/Source/WebCore/Modules/webgpu/WebGPURenderPassEncoder.idl
new file mode 100644 (file)
index 0000000..5000d3d
--- /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.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] interface WebGPURenderPassEncoder : WebGPUProgrammablePassEncoder {
+/* Not Yet Implemented
+    void setBlendColor(float r, float g, float b, float a);
+    void setIndexBuffer(WebGPUBuffer buffer, u32 offset);
+    void setVertexBuffers(u32 startSlot, sequence<WebGPUBuffer> buffers, sequence<u32> offsets);
+
+    void draw(u32 vertexCount, u32 instanceCount, u32 firstVertex, u32 firstInstance);
+    void drawIndexed(u32 indexCount, u32 instanceCount, u32 firstIndex, i32 baseVertex, u32 firstInstance);
+
+    // TODO add missing commands
+*/
+};
index eb517fd..7265945 100644 (file)
@@ -36,9 +36,8 @@ Ref<WebGPUTextureView> WebGPUTextureView::create(Ref<GPUTexture>&& view)
 }
 
 WebGPUTextureView::WebGPUTextureView(Ref<GPUTexture>&& view)
-    : m_textureView(WTFMove(view))
+    : m_texture(WTFMove(view))
 {
-    UNUSED_PARAM(m_textureView);
 }
 
 } // namespace WebCore
index b315fa4..fbeb8bc 100644 (file)
@@ -37,10 +37,11 @@ class WebGPUTextureView : public RefCounted<WebGPUTextureView> {
 public:
     static Ref<WebGPUTextureView> create(Ref<GPUTexture>&&);
 
+    Ref<GPUTexture> texture() { return m_texture.copyRef(); }
 private:
     explicit WebGPUTextureView(Ref<GPUTexture>&&);
     
-    Ref<GPUTexture> m_textureView;
+    Ref<GPUTexture> m_texture;
 };
 
 } // namespace WebCore
index 76ded8e..55d0849 100644 (file)
@@ -306,7 +306,9 @@ Modules/webgpu/WebGPUAdapter.cpp
 Modules/webgpu/WebGPUCommandBuffer.cpp
 Modules/webgpu/WebGPUDevice.cpp
 Modules/webgpu/WebGPUQueue.cpp
+Modules/webgpu/WebGPUProgrammablePassEncoder.cpp
 Modules/webgpu/WebGPURenderingContext.cpp
+Modules/webgpu/WebGPURenderPassEncoder.cpp
 Modules/webgpu/WebGPURenderPipeline.cpp
 Modules/webgpu/WebGPUShaderModule.cpp
 Modules/webgpu/WebGPUSwapChain.cpp
@@ -3221,7 +3223,10 @@ JSWebGPUDevice.cpp
 JSWebGPUQueue.cpp
 JSWebGPUPipelineDescriptorBase.cpp
 JSWebGPUPipelineStageDescriptor.cpp
+JSWebGPUProgrammablePassEncoder.cpp
 JSWebGPURenderingContext.cpp
+JSWebGPURenderPassDescriptor.cpp
+JSWebGPURenderPassEncoder.cpp
 JSWebGPURenderPipeline.cpp
 JSWebGPURenderPipelineDescriptor.cpp
 JSWebGPUShaderModule.cpp
index c9a5446..063dfdc 100644 (file)
@@ -320,7 +320,9 @@ platform/graphics/cv/VideoTextureCopierCV.cpp
 
 platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm
 platform/graphics/gpu/cocoa/GPUDeviceMetal.mm
+platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm
 platform/graphics/gpu/cocoa/GPUQueueMetal.mm
+platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm
 platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm
 platform/graphics/gpu/cocoa/GPUShaderModuleMetal.mm
 platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm
index 78453c9..7e46266 100644 (file)
                312FF8C321A4C2F300EB199D /* GPUTextureFormatEnum.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTextureFormatEnum.h; sourceTree = "<group>"; };
                312FF8C421A4C2F400EB199D /* GPUPipelineDescriptorBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUPipelineDescriptorBase.h; sourceTree = "<group>"; };
                312FF8C521A4C2F400EB199D /* GPUTexture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTexture.h; sourceTree = "<group>"; };
-               312FF8C721A4C32500EB199D /* GPUQueueMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GPUQueueMetal.mm; path = platform/graphics/gpu/cocoa/GPUQueueMetal.mm; sourceTree = SOURCE_ROOT; };
-               312FF8C821A4C32500EB199D /* GPUTextureMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GPUTextureMetal.mm; path = platform/graphics/gpu/cocoa/GPUTextureMetal.mm; sourceTree = SOURCE_ROOT; };
-               312FF8C921A4C32600EB199D /* GPUDeviceMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GPUDeviceMetal.mm; path = platform/graphics/gpu/cocoa/GPUDeviceMetal.mm; sourceTree = SOURCE_ROOT; };
-               312FF8CA21A4C32600EB199D /* GPUShaderModuleMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GPUShaderModuleMetal.mm; path = platform/graphics/gpu/cocoa/GPUShaderModuleMetal.mm; sourceTree = SOURCE_ROOT; };
-               312FF8CB21A4C32700EB199D /* GPUSwapChainMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GPUSwapChainMetal.mm; path = platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm; sourceTree = SOURCE_ROOT; };
-               312FF8CC21A4C32700EB199D /* GPUCommandBufferMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GPUCommandBufferMetal.mm; path = platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm; sourceTree = SOURCE_ROOT; };
-               312FF8CD21A4C32800EB199D /* GPURenderPipelineMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = GPURenderPipelineMetal.mm; path = platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm; sourceTree = SOURCE_ROOT; };
                312FF8CF21A4C33F00EB199D /* GPULegacyTextureDescriptor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPULegacyTextureDescriptor.cpp; sourceTree = "<group>"; };
                312FF8D021A4C33F00EB199D /* GPULegacyRenderPipelineDescriptor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPULegacyRenderPipelineDescriptor.cpp; sourceTree = "<group>"; };
                312FF8D121A4C33F00EB199D /* GPULegacyRenderPassDepthAttachmentDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPULegacyRenderPassDepthAttachmentDescriptor.h; sourceTree = "<group>"; };
                312FF93921A61C9F00EB199D /* WebGPUQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGPUQueue.h; sourceTree = "<group>"; };
                312FF93B21A61CA000EB199D /* WebGPUQueue.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGPUQueue.idl; sourceTree = "<group>"; };
                312FF93C21A61CA100EB199D /* WebGPUQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUQueue.cpp; sourceTree = "<group>"; };
-               312FF93D21A61F0700EB199D /* JSWebGPUQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebGPUQueue.h; path = JSWebGPUQueue.h; sourceTree = "<group>"; };
-               312FF93E21A61F0700EB199D /* JSWebGPUQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebGPUQueue.cpp; path = JSWebGPUQueue.cpp; sourceTree = "<group>"; };
+               312FF93D21A61F0700EB199D /* JSWebGPUQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGPUQueue.h; sourceTree = "<group>"; };
+               312FF93E21A61F0700EB199D /* JSWebGPUQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGPUQueue.cpp; sourceTree = "<group>"; };
                313171541FB079D1008D91FC /* CanvasBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasBase.h; sourceTree = "<group>"; };
                313171571FB0969E008D91FC /* CanvasBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasBase.cpp; sourceTree = "<group>"; };
                313591001E7DDC6000F30630 /* RTCIceConnectionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCIceConnectionState.h; sourceTree = "<group>"; };
                314BE3A41B3103FB00141982 /* NamedImageGeneratedImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NamedImageGeneratedImage.cpp; sourceTree = "<group>"; };
                314BE3A51B3103FB00141982 /* NamedImageGeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NamedImageGeneratedImage.h; sourceTree = "<group>"; };
                315574CC218F66D000D88F66 /* PointerEventIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PointerEventIOS.cpp; sourceTree = "<group>"; };
-               316BDB881E6E141C00DE0D5A /* GPULegacyDeviceMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyDeviceMetal.mm; sourceTree = "<group>"; };
                316BDB8A1E6E153000DE0D5A /* WebMetalLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebMetalLayer.h; sourceTree = "<group>"; };
-               316BDB961E70CA2400DE0D5A /* GPULegacyFunctionMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyFunctionMetal.mm; sourceTree = "<group>"; };
-               316BDB9C1E70CD9000DE0D5A /* GPULegacyLibraryMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyLibraryMetal.mm; sourceTree = "<group>"; };
-               316BDBA51E71FA6F00DE0D5A /* GPULegacyBufferMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyBufferMetal.mm; sourceTree = "<group>"; };
-               316BDBB31E7357B000DE0D5A /* GPULegacyTextureDescriptorMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyTextureDescriptorMetal.mm; sourceTree = "<group>"; };
-               316BDBBD1E73881300DE0D5A /* GPULegacyCommandQueueMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyCommandQueueMetal.mm; sourceTree = "<group>"; };
-               316BDBC61E75EE3D00DE0D5A /* GPULegacyCommandBufferMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyCommandBufferMetal.mm; sourceTree = "<group>"; };
-               316BDBC91E75F16200DE0D5A /* GPULegacyDrawableMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyDrawableMetal.mm; sourceTree = "<group>"; };
-               316BDBD41E75F7CA00DE0D5A /* GPULegacyRenderPassDescriptorMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyRenderPassDescriptorMetal.mm; sourceTree = "<group>"; };
-               316BDBD61E7612C400DE0D5A /* GPULegacyRenderPassColorAttachmentDescriptorMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyRenderPassColorAttachmentDescriptorMetal.mm; sourceTree = "<group>"; };
-               316BDBE01E761CB500DE0D5A /* GPULegacyRenderPassAttachmentDescriptorMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyRenderPassAttachmentDescriptorMetal.mm; sourceTree = "<group>"; };
-               316BDBE61E761F2700DE0D5A /* GPULegacyRenderPassDepthAttachmentDescriptorMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyRenderPassDepthAttachmentDescriptorMetal.mm; sourceTree = "<group>"; };
-               316BDBEC1E76246B00DE0D5A /* GPULegacyRenderCommandEncoderMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyRenderCommandEncoderMetal.mm; sourceTree = "<group>"; };
-               316BDBF21E76293700DE0D5A /* GPULegacyDepthStencilStateMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyDepthStencilStateMetal.mm; sourceTree = "<group>"; };
-               316BDBF81E762BEF00DE0D5A /* GPULegacyDepthStencilDescriptorMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyDepthStencilDescriptorMetal.mm; sourceTree = "<group>"; };
-               316BDC041E762F7E00DE0D5A /* GPULegacyRenderPipelineDescriptorMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyRenderPipelineDescriptorMetal.mm; sourceTree = "<group>"; };
-               316BDC051E762F7E00DE0D5A /* GPULegacyRenderPipelineStateMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyRenderPipelineStateMetal.mm; sourceTree = "<group>"; };
-               316BDC0A1E76343600DE0D5A /* GPULegacyRenderPipelineColorAttachmentDescriptorMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyRenderPipelineColorAttachmentDescriptorMetal.mm; sourceTree = "<group>"; };
                316DCB121E78BE43001B5F87 /* RTCOfferAnswerOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RTCOfferAnswerOptions.idl; sourceTree = "<group>"; };
                316DCB171E78C330001B5F87 /* RTCRtpTransceiverDirection.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = RTCRtpTransceiverDirection.idl; sourceTree = "<group>"; };
                316DCB191E78CA55001B5F87 /* JSRTCOfferAnswerOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRTCOfferAnswerOptions.cpp; sourceTree = "<group>"; };
                381E35E61E8E1DB90043E850 /* WebGPUComputeCommandEncoder.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGPUComputeCommandEncoder.idl; sourceTree = "<group>"; };
                381E35E71E8E1E0A0043E850 /* WebGPUComputeCommandEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGPUComputeCommandEncoder.h; sourceTree = "<group>"; };
                381E35E81E8E1E160043E850 /* WebGPUComputeCommandEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUComputeCommandEncoder.cpp; sourceTree = "<group>"; };
-               381E35E91E8E20AC0043E850 /* GPULegacyComputeCommandEncoderMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyComputeCommandEncoderMetal.mm; sourceTree = "<group>"; };
-               381E35EE1E8E24CB0043E850 /* GPULegacyComputePipelineStateMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyComputePipelineStateMetal.mm; sourceTree = "<group>"; };
                381E35EF1E8E3D7F0043E850 /* WebGPUSize.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGPUSize.idl; sourceTree = "<group>"; };
                381E35F51E8E4C420043E850 /* WebGPUSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGPUSize.h; sourceTree = "<group>"; };
                387AE9581E8E92EF0000DE96 /* JSWebGPUSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGPUSize.cpp; sourceTree = "<group>"; };
                D02F858621682AA70088EE74 /* WebMetalRenderPipelineColorAttachmentDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebMetalRenderPipelineColorAttachmentDescriptor.idl; sourceTree = "<group>"; };
                D02F858721682AA70088EE74 /* WebMetalRenderingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebMetalRenderingContext.cpp; sourceTree = "<group>"; };
                D02F858821682AA80088EE74 /* WebMetalFunction.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebMetalFunction.idl; sourceTree = "<group>"; };
+               D03211CE21AC954E00763CF2 /* GPURenderPassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPURenderPassEncoder.h; sourceTree = "<group>"; };
+               D03211CF21AC954E00763CF2 /* GPUProgrammablePassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUProgrammablePassEncoder.h; sourceTree = "<group>"; };
+               D03211D021AC954F00763CF2 /* GPURenderPassDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPURenderPassDescriptor.h; sourceTree = "<group>"; };
                D036DD8D208FFC0C00F9F4B2 /* WebGLCompressedTextureASTC.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGLCompressedTextureASTC.idl; sourceTree = "<group>"; };
                D045AD1D2168230B000A6E9B /* WebMetalLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebMetalLayer.mm; sourceTree = "<group>"; };
                D045AD1E21682449000A6E9B /* JSWebMetalRenderPassAttachmentDescriptorCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebMetalRenderPassAttachmentDescriptorCustom.cpp; sourceTree = "<group>"; };
                D045AD2121682474000A6E9B /* WebMetalBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebMetalBuffer.cpp; sourceTree = "<group>"; };
                D045AD2221682474000A6E9B /* WebMetalCommandBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebMetalCommandBuffer.h; sourceTree = "<group>"; };
                D045AD2321682475000A6E9B /* WebMetalCommandQueue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebMetalCommandQueue.cpp; sourceTree = "<group>"; };
-               D0573D42217EB81E00D1BE91 /* GPULegacyTextureMetal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GPULegacyTextureMetal.mm; sourceTree = "<group>"; };
                D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FormatBlockCommand.cpp; sourceTree = "<group>"; };
                D05CED280A40BB2C00C5AF38 /* FormatBlockCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FormatBlockCommand.h; sourceTree = "<group>"; };
                D060D88421825D5F00339318 /* WebGPUShaderModuleDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUShaderModuleDescriptor.idl; sourceTree = "<group>"; };
                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>"; };
                D086FE9709D53AAB005BC74D /* UnlinkCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnlinkCommand.cpp; sourceTree = "<group>"; };
+               D087CE3821ACA94200BDE174 /* GPUCommandBufferMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUCommandBufferMetal.mm; sourceTree = "<group>"; };
+               D087CE3921ACA94200BDE174 /* GPUQueueMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUQueueMetal.mm; sourceTree = "<group>"; };
+               D087CE3A21ACA94200BDE174 /* GPURenderPassEncoderMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPURenderPassEncoderMetal.mm; sourceTree = "<group>"; };
+               D087CE3B21ACA94200BDE174 /* GPUProgrammablePassEncoderMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUProgrammablePassEncoderMetal.mm; sourceTree = "<group>"; };
+               D087CE3C21ACA94200BDE174 /* GPUDeviceMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUDeviceMetal.mm; sourceTree = "<group>"; };
+               D087CE3D21ACA94200BDE174 /* GPURenderPipelineMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPURenderPipelineMetal.mm; sourceTree = "<group>"; };
+               D087CE3E21ACA94200BDE174 /* GPUSwapChainMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUSwapChainMetal.mm; sourceTree = "<group>"; };
+               D087CE3F21ACA94200BDE174 /* GPUTextureMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUTextureMetal.mm; sourceTree = "<group>"; };
+               D087CE4021ACA94200BDE174 /* GPUShaderModuleMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUShaderModuleMetal.mm; sourceTree = "<group>"; };
                D093D225217951D400329217 /* WebGPURenderingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPURenderingContext.h; sourceTree = "<group>"; };
                D093D227217951D400329217 /* WebGPURenderingContext.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderingContext.idl; sourceTree = "<group>"; };
                D093D2292179541600329217 /* WebGPURenderingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPURenderingContext.cpp; sourceTree = "<group>"; };
                D0EACF872193EE4E000FA75C /* WebGPUTextureView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUTextureView.h; sourceTree = "<group>"; };
                D0EACF882193EE4E000FA75C /* WebGPUTextureView.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUTextureView.cpp; sourceTree = "<group>"; };
                D0EACF892193EE4E000FA75C /* WebGPUTextureView.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUTextureView.idl; sourceTree = "<group>"; };
+               D0EACF8C219403C9000FA75C /* WebGPURenderPassDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPURenderPassDescriptor.h; sourceTree = "<group>"; };
+               D0EACF8D219403C9000FA75C /* WebGPURenderPassDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderPassDescriptor.idl; sourceTree = "<group>"; };
+               D0EACF8E21940A22000FA75C /* WebGPURenderPassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPURenderPassEncoder.h; sourceTree = "<group>"; };
+               D0EACF8F21940A22000FA75C /* WebGPURenderPassEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPURenderPassEncoder.cpp; sourceTree = "<group>"; };
+               D0EACF9021940A22000FA75C /* WebGPURenderPassEncoder.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderPassEncoder.idl; sourceTree = "<group>"; };
+               D0EACF9121940A5B000FA75C /* WebGPUProgrammablePassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUProgrammablePassEncoder.h; sourceTree = "<group>"; };
+               D0EACF9221940A5B000FA75C /* WebGPUProgrammablePassEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUProgrammablePassEncoder.cpp; sourceTree = "<group>"; };
+               D0EACF9321940A5B000FA75C /* WebGPUProgrammablePassEncoder.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUProgrammablePassEncoder.idl; sourceTree = "<group>"; };
                D0EACFAD219E30FD000FA75C /* WebGPUTextureFormatEnum.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUTextureFormatEnum.h; sourceTree = "<group>"; };
                D0EACFAE219E30FD000FA75C /* WebGPUTextureFormatEnum.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUTextureFormatEnum.idl; sourceTree = "<group>"; };
                D0EDA772143E303C0028E383 /* CachedRawResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedRawResource.cpp; sourceTree = "<group>"; };
                        path = workers;
                        sourceTree = "<group>";
                };
-               312FF8C621A4C30200EB199D /* cocoa */ = {
-                       isa = PBXGroup;
-                       children = (
-                               312FF8CC21A4C32700EB199D /* GPUCommandBufferMetal.mm */,
-                               312FF8C921A4C32600EB199D /* GPUDeviceMetal.mm */,
-                               312FF8C721A4C32500EB199D /* GPUQueueMetal.mm */,
-                               312FF8CD21A4C32800EB199D /* GPURenderPipelineMetal.mm */,
-                               312FF8CA21A4C32600EB199D /* GPUShaderModuleMetal.mm */,
-                               312FF8CB21A4C32700EB199D /* GPUSwapChainMetal.mm */,
-                               312FF8C821A4C32500EB199D /* GPUTextureMetal.mm */,
-                       );
-                       name = cocoa;
-                       path = "New Group";
-                       sourceTree = "<group>";
-               };
                312FF8CE21A4C33F00EB199D /* legacy */ = {
                        isa = PBXGroup;
                        children = (
                498770C11242C50D002226BA /* gpu */ = {
                        isa = PBXGroup;
                        children = (
-                               312FF8C621A4C30200EB199D /* cocoa */,
+                               D087CE3721ACA94200BDE174 /* cocoa */,
                                312FF8CE21A4C33F00EB199D /* legacy */,
                                312FF8BD21A4C2F100EB199D /* GPUCommandBuffer.h */,
                                312FF8BF21A4C2F100EB199D /* GPUDevice.cpp */,
                                312FF8BE21A4C2F100EB199D /* GPUDevice.h */,
                                312FF8C421A4C2F400EB199D /* GPUPipelineDescriptorBase.h */,
                                312FF8C221A4C2F300EB199D /* GPUPipelineStageDescriptor.h */,
+                               D03211CF21AC954E00763CF2 /* GPUProgrammablePassEncoder.h */,
                                312FF8C121A4C2F200EB199D /* GPUQueue.h */,
+                               D03211D021AC954F00763CF2 /* GPURenderPassDescriptor.h */,
+                               D03211CE21AC954E00763CF2 /* GPURenderPassEncoder.h */,
                                312FF8B921A4C2EF00EB199D /* GPURenderPipeline.h */,
                                312FF8BC21A4C2F000EB199D /* GPURenderPipelineDescriptor.h */,
                                312FF8BB21A4C2F000EB199D /* GPUShaderModule.h */,
                        path = filters;
                        sourceTree = "<group>";
                };
-               9368C49120F9B57200434D61 /* metal */ = {
-                       isa = PBXGroup;
-                       children = (
-                               316BDBA51E71FA6F00DE0D5A /* GPULegacyBufferMetal.mm */,
-                               316BDBC61E75EE3D00DE0D5A /* GPULegacyCommandBufferMetal.mm */,
-                               316BDBBD1E73881300DE0D5A /* GPULegacyCommandQueueMetal.mm */,
-                               381E35E91E8E20AC0043E850 /* GPULegacyComputeCommandEncoderMetal.mm */,
-                               381E35EE1E8E24CB0043E850 /* GPULegacyComputePipelineStateMetal.mm */,
-                               316BDBF81E762BEF00DE0D5A /* GPULegacyDepthStencilDescriptorMetal.mm */,
-                               316BDBF21E76293700DE0D5A /* GPULegacyDepthStencilStateMetal.mm */,
-                               316BDB881E6E141C00DE0D5A /* GPULegacyDeviceMetal.mm */,
-                               316BDBC91E75F16200DE0D5A /* GPULegacyDrawableMetal.mm */,
-                               316BDB961E70CA2400DE0D5A /* GPULegacyFunctionMetal.mm */,
-                               316BDB9C1E70CD9000DE0D5A /* GPULegacyLibraryMetal.mm */,
-                               316BDBEC1E76246B00DE0D5A /* GPULegacyRenderCommandEncoderMetal.mm */,
-                               316BDBE01E761CB500DE0D5A /* GPULegacyRenderPassAttachmentDescriptorMetal.mm */,
-                               316BDBD61E7612C400DE0D5A /* GPULegacyRenderPassColorAttachmentDescriptorMetal.mm */,
-                               316BDBE61E761F2700DE0D5A /* GPULegacyRenderPassDepthAttachmentDescriptorMetal.mm */,
-                               316BDBD41E75F7CA00DE0D5A /* GPULegacyRenderPassDescriptorMetal.mm */,
-                               316BDC0A1E76343600DE0D5A /* GPULegacyRenderPipelineColorAttachmentDescriptorMetal.mm */,
-                               316BDC041E762F7E00DE0D5A /* GPULegacyRenderPipelineDescriptorMetal.mm */,
-                               316BDC051E762F7E00DE0D5A /* GPULegacyRenderPipelineStateMetal.mm */,
-                               316BDBB31E7357B000DE0D5A /* GPULegacyTextureDescriptorMetal.mm */,
-                               D0573D42217EB81E00D1BE91 /* GPULegacyTextureMetal.mm */,
-                       );
-                       path = metal;
-                       sourceTree = "<group>";
-               };
                93A1EAA20A5634D8006960A0 /* mac */ = {
                        isa = PBXGroup;
                        children = (
                                441AF0A70EBA7BBF0044ED4B /* ios */,
                                CD892F5A1FB52ACF009333D2 /* iso */,
                                B27535490B053814002CE64F /* mac */,
-                               9368C49120F9B57200434D61 /* metal */,
                                FBC220DD1237FBEB00BCF788 /* opengl */,
                                3721493318F0B6D600156EDC /* opentype */,
                                49E911B20EF86D27009D0CAF /* transforms */,
                                D0C419F12183EB31009EC1DE /* WebGPUPipelineDescriptorBase.idl */,
                                D0C419EB2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.h */,
                                D0C419EC2183CFA2009EC1DE /* WebGPUPipelineStageDescriptor.idl */,
+                               D0EACF9221940A5B000FA75C /* WebGPUProgrammablePassEncoder.cpp */,
+                               D0EACF9121940A5B000FA75C /* WebGPUProgrammablePassEncoder.h */,
+                               D0EACF9321940A5B000FA75C /* WebGPUProgrammablePassEncoder.idl */,
                                312FF93C21A61CA100EB199D /* WebGPUQueue.cpp */,
                                312FF93921A61C9F00EB199D /* WebGPUQueue.h */,
                                312FF93B21A61CA000EB199D /* WebGPUQueue.idl */,
                                D093D2292179541600329217 /* WebGPURenderingContext.cpp */,
                                D093D225217951D400329217 /* WebGPURenderingContext.h */,
                                D093D227217951D400329217 /* WebGPURenderingContext.idl */,
+                               D0EACF8C219403C9000FA75C /* WebGPURenderPassDescriptor.h */,
+                               D0EACF8D219403C9000FA75C /* WebGPURenderPassDescriptor.idl */,
+                               D0EACF8F21940A22000FA75C /* WebGPURenderPassEncoder.cpp */,
+                               D0EACF8E21940A22000FA75C /* WebGPURenderPassEncoder.h */,
+                               D0EACF9021940A22000FA75C /* WebGPURenderPassEncoder.idl */,
                                D0C419F8218404DA009EC1DE /* WebGPURenderPipeline.cpp */,
                                D0C419F7218404DA009EC1DE /* WebGPURenderPipeline.h */,
                                D0C419F9218404DA009EC1DE /* WebGPURenderPipeline.idl */,
                        path = webgpu;
                        sourceTree = "<group>";
                };
+               D087CE3721ACA94200BDE174 /* cocoa */ = {
+                       isa = PBXGroup;
+                       children = (
+                               D087CE3821ACA94200BDE174 /* GPUCommandBufferMetal.mm */,
+                               D087CE3C21ACA94200BDE174 /* GPUDeviceMetal.mm */,
+                               D087CE3B21ACA94200BDE174 /* GPUProgrammablePassEncoderMetal.mm */,
+                               D087CE3921ACA94200BDE174 /* GPUQueueMetal.mm */,
+                               D087CE3A21ACA94200BDE174 /* GPURenderPassEncoderMetal.mm */,
+                               D087CE3D21ACA94200BDE174 /* GPURenderPipelineMetal.mm */,
+                               D087CE4021ACA94200BDE174 /* GPUShaderModuleMetal.mm */,
+                               D087CE3E21ACA94200BDE174 /* GPUSwapChainMetal.mm */,
+                               D087CE3F21ACA94200BDE174 /* GPUTextureMetal.mm */,
+                       );
+                       path = cocoa;
+                       sourceTree = "<group>";
+               };
                DF9AFD6F13FC31B00015FEB7 /* objc */ = {
                        isa = PBXGroup;
                        children = (
index f606d7c..ca7c603 100644 (file)
@@ -182,7 +182,9 @@ namespace WebCore {
     macro(WebGPUDevice) \
     macro(WebGPUCommandBuffer) \
     macro(WebGPUQueue) \
+    macro(WebGPUProgrammablePassEncoder) \
     macro(WebGPURenderingContext) \
+    macro(WebGPURenderPassEncoder) \
     macro(WebGPURenderPipeline) \
     macro(WebGPUShaderStage) \
     macro(WebGPUShaderModule) \
index 33c7332..81e8e99 100644 (file)
@@ -44,6 +44,8 @@ class GPUCommandBuffer : public RefCounted<GPUCommandBuffer> {
 public:
     static RefPtr<GPUCommandBuffer> create(GPUDevice&);
 
+    PlatformCommandBuffer* platformCommandBuffer() const { return m_platformCommandBuffer.get(); }
+
 private:
     GPUCommandBuffer(PlatformCommandBufferSmartPtr&&);
 
diff --git a/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h b/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h
new file mode 100644 (file)
index 0000000..95bb4b5
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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>
+
+OBJC_PROTOCOL(MTLCommandEncoder);
+
+namespace WebCore {
+
+using PlatformProgrammablePassEncoder = MTLCommandEncoder;
+
+class GPUProgrammablePassEncoder : public RefCounted<GPUProgrammablePassEncoder> {
+public:
+    virtual ~GPUProgrammablePassEncoder() = default;
+
+protected:
+    virtual PlatformProgrammablePassEncoder* platformPassEncoder() const = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/platform/graphics/gpu/GPURenderPassDescriptor.h b/Source/WebCore/platform/graphics/gpu/GPURenderPassDescriptor.h
new file mode 100644 (file)
index 0000000..5a24db3
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include "GPUTexture.h"
+
+namespace WebCore {
+
+struct GPURenderPassDescriptor {
+    Ref<GPUTexture> attachment;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h b/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h
new file mode 100644 (file)
index 0000000..f404478
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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 "GPUProgrammablePassEncoder.h"
+
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_PROTOCOL(MTLRenderCommandEncoder);
+
+namespace WebCore {
+
+class GPUCommandBuffer;
+
+struct GPURenderPassDescriptor;
+
+using PlatformRenderPassEncoder = MTLRenderCommandEncoder;
+using PlatformRenderPassEncoderSmartPtr = RetainPtr<MTLRenderCommandEncoder>;
+
+class GPURenderPassEncoder : public GPUProgrammablePassEncoder {
+public:
+    static RefPtr<GPURenderPassEncoder> create(const GPUCommandBuffer&, GPURenderPassDescriptor&&);
+
+private:
+    GPURenderPassEncoder(PlatformRenderPassEncoderSmartPtr&&);
+    ~GPURenderPassEncoder();
+
+    PlatformProgrammablePassEncoder *platformPassEncoder() const final;
+
+    PlatformRenderPassEncoderSmartPtr m_platformRenderPassEncoder;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
index 837440b..6953155 100644 (file)
@@ -42,6 +42,8 @@ class GPUTexture : public RefCounted<GPUTexture> {
 public:
     static Ref<GPUTexture> create(PlatformTextureSmartPtr&&);
 
+    PlatformTexture *platformTexture() const { return m_platformTexture.get(); }
+
     RefPtr<GPUTexture> createDefaultTextureView();
 
 private:
diff --git a/Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm b/Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm
new file mode 100644 (file)
index 0000000..0bb428f
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "GPUProgrammablePassEncoder.h"
+
+#if ENABLE(WEBGPU)
+
+namespace WebCore {
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
diff --git a/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm b/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm
new file mode 100644 (file)
index 0000000..e01a883
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "GPURenderPassEncoder.h"
+
+#if ENABLE(WEBGPU)
+
+#import "GPUCommandBuffer.h"
+#import "GPURenderPassDescriptor.h"
+#import "Logging.h"
+
+#import <Metal/Metal.h>
+#import <wtf/BlockObjCExceptions.h>
+
+namespace WebCore {
+
+RefPtr<GPURenderPassEncoder> GPURenderPassEncoder::create(const GPUCommandBuffer& buffer, GPURenderPassDescriptor&& descriptor)
+{
+    PlatformRenderPassEncoderSmartPtr mtlEncoder;
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    auto mtlDescriptor = adoptNS([MTLRenderPassDescriptor new]);
+
+    // FIXME: Default to colorAttachments[0] and this loadOp, storeOp, clearColor for now.
+    mtlDescriptor.get().colorAttachments[0].texture = descriptor.attachment->platformTexture();
+    mtlDescriptor.get().colorAttachments[0].loadAction = MTLLoadActionClear;
+    mtlDescriptor.get().colorAttachments[0].storeAction = MTLStoreActionStore;
+    mtlDescriptor.get().colorAttachments[0].clearColor = MTLClearColorMake(0.35, 0.65, 0.85, 1.0);
+
+    mtlEncoder = retainPtr([buffer.platformCommandBuffer() renderCommandEncoderWithDescriptor:mtlDescriptor.get()]);
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    if (!mtlEncoder) {
+        LOG(WebGPU, "GPURenderPassEncoder::create(): Unable to create MTLRenderCommandEncoder!");
+        return nullptr;
+    }
+
+    return adoptRef(new GPURenderPassEncoder(WTFMove(mtlEncoder)));
+}
+
+GPURenderPassEncoder::GPURenderPassEncoder(PlatformRenderPassEncoderSmartPtr&& encoder)
+    : m_platformRenderPassEncoder(WTFMove(encoder))
+{
+}
+
+GPURenderPassEncoder::~GPURenderPassEncoder()
+{
+    // The MTLCommandEncoder must have finished encoding before it can be released.
+    // FIXME: Only call this if we have not already ended encoding.
+    [m_platformRenderPassEncoder endEncoding];
+}
+
+PlatformProgrammablePassEncoder *GPURenderPassEncoder::platformPassEncoder() const
+{
+    return m_platformRenderPassEncoder.get();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)