d3d11: enable BufferZeroInitTests.Copy2DArrayTextureToBuffer

This fixes the dst buffer initialization for Texture2BufferCopy.

Bug: dawn:1799
Bug: dawn:1705
Change-Id: Ibd4d2db9e6e0b025acf3385591f285edd2aa64ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/131701
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Peng Huang <penghuang@chromium.org>
diff --git a/src/dawn/native/d3d11/CommandBufferD3D11.cpp b/src/dawn/native/d3d11/CommandBufferD3D11.cpp
index d70f299..38bf0eb 100644
--- a/src/dawn/native/d3d11/CommandBufferD3D11.cpp
+++ b/src/dawn/native/d3d11/CommandBufferD3D11.cpp
@@ -198,21 +198,14 @@
                 Buffer::ScopedMap scopedDstMap;
                 DAWN_TRY_ASSIGN(scopedDstMap, Buffer::ScopedMap::Create(buffer));
 
-                Texture::ReadCallback callback;
-                if (scopedDstMap.GetMappedData()) {
-                    callback = [&](const uint8_t* data, uint64_t offset,
-                                   uint64_t size) -> MaybeError {
-                        memcpy(scopedDstMap.GetMappedData() + dst.offset + offset, data, size);
-                        return {};
-                    };
-                } else {
-                    callback = [&](const uint8_t* data, uint64_t offset,
-                                   uint64_t size) -> MaybeError {
-                        DAWN_TRY(ToBackend(dst.buffer)
-                                     ->Write(commandContext, dst.offset + offset, data, size));
-                        return {};
-                    };
-                }
+                DAWN_TRY(buffer->EnsureDataInitializedAsDestination(commandContext, copy));
+
+                Texture::ReadCallback callback = [&](const uint8_t* data, uint64_t offset,
+                                                     uint64_t size) -> MaybeError {
+                    DAWN_TRY(ToBackend(dst.buffer)
+                                 ->Write(commandContext, dst.offset + offset, data, size));
+                    return {};
+                };
 
                 DAWN_TRY(ToBackend(src.texture)
                              ->Read(commandContext, subresources, src.origin, copy->copySize,
diff --git a/src/dawn/tests/end2end/BufferZeroInitTests.cpp b/src/dawn/tests/end2end/BufferZeroInitTests.cpp
index f2f5224..faf3d7d 100644
--- a/src/dawn/tests/end2end/BufferZeroInitTests.cpp
+++ b/src/dawn/tests/end2end/BufferZeroInitTests.cpp
@@ -967,9 +967,6 @@
 // Test that the code path of CopyTextureToBuffer clears the destination buffer correctly when it is
 // the first use of the buffer and the texture is a 2D array texture.
 TEST_P(BufferZeroInitTest, Copy2DArrayTextureToBuffer) {
-    // TODO(dawn:1799): Figure this out.
-    DAWN_SUPPRESS_TEST_IF(IsD3D11());
-
     constexpr wgpu::Extent3D kTextureSize = {64u, 4u, 3u};
 
     // bytesPerRow == texelBlockSizeInBytes * copySize.width && rowsPerImage == copySize.height &&