Commit 4ad76581 authored by Austin Eng's avatar Austin Eng Committed by Commit Bot

Implement GPUQueue.submit in Blink

Bug: 877147
Change-Id: I29fa88ab691262974783a6e327d2b75fa1e70b60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1547937
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: default avatarKai Ninomiya <kainino@chromium.org>
Reviewed-by: default avatarCorentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#648753}
parent 5f345214
......@@ -5,6 +5,8 @@
#include "third_party/blink/renderer/modules/webgpu/gpu_queue.h"
#include "gpu/command_buffer/client/webgpu_interface.h"
#include "third_party/blink/renderer/modules/webgpu/dawn_conversions.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_command_buffer.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_device.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_fence.h"
#include "third_party/blink/renderer/modules/webgpu/gpu_fence_descriptor.h"
......@@ -26,8 +28,20 @@ GPUQueue::~GPUQueue() {
GetProcs().queueRelease(GetHandle());
}
void GPUQueue::submit(const HeapVector<Member<GPUCommandBuffer>>& buffers) {
std::unique_ptr<DawnCommandBuffer[]> commandBuffers = AsDawnType(buffers);
GetProcs().queueSubmit(GetHandle(), buffers.size(), commandBuffers.get());
// WebGPU guarantees that submitted commands finish in finite time so we
// flush commands to the GPU process now.
device_->GetInterface()->FlushCommands();
}
void GPUQueue::signal(GPUFence* fence, uint64_t signal_value) {
GetProcs().queueSignal(GetHandle(), fence->GetHandle(), signal_value);
// Signaling a fence adds a callback to update the fence value to the
// completed value. WebGPU guarantees that the fence completion is
// observable in finite time so we flush commands to the GPU process now.
device_->GetInterface()->FlushCommands();
}
......
......@@ -9,6 +9,7 @@
namespace blink {
class GPUCommandBuffer;
class GPUFence;
class GPUFenceDescriptor;
......@@ -21,6 +22,7 @@ class GPUQueue : public DawnObject<DawnQueue> {
~GPUQueue() override;
// gpu_queue.idl
void submit(const HeapVector<Member<GPUCommandBuffer>>& buffers);
void signal(GPUFence* fence, uint64_t signal_value);
GPUFence* createFence(const GPUFenceDescriptor* descriptor);
......
......@@ -7,6 +7,7 @@
[
RuntimeEnabled=WebGPU
] interface GPUQueue {
void submit(sequence<GPUCommandBuffer> buffers);
void signal(GPUFence fence, unsigned long long signalValue);
GPUFence createFence(GPUFenceDescriptor descriptor);
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment