Fix ValidateEntireSubresourceCopied

This function was validating the depth of the copy which is
incorrect for 2D array textures. Remove this check for now
since it would be only relevant for 3D textures which Dawn
does not support yet.

Bug: dawn:424
Change-Id: I756080a899a7c5effe5843a530d4db0571bc10d5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/22323
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2020-06-01 16:19:02 +00:00 committed by Commit Bot service account
parent 13110bff05
commit 2dfc42dd39
2 changed files with 42 additions and 2 deletions

View File

@ -145,9 +145,10 @@ namespace dawn_native {
const Extent3D& copySize) {
Extent3D srcSize = src.texture->GetSize();
ASSERT(src.texture->GetDimension() == wgpu::TextureDimension::e2D &&
dst.texture->GetDimension() == wgpu::TextureDimension::e2D);
if (dst.origin.x != 0 || dst.origin.y != 0 || dst.origin.z != 0 ||
srcSize.width != copySize.width || srcSize.height != copySize.height ||
srcSize.depth != copySize.depth) {
srcSize.width != copySize.width || srcSize.height != copySize.height) {
return DAWN_VALIDATION_ERROR(
"The entire subresource must be copied when using a depth/stencil texture or "
"when samples are greater than 1.");

View File

@ -1157,6 +1157,45 @@ TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
{15, 15, 1});
}
TEST_F(CopyCommandTest_T2T, 2DTextureArrayDepthStencil) {
{
wgpu::Texture source = Create2DTexture(16, 16, 1, 3, wgpu::TextureFormat::Depth24PlusStencil8,
wgpu::TextureUsage::CopySrc);
wgpu::Texture destination = Create2DTexture(
16, 16, 1, 1, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureUsage::CopyDst);
// Success when entire depth stencil subresource (layer) is the copy source
TestT2TCopy(utils::Expectation::Success, source, 0, 1, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
{16, 16, 1});
}
{
wgpu::Texture source = Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::Depth24PlusStencil8,
wgpu::TextureUsage::CopySrc);
wgpu::Texture destination = Create2DTexture(
16, 16, 1, 3, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureUsage::CopyDst);
// Success when entire depth stencil subresource (layer) is the copy destination
TestT2TCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 1, {0, 0, 0},
{16, 16, 1});
}
{
wgpu::Texture source = Create2DTexture(16, 16, 1, 3, wgpu::TextureFormat::Depth24PlusStencil8,
wgpu::TextureUsage::CopySrc);
wgpu::Texture destination = Create2DTexture(
16, 16, 1, 3, wgpu::TextureFormat::Depth24PlusStencil8, wgpu::TextureUsage::CopyDst);
// Success when src and dst are an entire depth stencil subresource (layer)
TestT2TCopy(utils::Expectation::Success, source, 0, 2, {0, 0, 0}, destination, 0, 1, {0, 0, 0},
{16, 16, 1});
// Success when src and dst are an array of entire depth stencil subresources
TestT2TCopy(utils::Expectation::Success, source, 0, 1, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
{16, 16, 2});
}
}
TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
wgpu::Texture source =
Create2DTexture(16, 16, 5, 2, wgpu::TextureFormat::RGBA8Uint, wgpu::TextureUsage::CopySrc);