mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
Rename Transfer[Src|Dst] to Copy[Src|Dst]
This is to match the equivalent rename in WebGPU's IDL. BUG=dawn:22 Change-Id: Ibdf75869e58835d984df559878b884c55310a403 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8623 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
3c3e2bc4d9
commit
ec05355c72
@@ -77,7 +77,7 @@ class BufferValidationTest : public ValidationTest {
|
||||
dawn::Buffer CreateSetSubDataBuffer(uint64_t size) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = size;
|
||||
descriptor.usage = dawn::BufferUsageBit::TransferDst;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopyDst;
|
||||
|
||||
return device.CreateBuffer(&descriptor);
|
||||
}
|
||||
@@ -125,11 +125,11 @@ TEST_F(BufferValidationTest, CreationSuccess) {
|
||||
|
||||
// Test restriction on usages allowed with MapRead and MapWrite
|
||||
TEST_F(BufferValidationTest, CreationMapUsageRestrictions) {
|
||||
// MapRead with TransferDst is ok
|
||||
// MapRead with CopyDst is ok
|
||||
{
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
|
||||
|
||||
device.CreateBuffer(&descriptor);
|
||||
}
|
||||
@@ -143,11 +143,11 @@ TEST_F(BufferValidationTest, CreationMapUsageRestrictions) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateBuffer(&descriptor));
|
||||
}
|
||||
|
||||
// MapWrite with TransferSrc is ok
|
||||
// MapWrite with CopySrc is ok
|
||||
{
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
|
||||
|
||||
device.CreateBuffer(&descriptor);
|
||||
}
|
||||
@@ -200,8 +200,7 @@ TEST_F(BufferValidationTest, CreateBufferMappedSuccess) {
|
||||
|
||||
// Test the success case for non-mappable CreateBufferMapped
|
||||
TEST_F(BufferValidationTest, NonMappableCreateBufferMappedSuccess) {
|
||||
dawn::CreateBufferMappedResult result =
|
||||
CreateBufferMapped(4, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::CreateBufferMappedResult result = CreateBufferMapped(4, dawn::BufferUsageBit::CopySrc);
|
||||
ASSERT_NE(result.data, nullptr);
|
||||
ASSERT_EQ(result.dataLength, 4u);
|
||||
result.buffer.Unmap();
|
||||
@@ -211,7 +210,7 @@ TEST_F(BufferValidationTest, NonMappableCreateBufferMappedSuccess) {
|
||||
TEST_F(BufferValidationTest, MapReadWrongUsage) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::TransferDst;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopyDst;
|
||||
|
||||
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
||||
|
||||
@@ -226,7 +225,7 @@ TEST_F(BufferValidationTest, MapReadWrongUsage) {
|
||||
TEST_F(BufferValidationTest, MapWriteWrongUsage) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::TransferSrc;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc;
|
||||
|
||||
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
||||
|
||||
@@ -480,7 +479,7 @@ TEST_F(BufferValidationTest, SetSubDataWrongUsage) {
|
||||
TEST_F(BufferValidationTest, SetSubDataWithUnalignedSize) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4;
|
||||
descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
|
||||
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
||||
|
||||
@@ -492,7 +491,7 @@ TEST_F(BufferValidationTest, SetSubDataWithUnalignedSize) {
|
||||
TEST_F(BufferValidationTest, SetSubDataWithUnalignedOffset) {
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.size = 4000;
|
||||
descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
|
||||
dawn::Buffer buf = device.CreateBuffer(&descriptor);
|
||||
|
||||
@@ -646,11 +645,11 @@ TEST_F(BufferValidationTest, SetSubDataMappedBuffer) {
|
||||
TEST_F(BufferValidationTest, SubmitBufferWithMapUsage) {
|
||||
dawn::BufferDescriptor descriptorA;
|
||||
descriptorA.size = 4;
|
||||
descriptorA.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::MapWrite;
|
||||
descriptorA.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::MapWrite;
|
||||
|
||||
dawn::BufferDescriptor descriptorB;
|
||||
descriptorB.size = 4;
|
||||
descriptorB.usage = dawn::BufferUsageBit::TransferDst | dawn::BufferUsageBit::MapRead;
|
||||
descriptorB.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::MapRead;
|
||||
|
||||
dawn::Buffer bufA = device.CreateBuffer(&descriptorA);
|
||||
dawn::Buffer bufB = device.CreateBuffer(&descriptorB);
|
||||
@@ -665,11 +664,11 @@ TEST_F(BufferValidationTest, SubmitBufferWithMapUsage) {
|
||||
TEST_F(BufferValidationTest, SubmitMappedBuffer) {
|
||||
dawn::BufferDescriptor descriptorA;
|
||||
descriptorA.size = 4;
|
||||
descriptorA.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::MapWrite;
|
||||
descriptorA.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::MapWrite;
|
||||
|
||||
dawn::BufferDescriptor descriptorB;
|
||||
descriptorB.size = 4;
|
||||
descriptorB.usage = dawn::BufferUsageBit::TransferDst | dawn::BufferUsageBit::MapRead;
|
||||
descriptorB.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::MapRead;
|
||||
{
|
||||
dawn::Buffer bufA = device.CreateBuffer(&descriptorA);
|
||||
dawn::Buffer bufB = device.CreateBuffer(&descriptorB);
|
||||
@@ -720,11 +719,11 @@ TEST_F(BufferValidationTest, SubmitMappedBuffer) {
|
||||
TEST_F(BufferValidationTest, SubmitDestroyedBuffer) {
|
||||
dawn::BufferDescriptor descriptorA;
|
||||
descriptorA.size = 4;
|
||||
descriptorA.usage = dawn::BufferUsageBit::TransferSrc;
|
||||
descriptorA.usage = dawn::BufferUsageBit::CopySrc;
|
||||
|
||||
dawn::BufferDescriptor descriptorB;
|
||||
descriptorB.size = 4;
|
||||
descriptorB.usage = dawn::BufferUsageBit::TransferDst;
|
||||
descriptorB.usage = dawn::BufferUsageBit::CopyDst;
|
||||
|
||||
dawn::Buffer bufA = device.CreateBuffer(&descriptorA);
|
||||
dawn::Buffer bufB = device.CreateBuffer(&descriptorB);
|
||||
|
||||
@@ -160,7 +160,7 @@ TEST_F(CommandBufferValidationTest, CallsAfterASuccessfulFinish) {
|
||||
// A buffer that can be used in CopyBufferToBuffer
|
||||
dawn::BufferDescriptor copyBufferDesc;
|
||||
copyBufferDesc.size = 16;
|
||||
copyBufferDesc.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst;
|
||||
copyBufferDesc.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
dawn::Buffer copyBuffer = device.CreateBuffer(©BufferDesc);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
@@ -174,7 +174,7 @@ TEST_F(CommandBufferValidationTest, CallsAfterAFailedFinish) {
|
||||
// A buffer that can be used in CopyBufferToBuffer
|
||||
dawn::BufferDescriptor copyBufferDesc;
|
||||
copyBufferDesc.size = 16;
|
||||
copyBufferDesc.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst;
|
||||
copyBufferDesc.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
|
||||
dawn::Buffer copyBuffer = device.CreateBuffer(©BufferDesc);
|
||||
|
||||
// A buffer that can't be used in CopyBufferToBuffer
|
||||
|
||||
@@ -150,8 +150,8 @@ class CopyCommandTest_B2B : public CopyCommandTest {};
|
||||
|
||||
// Test a successfull B2B copy
|
||||
TEST_F(CopyCommandTest_B2B, Success) {
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
// Copy different copies, including some that touch the OOB condition
|
||||
{
|
||||
@@ -174,8 +174,8 @@ TEST_F(CopyCommandTest_B2B, Success) {
|
||||
|
||||
// Test B2B copies with OOB
|
||||
TEST_F(CopyCommandTest_B2B, OutOfBounds) {
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
// OOB on the source
|
||||
{
|
||||
@@ -194,8 +194,8 @@ TEST_F(CopyCommandTest_B2B, OutOfBounds) {
|
||||
|
||||
// Test B2B copies with incorrect buffer usage
|
||||
TEST_F(CopyCommandTest_B2B, BadUsage) {
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Buffer vertex = CreateBuffer(16, dawn::BufferUsageBit::Vertex);
|
||||
|
||||
// Source with incorrect usage
|
||||
@@ -215,8 +215,8 @@ TEST_F(CopyCommandTest_B2B, BadUsage) {
|
||||
|
||||
// Test B2B copies with unaligned data size
|
||||
TEST_F(CopyCommandTest_B2B, UnalignedSize) {
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToBuffer(source, 8, destination, 0, sizeof(uint8_t));
|
||||
@@ -225,8 +225,8 @@ TEST_F(CopyCommandTest_B2B, UnalignedSize) {
|
||||
|
||||
// Test B2B copies with unaligned offset
|
||||
TEST_F(CopyCommandTest_B2B, UnalignedOffset) {
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
// Unaligned source offset
|
||||
{
|
||||
@@ -247,11 +247,11 @@ TEST_F(CopyCommandTest_B2B, UnalignedOffset) {
|
||||
TEST_F(CopyCommandTest_B2B, BuffersInErrorState) {
|
||||
dawn::BufferDescriptor errorBufferDescriptor;
|
||||
errorBufferDescriptor.size = 4;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferSrc;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc;
|
||||
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
||||
|
||||
constexpr uint64_t bufferSize = 4;
|
||||
dawn::Buffer validBuffer = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer validBuffer = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
|
||||
{
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
@@ -271,9 +271,9 @@ class CopyCommandTest_B2T : public CopyCommandTest {};
|
||||
// Test a successfull B2T copy
|
||||
TEST_F(CopyCommandTest_B2T, Success) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Different copies, including some that touch the OOB condition
|
||||
{
|
||||
@@ -324,9 +324,9 @@ TEST_F(CopyCommandTest_B2T, Success) {
|
||||
// Test OOB conditions on the buffer
|
||||
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// OOB on the buffer because we copy too many pixels
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
@@ -346,8 +346,7 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||
{
|
||||
uint32_t sourceBufferSize = BufferSizeForTextureCopy(7, 3, 1);
|
||||
ASSERT_TRUE(256 * 3 > sourceBufferSize) << "row pitch * height should overflow buffer";
|
||||
dawn::Buffer sourceBuffer =
|
||||
CreateBuffer(sourceBufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer sourceBuffer = CreateBuffer(sourceBufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
|
||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
{7, 3, 1});
|
||||
@@ -357,9 +356,9 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||
// Test OOB conditions on the texture
|
||||
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// OOB on the texture because x + width overflows
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {13, 12, 0},
|
||||
@@ -384,9 +383,9 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
||||
|
||||
// Test that we force Z=0 and Depth=1 on copies to 2D textures
|
||||
TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) {
|
||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Z=1 on an empty copy still errors
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 1},
|
||||
@@ -399,10 +398,10 @@ TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) {
|
||||
|
||||
// Test B2T copies with incorrect buffer usage
|
||||
TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Buffer vertex = CreateBuffer(16 * 4, dawn::BufferUsageBit::Vertex);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::Sampled);
|
||||
|
||||
@@ -417,9 +416,9 @@ TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
||||
|
||||
TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Default row pitch is not 256-byte aligned
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
||||
@@ -436,9 +435,9 @@ TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
||||
|
||||
TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Image height is zero (Valid)
|
||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
@@ -460,9 +459,9 @@ TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
||||
// Test B2T copies with incorrect buffer offset usage
|
||||
TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Correct usage
|
||||
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 0, destination, 0, 0,
|
||||
@@ -482,9 +481,9 @@ TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
||||
// Test multisampled textures cannot be used in B2T copies.
|
||||
TEST_F(CopyCommandTest_B2T, CopyToMultisampledTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst, 4);
|
||||
dawn::TextureUsageBit::CopyDst, 4);
|
||||
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
{2, 2, 1});
|
||||
@@ -494,7 +493,7 @@ TEST_F(CopyCommandTest_B2T, CopyToMultisampledTexture) {
|
||||
TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
||||
dawn::BufferDescriptor errorBufferDescriptor;
|
||||
errorBufferDescriptor.size = 4;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferSrc;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc;
|
||||
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
||||
|
||||
dawn::TextureDescriptor errorTextureDescriptor;
|
||||
@@ -509,7 +508,7 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
||||
|
||||
{
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
|
||||
|
||||
@@ -520,7 +519,7 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
||||
|
||||
{
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
|
||||
|
||||
@@ -545,10 +544,9 @@ TEST_F(CopyCommandTest_B2T, TextureCopyBufferSizeLastRowComputation) {
|
||||
constexpr uint32_t kInvalidBufferSize = kRowPitch * (kHeight - 1) + kWidth;
|
||||
|
||||
for (dawn::TextureFormat format : kFormats) {
|
||||
dawn::Buffer source =
|
||||
CreateBuffer(kInvalidBufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(kInvalidBufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::TransferDst);
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopyDst);
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, kRowPitch, 0, destination, 0, 0,
|
||||
{0, 0, 0}, {kWidth, kHeight, 1});
|
||||
}
|
||||
@@ -558,21 +556,20 @@ TEST_F(CopyCommandTest_B2T, TextureCopyBufferSizeLastRowComputation) {
|
||||
for (dawn::TextureFormat format : kFormats) {
|
||||
uint32_t validBufferSize = BufferSizeForTextureCopy(kWidth, kHeight, 1, format);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::TransferDst);
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Verify the return value of BufferSizeForTextureCopy() is exactly the minimum valid
|
||||
// buffer size in this test.
|
||||
{
|
||||
uint32_t invalidBuffferSize = validBufferSize - 1;
|
||||
dawn::Buffer source =
|
||||
CreateBuffer(invalidBuffferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
CreateBuffer(invalidBuffferSize, dawn::BufferUsageBit::CopySrc);
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, kRowPitch, 0, destination, 0, 0,
|
||||
{0, 0, 0}, {kWidth, kHeight, 1});
|
||||
}
|
||||
|
||||
{
|
||||
dawn::Buffer source =
|
||||
CreateBuffer(validBufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(validBufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
TestB2TCopy(utils::Expectation::Success, source, 0, kRowPitch, 0, destination, 0, 0,
|
||||
{0, 0, 0}, {kWidth, kHeight, 1});
|
||||
}
|
||||
@@ -583,11 +580,10 @@ TEST_F(CopyCommandTest_B2T, TextureCopyBufferSizeLastRowComputation) {
|
||||
// Test copy from buffer to mip map of non square texture
|
||||
TEST_F(CopyCommandTest_B2T, CopyToMipmapOfNonSquareTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 2, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
uint32_t maxMipmapLevel = 3;
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture destination = Create2DTexture(
|
||||
4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Copy to top level mip map
|
||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, maxMipmapLevel - 1, 0,
|
||||
@@ -612,8 +608,8 @@ class CopyCommandTest_T2B : public CopyCommandTest {};
|
||||
TEST_F(CopyCommandTest_T2B, Success) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
// Different copies, including some that touch the OOB condition
|
||||
{
|
||||
@@ -665,8 +661,8 @@ TEST_F(CopyCommandTest_T2B, Success) {
|
||||
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
// OOB on the texture because x + width overflows
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {13, 12, 0}, destination, 0, 256, 0,
|
||||
@@ -689,8 +685,8 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
||||
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
// OOB on the buffer because we copy too many pixels
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||
@@ -711,7 +707,7 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
||||
uint32_t destinationBufferSize = BufferSizeForTextureCopy(7, 3, 1);
|
||||
ASSERT_TRUE(256 * 3 > destinationBufferSize) << "row pitch * height should overflow buffer";
|
||||
dawn::Buffer destinationBuffer =
|
||||
CreateBuffer(destinationBufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
CreateBuffer(destinationBufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destinationBuffer, 0, 256,
|
||||
0, {7, 3, 1});
|
||||
}
|
||||
@@ -721,8 +717,8 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
||||
TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
// Z=1 on an empty copy still errors
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 1}, destination, 0, 0, 0,
|
||||
@@ -737,10 +733,10 @@ TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
||||
TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::Sampled);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
dawn::Buffer vertex = CreateBuffer(bufferSize, dawn::BufferUsageBit::Vertex);
|
||||
|
||||
// Incorrect source usage
|
||||
@@ -754,8 +750,8 @@ TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
||||
TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
|
||||
// Default row pitch is not 256-byte aligned
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||
@@ -773,8 +769,8 @@ TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
||||
TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
// Image height is zero (Valid)
|
||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||
@@ -797,8 +793,8 @@ TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
||||
TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
// Correct usage
|
||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, bufferSize - 4,
|
||||
@@ -816,9 +812,9 @@ TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
||||
// Test multisampled textures cannot be used in T2B copies.
|
||||
TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) {
|
||||
dawn::Texture source = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc, 4);
|
||||
dawn::TextureUsageBit::CopySrc, 4);
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
|
||||
{2, 2, 1});
|
||||
@@ -828,7 +824,7 @@ TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) {
|
||||
TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
|
||||
dawn::BufferDescriptor errorBufferDescriptor;
|
||||
errorBufferDescriptor.size = 4;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferSrc;
|
||||
errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc;
|
||||
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
|
||||
|
||||
dawn::TextureDescriptor errorTextureDescriptor;
|
||||
@@ -843,7 +839,7 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
|
||||
|
||||
{
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
|
||||
|
||||
@@ -854,7 +850,7 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
|
||||
|
||||
{
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
|
||||
|
||||
@@ -880,10 +876,10 @@ TEST_F(CopyCommandTest_T2B, TextureCopyBufferSizeLastRowComputation) {
|
||||
|
||||
for (dawn::TextureFormat format : kFormats) {
|
||||
dawn::Texture source =
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::TransferDst);
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
dawn::Buffer destination =
|
||||
CreateBuffer(kInvalidBufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
CreateBuffer(kInvalidBufferSize, dawn::BufferUsageBit::CopySrc);
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0,
|
||||
kRowPitch, 0, {kWidth, kHeight, 1});
|
||||
}
|
||||
@@ -893,21 +889,21 @@ TEST_F(CopyCommandTest_T2B, TextureCopyBufferSizeLastRowComputation) {
|
||||
for (dawn::TextureFormat format : kFormats) {
|
||||
uint32_t validBufferSize = BufferSizeForTextureCopy(kWidth, kHeight, 1, format);
|
||||
dawn::Texture source =
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::TransferSrc);
|
||||
Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopySrc);
|
||||
|
||||
// Verify the return value of BufferSizeForTextureCopy() is exactly the minimum valid
|
||||
// buffer size in this test.
|
||||
{
|
||||
uint32_t invalidBufferSize = validBufferSize - 1;
|
||||
dawn::Buffer destination =
|
||||
CreateBuffer(invalidBufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
CreateBuffer(invalidBufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0,
|
||||
kRowPitch, 0, {kWidth, kHeight, 1});
|
||||
}
|
||||
|
||||
{
|
||||
dawn::Buffer destination =
|
||||
CreateBuffer(validBufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
CreateBuffer(validBufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0,
|
||||
kRowPitch, 0, {kWidth, kHeight, 1});
|
||||
}
|
||||
@@ -919,9 +915,9 @@ TEST_F(CopyCommandTest_T2B, TextureCopyBufferSizeLastRowComputation) {
|
||||
TEST_F(CopyCommandTest_T2B, CopyFromMipmapOfNonSquareTexture) {
|
||||
uint32_t maxMipmapLevel = 3;
|
||||
dawn::Texture source = Create2DTexture(4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 2, 1);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
// Copy from top level mip map
|
||||
TestT2BCopy(utils::Expectation::Success, source, maxMipmapLevel - 1, 0, {0, 0, 0}, destination,
|
||||
@@ -944,9 +940,9 @@ class CopyCommandTest_T2T : public CopyCommandTest {};
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, Success) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Different copies, including some that touch the OOB condition
|
||||
{
|
||||
@@ -997,9 +993,9 @@ TEST_F(CopyCommandTest_T2T, Success) {
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, IncorrectUsage) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Incorrect source usage causes failure
|
||||
TestT2TCopy(utils::Expectation::Failure, destination, 0, 0, {0, 0, 0}, destination, 0, 0,
|
||||
@@ -1012,9 +1008,9 @@ TEST_F(CopyCommandTest_T2T, IncorrectUsage) {
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, OutOfBounds) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// OOB on source
|
||||
{
|
||||
@@ -1065,9 +1061,9 @@ TEST_F(CopyCommandTest_T2T, OutOfBounds) {
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, 2DTextureDepthConstraints) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Empty copy on source with z > 0 fails
|
||||
TestT2TCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 1}, destination, 0, 0, {0, 0, 0},
|
||||
@@ -1084,9 +1080,9 @@ TEST_F(CopyCommandTest_T2T, 2DTextureDepthConstraints) {
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8, dawn::TextureUsageBit::TransferDst);
|
||||
16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8, dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Success when entire depth stencil subresource is copied
|
||||
TestT2TCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
|
||||
@@ -1099,9 +1095,9 @@ TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Uint,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopyDst);
|
||||
|
||||
// Failure when formats don't match
|
||||
TestT2TCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
|
||||
@@ -1110,11 +1106,11 @@ TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, MultisampledCopies) {
|
||||
dawn::Texture sourceMultiSampled1x = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::TransferSrc, 1);
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopySrc, 1);
|
||||
dawn::Texture sourceMultiSampled4x = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::TransferSrc, 4);
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopySrc, 4);
|
||||
dawn::Texture destinationMultiSampled4x = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::TransferDst, 4);
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopyDst, 4);
|
||||
|
||||
// Success when entire multisampled subresource is copied
|
||||
{
|
||||
@@ -1138,10 +1134,9 @@ TEST_F(CopyCommandTest_T2T, MultisampledCopies) {
|
||||
TEST_F(CopyCommandTest_T2T, CopyToMipmapOfNonSquareTexture) {
|
||||
uint32_t maxMipmapLevel = 3;
|
||||
dawn::Texture source = Create2DTexture(4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureUsageBit::CopySrc);
|
||||
dawn::Texture destination = Create2DTexture(
|
||||
4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopyDst);
|
||||
// Copy to top level mip map
|
||||
TestT2TCopy(utils::Expectation::Success, source, maxMipmapLevel - 1, 0, {0, 0, 0}, destination,
|
||||
maxMipmapLevel - 1, 0, {0, 0, 0}, {1, 1, 1});
|
||||
@@ -1165,8 +1160,8 @@ class CopyCommandTest_CompressedTextureFormats : public CopyCommandTest {
|
||||
uint32_t mipmapLevels = 1,
|
||||
uint32_t width = kWidth,
|
||||
uint32_t height = kHeight) {
|
||||
constexpr dawn::TextureUsageBit kUsage = dawn::TextureUsageBit::TransferDst |
|
||||
dawn::TextureUsageBit::TransferSrc |
|
||||
constexpr dawn::TextureUsageBit kUsage = dawn::TextureUsageBit::CopyDst |
|
||||
dawn::TextureUsageBit::CopySrc |
|
||||
dawn::TextureUsageBit::Sampled;
|
||||
constexpr uint32_t kArrayLayers = 1;
|
||||
return CopyCommandTest::Create2DTexture(width, height, mipmapLevels, kArrayLayers, format,
|
||||
@@ -1246,7 +1241,7 @@ class CopyCommandTest_CompressedTextureFormats : public CopyCommandTest {
|
||||
// in buffer-to-texture or texture-to-buffer copies with compressed texture formats.
|
||||
TEST_F(CopyCommandTest_CompressedTextureFormats, BufferOffset) {
|
||||
dawn::Buffer buffer =
|
||||
CreateBuffer(512, dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst);
|
||||
CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
for (dawn::TextureFormat bcFormat : kBCFormats) {
|
||||
dawn::Texture texture = Create2DTexture(bcFormat);
|
||||
@@ -1274,7 +1269,7 @@ TEST_F(CopyCommandTest_CompressedTextureFormats, BufferOffset) {
|
||||
// the multiple of compressed texture block width in bytes.
|
||||
TEST_F(CopyCommandTest_CompressedTextureFormats, RowPitch) {
|
||||
dawn::Buffer buffer =
|
||||
CreateBuffer(1024, dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst);
|
||||
CreateBuffer(1024, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
{
|
||||
constexpr uint32_t kTestWidth = 160;
|
||||
@@ -1343,7 +1338,7 @@ TEST_F(CopyCommandTest_CompressedTextureFormats, RowPitch) {
|
||||
// buffer-to-texture or texture-to-buffer copies with compressed texture formats.
|
||||
TEST_F(CopyCommandTest_CompressedTextureFormats, ImageHeight) {
|
||||
dawn::Buffer buffer =
|
||||
CreateBuffer(512, dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst);
|
||||
CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
for (dawn::TextureFormat bcFormat : kBCFormats) {
|
||||
dawn::Texture texture = Create2DTexture(bcFormat);
|
||||
@@ -1369,7 +1364,7 @@ TEST_F(CopyCommandTest_CompressedTextureFormats, ImageHeight) {
|
||||
// texture-to-buffer or texture-to-texture copies with compressed texture formats.
|
||||
TEST_F(CopyCommandTest_CompressedTextureFormats, ImageOffset) {
|
||||
dawn::Buffer buffer =
|
||||
CreateBuffer(512, dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst);
|
||||
CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
for (dawn::TextureFormat bcFormat : kBCFormats) {
|
||||
dawn::Texture texture = Create2DTexture(bcFormat);
|
||||
@@ -1412,7 +1407,7 @@ TEST_F(CopyCommandTest_CompressedTextureFormats, ImageOffset) {
|
||||
// texture-to-buffer or texture-to-texture copies with compressed texture formats.
|
||||
TEST_F(CopyCommandTest_CompressedTextureFormats, ImageExtent) {
|
||||
dawn::Buffer buffer =
|
||||
CreateBuffer(512, dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst);
|
||||
CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
|
||||
|
||||
constexpr uint32_t kMipmapLevels = 3;
|
||||
constexpr uint32_t kTestWidth = 60;
|
||||
|
||||
@@ -32,12 +32,12 @@ static void StoreTrueMapWriteCallback(DawnBufferMapAsyncStatus status,
|
||||
TEST_F(QueueSubmitValidationTest, SubmitWithMappedBuffer) {
|
||||
// Create a map-write buffer.
|
||||
dawn::BufferDescriptor descriptor;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc;
|
||||
descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
|
||||
descriptor.size = 4;
|
||||
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
// Create a fake copy destination buffer
|
||||
descriptor.usage = dawn::BufferUsageBit::TransferDst;
|
||||
descriptor.usage = dawn::BufferUsageBit::CopyDst;
|
||||
dawn::Buffer targetBuffer = device.CreateBuffer(&descriptor);
|
||||
|
||||
// Create a command buffer that reads from the mappable buffer.
|
||||
|
||||
@@ -491,7 +491,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetMipmapLevelM
|
||||
// include dawn::TextureUsageBit::OutputAttachment.
|
||||
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetUsageNoOutputAttachment) {
|
||||
constexpr dawn::TextureUsageBit kUsage =
|
||||
dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc;
|
||||
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc;
|
||||
dawn::Texture nonColorUsageResolveTexture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
|
||||
kLevelCount, 1, kUsage);
|
||||
|
||||
@@ -243,7 +243,7 @@ class CompressedTextureFormatsValidationTests : public TextureValidationTest {
|
||||
dawn::TextureDescriptor CreateDefaultTextureDescriptor() {
|
||||
dawn::TextureDescriptor descriptor =
|
||||
TextureValidationTest::CreateDefaultTextureDescriptor();
|
||||
descriptor.usage = dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst |
|
||||
descriptor.usage = dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst |
|
||||
dawn::TextureUsageBit::Sampled;
|
||||
return descriptor;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ TEST_F(CompressedTextureFormatsValidationTests, TextureSize) {
|
||||
|
||||
// Test the validation of texture usages when creating textures in compressed texture formats.
|
||||
TEST_F(CompressedTextureFormatsValidationTests, TextureUsage) {
|
||||
// Test that only TransferSrc, TransferDst and Sampled are accepted as the texture usage of the
|
||||
// Test that only CopySrc, CopyDst and Sampled are accepted as the texture usage of the
|
||||
// textures in BC formats.
|
||||
for (dawn::TextureFormat format : kBCFormats) {
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user