Diff
Modified: trunk/LayoutTests/ChangeLog (238244 => 238245)
--- trunk/LayoutTests/ChangeLog 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/LayoutTests/ChangeLog 2018-11-15 21:20:27 UTC (rev 238245)
@@ -1,3 +1,19 @@
+2018-11-15 Justin Fan <justin_...@apple.com>
+
+ [WebGPU] WebGPUCommandBuffer prototype
+ https://bugs.webkit.org/show_bug.cgi?id=191663
+
+ Reviewed by Dean Jackson.
+
+ Begin implementation of WebGPUCommandBuffers as well as GPUQueues (MTLCommandBuffer, MTLCommandQueue).
+
+ New testing for WebGPUCommandBuffers, to be fleshed out when WebGPUCommandBufferDescriptors
+ are added to the specification.
+
+ * webgpu/command-buffers-expected.txt: Added.
+ * webgpu/command-buffers.html: Basic functionality, with more stress tests to be added when the spec is updated.
+ * webgpu/webgpu-basics.html: Updated to create the command buffer used by later rendering operations.
+
2018-11-15 Oriol Brufau <obru...@igalia.com>
[css-logical] Implement flow-relative margin, padding and border shorthands
Added: trunk/LayoutTests/webgpu/command-buffers-expected.txt (0 => 238245)
--- trunk/LayoutTests/webgpu/command-buffers-expected.txt (rev 0)
+++ trunk/LayoutTests/webgpu/command-buffers-expected.txt 2018-11-15 21:20:27 UTC (rev 238245)
@@ -0,0 +1,7 @@
+PASS [object WebGPU] is defined.
+PASS Successfully created WebGPUCommandBuffer.
+All tests complete.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/webgpu/command-buffers.html (0 => 238245)
--- trunk/LayoutTests/webgpu/command-buffers.html (rev 0)
+++ trunk/LayoutTests/webgpu/command-buffers.html 2018-11-15 21:20:27 UTC (rev 238245)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<script src=""
+<script src=""
+<script>
+if (window.testRunner)
+ window.testRunner.dumpAsText();
+
+function setUpCommandBuffer() {
+ // FIXME: createCommandBuffer should take a WebGPUCommandBufferDescriptor, which is currently an empty dictionary.
+ let commandBuffer = defaultDevice.createCommandBuffer();
+ if (commandBuffer)
+ testPassed("Successfully created WebGPUCommandBuffer.");
+ else
+ testFailed("Could not create WebGPUCommandBuffer!");
+}
+
+function badCommandBuffer0() {
+ // FIXME: Stress command buffer creation when WebGPUCommandBufferDescriptor is specified.
+}
+
+runWebGPUTests([
+ setUpCommandBuffer,
+ badCommandBuffer0
+ ]);
+
+successfullyParsed = true;
+</script>
+<script src=""
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/webgpu/webgpu-basics.html (238244 => 238245)
--- trunk/LayoutTests/webgpu/webgpu-basics.html 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/LayoutTests/webgpu/webgpu-basics.html 2018-11-15 21:20:27 UTC (rev 238245)
@@ -88,8 +88,18 @@
}
}
-runWebGPUTests([setUpPipeline]);
+function render() {
+ let commandBuffer = defaultDevice.createCommandBuffer();
+ if (!commandBuffer) {
+ testFailed("Could not create WebGPUCommandBuffer!");
+ return;
+ }
+ // FIXME: More commands to follow as they are implemented.
+}
+
+runWebGPUTests([setUpPipeline, render]);
+
successfullyParsed = true;
</script>
<script src=""
Modified: trunk/Source/WebCore/CMakeLists.txt (238244 => 238245)
--- trunk/Source/WebCore/CMakeLists.txt 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/CMakeLists.txt 2018-11-15 21:20:27 UTC (rev 238245)
@@ -458,6 +458,7 @@
Modules/webgpu/WebGPU.idl
Modules/webgpu/WebGPUAdapter.idl
Modules/webgpu/WebGPUAdapterDescriptor.idl
+ Modules/webgpu/WebGPUCommandBuffer.idl
Modules/webgpu/WebGPUDevice.idl
Modules/webgpu/WebGPUPipelineDescriptorBase.idl
Modules/webgpu/WebGPUPipelineStageDescriptor.idl
Modified: trunk/Source/WebCore/ChangeLog (238244 => 238245)
--- trunk/Source/WebCore/ChangeLog 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/ChangeLog 2018-11-15 21:20:27 UTC (rev 238245)
@@ -1,3 +1,57 @@
+2018-11-15 Justin Fan <justin_...@apple.com>
+
+ [WebGPU] WebGPUCommandBuffer prototype
+ https://bugs.webkit.org/show_bug.cgi?id=191663
+
+ Reviewed by Dean Jackson.
+
+ Begin implementation of WebGPUCommandBuffers as well as GPUQueues (MTLCommandBuffer, MTLCommandQueue).
+
+ Test: webgpu/command-buffers.html
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * Modules/webgpu/GPUCommandBuffer.h: Added. Wrapper class around a MTLCommandBuffer.
+ * Modules/webgpu/GPUDevice.cpp:
+ (WebCore::GPUDevice::createCommandBuffer): Added.
+ (WebCore::GPUDevice::getQueue): Returns RefPtr to the device's singleton queue.
+ * Modules/webgpu/GPUDevice.h: Now manages the device's GPUQueue.
+ (WebCore::GPUDevice::platformDevice const):
+ * Modules/webgpu/GPUQueue.h: Added. Wrapper class around a MTLCommandQueue.
+ (WebCore::GPUQueue::platformQueue const):
+ * Modules/webgpu/GPURenderPipeline.h: Moved from Source/WebCore/Modules/webgpu/cocoa/GPURenderPipeline.h.
+ (WebCore::GPURenderPipeline::platformRenderPipeline const):
+ * Modules/webgpu/GPUShaderModule.h:
+ (WebCore::GPUShaderModule::platformShaderModule const):
+ * Modules/webgpu/GPUSwapChain.h: Moved from Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h.
+ (WebCore::GPUSwapChain::platformLayer const):
+ * Modules/webgpu/WebGPUCommandBuffer.cpp: Added. Web interface for a GPU device's command buffer.
+ (WebCore::WebGPUCommandBuffer::create):
+ (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer):
+ * Modules/webgpu/WebGPUCommandBuffer.h: Added.
+ * Modules/webgpu/WebGPUCommandBuffer.idl: Added.
+ * Modules/webgpu/WebGPUDevice.cpp:
+ (WebCore::WebGPUDevice::createCommandBuffer const): Added.
+ * Modules/webgpu/WebGPUDevice.h:
+ * Modules/webgpu/WebGPUDevice.idl:
+ * Modules/webgpu/cocoa/GPUCommandBufferMetal.mm: Added. MTLCommandBuffer impl for GPUCommandBuffer.
+ (WebCore::GPUCommandBuffer::create): Create a MTLCommandBuffer from the MTLCommandQueue.
+ (WebCore::GPUCommandBuffer::GPUCommandBuffer):
+ * Modules/webgpu/cocoa/GPUDeviceMetal.mm:
+ (WebCore::GPUDevice::GPUDevice):
+ * Modules/webgpu/cocoa/GPUQueueMetal.mm: Added. MTLCommandQueue impl for GPUQueue.
+ (WebCore::GPUQueue::create):
+ (WebCore::GPUQueue::GPUQueue):
+ * Modules/webgpu/cocoa/GPURenderPipelineMetal.mm:
+ (WebCore::GPURenderPipeline::GPURenderPipeline):
+ * Modules/webgpu/cocoa/GPUShaderModuleMetal.mm:
+ (WebCore::GPUShaderModule::create):
+ (WebCore::GPUShaderModule::GPUShaderModule):
+ * Sources.txt:
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/WebCoreBuiltinNames.h:
+
2018-11-15 Oriol Brufau <obru...@igalia.com>
[css-logical] Implement flow-relative margin, padding and border shorthands
Modified: trunk/Source/WebCore/DerivedSources.make (238244 => 238245)
--- trunk/Source/WebCore/DerivedSources.make 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/DerivedSources.make 2018-11-15 21:20:27 UTC (rev 238245)
@@ -375,6 +375,7 @@
$(WebCore)/Modules/webgpu/WebGPU.idl \
$(WebCore)/Modules/webgpu/WebGPUAdapter.idl \
$(WebCore)/Modules/webgpu/WebGPUAdapterDescriptor.idl \
+ $(WebCore)/Modules/webgpu/WebGPUCommandBuffer.idl \
$(WebCore)/Modules/webgpu/WebGPUDevice.idl \
$(WebCore)/Modules/webgpu/WebGPUPipelineDescriptorBase.idl \
$(WebCore)/Modules/webgpu/WebGPUPipelineStageDescriptor.idl \
Copied: trunk/Source/WebCore/Modules/webgpu/GPUCommandBuffer.h (from rev 238244, trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h) (0 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/GPUCommandBuffer.h (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUCommandBuffer.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_PROTOCOL(MTLCommandBuffer);
+
+namespace WebCore {
+
+class GPUDevice;
+
+using PlatformCommandBuffer = MTLCommandBuffer;
+using PlatformCommandBufferSmartPtr = RetainPtr<MTLCommandBuffer>;
+
+class GPUCommandBuffer : public RefCounted<GPUCommandBuffer> {
+public:
+ static RefPtr<GPUCommandBuffer> create(GPUDevice&);
+
+private:
+ GPUCommandBuffer(PlatformCommandBufferSmartPtr&&);
+
+ PlatformCommandBufferSmartPtr m_platformCommandBuffer;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp 2018-11-15 21:20:27 UTC (rev 238245)
@@ -45,6 +45,19 @@
return GPURenderPipeline::create(*this, WTFMove(descriptor));
}
+RefPtr<GPUCommandBuffer> GPUDevice::createCommandBuffer()
+{
+ return GPUCommandBuffer::create(*this);
+}
+
+RefPtr<GPUQueue> GPUDevice::getQueue()
+{
+ if (!m_queue)
+ m_queue = GPUQueue::create(*this);
+
+ return m_queue;
+}
+
} // namespace WebCore
#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Modules/webgpu/GPUDevice.h (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/GPUDevice.h 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/GPUDevice.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -27,6 +27,9 @@
#if ENABLE(WEBGPU)
+#include "GPUCommandBuffer.h"
+#include "GPUQueue.h"
+
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/RetainPtr.h>
@@ -38,8 +41,8 @@
using PlatformDevice = MTLDevice;
using PlatformDeviceSmartPtr = RetainPtr<MTLDevice>;
+class GPURenderPipeline;
class GPUShaderModule;
-class GPURenderPipeline;
struct GPUShaderModuleDescriptor;
struct GPURenderPipelineDescriptor;
@@ -51,12 +54,16 @@
RefPtr<GPUShaderModule> createShaderModule(GPUShaderModuleDescriptor&&) const;
RefPtr<GPURenderPipeline> createRenderPipeline(GPURenderPipelineDescriptor&&) const;
- PlatformDevice *platformDevice() const { return m_platformDevice.get(); }
+ RefPtr<GPUCommandBuffer> createCommandBuffer();
+ RefPtr<GPUQueue> getQueue();
+ PlatformDevice* platformDevice() const { return m_platformDevice.get(); }
+
private:
GPUDevice(PlatformDeviceSmartPtr&&);
PlatformDeviceSmartPtr m_platformDevice;
+ RefPtr<GPUQueue> m_queue;
};
} // namespace WebCore
Copied: trunk/Source/WebCore/Modules/webgpu/GPUQueue.h (from rev 238244, trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h) (0 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/GPUQueue.h (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUQueue.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -0,0 +1,57 @@
+/*
+ * 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>
+#include <wtf/RefPtr.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_PROTOCOL(MTLCommandQueue);
+
+namespace WebCore {
+
+class GPUDevice;
+
+using PlatformQueue = MTLCommandQueue;
+using PlatformQueueSmartPtr = RetainPtr<MTLCommandQueue>;
+
+class GPUQueue : public RefCounted<GPUQueue> {
+public:
+ static RefPtr<GPUQueue> create(const GPUDevice&);
+
+ PlatformQueue* platformQueue() const { return m_platformQueue.get(); }
+
+private:
+ GPUQueue(PlatformQueueSmartPtr&&);
+
+ PlatformQueueSmartPtr m_platformQueue;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
Copied: trunk/Source/WebCore/Modules/webgpu/GPURenderPipeline.h (from rev 238244, trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipeline.h) (0 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/GPURenderPipeline.h (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPURenderPipeline.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_PROTOCOL(MTLRenderPipelineState);
+
+namespace WebCore {
+
+class GPUDevice;
+
+struct GPURenderPipelineDescriptor;
+
+using PlatformRenderPipeline = MTLRenderPipelineState;
+using PlatformRenderPipelineSmartPtr = RetainPtr<MTLRenderPipelineState>;
+
+class GPURenderPipeline : public RefCounted<GPURenderPipeline> {
+public:
+ static RefPtr<GPURenderPipeline> create(const GPUDevice&, GPURenderPipelineDescriptor&&);
+
+ PlatformRenderPipeline* platformRenderPipeline() const { return m_platformRenderPipeline.get(); }
+
+private:
+ GPURenderPipeline(PlatformRenderPipelineSmartPtr&&);
+
+ PlatformRenderPipelineSmartPtr m_platformRenderPipeline;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Modules/webgpu/GPUShaderModule.h (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/GPUShaderModule.h 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/GPUShaderModule.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -46,7 +46,7 @@
public:
static RefPtr<GPUShaderModule> create(const GPUDevice&, GPUShaderModuleDescriptor&&);
- PlatformShaderModule *platformShaderModule() const { return m_platformShaderModule.get(); }
+ PlatformShaderModule* platformShaderModule() const { return m_platformShaderModule.get(); }
private:
GPUShaderModule(PlatformShaderModuleSmartPtr&&);
Copied: trunk/Source/WebCore/Modules/webgpu/GPUSwapChain.h (from rev 238244, trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h) (0 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/GPUSwapChain.h (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUSwapChain.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -0,0 +1,60 @@
+/*
+ * 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/RefPtr.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS CAMetalLayer;
+
+namespace WebCore {
+
+class GPUDevice;
+
+using PlatformSwapLayer = CAMetalLayer;
+using PlatformSwapLayerSmartPtr = RetainPtr<CAMetalLayer>;
+
+class GPUSwapChain : public RefCounted<GPUSwapChain> {
+public:
+ static RefPtr<GPUSwapChain> create();
+
+ void setDevice(const GPUDevice&);
+ void reshape(int width, int height);
+ void present();
+
+ PlatformSwapLayer* platformLayer() const { return m_platformSwapLayer.get(); }
+
+private:
+ GPUSwapChain(PlatformSwapLayerSmartPtr&&);
+
+ PlatformSwapLayerSmartPtr m_platformSwapLayer;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp (from rev 238244, trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp) (0 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp 2018-11-15 21:20:27 UTC (rev 238245)
@@ -0,0 +1,50 @@
+/*
+ * 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 "WebGPUCommandBuffer.h"
+
+#if ENABLE(WEBGPU)
+
+#include "GPUCommandBuffer.h"
+
+namespace WebCore {
+
+RefPtr<WebGPUCommandBuffer> WebGPUCommandBuffer::create(RefPtr<GPUCommandBuffer>&& buffer)
+{
+ if (!buffer)
+ return nullptr;
+
+ return adoptRef(new WebGPUCommandBuffer(buffer.releaseNonNull()));
+}
+
+WebGPUCommandBuffer::WebGPUCommandBuffer(Ref<GPUCommandBuffer>&& buffer)
+ : m_commandBuffer(WTFMove(buffer))
+{
+ UNUSED_PARAM(m_commandBuffer);
+}
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h (from rev 238244, trunk/Source/WebCore/Modules/webgpu/GPUDevice.cpp) (0 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -0,0 +1,50 @@
+/*
+ * 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/Ref.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class GPUCommandBuffer;
+
+class WebGPUCommandBuffer : public RefCounted<WebGPUCommandBuffer> {
+public:
+ static RefPtr<WebGPUCommandBuffer> create(RefPtr<GPUCommandBuffer>&&);
+
+private:
+ WebGPUCommandBuffer(Ref<GPUCommandBuffer>&&);
+
+ Ref<GPUCommandBuffer> m_commandBuffer;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
Copied: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.idl (from rev 238244, trunk/Source/WebCore/Modules/webgpu/GPUDevice.h) (0 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.idl (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.idl 2018-11-15 21:20:27 UTC (rev 238245)
@@ -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.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+[
+ Conditional=WEBGPU,
+ EnabledAtRuntime=WebGPU,
+ ImplementationLacksVTable
+] interface WebGPUCommandBuffer {
+/* Not Yet Implemented
+ WebGPURenderPassEncoder beginRenderPass(WebGPURenderPassDescriptor descriptor);
+ WebGPUComputePassEncoder beginComputePass();
+
+ // Commands allowed outside of "passes"
+ void copyBufferToBuffer(
+ WebGPUBuffer src,
+ u32 srcOffset,
+ WebGPUBuffer dst,
+ u32 dstOffset,
+ u32 size);
+
+ void copyBufferToTexture(
+ WebGPUBufferCopyView source,
+ WebGPUTextureCopyView destination,
+ WebGPUExtent3D copySize);
+
+ void copyTextureToBuffer(
+ WebGPUTextureCopyView source,
+ WebGPUBufferCopyView destination,
+ WebGPUExtent3D copySize);
+
+ void copyTextureToTexture(
+ WebGPUTextureCopyView source,
+ WebGPUTextureCopyView destination,
+ WebGPUExtent3D copySize);
+
+ // TODO figure which other commands are needed
+ void blit();
+*/
+};
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp 2018-11-15 21:20:27 UTC (rev 238245)
@@ -28,10 +28,12 @@
#if ENABLE(WEBGPU)
+#include "GPUCommandBuffer.h"
#include "GPUPipelineStageDescriptor.h"
#include "GPURenderPipelineDescriptor.h"
#include "GPUShaderModuleDescriptor.h"
#include "Logging.h"
+#include "WebGPUCommandBuffer.h"
#include "WebGPUPipelineStageDescriptor.h"
#include "WebGPURenderPipeline.h"
#include "WebGPURenderPipelineDescriptor.h"
@@ -117,6 +119,11 @@
return WebGPURenderPipeline::create(m_device->createRenderPipeline(GPURenderPipelineDescriptor { WTFMove(vertexStage), WTFMove(fragmentStage), static_cast<GPURenderPipelineDescriptor::PrimitiveTopology>(descriptor.primitiveTopology) }));
}
+RefPtr<WebGPUCommandBuffer> WebGPUDevice::createCommandBuffer() const
+{
+ return WebGPUCommandBuffer::create(m_device->createCommandBuffer());
+}
+
} // namespace WebCore
#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -37,7 +37,7 @@
namespace WebCore {
class ScriptExecutionContext;
-class WebGPUAdapter;
+class WebGPUCommandBuffer;
class WebGPURenderPipeline;
class WebGPUShaderModule;
@@ -54,6 +54,8 @@
RefPtr<WebGPUShaderModule> createShaderModule(WebGPUShaderModuleDescriptor&&) const;
RefPtr<WebGPURenderPipeline> createRenderPipeline(WebGPURenderPipelineDescriptor&&) const;
+ RefPtr<WebGPUCommandBuffer> createCommandBuffer() const;
+
private:
WebGPUDevice(Ref<WebGPUAdapter>&&, RefPtr<GPUDevice>&&);
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl 2018-11-15 21:20:27 UTC (rev 238245)
@@ -36,6 +36,9 @@
WebGPUShaderModule createShaderModule(WebGPUShaderModuleDescriptor descriptor);
WebGPURenderPipeline createRenderPipeline(WebGPURenderPipelineDescriptor descriptor);
+ // FIXME: Currently, WebGPUCommandBufferDescriptor is an empty dictionary.
+ WebGPUCommandBuffer createCommandBuffer(/*WebGPUCommandBufferDescriptor descriptor*/);
+
/* To Be Implemented:
WebGPUBuffer createBuffer(WebGPUBufferDescriptor descriptor);
WebGPUTexture createTexture(WebGPUTextureDescriptor descriptor);
@@ -50,7 +53,6 @@
WebGPUInputState createInputState(WebGPUInputStateDescriptor descriptor);
WebGPUAttachmentState createAttachmentState(WebGPUAttachmentStateDescriptor descriptor);
WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor);
- WebGPUCommandBuffer createCommandBuffer(WebGPUCommandBufferDescriptor descriptor);
WebGPUFence createFence(WebGPUFenceDescriptor descriptor);
WebGPUQueue getQueue();
Copied: trunk/Source/WebCore/Modules/webgpu/cocoa/GPUCommandBufferMetal.mm (from rev 238244, trunk/Source/WebCore/Modules/webgpu/cocoa/GPUDeviceMetal.mm) (0 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPUCommandBufferMetal.mm (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPUCommandBufferMetal.mm 2018-11-15 21:20:27 UTC (rev 238245)
@@ -0,0 +1,77 @@
+/*
+ * 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 "GPUCommandBuffer.h"
+
+#if ENABLE(WEBGPU)
+
+#import "GPUDevice.h"
+#import "GPUQueue.h"
+#import "Logging.h"
+
+#import <Metal/Metal.h>
+#import <wtf/BlockObjCExceptions.h>
+
+namespace WebCore {
+
+RefPtr<GPUCommandBuffer> GPUCommandBuffer::create(GPUDevice& device)
+{
+ if (!device.platformDevice()) {
+ LOG(WebGPU, "GPUCommandBuffer::create(): Invalid GPUDevice!");
+ return nullptr;
+ }
+
+ auto gpuCommandQueue = device.getQueue();
+ if (!gpuCommandQueue)
+ return nullptr;
+
+ auto mtlQueue = gpuCommandQueue->platformQueue();
+
+ PlatformCommandBufferSmartPtr buffer;
+
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+ buffer = retainPtr([mtlQueue commandBuffer]);
+
+ END_BLOCK_OBJC_EXCEPTIONS;
+
+ if (!buffer) {
+ LOG(WebGPU, "GPUCommandBuffer::create(): Unable to create MTLCommandBuffer!");
+ return nullptr;
+ }
+
+ return adoptRef(new GPUCommandBuffer(WTFMove(buffer)));
+}
+
+GPUCommandBuffer::GPUCommandBuffer(PlatformCommandBufferSmartPtr&& buffer)
+ : m_platformCommandBuffer(WTFMove(buffer))
+{
+ UNUSED_PARAM(m_platformCommandBuffer);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Modules/webgpu/cocoa/GPUDeviceMetal.mm (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPUDeviceMetal.mm 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPUDeviceMetal.mm 2018-11-15 21:20:27 UTC (rev 238245)
@@ -57,7 +57,6 @@
GPUDevice::GPUDevice(PlatformDeviceSmartPtr&& device)
: m_platformDevice(WTFMove(device))
{
- UNUSED_PARAM(m_platformDevice);
}
} // namespace WebCore
Copied: trunk/Source/WebCore/Modules/webgpu/cocoa/GPUQueueMetal.mm (from rev 238244, trunk/Source/WebCore/Modules/webgpu/cocoa/GPUDeviceMetal.mm) (0 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPUQueueMetal.mm (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPUQueueMetal.mm 2018-11-15 21:20:27 UTC (rev 238245)
@@ -0,0 +1,69 @@
+/*
+ * 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 "GPUQueue.h"
+
+#if ENABLE(WEBGPU)
+
+#import "GPUDevice.h"
+#import "Logging.h"
+
+#import <Metal/Metal.h>
+#import <wtf/BlockObjCExceptions.h>
+
+namespace WebCore {
+
+RefPtr<GPUQueue> GPUQueue::create(const GPUDevice& device)
+{
+ if (!device.platformDevice()) {
+ LOG(WebGPU, "GPUQueue::create(): Invalid GPUDevice!");
+ return nullptr;
+ }
+
+ PlatformQueueSmartPtr queue;
+
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+ queue = adoptNS([device.platformDevice() newCommandQueue]);
+
+ END_BLOCK_OBJC_EXCEPTIONS;
+
+ if (!queue) {
+ LOG(WebGPU, "GPUQueue::create(): Unable to create MTLCommandQueue!");
+ return nullptr;
+ }
+
+ return adoptRef(new GPUQueue(WTFMove(queue)));
+}
+
+GPUQueue::GPUQueue(PlatformQueueSmartPtr&& queue)
+ : m_platformQueue(WTFMove(queue))
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
Deleted: trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipeline.h (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipeline.h 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipeline.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -1,59 +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 <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/RetainPtr.h>
-
-OBJC_PROTOCOL(MTLRenderPipelineState);
-
-namespace WebCore {
-
-class GPUDevice;
-
-struct GPURenderPipelineDescriptor;
-
-using PlatformRenderPipeline = MTLRenderPipelineState;
-using PlatformRenderPipelineSmartPtr = RetainPtr<MTLRenderPipelineState>;
-
-class GPURenderPipeline : public RefCounted<GPURenderPipeline> {
-public:
- static RefPtr<GPURenderPipeline> create(const GPUDevice&, GPURenderPipelineDescriptor&&);
-
- PlatformRenderPipeline *platformRenderPipeline() const { return m_platformRenderPipeline.get(); }
-
-private:
- GPURenderPipeline(PlatformRenderPipelineSmartPtr&&);
-
- PlatformRenderPipelineSmartPtr m_platformRenderPipeline;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipelineMetal.mm (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipelineMetal.mm 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPURenderPipelineMetal.mm 2018-11-15 21:20:27 UTC (rev 238245)
@@ -130,7 +130,6 @@
GPURenderPipeline::GPURenderPipeline(PlatformRenderPipelineSmartPtr&& pipeline)
: m_platformRenderPipeline(WTFMove(pipeline))
{
- UNUSED_PARAM(m_platformRenderPipeline);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webgpu/cocoa/GPUShaderModuleMetal.mm (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPUShaderModuleMetal.mm 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPUShaderModuleMetal.mm 2018-11-15 21:20:27 UTC (rev 238245)
@@ -39,12 +39,14 @@
RefPtr<GPUShaderModule> GPUShaderModule::create(const GPUDevice& device, GPUShaderModuleDescriptor&& descriptor)
{
- if (!device.platformDevice())
+ if (!device.platformDevice()) {
+ LOG(WebGPU, "GPUShaderModule::create(): Invalid GPUDevice!");
return nullptr;
+ }
PlatformShaderModuleSmartPtr module;
- BEGIN_BLOCK_OBJC_EXCEPTIONS
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
NSError *error = [NSError errorWithDomain:@"com.apple.WebKit.GPU" code:1 userInfo:nil];
module = adoptNS([device.platformDevice() newLibraryWithSource:descriptor.code options:nil error:&error]);
@@ -62,7 +64,6 @@
GPUShaderModule::GPUShaderModule(PlatformShaderModuleSmartPtr&& module)
: m_platformShaderModule(WTFMove(module))
{
- UNUSED_PARAM(m_platformShaderModule);
}
}
Deleted: trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h (238244 => 238245)
--- trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Modules/webgpu/cocoa/GPUSwapChain.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -1,60 +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 <wtf/RefPtr.h>
-#include <wtf/RetainPtr.h>
-
-OBJC_CLASS CAMetalLayer;
-
-namespace WebCore {
-
-class GPUDevice;
-
-using PlatformSwapLayer = CAMetalLayer;
-using PlatformSwapLayerSmartPtr = RetainPtr<CAMetalLayer>;
-
-class GPUSwapChain : public RefCounted<GPUSwapChain> {
-public:
- static RefPtr<GPUSwapChain> create();
-
- void setDevice(const GPUDevice&);
- void reshape(int width, int height);
- void present();
-
- PlatformSwapLayer *platformLayer() const { return m_platformSwapLayer.get(); }
-
-private:
- GPUSwapChain(PlatformSwapLayerSmartPtr&&);
-
- PlatformSwapLayerSmartPtr m_platformSwapLayer;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
Modified: trunk/Source/WebCore/Sources.txt (238244 => 238245)
--- trunk/Source/WebCore/Sources.txt 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/Sources.txt 2018-11-15 21:20:27 UTC (rev 238245)
@@ -304,6 +304,7 @@
Modules/webgpu/GPUDevice.cpp
Modules/webgpu/WebGPU.cpp
Modules/webgpu/WebGPUAdapter.cpp
+Modules/webgpu/WebGPUCommandBuffer.cpp
Modules/webgpu/WebGPUDevice.cpp
Modules/webgpu/WebGPURenderingContext.cpp
Modules/webgpu/WebGPURenderPipeline.cpp
@@ -3208,6 +3209,7 @@
JSWebGPU.cpp
JSWebGPUAdapter.cpp
JSWebGPUAdapterDescriptor.cpp
+JSWebGPUCommandBuffer.cpp
JSWebGPUDevice.cpp
JSWebGPUPipelineDescriptorBase.cpp
JSWebGPUPipelineStageDescriptor.cpp
Modified: trunk/Source/WebCore/SourcesCocoa.txt (238244 => 238245)
--- trunk/Source/WebCore/SourcesCocoa.txt 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2018-11-15 21:20:27 UTC (rev 238245)
@@ -27,7 +27,9 @@
Modules/plugins/YouTubePluginReplacement.cpp
Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm
+Modules/webgpu/cocoa/GPUCommandBufferMetal.mm
Modules/webgpu/cocoa/GPUDeviceMetal.mm
+Modules/webgpu/cocoa/GPUQueueMetal.mm
Modules/webgpu/cocoa/GPURenderPipelineMetal.mm
Modules/webgpu/cocoa/GPUShaderModuleMetal.mm
Modules/webgpu/cocoa/GPUSwapChainMetal.mm
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (238244 => 238245)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-11-15 21:20:27 UTC (rev 238245)
@@ -13842,7 +13842,6 @@
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>"; };
- D09727B52187F44300942F3A /* GPUSwapChain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GPUSwapChain.h; path = cocoa/GPUSwapChain.h; sourceTree = "<group>"; };
D09727B62187F44300942F3A /* GPUSwapChainMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUSwapChainMetal.mm; sourceTree = "<group>"; };
D09727C2218A472900942F3A /* GPUShaderModuleDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUShaderModuleDescriptor.h; sourceTree = "<group>"; };
D09727CA218BD7A500942F3A /* GPUDevice.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUDevice.cpp; sourceTree = "<group>"; };
@@ -13865,7 +13864,6 @@
D0C419F7218404DA009EC1DE /* WebGPURenderPipeline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPURenderPipeline.h; sourceTree = "<group>"; };
D0C419F8218404DA009EC1DE /* WebGPURenderPipeline.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPURenderPipeline.cpp; sourceTree = "<group>"; };
D0C419F9218404DA009EC1DE /* WebGPURenderPipeline.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPURenderPipeline.idl; sourceTree = "<group>"; };
- D0C419FA21840F6C009EC1DE /* GPURenderPipeline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GPURenderPipeline.h; path = cocoa/GPURenderPipeline.h; sourceTree = "<group>"; };
D0C419FB21840F6C009EC1DE /* GPURenderPipelineMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPURenderPipelineMetal.mm; sourceTree = "<group>"; };
D0CAAE98216824A6001C91C7 /* WebMetalBuffer.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebMetalBuffer.idl; sourceTree = "<group>"; };
D0CAAE9A216824A6001C91C7 /* WebMetalCommandBuffer.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebMetalCommandBuffer.idl; sourceTree = "<group>"; };
@@ -13876,6 +13874,15 @@
D0DA0BE4217930E2007FE2AC /* WebGPUSwapChain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUSwapChain.h; sourceTree = "<group>"; };
D0DA0BE5217930E2007FE2AC /* WebGPUSwapChain.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUSwapChain.cpp; sourceTree = "<group>"; };
D0DA0BE6217930E2007FE2AC /* WebGPUSwapChain.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUSwapChain.idl; sourceTree = "<group>"; };
+ D0EACF7621937228000FA75C /* WebGPUCommandBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUCommandBuffer.h; sourceTree = "<group>"; };
+ D0EACF7721937228000FA75C /* WebGPUCommandBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUCommandBuffer.cpp; sourceTree = "<group>"; };
+ D0EACF7821937228000FA75C /* WebGPUCommandBuffer.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUCommandBuffer.idl; sourceTree = "<group>"; };
+ D0EACF7B21938253000FA75C /* GPUCommandBufferMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUCommandBufferMetal.mm; sourceTree = "<group>"; };
+ D0EACF7C219382AF000FA75C /* GPUSwapChain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GPUSwapChain.h; path = Modules/webgpu/GPUSwapChain.h; sourceTree = SOURCE_ROOT; };
+ D0EACF7D219382B0000FA75C /* GPURenderPipeline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GPURenderPipeline.h; path = Modules/webgpu/GPURenderPipeline.h; sourceTree = SOURCE_ROOT; };
+ D0EACF7E219382B0000FA75C /* GPUCommandBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GPUCommandBuffer.h; path = Modules/webgpu/GPUCommandBuffer.h; sourceTree = SOURCE_ROOT; };
+ D0EACF80219391EE000FA75C /* GPUQueueMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUQueueMetal.mm; sourceTree = "<group>"; };
+ D0EACF812193921A000FA75C /* GPUQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUQueue.h; sourceTree = "<group>"; };
D0EDA772143E303C0028E383 /* CachedRawResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedRawResource.cpp; sourceTree = "<group>"; };
D0EDA773143E303C0028E383 /* CachedRawResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedRawResource.h; sourceTree = "<group>"; };
D0FF2A5B11F8C45A007E74E0 /* PingLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PingLoader.cpp; sourceTree = "<group>"; };
@@ -25539,14 +25546,16 @@
D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */,
D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */,
D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */,
+ D0EACF7E219382B0000FA75C /* GPUCommandBuffer.h */,
D09727CA218BD7A500942F3A /* GPUDevice.cpp */,
D0615FCF217FF185008A48A8 /* GPUDevice.h */,
D046FB67218D180300CB8F62 /* GPUPipelineStageDescriptor.h */,
- D0C419FA21840F6C009EC1DE /* GPURenderPipeline.h */,
+ D0EACF812193921A000FA75C /* GPUQueue.h */,
+ D0EACF7D219382B0000FA75C /* GPURenderPipeline.h */,
D046FB65218D073C00CB8F62 /* GPURenderPipelineDescriptor.h */,
D060D888218280C100339318 /* GPUShaderModule.h */,
D09727C2218A472900942F3A /* GPUShaderModuleDescriptor.h */,
- D09727B52187F44300942F3A /* GPUSwapChain.h */,
+ D0EACF7C219382AF000FA75C /* GPUSwapChain.h */,
D00F5947216EFE54000D71DB /* WebGPU.cpp */,
D00F5946216EFE54000D71DB /* WebGPU.h */,
D00F5948216EFE54000D71DB /* WebGPU.idl */,
@@ -25555,6 +25564,9 @@
D00F5951216FFAC2000D71DB /* WebGPUAdapter.idl */,
D02C26912181416D00D818E4 /* WebGPUAdapterDescriptor.h */,
D02C26922181416D00D818E4 /* WebGPUAdapterDescriptor.idl */,
+ D0EACF7721937228000FA75C /* WebGPUCommandBuffer.cpp */,
+ D0EACF7621937228000FA75C /* WebGPUCommandBuffer.h */,
+ D0EACF7821937228000FA75C /* WebGPUCommandBuffer.idl */,
D00F595321701D8C000D71DB /* WebGPUDevice.cpp */,
D00F595221701D8C000D71DB /* WebGPUDevice.h */,
D00F595421701D8C000D71DB /* WebGPUDevice.idl */,
@@ -25587,7 +25599,9 @@
D0615FD2217FFEE3008A48A8 /* cocoa */ = {
isa = PBXGroup;
children = (
+ D0EACF7B21938253000FA75C /* GPUCommandBufferMetal.mm */,
D0615FD1217FF1E1008A48A8 /* GPUDeviceMetal.mm */,
+ D0EACF80219391EE000FA75C /* GPUQueueMetal.mm */,
D0C419FB21840F6C009EC1DE /* GPURenderPipelineMetal.mm */,
D060D889218280C100339318 /* GPUShaderModuleMetal.mm */,
D09727B62187F44300942F3A /* GPUSwapChainMetal.mm */,
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (238244 => 238245)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2018-11-15 21:15:26 UTC (rev 238244)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2018-11-15 21:20:27 UTC (rev 238245)
@@ -180,6 +180,7 @@
macro(WebGPU) \
macro(WebGPUAdapter) \
macro(WebGPUDevice) \
+ macro(WebGPUCommandBuffer) \
macro(WebGPURenderingContext) \
macro(WebGPURenderPipeline) \
macro(WebGPUShaderStage) \