Rename Transfer[Src|Dst] to Copy[Src|Dst]

This is to match the equivalent rename in WebGPU's IDL.

BUG=dawn:22

Change-Id: Ibdf75869e58835d984df559878b884c55310a403
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8623
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
Corentin Wallez 2019-07-08 10:05:46 +00:00 committed by Commit Bot service account
parent 3c3e2bc4d9
commit ec05355c72
49 changed files with 338 additions and 345 deletions

View File

@ -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"},

View File

@ -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 =

View File

@ -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,

View File

@ -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<uint8_t>(i % 253);
}
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::TransferSrc);
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::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};

View File

@ -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);

View File

@ -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 {};

View File

@ -26,11 +26,11 @@ 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 |
static constexpr dawn::BufferUsageBit kWritableBufferUsages = dawn::BufferUsageBit::MapWrite |
dawn::BufferUsageBit::CopyDst |
dawn::BufferUsageBit::Storage;
class BufferBase : public ObjectBase {

View File

@ -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());

View File

@ -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");

View File

@ -31,12 +31,12 @@ namespace dawn_native {
bool IsValidSampleCount(uint32_t sampleCount);
static constexpr dawn::TextureUsageBit kReadOnlyTextureUsages =
dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::Sampled |
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 {

View File

@ -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 =

View File

@ -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)) {

View File

@ -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,

View File

@ -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) {

View File

@ -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;

View File

@ -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, &region);
} 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();

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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), \

View File

@ -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;

View File

@ -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)},

View File

@ -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<uint32_t>(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<uint32_t>(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<uint32_t> 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<uint32_t> 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;

View File

@ -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;

View File

@ -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);

View File

@ -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,

View File

@ -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<uint32_t, kNumUints> 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<uint32_t, kNumUints> zero{};

View File

@ -69,8 +69,8 @@ void ComputeIndirectTests::BasicTest(std::initializer_list<uint32_t> bufferList,
// Set up dst storage buffer to contain dispatch x, y, z
dawn::Buffer dst = utils::CreateBufferFromData<uint32_t>(device,
dawn::BufferUsageBit::Storage |
dawn::BufferUsageBit::TransferSrc |
dawn::BufferUsageBit::TransferDst,
dawn::BufferUsageBit::CopySrc |
dawn::BufferUsageBit::CopyDst,
{0, 0, 0});
std::vector<uint32_t> indirectBufferData = bufferList;

View File

@ -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;

View File

@ -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<uint32_t>(sizeof(RGBA8) * textureArrayData[slice].size()), dawn::BufferUsageBit::TransferSrc);
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
device, textureArrayData[slice].data(),
static_cast<uint32_t>(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<RGBA8> emptyData(bufferSpec.size / kBytesPerTexel * textureSpec.arraySize);
buffer.SetSubData(0, static_cast<uint32_t>(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<RGBA8> 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<RGBA8> emptyData(texelCount);
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(device, emptyData.data(), static_cast<uint32_t>(sizeof(RGBA8) * emptyData.size()), dawn::BufferUsageBit::TransferSrc);
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
device, emptyData.data(), static_cast<uint32_t>(sizeof(RGBA8) * emptyData.size()),
dawn::BufferUsageBit::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<uint32_t>(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<RGBA8> emptyData(dstTexelCount);
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
device, emptyData.data(), static_cast<uint32_t>(sizeof(RGBA8) * emptyData.size()),
dawn::BufferUsageBit::TransferSrc);
dawn::BufferUsageBit::CopySrc);
dawn::BufferCopyView bufferCopyView =
utils::CreateBufferCopyView(uploadBuffer, 0, dstRowPitch, 0);
dawn::TextureCopyView textureCopyView =

View File

@ -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;

View File

@ -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();

View File

@ -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);

View File

@ -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);
}

View File

@ -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<RGBA8> 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<RGBA8> expected;

View File

@ -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();

View File

@ -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);
}

View File

@ -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});

View File

@ -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);

View File

@ -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<RGBA8> 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);

View File

@ -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,
dawn::TextureDescriptor descriptor =
CreateTextureDescriptor(4, 1,
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled |
dawn::TextureUsageBit::CopySrc,
kColorFormat);
dawn::Texture texture = device.CreateTexture(&descriptor);
std::vector<uint8_t> data(4 * kSize * kSize, 100);
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::TransferSrc);
device, data.data(), static_cast<uint32_t>(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,
dawn::TextureDescriptor descriptor =
CreateTextureDescriptor(4, 1,
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled |
dawn::TextureUsageBit::CopySrc,
kColorFormat);
dawn::Texture texture = device.CreateTexture(&descriptor);
std::vector<uint8_t> data(4 * kSize * kSize, 100);
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::TransferSrc);
device, data.data(), static_cast<uint32_t>(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,16 +219,16 @@ 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,
dawn::TextureDescriptor dstDescriptor =
CreateTextureDescriptor(1, 1,
dawn::TextureUsageBit::OutputAttachment |
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc,
kColorFormat);
dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor);
@ -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,
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<uint8_t> data(4 * kSize * kSize, 100);
dawn::Buffer stagingBuffer =
utils::CreateBufferFromData(device, data.data(), static_cast<uint32_t>(data.size()),
dawn::BufferUsageBit::TransferSrc);
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::CopySrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
dawn::TextureCopyView textureCopyView =
utils::CreateTextureCopyView(srcTexture, 0, 0, {0, 0, 0});
@ -277,10 +276,10 @@ 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,
dawn::TextureDescriptor dstDescriptor =
CreateTextureDescriptor(1, 1,
dawn::TextureUsageBit::OutputAttachment |
dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc,
kColorFormat);
dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor);
@ -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::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::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::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);

View File

@ -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);

View File

@ -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(&copyBufferDesc);
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(&copyBufferDesc);
// A buffer that can't be used in CopyBufferToBuffer

View File

@ -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;

View File

@ -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.

View File

@ -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);

View File

@ -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) {
{

View File

@ -208,8 +208,8 @@ TEST_F(WireArgumentTests, ObjectAsValueArgument) {
DawnBufferDescriptor descriptor;
descriptor.nextInChain = nullptr;
descriptor.size = 8;
descriptor.usage = static_cast<DawnBufferUsageBit>(DAWN_BUFFER_USAGE_BIT_TRANSFER_SRC |
DAWN_BUFFER_USAGE_BIT_TRANSFER_DST);
descriptor.usage = static_cast<DawnBufferUsageBit>(DAWN_BUFFER_USAGE_BIT_COPY_SRC |
DAWN_BUFFER_USAGE_BIT_COPY_DST);
DawnBuffer buffer = dawnDeviceCreateBuffer(device, &descriptor);
DawnBuffer apiBuffer = api.GetNewBuffer();

View File

@ -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);