SwapChainVk: record AcquireImage semaphore when suboptimal

Previously when vkAcquireNextImageKHR returned SUBOPTIMAL, we destroyed
the signaled semaphore and never used it, causing later synchronization
errors when we tried using the swapchain texture without first waiting
on the semaphore.

Fixed: 1503912
Change-Id: I2d257c5dcc1e6029469aad29cc8722eec157ef90
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/205035
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
diff --git a/src/dawn/native/dawn_platform.h b/src/dawn/native/dawn_platform.h
index 0f49346..fdfcfd4 100644
--- a/src/dawn/native/dawn_platform.h
+++ b/src/dawn/native/dawn_platform.h
@@ -74,7 +74,7 @@
 static constexpr wgpu::TextureUsage kReservedTextureUsage =
     static_cast<wgpu::TextureUsage>(1u << 31);
 
-// Extrea texture usages for textures that are used with the presentation engine.
+// Extra texture usages for textures that are used with the presentation engine.
 // Acquire is that Dawn is acquiring the texture from the presentation engine while Release is Dawn
 // releasing is to the presentation engine.
 static constexpr wgpu::TextureUsage kPresentAcquireTextureUsage =
diff --git a/src/dawn/native/vulkan/SwapChainVk.cpp b/src/dawn/native/vulkan/SwapChainVk.cpp
index 32ec032..7ede016 100644
--- a/src/dawn/native/vulkan/SwapChainVk.cpp
+++ b/src/dawn/native/vulkan/SwapChainVk.cpp
@@ -488,7 +488,7 @@
         device->GetVkDevice(), mSwapChain, std::numeric_limits<uint64_t>::max(), semaphore,
         VkFence{}, &mLastImageIndex));
 
-    if (result == VK_SUCCESS) {
+    if (result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR) {
         // TODO(crbug.com/dawn/269) put the semaphore on the texture so it is waited on when
         // used instead of directly on the recording context?
         ToBackend(device->GetQueue())
diff --git a/src/dawn/tests/end2end/SurfaceTests.cpp b/src/dawn/tests/end2end/SurfaceTests.cpp
index 1899541..d636569 100644
--- a/src/dawn/tests/end2end/SurfaceTests.cpp
+++ b/src/dawn/tests/end2end/SurfaceTests.cpp
@@ -351,9 +351,6 @@
 
 // Test resizing the window but not the surface.
 TEST_P(SurfaceTests, ResizingWindowOnly) {
-    // TODO(crbug.com/1503912): Failing new ValidateImageAcquireWait in Vulkan Validation Layer.
-    DAWN_SUPPRESS_TEST_IF(IsBackendValidationEnabled() && IsWindows() && IsVulkan() && IsIntel());
-
     wgpu::Surface surface = CreateTestSurface();
     wgpu::SurfaceConfiguration config = GetPreferredConfiguration(surface);
     wgpu::SurfaceTexture surfaceTexture;