Commit 314228d0 authored by Austin Eng's avatar Austin Eng Committed by Commit Bot

Flush WebGPU commands after fence.onCompletion

Currently, this callback is processed entirely on the client, so it
doesn't require a flush. It will be updated to be server-side for
consistent callback ordering. In order to ensure the server receives
the callback in finite time, we force a flush after the command is
sent.

Bug: dawn:516
Change-Id: Ibfa64b142331663e818c1142021ec2db1eeb9f58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2380026Reviewed-by: default avatarKai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802317}
parent f4b7fd79
......@@ -4,6 +4,7 @@
#include "third_party/blink/renderer/modules/webgpu/gpu_fence.h"
#include "gpu/command_buffer/client/webgpu_interface.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/modules/webgpu/dawn_callback.h"
......@@ -56,6 +57,10 @@ ScriptPromise GPUFence::onCompletion(ScriptState* script_state,
GetProcs().fenceOnCompletion(GetHandle(), value, callback->UnboundCallback(),
callback->AsUserdata());
// WebGPU guarantees that submitted commands finish in finite time so we
// flush commands to the GPU process now.
device_->GetInterface()->FlushCommands();
return promise;
}
......
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