D3D12: set correct data layout of dst texture for B2T copy

When we initialize the dst texture before T2T copy, we clear a
buffer with zeros and do a B2T copy in order to initialize the
texture. The T2T copy may only copy a subrect of the texture's
subresource, so does the initialization via B2T copy. As a result,
the buffer can store compact zeros for that exact subrect and then
do an exact B2T copy to initialize that area.

However, the current B2T copy uses incorrect data layout for the
buffer, making some part of the dst texture uninitialized, and
even leading to D3D12 runtime validation errors sometimes if it
goes beyond the boundary of staging buffer pool (4MB).

This change fixes this bug via using the exact height of copy area
to replace dataLayout.rowsPerImage (unnecessary padding rows included)
for the height of each depth image for 3D textures.

Bug: dawn:1288
Change-Id: I303e0d363039a6a87e352a8445898031e673cf4e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90780
Commit-Queue: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/native/d3d12/TextureD3D12.cpp b/src/dawn/native/d3d12/TextureD3D12.cpp
index 59e27a5..c7258a5 100644
--- a/src/dawn/native/d3d12/TextureD3D12.cpp
+++ b/src/dawn/native/d3d12/TextureD3D12.cpp
@@ -1122,7 +1122,8 @@
                     RecordBufferTextureCopyWithBufferHandle(
                         BufferTextureCopyDirection::B2T, commandList,
                         ToBackend(uploadHandle.stagingBuffer)->GetResource(),
-                        uploadHandle.startOffset, bytesPerRow, GetHeight(), textureCopy, copySize);
+                        uploadHandle.startOffset, bytesPerRow, largestMipSize.height, textureCopy,
+                        copySize);
                 }
             }
         }