Change Copy Validation To Allow Depth = 0 Copies
Existing validation requiring copy depth = 1 is not accurate. Copies
with a depth of 0 should be allowed.
Bug: dawn:18
Change-Id: Ib7607ee0965935127b3a8b66bc49b38ddcc56953
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/5940
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp
index 39e05f2..1ac0790 100644
--- a/src/dawn_native/CommandEncoder.cpp
+++ b/src/dawn_native/CommandEncoder.cpp
@@ -55,8 +55,8 @@
// TODO(cwallez@chromium.org): Check the depth bound differently for 2D arrays and 3D
// textures
- if (textureCopy.origin.z != 0 || copySize.depth != 1) {
- return DAWN_VALIDATION_ERROR("No support for z != 0 and depth != 1 for now");
+ if (textureCopy.origin.z != 0 || copySize.depth > 1) {
+ return DAWN_VALIDATION_ERROR("No support for z != 0 and depth > 1 for now");
}
return {};
diff --git a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
index 3fe8ce1..8954da6 100644
--- a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
+++ b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
@@ -288,6 +288,9 @@
// An empty copy
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
{0, 0, 1});
+ // An empty copy with depth = 0
+ TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
+ {0, 0, 0});
// An empty copy touching the end of the buffer
TestB2TCopy(utils::Expectation::Success, source, bufferSize, 0, 0, destination, 0, 0,
{0, 0, 0}, {0, 0, 1});
@@ -366,9 +369,9 @@
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 1},
{0, 0, 1});
- // Depth=0 on an empty copy still errors
+ // Depth > 1 on an empty copy still errors
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
- {0, 0, 0});
+ {0, 0, 2});
}
// Test B2T copies with incorrect buffer usage
@@ -549,6 +552,9 @@
// An empty copy
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0, 0,
{0, 0, 1});
+ // An empty copy with depth = 0
+ TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0, 0,
+ {0, 0, 0});
// An empty copy touching the end of the buffer
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, bufferSize,
0, 0, {0, 0, 1});
@@ -623,9 +629,9 @@
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 1}, destination, 0, 0, 0,
{0, 0, 1});
- // Depth=0 on an empty copy still errors
+ // Depth > 1 on an empty copy still errors
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 0, 0,
- {0, 0, 0});
+ {0, 0, 2});
}
// Test T2B copies with incorrect buffer usage
@@ -801,6 +807,10 @@
TestT2TCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0,
{0, 0, 0}, {0, 0, 1});
+ // An empty copy with depth = 0
+ TestT2TCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0,
+ {0, 0, 0}, {0, 0, 0});
+
// An empty copy touching the side of the source texture
TestT2TCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0,
{16, 16, 0}, {0, 0, 1});
@@ -893,9 +903,9 @@
TestT2TCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 0, {0, 0, 1},
{0, 0, 1});
- // Empty copy with depth = 0 fails
+ // Empty copy with depth > 1 fails
TestT2TCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
- {0, 0, 0});
+ {0, 0, 2});
}
TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {