d3d12::SwapChain: Mark images used with the correct serial.

Previously the swapchains were associated with the next serial, not the
current one, which would cause a one serial delay for reuse of swapchain
images.

Bug: dawn:2220
Change-Id: Ida9b209f44325750964a02e065eeb2501a728e1d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/166140
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
diff --git a/src/dawn/native/d3d12/SwapChainD3D12.cpp b/src/dawn/native/d3d12/SwapChainD3D12.cpp
index 65c1d55..993efab 100644
--- a/src/dawn/native/d3d12/SwapChainD3D12.cpp
+++ b/src/dawn/native/d3d12/SwapChainD3D12.cpp
@@ -98,7 +98,7 @@
 
     // Record that "new" is the last time the buffer has been used.
     DAWN_TRY(queue->NextSerial());
-    mBufferLastUsedSerials[mCurrentBuffer] = queue->GetPendingCommandSerial();
+    mBufferLastUsedSerials[mCurrentBuffer] = queue->GetLastSubmittedCommandSerial();
 
     mApiTexture->APIDestroy();
     mApiTexture = nullptr;