mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-13 08:36:08 +00:00
Allow empty B->T copies
This adds a test that empty copies are valid for B->B copies too. Tests for B->T will come in a follow up commit.
This commit is contained in:
parent
eaae746433
commit
4b4922cdce
@ -250,11 +250,6 @@ namespace backend {
|
|||||||
uint64_t z = copy->z;
|
uint64_t z = copy->z;
|
||||||
uint32_t level = copy->level;
|
uint32_t level = copy->level;
|
||||||
|
|
||||||
if (width == 0 || height == 0 || depth == 0) {
|
|
||||||
HandleError("Empty copy");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(cwallez@chromium.org): check for overflows
|
// TODO(cwallez@chromium.org): check for overflows
|
||||||
uint64_t pixelSize = TextureFormatPixelSize(texture->GetFormat());
|
uint64_t pixelSize = TextureFormatPixelSize(texture->GetFormat());
|
||||||
uint64_t dataSize = width * height * depth * pixelSize;
|
uint64_t dataSize = width * height * depth * pixelSize;
|
||||||
|
@ -32,6 +32,7 @@ TEST_F(CopyCommandTest_B2B, Success) {
|
|||||||
destination.FreezeUsage(nxt::BufferUsageBit::TransferDst);
|
destination.FreezeUsage(nxt::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
// Copy different copies, including some that touch the OOB condition
|
// Copy different copies, including some that touch the OOB condition
|
||||||
|
{
|
||||||
nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder())
|
nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder())
|
||||||
.CopyBufferToBuffer(source, 0, destination, 0, 16)
|
.CopyBufferToBuffer(source, 0, destination, 0, 16)
|
||||||
.CopyBufferToBuffer(source, 8, destination, 0, 8)
|
.CopyBufferToBuffer(source, 8, destination, 0, 8)
|
||||||
@ -39,7 +40,17 @@ TEST_F(CopyCommandTest_B2B, Success) {
|
|||||||
.GetResult();
|
.GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test B2B copies with overflows
|
// Empty copies are valid
|
||||||
|
{
|
||||||
|
nxt::CommandBuffer commands = AssertWillBeSuccess(device.CreateCommandBufferBuilder())
|
||||||
|
.CopyBufferToBuffer(source, 0, destination, 0, 0)
|
||||||
|
.CopyBufferToBuffer(source, 0, destination, 16, 0)
|
||||||
|
.CopyBufferToBuffer(source, 16, destination, 0, 0)
|
||||||
|
.GetResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test B2B copies with OOB
|
||||||
TEST_F(CopyCommandTest_B2B, OutOfBounds) {
|
TEST_F(CopyCommandTest_B2B, OutOfBounds) {
|
||||||
nxt::Buffer source = device.CreateBufferBuilder()
|
nxt::Buffer source = device.CreateBufferBuilder()
|
||||||
.SetSize(16)
|
.SetSize(16)
|
||||||
@ -68,7 +79,7 @@ TEST_F(CopyCommandTest_B2B, OutOfBounds) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test B2B copies with overflows
|
// Test B2B copies with incorrect buffer usage
|
||||||
TEST_F(CopyCommandTest_B2B, BadUsage) {
|
TEST_F(CopyCommandTest_B2B, BadUsage) {
|
||||||
nxt::Buffer source = device.CreateBufferBuilder()
|
nxt::Buffer source = device.CreateBufferBuilder()
|
||||||
.SetSize(16)
|
.SetSize(16)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user