Title: [292741] trunk/Source
Revision
292741
Author
mmaxfi...@apple.com
Date
2022-04-11 17:04:35 -0700 (Mon, 11 Apr 2022)

Log Message

[WebGPU] Hook up device.queue to the IDL
https://bugs.webkit.org/show_bug.cgi?id=239043

Reviewed by Kimmo Kinnunen.

Source/WebCore:

It seems when I imported the WebGPU IDLs, I somehow skipped GPUDevice.queue.
I was probably unsure about the ownership model. Now that the ownership model
is straightened out, this can be implemented.

This is needed to run any of the CTS tests.

* Modules/WebGPU/GPUDevice.cpp:
(WebCore::GPUDevice::queue const):
* Modules/WebGPU/GPUDevice.h:
(WebCore::GPUDevice::m_queue):
(WebCore::GPUDevice::m_backing): Deleted.
* Modules/WebGPU/GPUDevice.idl:

Source/WebCore/PAL:

* pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp:
(PAL::WebGPU::DeviceImpl::DeviceImpl):
(PAL::WebGPU::DeviceImpl::queue):
* pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.h:
* pal/graphics/WebGPU/WebGPUDevice.h:

Source/WebKit:

* GPUProcess/graphics/WebGPU/RemoteAdapter.cpp:
(WebKit::RemoteAdapter::requestDevice):
* GPUProcess/graphics/WebGPU/RemoteAdapter.h:
* GPUProcess/graphics/WebGPU/RemoteAdapter.messages.in:
* GPUProcess/graphics/WebGPU/RemoteDevice.cpp:
(WebKit::RemoteDevice::RemoteDevice):
(WebKit::RemoteDevice::queue):
* GPUProcess/graphics/WebGPU/RemoteDevice.h:
* WebProcess/GPU/graphics/WebGPU/RemoteAdapterProxy.cpp:
(WebKit::WebGPU::RemoteAdapterProxy::requestDevice):
* WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.cpp:
(WebKit::WebGPU::RemoteDeviceProxy::RemoteDeviceProxy):
(WebKit::WebGPU::RemoteDeviceProxy::queue):
* WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (292740 => 292741)


--- trunk/Source/WebCore/ChangeLog	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebCore/ChangeLog	2022-04-12 00:04:35 UTC (rev 292741)
@@ -1,3 +1,23 @@
+2022-04-11  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [WebGPU] Hook up device.queue to the IDL
+        https://bugs.webkit.org/show_bug.cgi?id=239043
+
+        Reviewed by Kimmo Kinnunen.
+
+        It seems when I imported the WebGPU IDLs, I somehow skipped GPUDevice.queue.
+        I was probably unsure about the ownership model. Now that the ownership model
+        is straightened out, this can be implemented.
+
+        This is needed to run any of the CTS tests.
+
+        * Modules/WebGPU/GPUDevice.cpp:
+        (WebCore::GPUDevice::queue const):
+        * Modules/WebGPU/GPUDevice.h:
+        (WebCore::GPUDevice::m_queue):
+        (WebCore::GPUDevice::m_backing): Deleted.
+        * Modules/WebGPU/GPUDevice.idl:
+
 2022-04-11  Philippe Normand  <pnorm...@igalia.com>
 
         [GStreamer] Debugs logs from VideoSinkCommon are missing

Modified: trunk/Source/WebCore/Modules/WebGPU/GPUDevice.cpp (292740 => 292741)


--- trunk/Source/WebCore/Modules/WebGPU/GPUDevice.cpp	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebCore/Modules/WebGPU/GPUDevice.cpp	2022-04-12 00:04:35 UTC (rev 292741)
@@ -86,6 +86,11 @@
     return GPUSupportedLimits::create(m_backing->limits());
 }
 
