Enable SurfaceTests on D3D11 and D3D12.

Fixes a test that was using two different surfaces on the same HWND.
This is definitely not supported and was causing issues where we
couldn't lose all references to the IDXGISwapChain before trying to
create a new one on the same HWND.

Bug: 42241264
Change-Id: If97bcbdebf31719dc70e0b636b43845c0adfa595
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/205457
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/src/dawn/tests/end2end/SurfaceTests.cpp b/src/dawn/tests/end2end/SurfaceTests.cpp
index bce7141..9f0a700 100644
--- a/src/dawn/tests/end2end/SurfaceTests.cpp
+++ b/src/dawn/tests/end2end/SurfaceTests.cpp
@@ -307,11 +307,10 @@
         wgpu::PresentMode::Mailbox,
     };
 
-    wgpu::Surface surface1 = CreateTestSurface();
-    wgpu::Surface surface2 = CreateTestSurface();
+    wgpu::Surface surface = CreateTestSurface();
 
     wgpu::SurfaceCapabilities capabilities;
-    surface1.GetCapabilities(adapter, &capabilities);
+    surface.GetCapabilities(adapter, &capabilities);
 
     for (wgpu::PresentMode mode1 : kAllPresentModes) {
         if (!SupportsPresentMode(capabilities, mode1)) {
@@ -322,27 +321,27 @@
                 continue;
             }
 
-            wgpu::SurfaceConfiguration config = GetPreferredConfiguration(surface1);
+            wgpu::SurfaceConfiguration config = GetPreferredConfiguration(surface);
 
             {
                 config.presentMode = mode1;
-                surface1.Configure(&config);
+                surface.Configure(&config);
 
                 wgpu::SurfaceTexture surfaceTexture;
-                surface1.GetCurrentTexture(&surfaceTexture);
+                surface.GetCurrentTexture(&surfaceTexture);
                 ClearTexture(surfaceTexture.texture, {0.0, 0.0, 0.0, 1.0});
-                surface1.Present();
+                surface.Present();
             }
 
             {
                 config.presentMode = mode2;
-                surface2.Configure(&config);
+                surface.Configure(&config);
 
                 wgpu::SurfaceTexture surfaceTexture;
-                surface2.GetCurrentTexture(&surfaceTexture);
+                surface.GetCurrentTexture(&surfaceTexture);
                 ClearTexture(surfaceTexture.texture, {0.0, 0.0, 0.0, 1.0});
-                surface2.Present();
-                surface2.Unconfigure();
+                surface.Present();
+                surface.Unconfigure();
             }
         }
     }
@@ -367,6 +366,9 @@
 
 // Test resizing the window but not the surface.
 TEST_P(SurfaceTests, ResizingWindowOnly) {
+    // Hangs on NVIDIA GTX 1660
+    DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsNvidia());
+
     wgpu::Surface surface = CreateTestSurface();
     wgpu::SurfaceConfiguration config = GetPreferredConfiguration(surface);
 
@@ -418,6 +420,9 @@
     // the same device.
     DAWN_SUPPRESS_TEST_IF(IsVulkan() && IsBackendValidationEnabled());
 
+    // TODO(dawn:269): This isn't implemented yet but could be supported in the future.
+    DAWN_SUPPRESS_TEST_IF(IsD3D11() || IsD3D12());
+
     wgpu::Device device2 = CreateDevice();
 
     wgpu::Surface surface = CreateTestSurface();
@@ -642,10 +647,9 @@
     surface.Present();
 }
 
-// TODO(dawn:2320): Enable D3D tests (though they are not enabled in SwapChainTests neither)
 DAWN_INSTANTIATE_TEST(SurfaceTests,
-                      // D3D11Backend(),
-                      // D3D12Backend(),
+                      D3D11Backend(),
+                      D3D12Backend(),
                       MetalBackend(),
                       VulkanBackend());