Add CopyB2B tests including for 0-sized copies
This catches a few driver bugs or validation errors when doing empty
copies.
Bug: dawn:446
Change-Id: Ibef50b0c03b2fa24bc00cf5c7b6d26b8ac6fae8a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19602
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp
index c1201d2..5159d9c 100644
--- a/src/dawn_native/CommandEncoder.cpp
+++ b/src/dawn_native/CommandEncoder.cpp
@@ -638,13 +638,16 @@
mTopLevelBuffers.insert(destination);
}
- CopyBufferToBufferCmd* copy =
- allocator->Allocate<CopyBufferToBufferCmd>(Command::CopyBufferToBuffer);
- copy->source = source;
- copy->sourceOffset = sourceOffset;
- copy->destination = destination;
- copy->destinationOffset = destinationOffset;
- copy->size = size;
+ // Skip noop copies. Some backends validation rules disallow them.
+ if (size != 0) {
+ CopyBufferToBufferCmd* copy =
+ allocator->Allocate<CopyBufferToBufferCmd>(Command::CopyBufferToBuffer);
+ copy->source = source;
+ copy->sourceOffset = sourceOffset;
+ copy->destination = destination;
+ copy->destinationOffset = destinationOffset;
+ copy->size = size;
+ }
return {};
});