+GPUQueue& GPUDevice::queue() const
+{
+    return m_queue;
+}
+
 void GPUDevice::destroy()
 {
     m_backing->destroy();

Modified: trunk/Source/WebCore/Modules/WebGPU/GPUDevice.h (292740 => 292741)


--- trunk/Source/WebCore/Modules/WebGPU/GPUDevice.h	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebCore/Modules/WebGPU/GPUDevice.h	2022-04-12 00:04:35 UTC (rev 292741)
@@ -33,6 +33,7 @@
 #include "GPUError.h"
 #include "GPUErrorFilter.h"
 #include "GPURenderPipeline.h"
+#include "GPUQueue.h"
 #include "JSDOMPromiseDeferred.h"
 #include "ScriptExecutionContext.h"
 #include <optional>
@@ -90,6 +91,8 @@
     Ref<GPUSupportedFeatures> features() const;
     Ref<GPUSupportedLimits> limits() const;
 
+    GPUQueue& queue() const;
+
     void destroy();
 
     Ref<GPUBuffer> createBuffer(const GPUBufferDescriptor&);
@@ -131,6 +134,7 @@
     GPUDevice(ScriptExecutionContext* scriptExecutionContext, Ref<PAL::WebGPU::Device>&& backing)
         : ActiveDOMObject { scriptExecutionContext }
         , m_backing(WTFMove(backing))
+        , m_queue(GPUQueue::create(Ref { m_backing->queue() }))
     {
     }
 
@@ -146,6 +150,7 @@
 
     LostPromise m_lostPromise;
     Ref<PAL::WebGPU::Device> m_backing;
+    Ref<GPUQueue> m_queue;
 };
 
 }

Modified: trunk/Source/WebCore/Modules/WebGPU/GPUDevice.idl (292740 => 292741)


--- trunk/Source/WebCore/Modules/WebGPU/GPUDevice.idl	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebCore/Modules/WebGPU/GPUDevice.idl	2022-04-12 00:04:35 UTC (rev 292741)
@@ -35,6 +35,8 @@
     [SameObject] readonly attribute GPUSupportedFeatures features;
     [SameObject] readonly attribute GPUSupportedLimits limits;
 
+    [SameObject] readonly attribute GPUQueue queue;
+
     undefined destroy();
 
     GPUBuffer createBuffer(GPUBufferDescriptor descriptor);

Modified: trunk/Source/WebCore/PAL/ChangeLog (292740 => 292741)


--- trunk/Source/WebCore/PAL/ChangeLog	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebCore/PAL/ChangeLog	2022-04-12 00:04:35 UTC (rev 292741)
@@ -1,5 +1,18 @@
 2022-04-11  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        [WebGPU] Hook up device.queue to the IDL
+        https://bugs.webkit.org/show_bug.cgi?id=239043
+
+        Reviewed by Kimmo Kinnunen.
+
+        * pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp:
+        (PAL::WebGPU::DeviceImpl::DeviceImpl):
+        (PAL::WebGPU::DeviceImpl::queue):
+        * pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.h:
+        * pal/graphics/WebGPU/WebGPUDevice.h:
+
+2022-04-11  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         Sort PAL.xcodeproj.
         https://bugs.webkit.org/show_bug.cgi?id=239050
 

Modified: trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp (292740 => 292741)


--- trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp	2022-04-12 00:04:35 UTC (rev 292741)
@@ -66,6 +66,7 @@
     : Device(WTFMove(features), WTFMove(limits))
     , m_backing(device)
     , m_convertToBackingContext(convertToBackingContext)
+    , m_queue(QueueImpl::create(wgpuDeviceGetQueue(device), convertToBackingContext))
 {
 }
 
@@ -74,6 +75,11 @@
     wgpuDeviceRelease(m_backing);
 }
 
+Queue& DeviceImpl::queue()
+{
+    return m_queue;
+}
+
 void DeviceImpl::destroy()
 {
     wgpuDeviceDestroy(m_backing);

Modified: trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.h (292740 => 292741)


--- trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.h	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.h	2022-04-12 00:04:35 UTC (rev 292741)
@@ -28,6 +28,7 @@
 #if HAVE(WEBGPU_IMPLEMENTATION)
 
 #include "WebGPUDevice.h"
+#include "WebGPUQueueImpl.h"
 #include <WebGPU/WebGPU.h>
 #include <wtf/Deque.h>
 
@@ -57,6 +58,8 @@
 
     WGPUDevice backing() const { return m_backing; }
 
+    Queue& queue() final;
+
     void destroy() final;
 
     Ref<Buffer> createBuffer(const BufferDescriptor&) final;
@@ -86,6 +89,7 @@
 
     WGPUDevice m_backing { nullptr };
     Ref<ConvertToBackingContext> m_convertToBackingContext;
+    Ref<QueueImpl> m_queue;
 };
 
 } // namespace PAL::WebGPU

