Remove Bit from TextureUsageBit and BufferUsageBit
This is to match the naming convention of WebGPU's WebIDL and webgpu.h
BUG=dawn:22
Change-Id: Ia91c5a018403e6a72eb0311b5f1a072d102282a2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10461
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/dawn.json b/dawn.json
index b9c823d..8f94bed 100644
--- a/dawn.json
+++ b/dawn.json
@@ -180,7 +180,7 @@
"category": "structure",
"extensible": true,
"members": [
- {"name": "usage", "type": "buffer usage bit"},
+ {"name": "usage", "type": "buffer usage"},
{"name": "size", "type": "uint64_t"}
]
},
@@ -199,7 +199,7 @@
{"value": 3, "name": "context lost"}
]
},
- "buffer usage bit": {
+ "buffer usage": {
"category": "bitmask",
"values": [
{"value": 0, "name": "none"},
@@ -1102,7 +1102,7 @@
"name": "configure",
"args": [
{"name": "format", "type": "texture format"},
- {"name": "allowed usage", "type": "texture usage bit"},
+ {"name": "allowed usage", "type": "texture usage"},
{"name": "width", "type": "uint32_t"},
{"name": "height", "type": "uint32_t"}
]
@@ -1175,7 +1175,7 @@
"category": "structure",
"extensible": true,
"members": [
- {"name": "usage", "type": "texture usage bit"},
+ {"name": "usage", "type": "texture usage"},
{"name": "dimension", "type": "texture dimension", "default": "2D"},
{"name": "size", "type": "extent 3D"},
{"name": "array layer count", "type": "uint32_t", "default": "1"},
@@ -1256,7 +1256,7 @@
{"value": 4294967295, "name": "none", "valid": false}
]
},
- "texture usage bit": {
+ "texture usage": {
"category": "bitmask",
"values": [
{"value": 0, "name": "none"},
diff --git a/examples/Animometer.cpp b/examples/Animometer.cpp
index a9d22ad..bab6535 100644
--- a/examples/Animometer.cpp
+++ b/examples/Animometer.cpp
@@ -52,8 +52,8 @@
queue = device.CreateQueue();
swapchain = GetSwapChain(device);
- swapchain.Configure(GetPreferredSwapChainTextureFormat(),
- dawn::TextureUsageBit::OutputAttachment, 640, 480);
+ swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
+ 640, 480);
dawn::ShaderModule vsModule = utils::CreateShaderModule(device, utils::ShaderStage::Vertex, R"(
#version 450
@@ -134,7 +134,7 @@
dawn::BufferDescriptor bufferDesc;
bufferDesc.size = kNumTriangles * sizeof(ShaderData);
- bufferDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Uniform;
+ bufferDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::Uniform;
ubo = device.CreateBuffer(&bufferDesc);
bindGroup =
diff --git a/examples/CHelloTriangle.cpp b/examples/CHelloTriangle.cpp
index 7df528c..2a0b591 100644
--- a/examples/CHelloTriangle.cpp
+++ b/examples/CHelloTriangle.cpp
@@ -35,8 +35,8 @@
swapchain = dawnDeviceCreateSwapChain(device, &descriptor);
}
swapChainFormat = static_cast<DawnTextureFormat>(GetPreferredSwapChainTextureFormat());
- dawnSwapChainConfigure(swapchain, swapChainFormat, DAWN_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT, 640,
- 480);
+ dawnSwapChainConfigure(swapchain, swapChainFormat, DAWN_TEXTURE_USAGE_OUTPUT_ATTACHMENT, 640,
+ 480);
const char* vs =
"#version 450\n"
diff --git a/examples/ComputeBoids.cpp b/examples/ComputeBoids.cpp
index 26c1fc7..9ec6893 100644
--- a/examples/ComputeBoids.cpp
+++ b/examples/ComputeBoids.cpp
@@ -64,10 +64,12 @@
{0.01, -0.02},
{0.00, 0.02},
};
- modelBuffer = utils::CreateBufferFromData(device, model, sizeof(model), dawn::BufferUsageBit::Vertex);
+ modelBuffer =
+ utils::CreateBufferFromData(device, model, sizeof(model), dawn::BufferUsage::Vertex);
SimParams params = { 0.04f, 0.1f, 0.025f, 0.025f, 0.02f, 0.05f, 0.005f, kNumParticles };
- updateParams = utils::CreateBufferFromData(device, ¶ms, sizeof(params), dawn::BufferUsageBit::Uniform);
+ updateParams =
+ utils::CreateBufferFromData(device, ¶ms, sizeof(params), dawn::BufferUsage::Uniform);
std::vector<Particle> initialParticles(kNumParticles);
{
@@ -83,8 +85,8 @@
for (size_t i = 0; i < 2; i++) {
dawn::BufferDescriptor descriptor;
descriptor.size = sizeof(Particle) * kNumParticles;
- descriptor.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Vertex |
- dawn::BufferUsageBit::Storage;
+ descriptor.usage =
+ dawn::BufferUsage::CopyDst | dawn::BufferUsage::Vertex | dawn::BufferUsage::Storage;
particleBuffers[i] = device.CreateBuffer(&descriptor);
particleBuffers[i].SetSubData(0,
@@ -293,8 +295,8 @@
queue = device.CreateQueue();
swapchain = GetSwapChain(device);
- swapchain.Configure(GetPreferredSwapChainTextureFormat(),
- dawn::TextureUsageBit::OutputAttachment, 640, 480);
+ swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
+ 640, 480);
initBuffers();
initRender();
diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp
index eb9d7da..5338958 100644
--- a/examples/CppHelloTriangle.cpp
+++ b/examples/CppHelloTriangle.cpp
@@ -38,14 +38,16 @@
static const uint32_t indexData[3] = {
0, 1, 2,
};
- indexBuffer = utils::CreateBufferFromData(device, indexData, sizeof(indexData), dawn::BufferUsageBit::Index);
+ indexBuffer =
+ utils::CreateBufferFromData(device, indexData, sizeof(indexData), dawn::BufferUsage::Index);
static const float vertexData[12] = {
0.0f, 0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, 0.0f, 1.0f,
0.5f, -0.5f, 0.0f, 1.0f,
};
- vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData), dawn::BufferUsageBit::Vertex);
+ vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData),
+ dawn::BufferUsage::Vertex);
}
void initTextures() {
@@ -58,7 +60,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled;
+ descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
texture = device.CreateTexture(&descriptor);
dawn::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
@@ -71,7 +73,7 @@
}
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
- device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::CopySrc);
+ device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::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};
@@ -88,8 +90,8 @@
queue = device.CreateQueue();
swapchain = GetSwapChain(device);
- swapchain.Configure(GetPreferredSwapChainTextureFormat(),
- dawn::TextureUsageBit::OutputAttachment, 640, 480);
+ swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
+ 640, 480);
initBuffers();
initTextures();
diff --git a/examples/CubeReflection.cpp b/examples/CubeReflection.cpp
index a9dc6f2..3a48806 100644
--- a/examples/CubeReflection.cpp
+++ b/examples/CubeReflection.cpp
@@ -62,7 +62,8 @@
20, 21, 22,
20, 22, 23
};
- indexBuffer = utils::CreateBufferFromData(device, indexData, sizeof(indexData), dawn::BufferUsageBit::Index);
+ indexBuffer =
+ utils::CreateBufferFromData(device, indexData, sizeof(indexData), dawn::BufferUsage::Index);
static const float vertexData[6 * 4 * 6] = {
-1.0, -1.0, 1.0, 1.0, 0.0, 0.0,
@@ -95,7 +96,8 @@
-1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
-1.0, 1.0, -1.0, 1.0, 1.0, 1.0
};
- vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData), dawn::BufferUsageBit::Vertex);
+ vertexBuffer = utils::CreateBufferFromData(device, vertexData, sizeof(vertexData),
+ dawn::BufferUsage::Vertex);
static const float planeData[6 * 4] = {
-2.0, -1.0, -2.0, 0.5, 0.5, 0.5,
@@ -103,7 +105,8 @@
2.0, -1.0, 2.0, 0.5, 0.5, 0.5,
-2.0, -1.0, 2.0, 0.5, 0.5, 0.5,
};
- planeBuffer = utils::CreateBufferFromData(device, planeData, sizeof(planeData), dawn::BufferUsageBit::Vertex);
+ planeBuffer = utils::CreateBufferFromData(device, planeData, sizeof(planeData),
+ dawn::BufferUsage::Vertex);
}
struct CameraData {
@@ -116,8 +119,8 @@
queue = device.CreateQueue();
swapchain = GetSwapChain(device);
- swapchain.Configure(GetPreferredSwapChainTextureFormat(),
- dawn::TextureUsageBit::OutputAttachment, 640, 480);
+ swapchain.Configure(GetPreferredSwapChainTextureFormat(), dawn::TextureUsage::OutputAttachment,
+ 640, 480);
initBuffers();
@@ -176,14 +179,16 @@
dawn::BufferDescriptor cameraBufDesc;
cameraBufDesc.size = sizeof(CameraData);
- cameraBufDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Uniform;
+ cameraBufDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::Uniform;
cameraBuffer = device.CreateBuffer(&cameraBufDesc);
glm::mat4 transform(1.0);
- transformBuffer[0] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4), dawn::BufferUsageBit::Uniform);
+ transformBuffer[0] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4),
+ dawn::BufferUsage::Uniform);
transform = glm::translate(transform, glm::vec3(0.f, -2.f, 0.f));
- transformBuffer[1] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4), dawn::BufferUsageBit::Uniform);
+ transformBuffer[1] = utils::CreateBufferFromData(device, &transform, sizeof(glm::mat4),
+ dawn::BufferUsage::Uniform);
bindGroup[0] = utils::MakeBindGroup(device, bgl, {
{0, cameraBuffer, 0, sizeof(CameraData)},
diff --git a/examples/SampleUtils.cpp b/examples/SampleUtils.cpp
index 1ff4afe..c9d426c 100644
--- a/examples/SampleUtils.cpp
+++ b/examples/SampleUtils.cpp
@@ -173,7 +173,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::Depth24PlusStencil8;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment;
auto depthStencilTexture = device.CreateTexture(&descriptor);
return depthStencilTexture.CreateDefaultView();
}
diff --git a/generator/templates/dawn_native/api_structs.h b/generator/templates/dawn_native/api_structs.h
index e4967ee..ca96ee3 100644
--- a/generator/templates/dawn_native/api_structs.h
+++ b/generator/templates/dawn_native/api_structs.h
@@ -38,7 +38,7 @@
const void* nextInChain = nullptr;
{% endif %}
{% for member in type.members %}
- {{as_annotated_frontendType(member)}} {{render_cpp_default_value(member)}};
+ {{as_annotated_frontendType(member)}} {{render_cpp_default_value(member)}};
{% endfor %}
};
diff --git a/src/common/SwapChainUtils.h b/src/common/SwapChainUtils.h
index a736227..af62d79 100644
--- a/src/common/SwapChainUtils.h
+++ b/src/common/SwapChainUtils.h
@@ -26,7 +26,7 @@
reinterpret_cast<T*>(userData)->Init(ctx);
};
impl.Destroy = [](void* userData) { delete reinterpret_cast<T*>(userData); };
- impl.Configure = [](void* userData, DawnTextureFormat format, DawnTextureUsageBit allowedUsage,
+ impl.Configure = [](void* userData, DawnTextureFormat format, DawnTextureUsage allowedUsage,
uint32_t width, uint32_t height) {
return static_cast<T*>(userData)->Configure(format, allowedUsage, width, height);
};
diff --git a/src/dawn_native/BindGroup.cpp b/src/dawn_native/BindGroup.cpp
index c2b832b..15c971f 100644
--- a/src/dawn_native/BindGroup.cpp
+++ b/src/dawn_native/BindGroup.cpp
@@ -30,7 +30,7 @@
MaybeError ValidateBufferBinding(const DeviceBase* device,
const BindGroupBinding& binding,
- dawn::BufferUsageBit requiredUsage) {
+ dawn::BufferUsage requiredUsage) {
if (binding.buffer == nullptr || binding.sampler != nullptr ||
binding.textureView != nullptr) {
return DAWN_VALIDATION_ERROR("expected buffer binding");
@@ -63,7 +63,7 @@
MaybeError ValidateTextureBinding(const DeviceBase* device,
const BindGroupBinding& binding,
- dawn::TextureUsageBit requiredUsage,
+ dawn::TextureUsage requiredUsage,
bool multisampledBinding,
dawn::TextureComponentType requiredComponentType) {
if (binding.textureView == nullptr || binding.sampler != nullptr ||
@@ -139,14 +139,14 @@
// Perform binding-type specific validation.
switch (layoutInfo.types[bindingIndex]) {
case dawn::BindingType::UniformBuffer:
- DAWN_TRY(ValidateBufferBinding(device, binding, dawn::BufferUsageBit::Uniform));
+ DAWN_TRY(ValidateBufferBinding(device, binding, dawn::BufferUsage::Uniform));
break;
case dawn::BindingType::StorageBuffer:
- DAWN_TRY(ValidateBufferBinding(device, binding, dawn::BufferUsageBit::Storage));
+ DAWN_TRY(ValidateBufferBinding(device, binding, dawn::BufferUsage::Storage));
break;
case dawn::BindingType::SampledTexture:
DAWN_TRY(
- ValidateTextureBinding(device, binding, dawn::TextureUsageBit::Sampled,
+ ValidateTextureBinding(device, binding, dawn::TextureUsage::Sampled,
layoutInfo.multisampled[bindingIndex],
layoutInfo.textureComponentTypes[bindingIndex]));
break;
diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp
index a88ebab..b040ac8 100644
--- a/src/dawn_native/Buffer.cpp
+++ b/src/dawn_native/Buffer.cpp
@@ -89,19 +89,19 @@
return DAWN_VALIDATION_ERROR("nextInChain must be nullptr");
}
- DAWN_TRY(ValidateBufferUsageBit(descriptor->usage));
+ DAWN_TRY(ValidateBufferUsage(descriptor->usage));
- dawn::BufferUsageBit usage = descriptor->usage;
+ dawn::BufferUsage usage = descriptor->usage;
- const dawn::BufferUsageBit kMapWriteAllowedUsages =
- dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
- if (usage & dawn::BufferUsageBit::MapWrite && (usage & kMapWriteAllowedUsages) != usage) {
+ const dawn::BufferUsage kMapWriteAllowedUsages =
+ dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
+ if (usage & dawn::BufferUsage::MapWrite && (usage & kMapWriteAllowedUsages) != usage) {
return DAWN_VALIDATION_ERROR("Only CopySrc is allowed with MapWrite");
}
- const dawn::BufferUsageBit kMapReadAllowedUsages =
- dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
- if (usage & dawn::BufferUsageBit::MapRead && (usage & kMapReadAllowedUsages) != usage) {
+ const dawn::BufferUsage kMapReadAllowedUsages =
+ dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
+ if (usage & dawn::BufferUsage::MapRead && (usage & kMapReadAllowedUsages) != usage) {
return DAWN_VALIDATION_ERROR("Only CopyDst is allowed with MapRead");
}
@@ -146,7 +146,7 @@
return mSize;
}
- dawn::BufferUsageBit BufferBase::GetUsage() const {
+ dawn::BufferUsage BufferBase::GetUsage() const {
ASSERT(!IsError());
return mUsage;
}
@@ -232,7 +232,7 @@
}
void BufferBase::MapReadAsync(DawnBufferMapReadCallback callback, void* userdata) {
- if (GetDevice()->ConsumedError(ValidateMap(dawn::BufferUsageBit::MapRead))) {
+ if (GetDevice()->ConsumedError(ValidateMap(dawn::BufferUsage::MapRead))) {
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, 0, userdata);
return;
}
@@ -272,7 +272,7 @@
}
void BufferBase::MapWriteAsync(DawnBufferMapWriteCallback callback, void* userdata) {
- if (GetDevice()->ConsumedError(ValidateMap(dawn::BufferUsageBit::MapWrite))) {
+ if (GetDevice()->ConsumedError(ValidateMap(dawn::BufferUsage::MapWrite))) {
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, 0, userdata);
return;
}
@@ -381,14 +381,14 @@
return DAWN_VALIDATION_ERROR("Buffer subdata out of range");
}
- if (!(mUsage & dawn::BufferUsageBit::CopyDst)) {
+ if (!(mUsage & dawn::BufferUsage::CopyDst)) {
return DAWN_VALIDATION_ERROR("Buffer needs the CopyDst usage bit");
}
return {};
}
- MaybeError BufferBase::ValidateMap(dawn::BufferUsageBit requiredUsage) const {
+ MaybeError BufferBase::ValidateMap(dawn::BufferUsage requiredUsage) const {
DAWN_TRY(GetDevice()->ValidateObject(this));
switch (mState) {
@@ -416,8 +416,7 @@
// even if it did not have a mappable usage.
return {};
case BufferState::Unmapped:
- if ((mUsage & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) ==
- 0) {
+ if ((mUsage & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) == 0) {
return DAWN_VALIDATION_ERROR("Buffer does not have map usage");
}
return {};
diff --git a/src/dawn_native/Buffer.h b/src/dawn_native/Buffer.h
index e656c25..9549c50 100644
--- a/src/dawn_native/Buffer.h
+++ b/src/dawn_native/Buffer.h
@@ -27,13 +27,12 @@
MaybeError ValidateBufferDescriptor(DeviceBase* device, const BufferDescriptor* descriptor);
- static constexpr dawn::BufferUsageBit kReadOnlyBufferUsages =
- dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc |
- dawn::BufferUsageBit::Index | dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Uniform;
+ static constexpr dawn::BufferUsage kReadOnlyBufferUsages =
+ dawn::BufferUsage::MapRead | dawn::BufferUsage::CopySrc | dawn::BufferUsage::Index |
+ dawn::BufferUsage::Vertex | dawn::BufferUsage::Uniform;
- static constexpr dawn::BufferUsageBit kWritableBufferUsages = dawn::BufferUsageBit::MapWrite |
- dawn::BufferUsageBit::CopyDst |
- dawn::BufferUsageBit::Storage;
+ static constexpr dawn::BufferUsage kWritableBufferUsages =
+ dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopyDst | dawn::BufferUsage::Storage;
class BufferBase : public ObjectBase {
enum class BufferState {
@@ -52,7 +51,7 @@
uint8_t** mappedPointer);
uint64_t GetSize() const;
- dawn::BufferUsageBit GetUsage() const;
+ dawn::BufferUsage GetUsage() const;
MaybeError MapAtCreation(uint8_t** mappedPointer);
@@ -91,12 +90,12 @@
MaybeError CopyFromStagingBuffer();
MaybeError ValidateSetSubData(uint32_t start, uint32_t count) const;
- MaybeError ValidateMap(dawn::BufferUsageBit requiredUsage) const;
+ MaybeError ValidateMap(dawn::BufferUsage requiredUsage) const;
MaybeError ValidateUnmap() const;
MaybeError ValidateDestroy() const;
uint64_t mSize = 0;
- dawn::BufferUsageBit mUsage = dawn::BufferUsageBit::None;
+ dawn::BufferUsage mUsage = dawn::BufferUsage::None;
DawnBufferMapReadCallback mMapReadCallback = nullptr;
DawnBufferMapWriteCallback mMapWriteCallback = nullptr;
diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp
index 8a58d1e..832d27a 100644
--- a/src/dawn_native/CommandEncoder.cpp
+++ b/src/dawn_native/CommandEncoder.cpp
@@ -242,7 +242,7 @@
return {};
}
- MaybeError ValidateCanUseAs(BufferBase* buffer, dawn::BufferUsageBit usage) {
+ MaybeError ValidateCanUseAs(BufferBase* buffer, dawn::BufferUsage usage) {
ASSERT(HasZeroOrOneBits(usage));
if (!(buffer->GetUsage() & usage)) {
return DAWN_VALIDATION_ERROR("buffer doesn't have the required usage.");
@@ -251,7 +251,7 @@
return {};
}
- MaybeError ValidateCanUseAs(TextureBase* texture, dawn::TextureUsageBit usage) {
+ MaybeError ValidateCanUseAs(TextureBase* texture, dawn::TextureUsage usage) {
ASSERT(HasZeroOrOneBits(usage));
if (!(texture->GetUsage() & usage)) {
return DAWN_VALIDATION_ERROR("texture doesn't have the required usage.");
@@ -715,9 +715,8 @@
DAWN_TRY(ValidateB2BCopySizeAlignment(copy->size, copy->sourceOffset,
copy->destinationOffset));
- DAWN_TRY(ValidateCanUseAs(copy->source.Get(), dawn::BufferUsageBit::CopySrc));
- DAWN_TRY(
- ValidateCanUseAs(copy->destination.Get(), dawn::BufferUsageBit::CopyDst));
+ DAWN_TRY(ValidateCanUseAs(copy->source.Get(), dawn::BufferUsage::CopySrc));
+ DAWN_TRY(ValidateCanUseAs(copy->destination.Get(), dawn::BufferUsage::CopyDst));
mResourceUsages.topLevelBuffers.insert(copy->source.Get());
mResourceUsages.topLevelBuffers.insert(copy->destination.Get());
@@ -750,9 +749,9 @@
copy->destination.texture->GetFormat()));
DAWN_TRY(
- ValidateCanUseAs(copy->source.buffer.Get(), dawn::BufferUsageBit::CopySrc));
+ ValidateCanUseAs(copy->source.buffer.Get(), dawn::BufferUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(copy->destination.texture.Get(),
- dawn::TextureUsageBit::CopyDst));
+ dawn::TextureUsage::CopyDst));
mResourceUsages.topLevelBuffers.insert(copy->source.buffer.Get());
mResourceUsages.topLevelTextures.insert(copy->destination.texture.Get());
@@ -784,10 +783,10 @@
DAWN_TRY(ValidateTexelBufferOffset(copy->destination,
copy->source.texture->GetFormat()));
- DAWN_TRY(ValidateCanUseAs(copy->source.texture.Get(),
- dawn::TextureUsageBit::CopySrc));
+ DAWN_TRY(
+ ValidateCanUseAs(copy->source.texture.Get(), dawn::TextureUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(copy->destination.buffer.Get(),
- dawn::BufferUsageBit::CopyDst));
+ dawn::BufferUsage::CopyDst));
mResourceUsages.topLevelTextures.insert(copy->source.texture.Get());
mResourceUsages.topLevelBuffers.insert(copy->destination.buffer.Get());
@@ -812,10 +811,10 @@
DAWN_TRY(ValidateCopySizeFitsInTexture(copy->source, copy->copySize));
DAWN_TRY(ValidateCopySizeFitsInTexture(copy->destination, copy->copySize));
- DAWN_TRY(ValidateCanUseAs(copy->source.texture.Get(),
- dawn::TextureUsageBit::CopySrc));
+ DAWN_TRY(
+ ValidateCanUseAs(copy->source.texture.Get(), dawn::TextureUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(copy->destination.texture.Get(),
- dawn::TextureUsageBit::CopyDst));
+ dawn::TextureUsage::CopyDst));
mResourceUsages.topLevelTextures.insert(copy->source.texture.Get());
mResourceUsages.topLevelTextures.insert(copy->destination.texture.Get());
diff --git a/src/dawn_native/CommandValidation.cpp b/src/dawn_native/CommandValidation.cpp
index 75101f0..2aa7323 100644
--- a/src/dawn_native/CommandValidation.cpp
+++ b/src/dawn_native/CommandValidation.cpp
@@ -59,17 +59,17 @@
switch (type) {
case dawn::BindingType::UniformBuffer: {
BufferBase* buffer = group->GetBindingAsBufferBinding(i).buffer;
- usageTracker->BufferUsedAs(buffer, dawn::BufferUsageBit::Uniform);
+ usageTracker->BufferUsedAs(buffer, dawn::BufferUsage::Uniform);
} break;
case dawn::BindingType::StorageBuffer: {
BufferBase* buffer = group->GetBindingAsBufferBinding(i).buffer;
- usageTracker->BufferUsedAs(buffer, dawn::BufferUsageBit::Storage);
+ usageTracker->BufferUsedAs(buffer, dawn::BufferUsage::Storage);
} break;
case dawn::BindingType::SampledTexture: {
TextureBase* texture = group->GetBindingAsTextureView(i)->GetTexture();
- usageTracker->TextureUsedAs(texture, dawn::TextureUsageBit::Sampled);
+ usageTracker->TextureUsedAs(texture, dawn::TextureUsage::Sampled);
} break;
case dawn::BindingType::Sampler:
@@ -105,14 +105,14 @@
DrawIndirectCmd* cmd = commands->NextCommand<DrawIndirectCmd>();
DAWN_TRY(commandBufferState->ValidateCanDraw());
usageTracker->BufferUsedAs(cmd->indirectBuffer.Get(),
- dawn::BufferUsageBit::Indirect);
+ dawn::BufferUsage::Indirect);
} break;
case Command::DrawIndexedIndirect: {
DrawIndexedIndirectCmd* cmd = commands->NextCommand<DrawIndexedIndirectCmd>();
DAWN_TRY(commandBufferState->ValidateCanDrawIndexed());
usageTracker->BufferUsedAs(cmd->indirectBuffer.Get(),
- dawn::BufferUsageBit::Indirect);
+ dawn::BufferUsage::Indirect);
} break;
case Command::InsertDebugMarker: {
@@ -154,7 +154,7 @@
case Command::SetIndexBuffer: {
SetIndexBufferCmd* cmd = commands->NextCommand<SetIndexBufferCmd>();
- usageTracker->BufferUsedAs(cmd->buffer.Get(), dawn::BufferUsageBit::Index);
+ usageTracker->BufferUsedAs(cmd->buffer.Get(), dawn::BufferUsage::Index);
commandBufferState->SetIndexBuffer();
} break;
@@ -164,7 +164,7 @@
commands->NextData<uint64_t>(cmd->count);
for (uint32_t i = 0; i < cmd->count; ++i) {
- usageTracker->BufferUsedAs(buffers[i].Get(), dawn::BufferUsageBit::Vertex);
+ usageTracker->BufferUsedAs(buffers[i].Get(), dawn::BufferUsage::Vertex);
}
commandBufferState->SetVertexBuffer(cmd->startSlot, cmd->count);
} break;
@@ -211,18 +211,18 @@
for (uint32_t i : IterateBitSet(renderPass->attachmentState->GetColorAttachmentsMask())) {
RenderPassColorAttachmentInfo* colorAttachment = &renderPass->colorAttachments[i];
TextureBase* texture = colorAttachment->view->GetTexture();
- usageTracker.TextureUsedAs(texture, dawn::TextureUsageBit::OutputAttachment);
+ usageTracker.TextureUsedAs(texture, dawn::TextureUsage::OutputAttachment);
TextureViewBase* resolveTarget = colorAttachment->resolveTarget.Get();
if (resolveTarget != nullptr) {
usageTracker.TextureUsedAs(resolveTarget->GetTexture(),
- dawn::TextureUsageBit::OutputAttachment);
+ dawn::TextureUsage::OutputAttachment);
}
}
if (renderPass->attachmentState->HasDepthStencilAttachment()) {
TextureBase* texture = renderPass->depthStencilAttachment.view->GetTexture();
- usageTracker.TextureUsedAs(texture, dawn::TextureUsageBit::OutputAttachment);
+ usageTracker.TextureUsedAs(texture, dawn::TextureUsage::OutputAttachment);
}
Command type;
@@ -324,7 +324,7 @@
DispatchIndirectCmd* cmd = commands->NextCommand<DispatchIndirectCmd>();
DAWN_TRY(commandBufferState.ValidateCanDispatch());
usageTracker.BufferUsedAs(cmd->indirectBuffer.Get(),
- dawn::BufferUsageBit::Indirect);
+ dawn::BufferUsage::Indirect);
} break;
case Command::InsertDebugMarker: {
diff --git a/src/dawn_native/PassResourceUsage.h b/src/dawn_native/PassResourceUsage.h
index 9a8c2b0..eebeda6 100644
--- a/src/dawn_native/PassResourceUsage.h
+++ b/src/dawn_native/PassResourceUsage.h
@@ -30,10 +30,10 @@
// re-compute it.
struct PassResourceUsage {
std::vector<BufferBase*> buffers;
- std::vector<dawn::BufferUsageBit> bufferUsages;
+ std::vector<dawn::BufferUsage> bufferUsages;
std::vector<TextureBase*> textures;
- std::vector<dawn::TextureUsageBit> textureUsages;
+ std::vector<dawn::TextureUsage> textureUsages;
};
struct CommandBufferResourceUsage {
diff --git a/src/dawn_native/PassResourceUsageTracker.cpp b/src/dawn_native/PassResourceUsageTracker.cpp
index 4f26112..8ae4edf 100644
--- a/src/dawn_native/PassResourceUsageTracker.cpp
+++ b/src/dawn_native/PassResourceUsageTracker.cpp
@@ -19,26 +19,24 @@
namespace dawn_native {
- void PassResourceUsageTracker::BufferUsedAs(BufferBase* buffer, dawn::BufferUsageBit usage) {
+ void PassResourceUsageTracker::BufferUsedAs(BufferBase* buffer, dawn::BufferUsage usage) {
// std::map's operator[] will create the key and return 0 if the key didn't exist
// before.
- dawn::BufferUsageBit& storedUsage = mBufferUsages[buffer];
+ dawn::BufferUsage& storedUsage = mBufferUsages[buffer];
- if (usage == dawn::BufferUsageBit::Storage && storedUsage & dawn::BufferUsageBit::Storage) {
+ if (usage == dawn::BufferUsage::Storage && storedUsage & dawn::BufferUsage::Storage) {
mStorageUsedMultipleTimes = true;
}
storedUsage |= usage;
}
- void PassResourceUsageTracker::TextureUsedAs(TextureBase* texture,
- dawn::TextureUsageBit usage) {
+ void PassResourceUsageTracker::TextureUsedAs(TextureBase* texture, dawn::TextureUsage usage) {
// std::map's operator[] will create the key and return 0 if the key didn't exist
// before.
- dawn::TextureUsageBit& storedUsage = mTextureUsages[texture];
+ dawn::TextureUsage& storedUsage = mTextureUsages[texture];
- if (usage == dawn::TextureUsageBit::Storage &&
- storedUsage & dawn::TextureUsageBit::Storage) {
+ if (usage == dawn::TextureUsage::Storage && storedUsage & dawn::TextureUsage::Storage) {
mStorageUsedMultipleTimes = true;
}
@@ -62,7 +60,7 @@
// Buffers can only be used as single-write or multiple read.
for (auto& it : mBufferUsages) {
BufferBase* buffer = it.first;
- dawn::BufferUsageBit usage = it.second;
+ dawn::BufferUsage usage = it.second;
if (usage & ~buffer->GetUsage()) {
return DAWN_VALIDATION_ERROR("Buffer missing usage for the pass");
@@ -81,7 +79,7 @@
// TODO(cwallez@chromium.org): implement per-subresource tracking
for (auto& it : mTextureUsages) {
TextureBase* texture = it.first;
- dawn::TextureUsageBit usage = it.second;
+ dawn::TextureUsage usage = it.second;
if (usage & ~texture->GetUsage()) {
return DAWN_VALIDATION_ERROR("Texture missing usage for the pass");
diff --git a/src/dawn_native/PassResourceUsageTracker.h b/src/dawn_native/PassResourceUsageTracker.h
index 6942058..8f3662f 100644
--- a/src/dawn_native/PassResourceUsageTracker.h
+++ b/src/dawn_native/PassResourceUsageTracker.h
@@ -33,8 +33,8 @@
// information.
class PassResourceUsageTracker {
public:
- void BufferUsedAs(BufferBase* buffer, dawn::BufferUsageBit usage);
- void TextureUsedAs(TextureBase* texture, dawn::TextureUsageBit usage);
+ void BufferUsedAs(BufferBase* buffer, dawn::BufferUsage usage);
+ void TextureUsedAs(TextureBase* texture, dawn::TextureUsage usage);
MaybeError ValidateComputePassUsages() const;
MaybeError ValidateRenderPassUsages() const;
@@ -46,8 +46,8 @@
// Performs the per-pass usage validation checks
MaybeError ValidateUsages() const;
- std::map<BufferBase*, dawn::BufferUsageBit> mBufferUsages;
- std::map<TextureBase*, dawn::TextureUsageBit> mTextureUsages;
+ std::map<BufferBase*, dawn::BufferUsage> mBufferUsages;
+ std::map<TextureBase*, dawn::TextureUsage> mTextureUsages;
bool mStorageUsedMultipleTimes = false;
};
diff --git a/src/dawn_native/SwapChain.cpp b/src/dawn_native/SwapChain.cpp
index 3151c98..d5f685a 100644
--- a/src/dawn_native/SwapChain.cpp
+++ b/src/dawn_native/SwapChain.cpp
@@ -81,7 +81,7 @@
}
void SwapChainBase::Configure(dawn::TextureFormat format,
- dawn::TextureUsageBit allowedUsage,
+ dawn::TextureUsage allowedUsage,
uint32_t width,
uint32_t height) {
if (GetDevice()->ConsumedError(ValidateConfigure(format, allowedUsage, width, height))) {
@@ -89,14 +89,14 @@
}
ASSERT(!IsError());
- allowedUsage |= dawn::TextureUsageBit::Present;
+ allowedUsage |= dawn::TextureUsage::Present;
mFormat = format;
mAllowedUsage = allowedUsage;
mWidth = width;
mHeight = height;
mImplementation.Configure(mImplementation.userData, static_cast<DawnTextureFormat>(format),
- static_cast<DawnTextureUsageBit>(allowedUsage), width, height);
+ static_cast<DawnTextureUsage>(allowedUsage), width, height);
}
TextureBase* SwapChainBase::GetNextTexture() {
@@ -138,12 +138,12 @@
}
MaybeError SwapChainBase::ValidateConfigure(dawn::TextureFormat format,
- dawn::TextureUsageBit allowedUsage,
+ dawn::TextureUsage allowedUsage,
uint32_t width,
uint32_t height) const {
DAWN_TRY(GetDevice()->ValidateObject(this));
- DAWN_TRY(ValidateTextureUsageBit(allowedUsage));
+ DAWN_TRY(ValidateTextureUsage(allowedUsage));
DAWN_TRY(ValidateTextureFormat(format));
if (width == 0 || height == 0) {
diff --git a/src/dawn_native/SwapChain.h b/src/dawn_native/SwapChain.h
index c8479c6..8b0e9fd 100644
--- a/src/dawn_native/SwapChain.h
+++ b/src/dawn_native/SwapChain.h
@@ -36,7 +36,7 @@
// Dawn API
void Configure(dawn::TextureFormat format,
- dawn::TextureUsageBit allowedUsage,
+ dawn::TextureUsage allowedUsage,
uint32_t width,
uint32_t height);
TextureBase* GetNextTexture();
@@ -51,7 +51,7 @@
private:
MaybeError ValidateConfigure(dawn::TextureFormat format,
- dawn::TextureUsageBit allowedUsage,
+ dawn::TextureUsage allowedUsage,
uint32_t width,
uint32_t height) const;
MaybeError ValidateGetNextTexture() const;
@@ -59,7 +59,7 @@
DawnSwapChainImplementation mImplementation = {};
dawn::TextureFormat mFormat = {};
- dawn::TextureUsageBit mAllowedUsage;
+ dawn::TextureUsage mAllowedUsage;
uint32_t mWidth = 0;
uint32_t mHeight = 0;
TextureBase* mLastNextTexture = nullptr;
diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp
index 64ba7a9..96cfde5 100644
--- a/src/dawn_native/Texture.cpp
+++ b/src/dawn_native/Texture.cpp
@@ -173,23 +173,23 @@
}
MaybeError ValidateTextureUsage(const TextureDescriptor* descriptor, const Format* format) {
- DAWN_TRY(ValidateTextureUsageBit(descriptor->usage));
+ DAWN_TRY(dawn_native::ValidateTextureUsage(descriptor->usage));
- constexpr dawn::TextureUsageBit kValidCompressedUsages =
- dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::CopySrc |
- dawn::TextureUsageBit::CopyDst;
+ constexpr dawn::TextureUsage kValidCompressedUsages = dawn::TextureUsage::Sampled |
+ dawn::TextureUsage::CopySrc |
+ dawn::TextureUsage::CopyDst;
if (format->isCompressed && (descriptor->usage & (~kValidCompressedUsages))) {
return DAWN_VALIDATION_ERROR(
"Compressed texture format is incompatible with the texture usage");
}
if (!format->isRenderable &&
- (descriptor->usage & dawn::TextureUsageBit::OutputAttachment)) {
+ (descriptor->usage & dawn::TextureUsage::OutputAttachment)) {
return DAWN_VALIDATION_ERROR(
"Non-renderable format used with OutputAttachment usage");
}
- if (descriptor->usage & dawn::TextureUsageBit::Storage) {
+ if (descriptor->usage & dawn::TextureUsage::Storage) {
return DAWN_VALIDATION_ERROR("storage textures aren't supported (yet)");
}
@@ -364,7 +364,7 @@
ASSERT(!IsError());
return mSampleCount;
}
- dawn::TextureUsageBit TextureBase::GetUsage() const {
+ dawn::TextureUsage TextureBase::GetUsage() const {
ASSERT(!IsError());
return mUsage;
}
diff --git a/src/dawn_native/Texture.h b/src/dawn_native/Texture.h
index 0e5f8cf..a913b8d 100644
--- a/src/dawn_native/Texture.h
+++ b/src/dawn_native/Texture.h
@@ -34,13 +34,12 @@
bool IsValidSampleCount(uint32_t sampleCount);
- static constexpr dawn::TextureUsageBit kReadOnlyTextureUsages = dawn::TextureUsageBit::CopySrc |
- dawn::TextureUsageBit::Sampled |
- dawn::TextureUsageBit::Present;
+ static constexpr dawn::TextureUsage kReadOnlyTextureUsages =
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::Sampled | dawn::TextureUsage::Present;
- static constexpr dawn::TextureUsageBit kWritableTextureUsages =
- dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Storage |
- dawn::TextureUsageBit::OutputAttachment;
+ static constexpr dawn::TextureUsage kWritableTextureUsages =
+ dawn::TextureUsage::CopyDst | dawn::TextureUsage::Storage |
+ dawn::TextureUsage::OutputAttachment;
class TextureBase : public ObjectBase {
public:
@@ -56,7 +55,7 @@
uint32_t GetArrayLayers() const;
uint32_t GetNumMipLevels() const;
uint32_t GetSampleCount() const;
- dawn::TextureUsageBit GetUsage() const;
+ dawn::TextureUsage GetUsage() const;
TextureState GetTextureState() const;
uint32_t GetSubresourceIndex(uint32_t mipLevel, uint32_t arraySlice) const;
bool IsSubresourceContentInitialized(uint32_t baseMipLevel,
@@ -100,7 +99,7 @@
uint32_t mArrayLayerCount;
uint32_t mMipLevelCount;
uint32_t mSampleCount;
- dawn::TextureUsageBit mUsage = dawn::TextureUsageBit::None;
+ dawn::TextureUsage mUsage = dawn::TextureUsage::None;
TextureState mState;
// TODO(natlee@microsoft.com): Use a more optimized data structure to save space
diff --git a/src/dawn_native/d3d12/BufferD3D12.cpp b/src/dawn_native/d3d12/BufferD3D12.cpp
index 77f2a77..585c24f 100644
--- a/src/dawn_native/d3d12/BufferD3D12.cpp
+++ b/src/dawn_native/d3d12/BufferD3D12.cpp
@@ -23,45 +23,45 @@
namespace dawn_native { namespace d3d12 {
namespace {
- D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::BufferUsageBit usage) {
+ D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::BufferUsage usage) {
D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE;
- if (usage & dawn::BufferUsageBit::Storage) {
+ if (usage & dawn::BufferUsage::Storage) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
}
return flags;
}
- D3D12_RESOURCE_STATES D3D12BufferUsage(dawn::BufferUsageBit usage) {
+ D3D12_RESOURCE_STATES D3D12BufferUsage(dawn::BufferUsage usage) {
D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON;
- if (usage & dawn::BufferUsageBit::CopySrc) {
+ if (usage & dawn::BufferUsage::CopySrc) {
resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE;
}
- if (usage & dawn::BufferUsageBit::CopyDst) {
+ if (usage & dawn::BufferUsage::CopyDst) {
resourceState |= D3D12_RESOURCE_STATE_COPY_DEST;
}
- if (usage & (dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Uniform)) {
+ if (usage & (dawn::BufferUsage::Vertex | dawn::BufferUsage::Uniform)) {
resourceState |= D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER;
}
- if (usage & dawn::BufferUsageBit::Index) {
+ if (usage & dawn::BufferUsage::Index) {
resourceState |= D3D12_RESOURCE_STATE_INDEX_BUFFER;
}
- if (usage & dawn::BufferUsageBit::Storage) {
+ if (usage & dawn::BufferUsage::Storage) {
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
}
- if (usage & dawn::BufferUsageBit::Indirect) {
+ if (usage & dawn::BufferUsage::Indirect) {
resourceState |= D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT;
}
return resourceState;
}
- D3D12_HEAP_TYPE D3D12HeapType(dawn::BufferUsageBit allowedUsage) {
- if (allowedUsage & dawn::BufferUsageBit::MapRead) {
+ D3D12_HEAP_TYPE D3D12HeapType(dawn::BufferUsage allowedUsage) {
+ if (allowedUsage & dawn::BufferUsage::MapRead) {
return D3D12_HEAP_TYPE_READBACK;
- } else if (allowedUsage & dawn::BufferUsageBit::MapWrite) {
+ } else if (allowedUsage & dawn::BufferUsage::MapWrite) {
return D3D12_HEAP_TYPE_UPLOAD;
} else {
return D3D12_HEAP_TYPE_DEFAULT;
@@ -84,7 +84,7 @@
resourceDescriptor.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
// Add CopyDst for non-mappable buffer initialization in CreateBufferMapped
// and robust resource initialization.
- resourceDescriptor.Flags = D3D12ResourceFlags(GetUsage() | dawn::BufferUsageBit::CopyDst);
+ resourceDescriptor.Flags = D3D12ResourceFlags(GetUsage() | dawn::BufferUsage::CopyDst);
auto heapType = D3D12HeapType(GetUsage());
auto bufferUsage = D3D12_RESOURCE_STATE_COMMON;
@@ -94,7 +94,7 @@
if (heapType == D3D12_HEAP_TYPE_READBACK) {
bufferUsage |= D3D12_RESOURCE_STATE_COPY_DEST;
mFixedResourceState = true;
- mLastUsage = dawn::BufferUsageBit::CopyDst;
+ mLastUsage = dawn::BufferUsage::CopyDst;
}
// D3D12 requires buffers on the UPLOAD heap to have the D3D12_RESOURCE_STATE_GENERIC_READ
@@ -102,7 +102,7 @@
if (heapType == D3D12_HEAP_TYPE_UPLOAD) {
bufferUsage |= D3D12_RESOURCE_STATE_GENERIC_READ;
mFixedResourceState = true;
- mLastUsage = dawn::BufferUsageBit::CopySrc;
+ mLastUsage = dawn::BufferUsage::CopySrc;
}
mResource =
@@ -126,7 +126,7 @@
// ResourceBarrier call. Failing to do so will cause the tracked state to become invalid and can
// cause subsequent errors.
bool Buffer::TransitionUsageAndGetResourceBarrier(D3D12_RESOURCE_BARRIER* barrier,
- dawn::BufferUsageBit newUsage) {
+ dawn::BufferUsage newUsage) {
// Resources in upload and readback heaps must be kept in the COPY_SOURCE/DEST state
if (mFixedResourceState) {
ASSERT(mLastUsage == newUsage);
@@ -183,7 +183,7 @@
}
void Buffer::TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
- dawn::BufferUsageBit usage) {
+ dawn::BufferUsage usage) {
D3D12_RESOURCE_BARRIER barrier;
if (TransitionUsageAndGetResourceBarrier(&barrier, usage)) {
@@ -205,7 +205,7 @@
bool Buffer::IsMapWritable() const {
// TODO(enga): Handle CPU-visible memory on UMA
- return (GetUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) != 0;
+ return (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
}
MaybeError Buffer::MapAtCreationImpl(uint8_t** mappedPointer) {
diff --git a/src/dawn_native/d3d12/BufferD3D12.h b/src/dawn_native/d3d12/BufferD3D12.h
index 811fe19..1b8b177 100644
--- a/src/dawn_native/d3d12/BufferD3D12.h
+++ b/src/dawn_native/d3d12/BufferD3D12.h
@@ -34,9 +34,9 @@
D3D12_GPU_VIRTUAL_ADDRESS GetVA() const;
void OnMapCommandSerialFinished(uint32_t mapSerial, void* data, bool isWrite);
bool TransitionUsageAndGetResourceBarrier(D3D12_RESOURCE_BARRIER* barrier,
- dawn::BufferUsageBit newUsage);
+ dawn::BufferUsage newUsage);
void TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
- dawn::BufferUsageBit usage);
+ dawn::BufferUsage usage);
private:
// Dawn API
@@ -50,7 +50,7 @@
ComPtr<ID3D12Resource> mResource;
bool mFixedResourceState = false;
- dawn::BufferUsageBit mLastUsage = dawn::BufferUsageBit::None;
+ dawn::BufferUsage mLastUsage = dawn::BufferUsage::None;
Serial mLastUsedSerial = UINT64_MAX;
D3D12_RANGE mWrittenMappedRange;
};
diff --git a/src/dawn_native/d3d12/CommandBufferD3D12.cpp b/src/dawn_native/d3d12/CommandBufferD3D12.cpp
index 150dd63..5e7174f 100644
--- a/src/dawn_native/d3d12/CommandBufferD3D12.cpp
+++ b/src/dawn_native/d3d12/CommandBufferD3D12.cpp
@@ -539,7 +539,7 @@
// Clear textures that are not output attachments. Output attachments will be
// cleared during record render pass if the texture subresource has not been
// initialized before the render pass.
- if (!(usages.textureUsages[i] & dawn::TextureUsageBit::OutputAttachment)) {
+ if (!(usages.textureUsages[i] & dawn::TextureUsage::OutputAttachment)) {
texture->EnsureSubresourceContentInitialized(
commandList, 0, texture->GetNumMipLevels(), 0, texture->GetArrayLayers());
}
@@ -591,8 +591,8 @@
Buffer* srcBuffer = ToBackend(copy->source.Get());
Buffer* dstBuffer = ToBackend(copy->destination.Get());
- srcBuffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopySrc);
- dstBuffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopyDst);
+ srcBuffer->TransitionUsageNow(commandList, dawn::BufferUsage::CopySrc);
+ dstBuffer->TransitionUsageNow(commandList, dawn::BufferUsage::CopyDst);
commandList->CopyBufferRegion(
dstBuffer->GetD3D12Resource().Get(), copy->destinationOffset,
@@ -614,8 +614,8 @@
copy->destination.arrayLayer, 1);
}
- buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopySrc);
- texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopyDst);
+ buffer->TransitionUsageNow(commandList, dawn::BufferUsage::CopySrc);
+ texture->TransitionUsageNow(commandList, dawn::TextureUsage::CopyDst);
auto copySplit = ComputeTextureCopySplit(
copy->destination.origin, copy->copySize, texture->GetFormat(),
@@ -660,8 +660,8 @@
texture->EnsureSubresourceContentInitialized(commandList, copy->source.mipLevel,
1, copy->source.arrayLayer, 1);
- texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopySrc);
- buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::CopyDst);
+ texture->TransitionUsageNow(commandList, dawn::TextureUsage::CopySrc);
+ buffer->TransitionUsageNow(commandList, dawn::BufferUsage::CopyDst);
auto copySplit = ComputeTextureCopySplit(
copy->source.origin, copy->copySize, texture->GetFormat(),
@@ -718,8 +718,8 @@
commandList, copy->destination.mipLevel, 1,
copy->destination.arrayLayer, 1);
}
- source->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopySrc);
- destination->TransitionUsageNow(commandList, dawn::TextureUsageBit::CopyDst);
+ source->TransitionUsageNow(commandList, dawn::TextureUsage::CopySrc);
+ destination->TransitionUsageNow(commandList, dawn::TextureUsage::CopyDst);
if (CanUseCopyResource(source->GetNumMipLevels(), source->GetSize(),
destination->GetSize(), copy->copySize)) {
diff --git a/src/dawn_native/d3d12/D3D12Backend.cpp b/src/dawn_native/d3d12/D3D12Backend.cpp
index 36e7661..47378d0 100644
--- a/src/dawn_native/d3d12/D3D12Backend.cpp
+++ b/src/dawn_native/d3d12/D3D12Backend.cpp
@@ -28,7 +28,7 @@
DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, window));
- impl.textureUsage = DAWN_TEXTURE_USAGE_BIT_PRESENT;
+ impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
return impl;
}
diff --git a/src/dawn_native/d3d12/DeviceD3D12.cpp b/src/dawn_native/d3d12/DeviceD3D12.cpp
index a0318d8..1f23108 100644
--- a/src/dawn_native/d3d12/DeviceD3D12.cpp
+++ b/src/dawn_native/d3d12/DeviceD3D12.cpp
@@ -317,7 +317,7 @@
uint64_t destinationOffset,
uint64_t size) {
ToBackend(destination)
- ->TransitionUsageNow(GetPendingCommandList(), dawn::BufferUsageBit::CopyDst);
+ ->TransitionUsageNow(GetPendingCommandList(), dawn::BufferUsage::CopyDst);
GetPendingCommandList()->CopyBufferRegion(
ToBackend(destination)->GetD3D12Resource().Get(), destinationOffset,
diff --git a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp
index 6934679..2ec24b5 100644
--- a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp
+++ b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp
@@ -21,15 +21,15 @@
namespace dawn_native { namespace d3d12 {
namespace {
- DXGI_USAGE D3D12SwapChainBufferUsage(DawnTextureUsageBit allowedUsages) {
+ DXGI_USAGE D3D12SwapChainBufferUsage(DawnTextureUsage allowedUsages) {
DXGI_USAGE usage = DXGI_CPU_ACCESS_NONE;
- if (allowedUsages & DAWN_TEXTURE_USAGE_BIT_SAMPLED) {
+ if (allowedUsages & DAWN_TEXTURE_USAGE_SAMPLED) {
usage |= DXGI_USAGE_SHADER_INPUT;
}
- if (allowedUsages & DAWN_TEXTURE_USAGE_BIT_STORAGE) {
+ if (allowedUsages & DAWN_TEXTURE_USAGE_STORAGE) {
usage |= DXGI_USAGE_UNORDERED_ACCESS;
}
- if (allowedUsages & DAWN_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT) {
+ if (allowedUsages & DAWN_TEXTURE_USAGE_OUTPUT_ATTACHMENT) {
usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT;
}
return usage;
@@ -49,7 +49,7 @@
}
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
- DawnTextureUsageBit usage,
+ DawnTextureUsage usage,
uint32_t width,
uint32_t height) {
ASSERT(width > 0);
diff --git a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h
index f2fa847..223f5ef 100644
--- a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h
+++ b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h
@@ -35,7 +35,7 @@
void Init(DawnWSIContextD3D12* context);
DawnSwapChainError Configure(DawnTextureFormat format,
- DawnTextureUsageBit,
+ DawnTextureUsage,
uint32_t width,
uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
diff --git a/src/dawn_native/d3d12/SwapChainD3D12.cpp b/src/dawn_native/d3d12/SwapChainD3D12.cpp
index f02a79e..48c642d 100644
--- a/src/dawn_native/d3d12/SwapChainD3D12.cpp
+++ b/src/dawn_native/d3d12/SwapChainD3D12.cpp
@@ -28,8 +28,8 @@
wsiContext.device = reinterpret_cast<DawnDevice>(GetDevice());
im.Init(im.userData, &wsiContext);
- ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_BIT_NONE);
- mTextureUsage = static_cast<dawn::TextureUsageBit>(im.textureUsage);
+ ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_NONE);
+ mTextureUsage = static_cast<dawn::TextureUsage>(im.textureUsage);
}
SwapChain::~SwapChain() {
diff --git a/src/dawn_native/d3d12/SwapChainD3D12.h b/src/dawn_native/d3d12/SwapChainD3D12.h
index 1ca8ded..833ba48 100644
--- a/src/dawn_native/d3d12/SwapChainD3D12.h
+++ b/src/dawn_native/d3d12/SwapChainD3D12.h
@@ -30,7 +30,7 @@
TextureBase* GetNextTextureImpl(const TextureDescriptor* descriptor) override;
void OnBeforePresent(TextureBase* texture) override;
- dawn::TextureUsageBit mTextureUsage;
+ dawn::TextureUsage mTextureUsage;
};
}} // namespace dawn_native::d3d12
diff --git a/src/dawn_native/d3d12/TextureD3D12.cpp b/src/dawn_native/d3d12/TextureD3D12.cpp
index c200dbb..af7a408 100644
--- a/src/dawn_native/d3d12/TextureD3D12.cpp
+++ b/src/dawn_native/d3d12/TextureD3D12.cpp
@@ -21,28 +21,28 @@
namespace dawn_native { namespace d3d12 {
namespace {
- D3D12_RESOURCE_STATES D3D12TextureUsage(dawn::TextureUsageBit usage, const Format& format) {
+ D3D12_RESOURCE_STATES D3D12TextureUsage(dawn::TextureUsage usage, const Format& format) {
D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON;
// Present is an exclusive flag.
- if (usage & dawn::TextureUsageBit::Present) {
+ if (usage & dawn::TextureUsage::Present) {
return D3D12_RESOURCE_STATE_PRESENT;
}
- if (usage & dawn::TextureUsageBit::CopySrc) {
+ if (usage & dawn::TextureUsage::CopySrc) {
resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE;
}
- if (usage & dawn::TextureUsageBit::CopyDst) {
+ if (usage & dawn::TextureUsage::CopyDst) {
resourceState |= D3D12_RESOURCE_STATE_COPY_DEST;
}
- if (usage & dawn::TextureUsageBit::Sampled) {
+ if (usage & dawn::TextureUsage::Sampled) {
resourceState |= (D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE |
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
}
- if (usage & dawn::TextureUsageBit::Storage) {
+ if (usage & dawn::TextureUsage::Storage) {
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
}
- if (usage & dawn::TextureUsageBit::OutputAttachment) {
+ if (usage & dawn::TextureUsage::OutputAttachment) {
if (format.HasDepthOrStencil()) {
resourceState |= D3D12_RESOURCE_STATE_DEPTH_WRITE;
} else {
@@ -53,12 +53,12 @@
return resourceState;
}
- D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::TextureUsageBit usage,
+ D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::TextureUsage usage,
const Format& format,
bool isMultisampledTexture) {
D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE;
- if (usage & dawn::TextureUsageBit::Storage) {
+ if (usage & dawn::TextureUsage::Storage) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
}
@@ -70,7 +70,7 @@
// flag is invalid.
// TODO(natlee@microsoft.com, jiawei.shao@intel.com): do not require render target for
// lazy clearing.
- if ((usage & dawn::TextureUsageBit::OutputAttachment) || isMultisampledTexture ||
+ if ((usage & dawn::TextureUsage::OutputAttachment) || isMultisampledTexture ||
!format.isCompressed) {
if (format.HasDepthOrStencil()) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
@@ -319,7 +319,7 @@
// ResourceBarrier call. Failing to do so will cause the tracked state to become invalid and can
// cause subsequent errors.
bool Texture::TransitionUsageAndGetResourceBarrier(D3D12_RESOURCE_BARRIER* barrier,
- dawn::TextureUsageBit newUsage) {
+ dawn::TextureUsage newUsage) {
return TransitionUsageAndGetResourceBarrier(barrier,
D3D12TextureUsage(newUsage, GetFormat()));
}
@@ -395,7 +395,7 @@
}
void Texture::TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
- dawn::TextureUsageBit usage) {
+ dawn::TextureUsage usage) {
TransitionUsageNow(commandList, D3D12TextureUsage(usage, GetFormat()));
}
diff --git a/src/dawn_native/d3d12/TextureD3D12.h b/src/dawn_native/d3d12/TextureD3D12.h
index 787c5b1..9584a12 100644
--- a/src/dawn_native/d3d12/TextureD3D12.h
+++ b/src/dawn_native/d3d12/TextureD3D12.h
@@ -35,9 +35,9 @@
DXGI_FORMAT GetD3D12Format() const;
ID3D12Resource* GetD3D12Resource() const;
bool TransitionUsageAndGetResourceBarrier(D3D12_RESOURCE_BARRIER* barrier,
- dawn::TextureUsageBit newUsage);
+ dawn::TextureUsage newUsage);
void TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
- dawn::TextureUsageBit usage);
+ dawn::TextureUsage usage);
void TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
D3D12_RESOURCE_STATES newState);
diff --git a/src/dawn_native/dawn_platform.h b/src/dawn_native/dawn_platform.h
index d456d32..795c371 100644
--- a/src/dawn_native/dawn_platform.h
+++ b/src/dawn_native/dawn_platform.h
@@ -15,7 +15,7 @@
#ifndef DAWNNATIVE_DAWNPLATFORM_H_
#define DAWNNATIVE_DAWNPLATFORM_H_
-// Use cawncpp to have the enum and bitfield definitions
+// Use dawncpp to have the enum and bitfield definitions
#include <dawn/dawncpp.h>
// Use our autogenerated version of the dawn structures that point to dawn_native object types
diff --git a/src/dawn_native/metal/BufferMTL.mm b/src/dawn_native/metal/BufferMTL.mm
index 0bdc09d..dfe96f3 100644
--- a/src/dawn_native/metal/BufferMTL.mm
+++ b/src/dawn_native/metal/BufferMTL.mm
@@ -21,7 +21,7 @@
Buffer::Buffer(Device* device, const BufferDescriptor* descriptor)
: BufferBase(device, descriptor) {
MTLResourceOptions storageMode;
- if (GetUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) {
+ if (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) {
storageMode = MTLResourceStorageModeShared;
} else {
storageMode = MTLResourceStorageModePrivate;
@@ -49,7 +49,7 @@
bool Buffer::IsMapWritable() const {
// TODO(enga): Handle CPU-visible memory on UMA
- return (GetUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) != 0;
+ return (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
}
MaybeError Buffer::MapAtCreationImpl(uint8_t** mappedPointer) {
diff --git a/src/dawn_native/metal/TextureMTL.mm b/src/dawn_native/metal/TextureMTL.mm
index 089974d..8bbd28b 100644
--- a/src/dawn_native/metal/TextureMTL.mm
+++ b/src/dawn_native/metal/TextureMTL.mm
@@ -21,24 +21,24 @@
namespace dawn_native { namespace metal {
namespace {
- bool UsageNeedsTextureView(dawn::TextureUsageBit usage) {
- constexpr dawn::TextureUsageBit kUsageNeedsTextureView =
- dawn::TextureUsageBit::Storage | dawn::TextureUsageBit::Sampled;
+ bool UsageNeedsTextureView(dawn::TextureUsage usage) {
+ constexpr dawn::TextureUsage kUsageNeedsTextureView =
+ dawn::TextureUsage::Storage | dawn::TextureUsage::Sampled;
return usage & kUsageNeedsTextureView;
}
- MTLTextureUsage MetalTextureUsage(dawn::TextureUsageBit usage) {
+ MTLTextureUsage MetalTextureUsage(dawn::TextureUsage usage) {
MTLTextureUsage result = MTLTextureUsageUnknown; // This is 0
- if (usage & (dawn::TextureUsageBit::Storage)) {
+ if (usage & (dawn::TextureUsage::Storage)) {
result |= MTLTextureUsageShaderWrite | MTLTextureUsageShaderRead;
}
- if (usage & (dawn::TextureUsageBit::Sampled)) {
+ if (usage & (dawn::TextureUsage::Sampled)) {
result |= MTLTextureUsageShaderRead;
}
- if (usage & (dawn::TextureUsageBit::OutputAttachment)) {
+ if (usage & (dawn::TextureUsage::OutputAttachment)) {
result |= MTLTextureUsageRenderTarget;
}
diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp
index 47a3aec..2ea0075 100644
--- a/src/dawn_native/null/DeviceNull.cpp
+++ b/src/dawn_native/null/DeviceNull.cpp
@@ -239,7 +239,7 @@
bool Buffer::IsMapWritable() const {
// Only return true for mappable buffers so we can test cases that need / don't need a
// staging buffer.
- return (GetUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) != 0;
+ return (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
}
MaybeError Buffer::MapAtCreationImpl(uint8_t** mappedPointer) {
@@ -345,7 +345,7 @@
}
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
- DawnTextureUsageBit,
+ DawnTextureUsage,
uint32_t width,
uint32_t height) {
return DAWN_SWAP_CHAIN_NO_ERROR;
diff --git a/src/dawn_native/null/DeviceNull.h b/src/dawn_native/null/DeviceNull.h
index 36139a5..640ff58 100644
--- a/src/dawn_native/null/DeviceNull.h
+++ b/src/dawn_native/null/DeviceNull.h
@@ -209,7 +209,7 @@
using WSIContext = struct {};
void Init(WSIContext* context);
DawnSwapChainError Configure(DawnTextureFormat format,
- DawnTextureUsageBit,
+ DawnTextureUsage,
uint32_t width,
uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
diff --git a/src/dawn_native/null/NullBackend.cpp b/src/dawn_native/null/NullBackend.cpp
index ef1bbe4..14fff85 100644
--- a/src/dawn_native/null/NullBackend.cpp
+++ b/src/dawn_native/null/NullBackend.cpp
@@ -25,7 +25,7 @@
DawnSwapChainImplementation CreateNativeSwapChainImpl() {
DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(new NativeSwapChainImpl());
- impl.textureUsage = DAWN_TEXTURE_USAGE_BIT_PRESENT;
+ impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
return impl;
}
diff --git a/src/dawn_native/opengl/CommandBufferGL.cpp b/src/dawn_native/opengl/CommandBufferGL.cpp
index c45dfd8..8351509 100644
--- a/src/dawn_native/opengl/CommandBufferGL.cpp
+++ b/src/dawn_native/opengl/CommandBufferGL.cpp
@@ -394,7 +394,7 @@
// We count the lazy clears for non output attachment textures and depth stencil
// textures in order to match the backdoor lazy clear counts in Vulkan and D3D12.
bool isLazyClear =
- ((!(usages.textureUsages[i] & dawn::TextureUsageBit::OutputAttachment) &&
+ ((!(usages.textureUsages[i] & dawn::TextureUsage::OutputAttachment) &&
texture->GetFormat().IsColor()) ||
texture->GetFormat().HasDepthOrStencil());
texture->EnsureSubresourceContentInitialized(
diff --git a/src/dawn_native/opengl/NativeSwapChainImplGL.cpp b/src/dawn_native/opengl/NativeSwapChainImplGL.cpp
index 656a4ac..f107875 100644
--- a/src/dawn_native/opengl/NativeSwapChainImplGL.cpp
+++ b/src/dawn_native/opengl/NativeSwapChainImplGL.cpp
@@ -43,7 +43,7 @@
}
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
- DawnTextureUsageBit usage,
+ DawnTextureUsage usage,
uint32_t width,
uint32_t height) {
if (format != DAWN_TEXTURE_FORMAT_RGBA8_UNORM) {
diff --git a/src/dawn_native/opengl/NativeSwapChainImplGL.h b/src/dawn_native/opengl/NativeSwapChainImplGL.h
index ff38f6d..81a5dc9 100644
--- a/src/dawn_native/opengl/NativeSwapChainImplGL.h
+++ b/src/dawn_native/opengl/NativeSwapChainImplGL.h
@@ -33,7 +33,7 @@
void Init(DawnWSIContextGL* context);
DawnSwapChainError Configure(DawnTextureFormat format,
- DawnTextureUsageBit,
+ DawnTextureUsage,
uint32_t width,
uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
diff --git a/src/dawn_native/opengl/OpenGLBackend.cpp b/src/dawn_native/opengl/OpenGLBackend.cpp
index 22dc697..91b019f 100644
--- a/src/dawn_native/opengl/OpenGLBackend.cpp
+++ b/src/dawn_native/opengl/OpenGLBackend.cpp
@@ -35,7 +35,7 @@
DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(
new NativeSwapChainImpl(backendDevice, present, presentUserdata));
- impl.textureUsage = DAWN_TEXTURE_USAGE_BIT_PRESENT;
+ impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
return impl;
}
diff --git a/src/dawn_native/opengl/TextureGL.cpp b/src/dawn_native/opengl/TextureGL.cpp
index 3dd2b0c..94bd58f 100644
--- a/src/dawn_native/opengl/TextureGL.cpp
+++ b/src/dawn_native/opengl/TextureGL.cpp
@@ -66,9 +66,9 @@
return handle;
}
- bool UsageNeedsTextureView(dawn::TextureUsageBit usage) {
- constexpr dawn::TextureUsageBit kUsageNeedingTextureView =
- dawn::TextureUsageBit::Storage | dawn::TextureUsageBit::Sampled;
+ bool UsageNeedsTextureView(dawn::TextureUsage usage) {
+ constexpr dawn::TextureUsage kUsageNeedingTextureView =
+ dawn::TextureUsage::Storage | dawn::TextureUsage::Sampled;
return usage & kUsageNeedingTextureView;
}
diff --git a/src/dawn_native/vulkan/BufferVk.cpp b/src/dawn_native/vulkan/BufferVk.cpp
index d1e6c62..53085b2 100644
--- a/src/dawn_native/vulkan/BufferVk.cpp
+++ b/src/dawn_native/vulkan/BufferVk.cpp
@@ -23,86 +23,86 @@
namespace {
- VkBufferUsageFlags VulkanBufferUsage(dawn::BufferUsageBit usage) {
+ VkBufferUsageFlags VulkanBufferUsage(dawn::BufferUsage usage) {
VkBufferUsageFlags flags = 0;
- if (usage & dawn::BufferUsageBit::CopySrc) {
+ if (usage & dawn::BufferUsage::CopySrc) {
flags |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
}
- if (usage & dawn::BufferUsageBit::CopyDst) {
+ if (usage & dawn::BufferUsage::CopyDst) {
flags |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;
}
- if (usage & dawn::BufferUsageBit::Index) {
+ if (usage & dawn::BufferUsage::Index) {
flags |= VK_BUFFER_USAGE_INDEX_BUFFER_BIT;
}
- if (usage & dawn::BufferUsageBit::Vertex) {
+ if (usage & dawn::BufferUsage::Vertex) {
flags |= VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
}
- if (usage & dawn::BufferUsageBit::Uniform) {
+ if (usage & dawn::BufferUsage::Uniform) {
flags |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
}
- if (usage & dawn::BufferUsageBit::Storage) {
+ if (usage & dawn::BufferUsage::Storage) {
flags |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
}
- if (usage & dawn::BufferUsageBit::Indirect) {
+ if (usage & dawn::BufferUsage::Indirect) {
flags |= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT;
}
return flags;
}
- VkPipelineStageFlags VulkanPipelineStage(dawn::BufferUsageBit usage) {
+ VkPipelineStageFlags VulkanPipelineStage(dawn::BufferUsage usage) {
VkPipelineStageFlags flags = 0;
- if (usage & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) {
+ if (usage & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) {
flags |= VK_PIPELINE_STAGE_HOST_BIT;
}
- if (usage & (dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst)) {
+ if (usage & (dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst)) {
flags |= VK_PIPELINE_STAGE_TRANSFER_BIT;
}
- if (usage & (dawn::BufferUsageBit::Index | dawn::BufferUsageBit::Vertex)) {
+ if (usage & (dawn::BufferUsage::Index | dawn::BufferUsage::Vertex)) {
flags |= VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
}
- if (usage & (dawn::BufferUsageBit::Uniform | dawn::BufferUsageBit::Storage)) {
+ if (usage & (dawn::BufferUsage::Uniform | dawn::BufferUsage::Storage)) {
flags |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT |
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
}
- if (usage & dawn::BufferUsageBit::Indirect) {
+ if (usage & dawn::BufferUsage::Indirect) {
flags |= VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT;
}
return flags;
}
- VkAccessFlags VulkanAccessFlags(dawn::BufferUsageBit usage) {
+ VkAccessFlags VulkanAccessFlags(dawn::BufferUsage usage) {
VkAccessFlags flags = 0;
- if (usage & dawn::BufferUsageBit::MapRead) {
+ if (usage & dawn::BufferUsage::MapRead) {
flags |= VK_ACCESS_HOST_READ_BIT;
}
- if (usage & dawn::BufferUsageBit::MapWrite) {
+ if (usage & dawn::BufferUsage::MapWrite) {
flags |= VK_ACCESS_HOST_WRITE_BIT;
}
- if (usage & dawn::BufferUsageBit::CopySrc) {
+ if (usage & dawn::BufferUsage::CopySrc) {
flags |= VK_ACCESS_TRANSFER_READ_BIT;
}
- if (usage & dawn::BufferUsageBit::CopyDst) {
+ if (usage & dawn::BufferUsage::CopyDst) {
flags |= VK_ACCESS_TRANSFER_WRITE_BIT;
}
- if (usage & dawn::BufferUsageBit::Index) {
+ if (usage & dawn::BufferUsage::Index) {
flags |= VK_ACCESS_INDEX_READ_BIT;
}
- if (usage & dawn::BufferUsageBit::Vertex) {
+ if (usage & dawn::BufferUsage::Vertex) {
flags |= VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT;
}
- if (usage & dawn::BufferUsageBit::Uniform) {
+ if (usage & dawn::BufferUsage::Uniform) {
flags |= VK_ACCESS_UNIFORM_READ_BIT;
}
- if (usage & dawn::BufferUsageBit::Storage) {
+ if (usage & dawn::BufferUsage::Storage) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
- if (usage & dawn::BufferUsageBit::Indirect) {
+ if (usage & dawn::BufferUsage::Indirect) {
flags |= VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
}
@@ -120,7 +120,7 @@
createInfo.size = GetSize();
// Add CopyDst for non-mappable buffer initialization in CreateBufferMapped
// and robust resource initialization.
- createInfo.usage = VulkanBufferUsage(GetUsage() | dawn::BufferUsageBit::CopyDst);
+ createInfo.usage = VulkanBufferUsage(GetUsage() | dawn::BufferUsage::CopyDst);
createInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
createInfo.queueFamilyIndexCount = 0;
createInfo.pQueueFamilyIndices = 0;
@@ -134,7 +134,7 @@
device->fn.GetBufferMemoryRequirements(device->GetVkDevice(), mHandle, &requirements);
bool requestMappable =
- (GetUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) != 0;
+ (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
if (!device->GetMemoryAllocator()->Allocate(requirements, requestMappable,
&mMemoryAllocation)) {
ASSERT(false);
@@ -164,7 +164,7 @@
}
void Buffer::TransitionUsageNow(CommandRecordingContext* recordingContext,
- dawn::BufferUsageBit usage) {
+ dawn::BufferUsage usage) {
bool lastIncludesTarget = (mLastUsage & usage) == usage;
bool lastReadOnly = (mLastUsage & kReadOnlyBufferUsages) == mLastUsage;
@@ -174,7 +174,7 @@
}
// Special-case for the initial transition: Vulkan doesn't allow access flags to be 0.
- if (mLastUsage == dawn::BufferUsageBit::None) {
+ if (mLastUsage == dawn::BufferUsage::None) {
mLastUsage = usage;
return;
}
@@ -214,7 +214,7 @@
Device* device = ToBackend(GetDevice());
CommandRecordingContext* recordingContext = device->GetPendingRecordingContext();
- TransitionUsageNow(recordingContext, dawn::BufferUsageBit::MapRead);
+ TransitionUsageNow(recordingContext, dawn::BufferUsage::MapRead);
uint8_t* memory = mMemoryAllocation.GetMappedPointer();
ASSERT(memory != nullptr);
@@ -228,7 +228,7 @@
Device* device = ToBackend(GetDevice());
CommandRecordingContext* recordingContext = device->GetPendingRecordingContext();
- TransitionUsageNow(recordingContext, dawn::BufferUsageBit::MapWrite);
+ TransitionUsageNow(recordingContext, dawn::BufferUsage::MapWrite);
uint8_t* memory = mMemoryAllocation.GetMappedPointer();
ASSERT(memory != nullptr);
diff --git a/src/dawn_native/vulkan/BufferVk.h b/src/dawn_native/vulkan/BufferVk.h
index abf735d..354c39e 100644
--- a/src/dawn_native/vulkan/BufferVk.h
+++ b/src/dawn_native/vulkan/BufferVk.h
@@ -39,8 +39,7 @@
// Transitions the buffer to be used as `usage`, recording any necessary barrier in
// `commands`.
// TODO(cwallez@chromium.org): coalesce barriers and do them early when possible.
- void TransitionUsageNow(CommandRecordingContext* recordingContext,
- dawn::BufferUsageBit usage);
+ void TransitionUsageNow(CommandRecordingContext* recordingContext, dawn::BufferUsage usage);
private:
// Dawn API
@@ -55,7 +54,7 @@
VkBuffer mHandle = VK_NULL_HANDLE;
DeviceMemoryAllocation mMemoryAllocation;
- dawn::BufferUsageBit mLastUsage = dawn::BufferUsageBit::None;
+ dawn::BufferUsage mLastUsage = dawn::BufferUsage::None;
};
class MapRequestTracker {
diff --git a/src/dawn_native/vulkan/CommandBufferVk.cpp b/src/dawn_native/vulkan/CommandBufferVk.cpp
index 636f44e..ab503d7 100644
--- a/src/dawn_native/vulkan/CommandBufferVk.cpp
+++ b/src/dawn_native/vulkan/CommandBufferVk.cpp
@@ -327,7 +327,7 @@
format.blockByteSize;
BufferDescriptor tempBufferDescriptor;
tempBufferDescriptor.size = tempBufferSize;
- tempBufferDescriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ tempBufferDescriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
Device* device = ToBackend(GetDevice());
Ref<Buffer> tempBuffer = ToBackend(device->CreateBuffer(&tempBufferDescriptor));
@@ -347,7 +347,7 @@
VkImage srcImage = ToBackend(srcCopy.texture)->GetHandle();
VkImage dstImage = ToBackend(dstCopy.texture)->GetHandle();
- tempBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopyDst);
+ tempBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopyDst);
VkBufferImageCopy srcToTempBufferRegion =
ComputeBufferImageCopyRegion(tempBufferCopy, srcCopy, copySize);
@@ -355,7 +355,7 @@
device->fn.CmdCopyImageToBuffer(commands, srcImage, VK_IMAGE_LAYOUT_GENERAL,
tempBuffer->GetHandle(), 1, &srcToTempBufferRegion);
- tempBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopySrc);
+ tempBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
VkBufferImageCopy tempBufferToDstRegion =
ComputeBufferImageCopyRegion(tempBufferCopy, dstCopy, copySize);
@@ -384,7 +384,7 @@
// Clear textures that are not output attachments. Output attachments will be
// cleared in RecordBeginRenderPass by setting the loadop to clear when the
// texture subresource has not been initialized before the render pass.
- if (!(usages.textureUsages[i] & dawn::TextureUsageBit::OutputAttachment)) {
+ if (!(usages.textureUsages[i] & dawn::TextureUsage::OutputAttachment)) {
texture->EnsureSubresourceContentInitialized(recordingContext, 0,
texture->GetNumMipLevels(), 0,
texture->GetArrayLayers());
@@ -403,8 +403,8 @@
Buffer* srcBuffer = ToBackend(copy->source.Get());
Buffer* dstBuffer = ToBackend(copy->destination.Get());
- srcBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopySrc);
- dstBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopyDst);
+ srcBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
+ dstBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopyDst);
VkBufferCopy region;
region.srcOffset = copy->sourceOffset;
@@ -437,9 +437,9 @@
subresource.baseArrayLayer, 1);
}
ToBackend(src.buffer)
- ->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopySrc);
+ ->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
ToBackend(dst.texture)
- ->TransitionUsageNow(recordingContext, dawn::TextureUsageBit::CopyDst);
+ ->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopyDst);
VkBuffer srcBuffer = ToBackend(src.buffer)->GetHandle();
VkImage dstImage = ToBackend(dst.texture)->GetHandle();
@@ -465,9 +465,9 @@
subresource.baseArrayLayer, 1);
ToBackend(src.texture)
- ->TransitionUsageNow(recordingContext, dawn::TextureUsageBit::CopySrc);
+ ->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopySrc);
ToBackend(dst.buffer)
- ->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopyDst);
+ ->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopyDst);
VkImage srcImage = ToBackend(src.texture)->GetHandle();
VkBuffer dstBuffer = ToBackend(dst.buffer)->GetHandle();
@@ -497,9 +497,9 @@
}
ToBackend(src.texture)
- ->TransitionUsageNow(recordingContext, dawn::TextureUsageBit::CopySrc);
+ ->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopySrc);
ToBackend(dst.texture)
- ->TransitionUsageNow(recordingContext, dawn::TextureUsageBit::CopyDst);
+ ->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopyDst);
// In some situations we cannot do texture-to-texture copies with vkCmdCopyImage
// because as Vulkan SPEC always validates image copies with the virtual size of
diff --git a/src/dawn_native/vulkan/DeviceVk.cpp b/src/dawn_native/vulkan/DeviceVk.cpp
index f5774f6..57c9eeb 100644
--- a/src/dawn_native/vulkan/DeviceVk.cpp
+++ b/src/dawn_native/vulkan/DeviceVk.cpp
@@ -568,7 +568,7 @@
// Insert pipeline barrier to ensure correct ordering with previous memory operations on the
// buffer.
ToBackend(destination)
- ->TransitionUsageNow(GetPendingRecordingContext(), dawn::BufferUsageBit::CopyDst);
+ ->TransitionUsageNow(GetPendingRecordingContext(), dawn::BufferUsage::CopyDst);
VkBufferCopy copy;
copy.srcOffset = sourceOffset;
diff --git a/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp b/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp
index 5f1e5ad..858d478 100644
--- a/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp
+++ b/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp
@@ -73,7 +73,7 @@
}
DawnSwapChainError NativeSwapChainImpl::Configure(DawnTextureFormat format,
- DawnTextureUsageBit usage,
+ DawnTextureUsage usage,
uint32_t width,
uint32_t height) {
UpdateSurfaceConfig();
@@ -99,7 +99,7 @@
createInfo.imageExtent.width = width;
createInfo.imageExtent.height = height;
createInfo.imageArrayLayers = 1;
- createInfo.imageUsage = VulkanImageUsage(static_cast<dawn::TextureUsageBit>(usage),
+ createInfo.imageUsage = VulkanImageUsage(static_cast<dawn::TextureUsage>(usage),
mDevice->GetValidInternalFormat(mConfig.format));
createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
createInfo.queueFamilyIndexCount = 0;
diff --git a/src/dawn_native/vulkan/NativeSwapChainImplVk.h b/src/dawn_native/vulkan/NativeSwapChainImplVk.h
index 1b897848..c213cb4 100644
--- a/src/dawn_native/vulkan/NativeSwapChainImplVk.h
+++ b/src/dawn_native/vulkan/NativeSwapChainImplVk.h
@@ -33,7 +33,7 @@
void Init(DawnWSIContextVulkan* context);
DawnSwapChainError Configure(DawnTextureFormat format,
- DawnTextureUsageBit,
+ DawnTextureUsage,
uint32_t width,
uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
diff --git a/src/dawn_native/vulkan/SwapChainVk.cpp b/src/dawn_native/vulkan/SwapChainVk.cpp
index 37877b4..f244d1b 100644
--- a/src/dawn_native/vulkan/SwapChainVk.cpp
+++ b/src/dawn_native/vulkan/SwapChainVk.cpp
@@ -25,8 +25,8 @@
DawnWSIContextVulkan wsiContext = {};
im.Init(im.userData, &wsiContext);
- ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_BIT_NONE);
- mTextureUsage = static_cast<dawn::TextureUsageBit>(im.textureUsage);
+ ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_NONE);
+ mTextureUsage = static_cast<dawn::TextureUsage>(im.textureUsage);
}
SwapChain::~SwapChain() {
diff --git a/src/dawn_native/vulkan/SwapChainVk.h b/src/dawn_native/vulkan/SwapChainVk.h
index e546c34..190346c 100644
--- a/src/dawn_native/vulkan/SwapChainVk.h
+++ b/src/dawn_native/vulkan/SwapChainVk.h
@@ -33,7 +33,7 @@
void OnBeforePresent(TextureBase* texture) override;
private:
- dawn::TextureUsageBit mTextureUsage;
+ dawn::TextureUsage mTextureUsage;
};
}} // namespace dawn_native::vulkan
diff --git a/src/dawn_native/vulkan/TextureVk.cpp b/src/dawn_native/vulkan/TextureVk.cpp
index f5c56d0..0aff39a 100644
--- a/src/dawn_native/vulkan/TextureVk.cpp
+++ b/src/dawn_native/vulkan/TextureVk.cpp
@@ -55,22 +55,22 @@
}
// Computes which vulkan access type could be required for the given Dawn usage.
- VkAccessFlags VulkanAccessFlags(dawn::TextureUsageBit usage, const Format& format) {
+ VkAccessFlags VulkanAccessFlags(dawn::TextureUsage usage, const Format& format) {
VkAccessFlags flags = 0;
- if (usage & dawn::TextureUsageBit::CopySrc) {
+ if (usage & dawn::TextureUsage::CopySrc) {
flags |= VK_ACCESS_TRANSFER_READ_BIT;
}
- if (usage & dawn::TextureUsageBit::CopyDst) {
+ if (usage & dawn::TextureUsage::CopyDst) {
flags |= VK_ACCESS_TRANSFER_WRITE_BIT;
}
- if (usage & dawn::TextureUsageBit::Sampled) {
+ if (usage & dawn::TextureUsage::Sampled) {
flags |= VK_ACCESS_SHADER_READ_BIT;
}
- if (usage & dawn::TextureUsageBit::Storage) {
+ if (usage & dawn::TextureUsage::Storage) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
- if (usage & dawn::TextureUsageBit::OutputAttachment) {
+ if (usage & dawn::TextureUsage::OutputAttachment) {
if (format.HasDepthOrStencil()) {
flags |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
@@ -79,7 +79,7 @@
VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
}
}
- if (usage & dawn::TextureUsageBit::Present) {
+ if (usage & dawn::TextureUsage::Present) {
// There is no access flag for present because the VK_KHR_SWAPCHAIN extension says
// that vkQueuePresentKHR makes the memory of the image visible to the presentation
// engine. There's also a note explicitly saying dstAccessMask should be 0. On the
@@ -92,8 +92,8 @@
}
// Chooses which Vulkan image layout should be used for the given Dawn usage
- VkImageLayout VulkanImageLayout(dawn::TextureUsageBit usage, const Format& format) {
- if (usage == dawn::TextureUsageBit::None) {
+ VkImageLayout VulkanImageLayout(dawn::TextureUsage usage, const Format& format) {
+ if (usage == dawn::TextureUsage::None) {
return VK_IMAGE_LAYOUT_UNDEFINED;
}
@@ -103,27 +103,27 @@
// Usage has a single bit so we can switch on its value directly.
switch (usage) {
- case dawn::TextureUsageBit::CopyDst:
+ case dawn::TextureUsage::CopyDst:
return VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
- case dawn::TextureUsageBit::Sampled:
+ case dawn::TextureUsage::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
// 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 CopySrc use GENERAL.
- case dawn::TextureUsageBit::CopySrc:
+ case dawn::TextureUsage::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:
+ case dawn::TextureUsage::Storage:
return VK_IMAGE_LAYOUT_GENERAL;
- case dawn::TextureUsageBit::OutputAttachment:
+ case dawn::TextureUsage::OutputAttachment:
if (format.HasDepthOrStencil()) {
return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
} else {
return VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
}
- case dawn::TextureUsageBit::Present:
+ case dawn::TextureUsage::Present:
return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
default:
UNREACHABLE();
@@ -131,24 +131,23 @@
}
// Computes which Vulkan pipeline stage can access a texture in the given Dawn usage
- VkPipelineStageFlags VulkanPipelineStage(dawn::TextureUsageBit usage,
- const Format& format) {
+ VkPipelineStageFlags VulkanPipelineStage(dawn::TextureUsage usage, const Format& format) {
VkPipelineStageFlags flags = 0;
- if (usage == dawn::TextureUsageBit::None) {
+ if (usage == dawn::TextureUsage::None) {
// This only happens when a texture is initially created (and for srcAccessMask) in
// 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::CopySrc | dawn::TextureUsageBit::CopyDst)) {
+ if (usage & (dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst)) {
flags |= VK_PIPELINE_STAGE_TRANSFER_BIT;
}
- if (usage & (dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::Storage)) {
+ if (usage & (dawn::TextureUsage::Sampled | dawn::TextureUsage::Storage)) {
flags |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT |
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
}
- if (usage & dawn::TextureUsageBit::OutputAttachment) {
+ if (usage & dawn::TextureUsage::OutputAttachment) {
if (format.HasDepthOrStencil()) {
flags |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
@@ -158,7 +157,7 @@
flags |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
}
}
- if (usage & dawn::TextureUsageBit::Present) {
+ if (usage & dawn::TextureUsage::Present) {
// There is no pipeline stage for present but a pipeline stage is required so we use
// "bottom of pipe" to block as little as possible and vkQueuePresentKHR will make
// the memory visible to the presentation engine. The spec explicitly mentions that
@@ -333,22 +332,22 @@
// Converts the Dawn usage flags to Vulkan usage flags. Also needs the format to choose
// between color and depth attachment usages.
- VkImageUsageFlags VulkanImageUsage(dawn::TextureUsageBit usage, const Format& format) {
+ VkImageUsageFlags VulkanImageUsage(dawn::TextureUsage usage, const Format& format) {
VkImageUsageFlags flags = 0;
- if (usage & dawn::TextureUsageBit::CopySrc) {
+ if (usage & dawn::TextureUsage::CopySrc) {
flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
}
- if (usage & dawn::TextureUsageBit::CopyDst) {
+ if (usage & dawn::TextureUsage::CopyDst) {
flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
}
- if (usage & dawn::TextureUsageBit::Sampled) {
+ if (usage & dawn::TextureUsage::Sampled) {
flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
}
- if (usage & dawn::TextureUsageBit::Storage) {
+ if (usage & dawn::TextureUsage::Storage) {
flags |= VK_IMAGE_USAGE_STORAGE_BIT;
}
- if (usage & dawn::TextureUsageBit::OutputAttachment) {
+ if (usage & dawn::TextureUsage::OutputAttachment) {
if (format.HasDepthOrStencil()) {
flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
} else {
@@ -527,7 +526,7 @@
// Release the texture
mExternalState = ExternalState::PendingRelease;
- TransitionUsageNow(device->GetPendingRecordingContext(), dawn::TextureUsageBit::None);
+ TransitionUsageNow(device->GetPendingRecordingContext(), dawn::TextureUsage::None);
// Queue submit to signal we are done with the texture
device->GetPendingRecordingContext()->signalSemaphores.push_back(mSignalSemaphore);
@@ -580,7 +579,7 @@
}
void Texture::TransitionUsageNow(CommandRecordingContext* recordingContext,
- dawn::TextureUsageBit usage) {
+ dawn::TextureUsage usage) {
// Avoid encoding barriers when it isn't needed.
bool lastReadOnly = (mLastUsage & kReadOnlyTextureUsages) == mLastUsage;
if (lastReadOnly && mLastUsage == usage && mLastExternalState == mExternalState) {
@@ -654,7 +653,7 @@
range.layerCount = layerCount;
uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1;
- TransitionUsageNow(recordingContext, dawn::TextureUsageBit::CopyDst);
+ TransitionUsageNow(recordingContext, dawn::TextureUsage::CopyDst);
if (GetFormat().HasDepthOrStencil()) {
VkClearDepthStencilValue clearDepthStencilValue[1];
clearDepthStencilValue[0].depth = clearColor;
@@ -679,7 +678,7 @@
(GetSize().height / GetFormat().blockHeight) *
GetFormat().blockByteSize;
descriptor.nextInChain = nullptr;
- descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::MapWrite;
+ descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::MapWrite;
std::unique_ptr<Buffer> srcBuffer =
std::make_unique<dawn_native::vulkan::Buffer>(device, &descriptor);
uint8_t* clearBuffer = nullptr;
@@ -706,7 +705,7 @@
ComputeBufferImageCopyRegion(bufferCopy, textureCopy, copySize);
// copy the clear buffer to the texture image
- srcBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsageBit::CopySrc);
+ srcBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
ToBackend(GetDevice())
->fn.CmdCopyBufferToImage(recordingContext->commandBuffer, srcBuffer->GetHandle(),
GetHandle(), VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1,
diff --git a/src/dawn_native/vulkan/TextureVk.h b/src/dawn_native/vulkan/TextureVk.h
index 75f7a54..0087027 100644
--- a/src/dawn_native/vulkan/TextureVk.h
+++ b/src/dawn_native/vulkan/TextureVk.h
@@ -27,7 +27,7 @@
struct ExternalImageDescriptor;
VkFormat VulkanImageFormat(dawn::TextureFormat format);
- VkImageUsageFlags VulkanImageUsage(dawn::TextureUsageBit usage, const Format& format);
+ VkImageUsageFlags VulkanImageUsage(dawn::TextureUsage usage, const Format& format);
VkSampleCountFlagBits VulkanSampleCount(uint32_t sampleCount);
MaybeError ValidateVulkanImageCanBeWrapped(const DeviceBase* device,
@@ -60,7 +60,7 @@
// `commands`.
// TODO(cwallez@chromium.org): coalesce barriers and do them early when possible.
void TransitionUsageNow(CommandRecordingContext* recordingContext,
- dawn::TextureUsageBit usage);
+ dawn::TextureUsage usage);
void EnsureSubresourceContentInitialized(CommandRecordingContext* recordingContext,
uint32_t baseMipLevel,
uint32_t levelCount,
@@ -89,7 +89,7 @@
// A usage of none will make sure the texture is transitioned before its first use as
// required by the spec.
- dawn::TextureUsageBit mLastUsage = dawn::TextureUsageBit::None;
+ dawn::TextureUsage mLastUsage = dawn::TextureUsage::None;
};
class TextureView : public TextureViewBase {
diff --git a/src/dawn_native/vulkan/VulkanBackend.cpp b/src/dawn_native/vulkan/VulkanBackend.cpp
index 566605e..60eda44 100644
--- a/src/dawn_native/vulkan/VulkanBackend.cpp
+++ b/src/dawn_native/vulkan/VulkanBackend.cpp
@@ -42,7 +42,7 @@
DawnSwapChainImplementation impl;
impl = CreateSwapChainImplementation(new NativeSwapChainImpl(backendDevice, surface));
- impl.textureUsage = DAWN_TEXTURE_USAGE_BIT_PRESENT;
+ impl.textureUsage = DAWN_TEXTURE_USAGE_PRESENT;
return impl;
}
diff --git a/src/include/dawn/dawn_wsi.h b/src/include/dawn/dawn_wsi.h
index 1a2c4df..832af4b 100644
--- a/src/include/dawn/dawn_wsi.h
+++ b/src/include/dawn/dawn_wsi.h
@@ -41,7 +41,7 @@
/// Configure/reconfigure the swap chain.
DawnSwapChainError (*Configure)(void* userData,
DawnTextureFormat format,
- DawnTextureUsageBit allowedUsage,
+ DawnTextureUsage allowedUsage,
uint32_t width,
uint32_t height);
@@ -55,7 +55,7 @@
void* userData;
/// For use by the D3D12 and Vulkan backends: how the swapchain will use the texture.
- DawnTextureUsageBit textureUsage;
+ DawnTextureUsage textureUsage;
} DawnSwapChainImplementation;
#if defined(DAWN_ENABLE_BACKEND_D3D12) && defined(__cplusplus)
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index 41902a4..737aa90 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -587,7 +587,7 @@
// TODO(cwallez@chromium.org): eventually make bigger buffers and allocate linearly?
dawn::BufferDescriptor descriptor;
descriptor.size = readbackSize;
- descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
ReadbackSlot slot;
slot.bufferSize = readbackSize;
diff --git a/src/tests/end2end/BasicTests.cpp b/src/tests/end2end/BasicTests.cpp
index f269c38..86a4487 100644
--- a/src/tests/end2end/BasicTests.cpp
+++ b/src/tests/end2end/BasicTests.cpp
@@ -24,7 +24,7 @@
TEST_P(BasicTests, BufferSetSubData) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
uint32_t value = 0x01020304;
@@ -38,7 +38,7 @@
TEST_P(BasicTests, BufferSetSubDataError) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
uint8_t value = 187;
diff --git a/src/tests/end2end/BindGroupTests.cpp b/src/tests/end2end/BindGroupTests.cpp
index b1ce999..94ad031 100644
--- a/src/tests/end2end/BindGroupTests.cpp
+++ b/src/tests/end2end/BindGroupTests.cpp
@@ -79,7 +79,7 @@
dawn::BufferDescriptor bufferDesc;
bufferDesc.size = sizeof(float);
- bufferDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::Uniform;
+ bufferDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::Uniform;
dawn::Buffer buffer = device.CreateBuffer(&bufferDesc);
dawn::BindGroup bindGroup = utils::MakeBindGroup(device, bgl, {{0, buffer, 0, sizeof(float)}});
@@ -148,7 +148,8 @@
{ 0 },
{ 0.f, 1.f, 0.f, 1.f },
};
- dawn::Buffer buffer = utils::CreateBufferFromData(device, &data, sizeof(data), dawn::BufferUsageBit::Uniform);
+ dawn::Buffer buffer =
+ utils::CreateBufferFromData(device, &data, sizeof(data), dawn::BufferUsage::Uniform);
dawn::BindGroup bindGroup = utils::MakeBindGroup(device, bgl, {
{0, buffer, 0, sizeof(Data::transform)},
{1, buffer, 256, sizeof(Data::color)}
@@ -222,7 +223,8 @@
constexpr float dummy = 0.0f;
constexpr float transform[] = { 1.f, 0.f, dummy, dummy, 0.f, 1.f, dummy, dummy };
- dawn::Buffer buffer = utils::CreateBufferFromData(device, &transform, sizeof(transform), dawn::BufferUsageBit::Uniform);
+ dawn::Buffer buffer = utils::CreateBufferFromData(device, &transform, sizeof(transform),
+ dawn::BufferUsage::Uniform);
dawn::SamplerDescriptor samplerDescriptor;
samplerDescriptor.minFilter = dawn::FilterMode::Nearest;
@@ -246,7 +248,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled;
+ descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
dawn::Texture texture = device.CreateTexture(&descriptor);
dawn::TextureView textureView = texture.CreateDefaultView();
@@ -259,8 +261,8 @@
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::CopySrc);
+ dawn::Buffer stagingBuffer =
+ utils::CreateBufferFromData(device, data.data(), sizeInBytes, dawn::BufferUsage::CopySrc);
dawn::BindGroup bindGroup = utils::MakeBindGroup(device, bgl, {
{0, buffer, 0, sizeof(transform)},
@@ -360,8 +362,8 @@
{{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f}, {0}, {1.0f, 0.0f, 0.0f, 1.0f}});
for (int i = 0; i < 2; i++) {
- dawn::Buffer buffer = utils::CreateBufferFromData(device, &data[i], sizeof(Data),
- dawn::BufferUsageBit::Uniform);
+ dawn::Buffer buffer =
+ utils::CreateBufferFromData(device, &data[i], sizeof(Data), dawn::BufferUsage::Uniform);
buffers.push_back(buffer);
bindGroups.push_back(utils::MakeBindGroup(device, layout,
{{0, buffers[i], 0, sizeof(Data::transform)},
@@ -441,8 +443,8 @@
pass.SetPipeline(pipeline);
std::array<float, 4> color = { 0.25, 0, 0, 0.25 };
- dawn::Buffer uniformBuffer = utils::CreateBufferFromData(
- device, &color, sizeof(color), dawn::BufferUsageBit::Uniform);
+ dawn::Buffer uniformBuffer =
+ utils::CreateBufferFromData(device, &color, sizeof(color), dawn::BufferUsage::Uniform);
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, layout, { { 0, uniformBuffer, 0, sizeof(color) } });
diff --git a/src/tests/end2end/BufferTests.cpp b/src/tests/end2end/BufferTests.cpp
index d6a5aae..f955270 100644
--- a/src/tests/end2end/BufferTests.cpp
+++ b/src/tests/end2end/BufferTests.cpp
@@ -46,7 +46,7 @@
TEST_P(BufferMapReadTests, SmallReadAtZero) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
uint32_t myData = 0x01020304;
@@ -68,7 +68,7 @@
dawn::BufferDescriptor descriptor;
descriptor.size = static_cast<uint32_t>(kDataSize * sizeof(uint32_t));
- descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
buffer.SetSubData(0, kDataSize * sizeof(uint32_t), myData.data());
@@ -115,7 +115,7 @@
TEST_P(BufferMapWriteTests, SmallWriteAtZero) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
+ descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
uint32_t myData = 2934875;
@@ -136,7 +136,7 @@
dawn::BufferDescriptor descriptor;
descriptor.size = static_cast<uint32_t>(kDataSize * sizeof(uint32_t));
- descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
+ descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
void* mappedData = MapWriteAsyncAndWait(buffer);
@@ -160,7 +160,7 @@
for (uint32_t i = 0; i < kBuffers; ++i) {
dawn::BufferDescriptor descriptor;
descriptor.size = static_cast<uint32_t>(kDataSize * sizeof(uint32_t));
- descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
+ descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
void* mappedData = MapWriteAsyncAndWait(buffer);
@@ -184,7 +184,7 @@
TEST_P(BufferSetSubDataTests, SmallDataAtZero) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
uint32_t value = 0x01020304;
@@ -197,7 +197,7 @@
TEST_P(BufferSetSubDataTests, SmallDataAtOffset) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4000;
- descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
constexpr uint64_t kOffset = 2000;
@@ -222,7 +222,7 @@
constexpr uint32_t kElements = 500 * 500;
dawn::BufferDescriptor descriptor;
descriptor.size = kSize;
- descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
std::vector<uint32_t> expectedData;
@@ -240,7 +240,7 @@
constexpr uint32_t kElements = 1000 * 1000;
dawn::BufferDescriptor descriptor;
descriptor.size = kSize;
- descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
std::vector<uint32_t> expectedData;
@@ -290,7 +290,7 @@
}
}
- dawn::CreateBufferMappedResult CreateBufferMapped(dawn::BufferUsageBit usage, uint64_t size) {
+ dawn::CreateBufferMappedResult CreateBufferMapped(dawn::BufferUsage usage, uint64_t size) {
dawn::BufferDescriptor descriptor;
descriptor.nextInChain = nullptr;
descriptor.size = size;
@@ -301,7 +301,7 @@
return result;
}
- dawn::CreateBufferMappedResult CreateBufferMappedWithData(dawn::BufferUsageBit usage,
+ dawn::CreateBufferMappedResult CreateBufferMappedWithData(dawn::BufferUsage usage,
const std::vector<uint32_t>& data) {
size_t byteLength = data.size() * sizeof(uint32_t);
dawn::CreateBufferMappedResult result = CreateBufferMapped(usage, byteLength);
@@ -311,7 +311,7 @@
}
template <DawnBufferMapAsyncStatus expectedStatus = DAWN_BUFFER_MAP_ASYNC_STATUS_SUCCESS>
- dawn::CreateBufferMappedResult CreateBufferMappedAsyncAndWait(dawn::BufferUsageBit usage,
+ dawn::CreateBufferMappedResult CreateBufferMappedAsyncAndWait(dawn::BufferUsage usage,
uint64_t size) {
dawn::BufferDescriptor descriptor;
descriptor.nextInChain = nullptr;
@@ -346,7 +346,7 @@
}
dawn::CreateBufferMappedResult CreateBufferMappedAsyncWithDataAndWait(
- dawn::BufferUsageBit usage,
+ dawn::BufferUsage usage,
const std::vector<uint32_t>& data) {
size_t byteLength = data.size() * sizeof(uint32_t);
dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncAndWait(usage, byteLength);
@@ -363,7 +363,7 @@
TEST_P(CreateBufferMappedTests, MapWriteUsageSmall) {
uint32_t myData = 230502;
dawn::CreateBufferMappedResult result = CreateBufferMappedWithData(
- dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
+ dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
result.buffer.Unmap();
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
}
@@ -372,7 +372,7 @@
TEST_P(CreateBufferMappedTests, MapReadUsageSmall) {
uint32_t myData = 230502;
dawn::CreateBufferMappedResult result =
- CreateBufferMappedWithData(dawn::BufferUsageBit::MapRead, {myData});
+ CreateBufferMappedWithData(dawn::BufferUsage::MapRead, {myData});
result.buffer.Unmap();
const void* mappedData = MapReadAsyncAndWait(result.buffer);
@@ -384,7 +384,7 @@
TEST_P(CreateBufferMappedTests, NonMappableUsageSmall) {
uint32_t myData = 4239;
dawn::CreateBufferMappedResult result =
- CreateBufferMappedWithData(dawn::BufferUsageBit::CopySrc, {myData});
+ CreateBufferMappedWithData(dawn::BufferUsage::CopySrc, {myData});
result.buffer.Unmap();
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
@@ -399,7 +399,7 @@
}
dawn::CreateBufferMappedResult result = CreateBufferMappedWithData(
- dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
+ dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
result.buffer.Unmap();
EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize);
@@ -414,7 +414,7 @@
}
dawn::CreateBufferMappedResult result =
- CreateBufferMappedWithData(dawn::BufferUsageBit::MapRead, myData);
+ CreateBufferMappedWithData(dawn::BufferUsage::MapRead, myData);
result.buffer.Unmap();
const void* mappedData = MapReadAsyncAndWait(result.buffer);
@@ -431,7 +431,7 @@
}
dawn::CreateBufferMappedResult result =
- CreateBufferMappedWithData(dawn::BufferUsageBit::CopySrc, {myData});
+ CreateBufferMappedWithData(dawn::BufferUsage::CopySrc, {myData});
result.buffer.Unmap();
EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize);
@@ -442,7 +442,7 @@
static uint32_t myData = 230502;
static uint32_t myData2 = 1337;
dawn::CreateBufferMappedResult result = CreateBufferMappedWithData(
- dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
+ dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
result.buffer.Unmap();
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
@@ -470,7 +470,7 @@
TEST_P(CreateBufferMappedTests, CreateThenMapBeforeUnmapFailure) {
uint32_t myData = 230502;
dawn::CreateBufferMappedResult result = CreateBufferMappedWithData(
- dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
+ dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
ASSERT_DEVICE_ERROR([&]() {
bool done = false;
@@ -497,7 +497,7 @@
TEST_P(CreateBufferMappedTests, MapWriteUsageSmallAsync) {
uint32_t myData = 230502;
dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait(
- dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
+ dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
result.buffer.Unmap();
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
}
@@ -506,7 +506,7 @@
TEST_P(CreateBufferMappedTests, MapReadUsageSmallAsync) {
uint32_t myData = 230502;
dawn::CreateBufferMappedResult result =
- CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::MapRead, {myData});
+ CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsage::MapRead, {myData});
result.buffer.Unmap();
const void* mappedData = MapReadAsyncAndWait(result.buffer);
@@ -518,7 +518,7 @@
TEST_P(CreateBufferMappedTests, NonMappableUsageSmallAsync) {
uint32_t myData = 4239;
dawn::CreateBufferMappedResult result =
- CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::CopySrc, {myData});
+ CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsage::CopySrc, {myData});
result.buffer.Unmap();
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
@@ -533,7 +533,7 @@
}
dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait(
- dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
+ dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
result.buffer.Unmap();
EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize);
@@ -548,7 +548,7 @@
}
dawn::CreateBufferMappedResult result =
- CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::MapRead, {myData});
+ CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsage::MapRead, {myData});
result.buffer.Unmap();
const void* mappedData = MapReadAsyncAndWait(result.buffer);
@@ -565,7 +565,7 @@
}
dawn::CreateBufferMappedResult result =
- CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsageBit::CopySrc, {myData});
+ CreateBufferMappedAsyncWithDataAndWait(dawn::BufferUsage::CopySrc, {myData});
result.buffer.Unmap();
EXPECT_BUFFER_U32_RANGE_EQ(myData.data(), result.buffer, 0, kDataSize);
@@ -576,7 +576,7 @@
static uint32_t myData = 230502;
static uint32_t myData2 = 1337;
dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait(
- dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
+ dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
result.buffer.Unmap();
EXPECT_BUFFER_U32_EQ(myData, result.buffer, 0);
@@ -604,7 +604,7 @@
TEST_P(CreateBufferMappedTests, CreateThenMapBeforeUnmapFailureAsync) {
uint32_t myData = 230502;
dawn::CreateBufferMappedResult result = CreateBufferMappedAsyncWithDataAndWait(
- dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc, {myData});
+ dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc, {myData});
ASSERT_DEVICE_ERROR([&]() {
bool done = false;
diff --git a/src/tests/end2end/ClipSpaceTests.cpp b/src/tests/end2end/ClipSpaceTests.cpp
index 6ae480f..b2e8d1f 100644
--- a/src/tests/end2end/ClipSpaceTests.cpp
+++ b/src/tests/end2end/ClipSpaceTests.cpp
@@ -59,7 +59,7 @@
textureDescriptor.dimension = dawn::TextureDimension::e2D;
textureDescriptor.format = format;
textureDescriptor.usage =
- dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
textureDescriptor.arrayLayerCount = 1;
textureDescriptor.mipLevelCount = 1;
textureDescriptor.sampleCount = 1;
diff --git a/src/tests/end2end/ColorStateTests.cpp b/src/tests/end2end/ColorStateTests.cpp
index f217817..ea88230 100644
--- a/src/tests/end2end/ColorStateTests.cpp
+++ b/src/tests/end2end/ColorStateTests.cpp
@@ -101,7 +101,7 @@
uint32_t bufferSize = static_cast<uint32_t>(4 * N * sizeof(float));
dawn::Buffer buffer =
- utils::CreateBufferFromData(device, &data, bufferSize, dawn::BufferUsageBit::Uniform);
+ utils::CreateBufferFromData(device, &data, bufferSize, dawn::BufferUsage::Uniform);
return utils::MakeBindGroup(device, bindGroupLayout, {{0, buffer, 0, bufferSize}});
}
@@ -762,7 +762,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
for (uint32_t i = 0; i < 4; ++i) {
renderTargets[i] = device.CreateTexture(&descriptor);
diff --git a/src/tests/end2end/CompressedTextureFormatTests.cpp b/src/tests/end2end/CompressedTextureFormatTests.cpp
index d13f616..75acffb 100644
--- a/src/tests/end2end/CompressedTextureFormatTests.cpp
+++ b/src/tests/end2end/CompressedTextureFormatTests.cpp
@@ -93,7 +93,7 @@
// Copy texture data from a staging buffer to the destination texture.
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
- device, uploadData.data(), uploadBufferSize, dawn::BufferUsageBit::CopySrc);
+ device, uploadData.data(), uploadBufferSize, dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView =
utils::CreateBufferCopyView(stagingBuffer, copyConfig.bufferOffset,
copyConfig.rowPitchAlignment, copyConfig.imageHeight);
@@ -449,8 +449,8 @@
static constexpr uint32_t kBCBlockWidthInTexels = 4;
static constexpr uint32_t kBCBlockHeightInTexels = 4;
- static constexpr dawn::TextureUsageBit kDefaultBCFormatTextureUsage =
- dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::CopyDst;
+ static constexpr dawn::TextureUsage kDefaultBCFormatTextureUsage =
+ dawn::TextureUsage::Sampled | dawn::TextureUsage::CopyDst;
dawn::BindGroupLayout mBindGroupLayout;
@@ -633,9 +633,8 @@
config.textureDescriptor.format = format;
// Add the usage bit for both source and destination textures so that we don't need to
// create two copy configs.
- config.textureDescriptor.usage = dawn::TextureUsageBit::CopySrc |
- dawn::TextureUsageBit::CopyDst |
- dawn::TextureUsageBit::Sampled;
+ config.textureDescriptor.usage =
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
dawn::Texture bcTextureSrc = CreateTextureWithCompressedData(config);
@@ -695,7 +694,7 @@
// compressed data.
srcConfig.textureDescriptor.format = format;
srcConfig.textureDescriptor.usage =
- dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
dawn::Texture bcTextureSrc = CreateTextureWithCompressedData(srcConfig);
dawn::TextureCopyView textureCopyViewSrc =
utils::CreateTextureCopyView(bcTextureSrc, srcConfig.viewMipmapLevel,
@@ -755,7 +754,7 @@
for (dawn::TextureFormat format : kBCFormats) {
srcConfig.textureDescriptor.format = dstConfig.textureDescriptor.format = format;
srcConfig.textureDescriptor.usage =
- dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
dstConfig.textureDescriptor.usage = kDefaultBCFormatTextureUsage;
// Create bcTextureSrc as the source texture and initialize it with pre-prepared BC
@@ -828,7 +827,7 @@
srcConfigs[i].textureDescriptor.format = dstConfigs[i].textureDescriptor.format =
format;
srcConfigs[i].textureDescriptor.usage =
- dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
dstConfigs[i].textureDescriptor.usage = kDefaultBCFormatTextureUsage;
// Create bcSrcTextures as the source textures and initialize them with pre-prepared BC
diff --git a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp
index 414f0ea..b491e4e 100644
--- a/src/tests/end2end/ComputeCopyStorageBufferTests.cpp
+++ b/src/tests/end2end/ComputeCopyStorageBufferTests.cpp
@@ -51,8 +51,8 @@
// Set up src storage buffer
dawn::BufferDescriptor srcDesc;
srcDesc.size = kNumUints * sizeof(uint32_t);
- srcDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc |
- dawn::BufferUsageBit::CopyDst;
+ srcDesc.usage =
+ dawn::BufferUsage::Storage | dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer src = device.CreateBuffer(&srcDesc);
std::array<uint32_t, kNumUints> expected;
@@ -65,8 +65,8 @@
// Set up dst storage buffer
dawn::BufferDescriptor dstDesc;
dstDesc.size = kNumUints * sizeof(uint32_t);
- dstDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc |
- dawn::BufferUsageBit::CopyDst;
+ dstDesc.usage =
+ dawn::BufferUsage::Storage | dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer dst = device.CreateBuffer(&dstDesc);
std::array<uint32_t, kNumUints> zero{};
diff --git a/src/tests/end2end/ComputeIndirectTests.cpp b/src/tests/end2end/ComputeIndirectTests.cpp
index 03e7b57..069a37c 100644
--- a/src/tests/end2end/ComputeIndirectTests.cpp
+++ b/src/tests/end2end/ComputeIndirectTests.cpp
@@ -67,20 +67,19 @@
dawn::ComputePipeline pipeline = device.CreateComputePipeline(&csDesc);
// Set up dst storage buffer to contain dispatch x, y, z
- dawn::Buffer dst = utils::CreateBufferFromData<uint32_t>(device,
- dawn::BufferUsageBit::Storage |
- dawn::BufferUsageBit::CopySrc |
- dawn::BufferUsageBit::CopyDst,
- {0, 0, 0});
+ dawn::Buffer dst = utils::CreateBufferFromData<uint32_t>(
+ device,
+ dawn::BufferUsage::Storage | dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst,
+ {0, 0, 0});
std::vector<uint32_t> indirectBufferData = bufferList;
dawn::Buffer indirectBuffer =
- utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsageBit::Indirect, bufferList);
+ utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Indirect, bufferList);
dawn::Buffer expectedBuffer =
utils::CreateBufferFromData(device, &indirectBufferData[indirectOffset / sizeof(uint32_t)],
- 3 * sizeof(uint32_t), dawn::BufferUsageBit::Uniform);
+ 3 * sizeof(uint32_t), dawn::BufferUsage::Uniform);
// Set up bind group and issue dispatch
dawn::BindGroup bindGroup =
diff --git a/src/tests/end2end/ComputeSharedMemoryTests.cpp b/src/tests/end2end/ComputeSharedMemoryTests.cpp
index ba56613..a541921 100644
--- a/src/tests/end2end/ComputeSharedMemoryTests.cpp
+++ b/src/tests/end2end/ComputeSharedMemoryTests.cpp
@@ -48,8 +48,8 @@
// Set up dst storage buffer
dawn::BufferDescriptor dstDesc;
dstDesc.size = sizeof(uint32_t);
- dstDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc |
- dawn::BufferUsageBit::CopyDst;
+ dstDesc.usage =
+ dawn::BufferUsage::Storage | dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer dst = device.CreateBuffer(&dstDesc);
const uint32_t zero = 0;
diff --git a/src/tests/end2end/CopyTests.cpp b/src/tests/end2end/CopyTests.cpp
index f6df0ff..6c318cb 100644
--- a/src/tests/end2end/CopyTests.cpp
+++ b/src/tests/end2end/CopyTests.cpp
@@ -85,7 +85,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = textureSpec.level + 1;
- descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::CopySrc;
dawn::Texture texture = device.CreateTexture(&descriptor);
uint32_t width = textureSpec.width >> textureSpec.level;
@@ -106,7 +106,7 @@
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
device, textureArrayData[slice].data(),
static_cast<uint32_t>(sizeof(RGBA8) * textureArrayData[slice].size()),
- dawn::BufferUsageBit::CopySrc);
+ dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView =
utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0);
dawn::TextureCopyView textureCopyView =
@@ -120,7 +120,7 @@
// 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::CopySrc | dawn::BufferUsageBit::CopyDst;
+ bufDescriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::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)),
@@ -182,7 +182,7 @@
// Create a buffer of size `size` and populate it with data
dawn::BufferDescriptor bufDescriptor;
bufDescriptor.size = bufferSpec.size;
- bufDescriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ bufDescriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer buffer = device.CreateBuffer(&bufDescriptor);
std::vector<RGBA8> bufferData(bufferSpec.size / kBytesPerTexel);
@@ -200,7 +200,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = textureSpec.level + 1;
- descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::CopySrc;
dawn::Texture texture = device.CreateTexture(&descriptor);
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -218,7 +218,7 @@
std::vector<RGBA8> emptyData(texelCount);
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
device, emptyData.data(), static_cast<uint32_t>(sizeof(RGBA8) * emptyData.size()),
- dawn::BufferUsageBit::CopySrc);
+ dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView =
utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0);
dawn::TextureCopyView textureCopyView =
@@ -281,7 +281,7 @@
srcDescriptor.sampleCount = 1;
srcDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
srcDescriptor.mipLevelCount = srcSpec.level + 1;
- srcDescriptor.usage = dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
+ srcDescriptor.usage = dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
dawn::TextureDescriptor dstDescriptor;
@@ -293,7 +293,7 @@
dstDescriptor.sampleCount = 1;
dstDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
dstDescriptor.mipLevelCount = dstSpec.level + 1;
- dstDescriptor.usage = dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
+ dstDescriptor.usage = dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor);
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -315,7 +315,7 @@
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
device, textureArrayData[slice].data(),
static_cast<uint32_t>(sizeof(RGBA8) * textureArrayData[slice].size()),
- dawn::BufferUsageBit::CopySrc);
+ dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView =
utils::CreateBufferCopyView(uploadBuffer, 0, rowPitch, 0);
dawn::TextureCopyView textureCopyView =
@@ -339,7 +339,7 @@
std::vector<RGBA8> emptyData(dstTexelCount);
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(
device, emptyData.data(), static_cast<uint32_t>(sizeof(RGBA8) * emptyData.size()),
- dawn::BufferUsageBit::CopySrc);
+ dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView =
utils::CreateBufferCopyView(uploadBuffer, 0, dstRowPitch, 0);
dawn::TextureCopyView textureCopyView =
diff --git a/src/tests/end2end/CullingTests.cpp b/src/tests/end2end/CullingTests.cpp
index e6c24b6..75c29d1 100644
--- a/src/tests/end2end/CullingTests.cpp
+++ b/src/tests/end2end/CullingTests.cpp
@@ -63,7 +63,7 @@
textureDescriptor.dimension = dawn::TextureDimension::e2D;
textureDescriptor.format = format;
textureDescriptor.usage =
- dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
textureDescriptor.arrayLayerCount = 1;
textureDescriptor.mipLevelCount = 1;
textureDescriptor.sampleCount = 1;
diff --git a/src/tests/end2end/DepthStencilStateTests.cpp b/src/tests/end2end/DepthStencilStateTests.cpp
index 22fa65d..f743d3d 100644
--- a/src/tests/end2end/DepthStencilStateTests.cpp
+++ b/src/tests/end2end/DepthStencilStateTests.cpp
@@ -35,7 +35,7 @@
renderTargetDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
renderTargetDescriptor.mipLevelCount = 1;
renderTargetDescriptor.usage =
- dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
renderTarget = device.CreateTexture(&renderTargetDescriptor);
renderTargetView = renderTarget.CreateDefaultView();
@@ -49,7 +49,7 @@
depthDescriptor.sampleCount = 1;
depthDescriptor.format = dawn::TextureFormat::Depth24PlusStencil8;
depthDescriptor.mipLevelCount = 1;
- depthDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
+ depthDescriptor.usage = dawn::TextureUsage::OutputAttachment;
depthTexture = device.CreateTexture(&depthDescriptor);
depthTextureView = depthTexture.CreateDefaultView();
@@ -265,7 +265,8 @@
test.depth,
};
// Upload a buffer for each triangle's depth and color data
- dawn::Buffer buffer = utils::CreateBufferFromData(device, &data, sizeof(TriangleData), dawn::BufferUsageBit::Uniform);
+ dawn::Buffer buffer = utils::CreateBufferFromData(
+ device, &data, sizeof(TriangleData), dawn::BufferUsage::Uniform);
// Create a bind group for the data
dawn::BindGroup bindGroup = utils::MakeBindGroup(device, bindGroupLayout, {{0, buffer, 0, sizeof(TriangleData)}});
diff --git a/src/tests/end2end/DestroyTests.cpp b/src/tests/end2end/DestroyTests.cpp
index fdd968f..7a9af70 100644
--- a/src/tests/end2end/DestroyTests.cpp
+++ b/src/tests/end2end/DestroyTests.cpp
@@ -55,7 +55,7 @@
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>(
- device, dawn::BufferUsageBit::Vertex,
+ device, dawn::BufferUsage::Vertex,
{// The bottom left triangle
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f});
diff --git a/src/tests/end2end/DrawIndexedIndirectTests.cpp b/src/tests/end2end/DrawIndexedIndirectTests.cpp
index d9d24a6..41d5e58 100644
--- a/src/tests/end2end/DrawIndexedIndirectTests.cpp
+++ b/src/tests/end2end/DrawIndexedIndirectTests.cpp
@@ -55,7 +55,7 @@
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>(
- device, dawn::BufferUsageBit::Vertex,
+ device, dawn::BufferUsage::Vertex,
{// First quad: the first 3 vertices represent the bottom left triangle
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f,
0.0f, 1.0f,
@@ -64,7 +64,7 @@
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 1.0f,
0.0f, 1.0f});
indexBuffer = utils::CreateBufferFromData<uint32_t>(
- device, dawn::BufferUsageBit::Index,
+ device, dawn::BufferUsage::Index,
{0, 1, 2, 0, 3, 1,
// The indices below are added to test negatve baseVertex
0 + 4, 1 + 4, 2 + 4, 0 + 4, 3 + 4, 1 + 4});
@@ -80,8 +80,8 @@
uint64_t indirectOffset,
RGBA8 bottomLeftExpected,
RGBA8 topRightExpected) {
- dawn::Buffer indirectBuffer = utils::CreateBufferFromData<uint32_t>(
- device, dawn::BufferUsageBit::Indirect, bufferList);
+ dawn::Buffer indirectBuffer =
+ utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Indirect, bufferList);
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
diff --git a/src/tests/end2end/DrawIndexedTests.cpp b/src/tests/end2end/DrawIndexedTests.cpp
index 41b1afb..6f8c38b 100644
--- a/src/tests/end2end/DrawIndexedTests.cpp
+++ b/src/tests/end2end/DrawIndexedTests.cpp
@@ -54,21 +54,17 @@
pipeline = device.CreateRenderPipeline(&descriptor);
- vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
- // First quad: the first 3 vertices represent the bottom left triangle
- -1.0f, -1.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 0.0f, 1.0f,
- -1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, -1.0f, 0.0f, 1.0f,
+ vertexBuffer = utils::CreateBufferFromData<float>(
+ device, dawn::BufferUsage::Vertex,
+ {// First quad: the first 3 vertices represent the bottom left triangle
+ -1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, 1.0f,
+ -1.0f, 0.0f, 1.0f,
// Second quad: the first 3 vertices represent the top right triangle
- -1.0f, -1.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, -1.0f, 0.0f, 1.0f,
- -1.0f, 1.0f, 0.0f, 1.0f
- });
+ -1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, -1.0f,
+ 1.0f, 0.0f, 1.0f});
indexBuffer = utils::CreateBufferFromData<uint32_t>(
- device, dawn::BufferUsageBit::Index,
+ device, dawn::BufferUsage::Index,
{0, 1, 2, 0, 3, 1,
// The indices below are added to test negatve baseVertex
0 + 4, 1 + 4, 2 + 4, 0 + 4, 3 + 4, 1 + 4});
diff --git a/src/tests/end2end/DrawIndirectTests.cpp b/src/tests/end2end/DrawIndirectTests.cpp
index acfad3f..538b8ef 100644
--- a/src/tests/end2end/DrawIndirectTests.cpp
+++ b/src/tests/end2end/DrawIndirectTests.cpp
@@ -55,7 +55,7 @@
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>(
- device, dawn::BufferUsageBit::Vertex,
+ device, dawn::BufferUsage::Vertex,
{// The bottom left triangle
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f,
@@ -71,8 +71,8 @@
uint64_t indirectOffset,
RGBA8 bottomLeftExpected,
RGBA8 topRightExpected) {
- dawn::Buffer indirectBuffer = utils::CreateBufferFromData<uint32_t>(
- device, dawn::BufferUsageBit::Indirect, bufferList);
+ dawn::Buffer indirectBuffer =
+ utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Indirect, bufferList);
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
diff --git a/src/tests/end2end/DrawTests.cpp b/src/tests/end2end/DrawTests.cpp
index 44a354f..b9b4d2d 100644
--- a/src/tests/end2end/DrawTests.cpp
+++ b/src/tests/end2end/DrawTests.cpp
@@ -55,7 +55,7 @@
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>(
- device, dawn::BufferUsageBit::Vertex,
+ device, dawn::BufferUsage::Vertex,
{// The bottom left triangle
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f,
diff --git a/src/tests/end2end/DynamicBufferOffsetTests.cpp b/src/tests/end2end/DynamicBufferOffsetTests.cpp
index 3c6dacc..8df6524 100644
--- a/src/tests/end2end/DynamicBufferOffsetTests.cpp
+++ b/src/tests/end2end/DynamicBufferOffsetTests.cpp
@@ -34,20 +34,19 @@
uniformData[1] = 2;
mUniformBuffers[0] = utils::CreateBufferFromData(device, uniformData.data(), kBufferSize,
- dawn::BufferUsageBit::Uniform);
+ dawn::BufferUsage::Uniform);
uniformData[uniformData.size() - 2] = 5;
uniformData[uniformData.size() - 1] = 6;
// Dynamic uniform buffer
mUniformBuffers[1] = utils::CreateBufferFromData(device, uniformData.data(), kBufferSize,
- dawn::BufferUsageBit::Uniform);
+ dawn::BufferUsage::Uniform);
dawn::BufferDescriptor storageBufferDescriptor;
storageBufferDescriptor.size = kBufferSize;
- storageBufferDescriptor.usage = dawn::BufferUsageBit::Storage |
- dawn::BufferUsageBit::CopyDst |
- dawn::BufferUsageBit::CopySrc;
+ storageBufferDescriptor.usage =
+ dawn::BufferUsage::Storage | dawn::BufferUsage::CopyDst | dawn::BufferUsage::CopySrc;
mStorageBuffers[0] = device.CreateBuffer(&storageBufferDescriptor);
@@ -74,7 +73,7 @@
// Extra uniform buffer for inheriting test
mUniformBuffers[2] = utils::CreateBufferFromData(device, uniformData.data(), kBufferSize,
- dawn::BufferUsageBit::Uniform);
+ dawn::BufferUsage::Uniform);
// Bind group layout for inheriting test
mBindGroupLayouts[1] = utils::MakeBindGroupLayout(
diff --git a/src/tests/end2end/IOSurfaceWrappingTests.cpp b/src/tests/end2end/IOSurfaceWrappingTests.cpp
index c475026..4696adc 100644
--- a/src/tests/end2end/IOSurfaceWrappingTests.cpp
+++ b/src/tests/end2end/IOSurfaceWrappingTests.cpp
@@ -118,7 +118,7 @@
descriptor.sampleCount = 1;
descriptor.arrayLayerCount = 1;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment;
}
protected:
@@ -248,7 +248,7 @@
textureDescriptor.sampleCount = 1;
textureDescriptor.arrayLayerCount = 1;
textureDescriptor.mipLevelCount = 1;
- textureDescriptor.usage = dawn::TextureUsageBit::Sampled;
+ textureDescriptor.usage = dawn::TextureUsage::Sampled;
dawn::Texture wrappingTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
dawn::TextureView textureView = wrappingTexture.CreateDefaultView();
@@ -341,7 +341,7 @@
textureDescriptor.sampleCount = 1;
textureDescriptor.arrayLayerCount = 1;
textureDescriptor.mipLevelCount = 1;
- textureDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
+ textureDescriptor.usage = dawn::TextureUsage::OutputAttachment;
dawn::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
dawn::TextureView ioSurfaceView = ioSurfaceTexture.CreateDefaultView();
diff --git a/src/tests/end2end/IndexFormatTests.cpp b/src/tests/end2end/IndexFormatTests.cpp
index 3e4fedc..1aa725f 100644
--- a/src/tests/end2end/IndexFormatTests.cpp
+++ b/src/tests/end2end/IndexFormatTests.cpp
@@ -66,16 +66,13 @@
TEST_P(IndexFormatTest, Uint32) {
dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint32);
- dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
- -1.0f, 1.0f, 0.0f, 1.0f, // Note Vertices[0] = Vertices[1]
- -1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 0.0f, 1.0f,
- -1.0f, -1.0f, 0.0f, 1.0f
- });
+ dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
+ device, dawn::BufferUsage::Vertex,
+ {-1.0f, 1.0f, 0.0f, 1.0f, // Note Vertices[0] = Vertices[1]
+ -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f});
// If this is interpreted as Uint16, then it would be 0, 1, 0, ... and would draw nothing.
- dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsageBit::Index, {
- 1, 2, 3
- });
+ dawn::Buffer indexBuffer =
+ utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Index, {1, 2, 3});
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -98,15 +95,12 @@
TEST_P(IndexFormatTest, Uint16) {
dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint16);
- dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
- -1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 0.0f, 1.0f,
- -1.0f, -1.0f, 0.0f, 1.0f
- });
+ dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
+ device, dawn::BufferUsage::Vertex,
+ {-1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f});
// If this is interpreted as uint32, it will have index 1 and 2 be both 0 and render nothing
- dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint16_t>(device, dawn::BufferUsageBit::Index, {
- 1, 2, 0, 0, 0, 0
- });
+ dawn::Buffer indexBuffer =
+ utils::CreateBufferFromData<uint16_t>(device, dawn::BufferUsage::Index, {1, 2, 0, 0, 0, 0});
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -141,16 +135,23 @@
TEST_P(IndexFormatTest, Uint32PrimitiveRestart) {
dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint32);
- dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
- 0.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 0.0f, 1.0f,
- 0.0f, -1.0f, 0.0f, 1.0f,
- -1.0f, -1.0f, 0.0f, 1.0f,
- });
- dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsageBit::Index, {
- 0, 1, 2, 0xFFFFFFFFu, 3, 4, 2,
- });
+ dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
+ device, dawn::BufferUsage::Vertex,
+ {
+ 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f,
+ });
+ dawn::Buffer indexBuffer =
+ utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Index,
+ {
+ 0,
+ 1,
+ 2,
+ 0xFFFFFFFFu,
+ 3,
+ 4,
+ 2,
+ });
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -175,18 +176,25 @@
TEST_P(IndexFormatTest, Uint16PrimitiveRestart) {
dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint16);
- dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
- 0.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 0.0f, 1.0f,
- 0.0f, -1.0f, 0.0f, 1.0f,
- -1.0f, -1.0f, 0.0f, 1.0f,
- });
- dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint16_t>(device, dawn::BufferUsageBit::Index, {
- 0, 1, 2, 0xFFFFu, 3, 4, 2,
- // This value is for padding.
- 0xFFFFu,
- });
+ dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
+ device, dawn::BufferUsage::Vertex,
+ {
+ 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f,
+ });
+ dawn::Buffer indexBuffer =
+ utils::CreateBufferFromData<uint16_t>(device, dawn::BufferUsage::Index,
+ {
+ 0,
+ 1,
+ 2,
+ 0xFFFFu,
+ 3,
+ 4,
+ 2,
+ // This value is for padding.
+ 0xFFFFu,
+ });
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -216,16 +224,13 @@
dawn::RenderPipeline pipeline32 = MakeTestPipeline(dawn::IndexFormat::Uint32);
dawn::RenderPipeline pipeline16 = MakeTestPipeline(dawn::IndexFormat::Uint16);
- dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
- -1.0f, 1.0f, 0.0f, 1.0f, // Note Vertices[0] = Vertices[1]
- -1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 0.0f, 1.0f,
- -1.0f, -1.0f, 0.0f, 1.0f
- });
+ dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
+ device, dawn::BufferUsage::Vertex,
+ {-1.0f, 1.0f, 0.0f, 1.0f, // Note Vertices[0] = Vertices[1]
+ -1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f});
// If this is interpreted as Uint16, then it would be 0, 1, 0, ... and would draw nothing.
- dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsageBit::Index, {
- 1, 2, 3
- });
+ dawn::Buffer indexBuffer =
+ utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Index, {1, 2, 3});
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -253,14 +258,11 @@
TEST_P(IndexFormatTest, DISABLED_SetIndexBufferBeforeSetPipeline) {
dawn::RenderPipeline pipeline = MakeTestPipeline(dawn::IndexFormat::Uint32);
- dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(device, dawn::BufferUsageBit::Vertex, {
- -1.0f, 1.0f, 0.0f, 1.0f,
- 1.0f, 1.0f, 0.0f, 1.0f,
- -1.0f, -1.0f, 0.0f, 1.0f
- });
- dawn::Buffer indexBuffer = utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsageBit::Index, {
- 0, 1, 2
- });
+ dawn::Buffer vertexBuffer = utils::CreateBufferFromData<float>(
+ device, dawn::BufferUsage::Vertex,
+ {-1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 1.0f});
+ dawn::Buffer indexBuffer =
+ utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Index, {0, 1, 2});
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
diff --git a/src/tests/end2end/MultisampledRenderingTests.cpp b/src/tests/end2end/MultisampledRenderingTests.cpp
index 07b1a80..2285975 100644
--- a/src/tests/end2end/MultisampledRenderingTests.cpp
+++ b/src/tests/end2end/MultisampledRenderingTests.cpp
@@ -95,7 +95,7 @@
descriptor.sampleCount = sampleCount;
descriptor.format = format;
descriptor.mipLevelCount = mipLevelCount;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
return device.CreateTexture(&descriptor);
}
@@ -104,9 +104,8 @@
const dawn::RenderPipeline& pipeline,
const float* uniformData,
uint32_t uniformDataSize) {
- dawn::Buffer uniformBuffer =
- utils::CreateBufferFromData(device, uniformData, uniformDataSize,
- dawn::BufferUsageBit::Uniform);
+ dawn::Buffer uniformBuffer = utils::CreateBufferFromData(
+ device, uniformData, uniformDataSize, dawn::BufferUsage::Uniform);
dawn::BindGroup bindGroup =
utils::MakeBindGroup(device, mBindGroupLayout,
{{0, uniformBuffer, 0, uniformDataSize}});
diff --git a/src/tests/end2end/NonzeroTextureCreationTests.cpp b/src/tests/end2end/NonzeroTextureCreationTests.cpp
index 02497da..cbd54ef 100644
--- a/src/tests/end2end/NonzeroTextureCreationTests.cpp
+++ b/src/tests/end2end/NonzeroTextureCreationTests.cpp
@@ -37,7 +37,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
dawn::Texture texture = device.CreateTexture(&descriptor);
RGBA8 filledWithOnes(255, 255, 255, 255);
@@ -57,7 +57,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = mipLevels;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
dawn::Texture texture = device.CreateTexture(&descriptor);
std::vector<RGBA8> expected;
@@ -82,7 +82,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
dawn::Texture texture = device.CreateTexture(&descriptor);
std::vector<RGBA8> expected;
@@ -107,14 +107,14 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Snorm;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::CopySrc;
dawn::Texture texture = device.CreateTexture(&descriptor);
// Set buffer with dirty data so we know it is cleared by the lazy cleared texture copy
uint32_t bufferSize = 4 * kSize * kSize;
std::vector<uint8_t> data(bufferSize, 100);
dawn::Buffer bufferDst = utils::CreateBufferFromData(
- device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::CopySrc);
+ device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, 0, 0);
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
diff --git a/src/tests/end2end/OpArrayLengthTests.cpp b/src/tests/end2end/OpArrayLengthTests.cpp
index be402ea..7a28ed7 100644
--- a/src/tests/end2end/OpArrayLengthTests.cpp
+++ b/src/tests/end2end/OpArrayLengthTests.cpp
@@ -26,7 +26,7 @@
// Create buffers of various size to check the length() implementation
dawn::BufferDescriptor bufferDesc;
bufferDesc.size = 4;
- bufferDesc.usage = dawn::BufferUsageBit::Storage;
+ bufferDesc.usage = dawn::BufferUsage::Storage;
mStorageBuffer4 = device.CreateBuffer(&bufferDesc);
bufferDesc.size = 256;
@@ -95,7 +95,7 @@
// Create a buffer to hold the result sizes and create a bindgroup for it.
dawn::BufferDescriptor bufferDesc;
- bufferDesc.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::CopySrc;
+ bufferDesc.usage = dawn::BufferUsage::Storage | dawn::BufferUsage::CopySrc;
bufferDesc.size = sizeof(uint32_t) * mExpectedLengths.size();
dawn::Buffer resultBuffer = device.CreateBuffer(&bufferDesc);
diff --git a/src/tests/end2end/PrimitiveTopologyTests.cpp b/src/tests/end2end/PrimitiveTopologyTests.cpp
index 3d966bd..322028f 100644
--- a/src/tests/end2end/PrimitiveTopologyTests.cpp
+++ b/src/tests/end2end/PrimitiveTopologyTests.cpp
@@ -165,7 +165,8 @@
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
})");
- vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices), dawn::BufferUsageBit::Vertex);
+ vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
+ dawn::BufferUsage::Vertex);
}
struct LocationSpec {
diff --git a/src/tests/end2end/RenderBundleTests.cpp b/src/tests/end2end/RenderBundleTests.cpp
index ad2dd3c..7b7a55e 100644
--- a/src/tests/end2end/RenderBundleTests.cpp
+++ b/src/tests/end2end/RenderBundleTests.cpp
@@ -59,9 +59,9 @@
kColors[1].a / 255.f};
dawn::Buffer buffer0 = utils::CreateBufferFromData(device, colors0, 4 * sizeof(float),
- dawn::BufferUsageBit::Uniform);
+ dawn::BufferUsage::Uniform);
dawn::Buffer buffer1 = utils::CreateBufferFromData(device, colors1, 4 * sizeof(float),
- dawn::BufferUsageBit::Uniform);
+ dawn::BufferUsage::Uniform);
bindGroups[0] = utils::MakeBindGroup(device, bgl, {{0, buffer0, 0, 4 * sizeof(float)}});
bindGroups[1] = utils::MakeBindGroup(device, bgl, {{0, buffer1, 0, 4 * sizeof(float)}});
@@ -86,7 +86,7 @@
pipeline = device.CreateRenderPipeline(&descriptor);
vertexBuffer = utils::CreateBufferFromData<float>(
- device, dawn::BufferUsageBit::Vertex,
+ device, dawn::BufferUsage::Vertex,
{// The bottom left triangle
-1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f,
diff --git a/src/tests/end2end/RenderPassLoadOpTests.cpp b/src/tests/end2end/RenderPassLoadOpTests.cpp
index 0b04cab..edaed78 100644
--- a/src/tests/end2end/RenderPassLoadOpTests.cpp
+++ b/src/tests/end2end/RenderPassLoadOpTests.cpp
@@ -66,8 +66,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
- descriptor.usage =
- dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
renderTarget = device.CreateTexture(&descriptor);
renderTargetView = renderTarget.CreateDefaultView();
diff --git a/src/tests/end2end/RenderPassTests.cpp b/src/tests/end2end/RenderPassTests.cpp
index b0e5f53..bea5116 100644
--- a/src/tests/end2end/RenderPassTests.cpp
+++ b/src/tests/end2end/RenderPassTests.cpp
@@ -62,7 +62,7 @@
descriptor.sampleCount = 1;
descriptor.format = kFormat;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
return device.CreateTexture(&descriptor);
}
diff --git a/src/tests/end2end/SamplerTests.cpp b/src/tests/end2end/SamplerTests.cpp
index 7eaf389..deb1783 100644
--- a/src/tests/end2end/SamplerTests.cpp
+++ b/src/tests/end2end/SamplerTests.cpp
@@ -90,7 +90,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled;
+ descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
dawn::Texture texture = device.CreateTexture(&descriptor);
// Create a 2x2 checkerboard texture, with black in the top left and bottom right corners.
@@ -102,7 +102,7 @@
data[1] = data[rowPixels] = white;
dawn::Buffer stagingBuffer =
- utils::CreateBufferFromData(device, data, sizeof(data), dawn::BufferUsageBit::CopySrc);
+ utils::CreateBufferFromData(device, data, sizeof(data), dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 256, 0);
dawn::TextureCopyView textureCopyView =
utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
diff --git a/src/tests/end2end/TextureFormatTests.cpp b/src/tests/end2end/TextureFormatTests.cpp
index 79029cf..8df676b 100644
--- a/src/tests/end2end/TextureFormatTests.cpp
+++ b/src/tests/end2end/TextureFormatTests.cpp
@@ -245,20 +245,19 @@
// Create the texture we will sample from
dawn::TextureDescriptor sampleTextureDesc;
- sampleTextureDesc.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled;
+ sampleTextureDesc.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
sampleTextureDesc.size = {width, 1, 1};
sampleTextureDesc.format = sampleFormatInfo.format;
dawn::Texture sampleTexture = device.CreateTexture(&sampleTextureDesc);
dawn::Buffer uploadBuffer = utils::CreateBufferFromData(device, sampleData, sampleDataSize,
- dawn::BufferUsageBit::CopySrc);
+ dawn::BufferUsage::CopySrc);
// Create the texture that we will render results to
ASSERT(expectedRenderDataSize == width * renderFormatInfo.texelByteSize);
dawn::TextureDescriptor renderTargetDesc;
- renderTargetDesc.usage =
- dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::OutputAttachment;
+ renderTargetDesc.usage = dawn::TextureUsage::CopySrc | dawn::TextureUsage::OutputAttachment;
renderTargetDesc.size = {width, 1, 1};
renderTargetDesc.format = renderFormatInfo.format;
@@ -266,7 +265,7 @@
// Create the readback buffer for the data in renderTarget
dawn::BufferDescriptor readbackBufferDesc;
- readbackBufferDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::CopySrc;
+ readbackBufferDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::CopySrc;
readbackBufferDesc.size = 4 * width * sampleFormatInfo.componentCount;
dawn::Buffer readbackBuffer = device.CreateBuffer(&readbackBufferDesc);
diff --git a/src/tests/end2end/TextureViewTests.cpp b/src/tests/end2end/TextureViewTests.cpp
index 4697dbd..9c636a9 100644
--- a/src/tests/end2end/TextureViewTests.cpp
+++ b/src/tests/end2end/TextureViewTests.cpp
@@ -32,7 +32,7 @@
uint32_t height,
uint32_t arrayLayerCount,
uint32_t mipLevelCount,
- dawn::TextureUsageBit usage) {
+ dawn::TextureUsage usage) {
dawn::TextureDescriptor descriptor;
descriptor.dimension = dawn::TextureDimension::e2D;
descriptor.size.width = width;
@@ -114,8 +114,8 @@
const uint32_t textureWidthLevel0 = 1 << mipLevelCount;
const uint32_t textureHeightLevel0 = 1 << mipLevelCount;
- constexpr dawn::TextureUsageBit kUsage =
- dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::Sampled;
+ constexpr dawn::TextureUsage kUsage =
+ dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
mTexture = Create2DTexture(
device, textureWidthLevel0, textureHeightLevel0, arrayLayerCount, mipLevelCount, kUsage);
@@ -143,9 +143,8 @@
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::CopySrc);
+ dawn::Buffer stagingBuffer = utils::CreateBufferFromData(
+ device, data.data(), data.size() * sizeof(RGBA8), dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView =
utils::CreateBufferCopyView(stagingBuffer, 0, kTextureRowPitchAlignment, 0);
dawn::TextureCopyView textureCopyView =
@@ -474,8 +473,8 @@
const uint32_t textureWidthLevel0 = 1 << levelCount;
const uint32_t textureHeightLevel0 = 1 << levelCount;
- constexpr dawn::TextureUsageBit kUsage =
- dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ constexpr dawn::TextureUsage kUsage =
+ dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
dawn::Texture texture = Create2DTexture(
device, textureWidthLevel0, textureHeightLevel0, layerCount, levelCount, kUsage);
diff --git a/src/tests/end2end/TextureZeroInitTests.cpp b/src/tests/end2end/TextureZeroInitTests.cpp
index 9655f45..60a181b 100644
--- a/src/tests/end2end/TextureZeroInitTests.cpp
+++ b/src/tests/end2end/TextureZeroInitTests.cpp
@@ -24,7 +24,7 @@
}
dawn::TextureDescriptor CreateTextureDescriptor(uint32_t mipLevelCount,
uint32_t arrayLayerCount,
- dawn::TextureUsageBit usage,
+ dawn::TextureUsage usage,
dawn::TextureFormat format) {
dawn::TextureDescriptor descriptor;
descriptor.dimension = dawn::TextureDimension::e2D;
@@ -93,8 +93,7 @@
// 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::CopySrc,
- kColorFormat);
+ 1, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc, kColorFormat);
dawn::Texture texture = device.CreateTexture(&descriptor);
// Texture's first usage is in EXPECT_PIXEL_RGBA8_EQ's call to CopyTextureToBuffer
@@ -106,8 +105,7 @@
// This goes through the BeginRenderPass's code path
TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) {
dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
- 4, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
- kColorFormat);
+ 4, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc, kColorFormat);
dawn::Texture texture = device.CreateTexture(&descriptor);
dawn::TextureViewDescriptor viewDescriptor = CreateTextureViewDescriptor(2, 0);
@@ -135,8 +133,7 @@
// This goes through the BeginRenderPass's code path
TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) {
dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
- 1, 4, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
- kColorFormat);
+ 1, 4, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc, kColorFormat);
dawn::Texture texture = device.CreateTexture(&descriptor);
dawn::TextureViewDescriptor viewDescriptor = CreateTextureViewDescriptor(0, 2);
@@ -162,16 +159,15 @@
// 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::CopyDst | dawn::TextureUsageBit::Sampled |
- dawn::TextureUsageBit::CopySrc,
- kColorFormat);
+ dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
+ 4, 1,
+ dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled | dawn::TextureUsage::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::CopySrc);
+ device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
@@ -190,16 +186,15 @@
// 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::CopyDst | dawn::TextureUsageBit::Sampled |
- dawn::TextureUsageBit::CopySrc,
- kColorFormat);
+ dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
+ 4, 1,
+ dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled | dawn::TextureUsage::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::CopySrc);
+ device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
@@ -221,7 +216,7 @@
// 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::CopySrc, kColorFormat);
+ 1, 1, dawn::TextureUsage::Sampled | dawn::TextureUsage::CopySrc, kColorFormat);
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
dawn::TextureCopyView srcTextureCopyView =
@@ -229,8 +224,8 @@
dawn::TextureDescriptor dstDescriptor =
CreateTextureDescriptor(1, 1,
- dawn::TextureUsageBit::OutputAttachment |
- dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc,
+ dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopyDst |
+ dawn::TextureUsage::CopySrc,
kColorFormat);
dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor);
@@ -253,18 +248,17 @@
// 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::CopySrc |
- dawn::TextureUsageBit::CopyDst,
- kColorFormat);
+ dawn::TextureDescriptor srcDescriptor = CreateTextureDescriptor(
+ 1, 1,
+ dawn::TextureUsage::Sampled | dawn::TextureUsage::CopySrc | dawn::TextureUsage::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::CopySrc);
+ device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
dawn::TextureCopyView textureCopyView =
utils::CreateTextureCopyView(srcTexture, 0, 0, {0, 0, 0});
@@ -280,8 +274,8 @@
dawn::TextureDescriptor dstDescriptor =
CreateTextureDescriptor(1, 1,
- dawn::TextureUsageBit::OutputAttachment |
- dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc,
+ dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopyDst |
+ dawn::TextureUsage::CopySrc,
kColorFormat);
dawn::Texture dstTexture = device.CreateTexture(&dstDescriptor);
@@ -308,13 +302,13 @@
TEST_P(TextureZeroInitTest, RenderingLoadingDepth) {
dawn::TextureDescriptor srcDescriptor =
CreateTextureDescriptor(1, 1,
- dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst |
- dawn::TextureUsageBit::OutputAttachment,
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst |
+ dawn::TextureUsage::OutputAttachment,
kColorFormat);
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
dawn::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
- 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
+ 1, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc,
kDepthStencilFormat);
dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
@@ -343,13 +337,13 @@
TEST_P(TextureZeroInitTest, RenderingLoadingStencil) {
dawn::TextureDescriptor srcDescriptor =
CreateTextureDescriptor(1, 1,
- dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst |
- dawn::TextureUsageBit::OutputAttachment,
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst |
+ dawn::TextureUsage::OutputAttachment,
kColorFormat);
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
dawn::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
- 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
+ 1, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc,
kDepthStencilFormat);
dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
@@ -378,13 +372,13 @@
TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) {
dawn::TextureDescriptor srcDescriptor =
CreateTextureDescriptor(1, 1,
- dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst |
- dawn::TextureUsageBit::OutputAttachment,
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst |
+ dawn::TextureUsage::OutputAttachment,
kColorFormat);
dawn::Texture srcTexture = device.CreateTexture(&srcDescriptor);
dawn::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
- 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
+ 1, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc,
kDepthStencilFormat);
dawn::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
@@ -410,8 +404,7 @@
// This tests the color attachments clear to 0s
TEST_P(TextureZeroInitTest, ColorAttachmentsClear) {
dawn::TextureDescriptor descriptor = CreateTextureDescriptor(
- 1, 1, dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc,
- kColorFormat);
+ 1, 1, dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc, kColorFormat);
dawn::Texture texture = device.CreateTexture(&descriptor);
utils::BasicRenderPass renderPass = utils::BasicRenderPass(kSize, kSize, texture, kColorFormat);
renderPass.renderPassInfo.cColorAttachmentsInfoPtr[0]->loadOp = dawn::LoadOp::Load;
@@ -431,12 +424,11 @@
TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
// Create needed resources
dawn::TextureDescriptor descriptor =
- CreateTextureDescriptor(1, 1, dawn::TextureUsageBit::Sampled, kColorFormat);
+ CreateTextureDescriptor(1, 1, dawn::TextureUsage::Sampled, kColorFormat);
dawn::Texture texture = device.CreateTexture(&descriptor);
dawn::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
- 1, 1, dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::OutputAttachment,
- kColorFormat);
+ 1, 1, dawn::TextureUsage::CopySrc | dawn::TextureUsage::OutputAttachment, kColorFormat);
dawn::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
dawn::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
@@ -501,7 +493,7 @@
TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
// Create needed resources
dawn::TextureDescriptor descriptor =
- CreateTextureDescriptor(1, 1, dawn::TextureUsageBit::Sampled, kColorFormat);
+ CreateTextureDescriptor(1, 1, dawn::TextureUsage::Sampled, kColorFormat);
descriptor.size.width = 1;
descriptor.size.height = 1;
dawn::Texture texture = device.CreateTexture(&descriptor);
@@ -509,8 +501,8 @@
uint32_t bufferSize = 4 * sizeof(uint32_t);
dawn::BufferDescriptor bufferDescriptor;
bufferDescriptor.size = bufferSize;
- bufferDescriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::Storage |
- dawn::BufferUsageBit::CopyDst;
+ bufferDescriptor.usage =
+ dawn::BufferUsage::CopySrc | dawn::BufferUsage::Storage | dawn::BufferUsage::CopyDst;
dawn::Buffer bufferTex = device.CreateBuffer(&bufferDescriptor);
// Add data to buffer to ensure it is initialized
uint32_t data = 100;
@@ -571,14 +563,14 @@
DAWN_SKIP_TEST_IF(IsOpenGL() || IsD3D12());
dawn::TextureDescriptor descriptor =
- CreateTextureDescriptor(1, 1, dawn::TextureUsageBit::CopySrc, kNonrenderableColorFormat);
+ CreateTextureDescriptor(1, 1, dawn::TextureUsage::CopySrc, kNonrenderableColorFormat);
dawn::Texture texture = device.CreateTexture(&descriptor);
// Set buffer with dirty data so we know it is cleared by the lazy cleared texture copy
uint32_t bufferSize = 4 * kSize * kSize;
std::vector<uint8_t> data(bufferSize, 100);
dawn::Buffer bufferDst = utils::CreateBufferFromData(
- device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::CopySrc);
+ device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, 0, 0);
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
diff --git a/src/tests/end2end/VertexFormatTests.cpp b/src/tests/end2end/VertexFormatTests.cpp
index c52d662..53e97c8 100644
--- a/src/tests/end2end/VertexFormatTests.cpp
+++ b/src/tests/end2end/VertexFormatTests.cpp
@@ -376,9 +376,8 @@
std::vector<VertexType> vertex,
std::vector<ExpectedType> expectedData) {
dawn::RenderPipeline pipeline = MakeTestPipeline(format, expectedData);
- dawn::Buffer vertexBuffer =
- utils::CreateBufferFromData(device, vertex.data(), vertex.size() * sizeof(VertexType),
- dawn::BufferUsageBit::Vertex);
+ dawn::Buffer vertexBuffer = utils::CreateBufferFromData(
+ device, vertex.data(), vertex.size() * sizeof(VertexType), dawn::BufferUsage::Vertex);
uint64_t zeroOffset = 0;
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
{
diff --git a/src/tests/end2end/VertexInputTests.cpp b/src/tests/end2end/VertexInputTests.cpp
index 6efce06..e39400e 100644
--- a/src/tests/end2end/VertexInputTests.cpp
+++ b/src/tests/end2end/VertexInputTests.cpp
@@ -179,7 +179,7 @@
dawn::Buffer MakeVertexBuffer(std::vector<T> data) {
return utils::CreateBufferFromData(device, data.data(),
static_cast<uint32_t>(data.size() * sizeof(T)),
- dawn::BufferUsageBit::Vertex);
+ dawn::BufferUsage::Vertex);
}
struct DrawVertexBuffer {
diff --git a/src/tests/end2end/ViewportTests.cpp b/src/tests/end2end/ViewportTests.cpp
index 4b0b186..4aa9d42 100644
--- a/src/tests/end2end/ViewportTests.cpp
+++ b/src/tests/end2end/ViewportTests.cpp
@@ -68,7 +68,7 @@
textureDescriptor.dimension = dawn::TextureDimension::e2D;
textureDescriptor.format = format;
textureDescriptor.usage =
- dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
textureDescriptor.arrayLayerCount = 1;
textureDescriptor.mipLevelCount = 1;
textureDescriptor.sampleCount = 1;
diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp
index e9cfb84..5e6a016 100644
--- a/src/tests/unittests/validation/BindGroupValidationTests.cpp
+++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp
@@ -25,13 +25,13 @@
{
dawn::BufferDescriptor descriptor;
descriptor.size = 1024;
- descriptor.usage = dawn::BufferUsageBit::Uniform;
+ descriptor.usage = dawn::BufferUsage::Uniform;
mUBO = device.CreateBuffer(&descriptor);
}
{
dawn::BufferDescriptor descriptor;
descriptor.size = 1024;
- descriptor.usage = dawn::BufferUsageBit::Storage;
+ descriptor.usage = dawn::BufferUsage::Storage;
mSSBO = device.CreateBuffer(&descriptor);
}
{
@@ -46,7 +46,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::Sampled;
+ descriptor.usage = dawn::TextureUsage::Sampled;
mSampledTexture = device.CreateTexture(&descriptor);
mSampledTextureView = mSampledTexture.CreateDefaultView();
}
@@ -272,7 +272,7 @@
{
dawn::BufferDescriptor bufferDesc;
bufferDesc.size = 1024;
- bufferDesc.usage = static_cast<dawn::BufferUsageBit>(0xFFFFFFFF);
+ bufferDesc.usage = static_cast<dawn::BufferUsage>(0xFFFFFFFF);
dawn::Buffer errorBuffer;
ASSERT_DEVICE_ERROR(errorBuffer = device.CreateBuffer(&bufferDesc));
@@ -300,7 +300,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment;
dawn::Texture outputTexture = device.CreateTexture(&descriptor);
dawn::TextureView outputTextureView = outputTexture.CreateDefaultView();
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, outputTextureView}}));
@@ -323,7 +323,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::RGBA8Uint;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::Sampled;
+ descriptor.usage = dawn::TextureUsage::Sampled;
dawn::Texture uintTexture = device.CreateTexture(&descriptor);
dawn::TextureView uintTextureView = uintTexture.CreateDefaultView();
@@ -382,7 +382,7 @@
dawn::BufferDescriptor descriptor;
descriptor.size = 1024;
- descriptor.usage = dawn::BufferUsageBit::Uniform;
+ descriptor.usage = dawn::BufferUsage::Uniform;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
// Success case, touching the start of the buffer works
@@ -602,7 +602,7 @@
dawn::BindingType::StorageBuffer, true}});
}
- dawn::Buffer CreateBuffer(uint64_t bufferSize, dawn::BufferUsageBit usage) {
+ dawn::Buffer CreateBuffer(uint64_t bufferSize, dawn::BufferUsage usage) {
dawn::BufferDescriptor bufferDescriptor;
bufferDescriptor.size = bufferSize;
bufferDescriptor.usage = usage;
@@ -717,8 +717,8 @@
// This is the test case that should work.
TEST_F(SetBindGroupValidationTest, Basic) {
// Set up the bind group.
- dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
- dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
+ dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
+ dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, mBindGroupLayout,
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
@@ -733,8 +733,8 @@
// Test cases that test dynamic offsets count mismatch with bind group layout.
TEST_F(SetBindGroupValidationTest, DynamicOffsetsMismatch) {
// Set up bind group.
- dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
- dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
+ dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
+ dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, mBindGroupLayout,
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
@@ -750,8 +750,8 @@
// Test cases that test dynamic offsets not aligned
TEST_F(SetBindGroupValidationTest, DynamicOffsetsNotAligned) {
// Set up bind group.
- dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
- dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
+ dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
+ dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, mBindGroupLayout,
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
@@ -767,8 +767,8 @@
// Test cases that test dynamic uniform buffer out of bound situation.
TEST_F(SetBindGroupValidationTest, OffsetOutOfBoundDynamicUniformBuffer) {
// Set up bind group.
- dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
- dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
+ dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
+ dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, mBindGroupLayout,
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
@@ -784,8 +784,8 @@
// Test cases that test dynamic storage buffer out of bound situation.
TEST_F(SetBindGroupValidationTest, OffsetOutOfBoundDynamicStorageBuffer) {
// Set up bind group.
- dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
- dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
+ dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
+ dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, mBindGroupLayout,
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
@@ -801,8 +801,8 @@
// Test cases that test dynamic uniform buffer out of bound situation because of binding size.
TEST_F(SetBindGroupValidationTest, BindingSizeOutOfBoundDynamicUniformBuffer) {
// Set up bind group, but binding size is larger than
- dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
- dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
+ dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
+ dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, mBindGroupLayout,
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
@@ -818,8 +818,8 @@
// Test cases that test dynamic storage buffer out of bound situation because of binding size.
TEST_F(SetBindGroupValidationTest, BindingSizeOutOfBoundDynamicStorageBuffer) {
- dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Uniform);
- dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsageBit::Storage);
+ dawn::Buffer uniformBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Uniform);
+ dawn::Buffer storageBuffer = CreateBuffer(kBufferSize, dawn::BufferUsage::Storage);
dawn::BindGroup bindGroup = utils::MakeBindGroup(
device, mBindGroupLayout,
{{0, uniformBuffer, 0, kBindingSize}, {1, storageBuffer, 0, kBindingSize}});
diff --git a/src/tests/unittests/validation/BufferValidationTests.cpp b/src/tests/unittests/validation/BufferValidationTests.cpp
index 8331af3..dcd5816 100644
--- a/src/tests/unittests/validation/BufferValidationTests.cpp
+++ b/src/tests/unittests/validation/BufferValidationTests.cpp
@@ -63,27 +63,26 @@
dawn::Buffer CreateMapReadBuffer(uint64_t size) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
- descriptor.usage = dawn::BufferUsageBit::MapRead;
+ descriptor.usage = dawn::BufferUsage::MapRead;
return device.CreateBuffer(&descriptor);
}
dawn::Buffer CreateMapWriteBuffer(uint64_t size) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
- descriptor.usage = dawn::BufferUsageBit::MapWrite;
+ descriptor.usage = dawn::BufferUsage::MapWrite;
return device.CreateBuffer(&descriptor);
}
dawn::Buffer CreateSetSubDataBuffer(uint64_t size) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
- descriptor.usage = dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopyDst;
return device.CreateBuffer(&descriptor);
}
- dawn::CreateBufferMappedResult CreateBufferMapped(uint64_t size,
- dawn::BufferUsageBit usage) {
+ dawn::CreateBufferMappedResult CreateBufferMapped(uint64_t size, dawn::BufferUsage usage) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
descriptor.usage = usage;
@@ -117,7 +116,7 @@
{
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::Uniform;
+ descriptor.usage = dawn::BufferUsage::Uniform;
device.CreateBuffer(&descriptor);
}
@@ -129,7 +128,7 @@
{
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
device.CreateBuffer(&descriptor);
}
@@ -138,7 +137,7 @@
{
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::Uniform;
+ descriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::Uniform;
ASSERT_DEVICE_ERROR(device.CreateBuffer(&descriptor));
}
@@ -147,7 +146,7 @@
{
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
+ descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
device.CreateBuffer(&descriptor);
}
@@ -156,7 +155,7 @@
{
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::Uniform;
+ descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::Uniform;
ASSERT_DEVICE_ERROR(device.CreateBuffer(&descriptor));
}
@@ -192,7 +191,7 @@
// Test the success case for CreateBufferMapped
TEST_F(BufferValidationTest, CreateBufferMappedSuccess) {
- dawn::CreateBufferMappedResult result = CreateBufferMapped(4, dawn::BufferUsageBit::MapWrite);
+ dawn::CreateBufferMappedResult result = CreateBufferMapped(4, dawn::BufferUsage::MapWrite);
ASSERT_NE(result.data, nullptr);
ASSERT_EQ(result.dataLength, 4u);
result.buffer.Unmap();
@@ -200,7 +199,7 @@
// Test the success case for non-mappable CreateBufferMapped
TEST_F(BufferValidationTest, NonMappableCreateBufferMappedSuccess) {
- dawn::CreateBufferMappedResult result = CreateBufferMapped(4, dawn::BufferUsageBit::CopySrc);
+ dawn::CreateBufferMappedResult result = CreateBufferMapped(4, dawn::BufferUsage::CopySrc);
ASSERT_NE(result.data, nullptr);
ASSERT_EQ(result.dataLength, 4u);
result.buffer.Unmap();
@@ -210,7 +209,7 @@
TEST_F(BufferValidationTest, MapReadWrongUsage) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopyDst;
dawn::Buffer buf = device.CreateBuffer(&descriptor);
@@ -225,7 +224,7 @@
TEST_F(BufferValidationTest, MapWriteWrongUsage) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::CopySrc;
+ descriptor.usage = dawn::BufferUsage::CopySrc;
dawn::Buffer buf = device.CreateBuffer(&descriptor);
@@ -467,7 +466,7 @@
TEST_F(BufferValidationTest, SetSubDataWrongUsage) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::Vertex;
+ descriptor.usage = dawn::BufferUsage::Vertex;
dawn::Buffer buf = device.CreateBuffer(&descriptor);
@@ -479,7 +478,7 @@
TEST_F(BufferValidationTest, SetSubDataWithUnalignedSize) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4;
- descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer buf = device.CreateBuffer(&descriptor);
@@ -491,7 +490,7 @@
TEST_F(BufferValidationTest, SetSubDataWithUnalignedOffset) {
dawn::BufferDescriptor descriptor;
descriptor.size = 4000;
- descriptor.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer buf = device.CreateBuffer(&descriptor);
@@ -612,12 +611,12 @@
// Test that is is invalid to Map a CreateBufferMapped buffer
TEST_F(BufferValidationTest, MapCreateBufferMappedBuffer) {
{
- dawn::Buffer buf = CreateBufferMapped(4, dawn::BufferUsageBit::MapRead).buffer;
+ dawn::Buffer buf = CreateBufferMapped(4, dawn::BufferUsage::MapRead).buffer;
ASSERT_DEVICE_ERROR(buf.MapReadAsync(ToMockBufferMapReadCallback, nullptr));
queue.Submit(0, nullptr);
}
{
- dawn::Buffer buf = CreateBufferMapped(4, dawn::BufferUsageBit::MapWrite).buffer;
+ dawn::Buffer buf = CreateBufferMapped(4, dawn::BufferUsage::MapWrite).buffer;
ASSERT_DEVICE_ERROR(buf.MapWriteAsync(ToMockBufferMapWriteCallback, nullptr));
queue.Submit(0, nullptr);
}
@@ -645,11 +644,11 @@
TEST_F(BufferValidationTest, SubmitBufferWithMapUsage) {
dawn::BufferDescriptor descriptorA;
descriptorA.size = 4;
- descriptorA.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::MapWrite;
+ descriptorA.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::MapWrite;
dawn::BufferDescriptor descriptorB;
descriptorB.size = 4;
- descriptorB.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::MapRead;
+ descriptorB.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::MapRead;
dawn::Buffer bufA = device.CreateBuffer(&descriptorA);
dawn::Buffer bufB = device.CreateBuffer(&descriptorB);
@@ -664,11 +663,11 @@
TEST_F(BufferValidationTest, SubmitMappedBuffer) {
dawn::BufferDescriptor descriptorA;
descriptorA.size = 4;
- descriptorA.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::MapWrite;
+ descriptorA.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::MapWrite;
dawn::BufferDescriptor descriptorB;
descriptorB.size = 4;
- descriptorB.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::MapRead;
+ descriptorB.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::MapRead;
{
dawn::Buffer bufA = device.CreateBuffer(&descriptorA);
dawn::Buffer bufB = device.CreateBuffer(&descriptorB);
@@ -719,11 +718,11 @@
TEST_F(BufferValidationTest, SubmitDestroyedBuffer) {
dawn::BufferDescriptor descriptorA;
descriptorA.size = 4;
- descriptorA.usage = dawn::BufferUsageBit::CopySrc;
+ descriptorA.usage = dawn::BufferUsage::CopySrc;
dawn::BufferDescriptor descriptorB;
descriptorB.size = 4;
- descriptorB.usage = dawn::BufferUsageBit::CopyDst;
+ descriptorB.usage = dawn::BufferUsage::CopyDst;
dawn::Buffer bufA = device.CreateBuffer(&descriptorA);
dawn::Buffer bufB = device.CreateBuffer(&descriptorB);
diff --git a/src/tests/unittests/validation/CommandBufferValidationTests.cpp b/src/tests/unittests/validation/CommandBufferValidationTests.cpp
index b8415bd..bdeb4ff 100644
--- a/src/tests/unittests/validation/CommandBufferValidationTests.cpp
+++ b/src/tests/unittests/validation/CommandBufferValidationTests.cpp
@@ -152,7 +152,7 @@
// A buffer that can be used in CopyBufferToBuffer
dawn::BufferDescriptor copyBufferDesc;
copyBufferDesc.size = 16;
- copyBufferDesc.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ copyBufferDesc.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer copyBuffer = device.CreateBuffer(©BufferDesc);
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -166,13 +166,13 @@
// A buffer that can be used in CopyBufferToBuffer
dawn::BufferDescriptor copyBufferDesc;
copyBufferDesc.size = 16;
- copyBufferDesc.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ copyBufferDesc.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer copyBuffer = device.CreateBuffer(©BufferDesc);
// A buffer that can't be used in CopyBufferToBuffer
dawn::BufferDescriptor bufferDesc;
bufferDesc.size = 16;
- bufferDesc.usage = dawn::BufferUsageBit::Uniform;
+ bufferDesc.usage = dawn::BufferUsage::Uniform;
dawn::Buffer buffer = device.CreateBuffer(&bufferDesc);
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -186,7 +186,7 @@
TEST_F(CommandBufferValidationTest, BufferWithMultipleReadUsage) {
// Create a buffer used as both vertex and index buffer.
dawn::BufferDescriptor bufferDescriptor;
- bufferDescriptor.usage = dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Index;
+ bufferDescriptor.usage = dawn::BufferUsage::Vertex | dawn::BufferUsage::Index;
bufferDescriptor.size = 4;
dawn::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
@@ -205,7 +205,7 @@
TEST_F(CommandBufferValidationTest, BufferWithReadAndWriteUsage) {
// Create a buffer that will be used as an index buffer and as a storage buffer
dawn::BufferDescriptor bufferDescriptor;
- bufferDescriptor.usage = dawn::BufferUsageBit::Storage | dawn::BufferUsageBit::Index;
+ bufferDescriptor.usage = dawn::BufferUsage::Storage | dawn::BufferUsage::Index;
bufferDescriptor.size = 4;
dawn::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
@@ -229,7 +229,7 @@
TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
// Create a texture that will be used both as a sampled texture and a render target
dawn::TextureDescriptor textureDescriptor;
- textureDescriptor.usage = dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::OutputAttachment;
+ textureDescriptor.usage = dawn::TextureUsage::Sampled | dawn::TextureUsage::OutputAttachment;
textureDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
textureDescriptor.dimension = dawn::TextureDimension::e2D;
textureDescriptor.size = {1, 1, 1};
diff --git a/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp b/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp
index 011751e..4eeb541 100644
--- a/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp
+++ b/src/tests/unittests/validation/ComputeIndirectValidationTests.cpp
@@ -54,8 +54,8 @@
void TestIndirectOffset(utils::Expectation expectation,
std::initializer_list<uint32_t> bufferList,
uint64_t indirectOffset) {
- dawn::Buffer indirectBuffer = utils::CreateBufferFromData<uint32_t>(
- device, dawn::BufferUsageBit::Indirect, bufferList);
+ dawn::Buffer indirectBuffer =
+ utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Indirect, bufferList);
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
dawn::ComputePassEncoder pass = encoder.BeginComputePass();
diff --git a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
index 0ed925c..8ac90fb 100644
--- a/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
+++ b/src/tests/unittests/validation/CopyCommandsValidationTests.cpp
@@ -20,7 +20,7 @@
class CopyCommandTest : public ValidationTest {
protected:
- dawn::Buffer CreateBuffer(uint64_t size, dawn::BufferUsageBit usage) {
+ dawn::Buffer CreateBuffer(uint64_t size, dawn::BufferUsage usage) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
descriptor.usage = usage;
@@ -33,7 +33,7 @@
uint32_t mipLevelCount,
uint32_t arrayLayerCount,
dawn::TextureFormat format,
- dawn::TextureUsageBit usage,
+ dawn::TextureUsage usage,
uint32_t sampleCount = 1) {
dawn::TextureDescriptor descriptor;
descriptor.dimension = dawn::TextureDimension::e2D;
@@ -150,8 +150,8 @@
// Test a successfull B2B copy
TEST_F(CopyCommandTest_B2B, Success) {
- dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
- dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
+ dawn::Buffer source = CreateBuffer(16, dawn::BufferUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsage::CopyDst);
// Copy different copies, including some that touch the OOB condition
{
@@ -174,8 +174,8 @@
// Test B2B copies with OOB
TEST_F(CopyCommandTest_B2B, OutOfBounds) {
- dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
- dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
+ dawn::Buffer source = CreateBuffer(16, dawn::BufferUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsage::CopyDst);
// OOB on the source
{
@@ -194,9 +194,9 @@
// Test B2B copies with incorrect buffer usage
TEST_F(CopyCommandTest_B2B, BadUsage) {
- dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
- dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
- dawn::Buffer vertex = CreateBuffer(16, dawn::BufferUsageBit::Vertex);
+ dawn::Buffer source = CreateBuffer(16, dawn::BufferUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsage::CopyDst);
+ dawn::Buffer vertex = CreateBuffer(16, dawn::BufferUsage::Vertex);
// Source with incorrect usage
{
@@ -215,8 +215,8 @@
// Test B2B copies with unaligned data size
TEST_F(CopyCommandTest_B2B, UnalignedSize) {
- dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
- dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
+ dawn::Buffer source = CreateBuffer(16, dawn::BufferUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsage::CopyDst);
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToBuffer(source, 8, destination, 0, sizeof(uint8_t));
@@ -225,8 +225,8 @@
// Test B2B copies with unaligned offset
TEST_F(CopyCommandTest_B2B, UnalignedOffset) {
- dawn::Buffer source = CreateBuffer(16, dawn::BufferUsageBit::CopySrc);
- dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsageBit::CopyDst);
+ dawn::Buffer source = CreateBuffer(16, dawn::BufferUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(16, dawn::BufferUsage::CopyDst);
// Unaligned source offset
{
@@ -247,11 +247,11 @@
TEST_F(CopyCommandTest_B2B, BuffersInErrorState) {
dawn::BufferDescriptor errorBufferDescriptor;
errorBufferDescriptor.size = 4;
- errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc;
+ errorBufferDescriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopySrc;
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
constexpr uint64_t bufferSize = 4;
- dawn::Buffer validBuffer = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
+ dawn::Buffer validBuffer = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
{
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -271,9 +271,9 @@
// Test a successfull B2T copy
TEST_F(CopyCommandTest_B2T, Success) {
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
- dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
// Different copies, including some that touch the OOB condition
{
@@ -324,9 +324,9 @@
// 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::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::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,7 +346,7 @@
{
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::CopySrc);
+ dawn::Buffer sourceBuffer = CreateBuffer(sourceBufferSize, dawn::BufferUsage::CopySrc);
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
{7, 3, 1});
@@ -356,9 +356,9 @@
// 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::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
// OOB on the texture because x + width overflows
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {13, 12, 0},
@@ -383,9 +383,9 @@
// 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::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
// Z=1 on an empty copy still errors
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 1},
@@ -398,12 +398,12 @@
// Test B2T copies with incorrect buffer usage
TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
- 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::CopyDst);
- dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::Sampled);
+ dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsage::CopySrc);
+ dawn::Buffer vertex = CreateBuffer(16 * 4, dawn::BufferUsage::Vertex);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
+ dawn::Texture sampled =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::Sampled);
// Incorrect source usage
TestB2TCopy(utils::Expectation::Failure, vertex, 0, 256, 0, destination, 0, 0, {0, 0, 0},
@@ -416,9 +416,9 @@
TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
- dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
+ dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
dawn::Texture destination = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::TextureUsage::CopyDst);
// Default row pitch is not 256-byte aligned
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
@@ -435,9 +435,9 @@
TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
- dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
// Image height is zero (Valid)
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
@@ -459,9 +459,9 @@
// 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::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
// Correct usage
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 0, destination, 0, 0,
@@ -481,9 +481,9 @@
// 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::CopySrc);
+ dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
dawn::Texture destination = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst, 4);
+ dawn::TextureUsage::CopyDst, 4);
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
{2, 2, 1});
@@ -493,7 +493,7 @@
TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
dawn::BufferDescriptor errorBufferDescriptor;
errorBufferDescriptor.size = 4;
- errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc;
+ errorBufferDescriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopySrc;
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
dawn::TextureDescriptor errorTextureDescriptor;
@@ -508,7 +508,7 @@
{
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::TextureUsage::CopyDst);
dawn::TextureCopyView textureCopyView =
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
@@ -519,7 +519,7 @@
{
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
- dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
+ dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
@@ -544,9 +544,9 @@
constexpr uint32_t kInvalidBufferSize = kRowPitch * (kHeight - 1) + kWidth;
for (dawn::TextureFormat format : kFormats) {
- dawn::Buffer source = CreateBuffer(kInvalidBufferSize, dawn::BufferUsageBit::CopySrc);
+ dawn::Buffer source = CreateBuffer(kInvalidBufferSize, dawn::BufferUsage::CopySrc);
dawn::Texture destination =
- Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopyDst);
+ Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsage::CopyDst);
TestB2TCopy(utils::Expectation::Failure, source, 0, kRowPitch, 0, destination, 0, 0,
{0, 0, 0}, {kWidth, kHeight, 1});
}
@@ -556,20 +556,19 @@
for (dawn::TextureFormat format : kFormats) {
uint32_t validBufferSize = BufferSizeForTextureCopy(kWidth, kHeight, 1, format);
dawn::Texture destination =
- Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopyDst);
+ Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsage::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::CopySrc);
+ dawn::Buffer source = CreateBuffer(invalidBuffferSize, dawn::BufferUsage::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::CopySrc);
+ dawn::Buffer source = CreateBuffer(validBufferSize, dawn::BufferUsage::CopySrc);
TestB2TCopy(utils::Expectation::Success, source, 0, kRowPitch, 0, destination, 0, 0,
{0, 0, 0}, {kWidth, kHeight, 1});
}
@@ -580,10 +579,10 @@
// 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::CopySrc);
+ dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
uint32_t maxMipmapLevel = 3;
dawn::Texture destination = Create2DTexture(
- 4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopyDst);
+ 4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
// Copy to top level mip map
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, maxMipmapLevel - 1, 0,
@@ -607,9 +606,9 @@
// Test a successfull T2B copy
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::CopySrc);
- dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
// Different copies, including some that touch the OOB condition
{
@@ -660,9 +659,9 @@
// Test OOB conditions on the texture
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::CopySrc);
- dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
// OOB on the texture because x + width overflows
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {13, 12, 0}, destination, 0, 256, 0,
@@ -684,9 +683,9 @@
// Test OOB conditions on the buffer
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::CopySrc);
- dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::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,
@@ -707,7 +706,7 @@
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::CopyDst);
+ CreateBuffer(destinationBufferSize, dawn::BufferUsage::CopyDst);
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destinationBuffer, 0, 256,
0, {7, 3, 1});
}
@@ -716,9 +715,9 @@
// Test that we force Z=0 and Depth=1 on copies from to 2D textures
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::CopySrc);
- dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
// Z=1 on an empty copy still errors
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 1}, destination, 0, 0, 0,
@@ -732,12 +731,12 @@
// Test T2B copies with incorrect buffer usage
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::CopySrc);
- dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::Sampled);
- dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
- dawn::Buffer vertex = CreateBuffer(bufferSize, dawn::BufferUsageBit::Vertex);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
+ dawn::Texture sampled =
+ Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::Sampled);
+ dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
+ dawn::Buffer vertex = CreateBuffer(bufferSize, dawn::BufferUsage::Vertex);
// Incorrect source usage
TestT2BCopy(utils::Expectation::Failure, sampled, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
@@ -750,8 +749,8 @@
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::CopyDst);
- dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
+ dawn::TextureUsage::CopyDst);
+ dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
// Default row pitch is not 256-byte aligned
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
@@ -768,9 +767,9 @@
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::CopySrc);
- dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
// Image height is zero (Valid)
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
@@ -793,8 +792,8 @@
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::CopySrc);
- dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
+ dawn::TextureUsage::CopySrc);
+ dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
// Correct usage
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, bufferSize - 4,
@@ -812,9 +811,9 @@
// 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::CopySrc, 4);
+ dawn::TextureUsage::CopySrc, 4);
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
- dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
+ dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 256, 0,
{2, 2, 1});
@@ -824,7 +823,7 @@
TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
dawn::BufferDescriptor errorBufferDescriptor;
errorBufferDescriptor.size = 4;
- errorBufferDescriptor.usage = dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::CopySrc;
+ errorBufferDescriptor.usage = dawn::BufferUsage::MapRead | dawn::BufferUsage::CopySrc;
ASSERT_DEVICE_ERROR(dawn::Buffer errorBuffer = device.CreateBuffer(&errorBufferDescriptor));
dawn::TextureDescriptor errorTextureDescriptor;
@@ -839,7 +838,7 @@
{
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
- dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopySrc);
+ dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsage::CopySrc);
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0);
@@ -850,7 +849,7 @@
{
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::TextureUsage::CopyDst);
dawn::TextureCopyView textureCopyView =
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
@@ -876,10 +875,9 @@
for (dawn::TextureFormat format : kFormats) {
dawn::Texture source =
- Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopyDst);
+ Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsage::CopyDst);
- dawn::Buffer destination =
- CreateBuffer(kInvalidBufferSize, dawn::BufferUsageBit::CopySrc);
+ dawn::Buffer destination = CreateBuffer(kInvalidBufferSize, dawn::BufferUsage::CopySrc);
TestT2BCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0,
kRowPitch, 0, {kWidth, kHeight, 1});
}
@@ -889,21 +887,21 @@
for (dawn::TextureFormat format : kFormats) {
uint32_t validBufferSize = BufferSizeForTextureCopy(kWidth, kHeight, 1, format);
dawn::Texture source =
- Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsageBit::CopySrc);
+ Create2DTexture(kWidth, kHeight, 1, 1, format, dawn::TextureUsage::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::CopyDst);
+ CreateBuffer(invalidBufferSize, dawn::BufferUsage::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::CopyDst);
+ CreateBuffer(validBufferSize, dawn::BufferUsage::CopyDst);
TestT2BCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0,
kRowPitch, 0, {kWidth, kHeight, 1});
}
@@ -915,9 +913,9 @@
TEST_F(CopyCommandTest_T2B, CopyFromMipmapOfNonSquareTexture) {
uint32_t maxMipmapLevel = 3;
dawn::Texture source = Create2DTexture(4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopySrc);
+ dawn::TextureUsage::CopySrc);
uint64_t bufferSize = BufferSizeForTextureCopy(4, 2, 1);
- dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::CopyDst);
+ dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsage::CopyDst);
// Copy from top level mip map
TestT2BCopy(utils::Expectation::Success, source, maxMipmapLevel - 1, 0, {0, 0, 0}, destination,
@@ -939,10 +937,10 @@
class CopyCommandTest_T2T : public CopyCommandTest {};
TEST_F(CopyCommandTest_T2T, Success) {
- dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
// Different copies, including some that touch the OOB condition
{
@@ -992,10 +990,10 @@
}
TEST_F(CopyCommandTest_T2T, IncorrectUsage) {
- dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
// Incorrect source usage causes failure
TestT2TCopy(utils::Expectation::Failure, destination, 0, 0, {0, 0, 0}, destination, 0, 0,
@@ -1007,10 +1005,10 @@
}
TEST_F(CopyCommandTest_T2T, OutOfBounds) {
- dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
// OOB on source
{
@@ -1060,10 +1058,10 @@
}
TEST_F(CopyCommandTest_T2T, 2DTextureDepthConstraints) {
- dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::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},
@@ -1080,9 +1078,9 @@
TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8,
- dawn::TextureUsageBit::CopySrc);
+ dawn::TextureUsage::CopySrc);
dawn::Texture destination = Create2DTexture(
- 16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8, dawn::TextureUsageBit::CopyDst);
+ 16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8, dawn::TextureUsage::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},
@@ -1094,10 +1092,10 @@
}
TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
- dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Uint,
- dawn::TextureUsageBit::CopySrc);
- dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopyDst);
+ dawn::Texture source =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Uint, dawn::TextureUsage::CopySrc);
+ dawn::Texture destination =
+ Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst);
// Failure when formats don't match
TestT2TCopy(utils::Expectation::Failure, source, 0, 0, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
@@ -1106,11 +1104,11 @@
TEST_F(CopyCommandTest_T2T, MultisampledCopies) {
dawn::Texture sourceMultiSampled1x = Create2DTexture(
- 16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopySrc, 1);
+ 16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc, 1);
dawn::Texture sourceMultiSampled4x = Create2DTexture(
- 16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopySrc, 4);
+ 16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopySrc, 4);
dawn::Texture destinationMultiSampled4x = Create2DTexture(
- 16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopyDst, 4);
+ 16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::CopyDst, 4);
// Success when entire multisampled subresource is copied
{
@@ -1134,9 +1132,9 @@
TEST_F(CopyCommandTest_T2T, CopyToMipmapOfNonSquareTexture) {
uint32_t maxMipmapLevel = 3;
dawn::Texture source = Create2DTexture(4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm,
- dawn::TextureUsageBit::CopySrc);
+ dawn::TextureUsage::CopySrc);
dawn::Texture destination = Create2DTexture(
- 4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::CopyDst);
+ 4, 2, maxMipmapLevel, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsage::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,9 +1163,8 @@
uint32_t mipmapLevels = 1,
uint32_t width = kWidth,
uint32_t height = kHeight) {
- constexpr dawn::TextureUsageBit kUsage = dawn::TextureUsageBit::CopyDst |
- dawn::TextureUsageBit::CopySrc |
- dawn::TextureUsageBit::Sampled;
+ constexpr dawn::TextureUsage kUsage =
+ dawn::TextureUsage::CopyDst | dawn::TextureUsage::CopySrc | dawn::TextureUsage::Sampled;
constexpr uint32_t kArrayLayers = 1;
return CopyCommandTest::Create2DTexture(width, height, mipmapLevels, kArrayLayers, format,
kUsage, 1);
@@ -1246,7 +1243,7 @@
// 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::CopySrc | dawn::BufferUsageBit::CopyDst);
+ CreateBuffer(512, dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst);
for (dawn::TextureFormat bcFormat : kBCFormats) {
dawn::Texture texture = Create2DTexture(bcFormat);
@@ -1274,7 +1271,7 @@
// the multiple of compressed texture block width in bytes.
TEST_F(CopyCommandTest_CompressedTextureFormats, RowPitch) {
dawn::Buffer buffer =
- CreateBuffer(1024, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
+ CreateBuffer(1024, dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst);
{
constexpr uint32_t kTestWidth = 160;
@@ -1343,7 +1340,7 @@
// buffer-to-texture or texture-to-buffer copies with compressed texture formats.
TEST_F(CopyCommandTest_CompressedTextureFormats, ImageHeight) {
dawn::Buffer buffer =
- CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
+ CreateBuffer(512, dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst);
for (dawn::TextureFormat bcFormat : kBCFormats) {
dawn::Texture texture = Create2DTexture(bcFormat);
@@ -1369,7 +1366,7 @@
// texture-to-buffer or texture-to-texture copies with compressed texture formats.
TEST_F(CopyCommandTest_CompressedTextureFormats, ImageOffset) {
dawn::Buffer buffer =
- CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
+ CreateBuffer(512, dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst);
for (dawn::TextureFormat bcFormat : kBCFormats) {
dawn::Texture texture = Create2DTexture(bcFormat);
@@ -1412,7 +1409,7 @@
// texture-to-buffer or texture-to-texture copies with compressed texture formats.
TEST_F(CopyCommandTest_CompressedTextureFormats, ImageExtent) {
dawn::Buffer buffer =
- CreateBuffer(512, dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst);
+ CreateBuffer(512, dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst);
constexpr uint32_t kMipmapLevels = 3;
constexpr uint32_t kTestWidth = 60;
diff --git a/src/tests/unittests/validation/DrawIndirectValidationTests.cpp b/src/tests/unittests/validation/DrawIndirectValidationTests.cpp
index 284dc07..b11bbac 100644
--- a/src/tests/unittests/validation/DrawIndirectValidationTests.cpp
+++ b/src/tests/unittests/validation/DrawIndirectValidationTests.cpp
@@ -73,8 +73,8 @@
std::initializer_list<uint32_t> bufferList,
uint64_t indirectOffset,
bool indexed) {
- dawn::Buffer indirectBuffer = utils::CreateBufferFromData<uint32_t>(
- device, dawn::BufferUsageBit::Indirect, bufferList);
+ dawn::Buffer indirectBuffer =
+ utils::CreateBufferFromData<uint32_t>(device, dawn::BufferUsage::Indirect, bufferList);
DummyRenderPass renderPass(device);
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
@@ -82,8 +82,8 @@
pass.SetPipeline(pipeline);
if (indexed) {
uint32_t zeros[100] = {};
- dawn::Buffer indexBuffer = utils::CreateBufferFromData(device, zeros, sizeof(zeros),
- dawn::BufferUsageBit::Index);
+ dawn::Buffer indexBuffer =
+ utils::CreateBufferFromData(device, zeros, sizeof(zeros), dawn::BufferUsage::Index);
pass.SetIndexBuffer(indexBuffer, 0);
pass.DrawIndexedIndirect(indirectBuffer, indirectOffset);
} else {
diff --git a/src/tests/unittests/validation/QueueSubmitValidationTests.cpp b/src/tests/unittests/validation/QueueSubmitValidationTests.cpp
index 5c10a5d..8d3777b 100644
--- a/src/tests/unittests/validation/QueueSubmitValidationTests.cpp
+++ b/src/tests/unittests/validation/QueueSubmitValidationTests.cpp
@@ -32,12 +32,12 @@
TEST_F(QueueSubmitValidationTest, SubmitWithMappedBuffer) {
// Create a map-write buffer.
dawn::BufferDescriptor descriptor;
- descriptor.usage = dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::CopySrc;
+ descriptor.usage = dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
descriptor.size = 4;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
// Create a fake copy destination buffer
- descriptor.usage = dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = dawn::BufferUsage::CopyDst;
dawn::Buffer targetBuffer = device.CreateBuffer(&descriptor);
// Create a command buffer that reads from the mappable buffer.
diff --git a/src/tests/unittests/validation/RenderBundleValidationTests.cpp b/src/tests/unittests/validation/RenderBundleValidationTests.cpp
index 271878d..d3c33a7 100644
--- a/src/tests/unittests/validation/RenderBundleValidationTests.cpp
+++ b/src/tests/unittests/validation/RenderBundleValidationTests.cpp
@@ -69,21 +69,21 @@
float data[4];
dawn::Buffer buffer = utils::CreateBufferFromData(device, data, 4 * sizeof(float),
- dawn::BufferUsageBit::Uniform);
+ dawn::BufferUsage::Uniform);
constexpr static float kVertices[] = {-1.f, 1.f, 1.f, -1.f, -1.f, 1.f};
vertexBuffer = utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
- dawn::BufferUsageBit::Vertex);
+ dawn::BufferUsage::Vertex);
// Dummy storage buffer.
dawn::Buffer storageBuffer = utils::CreateBufferFromData(
- device, kVertices, sizeof(kVertices), dawn::BufferUsageBit::Storage);
+ device, kVertices, sizeof(kVertices), dawn::BufferUsage::Storage);
// Vertex buffer with storage usage for testing read+write error usage.
- vertexStorageBuffer = utils::CreateBufferFromData(
- device, kVertices, sizeof(kVertices),
- dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Storage);
+ vertexStorageBuffer =
+ utils::CreateBufferFromData(device, kVertices, sizeof(kVertices),
+ dawn::BufferUsage::Vertex | dawn::BufferUsage::Storage);
bg0 = utils::MakeBindGroup(device, bgls[0], {{0, buffer, 0, 4 * sizeof(float)}});
bg1 = utils::MakeBindGroup(
@@ -843,7 +843,7 @@
dawn::RenderBundle renderBundle = renderBundleEncoder.Finish();
dawn::TextureDescriptor textureDesc = {};
- textureDesc.usage = dawn::TextureUsageBit::OutputAttachment;
+ textureDesc.usage = dawn::TextureUsage::OutputAttachment;
textureDesc.size = dawn::Extent3D({400, 400, 1});
textureDesc.format = dawn::TextureFormat::RGBA8Unorm;
@@ -914,7 +914,7 @@
dawn::RenderBundle renderBundle = renderBundleEncoder.Finish();
dawn::TextureDescriptor textureDesc = {};
- textureDesc.usage = dawn::TextureUsageBit::OutputAttachment;
+ textureDesc.usage = dawn::TextureUsage::OutputAttachment;
textureDesc.size = dawn::Extent3D({400, 400, 1});
textureDesc.format = dawn::TextureFormat::RGBA8Unorm;
@@ -973,7 +973,7 @@
dawn::RenderBundle renderBundle = renderBundleEncoder.Finish();
dawn::TextureDescriptor textureDesc = {};
- textureDesc.usage = dawn::TextureUsageBit::OutputAttachment;
+ textureDesc.usage = dawn::TextureUsage::OutputAttachment;
textureDesc.size = dawn::Extent3D({400, 400, 1});
textureDesc.format = dawn::TextureFormat::RGBA8Unorm;
diff --git a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
index ec06fe3..852b595 100644
--- a/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
+++ b/src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp
@@ -48,7 +48,7 @@
uint32_t arrayLayerCount,
uint32_t mipLevelCount,
uint32_t sampleCount = 1,
- dawn::TextureUsageBit usage = dawn::TextureUsageBit::OutputAttachment) {
+ dawn::TextureUsage usage = dawn::TextureUsage::OutputAttachment) {
dawn::TextureDescriptor descriptor;
descriptor.dimension = dimension;
descriptor.size.width = width;
@@ -488,10 +488,9 @@
}
// It is not allowed to use a resolve target which is created from a texture whose usage does not
-// include dawn::TextureUsageBit::OutputAttachment.
+// include dawn::TextureUsage::OutputAttachment.
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetUsageNoOutputAttachment) {
- constexpr dawn::TextureUsageBit kUsage =
- dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc;
+ constexpr dawn::TextureUsage kUsage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::CopySrc;
dawn::Texture nonColorUsageResolveTexture = CreateTexture(
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
kLevelCount, 1, kUsage);
diff --git a/src/tests/unittests/validation/RenderPassValidationTests.cpp b/src/tests/unittests/validation/RenderPassValidationTests.cpp
index 67a2165..eeacf45 100644
--- a/src/tests/unittests/validation/RenderPassValidationTests.cpp
+++ b/src/tests/unittests/validation/RenderPassValidationTests.cpp
@@ -66,8 +66,8 @@
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
float data[4];
- dawn::Buffer buffer = utils::CreateBufferFromData(device, data, 4 * sizeof(float),
- dawn::BufferUsageBit::Uniform);
+ dawn::Buffer buffer =
+ utils::CreateBufferFromData(device, data, 4 * sizeof(float), dawn::BufferUsage::Uniform);
dawn::BindGroup bg1 =
utils::MakeBindGroup(device, bgls[0], {{0, buffer, 0, 4 * sizeof(float)}});
diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
index 4185e41..66000b8 100644
--- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
+++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
@@ -130,7 +130,7 @@
baseTextureDescriptor.arrayLayerCount = 1;
baseTextureDescriptor.mipLevelCount = 1;
baseTextureDescriptor.dimension = dawn::TextureDimension::e2D;
- baseTextureDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
+ baseTextureDescriptor.usage = dawn::TextureUsage::OutputAttachment;
utils::ComboRenderPipelineDescriptor nonMultisampledPipelineDescriptor(device);
nonMultisampledPipelineDescriptor.sampleCount = 1;
diff --git a/src/tests/unittests/validation/TextureValidationTests.cpp b/src/tests/unittests/validation/TextureValidationTests.cpp
index a5e38b4..7e198b6 100644
--- a/src/tests/unittests/validation/TextureValidationTests.cpp
+++ b/src/tests/unittests/validation/TextureValidationTests.cpp
@@ -32,7 +32,7 @@
descriptor.sampleCount = kDefaultSampleCount;
descriptor.dimension = dawn::TextureDimension::e2D;
descriptor.format = kDefaultTextureFormat;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::Sampled;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::Sampled;
return descriptor;
}
@@ -239,7 +239,7 @@
TEST_F(TextureValidationTest, NonRenderableAndOutputAttachment) {
dawn::TextureDescriptor descriptor;
descriptor.size = {1, 1, 1};
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment;
// Succeeds because RGBA8Unorm is renderable
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
@@ -276,8 +276,8 @@
dawn::TextureDescriptor CreateDefaultTextureDescriptor() {
dawn::TextureDescriptor descriptor =
TextureValidationTest::CreateDefaultTextureDescriptor();
- descriptor.usage = dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst |
- dawn::TextureUsageBit::Sampled;
+ descriptor.usage =
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst | dawn::TextureUsage::Sampled;
return descriptor;
}
@@ -347,21 +347,21 @@
{
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
descriptor.format = format;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment;
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
{
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
descriptor.format = format;
- descriptor.usage = dawn::TextureUsageBit::Storage;
+ descriptor.usage = dawn::TextureUsage::Storage;
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
{
dawn::TextureDescriptor descriptor = CreateDefaultTextureDescriptor();
descriptor.format = format;
- descriptor.usage = dawn::TextureUsageBit::Present;
+ descriptor.usage = dawn::TextureUsage::Present;
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
}
diff --git a/src/tests/unittests/validation/TextureViewValidationTests.cpp b/src/tests/unittests/validation/TextureViewValidationTests.cpp
index f2872d9..3d6c282 100644
--- a/src/tests/unittests/validation/TextureViewValidationTests.cpp
+++ b/src/tests/unittests/validation/TextureViewValidationTests.cpp
@@ -40,7 +40,7 @@
descriptor.sampleCount = sampleCount;
descriptor.format = kDefaultTextureFormat;
descriptor.mipLevelCount = mipLevelCount;
- descriptor.usage = dawn::TextureUsageBit::Sampled;
+ descriptor.usage = dawn::TextureUsage::Sampled;
return device.CreateTexture(&descriptor);
}
diff --git a/src/tests/unittests/validation/ValidationTest.cpp b/src/tests/unittests/validation/ValidationTest.cpp
index af02a0b..a1386b1 100644
--- a/src/tests/unittests/validation/ValidationTest.cpp
+++ b/src/tests/unittests/validation/ValidationTest.cpp
@@ -104,7 +104,7 @@
descriptor.sampleCount = 1;
descriptor.format = attachmentFormat;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment;
attachment = device.CreateTexture(&descriptor);
dawn::TextureView view = attachment.CreateDefaultView();
diff --git a/src/tests/unittests/validation/VertexBufferValidationTests.cpp b/src/tests/unittests/validation/VertexBufferValidationTests.cpp
index d8a2142..cf2596c0 100644
--- a/src/tests/unittests/validation/VertexBufferValidationTests.cpp
+++ b/src/tests/unittests/validation/VertexBufferValidationTests.cpp
@@ -38,7 +38,7 @@
for (auto& buffer : buffers) {
dawn::BufferDescriptor descriptor;
descriptor.size = 256;
- descriptor.usage = dawn::BufferUsageBit::Vertex;
+ descriptor.usage = dawn::BufferUsage::Vertex;
buffer = device.CreateBuffer(&descriptor);
}
diff --git a/src/tests/unittests/wire/WireArgumentTests.cpp b/src/tests/unittests/wire/WireArgumentTests.cpp
index e59fe24..495be28 100644
--- a/src/tests/unittests/wire/WireArgumentTests.cpp
+++ b/src/tests/unittests/wire/WireArgumentTests.cpp
@@ -210,8 +210,8 @@
DawnBufferDescriptor descriptor;
descriptor.nextInChain = nullptr;
descriptor.size = 8;
- descriptor.usage = static_cast<DawnBufferUsageBit>(DAWN_BUFFER_USAGE_BIT_COPY_SRC |
- DAWN_BUFFER_USAGE_BIT_COPY_DST);
+ descriptor.usage =
+ static_cast<DawnBufferUsage>(DAWN_BUFFER_USAGE_COPY_SRC | DAWN_BUFFER_USAGE_COPY_DST);
DawnBuffer buffer = dawnDeviceCreateBuffer(device, &descriptor);
DawnBuffer apiBuffer = api.GetNewBuffer();
diff --git a/src/tests/white_box/VulkanImageWrappingTests.cpp b/src/tests/white_box/VulkanImageWrappingTests.cpp
index abd4e4d..07abff4 100644
--- a/src/tests/white_box/VulkanImageWrappingTests.cpp
+++ b/src/tests/white_box/VulkanImageWrappingTests.cpp
@@ -213,8 +213,8 @@
defaultDescriptor.sampleCount = 1;
defaultDescriptor.arrayLayerCount = 1;
defaultDescriptor.mipLevelCount = 1;
- defaultDescriptor.usage = dawn::TextureUsageBit::OutputAttachment |
- dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
+ defaultDescriptor.usage = dawn::TextureUsage::OutputAttachment |
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
}
void TearDown() override {
@@ -373,8 +373,8 @@
defaultDescriptor.sampleCount = 1;
defaultDescriptor.arrayLayerCount = 1;
defaultDescriptor.mipLevelCount = 1;
- defaultDescriptor.usage = dawn::TextureUsageBit::OutputAttachment |
- dawn::TextureUsageBit::CopySrc | dawn::TextureUsageBit::CopyDst;
+ defaultDescriptor.usage = dawn::TextureUsage::OutputAttachment |
+ dawn::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst;
}
void TearDown() override {
@@ -655,7 +655,7 @@
// Create a destination buffer on |device|
dawn::BufferDescriptor bufferDesc;
bufferDesc.size = 4;
- bufferDesc.usage = dawn::BufferUsageBit::CopyDst | dawn::BufferUsageBit::CopySrc;
+ bufferDesc.usage = dawn::BufferUsage::CopyDst | dawn::BufferUsage::CopySrc;
dawn::Buffer copyDstBuffer = device.CreateBuffer(&bufferDesc);
// Copy |deviceWrappedTexture| into |copyDstBuffer|
@@ -717,7 +717,7 @@
// Create a buffer on |secondDevice|
dawn::Buffer copySrcBuffer =
- utils::CreateBufferFromData(secondDevice, dawn::BufferUsageBit::CopySrc, {0x04030201});
+ utils::CreateBufferFromData(secondDevice, dawn::BufferUsage::CopySrc, {0x04030201});
// Copy |copySrcBuffer| into |secondDeviceWrappedTexture|
dawn::BufferCopyView copySrc;
@@ -925,7 +925,7 @@
descriptor.sampleCount = 1;
descriptor.format = dawn::TextureFormat::BGRA8Unorm;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::CopyDst | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::CopyDst | dawn::TextureUsage::CopySrc;
// Fill memory with textures to trigger layout issues on AMD
std::vector<dawn::Texture> textures;
@@ -969,7 +969,7 @@
// Write the picture
{
dawn::Buffer copySrcBuffer =
- utils::CreateBufferFromData(secondDevice, data, size, dawn::BufferUsageBit::CopySrc);
+ utils::CreateBufferFromData(secondDevice, data, size, dawn::BufferUsage::CopySrc);
dawn::BufferCopyView copySrc = utils::CreateBufferCopyView(copySrcBuffer, 0, rowPitch, 0);
dawn::TextureCopyView copyDst =
utils::CreateTextureCopyView(wrappedTexture, 0, 0, {0, 0, 0});
@@ -992,7 +992,7 @@
// Copy the image into a buffer for comparison
dawn::BufferDescriptor copyDesc;
copyDesc.size = size;
- copyDesc.usage = dawn::BufferUsageBit::CopySrc | dawn::BufferUsageBit::CopyDst;
+ copyDesc.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
dawn::Buffer copyDstBuffer = device.CreateBuffer(©Desc);
{
dawn::TextureCopyView copySrc =
diff --git a/src/utils/DawnHelpers.cpp b/src/utils/DawnHelpers.cpp
index c19e74c..dbf8ff6 100644
--- a/src/utils/DawnHelpers.cpp
+++ b/src/utils/DawnHelpers.cpp
@@ -116,10 +116,10 @@
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
const void* data,
uint64_t size,
- dawn::BufferUsageBit usage) {
+ dawn::BufferUsage usage) {
dawn::BufferDescriptor descriptor;
descriptor.size = size;
- descriptor.usage = usage | dawn::BufferUsageBit::CopyDst;
+ descriptor.usage = usage | dawn::BufferUsage::CopyDst;
dawn::Buffer buffer = device.CreateBuffer(&descriptor);
buffer.SetSubData(0, size, data);
@@ -224,7 +224,7 @@
descriptor.sampleCount = 1;
descriptor.format = BasicRenderPass::kDefaultColorFormat;
descriptor.mipLevelCount = 1;
- descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::CopySrc;
+ descriptor.usage = dawn::TextureUsage::OutputAttachment | dawn::TextureUsage::CopySrc;
dawn::Texture color = device.CreateTexture(&descriptor);
return BasicRenderPass(width, height, color);
diff --git a/src/utils/DawnHelpers.h b/src/utils/DawnHelpers.h
index d38d612..89377c7 100644
--- a/src/utils/DawnHelpers.h
+++ b/src/utils/DawnHelpers.h
@@ -36,11 +36,11 @@
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
const void* data,
uint64_t size,
- dawn::BufferUsageBit usage);
+ dawn::BufferUsage usage);
template <typename T>
dawn::Buffer CreateBufferFromData(const dawn::Device& device,
- dawn::BufferUsageBit usage,
+ dawn::BufferUsage usage,
std::initializer_list<T> data) {
return CreateBufferFromData(device, data.begin(), uint32_t(sizeof(T) * data.size()), usage);
}
diff --git a/src/utils/MetalBinding.mm b/src/utils/MetalBinding.mm
index e28764d..4f9b5be 100644
--- a/src/utils/MetalBinding.mm
+++ b/src/utils/MetalBinding.mm
@@ -43,7 +43,7 @@
}
DawnSwapChainError Configure(DawnTextureFormat format,
- DawnTextureUsageBit usage,
+ DawnTextureUsage usage,
uint32_t width,
uint32_t height) {
if (format != DAWN_TEXTURE_FORMAT_BGRA8_UNORM) {
@@ -65,7 +65,7 @@
[mLayer setDrawableSize:size];
constexpr uint32_t kFramebufferOnlyTextureUsages =
- DAWN_TEXTURE_USAGE_BIT_OUTPUT_ATTACHMENT | DAWN_TEXTURE_USAGE_BIT_PRESENT;
+ DAWN_TEXTURE_USAGE_OUTPUT_ATTACHMENT | DAWN_TEXTURE_USAGE_PRESENT;
bool hasOnlyFramebufferUsages = !(usage & (~kFramebufferOnlyTextureUsages));
if (hasOnlyFramebufferUsages) {
[mLayer setFramebufferOnly:YES];