diff --git a/dawn.json b/dawn.json index e1639a0c78..44f1e7d451 100644 --- a/dawn.json +++ b/dawn.json @@ -202,8 +202,8 @@ {"value": 0, "name": "none"}, {"value": 1, "name": "map read"}, {"value": 2, "name": "map write"}, - {"value": 4, "name": "transfer src"}, - {"value": 8, "name": "transfer dst"}, + {"value": 4, "name": "copy src"}, + {"value": 8, "name": "copy dst"}, {"value": 16, "name": "index"}, {"value": 32, "name": "vertex"}, {"value": 64, "name": "uniform"}, @@ -1118,8 +1118,8 @@ "category": "bitmask", "values": [ {"value": 0, "name": "none"}, - {"value": 1, "name": "transfer src"}, - {"value": 2, "name": "transfer dst"}, + {"value": 1, "name": "copy src"}, + {"value": 2, "name": "copy dst"}, {"value": 4, "name": "sampled"}, {"value": 8, "name": "storage"}, {"value": 16, "name": "output attachment"}, diff --git a/examples/Animometer.cpp b/examples/Animometer.cpp index abec0a8429..da685520a6 100644 --- a/examples/Animometer.cpp +++ b/examples/Animometer.cpp @@ -133,7 +133,7 @@ void init() { dawn::BufferDescriptor bufferDesc; bufferDesc.size = kNumTriangles * sizeof(ShaderData); - bufferDesc.usage = dawn::BufferUsageBit::TransferDst | dawn::BufferUsageBit::Uniform; + bufferDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Uniform; ubo = device.CreateBuffer(&bufferDesc); bindGroup = diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp index dfabcecdaa..80b2dc1435 100644 --- a/examples/ComputeBoids.cpp +++ b/examples/ComputeBoids.cpp @@ -83,7 +83,8 @@ void initBuffers() { for (size_t i = 0; i < 2; i++) { dawn::BufferDescriptor descriptor; descriptor.size = sizeof(Particle) * kNumParticles; - descriptor.usage = dawn::BufferUsageBit::TransferDst | dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Storage; + descriptor.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Vertex | + dawn::BufferUsageBit::Storage; particleBuffers[i] = device.CreateBuffer(&descriptor); particleBuffers[i].SetSubData(0, diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp index dc8f24226b..39a6d93967 100644 --- a/examples/CppHelloTriangle.cpp +++ b/examples/CppHelloTriangle.cpp @@ -58,7 +58,7 @@ void initTextures() { descriptor.sampleCount = 1; descriptor.format = dawn::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1; - descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled; + descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled; texture = device.CreateTexture(&descriptor); dawn::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor(); @@ -70,7 +70,8 @@ void initTextures() { data[i] = static_cast(i % 253); } - dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), static_cast(data.size()), dawn::BufferUsageBit::TransferSrc); + dawn::Buffer stagingBuffer = utils::CreateBufferFromData( + device, data.data(), static_cast(data.size()), dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0); dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0}); dawn::Extent3D copySize = {1024, 1024, 1}; diff --git a/examples/CubeReflection.cpp b/examples/CubeReflection.cpp index 51bab675d4..2d2d7233ed 100644 --- a/examples/CubeReflection.cpp +++ b/examples/CubeReflection.cpp @@ -176,7 +176,7 @@ void init() { dawn::BufferDescriptor cameraBufDesc; cameraBufDesc.size = sizeof(CameraData); - cameraBufDesc.usage = dawn::BufferUsageBit::TransferDst | dawn::BufferUsageBit::Uniform; + cameraBufDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Uniform; cameraBuffer = device.CreateBuffer(&cameraBufDesc); glm::mat4 transform(1.0); diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp index dd568f5aa8..4930e28a60 100644 --- a/src/dawn_native/Buffer.cpp +++ b/src/dawn_native/Buffer.cpp @@ -91,15 +91,15 @@ namespace dawn_native { dawn::BufferUsageBit usage = descriptor->usage; const dawn::BufferUsageBit kMapWriteAllowedUsages = - dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc; + dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc; if (usage & dawn::BufferUsageBit::MapWrite && (usage & kMapWriteAllowedUsages) != usage) { - return DAWN_VALIDATION_ERROR("Only TransferSrc is allowed with MapWrite"); + return DAWN_VALIDATION_ERROR("Only CopySrc is allowed with MapWrite"); } const dawn::BufferUsageBit kMapReadAllowedUsages = - dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst; + dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst; if (usage & dawn::BufferUsageBit::MapRead && (usage & kMapReadAllowedUsages) != usage) { - return DAWN_VALIDATION_ERROR("Only TransferDst is allowed with MapRead"); + return DAWN_VALIDATION_ERROR("Only CopyDst is allowed with MapRead"); } return {}; @@ -374,8 +374,8 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR("Buffer subdata out of range"); } - if (!(mUsage & dawn::BufferUsageBit::TransferDst)) { - return DAWN_VALIDATION_ERROR("Buffer needs the transfer dst usage bit"); + if (!(mUsage & dawn::BufferUsageBit::CopyDst)) { + return DAWN_VALIDATION_ERROR("Buffer needs the CopyDst usage bit"); } return {}; diff --git a/src/dawn_native/Buffer.h b/src/dawn_native/Buffer.h index 0e2ceb2fd4..52ea2c3bca 100644 --- a/src/dawn_native/Buffer.h +++ b/src/dawn_native/Buffer.h @@ -26,12 +26,12 @@ namespace dawn_native { MaybeError ValidateBufferDescriptor(DeviceBase* device, const BufferDescriptor* descriptor); static constexpr dawn::BufferUsageBit kReadOnlyBufferUsages = - dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferSrc | + dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::Index | dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Uniform; - static constexpr dawn::BufferUsageBit kWritableBufferUsages = - dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferDst | - dawn::BufferUsageBit::Storage; + static constexpr dawn::BufferUsageBit kWritableBufferUsages = dawn::BufferUsageBit::MapWrite | + dawn::BufferUsageBit::CopyDst | + dawn::BufferUsageBit::Storage; class BufferBase : public ObjectBase { enum class BufferState { diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp index b8bc34ca68..4a66f2310c 100644 --- a/src/dawn_native/CommandEncoder.cpp +++ b/src/dawn_native/CommandEncoder.cpp @@ -931,10 +931,9 @@ namespace dawn_native { DAWN_TRY(ValidateB2BCopySizeAlignment(copy->size, copy->sourceOffset, copy->destinationOffset)); + DAWN_TRY(ValidateCanUseAs(copy->source.Get(), dawn::BufferUsageBit::CopySrc)); DAWN_TRY( - ValidateCanUseAs(copy->source.Get(), dawn::BufferUsageBit::TransferSrc)); - DAWN_TRY(ValidateCanUseAs(copy->destination.Get(), - dawn::BufferUsageBit::TransferDst)); + ValidateCanUseAs(copy->destination.Get(), dawn::BufferUsageBit::CopyDst)); mResourceUsages.topLevelBuffers.insert(copy->source.Get()); mResourceUsages.topLevelBuffers.insert(copy->destination.Get()); @@ -966,10 +965,10 @@ namespace dawn_native { DAWN_TRY(ValidateTexelBufferOffset(copy->source, copy->destination.texture->GetFormat())); - DAWN_TRY(ValidateCanUseAs(copy->source.buffer.Get(), - dawn::BufferUsageBit::TransferSrc)); + DAWN_TRY( + ValidateCanUseAs(copy->source.buffer.Get(), dawn::BufferUsageBit::CopySrc)); DAWN_TRY(ValidateCanUseAs(copy->destination.texture.Get(), - dawn::TextureUsageBit::TransferDst)); + dawn::TextureUsageBit::CopyDst)); mResourceUsages.topLevelBuffers.insert(copy->source.buffer.Get()); mResourceUsages.topLevelTextures.insert(copy->destination.texture.Get()); @@ -1002,9 +1001,9 @@ namespace dawn_native { copy->source.texture->GetFormat())); DAWN_TRY(ValidateCanUseAs(copy->source.texture.Get(), - dawn::TextureUsageBit::TransferSrc)); + dawn::TextureUsageBit::CopySrc)); DAWN_TRY(ValidateCanUseAs(copy->destination.buffer.Get(), - dawn::BufferUsageBit::TransferDst)); + dawn::BufferUsageBit::CopyDst)); mResourceUsages.topLevelTextures.insert(copy->source.texture.Get()); mResourceUsages.topLevelBuffers.insert(copy->destination.buffer.Get()); @@ -1030,9 +1029,9 @@ namespace dawn_native { DAWN_TRY(ValidateCopySizeFitsInTexture(copy->destination, copy->copySize)); DAWN_TRY(ValidateCanUseAs(copy->source.texture.Get(), - dawn::TextureUsageBit::TransferSrc)); + dawn::TextureUsageBit::CopySrc)); DAWN_TRY(ValidateCanUseAs(copy->destination.texture.Get(), - dawn::TextureUsageBit::TransferDst)); + dawn::TextureUsageBit::CopyDst)); mResourceUsages.topLevelTextures.insert(copy->source.texture.Get()); mResourceUsages.topLevelTextures.insert(copy->destination.texture.Get()); diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp index e1b9adad25..f38c341882 100644 --- a/src/dawn_native/Texture.cpp +++ b/src/dawn_native/Texture.cpp @@ -309,8 +309,8 @@ namespace dawn_native { DAWN_TRY(ValidateTextureUsageBit(descriptor->usage)); if (format.isCompressed) { constexpr dawn::TextureUsageBit kValidUsage = dawn::TextureUsageBit::Sampled | - dawn::TextureUsageBit::TransferSrc | - dawn::TextureUsageBit::TransferDst; + dawn::TextureUsageBit::CopySrc | + dawn::TextureUsageBit::CopyDst; if (descriptor->usage & (~kValidUsage)) { return DAWN_VALIDATION_ERROR( "Compressed texture format is incompatible with the texture usage"); diff --git a/src/dawn_native/Texture.h b/src/dawn_native/Texture.h index 640fee50f2..02cefe3ee5 100644 --- a/src/dawn_native/Texture.h +++ b/src/dawn_native/Texture.h @@ -31,12 +31,12 @@ namespace dawn_native { bool IsValidSampleCount(uint32_t sampleCount); - static constexpr dawn::TextureUsageBit kReadOnlyTextureUsages = - dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::Sampled | - dawn::TextureUsageBit::Present; + static constexpr dawn::TextureUsageBit kReadOnlyTextureUsages = dawn::TextureUsageBit::CopySrc | + dawn::TextureUsageBit::Sampled | + dawn::TextureUsageBit::Present; static constexpr dawn::TextureUsageBit kWritableTextureUsages = - dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Storage | + dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Storage | dawn::TextureUsageBit::OutputAttachment; struct Format { diff --git a/src/dawn_native/d3d12/BufferD3D12.cpp b/src/dawn_native/d3d12/BufferD3D12.cpp index bfc7e7e36a..45c423d133 100644 --- a/src/dawn_native/d3d12/BufferD3D12.cpp +++ b/src/dawn_native/d3d12/BufferD3D12.cpp @@ -36,10 +36,10 @@ namespace dawn_native { namespace d3d12 { D3D12_RESOURCE_STATES D3D12BufferUsage(dawn::BufferUsageBit usage) { D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON; - if (usage & dawn::BufferUsageBit::TransferSrc) { + if (usage & dawn::BufferUsageBit::CopySrc) { resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE; } - if (usage & dawn::BufferUsageBit::TransferDst) { + if (usage & dawn::BufferUsageBit::CopyDst) { resourceState |= D3D12_RESOURCE_STATE_COPY_DEST; } if (usage & (dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Uniform)) { @@ -82,10 +82,9 @@ namespace dawn_native { namespace d3d12 { resourceDescriptor.SampleDesc.Count = 1; resourceDescriptor.SampleDesc.Quality = 0; resourceDescriptor.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; - // Add TransferDst for non-mappable buffer initialization in CreateBufferMapped + // Add CopyDst for non-mappable buffer initialization in CreateBufferMapped // and robust resource initialization. - resourceDescriptor.Flags = - D3D12ResourceFlags(GetUsage() | dawn::BufferUsageBit::TransferDst); + resourceDescriptor.Flags = D3D12ResourceFlags(GetUsage() | dawn::BufferUsageBit::CopyDst); auto heapType = D3D12HeapType(GetUsage()); auto bufferUsage = D3D12_RESOURCE_STATE_COMMON; @@ -95,7 +94,7 @@ namespace dawn_native { namespace d3d12 { if (heapType == D3D12_HEAP_TYPE_READBACK) { bufferUsage |= D3D12_RESOURCE_STATE_COPY_DEST; mFixedResourceState = true; - mLastUsage = dawn::BufferUsageBit::TransferDst; + mLastUsage = dawn::BufferUsageBit::CopyDst; } // D3D12 requires buffers on the UPLOAD heap to have the D3D12_RESOURCE_STATE_GENERIC_READ @@ -103,7 +102,7 @@ namespace dawn_native { namespace d3d12 { if (heapType == D3D12_HEAP_TYPE_UPLOAD) { bufferUsage |= D3D12_RESOURCE_STATE_GENERIC_READ; mFixedResourceState = true; - mLastUsage = dawn::BufferUsageBit::TransferSrc; + mLastUsage = dawn::BufferUsageBit::CopySrc; } mResource = diff --git a/src/dawn_native/d3d12/CommandBufferD3D12.cpp b/src/dawn_native/d3d12/CommandBufferD3D12.cpp index 75f927d24d..bb7bf51743 100644 --- a/src/dawn_native/d3d12/CommandBufferD3D12.cpp +++ b/src/dawn_native/d3d12/CommandBufferD3D12.cpp @@ -495,8 +495,8 @@ namespace dawn_native { namespace d3d12 { Buffer* srcBuffer = ToBackend(copy->source.Get()); Buffer* dstBuffer = ToBackend(copy->destination.Get()); - srcBuffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferSrc); - dstBuffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferDst); + srcBuffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopySrc); + dstBuffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopyDst); commandList->CopyBufferRegion( dstBuffer->GetD3D12Resource().Get(), copy->destinationOffset, @@ -518,8 +518,8 @@ namespace dawn_native { namespace d3d12 { copy->destination.arrayLayer, 1); } - buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferSrc); - texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::TransferDst); + buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopySrc); + texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopyDst); auto copySplit = ComputeTextureCopySplit( copy->destination.origin, copy->copySize, texture->GetFormat(), @@ -564,8 +564,8 @@ namespace dawn_native { namespace d3d12 { texture->EnsureSubresourceContentInitialized(commandList, copy->source.mipLevel, 1, copy->source.arrayLayer, 1); - texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::TransferSrc); - buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferDst); + texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopySrc); + buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopyDst); auto copySplit = ComputeTextureCopySplit( copy->source.origin, copy->copySize, texture->GetFormat(), @@ -622,9 +622,8 @@ namespace dawn_native { namespace d3d12 { commandList, copy->destination.mipLevel, 1, copy->destination.arrayLayer, 1); } - source->TransitionUsageNow(commandList, dawn::TextureUsageBit::TransferSrc); - destination->TransitionUsageNow(commandList, - dawn::TextureUsageBit::TransferDst); + source->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopySrc); + destination->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopyDst); if (CanUseCopyResource(source->GetNumMipLevels(), source->GetSize(), destination->GetSize(), copy->copySize)) { diff --git a/src/dawn_native/d3d12/DeviceD3D12.cpp b/src/dawn_native/d3d12/DeviceD3D12.cpp index fa4a69a0a9..64c8e70f7e 100644 --- a/src/dawn_native/d3d12/DeviceD3D12.cpp +++ b/src/dawn_native/d3d12/DeviceD3D12.cpp @@ -312,7 +312,7 @@ namespace dawn_native { namespace d3d12 { uint64_t destinationOffset, uint64_t size) { ToBackend(destination) - ->TransitionUsageNow(GetPendingCommandList(), dawn::BufferUsageBit::TransferDst); + ->TransitionUsageNow(GetPendingCommandList(), dawn::BufferUsageBit::CopyDst); GetPendingCommandList()->CopyBufferRegion( ToBackend(destination)->GetD3D12Resource().Get(), destinationOffset, diff --git a/src/dawn_native/d3d12/TextureD3D12.cpp b/src/dawn_native/d3d12/TextureD3D12.cpp index da03dba6d6..7cddda5a55 100644 --- a/src/dawn_native/d3d12/TextureD3D12.cpp +++ b/src/dawn_native/d3d12/TextureD3D12.cpp @@ -29,10 +29,10 @@ namespace dawn_native { namespace d3d12 { return D3D12_RESOURCE_STATE_PRESENT; } - if (usage & dawn::TextureUsageBit::TransferSrc) { + if (usage & dawn::TextureUsageBit::CopySrc) { resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE; } - if (usage & dawn::TextureUsageBit::TransferDst) { + if (usage & dawn::TextureUsageBit::CopyDst) { resourceState |= D3D12_RESOURCE_STATE_COPY_DEST; } if (usage & dawn::TextureUsageBit::Sampled) { diff --git a/src/dawn_native/vulkan/BufferVk.cpp b/src/dawn_native/vulkan/BufferVk.cpp index 4ead2a99e4..968cb19ddd 100644 --- a/src/dawn_native/vulkan/BufferVk.cpp +++ b/src/dawn_native/vulkan/BufferVk.cpp @@ -26,10 +26,10 @@ namespace dawn_native { namespace vulkan { VkBufferUsageFlags VulkanBufferUsage(dawn::BufferUsageBit usage) { VkBufferUsageFlags flags = 0; - if (usage & dawn::BufferUsageBit::TransferSrc) { + if (usage & dawn::BufferUsageBit::CopySrc) { flags |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; } - if (usage & dawn::BufferUsageBit::TransferDst) { + if (usage & dawn::BufferUsageBit::CopyDst) { flags |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; } if (usage & dawn::BufferUsageBit::Index) { @@ -57,7 +57,7 @@ namespace dawn_native { namespace vulkan { if (usage & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) { flags |= VK_PIPELINE_STAGE_HOST_BIT; } - if (usage & (dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst)) { + if (usage & (dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst)) { flags |= VK_PIPELINE_STAGE_TRANSFER_BIT; } if (usage & (dawn::BufferUsageBit::Index | dawn::BufferUsageBit::Vertex)) { @@ -84,10 +84,10 @@ namespace dawn_native { namespace vulkan { if (usage & dawn::BufferUsageBit::MapWrite) { flags |= VK_ACCESS_HOST_WRITE_BIT; } - if (usage & dawn::BufferUsageBit::TransferSrc) { + if (usage & dawn::BufferUsageBit::CopySrc) { flags |= VK_ACCESS_TRANSFER_READ_BIT; } - if (usage & dawn::BufferUsageBit::TransferDst) { + if (usage & dawn::BufferUsageBit::CopyDst) { flags |= VK_ACCESS_TRANSFER_WRITE_BIT; } if (usage & dawn::BufferUsageBit::Index) { @@ -118,9 +118,9 @@ namespace dawn_native { namespace vulkan { createInfo.pNext = nullptr; createInfo.flags = 0; createInfo.size = GetSize(); - // Add TransferDst for non-mappable buffer initialization in CreateBufferMapped + // Add CopyDst for non-mappable buffer initialization in CreateBufferMapped // and robust resource initialization. - createInfo.usage = VulkanBufferUsage(GetUsage() | dawn::BufferUsageBit::TransferDst); + createInfo.usage = VulkanBufferUsage(GetUsage() | dawn::BufferUsageBit::CopyDst); createInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; createInfo.queueFamilyIndexCount = 0; createInfo.pQueueFamilyIndices = 0; diff --git a/src/dawn_native/vulkan/CommandBufferVk.cpp b/src/dawn_native/vulkan/CommandBufferVk.cpp index 1ad5280835..62aaa145a6 100644 --- a/src/dawn_native/vulkan/CommandBufferVk.cpp +++ b/src/dawn_native/vulkan/CommandBufferVk.cpp @@ -366,8 +366,8 @@ namespace dawn_native { namespace vulkan { Buffer* srcBuffer = ToBackend(copy->source.Get()); Buffer* dstBuffer = ToBackend(copy->destination.Get()); - srcBuffer->TransitionUsageNow(commands, dawn::BufferUsageBit::TransferSrc); - dstBuffer->TransitionUsageNow(commands, dawn::BufferUsageBit::TransferDst); + srcBuffer->TransitionUsageNow(commands, dawn::BufferUsageBit::CopySrc); + dstBuffer->TransitionUsageNow(commands, dawn::BufferUsageBit::CopyDst); VkBufferCopy region; region.srcOffset = copy->sourceOffset; @@ -399,9 +399,9 @@ namespace dawn_native { namespace vulkan { subresource.baseArrayLayer, 1); } ToBackend(src.buffer) - ->TransitionUsageNow(commands, dawn::BufferUsageBit::TransferSrc); + ->TransitionUsageNow(commands, dawn::BufferUsageBit::CopySrc); ToBackend(dst.texture) - ->TransitionUsageNow(commands, dawn::TextureUsageBit::TransferDst); + ->TransitionUsageNow(commands, dawn::TextureUsageBit::CopyDst); VkBuffer srcBuffer = ToBackend(src.buffer)->GetHandle(); VkImage dstImage = ToBackend(dst.texture)->GetHandle(); @@ -426,13 +426,13 @@ namespace dawn_native { namespace vulkan { subresource.baseArrayLayer, 1); ToBackend(src.texture) - ->TransitionUsageNow(commands, dawn::TextureUsageBit::TransferSrc); + ->TransitionUsageNow(commands, dawn::TextureUsageBit::CopySrc); ToBackend(dst.buffer) - ->TransitionUsageNow(commands, dawn::BufferUsageBit::TransferDst); + ->TransitionUsageNow(commands, dawn::BufferUsageBit::CopyDst); VkImage srcImage = ToBackend(src.texture)->GetHandle(); VkBuffer dstBuffer = ToBackend(dst.buffer)->GetHandle(); - // The Dawn TransferSrc usage is always mapped to GENERAL + // The Dawn CopySrc usage is always mapped to GENERAL device->fn.CmdCopyImageToBuffer(commands, srcImage, VK_IMAGE_LAYOUT_GENERAL, dstBuffer, 1, ®ion); } break; @@ -462,9 +462,9 @@ namespace dawn_native { namespace vulkan { 1); } ToBackend(src.texture) - ->TransitionUsageNow(commands, dawn::TextureUsageBit::TransferSrc); + ->TransitionUsageNow(commands, dawn::TextureUsageBit::CopySrc); ToBackend(dst.texture) - ->TransitionUsageNow(commands, dawn::TextureUsageBit::TransferDst); + ->TransitionUsageNow(commands, dawn::TextureUsageBit::CopyDst); VkImage srcImage = ToBackend(src.texture)->GetHandle(); VkImage dstImage = ToBackend(dst.texture)->GetHandle(); diff --git a/src/dawn_native/vulkan/DeviceVk.cpp b/src/dawn_native/vulkan/DeviceVk.cpp index dc4707f5d2..70edabc4d2 100644 --- a/src/dawn_native/vulkan/DeviceVk.cpp +++ b/src/dawn_native/vulkan/DeviceVk.cpp @@ -525,7 +525,7 @@ namespace dawn_native { namespace vulkan { // Insert pipeline barrier to ensure correct ordering with previous memory operations on the // buffer. ToBackend(destination) - ->TransitionUsageNow(GetPendingCommandBuffer(), dawn::BufferUsageBit::TransferDst); + ->TransitionUsageNow(GetPendingCommandBuffer(), dawn::BufferUsageBit::CopyDst); VkBufferCopy copy; copy.srcOffset = sourceOffset; diff --git a/src/dawn_native/vulkan/TextureVk.cpp b/src/dawn_native/vulkan/TextureVk.cpp index 16c79946d0..0f92b1c1b5 100644 --- a/src/dawn_native/vulkan/TextureVk.cpp +++ b/src/dawn_native/vulkan/TextureVk.cpp @@ -54,10 +54,10 @@ namespace dawn_native { namespace vulkan { VkAccessFlags VulkanAccessFlags(dawn::TextureUsageBit usage, const Format& format) { VkAccessFlags flags = 0; - if (usage & dawn::TextureUsageBit::TransferSrc) { + if (usage & dawn::TextureUsageBit::CopySrc) { flags |= VK_ACCESS_TRANSFER_READ_BIT; } - if (usage & dawn::TextureUsageBit::TransferDst) { + if (usage & dawn::TextureUsageBit::CopyDst) { flags |= VK_ACCESS_TRANSFER_WRITE_BIT; } if (usage & dawn::TextureUsageBit::Sampled) { @@ -99,16 +99,16 @@ namespace dawn_native { namespace vulkan { // Usage has a single bit so we can switch on its value directly. switch (usage) { - case dawn::TextureUsageBit::TransferDst: + case dawn::TextureUsageBit::CopyDst: return VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; case dawn::TextureUsageBit::Sampled: return VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; // Vulkan texture copy functions require the image to be in _one_ known layout. // Depending on whether parts of the texture have been transitioned to only - // TransferSrc or a combination with something else, the texture could be in a + // CopySrc or a combination with something else, the texture could be in a // combination of GENERAL and TRANSFER_SRC_OPTIMAL. This would be a problem, so we - // make TransferSrc use GENERAL. - case dawn::TextureUsageBit::TransferSrc: + // make CopySrc use GENERAL. + case dawn::TextureUsageBit::CopySrc: // Writable storage textures must use general. If we could know the texture is read // only we could use SHADER_READ_ONLY_OPTIMAL case dawn::TextureUsageBit::Storage: @@ -136,7 +136,7 @@ namespace dawn_native { namespace vulkan { // which case there is no need to wait on anything to stop accessing this texture. return VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; } - if (usage & (dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst)) { + if (usage & (dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst)) { flags |= VK_PIPELINE_STAGE_TRANSFER_BIT; } if (usage & (dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::Storage)) { @@ -344,10 +344,10 @@ namespace dawn_native { namespace vulkan { VkImageUsageFlags VulkanImageUsage(dawn::TextureUsageBit usage, const Format& format) { VkImageUsageFlags flags = 0; - if (usage & dawn::TextureUsageBit::TransferSrc) { + if (usage & dawn::TextureUsageBit::CopySrc) { flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; } - if (usage & dawn::TextureUsageBit::TransferDst) { + if (usage & dawn::TextureUsageBit::CopyDst) { flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT; } if (usage & dawn::TextureUsageBit::Sampled) { @@ -437,7 +437,7 @@ namespace dawn_native { namespace vulkan { range.baseArrayLayer = 0; range.layerCount = GetArrayLayers(); TransitionUsageNow(ToBackend(GetDevice())->GetPendingCommandBuffer(), - dawn::TextureUsageBit::TransferDst); + dawn::TextureUsageBit::CopyDst); if (GetFormat().HasDepthOrStencil()) { VkClearDepthStencilValue clear_color[1]; @@ -543,7 +543,7 @@ namespace dawn_native { namespace vulkan { range.baseArrayLayer = baseArrayLayer; range.layerCount = layerCount; - TransitionUsageNow(commands, dawn::TextureUsageBit::TransferDst); + TransitionUsageNow(commands, dawn::TextureUsageBit::CopyDst); if (GetFormat().HasDepthOrStencil()) { VkClearDepthStencilValue clear_color[1]; clear_color[0].depth = 0.0f; diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index c82b756553..ab5d0dda27 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -564,7 +564,7 @@ DawnTest::ReadbackReservation DawnTest::ReserveReadback(uint64_t readbackSize) { // TODO(cwallez@chromium.org): eventually make bigger buffers and allocate linearly? dawn::BufferDescriptor descriptor; descriptor.size = readbackSize; - descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst; + descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst; ReadbackSlot slot; slot.bufferSize = readbackSize; diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index a45fb40be1..4ba32c71b4 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h @@ -23,7 +23,7 @@ // Getting data back from Dawn is done in an async manners so all expectations are "deferred" // until the end of the test. Also expectations use a copy to a MapRead buffer to get the data -// so resources should have the TransferSrc allowed usage bit if you want to add expectations on +// so resources should have the CopySrc allowed usage bit if you want to add expectations on // them. #define EXPECT_BUFFER_U32_EQ(expected, buffer, offset) \ AddBufferExpectation(__FILE__, __LINE__, buffer, offset, sizeof(uint32_t), \ diff --git a/src/tests/end2end/BasicTests.cpp b/src/tests/end2end/BasicTests.cpp index 1b650db4dd..f269c38e31 100644 --- a/src/tests/end2end/BasicTests.cpp +++ b/src/tests/end2end/BasicTests.cpp @@ -24,7 +24,7 @@ class BasicTests : public DawnTest { TEST_P(BasicTests, BufferSetSubData) { dawn::BufferDescriptor descriptor; descriptor.size = 4; - descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst; + descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&descriptor); uint32_t value = 0x01020304; @@ -38,7 +38,7 @@ TEST_P(BasicTests, BufferSetSubData) { TEST_P(BasicTests, BufferSetSubDataError) { dawn::BufferDescriptor descriptor; descriptor.size = 4; - descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst; + descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&descriptor); uint8_t value = 187; diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp index 26ad297d4f..632d6d8e76 100644 --- a/src/tests/end2end/BindGroupTests.cpp +++ b/src/tests/end2end/BindGroupTests.cpp @@ -79,8 +79,7 @@ TEST_P(BindGroupTests, ReusedBindGroupSingleSubmit) { dawn::BufferDescriptor bufferDesc; bufferDesc.size = sizeof(float); - bufferDesc.usage = dawn::BufferUsageBit::TransferDst | - dawn::BufferUsageBit::Uniform; + bufferDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Uniform; dawn::Buffer buffer = device.CreateBuffer(&bufferDesc); dawn::BindGroup bindGroup = utils::MakeBindGroup(device, bgl, {{0, buffer, 0, sizeof(float)}}); @@ -249,7 +248,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { descriptor.sampleCount = 1; descriptor.format = dawn::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1; - descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled; + descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled; dawn::Texture texture = device.CreateTexture(&descriptor); dawn::TextureView textureView = texture.CreateDefaultView(); @@ -262,7 +261,8 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) { for (int i = 0; i < size; i++) { data[i] = RGBA8(0, 255, 0, 255); } - dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), sizeInBytes, dawn::BufferUsageBit::TransferSrc); + dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), sizeInBytes, + dawn::BufferUsageBit::CopySrc); dawn::BindGroup bindGroup = utils::MakeBindGroup(device, bgl, { {0, buffer, 0, sizeof(transform)}, diff --git a/src/tests/end2end/BufferTests.cpp b/src/tests/end2end/BufferTests.cpp index 3161decbd7..ed6e407a58 100644 --- a/src/tests/end2end/BufferTests.cpp +++ b/src/tests/end2end/BufferTests.cpp @@ -46,7 +46,7 @@ class BufferMapReadTests : public DawnTest { TEST_P(BufferMapReadTests, SmallReadAtZero) { dawn::BufferDescriptor descriptor; descriptor.size = 4; - descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst; + descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&descriptor); uint32_t myData = 0x01020304; @@ -68,7 +68,7 @@ TEST_P(BufferMapReadTests, LargeRead) { dawn::BufferDescriptor descriptor; descriptor.size = static_cast(kDataSize * sizeof(uint32_t)); - descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst; + descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&descriptor); buffer.SetSubData(0, kDataSize * sizeof(uint32_t), myData.data()); @@ -111,7 +111,7 @@ class BufferMapWriteTests : public DawnTest { TEST_P(BufferMapWriteTests, SmallWriteAtZero) { dawn::BufferDescriptor descriptor; descriptor.size = 4; - descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc; + descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc; dawn::Buffer buffer = device.CreateBuffer(&descriptor); uint32_t myData = 2934875; @@ -132,7 +132,7 @@ TEST_P(BufferMapWriteTests, LargeWrite) { dawn::BufferDescriptor descriptor; descriptor.size = static_cast(kDataSize * sizeof(uint32_t)); - descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc; + descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc; dawn::Buffer buffer = device.CreateBuffer(&descriptor); void* mappedData = MapWriteAsyncAndWait(buffer); @@ -151,7 +151,7 @@ class BufferSetSubDataTests : public DawnTest { TEST_P(BufferSetSubDataTests, SmallDataAtZero) { dawn::BufferDescriptor descriptor; descriptor.size = 4; - descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst; + descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&descriptor); uint32_t value = 0x01020304; @@ -164,7 +164,7 @@ TEST_P(BufferSetSubDataTests, SmallDataAtZero) { TEST_P(BufferSetSubDataTests, SmallDataAtOffset) { dawn::BufferDescriptor descriptor; descriptor.size = 4000; - descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst; + descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&descriptor); constexpr uint64_t kOffset = 2000; @@ -194,7 +194,7 @@ TEST_P(BufferSetSubDataTests, ManySetSubData) { constexpr uint32_t kElements = 500 * 500; dawn::BufferDescriptor descriptor; descriptor.size = kSize; - descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst; + descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&descriptor); std::vector expectedData; @@ -212,7 +212,7 @@ TEST_P(BufferSetSubDataTests, LargeSetSubData) { constexpr uint32_t kElements = 1000 * 1000; dawn::BufferDescriptor descriptor; descriptor.size = kSize; - descriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst; + descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&descriptor); std::vector expectedData; @@ -335,7 +335,7 @@ class CreateBufferMappedTests : public DawnTest { TEST_P(CreateBufferMappedTests, MapWriteUsageSmall) { uint32_t myData = 230502; dawn::CreateBufferMappedResult result = CreateBufferMappedWithData( - dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc, {myData}); + dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData}); result.buffer.Unmap(); EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0); } @@ -356,7 +356,7 @@ TEST_P(CreateBufferMappedTests, MapReadUsageSmall) { TEST_P(CreateBufferMappedTests, NonMappableUsageSmall) { uint32_t myData = 4239; dawn::CreateBufferMappedResult result = - CreateBufferMappedWithData(dawn::BufferUsageBit::TransferSrc, {myData}); + CreateBufferMappedWithData(dawn::BufferUsageBit::CopySrc, {myData}); result.buffer.Unmap(); EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0); @@ -371,7 +371,7 @@ TEST_P(CreateBufferMappedTests, MapWriteUsageLarge) { } dawn::CreateBufferMappedResult result = CreateBufferMappedWithData( - dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc, {myData}); + dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData}); result.buffer.Unmap(); EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize); @@ -403,7 +403,7 @@ TEST_P(CreateBufferMappedTests, NonMappableUsageLarge) { } dawn::CreateBufferMappedResult result = - CreateBufferMappedWithData(dawn::BufferUsageBit::TransferSrc, {myData}); + CreateBufferMappedWithData(dawn::BufferUsageBit::CopySrc, {myData}); result.buffer.Unmap(); EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize); @@ -414,7 +414,7 @@ TEST_P(CreateBufferMappedTests, CreateThenMapSuccess) { static uint32_t myData = 230502; static uint32_t myData2 = 1337; dawn::CreateBufferMappedResult result = CreateBufferMappedWithData( - dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc, {myData}); + dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData}); result.buffer.Unmap(); EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0); @@ -442,7 +442,7 @@ TEST_P(CreateBufferMappedTests, CreateThenMapSuccess) { TEST_P(CreateBufferMappedTests, CreateThenMapBeforeUnmapFailure) { uint32_t myData = 230502; dawn::CreateBufferMappedResult result = CreateBufferMappedWithData( - dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc, {myData}); + dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData}); ASSERT_DEVICE_ERROR([&]() { bool done = false; @@ -469,7 +469,7 @@ TEST_P(CreateBufferMappedTests, CreateThenMapBeforeUnmapFailure) { TEST_P(CreateBufferMappedTests, MapWriteUsageSmallAsync) { uint32_t myData = 230502; dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait( - dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc, {myData}); + dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData}); result.buffer.Unmap(); EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0); } @@ -490,7 +490,7 @@ TEST_P(CreateBufferMappedTests, MapReadUsageSmallAsync) { TEST_P(CreateBufferMappedTests, NonMappableUsageSmallAsync) { uint32_t myData = 4239; dawn::CreateBufferMappedResult result = - CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::TransferSrc, {myData}); + CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::CopySrc, {myData}); result.buffer.Unmap(); EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0); @@ -505,7 +505,7 @@ TEST_P(CreateBufferMappedTests, MapWriteUsageLargeAsync) { } dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait( - dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc, {myData}); + dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData}); result.buffer.Unmap(); EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize); @@ -537,7 +537,7 @@ TEST_P(CreateBufferMappedTests, NonMappableUsageLargeAsync) { } dawn::CreateBufferMappedResult result = - CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::TransferSrc, {myData}); + CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::CopySrc, {myData}); result.buffer.Unmap(); EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize); @@ -548,7 +548,7 @@ TEST_P(CreateBufferMappedTests, CreateThenMapSuccessAsync) { static uint32_t myData = 230502; static uint32_t myData2 = 1337; dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait( - dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc, {myData}); + dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData}); result.buffer.Unmap(); EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0); @@ -576,7 +576,7 @@ TEST_P(CreateBufferMappedTests, CreateThenMapSuccessAsync) { TEST_P(CreateBufferMappedTests, CreateThenMapBeforeUnmapFailureAsync) { uint32_t myData = 230502; dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait( - dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc, {myData}); + dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData}); ASSERT_DEVICE_ERROR([&]() { bool done = false; diff --git a/src/tests/end2end/ClipSpaceTests.cpp b/src/tests/end2end/ClipSpaceTests.cpp index 5b635689f3..c5fc25c256 100644 --- a/src/tests/end2end/ClipSpaceTests.cpp +++ b/src/tests/end2end/ClipSpaceTests.cpp @@ -59,7 +59,7 @@ class ClipSpaceTest : public DawnTest { textureDescriptor.dimension = dawn::TextureDimension::e2D; textureDescriptor.format = format; textureDescriptor.usage = - dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; textureDescriptor.arrayLayerCount = 1; textureDescriptor.mipLevelCount = 1; textureDescriptor.sampleCount = 1; diff --git a/src/tests/end2end/ColorStateTests.cpp b/src/tests/end2end/ColorStateTests.cpp index 0e6ee82752..9f3a0492e1 100644 --- a/src/tests/end2end/ColorStateTests.cpp +++ b/src/tests/end2end/ColorStateTests.cpp @@ -762,7 +762,7 @@ TEST_P(ColorStateTest, IndependentColorState) { descriptor.sampleCount = 1; descriptor.format = dawn::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1; - descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; for (uint32_t i = 0; i < 4; ++i) { renderTargets[i] = device.CreateTexture(&descriptor); diff --git a/src/tests/end2end/CompressedTextureFormatTests.cpp b/src/tests/end2end/CompressedTextureFormatTests.cpp index ffad0ab703..704af0ffdf 100644 --- a/src/tests/end2end/CompressedTextureFormatTests.cpp +++ b/src/tests/end2end/CompressedTextureFormatTests.cpp @@ -28,7 +28,7 @@ dawn::Texture Create2DTexture(dawn::Device device, uint32_t arrayLayerCount = 1, uint32_t mipLevelCount = 1, dawn::TextureUsageBit usage = dawn::TextureUsageBit::Sampled | - dawn::TextureUsageBit::TransferDst) { + dawn::TextureUsageBit::CopyDst) { dawn::TextureDescriptor descriptor; descriptor.dimension = dawn::TextureDimension::e2D; descriptor.format = format; @@ -101,7 +101,7 @@ class CompressedTextureBCFormatTest : public DawnTest { // Copy texture data from a staging buffer to the destination texture. dawn::Buffer stagingBuffer = utils::CreateBufferFromData( - device, uploadData.data(), uploadBufferSize, dawn::BufferUsageBit::TransferSrc); + device, uploadData.data(), uploadBufferSize, dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView( stagingBuffer, copyConfig.bufferOffset, copyConfig.rowPitchAlignment, 0); dawn::TextureCopyView textureCopyView = @@ -449,7 +449,7 @@ TEST_P(CompressedTextureBCFormatTest, CopyWholeTextureSubResourceIntoNonZeroMipm dawn::Texture bcTextureSrc = Create2DTexture( device, config.format, config.textureWidthLevel0, config.textureHeightLevel0, config.arrayLayerCount, config.mipmapLevelCount, - dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst); + dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst); CopyDataIntoCompressedTexture(bcTextureSrc, config); // Create bcTexture and copy from the content in bcTextureSrc into it. @@ -521,7 +521,7 @@ TEST_P(CompressedTextureBCFormatTest, CopyPartofTextureSubResourceIntoNonZeroMip dawn::Texture bcTextureSrc = Create2DTexture( device, srcConfig.format, srcConfig.textureWidthLevel0, srcConfig.textureHeightLevel0, srcConfig.arrayLayerCount, srcConfig.mipmapLevelCount, - dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst); + dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst); CopyDataIntoCompressedTexture(bcTextureSrc, srcConfig); dawn::TextureCopyView textureCopyViewSrc = utils::CreateTextureCopyView(bcTextureSrc, srcConfig.baseMipmapLevel, diff --git a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp index 84d2c9a6b0..4ad799ed0b 100644 --- a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp +++ b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp @@ -51,8 +51,8 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) { // Set up src storage buffer dawn::BufferDescriptor srcDesc; srcDesc.size = kNumUints * sizeof(uint32_t); - srcDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::TransferSrc | - dawn::BufferUsageBit::TransferDst; + srcDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc | + dawn::BufferUsageBit::CopyDst; dawn::Buffer src = device.CreateBuffer(&srcDesc); std::array expected; @@ -65,8 +65,8 @@ void ComputeCopyStorageBufferTests::BasicTest(const char* shader) { // Set up dst storage buffer dawn::BufferDescriptor dstDesc; dstDesc.size = kNumUints * sizeof(uint32_t); - dstDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::TransferSrc | - dawn::BufferUsageBit::TransferDst; + dstDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc | + dawn::BufferUsageBit::CopyDst; dawn::Buffer dst = device.CreateBuffer(&dstDesc); std::array zero{}; diff --git a/src/tests/end2end/ComputeIndirectTests.cpp b/src/tests/end2end/ComputeIndirectTests.cpp index 085bca34d0..e6092d9bba 100644 --- a/src/tests/end2end/ComputeIndirectTests.cpp +++ b/src/tests/end2end/ComputeIndirectTests.cpp @@ -69,8 +69,8 @@ void ComputeIndirectTests::BasicTest(std::initializer_list bufferList, // Set up dst storage buffer to contain dispatch x, y, z dawn::Buffer dst = utils::CreateBufferFromData(device, dawn::BufferUsageBit::Storage | - dawn::BufferUsageBit::TransferSrc | - dawn::BufferUsageBit::TransferDst, + dawn::BufferUsageBit::CopySrc | + dawn::BufferUsageBit::CopyDst, {0, 0, 0}); std::vector indirectBufferData = bufferList; diff --git a/src/tests/end2end/ComputeSharedMemoryTests.cpp b/src/tests/end2end/ComputeSharedMemoryTests.cpp index 96f9d759ee..7531971abf 100644 --- a/src/tests/end2end/ComputeSharedMemoryTests.cpp +++ b/src/tests/end2end/ComputeSharedMemoryTests.cpp @@ -48,8 +48,8 @@ void ComputeSharedMemoryTests::BasicTest(const char* shader) { // Set up dst storage buffer dawn::BufferDescriptor dstDesc; dstDesc.size = sizeof(uint32_t); - dstDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::TransferSrc | - dawn::BufferUsageBit::TransferDst; + dstDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc | + dawn::BufferUsageBit::CopyDst; dawn::Buffer dst = device.CreateBuffer(&dstDesc); const uint32_t zero = 0; diff --git a/src/tests/end2end/CopyTests.cpp b/src/tests/end2end/CopyTests.cpp index 527a4126bd..f6df0ff418 100644 --- a/src/tests/end2end/CopyTests.cpp +++ b/src/tests/end2end/CopyTests.cpp @@ -85,7 +85,7 @@ class CopyTests_T2B : public CopyTests { descriptor.sampleCount = 1; descriptor.format = dawn::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = textureSpec.level + 1; - descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc; + descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc; dawn::Texture texture = device.CreateTexture(&descriptor); uint32_t width = textureSpec.width >> textureSpec.level; @@ -103,8 +103,10 @@ class CopyTests_T2B : public CopyTests { textureArrayData[slice].data()); // Create an upload buffer and use it to populate the current slice of the texture in `level` mip level - dawn::Buffer uploadBuffer = utils::CreateBufferFromData(device, textureArrayData[slice].data(), - static_cast(sizeof(RGBA8) * textureArrayData[slice].size()), dawn::BufferUsageBit::TransferSrc); + dawn::Buffer uploadBuffer = utils::CreateBufferFromData( + device, textureArrayData[slice].data(), + static_cast(sizeof(RGBA8) * textureArrayData[slice].size()), + dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0); dawn::TextureCopyView textureCopyView = @@ -118,7 +120,7 @@ class CopyTests_T2B : public CopyTests { // and helps ensure that the padding due to the row pitch is not modified by the copy dawn::BufferDescriptor bufDescriptor; bufDescriptor.size = bufferSpec.size * textureSpec.arraySize; - bufDescriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst; + bufDescriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&bufDescriptor); std::vector emptyData(bufferSpec.size / kBytesPerTexel * textureSpec.arraySize); buffer.SetSubData(0, static_cast(emptyData.size() * sizeof(RGBA8)), @@ -180,7 +182,7 @@ protected: // Create a buffer of size `size` and populate it with data dawn::BufferDescriptor bufDescriptor; bufDescriptor.size = bufferSpec.size; - bufDescriptor.usage = dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst; + bufDescriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&bufDescriptor); std::vector bufferData(bufferSpec.size / kBytesPerTexel); @@ -198,7 +200,7 @@ protected: descriptor.sampleCount = 1; descriptor.format = dawn::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = textureSpec.level + 1; - descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc; + descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc; dawn::Texture texture = device.CreateTexture(&descriptor); dawn::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -214,7 +216,9 @@ protected: uint32_t texelCount = texelsPerRow * (height - 1) + width; std::vector emptyData(texelCount); - dawn::Buffer uploadBuffer = utils::CreateBufferFromData(device, emptyData.data(), static_cast(sizeof(RGBA8) * emptyData.size()), dawn::BufferUsageBit::TransferSrc); + dawn::Buffer uploadBuffer = utils::CreateBufferFromData( + device, emptyData.data(), static_cast(sizeof(RGBA8) * emptyData.size()), + dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0); dawn::TextureCopyView textureCopyView = @@ -277,8 +281,7 @@ class CopyTests_T2T : public CopyTests { srcDescriptor.sampleCount = 1; srcDescriptor.format = dawn::TextureFormat::RGBA8Unorm; srcDescriptor.mipLevelCount = srcSpec.level + 1; - srcDescriptor.usage = - dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst; + srcDescriptor.usage = dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst; dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor); dawn::TextureDescriptor dstDescriptor; @@ -290,8 +293,7 @@ class CopyTests_T2T : public CopyTests { dstDescriptor.sampleCount = 1; dstDescriptor.format = dawn::TextureFormat::RGBA8Unorm; dstDescriptor.mipLevelCount = dstSpec.level + 1; - dstDescriptor.usage = - dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst; + dstDescriptor.usage = dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst; dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor); dawn::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -313,7 +315,7 @@ class CopyTests_T2T : public CopyTests { dawn::Buffer uploadBuffer = utils::CreateBufferFromData( device, textureArrayData[slice].data(), static_cast(sizeof(RGBA8) * textureArrayData[slice].size()), - dawn::BufferUsageBit::TransferSrc); + dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0); dawn::TextureCopyView textureCopyView = @@ -337,7 +339,7 @@ class CopyTests_T2T : public CopyTests { std::vector emptyData(dstTexelCount); dawn::Buffer uploadBuffer = utils::CreateBufferFromData( device, emptyData.data(), static_cast(sizeof(RGBA8) * emptyData.size()), - dawn::BufferUsageBit::TransferSrc); + dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(uploadBuffer, 0, dstRowPitch, 0); dawn::TextureCopyView textureCopyView = diff --git a/src/tests/end2end/CullingTests.cpp b/src/tests/end2end/CullingTests.cpp index a9fc6aca94..9015df68ad 100644 --- a/src/tests/end2end/CullingTests.cpp +++ b/src/tests/end2end/CullingTests.cpp @@ -60,7 +60,7 @@ class CullingTest : public DawnTest { textureDescriptor.dimension = dawn::TextureDimension::e2D; textureDescriptor.format = format; textureDescriptor.usage = - dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; textureDescriptor.arrayLayerCount = 1; textureDescriptor.mipLevelCount = 1; textureDescriptor.sampleCount = 1; diff --git a/src/tests/end2end/DepthStencilStateTests.cpp b/src/tests/end2end/DepthStencilStateTests.cpp index eac1b6e4f2..98bb1e0262 100644 --- a/src/tests/end2end/DepthStencilStateTests.cpp +++ b/src/tests/end2end/DepthStencilStateTests.cpp @@ -34,7 +34,8 @@ class DepthStencilStateTest : public DawnTest { renderTargetDescriptor.sampleCount = 1; renderTargetDescriptor.format = dawn::TextureFormat::RGBA8Unorm; renderTargetDescriptor.mipLevelCount = 1; - renderTargetDescriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + renderTargetDescriptor.usage = + dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; renderTarget = device.CreateTexture(&renderTargetDescriptor); renderTargetView = renderTarget.CreateDefaultView(); diff --git a/src/tests/end2end/DynamicBufferOffsetTests.cpp b/src/tests/end2end/DynamicBufferOffsetTests.cpp index 879a5fe35d..d880a74bae 100644 --- a/src/tests/end2end/DynamicBufferOffsetTests.cpp +++ b/src/tests/end2end/DynamicBufferOffsetTests.cpp @@ -40,8 +40,8 @@ class DynamicBufferOffsetTests : public DawnTest { dawn::BufferDescriptor storageBufferDescriptor; storageBufferDescriptor.size = kBufferSize; storageBufferDescriptor.usage = dawn::BufferUsageBit::Storage | - dawn::BufferUsageBit::TransferDst | - dawn::BufferUsageBit::TransferSrc; + dawn::BufferUsageBit::CopyDst | + dawn::BufferUsageBit::CopySrc; mStorageBuffer = device.CreateBuffer(&storageBufferDescriptor); diff --git a/src/tests/end2end/MultisampledRenderingTests.cpp b/src/tests/end2end/MultisampledRenderingTests.cpp index b2f0c35d44..00721be2d4 100644 --- a/src/tests/end2end/MultisampledRenderingTests.cpp +++ b/src/tests/end2end/MultisampledRenderingTests.cpp @@ -95,8 +95,7 @@ class MultisampledRenderingTest : public DawnTest { descriptor.sampleCount = sampleCount; descriptor.format = format; descriptor.mipLevelCount = mipLevelCount; - descriptor.usage = - dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; return device.CreateTexture(&descriptor); } diff --git a/src/tests/end2end/NonzeroTextureCreationTests.cpp b/src/tests/end2end/NonzeroTextureCreationTests.cpp index e448cd6866..00f26c3c32 100644 --- a/src/tests/end2end/NonzeroTextureCreationTests.cpp +++ b/src/tests/end2end/NonzeroTextureCreationTests.cpp @@ -37,7 +37,7 @@ TEST_P(NonzeroTextureCreationTests, TextureCreationClearsOneBits) { descriptor.sampleCount = 1; descriptor.format = dawn::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1; - descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; dawn::Texture texture = device.CreateTexture(&descriptor); RGBA8 filledWithOnes(255, 255, 255, 255); @@ -57,7 +57,7 @@ TEST_P(NonzeroTextureCreationTests, MipMapClears) { descriptor.sampleCount = 1; descriptor.format = dawn::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = mipLevels; - descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; dawn::Texture texture = device.CreateTexture(&descriptor); std::vector expected; @@ -82,7 +82,7 @@ TEST_P(NonzeroTextureCreationTests, ArrayLayerClears) { descriptor.sampleCount = 1; descriptor.format = dawn::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1; - descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; dawn::Texture texture = device.CreateTexture(&descriptor); std::vector expected; diff --git a/src/tests/end2end/RenderPassLoadOpTests.cpp b/src/tests/end2end/RenderPassLoadOpTests.cpp index 80fdc21ff5..7fbc26f278 100644 --- a/src/tests/end2end/RenderPassLoadOpTests.cpp +++ b/src/tests/end2end/RenderPassLoadOpTests.cpp @@ -66,7 +66,8 @@ class RenderPassLoadOpTests : public DawnTest { descriptor.sampleCount = 1; descriptor.format = dawn::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1; - descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + descriptor.usage = + dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; renderTarget = device.CreateTexture(&descriptor); renderTargetView = renderTarget.CreateDefaultView(); diff --git a/src/tests/end2end/RenderPassTests.cpp b/src/tests/end2end/RenderPassTests.cpp index f04f74664c..476763289e 100644 --- a/src/tests/end2end/RenderPassTests.cpp +++ b/src/tests/end2end/RenderPassTests.cpp @@ -62,8 +62,7 @@ protected: descriptor.sampleCount = 1; descriptor.format = kFormat; descriptor.mipLevelCount = 1; - descriptor.usage = - dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; return device.CreateTexture(&descriptor); } diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp index 92ebd9d285..ee67ed7e45 100644 --- a/src/tests/end2end/SamplerTests.cpp +++ b/src/tests/end2end/SamplerTests.cpp @@ -90,7 +90,7 @@ protected: descriptor.sampleCount = 1; descriptor.format = dawn::TextureFormat::RGBA8Unorm; descriptor.mipLevelCount = 1; - descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled; + descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled; dawn::Texture texture = device.CreateTexture(&descriptor); // Create a 2x2 checkerboard texture, with black in the top left and bottom right corners. @@ -101,7 +101,8 @@ protected: data[0] = data[rowPixels + 1] = black; data[1] = data[rowPixels] = white; - dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data, sizeof(data), dawn::BufferUsageBit::TransferSrc); + dawn::Buffer stagingBuffer = + utils::CreateBufferFromData(device, data, sizeof(data), dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 256, 0); dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0}); diff --git a/src/tests/end2end/TextureFormatTests.cpp b/src/tests/end2end/TextureFormatTests.cpp index fc1950db5c..d1ef7ffe34 100644 --- a/src/tests/end2end/TextureFormatTests.cpp +++ b/src/tests/end2end/TextureFormatTests.cpp @@ -210,7 +210,7 @@ class TextureFormatTest : public DawnTest { // Create the texture we will sample from dawn::TextureDescriptor textureDesc; - textureDesc.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled; + textureDesc.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled; textureDesc.dimension = dawn::TextureDimension::e2D; textureDesc.size = {width, 1, 1}; textureDesc.arrayLayerCount = 1; @@ -221,12 +221,12 @@ class TextureFormatTest : public DawnTest { dawn::Texture texture = device.CreateTexture(&textureDesc); dawn::Buffer uploadBuffer = utils::CreateBufferFromData( - device, textureData, textureDataSize, dawn::BufferUsageBit::TransferSrc); + device, textureData, textureDataSize, dawn::BufferUsageBit::CopySrc); // Create the texture that we will render results to dawn::TextureDescriptor renderTargetDesc; renderTargetDesc.usage = - dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::OutputAttachment; + dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::OutputAttachment; renderTargetDesc.dimension = dawn::TextureDimension::e2D; renderTargetDesc.size = {width, 1, 1}; renderTargetDesc.arrayLayerCount = 1; @@ -238,8 +238,7 @@ class TextureFormatTest : public DawnTest { // Create the readback buffer for the data in renderTarget dawn::BufferDescriptor readbackBufferDesc; - readbackBufferDesc.usage = - dawn::BufferUsageBit::TransferDst | dawn::BufferUsageBit::TransferSrc; + readbackBufferDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::CopySrc; readbackBufferDesc.size = 4 * width * formatInfo.componentCount; dawn::Buffer readbackBuffer = device.CreateBuffer(&readbackBufferDesc); diff --git a/src/tests/end2end/TextureViewTests.cpp b/src/tests/end2end/TextureViewTests.cpp index 845e6afaae..329d0930a7 100644 --- a/src/tests/end2end/TextureViewTests.cpp +++ b/src/tests/end2end/TextureViewTests.cpp @@ -115,7 +115,7 @@ protected: const uint32_t textureWidthLevel0 = 1 << mipLevelCount; const uint32_t textureHeightLevel0 = 1 << mipLevelCount; constexpr dawn::TextureUsageBit kUsage = - dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled; + dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled; mTexture = Create2DTexture( device, textureWidthLevel0, textureHeightLevel0, arrayLayerCount, mipLevelCount, kUsage); @@ -143,9 +143,9 @@ protected: constexpr uint32_t kPaddedTexWidth = kPixelsPerRowPitch; std::vector data(kPaddedTexWidth * texHeight, RGBA8(0, 0, 0, pixelValue)); - dawn::Buffer stagingBuffer = utils::CreateBufferFromData( - device, data.data(), data.size() * sizeof(RGBA8), - dawn::BufferUsageBit::TransferSrc); + dawn::Buffer stagingBuffer = + utils::CreateBufferFromData(device, data.data(), data.size() * sizeof(RGBA8), + dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, kTextureRowPitchAlignment, 0); dawn::TextureCopyView textureCopyView = @@ -474,8 +474,8 @@ class TextureViewRenderingTest : public DawnTest { const uint32_t textureWidthLevel0 = 1 << levelCount; const uint32_t textureHeightLevel0 = 1 << levelCount; - constexpr dawn::TextureUsageBit kUsage = dawn::TextureUsageBit::OutputAttachment | - dawn::TextureUsageBit::TransferSrc; + constexpr dawn::TextureUsageBit kUsage = + dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; dawn::Texture texture = Create2DTexture( device, textureWidthLevel0, textureHeightLevel0, layerCount, levelCount, kUsage); diff --git a/src/tests/end2end/TextureZeroInitTests.cpp b/src/tests/end2end/TextureZeroInitTests.cpp index 81ede5d6ed..af556bc25e 100644 --- a/src/tests/end2end/TextureZeroInitTests.cpp +++ b/src/tests/end2end/TextureZeroInitTests.cpp @@ -91,7 +91,7 @@ class TextureZeroInitTest : public DawnTest { // This tests that the code path of CopyTextureToBuffer clears correctly to Zero after first usage TEST_P(TextureZeroInitTest, CopyTextureToBufferSource) { dawn::TextureDescriptor descriptor = CreateTextureDescriptor( - 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc, + 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc, kColorFormat); dawn::Texture texture = device.CreateTexture(&descriptor); @@ -104,7 +104,7 @@ TEST_P(TextureZeroInitTest, CopyTextureToBufferSource) { // This goes through the BeginRenderPass's code path TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) { dawn::TextureDescriptor descriptor = CreateTextureDescriptor( - 4, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc, + 4, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc, kColorFormat); dawn::Texture texture = device.CreateTexture(&descriptor); @@ -133,7 +133,7 @@ TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) { // This goes through the BeginRenderPass's code path TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) { dawn::TextureDescriptor descriptor = CreateTextureDescriptor( - 1, 4, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc, + 1, 4, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc, kColorFormat); dawn::Texture texture = device.CreateTexture(&descriptor); @@ -160,16 +160,16 @@ TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) { // TODO(natlee@microsoft.com): Add backdoor to dawn native to query the number of zero-inited // subresources TEST_P(TextureZeroInitTest, CopyBufferToTexture) { - dawn::TextureDescriptor descriptor = CreateTextureDescriptor( - 4, 1, - dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled | - dawn::TextureUsageBit::TransferSrc, - kColorFormat); + dawn::TextureDescriptor descriptor = + CreateTextureDescriptor(4, 1, + dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled | + dawn::TextureUsageBit::CopySrc, + kColorFormat); dawn::Texture texture = device.CreateTexture(&descriptor); std::vector data(4 * kSize * kSize, 100); dawn::Buffer stagingBuffer = utils::CreateBufferFromData( - device, data.data(), static_cast(data.size()), dawn::BufferUsageBit::TransferSrc); + device, data.data(), static_cast(data.size()), dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0); dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0}); @@ -188,16 +188,16 @@ TEST_P(TextureZeroInitTest, CopyBufferToTexture) { // Test for a copy only to a subset of the subresource, lazy init is necessary to clear the other // half. TEST_P(TextureZeroInitTest, CopyBufferToTextureHalf) { - dawn::TextureDescriptor descriptor = CreateTextureDescriptor( - 4, 1, - dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled | - dawn::TextureUsageBit::TransferSrc, - kColorFormat); + dawn::TextureDescriptor descriptor = + CreateTextureDescriptor(4, 1, + dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled | + dawn::TextureUsageBit::CopySrc, + kColorFormat); dawn::Texture texture = device.CreateTexture(&descriptor); std::vector data(4 * kSize * kSize, 100); dawn::Buffer stagingBuffer = utils::CreateBufferFromData( - device, data.data(), static_cast(data.size()), dawn::BufferUsageBit::TransferSrc); + device, data.data(), static_cast(data.size()), dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0); dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0}); @@ -219,17 +219,17 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureHalf) { // This tests CopyTextureToTexture fully overwrites copy so lazy init is not needed. TEST_P(TextureZeroInitTest, CopyTextureToTexture) { dawn::TextureDescriptor srcDescriptor = CreateTextureDescriptor( - 1, 1, dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::TransferSrc, kColorFormat); + 1, 1, dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::CopySrc, kColorFormat); dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor); dawn::TextureCopyView srcTextureCopyView = utils::CreateTextureCopyView(srcTexture, 0, 0, {0, 0, 0}); - dawn::TextureDescriptor dstDescriptor = CreateTextureDescriptor( - 1, 1, - dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferDst | - dawn::TextureUsageBit::TransferSrc, - kColorFormat); + dawn::TextureDescriptor dstDescriptor = + CreateTextureDescriptor(1, 1, + dawn::TextureUsageBit::OutputAttachment | + dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc, + kColorFormat); dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor); dawn::TextureCopyView dstTextureCopyView = @@ -251,19 +251,18 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) { // This Tests the CopyTextureToTexture's copy only to a subset of the subresource, lazy init is // necessary to clear the other half. TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) { - dawn::TextureDescriptor srcDescriptor = CreateTextureDescriptor( - 1, 1, - dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::TransferSrc | - dawn::TextureUsageBit::TransferDst, - kColorFormat); + dawn::TextureDescriptor srcDescriptor = + CreateTextureDescriptor(1, 1, + dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::CopySrc | + dawn::TextureUsageBit::CopyDst, + kColorFormat); dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor); // fill srcTexture with 100 { std::vector data(4 * kSize * kSize, 100); - dawn::Buffer stagingBuffer = - utils::CreateBufferFromData(device, data.data(), static_cast(data.size()), - dawn::BufferUsageBit::TransferSrc); + dawn::Buffer stagingBuffer = utils::CreateBufferFromData( + device, data.data(), static_cast(data.size()), dawn::BufferUsageBit::CopySrc); dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0); dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(srcTexture, 0, 0, {0, 0, 0}); @@ -277,11 +276,11 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) { dawn::TextureCopyView srcTextureCopyView = utils::CreateTextureCopyView(srcTexture, 0, 0, {0, 0, 0}); - dawn::TextureDescriptor dstDescriptor = CreateTextureDescriptor( - 1, 1, - dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferDst | - dawn::TextureUsageBit::TransferSrc, - kColorFormat); + dawn::TextureDescriptor dstDescriptor = + CreateTextureDescriptor(1, 1, + dawn::TextureUsageBit::OutputAttachment | + dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc, + kColorFormat); dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor); dawn::TextureCopyView dstTextureCopyView = @@ -305,15 +304,15 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) { // This tests the texture with depth attachment and load op load will init depth stencil texture to // 0s. TEST_P(TextureZeroInitTest, RenderingLoadingDepth) { - dawn::TextureDescriptor srcDescriptor = CreateTextureDescriptor( - 1, 1, - dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst | - dawn::TextureUsageBit::OutputAttachment, - kColorFormat); + dawn::TextureDescriptor srcDescriptor = + CreateTextureDescriptor(1, 1, + dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst | + dawn::TextureUsageBit::OutputAttachment, + kColorFormat); dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor); dawn::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor( - 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc, + 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc, kDepthStencilFormat); dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor); @@ -339,15 +338,15 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepth) { // This tests the texture with stencil attachment and load op load will init depth stencil texture // to 0s. TEST_P(TextureZeroInitTest, RenderingLoadingStencil) { - dawn::TextureDescriptor srcDescriptor = CreateTextureDescriptor( - 1, 1, - dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst | - dawn::TextureUsageBit::OutputAttachment, - kColorFormat); + dawn::TextureDescriptor srcDescriptor = + CreateTextureDescriptor(1, 1, + dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst | + dawn::TextureUsageBit::OutputAttachment, + kColorFormat); dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor); dawn::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor( - 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc, + 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc, kDepthStencilFormat); dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor); @@ -373,15 +372,15 @@ TEST_P(TextureZeroInitTest, RenderingLoadingStencil) { // This tests the texture with depth stencil attachment and load op load will init depth stencil // texture to 0s. TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) { - dawn::TextureDescriptor srcDescriptor = CreateTextureDescriptor( - 1, 1, - dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst | - dawn::TextureUsageBit::OutputAttachment, - kColorFormat); + dawn::TextureDescriptor srcDescriptor = + CreateTextureDescriptor(1, 1, + dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst | + dawn::TextureUsageBit::OutputAttachment, + kColorFormat); dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor); dawn::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor( - 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc, + 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc, kDepthStencilFormat); dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor); @@ -406,7 +405,7 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) { // This tests the color attachments clear to 0s TEST_P(TextureZeroInitTest, ColorAttachmentsClear) { dawn::TextureDescriptor descriptor = CreateTextureDescriptor( - 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc, + 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc, kColorFormat); dawn::Texture texture = device.CreateTexture(&descriptor); utils::BasicRenderPass renderPass = utils::BasicRenderPass(kSize, kSize, texture, kColorFormat); diff --git a/src/tests/unittests/validation/BufferValidationTests.cpp b/src/tests/unittests/validation/BufferValidationTests.cpp index 53694d78b4..8331af3ce8 100644 --- a/src/tests/unittests/validation/BufferValidationTests.cpp +++ b/src/tests/unittests/validation/BufferValidationTests.cpp @@ -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); diff --git a/src/tests/unittests/validation/CommandBufferValidationTests.cpp b/src/tests/unittests/validation/CommandBufferValidationTests.cpp index 407986c83f..9fe2863023 100644 --- a/src/tests/unittests/validation/CommandBufferValidationTests.cpp +++ b/src/tests/unittests/validation/CommandBufferValidationTests.cpp @@ -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 diff --git a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp index 71f3d4eaaa..b2ca88e41e 100644 --- a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp +++ b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp @@ -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; diff --git a/src/tests/unittests/validation/QueueSubmitValidationTests.cpp b/src/tests/unittests/validation/QueueSubmitValidationTests.cpp index ccaa107ff4..5c10a5dd19 100644 --- a/src/tests/unittests/validation/QueueSubmitValidationTests.cpp +++ b/src/tests/unittests/validation/QueueSubmitValidationTests.cpp @@ -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. diff --git a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp index 1bb85fa19b..ec06fe3b25 100644 --- a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp +++ b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp @@ -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); diff --git a/src/tests/unittests/validation/TextureValidationTests.cpp b/src/tests/unittests/validation/TextureValidationTests.cpp index b1570ee6b2..1ed72dfa23 100644 --- a/src/tests/unittests/validation/TextureValidationTests.cpp +++ b/src/tests/unittests/validation/TextureValidationTests.cpp @@ -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) { { diff --git a/src/tests/unittests/wire/WireArgumentTests.cpp b/src/tests/unittests/wire/WireArgumentTests.cpp index d0194d7103..a054a364c9 100644 --- a/src/tests/unittests/wire/WireArgumentTests.cpp +++ b/src/tests/unittests/wire/WireArgumentTests.cpp @@ -208,8 +208,8 @@ TEST_F(WireArgumentTests, ObjectAsValueArgument) { DawnBufferDescriptor descriptor; descriptor.nextInChain = nullptr; descriptor.size = 8; - descriptor.usage = static_cast(DAWN_BUFFER_USAGE_BIT_TRANSFER_SRC | - DAWN_BUFFER_USAGE_BIT_TRANSFER_DST); + descriptor.usage = static_cast(DAWN_BUFFER_USAGE_BIT_COPY_SRC | + DAWN_BUFFER_USAGE_BIT_COPY_DST); DawnBuffer buffer = dawnDeviceCreateBuffer(device, &descriptor); DawnBuffer apiBuffer = api.GetNewBuffer(); diff --git a/src/utils/DawnHelpers.cpp b/src/utils/DawnHelpers.cpp index f955057e08..ee48127c17 100644 --- a/src/utils/DawnHelpers.cpp +++ b/src/utils/DawnHelpers.cpp @@ -119,7 +119,7 @@ namespace utils { dawn::BufferUsageBit usage) { dawn::BufferDescriptor descriptor; descriptor.size = size; - descriptor.usage = usage | dawn::BufferUsageBit::TransferDst; + descriptor.usage = usage | dawn::BufferUsageBit::CopyDst; dawn::Buffer buffer = device.CreateBuffer(&descriptor); buffer.SetSubData(0, size, data); @@ -224,8 +224,7 @@ namespace utils { descriptor.sampleCount = 1; descriptor.format = BasicRenderPass::kDefaultColorFormat; descriptor.mipLevelCount = 1; - descriptor.usage = - dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc; + descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc; dawn::Texture color = device.CreateTexture(&descriptor); return BasicRenderPass(width, height, color);