Modified: trunk/Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUDevice.h (292740 => 292741)


--- trunk/Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUDevice.h	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebCore/PAL/pal/graphics/WebGPU/WebGPUDevice.h	2022-04-12 00:04:35 UTC (rev 292741)
@@ -58,6 +58,7 @@
 struct PipelineLayoutDescriptor;
 class QuerySet;
 struct QuerySetDescriptor;
+class Queue;
 class RenderBundleEncoder;
 struct RenderBundleEncoderDescriptor;
 class RenderPipeline;
@@ -86,6 +87,8 @@
     SupportedLimits& limits() { return m_limits; }
     const SupportedLimits& limits() const { return m_limits; }
 
+    virtual Queue& queue() = 0;
+
     virtual void destroy() = 0;
 
     virtual Ref<Buffer> createBuffer(const BufferDescriptor&) = 0;

Modified: trunk/Source/WebKit/ChangeLog (292740 => 292741)


--- trunk/Source/WebKit/ChangeLog	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebKit/ChangeLog	2022-04-12 00:04:35 UTC (rev 292741)
@@ -1,3 +1,25 @@
+2022-04-11  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [WebGPU] Hook up device.queue to the IDL
+        https://bugs.webkit.org/show_bug.cgi?id=239043
+
+        Reviewed by Kimmo Kinnunen.
+
+        * GPUProcess/graphics/WebGPU/RemoteAdapter.cpp:
+        (WebKit::RemoteAdapter::requestDevice):
+        * GPUProcess/graphics/WebGPU/RemoteAdapter.h:
+        * GPUProcess/graphics/WebGPU/RemoteAdapter.messages.in:
+        * GPUProcess/graphics/WebGPU/RemoteDevice.cpp:
+        (WebKit::RemoteDevice::RemoteDevice):
+        (WebKit::RemoteDevice::queue):
+        * GPUProcess/graphics/WebGPU/RemoteDevice.h:
+        * WebProcess/GPU/graphics/WebGPU/RemoteAdapterProxy.cpp:
+        (WebKit::WebGPU::RemoteAdapterProxy::requestDevice):
+        * WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.cpp:
+        (WebKit::WebGPU::RemoteDeviceProxy::RemoteDeviceProxy):
+        (WebKit::WebGPU::RemoteDeviceProxy::queue):
+        * WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.h:
+
 2022-04-11  Alex Christensen  <achristen...@webkit.org>
 
         Use WebKit::blockedError instead of ResourceLoader::blockedError in WebLoaderStrategy::scheduleLoadFromNetworkProcess

Modified: trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.cpp (292740 => 292741)


--- trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.cpp	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.cpp	2022-04-12 00:04:35 UTC (rev 292741)
@@ -30,6 +30,7 @@
 
 #include "RemoteAdapterMessages.h"
 #include "RemoteDevice.h"
+#include "RemoteQueue.h"
 #include "StreamServerConnection.h"
 #include "WebGPUDeviceDescriptor.h"
 #include "WebGPUObjectHeap.h"
@@ -56,7 +57,7 @@
     m_streamConnection->stopReceivingMessages(Messages::RemoteAdapter::messageReceiverName(), m_identifier.toUInt64());
 }
 
-void RemoteAdapter::requestDevice(const WebGPU::DeviceDescriptor& descriptor, WebGPUIdentifier identifier, CompletionHandler<void(WebGPU::SupportedFeatures&&, WebGPU::SupportedLimits&&)>&& callback)
+void RemoteAdapter::requestDevice(const WebGPU::DeviceDescriptor& descriptor, WebGPUIdentifier identifier, WebGPUIdentifier queueIdentifier, CompletionHandler<void(WebGPU::SupportedFeatures&&, WebGPU::SupportedLimits&&)>&& callback)
 {
     auto convertedDescriptor = m_objectHeap.convertFromBacking(descriptor);
     ASSERT(convertedDescriptor);
@@ -65,9 +66,10 @@
         return;
     }
 
