Ensure commands are submitted before exporting the last signaled event

Consumers of the event expect it to be signaled after all work
enqueued thus far. Ensure that commands are flushed to ensure this.

Fixed: dawn:1691
Change-Id: I1409c668119a12e5e50a1ce2924ebc16d0470a4d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131880
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
This commit is contained in:
Austin Eng 2023-05-08 19:43:35 +00:00 committed by Dawn LUCI CQ
parent a187e9e281
commit 1a8bb02624
1 changed files with 6 additions and 0 deletions

View File

@ -361,6 +361,12 @@ MaybeError Device::SubmitPendingCommandBuffer() {
}
void Device::ExportLastSignaledEvent(ExternalImageMTLSharedEventDescriptor* desc) {
// Ensure commands are submitted before getting the last submited serial.
// Ignore the error since we still want to export the serial of the last successful
// submission - that was the last serial that was actually signaled.
ForceEventualFlushOfCommands();
DAWN_UNUSED(ConsumedError(SubmitPendingCommandBuffer()));
desc->sharedEvent = *mMtlSharedEvent;
desc->signaledValue = static_cast<uint64_t>(GetLastSubmittedCommandSerial());
}