Add workaround for blit depth to depth in D3D12 T2T on Intel Gen9 GPUs

T2T depth copy failed with non-zero array layers for depth16unorm format
on Intel Gen9 GPUs with latest D3D driver >= 31.0.101.2121.

Fix a typo in driver version: 30.0.101.4091 -> 31.0.101.4091.

Change-Id: Id35ad56b677b27c871ba118a096dd6359170ced4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/139180
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Hao Li <hao.x.li@intel.com>
diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
index be29dd5..ff90b2b 100644
--- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
+++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
@@ -547,15 +547,19 @@
         }
     }
 
-    // This workaround is needed on Intel Gen12LP GPUs with driver >= 30.0.101.4091.
-    // See http://crbug.com/dawn/1083 for more information.
-    if (gpu_info::IsIntelGen12LP(vendorId, deviceId)) {
-        const gpu_info::DriverVersion kDriverVersion = {30, 0, 101, 4091};
-        if (gpu_info::CompareWindowsDriverVersion(vendorId, GetDriverVersion(), kDriverVersion) !=
-            -1) {
-            deviceToggles->Default(Toggle::UseBlitForDepthTextureToTextureCopyToNonzeroSubresource,
-                                   true);
-        }
+    // This workaround is needed on Intel Gen9 GPUs with driver >= 31.0.101.2121 and Gen12LP GPUs
+    // with driver >= 31.0.101.4091. See http://crbug.com/dawn/1083 for more information.
+    bool useBlitForT2T = false;
+    if (gpu_info::IsIntelGen9(vendorId, deviceId)) {
+        useBlitForT2T = gpu_info::CompareWindowsDriverVersion(vendorId, GetDriverVersion(),
+                                                              {31, 0, 101, 2121}) != -1;
+    } else if (gpu_info::IsIntelGen12LP(vendorId, deviceId)) {
+        useBlitForT2T = gpu_info::CompareWindowsDriverVersion(vendorId, GetDriverVersion(),
+                                                              {31, 0, 101, 4091}) != -1;
+    }
+    if (useBlitForT2T) {
+        deviceToggles->Default(Toggle::UseBlitForDepthTextureToTextureCopyToNonzeroSubresource,
+                               true);
     }
 
     // D3D driver has a bug resolving overlapping queries to a same buffer on Intel Gen12 GPUs. This
diff --git a/src/dawn/tests/end2end/DepthStencilCopyTests.cpp b/src/dawn/tests/end2end/DepthStencilCopyTests.cpp
index 895a7cd..b4532bc 100644
--- a/src/dawn/tests/end2end/DepthStencilCopyTests.cpp
+++ b/src/dawn/tests/end2end/DepthStencilCopyTests.cpp
@@ -1439,7 +1439,9 @@
 
 DAWN_INSTANTIATE_TEST_P(
     DepthStencilCopyTests,
-    {D3D11Backend(), D3D12Backend(), MetalBackend(),
+    {D3D11Backend(), D3D12Backend(),
+     D3D12Backend({"use_blit_for_depth_texture_to_texture_copy_to_nonzero_subresource"}),
+     MetalBackend(),
      MetalBackend({"use_blit_for_depth_texture_to_texture_copy_to_nonzero_subresource"}),
      MetalBackend({"use_blit_for_buffer_to_depth_texture_copy",
                    "use_blit_for_buffer_to_stencil_texture_copy"}),
@@ -1449,16 +1451,13 @@
     std::vector<wgpu::TextureFormat>(utils::kDepthAndStencilFormats.begin(),
                                      utils::kDepthAndStencilFormats.end()));
 
-DAWN_INSTANTIATE_TEST_P(
-    DepthCopyTests,
-    {D3D11Backend(), D3D12Backend(),
-     D3D12Backend({"d3d12_use_temp_buffer_in_depth_stencil_texture_and_buffer_"
-                   "copy_with_non_zero_buffer_offset"}),
-     MetalBackend(),
-     MetalBackend({"use_blit_for_depth_texture_to_texture_copy_to_nonzero_subresource"}),
-     OpenGLBackend(), OpenGLESBackend(), VulkanBackend()},
-    std::vector<wgpu::TextureFormat>(kValidDepthCopyTextureFormats.begin(),
-                                     kValidDepthCopyTextureFormats.end()));
+DAWN_INSTANTIATE_TEST_P(DepthCopyTests,
+                        {D3D11Backend(), D3D12Backend(),
+                         D3D12Backend({"d3d12_use_temp_buffer_in_depth_stencil_texture_and_buffer_"
+                                       "copy_with_non_zero_buffer_offset"}),
+                         MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()},
+                        std::vector<wgpu::TextureFormat>(kValidDepthCopyTextureFormats.begin(),
+                                                         kValidDepthCopyTextureFormats.end()));
 
 DAWN_INSTANTIATE_TEST_P(DepthCopyFromBufferTests,
                         {D3D11Backend(), D3D12Backend(),
@@ -1486,7 +1485,9 @@
 
 DAWN_INSTANTIATE_TEST_P(
     DepthStencilCopyTests_RegressionDawn1083,
-    {D3D11Backend(), D3D12Backend(), MetalBackend(),
+    {D3D11Backend(), D3D12Backend(),
+     D3D12Backend({"use_blit_for_depth_texture_to_texture_copy_to_nonzero_subresource"}),
+     MetalBackend(),
      MetalBackend({"use_blit_for_depth_texture_to_texture_copy_to_nonzero_subresource"}),
      OpenGLBackend(), OpenGLESBackend(), VulkanBackend()},
     std::vector<wgpu::TextureFormat>{wgpu::TextureFormat::Depth16Unorm,