Validate that 3D texture copies cannot be between the same subresource

Bug: dawn:547
Change-Id: I747ccdb895121292e527acc385d69697bc86d8b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/50240
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
Austin Eng
2021-05-10 17:42:41 +00:00
committed by Commit Bot service account
parent 5200c8158c
commit 67851d9021
2 changed files with 54 additions and 5 deletions

View File

@@ -421,12 +421,13 @@ namespace dawn_native {
}
if (src.texture == dst.texture && src.mipLevel == dst.mipLevel) {
ASSERT(src.texture->GetDimension() == wgpu::TextureDimension::e2D &&
dst.texture->GetDimension() == wgpu::TextureDimension::e2D);
if (IsRangeOverlapped(src.origin.z, dst.origin.z, copySize.depthOrArrayLayers)) {
wgpu::TextureDimension dimension = src.texture->GetDimension();
ASSERT(dimension != wgpu::TextureDimension::e1D);
if ((dimension == wgpu::TextureDimension::e2D &&
IsRangeOverlapped(src.origin.z, dst.origin.z, copySize.depthOrArrayLayers)) ||
dimension == wgpu::TextureDimension::e3D) {
return DAWN_VALIDATION_ERROR(
"Copy subresources cannot be overlapped when copying within the same "
"texture.");
"Cannot copy between overlapping subresources of the same texture.");
}
}