Remove textureAspect from TextureCopyView
Delete all references to textureAspect inside of TextureCopyView to reflect WebGPU IDL change. Bug: dawn:17 Change-Id: Ib849f07bed6aff93e2759739e5c7a92367658df4 Reviewed-on: https://dawn-review.googlesource.com/c/3200 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
8bff3b22be
commit
069664e58b
|
@ -1034,8 +1034,7 @@
|
||||||
{"name": "texture", "type": "texture"},
|
{"name": "texture", "type": "texture"},
|
||||||
{"name": "level", "type": "uint32_t"},
|
{"name": "level", "type": "uint32_t"},
|
||||||
{"name": "slice", "type": "uint32_t"},
|
{"name": "slice", "type": "uint32_t"},
|
||||||
{"name": "origin", "type": "origin 3D"},
|
{"name": "origin", "type": "origin 3D"}
|
||||||
{"name": "aspect", "type": "texture aspect"}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"texture descriptor": {
|
"texture descriptor": {
|
||||||
|
|
|
@ -72,8 +72,7 @@ void initTextures() {
|
||||||
|
|
||||||
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
|
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
|
||||||
dawn::TextureCopyView textureCopyView =
|
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
|
||||||
utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color);
|
|
||||||
dawn::Extent3D copySize = {1024, 1024, 1};
|
dawn::Extent3D copySize = {1024, 1024, 1};
|
||||||
dawn::CommandBuffer copy =
|
dawn::CommandBuffer copy =
|
||||||
device.CreateCommandBufferBuilder()
|
device.CreateCommandBufferBuilder()
|
||||||
|
|
|
@ -445,7 +445,7 @@ namespace {
|
||||||
dawn::BufferCopyView bufferCopyView =
|
dawn::BufferCopyView bufferCopyView =
|
||||||
utils::CreateBufferCopyView(staging, 0, rowPitch, 0);
|
utils::CreateBufferCopyView(staging, 0, rowPitch, 0);
|
||||||
dawn::TextureCopyView textureCopyView =
|
dawn::TextureCopyView textureCopyView =
|
||||||
utils::CreateTextureCopyView(oTexture, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color);
|
utils::CreateTextureCopyView(oTexture, 0, 0, {0, 0, 0});
|
||||||
dawn::Extent3D copySize = {iImage.width, iImage.height, 1};
|
dawn::Extent3D copySize = {iImage.width, iImage.height, 1};
|
||||||
auto cmdbuf = device.CreateCommandBufferBuilder()
|
auto cmdbuf = device.CreateCommandBufferBuilder()
|
||||||
.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size)
|
.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size)
|
||||||
|
|
|
@ -66,7 +66,6 @@ namespace dawn_native {
|
||||||
uint32_t level;
|
uint32_t level;
|
||||||
uint32_t slice;
|
uint32_t slice;
|
||||||
Origin3D origin; // Texels
|
Origin3D origin; // Texels
|
||||||
dawn::TextureAspect aspect;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CopyBufferToBufferCmd {
|
struct CopyBufferToBufferCmd {
|
||||||
|
|
|
@ -303,7 +303,7 @@ std::ostringstream& DawnTest::AddTextureExpectation(const char* file,
|
||||||
// We need to enqueue the copy immediately because by the time we resolve the expectation,
|
// We need to enqueue the copy immediately because by the time we resolve the expectation,
|
||||||
// the texture might have been modified.
|
// the texture might have been modified.
|
||||||
dawn::TextureCopyView textureCopyView =
|
dawn::TextureCopyView textureCopyView =
|
||||||
utils::CreateTextureCopyView(texture, level, slice, {x, y, 0}, dawn::TextureAspect::Color);
|
utils::CreateTextureCopyView(texture, level, slice, {x, y, 0});
|
||||||
dawn::BufferCopyView bufferCopyView =
|
dawn::BufferCopyView bufferCopyView =
|
||||||
utils::CreateBufferCopyView(readback.buffer, readback.offset, rowPitch, 0);
|
utils::CreateBufferCopyView(readback.buffer, readback.offset, rowPitch, 0);
|
||||||
dawn::Extent3D copySize = {width, height, 1};
|
dawn::Extent3D copySize = {width, height, 1};
|
||||||
|
|
|
@ -256,8 +256,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||||
dawn::CommandBufferBuilder builder = device.CreateCommandBufferBuilder();
|
dawn::CommandBufferBuilder builder = device.CreateCommandBufferBuilder();
|
||||||
dawn::BufferCopyView bufferCopyView =
|
dawn::BufferCopyView bufferCopyView =
|
||||||
utils::CreateBufferCopyView(stagingBuffer, 0, widthInBytes, 0);
|
utils::CreateBufferCopyView(stagingBuffer, 0, widthInBytes, 0);
|
||||||
dawn::TextureCopyView textureCopyView =
|
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
|
||||||
utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color);
|
|
||||||
dawn::Extent3D copySize = {width, height, 1};
|
dawn::Extent3D copySize = {width, height, 1};
|
||||||
builder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
builder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||||
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo);
|
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass.renderPassInfo);
|
||||||
|
|
|
@ -103,8 +103,8 @@ class CopyTests_T2B : public CopyTests {
|
||||||
static_cast<uint32_t>(sizeof(RGBA8) * textureArrayData[slice].size()), dawn::BufferUsageBit::TransferSrc);
|
static_cast<uint32_t>(sizeof(RGBA8) * textureArrayData[slice].size()), dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::BufferCopyView bufferCopyView =
|
dawn::BufferCopyView bufferCopyView =
|
||||||
utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0);
|
utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0);
|
||||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
dawn::TextureCopyView textureCopyView =
|
||||||
texture, textureSpec.level, slice, {0, 0, 0}, dawn::TextureAspect::Color);
|
utils::CreateTextureCopyView(texture, textureSpec.level, slice, {0, 0, 0});
|
||||||
dawn::Extent3D copySize = {width, height, 1};
|
dawn::Extent3D copySize = {width, height, 1};
|
||||||
cmdBuilder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
cmdBuilder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||||
}
|
}
|
||||||
|
@ -123,8 +123,7 @@ class CopyTests_T2B : public CopyTests {
|
||||||
for (uint32_t slice = 0; slice < textureSpec.arraySize; ++slice) {
|
for (uint32_t slice = 0; slice < textureSpec.arraySize; ++slice) {
|
||||||
// Copy the region [(`x`, `y`), (`x + copyWidth, `y + copyWidth`)] from the `level` mip into the buffer at `offset + bufferSpec.size * slice` and `rowPitch`
|
// Copy the region [(`x`, `y`), (`x + copyWidth, `y + copyWidth`)] from the `level` mip into the buffer at `offset + bufferSpec.size * slice` and `rowPitch`
|
||||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
||||||
texture, textureSpec.level, slice, {textureSpec.x, textureSpec.y, 0},
|
texture, textureSpec.level, slice, {textureSpec.x, textureSpec.y, 0});
|
||||||
dawn::TextureAspect::Color);
|
|
||||||
dawn::BufferCopyView bufferCopyView =
|
dawn::BufferCopyView bufferCopyView =
|
||||||
utils::CreateBufferCopyView(buffer, bufferOffset, bufferSpec.rowPitch, 0);
|
utils::CreateBufferCopyView(buffer, bufferOffset, bufferSpec.rowPitch, 0);
|
||||||
dawn::Extent3D copySize = {textureSpec.copyWidth, textureSpec.copyHeight, 1};
|
dawn::Extent3D copySize = {textureSpec.copyWidth, textureSpec.copyHeight, 1};
|
||||||
|
@ -212,8 +211,8 @@ protected:
|
||||||
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(device, emptyData.data(), static_cast<uint32_t>(sizeof(RGBA8) * emptyData.size()), dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(device, emptyData.data(), static_cast<uint32_t>(sizeof(RGBA8) * emptyData.size()), dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::BufferCopyView bufferCopyView =
|
dawn::BufferCopyView bufferCopyView =
|
||||||
utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0);
|
utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0);
|
||||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
dawn::TextureCopyView textureCopyView =
|
||||||
texture, textureSpec.level, 0, {0, 0, 0}, dawn::TextureAspect::Color);
|
utils::CreateTextureCopyView(texture, textureSpec.level, 0, {0, 0, 0});
|
||||||
dawn::Extent3D copySize = {width, height, 1};
|
dawn::Extent3D copySize = {width, height, 1};
|
||||||
cmdBuilder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
cmdBuilder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||||
}
|
}
|
||||||
|
@ -223,8 +222,7 @@ protected:
|
||||||
dawn::BufferCopyView bufferCopyView =
|
dawn::BufferCopyView bufferCopyView =
|
||||||
utils::CreateBufferCopyView(buffer, bufferSpec.offset, bufferSpec.rowPitch, 0);
|
utils::CreateBufferCopyView(buffer, bufferSpec.offset, bufferSpec.rowPitch, 0);
|
||||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
||||||
texture, textureSpec.level, 0, {textureSpec.x, textureSpec.y, 0},
|
texture, textureSpec.level, 0, {textureSpec.x, textureSpec.y, 0});
|
||||||
dawn::TextureAspect::Color);
|
|
||||||
dawn::Extent3D copySize = {textureSpec.copyWidth, textureSpec.copyHeight, 1};
|
dawn::Extent3D copySize = {textureSpec.copyWidth, textureSpec.copyHeight, 1};
|
||||||
cmdBuilder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
cmdBuilder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ protected:
|
||||||
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data, sizeof(data), dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data, sizeof(data), dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 256, 0);
|
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 256, 0);
|
||||||
dawn::TextureCopyView textureCopyView =
|
dawn::TextureCopyView textureCopyView =
|
||||||
utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color);
|
utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
|
||||||
dawn::Extent3D copySize = {2, 2, 1};
|
dawn::Extent3D copySize = {2, 2, 1};
|
||||||
dawn::CommandBuffer copy =
|
dawn::CommandBuffer copy =
|
||||||
device.CreateCommandBufferBuilder()
|
device.CreateCommandBufferBuilder()
|
||||||
|
|
|
@ -146,8 +146,8 @@ protected:
|
||||||
dawn::BufferUsageBit::TransferSrc);
|
dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::BufferCopyView bufferCopyView =
|
dawn::BufferCopyView bufferCopyView =
|
||||||
utils::CreateBufferCopyView(stagingBuffer, 0, kTextureRowPitchAlignment, 0);
|
utils::CreateBufferCopyView(stagingBuffer, 0, kTextureRowPitchAlignment, 0);
|
||||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
dawn::TextureCopyView textureCopyView =
|
||||||
mTexture, level, layer, {0, 0, 0}, dawn::TextureAspect::Color);
|
utils::CreateTextureCopyView(mTexture, level, layer, {0, 0, 0});
|
||||||
dawn::Extent3D copySize = {texWidth, texHeight, 1};
|
dawn::Extent3D copySize = {texWidth, texHeight, 1};
|
||||||
builder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
builder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,12 +58,11 @@ class CopyCommandTest : public ValidationTest {
|
||||||
uint32_t destLevel,
|
uint32_t destLevel,
|
||||||
uint32_t destSlice,
|
uint32_t destSlice,
|
||||||
dawn::Origin3D destOrigin,
|
dawn::Origin3D destOrigin,
|
||||||
dawn::TextureAspect destAspect,
|
|
||||||
dawn::Extent3D extent3D) {
|
dawn::Extent3D extent3D) {
|
||||||
dawn::BufferCopyView bufferCopyView =
|
dawn::BufferCopyView bufferCopyView =
|
||||||
utils::CreateBufferCopyView(srcBuffer, srcOffset, srcRowPitch, srcImageHeight);
|
utils::CreateBufferCopyView(srcBuffer, srcOffset, srcRowPitch, srcImageHeight);
|
||||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
dawn::TextureCopyView textureCopyView =
|
||||||
destTexture, destLevel, destSlice, destOrigin, destAspect);
|
utils::CreateTextureCopyView(destTexture, destLevel, destSlice, destOrigin);
|
||||||
|
|
||||||
if (expectation == utils::Expectation::Success) {
|
if (expectation == utils::Expectation::Success) {
|
||||||
dawn::CommandBuffer commands =
|
dawn::CommandBuffer commands =
|
||||||
|
@ -83,7 +82,6 @@ class CopyCommandTest : public ValidationTest {
|
||||||
uint32_t srcLevel,
|
uint32_t srcLevel,
|
||||||
uint32_t srcSlice,
|
uint32_t srcSlice,
|
||||||
dawn::Origin3D srcOrigin,
|
dawn::Origin3D srcOrigin,
|
||||||
dawn::TextureAspect srcAspect,
|
|
||||||
dawn::Buffer destBuffer,
|
dawn::Buffer destBuffer,
|
||||||
uint32_t destOffset,
|
uint32_t destOffset,
|
||||||
uint32_t destRowPitch,
|
uint32_t destRowPitch,
|
||||||
|
@ -91,8 +89,8 @@ class CopyCommandTest : public ValidationTest {
|
||||||
dawn::Extent3D extent3D) {
|
dawn::Extent3D extent3D) {
|
||||||
dawn::BufferCopyView bufferCopyView =
|
dawn::BufferCopyView bufferCopyView =
|
||||||
utils::CreateBufferCopyView(destBuffer, destOffset, destRowPitch, destImageHeight);
|
utils::CreateBufferCopyView(destBuffer, destOffset, destRowPitch, destImageHeight);
|
||||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
dawn::TextureCopyView textureCopyView =
|
||||||
srcTexture, srcLevel, srcSlice, srcOrigin, srcAspect);
|
utils::CreateTextureCopyView(srcTexture, srcLevel, srcSlice, srcOrigin);
|
||||||
|
|
||||||
if (expectation == utils::Expectation::Success) {
|
if (expectation == utils::Expectation::Success) {
|
||||||
dawn::CommandBuffer commands =
|
dawn::CommandBuffer commands =
|
||||||
|
@ -192,42 +190,42 @@ TEST_F(CopyCommandTest_B2T, Success) {
|
||||||
{
|
{
|
||||||
// Copy 4x4 block in corner of first mip.
|
// Copy 4x4 block in corner of first mip.
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
// Copy 4x4 block in opposite corner of first mip.
|
// Copy 4x4 block in opposite corner of first mip.
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {12, 12, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {12, 12, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
// Copy 4x4 block in the 4x4 mip.
|
// Copy 4x4 block in the 4x4 mip.
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 2, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 2, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
// Copy with a buffer offset
|
// Copy with a buffer offset
|
||||||
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 0, destination, 0, 0,
|
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 0, destination, 0, 0,
|
||||||
{0, 0, 0}, dawn::TextureAspect::Color, {1, 1, 1});
|
{0, 0, 0}, {1, 1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copies with a 256-byte aligned row pitch but unaligned texture region
|
// Copies with a 256-byte aligned row pitch but unaligned texture region
|
||||||
{
|
{
|
||||||
// Unaligned region
|
// Unaligned region
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {3, 4, 1});
|
{3, 4, 1});
|
||||||
// Unaligned region with texture offset
|
// Unaligned region with texture offset
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {5, 7, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {5, 7, 0},
|
||||||
dawn::TextureAspect::Color, {2, 3, 1});
|
{2, 3, 1});
|
||||||
// Unaligned region, with buffer offset
|
// Unaligned region, with buffer offset
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 31 * 4, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 31 * 4, 256, 0, destination, 0, 0,
|
||||||
dawn::TextureAspect::Color, {3, 3, 1});
|
{0, 0, 0}, {3, 3, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty copies are valid
|
// Empty copies are valid
|
||||||
{
|
{
|
||||||
// An empty copy
|
// An empty copy
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {0, 0, 1});
|
{0, 0, 1});
|
||||||
// An empty copy touching the end of the buffer
|
// An empty copy touching the end of the buffer
|
||||||
TestB2TCopy(utils::Expectation::Success, source, bufferSize, 0, 0, destination, 0, 0, {0, 0,
|
TestB2TCopy(utils::Expectation::Success, source, bufferSize, 0, 0, destination, 0, 0,
|
||||||
0}, dawn::TextureAspect::Color, {0, 0, 1});
|
{0, 0, 0}, {0, 0, 1});
|
||||||
// An empty copy touching the side of the texture
|
// An empty copy touching the side of the texture
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, 0, {16, 16, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 0, 0, destination, 0, 0, {16, 16, 0},
|
||||||
dawn::TextureAspect::Color, {0, 0, 1});
|
{0, 0, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,15 +238,15 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||||
|
|
||||||
// OOB on the buffer because we copy too many pixels
|
// OOB on the buffer because we copy too many pixels
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 5, 1});
|
{4, 5, 1});
|
||||||
|
|
||||||
// OOB on the buffer because of the offset
|
// OOB on the buffer because of the offset
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 4, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 4, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// OOB on the buffer because (row pitch * (height - 1) + width) * depth overflows
|
// OOB on the buffer because (row pitch * (height - 1) + width) * depth overflows
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 512, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 512, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 3, 1});
|
{4, 3, 1});
|
||||||
|
|
||||||
// Not OOB on the buffer although row pitch * height overflows
|
// Not OOB on the buffer although row pitch * height overflows
|
||||||
// but (row pitch * (height - 1) + width) * depth does not overlow
|
// but (row pitch * (height - 1) + width) * depth does not overlow
|
||||||
|
@ -258,7 +256,7 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||||
dawn::Buffer sourceBuffer = CreateBuffer(sourceBufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer sourceBuffer = CreateBuffer(sourceBufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
|
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {7, 3, 1});
|
{7, 3, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,23 +269,23 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
||||||
|
|
||||||
// OOB on the texture because x + width overflows
|
// OOB on the texture because x + width overflows
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {13, 12, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {13, 12, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// OOB on the texture because y + width overflows
|
// OOB on the texture because y + width overflows
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {12, 13, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {12, 13, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// OOB on the texture because we overflow a non-zero mip
|
// OOB on the texture because we overflow a non-zero mip
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 2, 0, {1, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 2, 0, {1, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// OOB on the texture even on an empty copy when we copy to a non-existent mip.
|
// OOB on the texture even on an empty copy when we copy to a non-existent mip.
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 5, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 5, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {0, 0, 1});
|
{0, 0, 1});
|
||||||
|
|
||||||
// OOB on the texture because slice overflows
|
// OOB on the texture because slice overflows
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 2, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 2, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {0, 0, 1});
|
{0, 0, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that we force Z=0 and Depth=1 on copies to 2D textures
|
// Test that we force Z=0 and Depth=1 on copies to 2D textures
|
||||||
|
@ -298,11 +296,11 @@ TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) {
|
||||||
|
|
||||||
// Z=1 on an empty copy still errors
|
// Z=1 on an empty copy still errors
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 1},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 1},
|
||||||
dawn::TextureAspect::Color, {0, 0, 1});
|
{0, 0, 1});
|
||||||
|
|
||||||
// Depth=0 on an empty copy still errors
|
// Depth=0 on an empty copy still errors
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {0, 0, 0});
|
{0, 0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test B2T copies with incorrect buffer usage
|
// Test B2T copies with incorrect buffer usage
|
||||||
|
@ -316,11 +314,11 @@ TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
||||||
|
|
||||||
// Incorrect source usage
|
// Incorrect source usage
|
||||||
TestB2TCopy(utils::Expectation::Failure, vertex, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, vertex, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// Incorrect destination usage
|
// Incorrect destination usage
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, sampled, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, sampled, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
||||||
|
@ -331,15 +329,15 @@ TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
||||||
|
|
||||||
// Default row pitch is not 256-byte aligned
|
// Default row pitch is not 256-byte aligned
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {3, 4, 1});
|
{3, 4, 1});
|
||||||
|
|
||||||
// Row pitch is not 256-byte aligned
|
// Row pitch is not 256-byte aligned
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 128, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 128, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// Row pitch is less than width * bytesPerPixel
|
// Row pitch is less than width * bytesPerPixel
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {65, 1, 1});
|
{65, 1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
||||||
|
@ -350,19 +348,19 @@ TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
||||||
|
|
||||||
// Image height is zero (Valid)
|
// Image height is zero (Valid)
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// Image height is equal to copy height (Valid)
|
// Image height is equal to copy height (Valid)
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// Image height is larger than copy height (Valid)
|
// Image height is larger than copy height (Valid)
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 4, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 4, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// Image height is less than copy height (Invalid)
|
// Image height is less than copy height (Invalid)
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 3, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 3, destination, 0, 0, {0, 0, 0},
|
||||||
dawn::TextureAspect::Color, {4, 4, 1});
|
{4, 4, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test B2T copies with incorrect buffer offset usage
|
// Test B2T copies with incorrect buffer offset usage
|
||||||
|
@ -373,17 +371,17 @@ TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Correct usage
|
// Correct usage
|
||||||
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 0, destination, 0, 0, {0,
|
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 0, destination, 0, 0,
|
||||||
0, 0}, dawn::TextureAspect::Color, {1, 1, 1});
|
{0, 0, 0}, {1, 1, 1});
|
||||||
|
|
||||||
// Incorrect usages
|
// Incorrect usages
|
||||||
{
|
{
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, bufferSize - 5, 256, 0, destination, 0, 0,
|
TestB2TCopy(utils::Expectation::Failure, source, bufferSize - 5, 256, 0, destination, 0, 0,
|
||||||
{0, 0, 0}, dawn::TextureAspect::Color, {1, 1, 1});
|
{0, 0, 0}, {1, 1, 1});
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, bufferSize - 6, 256, 0, destination, 0, 0,
|
TestB2TCopy(utils::Expectation::Failure, source, bufferSize - 6, 256, 0, destination, 0, 0,
|
||||||
{0, 0, 0}, dawn::TextureAspect::Color, {1, 1, 1});
|
{0, 0, 0}, {1, 1, 1});
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, bufferSize - 7, 256, 0, destination, 0, 0,
|
TestB2TCopy(utils::Expectation::Failure, source, bufferSize - 7, 256, 0, destination, 0, 0,
|
||||||
{0, 0, 0}, dawn::TextureAspect::Color, {1, 1, 1});
|
{0, 0, 0}, {1, 1, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,43 +398,43 @@ TEST_F(CopyCommandTest_T2B, Success) {
|
||||||
// Different copies, including some that touch the OOB condition
|
// Different copies, including some that touch the OOB condition
|
||||||
{
|
{
|
||||||
// Copy from 4x4 block in corner of first mip.
|
// Copy from 4x4 block in corner of first mip.
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {4, 4, 1});
|
{4, 4, 1});
|
||||||
// Copy from 4x4 block in opposite corner of first mip.
|
// Copy from 4x4 block in opposite corner of first mip.
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {12, 12, 0},
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {12, 12, 0}, destination, 0, 256, 0,
|
||||||
dawn::TextureAspect::Color, destination, 0, 256, 0, {4, 4, 1});
|
{4, 4, 1});
|
||||||
// Copy from 4x4 block in the 4x4 mip.
|
// Copy from 4x4 block in the 4x4 mip.
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 2, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 2, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {4, 4, 1});
|
{4, 4, 1});
|
||||||
// Copy with a buffer offset
|
// Copy with a buffer offset
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination,
|
||||||
destination, bufferSize - 4, 256, 0, {1, 1, 1});
|
bufferSize - 4, 256, 0, {1, 1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copies with a 256-byte aligned row pitch but unaligned texture region
|
// Copies with a 256-byte aligned row pitch but unaligned texture region
|
||||||
{
|
{
|
||||||
// Unaligned region
|
// Unaligned region
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {3, 4, 1});
|
{3, 4, 1});
|
||||||
// Unaligned region with texture offset
|
// Unaligned region with texture offset
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {5, 7, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {5, 7, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {2, 3, 1});
|
{2, 3, 1});
|
||||||
// Unaligned region, with buffer offset
|
// Unaligned region, with buffer offset
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 2, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 2, 0, {0, 0, 0}, destination, 31 * 4, 256,
|
||||||
destination, 31 * 4, 256, 0, {3, 3, 1});
|
0, {3, 3, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty copies are valid
|
// Empty copies are valid
|
||||||
{
|
{
|
||||||
// An empty copy
|
// An empty copy
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0, 0,
|
||||||
destination, 0, 0, 0, {0, 0, 1});
|
{0, 0, 1});
|
||||||
// An empty copy touching the end of the buffer
|
// An empty copy touching the end of the buffer
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, bufferSize,
|
||||||
destination, bufferSize, 0, 0, {0, 0, 1});
|
0, 0, {0, 0, 1});
|
||||||
// An empty copy touching the side of the texture
|
// An empty copy touching the side of the texture
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {16, 16, 0},
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {16, 16, 0}, destination, 0, 0, 0,
|
||||||
dawn::TextureAspect::Color, destination, 0, 0, 0, {0, 0, 1});
|
{0, 0, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,20 +446,20 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
// OOB on the texture because x + width overflows
|
// OOB on the texture because x + width overflows
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {13, 12, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {13, 12, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// OOB on the texture because y + width overflows
|
// OOB on the texture because y + width overflows
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {12, 13, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {12, 13, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// OOB on the texture because we overflow a non-zero mip
|
// OOB on the texture because we overflow a non-zero mip
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 2, 0, {1, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 2, 0, {1, 0, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// OOB on the texture even on an empty copy when we copy from a non-existent mip.
|
// OOB on the texture even on an empty copy when we copy from a non-existent mip.
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 5, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 5, 0, {0, 0, 0}, destination, 0, 0, 0,
|
||||||
destination, 0, 0, 0, {0, 0, 1});
|
{0, 0, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test OOB conditions on the buffer
|
// Test OOB conditions on the buffer
|
||||||
|
@ -472,16 +470,16 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
// OOB on the buffer because we copy too many pixels
|
// OOB on the buffer because we copy too many pixels
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {4, 5, 1});
|
{4, 5, 1});
|
||||||
|
|
||||||
// OOB on the buffer because of the offset
|
// OOB on the buffer because of the offset
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 4, 256, 0,
|
||||||
destination, 4, 256, 0, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// OOB on the buffer because (row pitch * (height - 1) + width) * depth overflows
|
// OOB on the buffer because (row pitch * (height - 1) + width) * depth overflows
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 512, 0,
|
||||||
destination, 0, 512, 0, {4, 3, 1});
|
{4, 3, 1});
|
||||||
|
|
||||||
// Not OOB on the buffer although row pitch * height overflows
|
// Not OOB on the buffer although row pitch * height overflows
|
||||||
// but (row pitch * (height - 1) + width) * depth does not overlow
|
// but (row pitch * (height - 1) + width) * depth does not overlow
|
||||||
|
@ -489,8 +487,8 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
||||||
uint32_t destinationBufferSize = BufferSizeForTextureCopy(7, 3, 1);
|
uint32_t destinationBufferSize = BufferSizeForTextureCopy(7, 3, 1);
|
||||||
ASSERT_TRUE(256 * 3 > destinationBufferSize) << "row pitch * height should overflow buffer";
|
ASSERT_TRUE(256 * 3 > destinationBufferSize) << "row pitch * height should overflow buffer";
|
||||||
dawn::Buffer destinationBuffer = CreateBuffer(destinationBufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destinationBuffer = CreateBuffer(destinationBufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destinationBuffer, 0, 256,
|
||||||
destinationBuffer, 0, 256, 0, {7, 3, 1});
|
0, {7, 3, 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,12 +500,12 @@ TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
// Z=1 on an empty copy still errors
|
// Z=1 on an empty copy still errors
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 1}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 1}, destination, 0, 0, 0,
|
||||||
destination, 0, 0, 0, {0, 0, 1});
|
{0, 0, 1});
|
||||||
|
|
||||||
// Depth=0 on an empty copy still errors
|
// Depth=0 on an empty copy still errors
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 0, 0,
|
||||||
destination, 0, 0, 0, {0, 0, 0});
|
{0, 0, 0});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test T2B copies with incorrect buffer usage
|
// Test T2B copies with incorrect buffer usage
|
||||||
|
@ -521,12 +519,11 @@ TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
||||||
dawn::Buffer vertex = CreateBuffer(bufferSize, dawn::BufferUsageBit::Vertex);
|
dawn::Buffer vertex = CreateBuffer(bufferSize, dawn::BufferUsageBit::Vertex);
|
||||||
|
|
||||||
// Incorrect source usage
|
// Incorrect source usage
|
||||||
TestT2BCopy(utils::Expectation::Failure, sampled, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, sampled, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// Incorrect destination usage
|
// Incorrect destination usage
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, vertex, 0, 256, 0, {4, 4, 1});
|
||||||
vertex, 0, 256, 0, {4, 4, 1});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
||||||
|
@ -536,16 +533,16 @@ TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
|
|
||||||
// Default row pitch is not 256-byte aligned
|
// Default row pitch is not 256-byte aligned
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {3, 4, 1});
|
{3, 4, 1});
|
||||||
|
|
||||||
// Row pitch is not 256-byte aligned
|
// Row pitch is not 256-byte aligned
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 257, 0,
|
||||||
destination, 0, 257, 0, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// Row pitch is less than width * bytesPerPixel
|
// Row pitch is less than width * bytesPerPixel
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {65, 1, 1});
|
{65, 1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
||||||
|
@ -555,20 +552,20 @@ TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
// Image height is zero (Valid)
|
// Image height is zero (Valid)
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||||
destination, 0, 256, 0, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// Image height is equal to copy height (Valid)
|
// Image height is equal to copy height (Valid)
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 256, 4,
|
||||||
destination, 0, 256, 4, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// Image height exceeds copy height (Valid)
|
// Image height exceeds copy height (Valid)
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 256, 5,
|
||||||
destination, 0, 256, 5, {4, 4, 1});
|
{4, 4, 1});
|
||||||
|
|
||||||
// Image height is less than copy height (Invalid)
|
// Image height is less than copy height (Invalid)
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 3,
|
||||||
destination, 0, 256, 3, {4, 4, 1});
|
{4, 4, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test T2B copies with incorrect buffer offset usage
|
// Test T2B copies with incorrect buffer offset usage
|
||||||
|
@ -579,15 +576,15 @@ TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
// Correct usage
|
// Correct usage
|
||||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, bufferSize - 4,
|
||||||
destination, bufferSize - 4, 256, 0, {1, 1, 1});
|
256, 0, {1, 1, 1});
|
||||||
|
|
||||||
// Incorrect usages
|
// Incorrect usages
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, bufferSize - 5,
|
||||||
destination, bufferSize - 5, 256, 0, {1, 1, 1});
|
256, 0, {1, 1, 1});
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, bufferSize - 6,
|
||||||
destination, bufferSize - 6, 256, 0, {1, 1, 1});
|
256, 0, {1, 1, 1});
|
||||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color,
|
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, bufferSize - 7,
|
||||||
destination, bufferSize - 7, 256, 0, {1, 1, 1});
|
256, 0, {1, 1, 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,14 +170,12 @@ namespace utils {
|
||||||
dawn::TextureCopyView CreateTextureCopyView(dawn::Texture texture,
|
dawn::TextureCopyView CreateTextureCopyView(dawn::Texture texture,
|
||||||
uint32_t level,
|
uint32_t level,
|
||||||
uint32_t slice,
|
uint32_t slice,
|
||||||
dawn::Origin3D origin,
|
dawn::Origin3D origin) {
|
||||||
dawn::TextureAspect aspect) {
|
|
||||||
dawn::TextureCopyView textureCopyView;
|
dawn::TextureCopyView textureCopyView;
|
||||||
textureCopyView.texture = texture;
|
textureCopyView.texture = texture;
|
||||||
textureCopyView.level = level;
|
textureCopyView.level = level;
|
||||||
textureCopyView.slice = slice;
|
textureCopyView.slice = slice;
|
||||||
textureCopyView.origin = origin;
|
textureCopyView.origin = origin;
|
||||||
textureCopyView.aspect = aspect;
|
|
||||||
|
|
||||||
return textureCopyView;
|
return textureCopyView;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,7 @@ namespace utils {
|
||||||
dawn::TextureCopyView CreateTextureCopyView(dawn::Texture texture,
|
dawn::TextureCopyView CreateTextureCopyView(dawn::Texture texture,
|
||||||
uint32_t level,
|
uint32_t level,
|
||||||
uint32_t slice,
|
uint32_t slice,
|
||||||
dawn::Origin3D origin,
|
dawn::Origin3D origin);
|
||||||
dawn::TextureAspect aspect);
|
|
||||||
|
|
||||||
struct BasicRenderPass {
|
struct BasicRenderPass {
|
||||||
uint32_t width;
|
uint32_t width;
|
||||||
|
|
Loading…
Reference in New Issue