-    m_backing->requestDevice(*convertedDescriptor, [callback = WTFMove(callback), objectHeap = Ref { m_objectHeap }, streamConnection = m_streamConnection.copyRef(), identifier] (Ref<PAL::WebGPU::Device>&& device) mutable {
-        auto remoteDevice = RemoteDevice::create(device, objectHeap, WTFMove(streamConnection), identifier);
+    m_backing->requestDevice(*convertedDescriptor, [callback = WTFMove(callback), objectHeap = Ref { m_objectHeap }, streamConnection = m_streamConnection.copyRef(), identifier, queueIdentifier] (Ref<PAL::WebGPU::Device>&& device) mutable {
+        auto remoteDevice = RemoteDevice::create(device, objectHeap, WTFMove(streamConnection), identifier, queueIdentifier);
         objectHeap->addObject(identifier, remoteDevice);
+        objectHeap->addObject(queueIdentifier, remoteDevice->queue());
         const auto& features = device->features();
         const auto& limits = device->limits();
         callback(WebGPU::SupportedFeatures { features.features() }, WebGPU::SupportedLimits {

Modified: trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.h (292740 => 292741)


--- trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.h	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.h	2022-04-12 00:04:35 UTC (rev 292741)
@@ -75,7 +75,7 @@
 
     void didReceiveStreamMessage(IPC::StreamServerConnection&, IPC::Decoder&) final;
 
-    void requestDevice(const WebGPU::DeviceDescriptor&, WebGPUIdentifier, CompletionHandler<void(WebGPU::SupportedFeatures&&, WebGPU::SupportedLimits&&)>&&);
+    void requestDevice(const WebGPU::DeviceDescriptor&, WebGPUIdentifier, WebGPUIdentifier queueIdentifier, CompletionHandler<void(WebGPU::SupportedFeatures&&, WebGPU::SupportedLimits&&)>&&);
 
     Ref<PAL::WebGPU::Adapter> m_backing;
     WebGPU::ObjectHeap& m_objectHeap;

Modified: trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.messages.in (292740 => 292741)


--- trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.messages.in	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.messages.in	2022-04-12 00:04:35 UTC (rev 292741)
@@ -24,7 +24,7 @@
 #if ENABLE(GPU_PROCESS)
 
 messages -> RemoteAdapter NotRefCounted Stream {
-    void RequestDevice(WebKit::WebGPU::DeviceDescriptor deviceDescriptor, WebKit::WebGPUIdentifier identifier) -> (WebKit::WebGPU::SupportedFeatures supportedFeatures, WebKit::WebGPU::SupportedLimits supportedLimits) Synchronous
+    void RequestDevice(WebKit::WebGPU::DeviceDescriptor deviceDescriptor, WebKit::WebGPUIdentifier identifier, WebKit::WebGPUIdentifier queueIdentifier) -> (WebKit::WebGPU::SupportedFeatures supportedFeatures, WebKit::WebGPU::SupportedLimits supportedLimits) Synchronous
 }
 
 #endif

Modified: trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.cpp (292740 => 292741)


--- trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.cpp	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.cpp	2022-04-12 00:04:35 UTC (rev 292741)
@@ -78,11 +78,12 @@
 
 namespace WebKit {
 
-RemoteDevice::RemoteDevice(PAL::WebGPU::Device& device, WebGPU::ObjectHeap& objectHeap, Ref<IPC::StreamServerConnection>&& streamConnection, WebGPUIdentifier identifier)
+RemoteDevice::RemoteDevice(PAL::WebGPU::Device& device, WebGPU::ObjectHeap& objectHeap, Ref<IPC::StreamServerConnection>&& streamConnection, WebGPUIdentifier identifier, WebGPUIdentifier queueIdentifier)
     : m_backing(device)
     , m_objectHeap(objectHeap)
-    , m_streamConnection(WTFMove(streamConnection))
+    , m_streamConnection(streamConnection.copyRef())
     , m_identifier(identifier)
+    , m_queue(RemoteQueue::create(device.queue(), objectHeap, WTFMove(streamConnection), queueIdentifier))
 {
     m_streamConnection->startReceivingMessages(*this, Messages::RemoteDevice::messageReceiverName(), m_identifier.toUInt64());
 }
@@ -94,6 +95,11 @@
     m_streamConnection->stopReceivingMessages(Messages::RemoteDevice::messageReceiverName(), m_identifier.toUInt64());
 }
 
+RemoteQueue& RemoteDevice::queue()
+{
+    return m_queue;
+}
+
 void RemoteDevice::destroy()
 {
     m_backing->destroy();

Modified: trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.h (292740 => 292741)


--- trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.h	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.h	2022-04-12 00:04:35 UTC (rev 292741)
@@ -27,6 +27,7 @@
 
 #if ENABLE(GPU_PROCESS)
 
+#include "RemoteQueue.h"
 #include "StreamMessageReceiver.h"
 #include "WebGPUError.h"
 #include "WebGPUIdentifier.h"
@@ -65,9 +66,9 @@
 class RemoteDevice final : public IPC::StreamMessageReceiver {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static Ref<RemoteDevice> create(PAL::WebGPU::Device& device, WebGPU::ObjectHeap& objectHeap, Ref<IPC::StreamServerConnection>&& streamConnection, WebGPUIdentifier identifier)
+    static Ref<RemoteDevice> create(PAL::WebGPU::Device& device, WebGPU::ObjectHeap& objectHeap, Ref<IPC::StreamServerConnection>&& streamConnection, WebGPUIdentifier identifier, WebGPUIdentifier queueIdentifier)
     {
-        return adoptRef(*new RemoteDevice(device, objectHeap, WTFMove(streamConnection), identifier));
+        return adoptRef(*new RemoteDevice(device, objectHeap, WTFMove(streamConnection), identifier, queueIdentifier));
     }
 
     ~RemoteDevice();
@@ -74,10 +75,12 @@
 
     void stopListeningForIPC();
 
+    RemoteQueue& queue();
+
 private:
     friend class WebGPU::ObjectHeap;
 
-    RemoteDevice(PAL::WebGPU::Device&, WebGPU::ObjectHeap&, Ref<IPC::StreamServerConnection>&&, WebGPUIdentifier);
+    RemoteDevice(PAL::WebGPU::Device&, WebGPU::ObjectHeap&, Ref<IPC::StreamServerConnection>&&, WebGPUIdentifier, WebGPUIdentifier queueIdentifier);
 
     RemoteDevice(const RemoteDevice&) = delete;
     RemoteDevice(RemoteDevice&&) = delete;
@@ -119,6 +122,7 @@
     WebGPU::ObjectHeap& m_objectHeap;
     Ref<IPC::StreamServerConnection> m_streamConnection;
     WebGPUIdentifier m_identifier;
+    Ref<RemoteQueue> m_queue;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteAdapterProxy.cpp (292740 => 292741)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteAdapterProxy.cpp	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteAdapterProxy.cpp	2022-04-12 00:04:35 UTC (rev 292741)
@@ -54,9 +54,10 @@
         return;
 
     auto identifier = WebGPUIdentifier::generate();
+    auto queueIdentifier = WebGPUIdentifier::generate();
     SupportedFeatures supportedFeatures;
     SupportedLimits supportedLimits;
-    auto sendResult = sendSync(Messages::RemoteAdapter::RequestDevice(*convertedDescriptor, identifier), { supportedFeatures, supportedLimits });
+    auto sendResult = sendSync(Messages::RemoteAdapter::RequestDevice(*convertedDescriptor, identifier, queueIdentifier), { supportedFeatures, supportedLimits });
     if (!sendResult)
         return;
 
@@ -89,7 +90,7 @@
         supportedLimits.maxComputeWorkgroupSizeZ,
         supportedLimits.maxComputeWorkgroupsPerDimension
     );
-    callback(RemoteDeviceProxy::create(WTFMove(resultSupportedFeatures), WTFMove(resultSupportedLimits), *this, m_convertToBackingContext, identifier));
+    callback(RemoteDeviceProxy::create(WTFMove(resultSupportedFeatures), WTFMove(resultSupportedLimits), *this, m_convertToBackingContext, identifier, queueIdentifier));
 }
 
 } // namespace WebKit::WebGPU

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.cpp (292740 => 292741)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.cpp	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.cpp	2022-04-12 00:04:35 UTC (rev 292741)
@@ -37,6 +37,7 @@
 #include "RemoteExternalTextureProxy.h"
 #include "RemotePipelineLayoutProxy.h"
 #include "RemoteQuerySetProxy.h"
+#include "RemoteQueueProxy.h"
 #include "RemoteRenderBundleEncoderProxy.h"
 #include "RemoteRenderPipelineProxy.h"
 #include "RemoteSamplerProxy.h"
@@ -47,11 +48,12 @@
 
 namespace WebKit::WebGPU {
 
-RemoteDeviceProxy::RemoteDeviceProxy(Ref<PAL::WebGPU::SupportedFeatures>&& features, Ref<PAL::WebGPU::SupportedLimits>&& limits, RemoteAdapterProxy& parent, ConvertToBackingContext& convertToBackingContext, WebGPUIdentifier identifier)
+RemoteDeviceProxy::RemoteDeviceProxy(Ref<PAL::WebGPU::SupportedFeatures>&& features, Ref<PAL::WebGPU::SupportedLimits>&& limits, RemoteAdapterProxy& parent, ConvertToBackingContext& convertToBackingContext, WebGPUIdentifier identifier, WebGPUIdentifier queueIdentifier)
     : Device(WTFMove(features), WTFMove(limits))
     , m_backing(identifier)
     , m_convertToBackingContext(convertToBackingContext)
     , m_parent(parent)
+    , m_queue(RemoteQueueProxy::create(*this, convertToBackingContext, queueIdentifier))
 {
 }
 
@@ -59,6 +61,11 @@
 {
 }
 
+PAL::WebGPU::Queue& RemoteDeviceProxy::queue()
+{
+    return m_queue;
+}
+
 void RemoteDeviceProxy::destroy()
 {
 }

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.h (292740 => 292741)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.h	2022-04-11 23:48:05 UTC (rev 292740)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.h	2022-04-12 00:04:35 UTC (rev 292741)
@@ -36,13 +36,14 @@
 namespace WebKit::WebGPU {
 
 class ConvertToBackingContext;
+class RemoteQueueProxy;
 
 class RemoteDeviceProxy final : public PAL::WebGPU::Device {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static Ref<RemoteDeviceProxy> create(Ref<PAL::WebGPU::SupportedFeatures>&& features, Ref<PAL::WebGPU::SupportedLimits>&& limits, RemoteAdapterProxy& parent, ConvertToBackingContext& convertToBackingContext, WebGPUIdentifier identifier)
+    static Ref<RemoteDeviceProxy> create(Ref<PAL::WebGPU::SupportedFeatures>&& features, Ref<PAL::WebGPU::SupportedLimits>&& limits, RemoteAdapterProxy& parent, ConvertToBackingContext& convertToBackingContext, WebGPUIdentifier identifier, WebGPUIdentifier queueIdentifier)
     {
-        return adoptRef(*new RemoteDeviceProxy(WTFMove(features), WTFMove(limits), parent, convertToBackingContext, identifier));
+        return adoptRef(*new RemoteDeviceProxy(WTFMove(features), WTFMove(limits), parent, convertToBackingContext, identifier, queueIdentifier));
     }
 
     virtual ~RemoteDeviceProxy();
@@ -53,7 +54,7 @@
 private:
     friend class DowncastConvertToBackingContext;
 
-    RemoteDeviceProxy(Ref<PAL::WebGPU::SupportedFeatures>&&, Ref<PAL::WebGPU::SupportedLimits>&&, RemoteAdapterProxy&, ConvertToBackingContext&, WebGPUIdentifier);
+    RemoteDeviceProxy(Ref<PAL::WebGPU::SupportedFeatures>&&, Ref<PAL::WebGPU::SupportedLimits>&&, RemoteAdapterProxy&, ConvertToBackingContext&, WebGPUIdentifier, WebGPUIdentifier queueIdentifier);
 
     RemoteDeviceProxy(const RemoteDeviceProxy&) = delete;
     RemoteDeviceProxy(RemoteDeviceProxy&&) = delete;
@@ -74,6 +75,8 @@
         return root().streamClientConnection().sendSync(WTFMove(message), WTFMove(reply), backing(), defaultSendTimeout);
     }
 
+    PAL::WebGPU::Queue& queue() final;
+
     void destroy() final;
 
     Ref<PAL::WebGPU::Buffer> createBuffer(const PAL::WebGPU::BufferDescriptor&) final;
@@ -106,8 +109,10 @@
     Deque<CompletionHandler<void(std::optional<PAL::WebGPU::Error>&&)>> m_popErrorScopeCallbacks;
 
     WebGPUIdentifier m_backing;
+    WebGPUIdentifier m_queueBacking;
     Ref<ConvertToBackingContext> m_convertToBackingContext;
     Ref<RemoteAdapterProxy> m_parent;
+    Ref<RemoteQueueProxy> m_queue;
 };
 
 } // namespace WebKit::WebGPU
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to