Support Noop Copy for B2T, T2B and T2T Copies

In B2T, T2B and T2T copies, copySize has 0 in width, height or depth
will trigger errors in D3D12 backend.

This patch bypass the command record step for noop copy. But all
validation rules still applies to the copy.

BUG=dawn:255

Change-Id: I4d01cef2e3c1f78440014c2c6ac63a48310d99af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28521
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Yan, Shaobo
2020-09-23 10:28:26 +00:00
committed by Commit Bot service account
parent a3651d2fe0
commit 75e5ed6161
4 changed files with 118 additions and 48 deletions

View File

@@ -87,6 +87,14 @@ namespace utils {
}
}
uint64_t GetTexelCountInCopyRegion(uint64_t bytesPerRow,
uint64_t rowsPerImage,
wgpu::Extent3D copyExtent,
wgpu::TextureFormat textureFormat) {
return RequiredBytesInCopy(bytesPerRow, rowsPerImage, copyExtent, textureFormat) /
utils::GetTexelBlockSizeInBytes(textureFormat);
}
void UnalignDynamicUploader(wgpu::Device device) {
std::vector<uint8_t> data = {1};

View File

@@ -46,6 +46,11 @@ namespace utils {
wgpu::Extent3D copyExtent,
wgpu::TextureFormat textureFormat);
uint64_t GetTexelCountInCopyRegion(uint64_t bytesPerRow,
uint64_t rowsPerImage,
wgpu::Extent3D copyExtent,
wgpu::TextureFormat textureFormat);
// A helper function used for testing DynamicUploader offset alignment.
// A call of this function will do a Queue::WriteTexture with 1 byte of data,
// so that assuming that WriteTexture uses DynamicUploader, the first RingBuffer