Vulkan: Fix a bug in the impl of T2T copy with 2D array textures

This patch fixes a bug in the implementation of the toggle
UseTemporaryBufferInCompressedTextureToTextureCopy on Vulkan backend.
The previous implementation only considered the T2T one-layer copies,
which will cause the validation error by Vulkan validation layer. This
patch fixes this issue by adding the missing support of multi-layer
copies.

This patch also fixes the failures in the WebGPU CTS tests
color_textures,compressed,array,* on the Linux/Vulkan backends with
Vulkan validation layer enabled.

BUG=dawn:42, chromium:1161355
TEST=dawn_end2end_tests

Change-Id: Ic437919a843b8439d267b8d75b27ade3a9e7bcae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36260
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
Jiawei Shao
2021-01-05 00:40:30 +00:00
committed by Commit Bot service account
parent da2d927bb1
commit 4110684aa0
2 changed files with 79 additions and 2 deletions

View File

@@ -414,7 +414,8 @@ namespace dawn_native { namespace vulkan {
// Create the temporary buffer. Note that We don't need to respect WebGPU's 256 alignment
// because it isn't a hard constraint in Vulkan.
uint64_t tempBufferSize = widthInBlocks * heightInBlocks * blockInfo.byteSize;
uint64_t tempBufferSize =
widthInBlocks * heightInBlocks * copySize.depth * blockInfo.byteSize;
BufferDescriptor tempBufferDescriptor;
tempBufferDescriptor.size = tempBufferSize;
tempBufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;