diff --git a/src/dawn/native/metal/DeviceMTL.mm b/src/dawn/native/metal/DeviceMTL.mm index 7223e1a282..9409cb934f 100644 --- a/src/dawn/native/metal/DeviceMTL.mm +++ b/src/dawn/native/metal/DeviceMTL.mm @@ -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(GetLastSubmittedCommandSerial()); }