[dawn][metal] Increment the submitted serial only after the commit The logic was slightly unclear previously because the serial was incremented before the submit. No other operation used the signal but if some did, they could assume they used the next pending serial instead of the one that would be used for the commit. This should be a noop change. Bug: 42242066 Change-Id: I1904ac8f41a8a5530ea72f2eb14c15939d94538c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/227054 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Auto-Submit: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/native/metal/QueueMTL.mm b/src/dawn/native/metal/QueueMTL.mm index ded0d53..f1d3f04f 100644 --- a/src/dawn/native/metal/QueueMTL.mm +++ b/src/dawn/native/metal/QueueMTL.mm
@@ -138,8 +138,6 @@ auto platform = GetDevice()->GetPlatform(); - IncrementLastSubmittedCommandSerial(); - // Acquire the pending command buffer, which is retained. It must be released later. NSPRef<id<MTLCommandBuffer>> pendingCommands = mCommandContext.AcquireCommands(); @@ -164,7 +162,7 @@ // Update the completed serial once the completed handler is fired. Make a local copy of // mLastSubmittedSerial so it is captured by value. - ExecutionSerial pendingSerial = GetLastSubmittedCommandSerial(); + ExecutionSerial pendingSerial = GetPendingCommandSerial(); // this ObjC block runs on a different thread [*pendingCommands addCompletedHandler:^(id<MTLCommandBuffer>) { TRACE_EVENT_ASYNC_END0(platform, GPUWork, "DeviceMTL::SubmitPendingCommandBuffer", @@ -189,6 +187,7 @@ value:static_cast<uint64_t>(pendingSerial)]; [*pendingCommands commit]; + IncrementLastSubmittedCommandSerial(); return mCommandContext.PrepareNextCommandBuffer(*mCommandQueue); }