Make dawn_native use the webgpu.h header
BUG=dawn:22
Change-Id: I66e2d998f5e09030e40ec88813cd65c492018fd0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/12541
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/src/dawn_native/AttachmentState.cpp b/src/dawn_native/AttachmentState.cpp
index 3cd6621..79ce913 100644
--- a/src/dawn_native/AttachmentState.cpp
+++ b/src/dawn_native/AttachmentState.cpp
@@ -127,16 +127,16 @@
return mColorAttachmentsSet;
}
- dawn::TextureFormat AttachmentState::GetColorAttachmentFormat(uint32_t index) const {
+ wgpu::TextureFormat AttachmentState::GetColorAttachmentFormat(uint32_t index) const {
ASSERT(mColorAttachmentsSet[index]);
return mColorFormats[index];
}
bool AttachmentState::HasDepthStencilAttachment() const {
- return mDepthStencilFormat != dawn::TextureFormat::Undefined;
+ return mDepthStencilFormat != wgpu::TextureFormat::Undefined;
}
- dawn::TextureFormat AttachmentState::GetDepthStencilFormat() const {
+ wgpu::TextureFormat AttachmentState::GetDepthStencilFormat() const {
ASSERT(HasDepthStencilAttachment());
return mDepthStencilFormat;
}
diff --git a/src/dawn_native/AttachmentState.h b/src/dawn_native/AttachmentState.h
index 7a2001a..d31ea06 100644
--- a/src/dawn_native/AttachmentState.h
+++ b/src/dawn_native/AttachmentState.h
@@ -50,9 +50,9 @@
protected:
std::bitset<kMaxColorAttachments> mColorAttachmentsSet;
- std::array<dawn::TextureFormat, kMaxColorAttachments> mColorFormats;
+ std::array<wgpu::TextureFormat, kMaxColorAttachments> mColorFormats;
// Default (texture format Undefined) indicates there is no depth stencil attachment.
- dawn::TextureFormat mDepthStencilFormat = dawn::TextureFormat::Undefined;
+ wgpu::TextureFormat mDepthStencilFormat = wgpu::TextureFormat::Undefined;
uint32_t mSampleCount = 0;
};
@@ -62,9 +62,9 @@
~AttachmentState() override;
std::bitset<kMaxColorAttachments> GetColorAttachmentsMask() const;
- dawn::TextureFormat GetColorAttachmentFormat(uint32_t index) const;
+ wgpu::TextureFormat GetColorAttachmentFormat(uint32_t index) const;
bool HasDepthStencilAttachment() const;
- dawn::TextureFormat GetDepthStencilFormat() const;
+ wgpu::TextureFormat GetDepthStencilFormat() const;
uint32_t GetSampleCount() const;
private:
diff --git a/src/dawn_native/BindGroup.cpp b/src/dawn_native/BindGroup.cpp
index ceaf913..3765fed 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::BufferUsage requiredUsage) {
+ wgpu::BufferUsage requiredUsage) {
if (binding.buffer == nullptr || binding.sampler != nullptr ||
binding.textureView != nullptr) {
return DAWN_VALIDATION_ERROR("expected buffer binding");
@@ -38,7 +38,7 @@
DAWN_TRY(device->ValidateObject(binding.buffer));
uint64_t bufferSize = binding.buffer->GetSize();
- uint64_t bindingSize = (binding.size == dawn::kWholeSize) ? bufferSize : binding.size;
+ uint64_t bindingSize = (binding.size == wgpu::kWholeSize) ? bufferSize : binding.size;
if (bindingSize > bufferSize) {
return DAWN_VALIDATION_ERROR("Buffer binding size larger than the buffer");
}
@@ -63,10 +63,10 @@
MaybeError ValidateTextureBinding(const DeviceBase* device,
const BindGroupBinding& binding,
- dawn::TextureUsage requiredUsage,
+ wgpu::TextureUsage requiredUsage,
bool multisampledBinding,
- dawn::TextureComponentType requiredComponentType,
- dawn::TextureViewDimension requiredDimension) {
+ wgpu::TextureComponentType requiredComponentType,
+ wgpu::TextureViewDimension requiredDimension) {
if (binding.textureView == nullptr || binding.sampler != nullptr ||
binding.buffer != nullptr) {
return DAWN_VALIDATION_ERROR("expected texture binding");
@@ -143,23 +143,23 @@
// Perform binding-type specific validation.
switch (layoutInfo.types[bindingIndex]) {
- case dawn::BindingType::UniformBuffer:
- DAWN_TRY(ValidateBufferBinding(device, binding, dawn::BufferUsage::Uniform));
+ case wgpu::BindingType::UniformBuffer:
+ DAWN_TRY(ValidateBufferBinding(device, binding, wgpu::BufferUsage::Uniform));
break;
- case dawn::BindingType::StorageBuffer:
- DAWN_TRY(ValidateBufferBinding(device, binding, dawn::BufferUsage::Storage));
+ case wgpu::BindingType::StorageBuffer:
+ DAWN_TRY(ValidateBufferBinding(device, binding, wgpu::BufferUsage::Storage));
break;
- case dawn::BindingType::SampledTexture:
- DAWN_TRY(ValidateTextureBinding(device, binding, dawn::TextureUsage::Sampled,
+ case wgpu::BindingType::SampledTexture:
+ DAWN_TRY(ValidateTextureBinding(device, binding, wgpu::TextureUsage::Sampled,
layoutInfo.multisampled[bindingIndex],
layoutInfo.textureComponentTypes[bindingIndex],
layoutInfo.textureDimensions[bindingIndex]));
break;
- case dawn::BindingType::Sampler:
+ case wgpu::BindingType::Sampler:
DAWN_TRY(ValidateSamplerBinding(device, binding));
break;
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
}
@@ -193,7 +193,7 @@
mBindings[bindingIndex] = binding.buffer;
mOffsets[bindingIndex] = binding.offset;
uint64_t bufferSize =
- (binding.size == dawn::kWholeSize) ? binding.buffer->GetSize() : binding.size;
+ (binding.size == wgpu::kWholeSize) ? binding.buffer->GetSize() : binding.size;
mSizes[bindingIndex] = bufferSize;
continue;
}
@@ -230,8 +230,8 @@
ASSERT(!IsError());
ASSERT(binding < kMaxBindingsPerGroup);
ASSERT(mLayout->GetBindingInfo().mask[binding]);
- ASSERT(mLayout->GetBindingInfo().types[binding] == dawn::BindingType::UniformBuffer ||
- mLayout->GetBindingInfo().types[binding] == dawn::BindingType::StorageBuffer);
+ ASSERT(mLayout->GetBindingInfo().types[binding] == wgpu::BindingType::UniformBuffer ||
+ mLayout->GetBindingInfo().types[binding] == wgpu::BindingType::StorageBuffer);
BufferBase* buffer = static_cast<BufferBase*>(mBindings[binding].Get());
return {buffer, mOffsets[binding], mSizes[binding]};
}
@@ -240,7 +240,7 @@
ASSERT(!IsError());
ASSERT(binding < kMaxBindingsPerGroup);
ASSERT(mLayout->GetBindingInfo().mask[binding]);
- ASSERT(mLayout->GetBindingInfo().types[binding] == dawn::BindingType::Sampler);
+ ASSERT(mLayout->GetBindingInfo().types[binding] == wgpu::BindingType::Sampler);
return static_cast<SamplerBase*>(mBindings[binding].Get());
}
@@ -248,7 +248,7 @@
ASSERT(!IsError());
ASSERT(binding < kMaxBindingsPerGroup);
ASSERT(mLayout->GetBindingInfo().mask[binding]);
- ASSERT(mLayout->GetBindingInfo().types[binding] == dawn::BindingType::SampledTexture);
+ ASSERT(mLayout->GetBindingInfo().types[binding] == wgpu::BindingType::SampledTexture);
return static_cast<TextureViewBase*>(mBindings[binding].Get());
}
diff --git a/src/dawn_native/BindGroupAndStorageBarrierTracker.h b/src/dawn_native/BindGroupAndStorageBarrierTracker.h
index dedb5ee..de63efc 100644
--- a/src/dawn_native/BindGroupAndStorageBarrierTracker.h
+++ b/src/dawn_native/BindGroupAndStorageBarrierTracker.h
@@ -42,26 +42,26 @@
const auto& info = layout->GetBindingInfo();
for (uint32_t binding : IterateBitSet(info.mask)) {
- if ((info.visibilities[binding] & dawn::ShaderStage::Compute) == 0) {
+ if ((info.visibilities[binding] & wgpu::ShaderStage::Compute) == 0) {
continue;
}
mBindingTypes[index][binding] = info.types[binding];
switch (info.types[binding]) {
- case dawn::BindingType::UniformBuffer:
- case dawn::BindingType::ReadonlyStorageBuffer:
- case dawn::BindingType::Sampler:
- case dawn::BindingType::SampledTexture:
+ case wgpu::BindingType::UniformBuffer:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::Sampler:
+ case wgpu::BindingType::SampledTexture:
// Don't require barriers.
break;
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
mBuffersNeedingBarrier[index].set(binding);
mBuffers[index][binding] =
bindGroup->GetBindingAsBufferBinding(binding).buffer;
break;
- case dawn::BindingType::StorageTexture:
+ case wgpu::BindingType::StorageTexture:
// Not implemented.
default:
@@ -76,7 +76,7 @@
protected:
std::array<std::bitset<kMaxBindingsPerGroup>, kMaxBindGroups> mBuffersNeedingBarrier = {};
- std::array<std::array<dawn::BindingType, kMaxBindingsPerGroup>, kMaxBindGroups>
+ std::array<std::array<wgpu::BindingType, kMaxBindingsPerGroup>, kMaxBindGroups>
mBindingTypes = {};
std::array<std::array<BufferBase*, kMaxBindingsPerGroup>, kMaxBindGroups> mBuffers = {};
};
diff --git a/src/dawn_native/BindGroupLayout.cpp b/src/dawn_native/BindGroupLayout.cpp
index 2001b6b..ac5308d 100644
--- a/src/dawn_native/BindGroupLayout.cpp
+++ b/src/dawn_native/BindGroupLayout.cpp
@@ -38,7 +38,7 @@
DAWN_TRY(ValidateBindingType(binding.type));
DAWN_TRY(ValidateTextureComponentType(binding.textureComponentType));
- if (binding.textureDimension != dawn::TextureViewDimension::Undefined) {
+ if (binding.textureDimension != wgpu::TextureViewDimension::Undefined) {
DAWN_TRY(ValidateTextureViewDimension(binding.textureDimension));
}
@@ -50,25 +50,25 @@
}
switch (binding.type) {
- case dawn::BindingType::UniformBuffer:
+ case wgpu::BindingType::UniformBuffer:
if (binding.hasDynamicOffset) {
++dynamicUniformBufferCount;
}
break;
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
if (binding.hasDynamicOffset) {
++dynamicStorageBufferCount;
}
break;
- case dawn::BindingType::SampledTexture:
- case dawn::BindingType::Sampler:
+ case wgpu::BindingType::SampledTexture:
+ case wgpu::BindingType::Sampler:
if (binding.hasDynamicOffset) {
return DAWN_VALIDATION_ERROR("Samplers and textures cannot be dynamic");
}
break;
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
return DAWN_VALIDATION_ERROR("readonly storage buffers aren't supported (yet)");
- case dawn::BindingType::StorageTexture:
+ case wgpu::BindingType::StorageTexture:
return DAWN_VALIDATION_ERROR("storage textures aren't supported (yet)");
}
@@ -140,24 +140,24 @@
mBindingInfo.types[index] = binding.type;
mBindingInfo.textureComponentTypes[index] = binding.textureComponentType;
- if (binding.textureDimension == dawn::TextureViewDimension::Undefined) {
- mBindingInfo.textureDimensions[index] = dawn::TextureViewDimension::e2D;
+ if (binding.textureDimension == wgpu::TextureViewDimension::Undefined) {
+ mBindingInfo.textureDimensions[index] = wgpu::TextureViewDimension::e2D;
} else {
mBindingInfo.textureDimensions[index] = binding.textureDimension;
}
if (binding.hasDynamicOffset) {
mBindingInfo.hasDynamicOffset.set(index);
switch (binding.type) {
- case dawn::BindingType::UniformBuffer:
+ case wgpu::BindingType::UniformBuffer:
++mDynamicUniformBufferCount;
break;
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
++mDynamicStorageBufferCount;
break;
- case dawn::BindingType::SampledTexture:
- case dawn::BindingType::Sampler:
- case dawn::BindingType::ReadonlyStorageBuffer:
- case dawn::BindingType::StorageTexture:
+ case wgpu::BindingType::SampledTexture:
+ case wgpu::BindingType::Sampler:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
UNREACHABLE();
break;
}
diff --git a/src/dawn_native/BindGroupLayout.h b/src/dawn_native/BindGroupLayout.h
index c241cab..8c275f0 100644
--- a/src/dawn_native/BindGroupLayout.h
+++ b/src/dawn_native/BindGroupLayout.h
@@ -40,10 +40,10 @@
static BindGroupLayoutBase* MakeError(DeviceBase* device);
struct LayoutBindingInfo {
- std::array<dawn::ShaderStage, kMaxBindingsPerGroup> visibilities;
- std::array<dawn::BindingType, kMaxBindingsPerGroup> types;
- std::array<dawn::TextureComponentType, kMaxBindingsPerGroup> textureComponentTypes;
- std::array<dawn::TextureViewDimension, kMaxBindingsPerGroup> textureDimensions;
+ std::array<wgpu::ShaderStage, kMaxBindingsPerGroup> visibilities;
+ std::array<wgpu::BindingType, kMaxBindingsPerGroup> types;
+ std::array<wgpu::TextureComponentType, kMaxBindingsPerGroup> textureComponentTypes;
+ std::array<wgpu::TextureViewDimension, kMaxBindingsPerGroup> textureDimensions;
std::bitset<kMaxBindingsPerGroup> hasDynamicOffset;
std::bitset<kMaxBindingsPerGroup> multisampled;
std::bitset<kMaxBindingsPerGroup> mask;
diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp
index 21bc305..7bfed63 100644
--- a/src/dawn_native/Buffer.cpp
+++ b/src/dawn_native/Buffer.cpp
@@ -91,17 +91,17 @@
DAWN_TRY(ValidateBufferUsage(descriptor->usage));
- dawn::BufferUsage usage = descriptor->usage;
+ wgpu::BufferUsage usage = descriptor->usage;
- const dawn::BufferUsage kMapWriteAllowedUsages =
- dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopySrc;
- if (usage & dawn::BufferUsage::MapWrite && (usage & kMapWriteAllowedUsages) != usage) {
+ const wgpu::BufferUsage kMapWriteAllowedUsages =
+ wgpu::BufferUsage::MapWrite | wgpu::BufferUsage::CopySrc;
+ if (usage & wgpu::BufferUsage::MapWrite && (usage & kMapWriteAllowedUsages) != usage) {
return DAWN_VALIDATION_ERROR("Only CopySrc is allowed with MapWrite");
}
- const dawn::BufferUsage kMapReadAllowedUsages =
- dawn::BufferUsage::MapRead | dawn::BufferUsage::CopyDst;
- if (usage & dawn::BufferUsage::MapRead && (usage & kMapReadAllowedUsages) != usage) {
+ const wgpu::BufferUsage kMapReadAllowedUsages =
+ wgpu::BufferUsage::MapRead | wgpu::BufferUsage::CopyDst;
+ if (usage & wgpu::BufferUsage::MapRead && (usage & kMapReadAllowedUsages) != usage) {
return DAWN_VALIDATION_ERROR("Only CopyDst is allowed with MapRead");
}
@@ -146,7 +146,7 @@
return mSize;
}
- dawn::BufferUsage BufferBase::GetUsage() const {
+ wgpu::BufferUsage BufferBase::GetUsage() const {
ASSERT(!IsError());
return mUsage;
}
@@ -189,7 +189,7 @@
}
void BufferBase::CallMapReadCallback(uint32_t serial,
- DawnBufferMapAsyncStatus status,
+ WGPUBufferMapAsyncStatus status,
const void* pointer,
uint32_t dataLength) {
ASSERT(!IsError());
@@ -197,14 +197,14 @@
ASSERT(mMapWriteCallback == nullptr);
// Tag the callback as fired before firing it, otherwise it could fire a second time if
// for example buffer.Unmap() is called inside the application-provided callback.
- DawnBufferMapReadCallback callback = mMapReadCallback;
+ WGPUBufferMapReadCallback callback = mMapReadCallback;
mMapReadCallback = nullptr;
callback(status, pointer, dataLength, mMapUserdata);
}
}
void BufferBase::CallMapWriteCallback(uint32_t serial,
- DawnBufferMapAsyncStatus status,
+ WGPUBufferMapAsyncStatus status,
void* pointer,
uint32_t dataLength) {
ASSERT(!IsError());
@@ -212,7 +212,7 @@
ASSERT(mMapReadCallback == nullptr);
// Tag the callback as fired before firing it, otherwise it could fire a second time if
// for example buffer.Unmap() is called inside the application-provided callback.
- DawnBufferMapWriteCallback callback = mMapWriteCallback;
+ WGPUBufferMapWriteCallback callback = mMapWriteCallback;
mMapWriteCallback = nullptr;
callback(status, pointer, dataLength, mMapUserdata);
}
@@ -229,8 +229,8 @@
}
}
- void BufferBase::MapReadAsync(DawnBufferMapReadCallback callback, void* userdata) {
- if (GetDevice()->ConsumedError(ValidateMap(dawn::BufferUsage::MapRead))) {
+ void BufferBase::MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata) {
+ if (GetDevice()->ConsumedError(ValidateMap(wgpu::BufferUsage::MapRead))) {
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, 0, userdata);
return;
}
@@ -265,8 +265,8 @@
return {};
}
- void BufferBase::MapWriteAsync(DawnBufferMapWriteCallback callback, void* userdata) {
- if (GetDevice()->ConsumedError(ValidateMap(dawn::BufferUsage::MapWrite))) {
+ void BufferBase::MapWriteAsync(WGPUBufferMapWriteCallback callback, void* userdata) {
+ if (GetDevice()->ConsumedError(ValidateMap(wgpu::BufferUsage::MapWrite))) {
callback(DAWN_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, 0, userdata);
return;
}
@@ -374,14 +374,14 @@
return DAWN_VALIDATION_ERROR("Buffer subdata out of range");
}
- if (!(mUsage & dawn::BufferUsage::CopyDst)) {
+ if (!(mUsage & wgpu::BufferUsage::CopyDst)) {
return DAWN_VALIDATION_ERROR("Buffer needs the CopyDst usage bit");
}
return {};
}
- MaybeError BufferBase::ValidateMap(dawn::BufferUsage requiredUsage) const {
+ MaybeError BufferBase::ValidateMap(wgpu::BufferUsage requiredUsage) const {
DAWN_TRY(GetDevice()->ValidateObject(this));
switch (mState) {
@@ -409,7 +409,7 @@
// even if it did not have a mappable usage.
return {};
case BufferState::Unmapped:
- if ((mUsage & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) == 0) {
+ if ((mUsage & (wgpu::BufferUsage::MapRead | wgpu::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 9549c50..3a675aa 100644
--- a/src/dawn_native/Buffer.h
+++ b/src/dawn_native/Buffer.h
@@ -27,12 +27,12 @@
MaybeError ValidateBufferDescriptor(DeviceBase* device, const BufferDescriptor* descriptor);
- static constexpr dawn::BufferUsage kReadOnlyBufferUsages =
- dawn::BufferUsage::MapRead | dawn::BufferUsage::CopySrc | dawn::BufferUsage::Index |
- dawn::BufferUsage::Vertex | dawn::BufferUsage::Uniform;
+ static constexpr wgpu::BufferUsage kReadOnlyBufferUsages =
+ wgpu::BufferUsage::MapRead | wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::Index |
+ wgpu::BufferUsage::Vertex | wgpu::BufferUsage::Uniform;
- static constexpr dawn::BufferUsage kWritableBufferUsages =
- dawn::BufferUsage::MapWrite | dawn::BufferUsage::CopyDst | dawn::BufferUsage::Storage;
+ static constexpr wgpu::BufferUsage kWritableBufferUsages =
+ wgpu::BufferUsage::MapWrite | wgpu::BufferUsage::CopyDst | wgpu::BufferUsage::Storage;
class BufferBase : public ObjectBase {
enum class BufferState {
@@ -51,7 +51,7 @@
uint8_t** mappedPointer);
uint64_t GetSize() const;
- dawn::BufferUsage GetUsage() const;
+ wgpu::BufferUsage GetUsage() const;
MaybeError MapAtCreation(uint8_t** mappedPointer);
@@ -59,8 +59,8 @@
// Dawn API
void SetSubData(uint32_t start, uint32_t count, const void* data);
- void MapReadAsync(DawnBufferMapReadCallback callback, void* userdata);
- void MapWriteAsync(DawnBufferMapWriteCallback callback, void* userdata);
+ void MapReadAsync(WGPUBufferMapReadCallback callback, void* userdata);
+ void MapWriteAsync(WGPUBufferMapWriteCallback callback, void* userdata);
void Unmap();
void Destroy();
@@ -68,11 +68,11 @@
BufferBase(DeviceBase* device, ObjectBase::ErrorTag tag);
void CallMapReadCallback(uint32_t serial,
- DawnBufferMapAsyncStatus status,
+ WGPUBufferMapAsyncStatus status,
const void* pointer,
uint32_t dataLength);
void CallMapWriteCallback(uint32_t serial,
- DawnBufferMapAsyncStatus status,
+ WGPUBufferMapAsyncStatus status,
void* pointer,
uint32_t dataLength);
@@ -90,15 +90,15 @@
MaybeError CopyFromStagingBuffer();
MaybeError ValidateSetSubData(uint32_t start, uint32_t count) const;
- MaybeError ValidateMap(dawn::BufferUsage requiredUsage) const;
+ MaybeError ValidateMap(wgpu::BufferUsage requiredUsage) const;
MaybeError ValidateUnmap() const;
MaybeError ValidateDestroy() const;
uint64_t mSize = 0;
- dawn::BufferUsage mUsage = dawn::BufferUsage::None;
+ wgpu::BufferUsage mUsage = wgpu::BufferUsage::None;
- DawnBufferMapReadCallback mMapReadCallback = nullptr;
- DawnBufferMapWriteCallback mMapWriteCallback = nullptr;
+ WGPUBufferMapReadCallback mMapReadCallback = nullptr;
+ WGPUBufferMapWriteCallback mMapWriteCallback = nullptr;
void* mMapUserdata = 0;
uint32_t mMapSerial = 0;
diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp
index c41484d..09a6d7f 100644
--- a/src/dawn_native/CommandEncoder.cpp
+++ b/src/dawn_native/CommandEncoder.cpp
@@ -242,8 +242,8 @@
return {};
}
- MaybeError ValidateCanUseAs(BufferBase* buffer, dawn::BufferUsage usage) {
- ASSERT(dawn::HasZeroOrOneBits(usage));
+ MaybeError ValidateCanUseAs(BufferBase* buffer, wgpu::BufferUsage usage) {
+ ASSERT(wgpu::HasZeroOrOneBits(usage));
if (!(buffer->GetUsage() & usage)) {
return DAWN_VALIDATION_ERROR("buffer doesn't have the required usage.");
}
@@ -251,8 +251,8 @@
return {};
}
- MaybeError ValidateCanUseAs(TextureBase* texture, dawn::TextureUsage usage) {
- ASSERT(dawn::HasZeroOrOneBits(usage));
+ MaybeError ValidateCanUseAs(TextureBase* texture, wgpu::TextureUsage usage) {
+ ASSERT(wgpu::HasZeroOrOneBits(usage));
if (!(texture->GetUsage() & usage)) {
return DAWN_VALIDATION_ERROR("texture doesn't have the required usage.");
}
@@ -352,7 +352,7 @@
"The size of the resolve target must be the same as the color attachment");
}
- dawn::TextureFormat resolveTargetFormat = resolveTarget->GetFormat().format;
+ wgpu::TextureFormat resolveTargetFormat = resolveTarget->GetFormat().format;
if (resolveTargetFormat != attachment->GetFormat().format) {
return DAWN_VALIDATION_ERROR(
"The format of the resolve target must be the same as the color attachment");
@@ -755,8 +755,8 @@
DAWN_TRY(ValidateB2BCopySizeAlignment(copy->size, copy->sourceOffset,
copy->destinationOffset));
- DAWN_TRY(ValidateCanUseAs(copy->source.Get(), dawn::BufferUsage::CopySrc));
- DAWN_TRY(ValidateCanUseAs(copy->destination.Get(), dawn::BufferUsage::CopyDst));
+ DAWN_TRY(ValidateCanUseAs(copy->source.Get(), wgpu::BufferUsage::CopySrc));
+ DAWN_TRY(ValidateCanUseAs(copy->destination.Get(), wgpu::BufferUsage::CopyDst));
mResourceUsages.topLevelBuffers.insert(copy->source.Get());
mResourceUsages.topLevelBuffers.insert(copy->destination.Get());
@@ -789,9 +789,9 @@
copy->destination.texture->GetFormat()));
DAWN_TRY(
- ValidateCanUseAs(copy->source.buffer.Get(), dawn::BufferUsage::CopySrc));
+ ValidateCanUseAs(copy->source.buffer.Get(), wgpu::BufferUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(copy->destination.texture.Get(),
- dawn::TextureUsage::CopyDst));
+ wgpu::TextureUsage::CopyDst));
mResourceUsages.topLevelBuffers.insert(copy->source.buffer.Get());
mResourceUsages.topLevelTextures.insert(copy->destination.texture.Get());
@@ -824,9 +824,9 @@
copy->source.texture->GetFormat()));
DAWN_TRY(
- ValidateCanUseAs(copy->source.texture.Get(), dawn::TextureUsage::CopySrc));
+ ValidateCanUseAs(copy->source.texture.Get(), wgpu::TextureUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(copy->destination.buffer.Get(),
- dawn::BufferUsage::CopyDst));
+ wgpu::BufferUsage::CopyDst));
mResourceUsages.topLevelTextures.insert(copy->source.texture.Get());
mResourceUsages.topLevelBuffers.insert(copy->destination.buffer.Get());
@@ -852,9 +852,9 @@
DAWN_TRY(ValidateCopySizeFitsInTexture(copy->destination, copy->copySize));
DAWN_TRY(
- ValidateCanUseAs(copy->source.texture.Get(), dawn::TextureUsage::CopySrc));
+ ValidateCanUseAs(copy->source.texture.Get(), wgpu::TextureUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(copy->destination.texture.Get(),
- dawn::TextureUsage::CopyDst));
+ wgpu::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 c249a33..e3bb099 100644
--- a/src/dawn_native/CommandValidation.cpp
+++ b/src/dawn_native/CommandValidation.cpp
@@ -31,29 +31,29 @@
const auto& layoutInfo = group->GetLayout()->GetBindingInfo();
for (uint32_t i : IterateBitSet(layoutInfo.mask)) {
- dawn::BindingType type = layoutInfo.types[i];
+ wgpu::BindingType type = layoutInfo.types[i];
switch (type) {
- case dawn::BindingType::UniformBuffer: {
+ case wgpu::BindingType::UniformBuffer: {
BufferBase* buffer = group->GetBindingAsBufferBinding(i).buffer;
- usageTracker->BufferUsedAs(buffer, dawn::BufferUsage::Uniform);
+ usageTracker->BufferUsedAs(buffer, wgpu::BufferUsage::Uniform);
} break;
- case dawn::BindingType::StorageBuffer: {
+ case wgpu::BindingType::StorageBuffer: {
BufferBase* buffer = group->GetBindingAsBufferBinding(i).buffer;
- usageTracker->BufferUsedAs(buffer, dawn::BufferUsage::Storage);
+ usageTracker->BufferUsedAs(buffer, wgpu::BufferUsage::Storage);
} break;
- case dawn::BindingType::SampledTexture: {
+ case wgpu::BindingType::SampledTexture: {
TextureBase* texture = group->GetBindingAsTextureView(i)->GetTexture();
- usageTracker->TextureUsedAs(texture, dawn::TextureUsage::Sampled);
+ usageTracker->TextureUsedAs(texture, wgpu::TextureUsage::Sampled);
} break;
- case dawn::BindingType::Sampler:
+ case wgpu::BindingType::Sampler:
break;
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
}
@@ -82,14 +82,14 @@
DrawIndirectCmd* cmd = commands->NextCommand<DrawIndirectCmd>();
DAWN_TRY(commandBufferState->ValidateCanDraw());
usageTracker->BufferUsedAs(cmd->indirectBuffer.Get(),
- dawn::BufferUsage::Indirect);
+ wgpu::BufferUsage::Indirect);
} break;
case Command::DrawIndexedIndirect: {
DrawIndexedIndirectCmd* cmd = commands->NextCommand<DrawIndexedIndirectCmd>();
DAWN_TRY(commandBufferState->ValidateCanDrawIndexed());
usageTracker->BufferUsedAs(cmd->indirectBuffer.Get(),
- dawn::BufferUsage::Indirect);
+ wgpu::BufferUsage::Indirect);
} break;
case Command::InsertDebugMarker: {
@@ -132,14 +132,14 @@
case Command::SetIndexBuffer: {
SetIndexBufferCmd* cmd = commands->NextCommand<SetIndexBufferCmd>();
- usageTracker->BufferUsedAs(cmd->buffer.Get(), dawn::BufferUsage::Index);
+ usageTracker->BufferUsedAs(cmd->buffer.Get(), wgpu::BufferUsage::Index);
commandBufferState->SetIndexBuffer();
} break;
case Command::SetVertexBuffer: {
SetVertexBufferCmd* cmd = commands->NextCommand<SetVertexBufferCmd>();
- usageTracker->BufferUsedAs(cmd->buffer.Get(), dawn::BufferUsage::Vertex);
+ usageTracker->BufferUsedAs(cmd->buffer.Get(), wgpu::BufferUsage::Vertex);
commandBufferState->SetVertexBuffer(cmd->slot);
} break;
@@ -199,18 +199,18 @@
for (uint32_t i : IterateBitSet(renderPass->attachmentState->GetColorAttachmentsMask())) {
RenderPassColorAttachmentInfo* colorAttachment = &renderPass->colorAttachments[i];
TextureBase* texture = colorAttachment->view->GetTexture();
- usageTracker.TextureUsedAs(texture, dawn::TextureUsage::OutputAttachment);
+ usageTracker.TextureUsedAs(texture, wgpu::TextureUsage::OutputAttachment);
TextureViewBase* resolveTarget = colorAttachment->resolveTarget.Get();
if (resolveTarget != nullptr) {
usageTracker.TextureUsedAs(resolveTarget->GetTexture(),
- dawn::TextureUsage::OutputAttachment);
+ wgpu::TextureUsage::OutputAttachment);
}
}
if (renderPass->attachmentState->HasDepthStencilAttachment()) {
TextureBase* texture = renderPass->depthStencilAttachment.view->GetTexture();
- usageTracker.TextureUsedAs(texture, dawn::TextureUsage::OutputAttachment);
+ usageTracker.TextureUsedAs(texture, wgpu::TextureUsage::OutputAttachment);
}
Command type;
@@ -310,7 +310,7 @@
DispatchIndirectCmd* cmd = commands->NextCommand<DispatchIndirectCmd>();
DAWN_TRY(commandBufferState.ValidateCanDispatch());
usageTracker.BufferUsedAs(cmd->indirectBuffer.Get(),
- dawn::BufferUsage::Indirect);
+ wgpu::BufferUsage::Indirect);
} break;
case Command::InsertDebugMarker: {
diff --git a/src/dawn_native/Commands.h b/src/dawn_native/Commands.h
index eeaf9dc..05632d7 100644
--- a/src/dawn_native/Commands.h
+++ b/src/dawn_native/Commands.h
@@ -66,17 +66,17 @@
struct RenderPassColorAttachmentInfo {
Ref<TextureViewBase> view;
Ref<TextureViewBase> resolveTarget;
- dawn::LoadOp loadOp;
- dawn::StoreOp storeOp;
+ wgpu::LoadOp loadOp;
+ wgpu::StoreOp storeOp;
dawn_native::Color clearColor;
};
struct RenderPassDepthStencilAttachmentInfo {
Ref<TextureViewBase> view;
- dawn::LoadOp depthLoadOp;
- dawn::StoreOp depthStoreOp;
- dawn::LoadOp stencilLoadOp;
- dawn::StoreOp stencilStoreOp;
+ wgpu::LoadOp depthLoadOp;
+ wgpu::StoreOp depthStoreOp;
+ wgpu::LoadOp stencilLoadOp;
+ wgpu::StoreOp stencilStoreOp;
float clearDepth;
uint32_t clearStencil;
};
diff --git a/src/dawn_native/ComputePipeline.cpp b/src/dawn_native/ComputePipeline.cpp
index 6b20706..a9bfb21 100644
--- a/src/dawn_native/ComputePipeline.cpp
+++ b/src/dawn_native/ComputePipeline.cpp
@@ -36,7 +36,7 @@
ComputePipelineBase::ComputePipelineBase(DeviceBase* device,
const ComputePipelineDescriptor* descriptor,
bool blueprint)
- : PipelineBase(device, descriptor->layout, dawn::ShaderStage::Compute),
+ : PipelineBase(device, descriptor->layout, wgpu::ShaderStage::Compute),
mModule(descriptor->computeStage.module),
mEntryPoint(descriptor->computeStage.entryPoint),
mIsBlueprint(blueprint) {
diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp
index bf36778..c160447 100644
--- a/src/dawn_native/Device.cpp
+++ b/src/dawn_native/Device.cpp
@@ -94,16 +94,16 @@
ASSERT(mCaches->shaderModules.empty());
}
- void DeviceBase::HandleError(dawn::ErrorType type, const char* message) {
+ void DeviceBase::HandleError(wgpu::ErrorType type, const char* message) {
mCurrentErrorScope->HandleError(type, message);
}
- void DeviceBase::InjectError(dawn::ErrorType type, const char* message) {
+ void DeviceBase::InjectError(wgpu::ErrorType type, const char* message) {
if (ConsumedError(ValidateErrorType(type))) {
return;
}
- if (DAWN_UNLIKELY(type == dawn::ErrorType::NoError)) {
- HandleError(dawn::ErrorType::Validation, "Invalid injected error NoError");
+ if (DAWN_UNLIKELY(type == wgpu::ErrorType::NoError)) {
+ HandleError(wgpu::ErrorType::Validation, "Invalid injected error NoError");
return;
}
HandleError(type, message);
@@ -115,18 +115,18 @@
delete error;
}
- void DeviceBase::SetUncapturedErrorCallback(dawn::ErrorCallback callback, void* userdata) {
+ void DeviceBase::SetUncapturedErrorCallback(wgpu::ErrorCallback callback, void* userdata) {
mRootErrorScope->SetCallback(callback, userdata);
}
- void DeviceBase::PushErrorScope(dawn::ErrorFilter filter) {
+ void DeviceBase::PushErrorScope(wgpu::ErrorFilter filter) {
if (ConsumedError(ValidateErrorFilter(filter))) {
return;
}
mCurrentErrorScope = AcquireRef(new ErrorScope(filter, mCurrentErrorScope.Get()));
}
- bool DeviceBase::PopErrorScope(dawn::ErrorCallback callback, void* userdata) {
+ bool DeviceBase::PopErrorScope(wgpu::ErrorCallback callback, void* userdata) {
if (DAWN_UNLIKELY(mCurrentErrorScope.Get() == mRootErrorScope.Get())) {
return false;
}
@@ -168,7 +168,7 @@
return mFenceSignalTracker.get();
}
- ResultOrError<const Format*> DeviceBase::GetInternalFormat(dawn::TextureFormat format) const {
+ ResultOrError<const Format*> DeviceBase::GetInternalFormat(wgpu::TextureFormat format) const {
size_t index = ComputeFormatIndex(format);
if (index >= mFormatTable.size()) {
return DAWN_VALIDATION_ERROR("Unknown texture format");
@@ -182,7 +182,7 @@
return internalFormat;
}
- const Format& DeviceBase::GetValidInternalFormat(dawn::TextureFormat format) const {
+ const Format& DeviceBase::GetValidInternalFormat(wgpu::TextureFormat format) const {
size_t index = ComputeFormatIndex(format);
ASSERT(index < mFormatTable.size());
ASSERT(mFormatTable[index].isSupported);
@@ -413,7 +413,7 @@
return result;
}
void DeviceBase::CreateBufferMappedAsync(const BufferDescriptor* descriptor,
- dawn::BufferCreateMappedCallback callback,
+ wgpu::BufferCreateMappedCallback callback,
void* userdata) {
DawnCreateBufferMappedResult result = CreateBufferMapped(descriptor);
diff --git a/src/dawn_native/Device.h b/src/dawn_native/Device.h
index 85ca254..e828195 100644
--- a/src/dawn_native/Device.h
+++ b/src/dawn_native/Device.h
@@ -46,7 +46,7 @@
DeviceBase(AdapterBase* adapter, const DeviceDescriptor* descriptor);
virtual ~DeviceBase();
- void HandleError(dawn::ErrorType type, const char* message);
+ void HandleError(wgpu::ErrorType type, const char* message);
bool ConsumedError(MaybeError maybeError) {
if (DAWN_UNLIKELY(maybeError.IsError())) {
@@ -74,15 +74,15 @@
ErrorScopeTracker* GetErrorScopeTracker() const;
FenceSignalTracker* GetFenceSignalTracker() const;
- // Returns the Format corresponding to the dawn::TextureFormat or an error if the format
- // isn't a valid dawn::TextureFormat or isn't supported by this device.
+ // Returns the Format corresponding to the wgpu::TextureFormat or an error if the format
+ // isn't a valid wgpu::TextureFormat or isn't supported by this device.
// The pointer returned has the same lifetime as the device.
- ResultOrError<const Format*> GetInternalFormat(dawn::TextureFormat format) const;
+ ResultOrError<const Format*> GetInternalFormat(wgpu::TextureFormat format) const;
- // Returns the Format corresponding to the dawn::TextureFormat and assumes the format is
+ // Returns the Format corresponding to the wgpu::TextureFormat and assumes the format is
// valid and supported.
// The reference returned has the same lifetime as the device.
- const Format& GetValidInternalFormat(dawn::TextureFormat format) const;
+ const Format& GetValidInternalFormat(wgpu::TextureFormat format) const;
virtual CommandBufferBase* CreateCommandBuffer(
CommandEncoderBase* encoder,
@@ -143,7 +143,7 @@
BufferBase* CreateBuffer(const BufferDescriptor* descriptor);
DawnCreateBufferMappedResult CreateBufferMapped(const BufferDescriptor* descriptor);
void CreateBufferMappedAsync(const BufferDescriptor* descriptor,
- dawn::BufferCreateMappedCallback callback,
+ wgpu::BufferCreateMappedCallback callback,
void* userdata);
CommandEncoderBase* CreateCommandEncoder(const CommandEncoderDescriptor* descriptor);
ComputePipelineBase* CreateComputePipeline(const ComputePipelineDescriptor* descriptor);
@@ -159,13 +159,13 @@
TextureViewBase* CreateTextureView(TextureBase* texture,
const TextureViewDescriptor* descriptor);
- void InjectError(dawn::ErrorType type, const char* message);
+ void InjectError(wgpu::ErrorType type, const char* message);
void Tick();
- void SetUncapturedErrorCallback(dawn::ErrorCallback callback, void* userdata);
- void PushErrorScope(dawn::ErrorFilter filter);
- bool PopErrorScope(dawn::ErrorCallback callback, void* userdata);
+ void SetUncapturedErrorCallback(wgpu::ErrorCallback callback, void* userdata);
+ void PushErrorScope(wgpu::ErrorFilter filter);
+ bool PopErrorScope(wgpu::ErrorCallback callback, void* userdata);
ErrorScope* GetCurrentErrorScope();
void Reference();
@@ -261,7 +261,7 @@
std::unique_ptr<Caches> mCaches;
struct DeferredCreateBufferMappedAsync {
- dawn::BufferCreateMappedCallback callback;
+ wgpu::BufferCreateMappedCallback callback;
DawnBufferMapAsyncStatus status;
DawnCreateBufferMappedResult result;
void* userdata;
diff --git a/src/dawn_native/EncodingContext.cpp b/src/dawn_native/EncodingContext.cpp
index 121a890..ea156a6 100644
--- a/src/dawn_native/EncodingContext.cpp
+++ b/src/dawn_native/EncodingContext.cpp
@@ -45,7 +45,7 @@
return &mIterator;
}
- void EncodingContext::HandleError(dawn::ErrorType type, const char* message) {
+ void EncodingContext::HandleError(wgpu::ErrorType type, const char* message) {
if (!IsFinished()) {
// If the encoding context is not finished, errors are deferred until
// Finish() is called.
diff --git a/src/dawn_native/EncodingContext.h b/src/dawn_native/EncodingContext.h
index 831db7d..ecb0505 100644
--- a/src/dawn_native/EncodingContext.h
+++ b/src/dawn_native/EncodingContext.h
@@ -38,7 +38,7 @@
CommandIterator* GetIterator();
// Functions to handle encoder errors
- void HandleError(dawn::ErrorType type, const char* message);
+ void HandleError(wgpu::ErrorType type, const char* message);
inline void ConsumeError(ErrorData* error) {
HandleError(error->GetType(), error->GetMessage().c_str());
@@ -58,10 +58,10 @@
if (DAWN_UNLIKELY(encoder != mCurrentEncoder)) {
if (mCurrentEncoder != mTopLevelEncoder) {
// The top level encoder was used when a pass encoder was current.
- HandleError(dawn::ErrorType::Validation,
+ HandleError(wgpu::ErrorType::Validation,
"Command cannot be recorded inside a pass");
} else {
- HandleError(dawn::ErrorType::Validation,
+ HandleError(wgpu::ErrorType::Validation,
"Recording in an error or already ended pass encoder");
}
return false;
diff --git a/src/dawn_native/ErrorData.cpp b/src/dawn_native/ErrorData.cpp
index 06be01e..2cd01da 100644
--- a/src/dawn_native/ErrorData.cpp
+++ b/src/dawn_native/ErrorData.cpp
@@ -38,16 +38,16 @@
return mType;
}
- dawn::ErrorType ErrorData::GetType() const {
+ wgpu::ErrorType ErrorData::GetType() const {
switch (mType) {
case InternalErrorType::Validation:
- return dawn::ErrorType::Validation;
+ return wgpu::ErrorType::Validation;
case InternalErrorType::OutOfMemory:
- return dawn::ErrorType::OutOfMemory;
+ return wgpu::ErrorType::OutOfMemory;
case InternalErrorType::DeviceLost:
- return dawn::ErrorType::DeviceLost;
+ return wgpu::ErrorType::DeviceLost;
default:
- return dawn::ErrorType::Unknown;
+ return wgpu::ErrorType::Unknown;
}
}
diff --git a/src/dawn_native/ErrorData.h b/src/dawn_native/ErrorData.h
index fdc7623..a73d90d 100644
--- a/src/dawn_native/ErrorData.h
+++ b/src/dawn_native/ErrorData.h
@@ -44,7 +44,7 @@
void AppendBacktrace(const char* file, const char* function, int line);
InternalErrorType GetInternalType() const;
- dawn::ErrorType GetType() const;
+ wgpu::ErrorType GetType() const;
const std::string& GetMessage() const;
const std::vector<BacktraceRecord>& GetBacktrace() const;
diff --git a/src/dawn_native/ErrorScope.cpp b/src/dawn_native/ErrorScope.cpp
index 1758ef7..2facb8b 100644
--- a/src/dawn_native/ErrorScope.cpp
+++ b/src/dawn_native/ErrorScope.cpp
@@ -20,7 +20,7 @@
ErrorScope::ErrorScope() = default;
- ErrorScope::ErrorScope(dawn::ErrorFilter errorFilter, ErrorScope* parent)
+ ErrorScope::ErrorScope(wgpu::ErrorFilter errorFilter, ErrorScope* parent)
: RefCounted(), mErrorFilter(errorFilter), mParent(parent) {
ASSERT(mParent.Get() != nullptr);
}
@@ -29,10 +29,10 @@
if (mCallback == nullptr || IsRoot()) {
return;
}
- mCallback(static_cast<DawnErrorType>(mErrorType), mErrorMessage.c_str(), mUserdata);
+ mCallback(static_cast<WGPUErrorType>(mErrorType), mErrorMessage.c_str(), mUserdata);
}
- void ErrorScope::SetCallback(dawn::ErrorCallback callback, void* userdata) {
+ void ErrorScope::SetCallback(wgpu::ErrorCallback callback, void* userdata) {
mCallback = callback;
mUserdata = userdata;
}
@@ -45,28 +45,28 @@
return mParent.Get() == nullptr;
}
- void ErrorScope::HandleError(dawn::ErrorType type, const char* message) {
+ void ErrorScope::HandleError(wgpu::ErrorType type, const char* message) {
HandleErrorImpl(this, type, message);
}
// static
- void ErrorScope::HandleErrorImpl(ErrorScope* scope, dawn::ErrorType type, const char* message) {
+ void ErrorScope::HandleErrorImpl(ErrorScope* scope, wgpu::ErrorType type, const char* message) {
ErrorScope* currentScope = scope;
for (; !currentScope->IsRoot(); currentScope = currentScope->GetParent()) {
ASSERT(currentScope != nullptr);
bool consumed = false;
switch (type) {
- case dawn::ErrorType::Validation:
- if (currentScope->mErrorFilter != dawn::ErrorFilter::Validation) {
+ case wgpu::ErrorType::Validation:
+ if (currentScope->mErrorFilter != wgpu::ErrorFilter::Validation) {
// Error filter does not match. Move on to the next scope.
continue;
}
consumed = true;
break;
- case dawn::ErrorType::OutOfMemory:
- if (currentScope->mErrorFilter != dawn::ErrorFilter::OutOfMemory) {
+ case wgpu::ErrorType::OutOfMemory:
+ if (currentScope->mErrorFilter != wgpu::ErrorFilter::OutOfMemory) {
// Error filter does not match. Move on to the next scope.
continue;
}
@@ -75,19 +75,19 @@
// Unknown and DeviceLost are fatal. All error scopes capture them.
// |consumed| is false because these should bubble to all scopes.
- case dawn::ErrorType::Unknown:
- case dawn::ErrorType::DeviceLost:
+ case wgpu::ErrorType::Unknown:
+ case wgpu::ErrorType::DeviceLost:
consumed = false;
break;
- case dawn::ErrorType::NoError:
+ case wgpu::ErrorType::NoError:
default:
UNREACHABLE();
return;
}
// Record the error if the scope doesn't have one yet.
- if (currentScope->mErrorType == dawn::ErrorType::NoError) {
+ if (currentScope->mErrorType == wgpu::ErrorType::NoError) {
currentScope->mErrorType = type;
currentScope->mErrorMessage = message;
}
@@ -100,14 +100,14 @@
// The root error scope captures all uncaptured errors.
ASSERT(currentScope->IsRoot());
if (currentScope->mCallback) {
- currentScope->mCallback(static_cast<DawnErrorType>(type), message,
+ currentScope->mCallback(static_cast<WGPUErrorType>(type), message,
currentScope->mUserdata);
}
}
void ErrorScope::Destroy() {
if (!IsRoot()) {
- mErrorType = dawn::ErrorType::Unknown;
+ mErrorType = wgpu::ErrorType::Unknown;
mErrorMessage = "Error scope destroyed";
}
}
diff --git a/src/dawn_native/ErrorScope.h b/src/dawn_native/ErrorScope.h
index f3218cb..fb0bc67 100644
--- a/src/dawn_native/ErrorScope.h
+++ b/src/dawn_native/ErrorScope.h
@@ -38,27 +38,27 @@
class ErrorScope : public RefCounted {
public:
ErrorScope(); // Constructor for the root error scope.
- ErrorScope(dawn::ErrorFilter errorFilter, ErrorScope* parent);
+ ErrorScope(wgpu::ErrorFilter errorFilter, ErrorScope* parent);
~ErrorScope();
- void SetCallback(dawn::ErrorCallback callback, void* userdata);
+ void SetCallback(wgpu::ErrorCallback callback, void* userdata);
ErrorScope* GetParent();
- void HandleError(dawn::ErrorType type, const char* message);
+ void HandleError(wgpu::ErrorType type, const char* message);
void Destroy();
private:
bool IsRoot() const;
- static void HandleErrorImpl(ErrorScope* scope, dawn::ErrorType type, const char* message);
+ static void HandleErrorImpl(ErrorScope* scope, wgpu::ErrorType type, const char* message);
- dawn::ErrorFilter mErrorFilter = dawn::ErrorFilter::None;
+ wgpu::ErrorFilter mErrorFilter = wgpu::ErrorFilter::None;
Ref<ErrorScope> mParent = nullptr;
- dawn::ErrorCallback mCallback = nullptr;
+ wgpu::ErrorCallback mCallback = nullptr;
void* mUserdata = nullptr;
- dawn::ErrorType mErrorType = dawn::ErrorType::NoError;
+ wgpu::ErrorType mErrorType = wgpu::ErrorType::NoError;
std::string mErrorMessage = "";
};
diff --git a/src/dawn_native/Fence.cpp b/src/dawn_native/Fence.cpp
index 55b6b33..c0195c4 100644
--- a/src/dawn_native/Fence.cpp
+++ b/src/dawn_native/Fence.cpp
@@ -64,7 +64,7 @@
}
void FenceBase::OnCompletion(uint64_t value,
- dawn::FenceOnCompletionCallback callback,
+ wgpu::FenceOnCompletionCallback callback,
void* userdata) {
if (GetDevice()->ConsumedError(ValidateOnCompletion(value))) {
callback(DAWN_FENCE_COMPLETION_STATUS_ERROR, userdata);
diff --git a/src/dawn_native/Fence.h b/src/dawn_native/Fence.h
index cd20d26..7408261 100644
--- a/src/dawn_native/Fence.h
+++ b/src/dawn_native/Fence.h
@@ -40,7 +40,7 @@
// Dawn API
uint64_t GetCompletedValue() const;
- void OnCompletion(uint64_t value, dawn::FenceOnCompletionCallback callback, void* userdata);
+ void OnCompletion(uint64_t value, wgpu::FenceOnCompletionCallback callback, void* userdata);
protected:
friend class QueueBase;
@@ -54,7 +54,7 @@
MaybeError ValidateOnCompletion(uint64_t value) const;
struct OnCompletionData {
- dawn::FenceOnCompletionCallback completionCallback = nullptr;
+ wgpu::FenceOnCompletionCallback completionCallback = nullptr;
void* userdata = nullptr;
};
diff --git a/src/dawn_native/Format.cpp b/src/dawn_native/Format.cpp
index c604a87..47b36ab 100644
--- a/src/dawn_native/Format.cpp
+++ b/src/dawn_native/Format.cpp
@@ -38,23 +38,23 @@
return aspect != Color;
}
- bool Format::HasComponentType(dawn::TextureComponentType componentType) const {
+ bool Format::HasComponentType(wgpu::TextureComponentType componentType) const {
// Depth stencil textures need to be special cased but we don't support sampling them yet.
if (aspect != Color) {
return false;
}
// Check that Type is correctly mirrors TextureComponentType except for "Other".
- static_assert(static_cast<dawn::TextureComponentType>(Type::Float) ==
- dawn::TextureComponentType::Float,
+ static_assert(static_cast<wgpu::TextureComponentType>(Type::Float) ==
+ wgpu::TextureComponentType::Float,
"");
static_assert(
- static_cast<dawn::TextureComponentType>(Type::Sint) == dawn::TextureComponentType::Sint,
+ static_cast<wgpu::TextureComponentType>(Type::Sint) == wgpu::TextureComponentType::Sint,
"");
static_assert(
- static_cast<dawn::TextureComponentType>(Type::Uint) == dawn::TextureComponentType::Uint,
+ static_cast<wgpu::TextureComponentType>(Type::Uint) == wgpu::TextureComponentType::Uint,
"");
- return static_cast<dawn::TextureComponentType>(type) == componentType;
+ return static_cast<wgpu::TextureComponentType>(type) == componentType;
}
size_t Format::GetIndex() const {
@@ -65,10 +65,10 @@
// For the enum for formats are packed but this might change when we have a broader extension
// mechanism for webgpu.h. Formats start at 1 because 0 is the undefined format.
- size_t ComputeFormatIndex(dawn::TextureFormat format) {
+ size_t ComputeFormatIndex(wgpu::TextureFormat format) {
// This takes advantage of overflows to make the index of TextureFormat::Undefined outside
// of the range of the FormatTable.
- static_assert(static_cast<uint32_t>(dawn::TextureFormat::Undefined) - 1 > kKnownFormatCount,
+ static_assert(static_cast<uint32_t>(wgpu::TextureFormat::Undefined) - 1 > kKnownFormatCount,
"");
return static_cast<size_t>(static_cast<uint32_t>(format) - 1);
}
@@ -92,7 +92,7 @@
formatsSet.set(index);
};
- auto AddColorFormat = [&AddFormat](dawn::TextureFormat format, bool renderable,
+ auto AddColorFormat = [&AddFormat](wgpu::TextureFormat format, bool renderable,
uint32_t byteSize, Type type) {
Format internalFormat;
internalFormat.format = format;
@@ -107,7 +107,7 @@
AddFormat(internalFormat);
};
- auto AddDepthStencilFormat = [&AddFormat](dawn::TextureFormat format, Format::Aspect aspect,
+ auto AddDepthStencilFormat = [&AddFormat](wgpu::TextureFormat format, Format::Aspect aspect,
uint32_t byteSize) {
Format internalFormat;
internalFormat.format = format;
@@ -122,7 +122,7 @@
AddFormat(internalFormat);
};
- auto AddCompressedFormat = [&AddFormat](dawn::TextureFormat format, uint32_t byteSize,
+ auto AddCompressedFormat = [&AddFormat](wgpu::TextureFormat format, uint32_t byteSize,
uint32_t width, uint32_t height, bool isSupported) {
Format internalFormat;
internalFormat.format = format;
@@ -140,74 +140,74 @@
// clang-format off
// 1 byte color formats
- AddColorFormat(dawn::TextureFormat::R8Unorm, true, 1, Type::Float);
- AddColorFormat(dawn::TextureFormat::R8Snorm, false, 1, Type::Float);
- AddColorFormat(dawn::TextureFormat::R8Uint, true, 1, Type::Uint);
- AddColorFormat(dawn::TextureFormat::R8Sint, true, 1, Type::Sint);
+ AddColorFormat(wgpu::TextureFormat::R8Unorm, true, 1, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::R8Snorm, false, 1, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::R8Uint, true, 1, Type::Uint);
+ AddColorFormat(wgpu::TextureFormat::R8Sint, true, 1, Type::Sint);
// 2 bytes color formats
- AddColorFormat(dawn::TextureFormat::R16Uint, true, 2, Type::Uint);
- AddColorFormat(dawn::TextureFormat::R16Sint, true, 2, Type::Sint);
- AddColorFormat(dawn::TextureFormat::R16Float, true, 2, Type::Float);
- AddColorFormat(dawn::TextureFormat::RG8Unorm, true, 2, Type::Float);
- AddColorFormat(dawn::TextureFormat::RG8Snorm, false, 2, Type::Float);
- AddColorFormat(dawn::TextureFormat::RG8Uint, true, 2, Type::Uint);
- AddColorFormat(dawn::TextureFormat::RG8Sint, true, 2, Type::Sint);
+ AddColorFormat(wgpu::TextureFormat::R16Uint, true, 2, Type::Uint);
+ AddColorFormat(wgpu::TextureFormat::R16Sint, true, 2, Type::Sint);
+ AddColorFormat(wgpu::TextureFormat::R16Float, true, 2, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RG8Unorm, true, 2, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RG8Snorm, false, 2, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RG8Uint, true, 2, Type::Uint);
+ AddColorFormat(wgpu::TextureFormat::RG8Sint, true, 2, Type::Sint);
// 4 bytes color formats
- AddColorFormat(dawn::TextureFormat::R32Uint, true, 4, Type::Uint);
- AddColorFormat(dawn::TextureFormat::R32Sint, true, 4, Type::Sint);
- AddColorFormat(dawn::TextureFormat::R32Float, true, 4, Type::Float);
- AddColorFormat(dawn::TextureFormat::RG16Uint, true, 4, Type::Uint);
- AddColorFormat(dawn::TextureFormat::RG16Sint, true, 4, Type::Sint);
- AddColorFormat(dawn::TextureFormat::RG16Float, true, 4, Type::Float);
- AddColorFormat(dawn::TextureFormat::RGBA8Unorm, true, 4, Type::Float);
- AddColorFormat(dawn::TextureFormat::RGBA8UnormSrgb, true, 4, Type::Float);
- AddColorFormat(dawn::TextureFormat::RGBA8Snorm, false, 4, Type::Float);
- AddColorFormat(dawn::TextureFormat::RGBA8Uint, true, 4, Type::Uint);
- AddColorFormat(dawn::TextureFormat::RGBA8Sint, true, 4, Type::Sint);
- AddColorFormat(dawn::TextureFormat::BGRA8Unorm, true, 4, Type::Float);
- AddColorFormat(dawn::TextureFormat::BGRA8UnormSrgb, true, 4, Type::Float);
- AddColorFormat(dawn::TextureFormat::RGB10A2Unorm, true, 4, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::R32Uint, true, 4, Type::Uint);
+ AddColorFormat(wgpu::TextureFormat::R32Sint, true, 4, Type::Sint);
+ AddColorFormat(wgpu::TextureFormat::R32Float, true, 4, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RG16Uint, true, 4, Type::Uint);
+ AddColorFormat(wgpu::TextureFormat::RG16Sint, true, 4, Type::Sint);
+ AddColorFormat(wgpu::TextureFormat::RG16Float, true, 4, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RGBA8Unorm, true, 4, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RGBA8UnormSrgb, true, 4, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RGBA8Snorm, false, 4, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RGBA8Uint, true, 4, Type::Uint);
+ AddColorFormat(wgpu::TextureFormat::RGBA8Sint, true, 4, Type::Sint);
+ AddColorFormat(wgpu::TextureFormat::BGRA8Unorm, true, 4, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::BGRA8UnormSrgb, true, 4, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RGB10A2Unorm, true, 4, Type::Float);
- AddColorFormat(dawn::TextureFormat::RG11B10Float, false, 4, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RG11B10Float, false, 4, Type::Float);
// 8 bytes color formats
- AddColorFormat(dawn::TextureFormat::RG32Uint, true, 8, Type::Uint);
- AddColorFormat(dawn::TextureFormat::RG32Sint, true, 8, Type::Sint);
- AddColorFormat(dawn::TextureFormat::RG32Float, true, 8, Type::Float);
- AddColorFormat(dawn::TextureFormat::RGBA16Uint, true, 8, Type::Uint);
- AddColorFormat(dawn::TextureFormat::RGBA16Sint, true, 8, Type::Sint);
- AddColorFormat(dawn::TextureFormat::RGBA16Float, true, 8, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RG32Uint, true, 8, Type::Uint);
+ AddColorFormat(wgpu::TextureFormat::RG32Sint, true, 8, Type::Sint);
+ AddColorFormat(wgpu::TextureFormat::RG32Float, true, 8, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RGBA16Uint, true, 8, Type::Uint);
+ AddColorFormat(wgpu::TextureFormat::RGBA16Sint, true, 8, Type::Sint);
+ AddColorFormat(wgpu::TextureFormat::RGBA16Float, true, 8, Type::Float);
// 16 bytes color formats
- AddColorFormat(dawn::TextureFormat::RGBA32Uint, true, 16, Type::Uint);
- AddColorFormat(dawn::TextureFormat::RGBA32Sint, true, 16, Type::Sint);
- AddColorFormat(dawn::TextureFormat::RGBA32Float, true, 16, Type::Float);
+ AddColorFormat(wgpu::TextureFormat::RGBA32Uint, true, 16, Type::Uint);
+ AddColorFormat(wgpu::TextureFormat::RGBA32Sint, true, 16, Type::Sint);
+ AddColorFormat(wgpu::TextureFormat::RGBA32Float, true, 16, Type::Float);
// Depth stencil formats
- AddDepthStencilFormat(dawn::TextureFormat::Depth32Float, Aspect::Depth, 4);
- AddDepthStencilFormat(dawn::TextureFormat::Depth24Plus, Aspect::Depth, 4);
+ AddDepthStencilFormat(wgpu::TextureFormat::Depth32Float, Aspect::Depth, 4);
+ AddDepthStencilFormat(wgpu::TextureFormat::Depth24Plus, Aspect::Depth, 4);
// TODO(cwallez@chromium.org): It isn't clear if this format should be copyable
// because its size isn't well defined, is it 4, 5 or 8?
- AddDepthStencilFormat(dawn::TextureFormat::Depth24PlusStencil8, Aspect::DepthStencil, 4);
+ AddDepthStencilFormat(wgpu::TextureFormat::Depth24PlusStencil8, Aspect::DepthStencil, 4);
// BC compressed formats
bool isBCFormatSupported = device->IsExtensionEnabled(Extension::TextureCompressionBC);
- AddCompressedFormat(dawn::TextureFormat::BC1RGBAUnorm, 8, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC1RGBAUnormSrgb, 8, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC4RSnorm, 8, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC4RUnorm, 8, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC2RGBAUnorm, 16, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC2RGBAUnormSrgb, 16, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC3RGBAUnorm, 16, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC3RGBAUnormSrgb, 16, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC5RGSnorm, 16, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC5RGUnorm, 16, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC6HRGBSfloat, 16, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC6HRGBUfloat, 16, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC7RGBAUnorm, 16, 4, 4, isBCFormatSupported);
- AddCompressedFormat(dawn::TextureFormat::BC7RGBAUnormSrgb, 16, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC1RGBAUnorm, 8, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC1RGBAUnormSrgb, 8, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC4RSnorm, 8, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC4RUnorm, 8, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC2RGBAUnorm, 16, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC2RGBAUnormSrgb, 16, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC3RGBAUnorm, 16, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC3RGBAUnormSrgb, 16, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC5RGSnorm, 16, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC5RGUnorm, 16, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC6HRGBSfloat, 16, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC6HRGBUfloat, 16, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC7RGBAUnorm, 16, 4, 4, isBCFormatSupported);
+ AddCompressedFormat(wgpu::TextureFormat::BC7RGBAUnormSrgb, 16, 4, 4, isBCFormatSupported);
// clang-format on
diff --git a/src/dawn_native/Format.h b/src/dawn_native/Format.h
index 4ec19b8..2c35b1b 100644
--- a/src/dawn_native/Format.h
+++ b/src/dawn_native/Format.h
@@ -29,7 +29,7 @@
// exact number of known format.
static constexpr size_t kKnownFormatCount = 52;
- // A dawn::TextureFormat along with all the information about it necessary for validation.
+ // A wgpu::TextureFormat along with all the information about it necessary for validation.
struct Format {
enum Aspect {
Color,
@@ -45,7 +45,7 @@
Other,
};
- dawn::TextureFormat format;
+ wgpu::TextureFormat format;
bool isRenderable;
bool isCompressed;
// A format can be known but not supported because it is part of a disabled extension.
@@ -61,7 +61,7 @@
bool HasDepth() const;
bool HasStencil() const;
bool HasDepthOrStencil() const;
- bool HasComponentType(dawn::TextureComponentType componentType) const;
+ bool HasComponentType(wgpu::TextureComponentType componentType) const;
// The index of the format in the list of all known formats: a unique number for each format
// in [0, kKnownFormatCount)
@@ -73,7 +73,7 @@
using FormatTable = std::array<Format, kKnownFormatCount>;
// Returns the index of a format in the FormatTable.
- size_t ComputeFormatIndex(dawn::TextureFormat format);
+ size_t ComputeFormatIndex(wgpu::TextureFormat format);
// Builds the format table with the extensions enabled on the device.
FormatTable BuildFormatTable(const DeviceBase* device);
diff --git a/src/dawn_native/PassResourceUsage.h b/src/dawn_native/PassResourceUsage.h
index eebeda6..226ad31 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::BufferUsage> bufferUsages;
+ std::vector<wgpu::BufferUsage> bufferUsages;
std::vector<TextureBase*> textures;
- std::vector<dawn::TextureUsage> textureUsages;
+ std::vector<wgpu::TextureUsage> textureUsages;
};
struct CommandBufferResourceUsage {
diff --git a/src/dawn_native/PassResourceUsageTracker.cpp b/src/dawn_native/PassResourceUsageTracker.cpp
index 5867eb0..18980b8 100644
--- a/src/dawn_native/PassResourceUsageTracker.cpp
+++ b/src/dawn_native/PassResourceUsageTracker.cpp
@@ -19,13 +19,13 @@
namespace dawn_native {
- void PassResourceUsageTracker::BufferUsedAs(BufferBase* buffer, dawn::BufferUsage usage) {
+ void PassResourceUsageTracker::BufferUsedAs(BufferBase* buffer, wgpu::BufferUsage usage) {
// std::map's operator[] will create the key and return 0 if the key didn't exist
// before.
mBufferUsages[buffer] |= usage;
}
- void PassResourceUsageTracker::TextureUsedAs(TextureBase* texture, dawn::TextureUsage usage) {
+ void PassResourceUsageTracker::TextureUsedAs(TextureBase* texture, wgpu::TextureUsage usage) {
// std::map's operator[] will create the key and return 0 if the key didn't exist
// before.
mTextureUsages[texture] |= usage;
@@ -44,14 +44,14 @@
// Buffers can only be used as single-write or multiple read.
for (auto& it : mBufferUsages) {
BufferBase* buffer = it.first;
- dawn::BufferUsage usage = it.second;
+ wgpu::BufferUsage usage = it.second;
if (usage & ~buffer->GetUsage()) {
return DAWN_VALIDATION_ERROR("Buffer missing usage for the pass");
}
bool readOnly = (usage & kReadOnlyBufferUsages) == usage;
- bool singleUse = dawn::HasZeroOrOneBits(usage);
+ bool singleUse = wgpu::HasZeroOrOneBits(usage);
if (!readOnly && !singleUse) {
return DAWN_VALIDATION_ERROR(
@@ -63,7 +63,7 @@
// TODO(cwallez@chromium.org): implement per-subresource tracking
for (auto& it : mTextureUsages) {
TextureBase* texture = it.first;
- dawn::TextureUsage usage = it.second;
+ wgpu::TextureUsage usage = it.second;
if (usage & ~texture->GetUsage()) {
return DAWN_VALIDATION_ERROR("Texture missing usage for the pass");
@@ -71,7 +71,7 @@
// For textures the only read-only usage in a pass is Sampled, so checking the
// usage constraint simplifies to checking a single usage bit is set.
- if (!dawn::HasZeroOrOneBits(it.second)) {
+ if (!wgpu::HasZeroOrOneBits(it.second)) {
return DAWN_VALIDATION_ERROR("Texture used with more than one usage in pass");
}
}
diff --git a/src/dawn_native/PassResourceUsageTracker.h b/src/dawn_native/PassResourceUsageTracker.h
index 48cd01e..ff168fb 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::BufferUsage usage);
- void TextureUsedAs(TextureBase* texture, dawn::TextureUsage usage);
+ void BufferUsedAs(BufferBase* buffer, wgpu::BufferUsage usage);
+ void TextureUsedAs(TextureBase* texture, wgpu::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::BufferUsage> mBufferUsages;
- std::map<TextureBase*, dawn::TextureUsage> mTextureUsages;
+ std::map<BufferBase*, wgpu::BufferUsage> mBufferUsages;
+ std::map<TextureBase*, wgpu::TextureUsage> mTextureUsages;
};
} // namespace dawn_native
diff --git a/src/dawn_native/PerStage.cpp b/src/dawn_native/PerStage.cpp
index c4837c7..198d99d 100644
--- a/src/dawn_native/PerStage.cpp
+++ b/src/dawn_native/PerStage.cpp
@@ -16,14 +16,14 @@
namespace dawn_native {
- BitSetIterator<kNumStages, SingleShaderStage> IterateStages(dawn::ShaderStage stages) {
+ BitSetIterator<kNumStages, SingleShaderStage> IterateStages(wgpu::ShaderStage stages) {
std::bitset<kNumStages> bits(static_cast<uint32_t>(stages));
return BitSetIterator<kNumStages, SingleShaderStage>(bits);
}
- dawn::ShaderStage StageBit(SingleShaderStage stage) {
+ wgpu::ShaderStage StageBit(SingleShaderStage stage) {
ASSERT(static_cast<uint32_t>(stage) < kNumStages);
- return static_cast<dawn::ShaderStage>(1 << static_cast<uint32_t>(stage));
+ return static_cast<wgpu::ShaderStage>(1 << static_cast<uint32_t>(stage));
}
} // namespace dawn_native
diff --git a/src/dawn_native/PerStage.h b/src/dawn_native/PerStage.h
index ac92b5b..be9f4c4 100644
--- a/src/dawn_native/PerStage.h
+++ b/src/dawn_native/PerStage.h
@@ -31,21 +31,21 @@
static_assert(static_cast<uint32_t>(SingleShaderStage::Fragment) < kNumStages, "");
static_assert(static_cast<uint32_t>(SingleShaderStage::Compute) < kNumStages, "");
- static_assert(static_cast<uint32_t>(dawn::ShaderStage::Vertex) ==
+ static_assert(static_cast<uint32_t>(wgpu::ShaderStage::Vertex) ==
(1 << static_cast<uint32_t>(SingleShaderStage::Vertex)),
"");
- static_assert(static_cast<uint32_t>(dawn::ShaderStage::Fragment) ==
+ static_assert(static_cast<uint32_t>(wgpu::ShaderStage::Fragment) ==
(1 << static_cast<uint32_t>(SingleShaderStage::Fragment)),
"");
- static_assert(static_cast<uint32_t>(dawn::ShaderStage::Compute) ==
+ static_assert(static_cast<uint32_t>(wgpu::ShaderStage::Compute) ==
(1 << static_cast<uint32_t>(SingleShaderStage::Compute)),
"");
- BitSetIterator<kNumStages, SingleShaderStage> IterateStages(dawn::ShaderStage stages);
- dawn::ShaderStage StageBit(SingleShaderStage stage);
+ BitSetIterator<kNumStages, SingleShaderStage> IterateStages(wgpu::ShaderStage stages);
+ wgpu::ShaderStage StageBit(SingleShaderStage stage);
- static constexpr dawn::ShaderStage kAllStages =
- static_cast<dawn::ShaderStage>((1 << kNumStages) - 1);
+ static constexpr wgpu::ShaderStage kAllStages =
+ static_cast<wgpu::ShaderStage>((1 << kNumStages) - 1);
template <typename T>
class PerStage {
@@ -64,12 +64,12 @@
return mData[static_cast<uint32_t>(stage)];
}
- T& operator[](dawn::ShaderStage stageBit) {
+ T& operator[](wgpu::ShaderStage stageBit) {
uint32_t bit = static_cast<uint32_t>(stageBit);
DAWN_ASSERT(bit != 0 && IsPowerOfTwo(bit) && bit <= (1 << kNumStages));
return mData[Log2(bit)];
}
- const T& operator[](dawn::ShaderStage stageBit) const {
+ const T& operator[](wgpu::ShaderStage stageBit) const {
uint32_t bit = static_cast<uint32_t>(stageBit);
DAWN_ASSERT(bit != 0 && IsPowerOfTwo(bit) && bit <= (1 << kNumStages));
return mData[Log2(bit)];
diff --git a/src/dawn_native/Pipeline.cpp b/src/dawn_native/Pipeline.cpp
index a8c6e9b..246afe9 100644
--- a/src/dawn_native/Pipeline.cpp
+++ b/src/dawn_native/Pipeline.cpp
@@ -42,7 +42,7 @@
PipelineBase::PipelineBase(DeviceBase* device,
PipelineLayoutBase* layout,
- dawn::ShaderStage stages)
+ wgpu::ShaderStage stages)
: ObjectBase(device), mStageMask(stages), mLayout(layout) {
}
@@ -50,7 +50,7 @@
: ObjectBase(device, tag) {
}
- dawn::ShaderStage PipelineBase::GetStageMask() const {
+ wgpu::ShaderStage PipelineBase::GetStageMask() const {
ASSERT(!IsError());
return mStageMask;
}
diff --git a/src/dawn_native/Pipeline.h b/src/dawn_native/Pipeline.h
index 2159954..5373bd0 100644
--- a/src/dawn_native/Pipeline.h
+++ b/src/dawn_native/Pipeline.h
@@ -35,16 +35,16 @@
class PipelineBase : public ObjectBase {
public:
- dawn::ShaderStage GetStageMask() const;
+ wgpu::ShaderStage GetStageMask() const;
PipelineLayoutBase* GetLayout();
const PipelineLayoutBase* GetLayout() const;
protected:
- PipelineBase(DeviceBase* device, PipelineLayoutBase* layout, dawn::ShaderStage stages);
+ PipelineBase(DeviceBase* device, PipelineLayoutBase* layout, wgpu::ShaderStage stages);
PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag);
private:
- dawn::ShaderStage mStageMask;
+ wgpu::ShaderStage mStageMask;
Ref<PipelineLayoutBase> mLayout;
};
diff --git a/src/dawn_native/RenderBundleEncoder.cpp b/src/dawn_native/RenderBundleEncoder.cpp
index 8a7e99a..60598dd 100644
--- a/src/dawn_native/RenderBundleEncoder.cpp
+++ b/src/dawn_native/RenderBundleEncoder.cpp
@@ -24,7 +24,7 @@
namespace dawn_native {
MaybeError ValidateColorAttachmentFormat(const DeviceBase* device,
- dawn::TextureFormat textureFormat) {
+ wgpu::TextureFormat textureFormat) {
DAWN_TRY(ValidateTextureFormat(textureFormat));
const Format* format = nullptr;
DAWN_TRY_ASSIGN(format, device->GetInternalFormat(textureFormat));
@@ -36,7 +36,7 @@
}
MaybeError ValidateDepthStencilAttachmentFormat(const DeviceBase* device,
- dawn::TextureFormat textureFormat) {
+ wgpu::TextureFormat textureFormat) {
DAWN_TRY(ValidateTextureFormat(textureFormat));
const Format* format = nullptr;
DAWN_TRY_ASSIGN(format, device->GetInternalFormat(textureFormat));
@@ -60,7 +60,7 @@
}
if (descriptor->colorFormatsCount == 0 &&
- descriptor->depthStencilFormat == dawn::TextureFormat::Undefined) {
+ descriptor->depthStencilFormat == wgpu::TextureFormat::Undefined) {
return DAWN_VALIDATION_ERROR("Should have at least one attachment format");
}
@@ -68,7 +68,7 @@
DAWN_TRY(ValidateColorAttachmentFormat(device, descriptor->colorFormats[i]));
}
- if (descriptor->depthStencilFormat != dawn::TextureFormat::Undefined) {
+ if (descriptor->depthStencilFormat != wgpu::TextureFormat::Undefined) {
DAWN_TRY(ValidateDepthStencilAttachmentFormat(device, descriptor->depthStencilFormat));
}
diff --git a/src/dawn_native/RenderPipeline.cpp b/src/dawn_native/RenderPipeline.cpp
index daba3a8..69bc2cd 100644
--- a/src/dawn_native/RenderPipeline.cpp
+++ b/src/dawn_native/RenderPipeline.cpp
@@ -177,100 +177,100 @@
} // anonymous namespace
// Helper functions
- size_t IndexFormatSize(dawn::IndexFormat format) {
+ size_t IndexFormatSize(wgpu::IndexFormat format) {
switch (format) {
- case dawn::IndexFormat::Uint16:
+ case wgpu::IndexFormat::Uint16:
return sizeof(uint16_t);
- case dawn::IndexFormat::Uint32:
+ case wgpu::IndexFormat::Uint32:
return sizeof(uint32_t);
default:
UNREACHABLE();
}
}
- uint32_t VertexFormatNumComponents(dawn::VertexFormat format) {
+ uint32_t VertexFormatNumComponents(wgpu::VertexFormat format) {
switch (format) {
- case dawn::VertexFormat::UChar4:
- case dawn::VertexFormat::Char4:
- case dawn::VertexFormat::UChar4Norm:
- case dawn::VertexFormat::Char4Norm:
- case dawn::VertexFormat::UShort4:
- case dawn::VertexFormat::Short4:
- case dawn::VertexFormat::UShort4Norm:
- case dawn::VertexFormat::Short4Norm:
- case dawn::VertexFormat::Half4:
- case dawn::VertexFormat::Float4:
- case dawn::VertexFormat::UInt4:
- case dawn::VertexFormat::Int4:
+ case wgpu::VertexFormat::UChar4:
+ case wgpu::VertexFormat::Char4:
+ case wgpu::VertexFormat::UChar4Norm:
+ case wgpu::VertexFormat::Char4Norm:
+ case wgpu::VertexFormat::UShort4:
+ case wgpu::VertexFormat::Short4:
+ case wgpu::VertexFormat::UShort4Norm:
+ case wgpu::VertexFormat::Short4Norm:
+ case wgpu::VertexFormat::Half4:
+ case wgpu::VertexFormat::Float4:
+ case wgpu::VertexFormat::UInt4:
+ case wgpu::VertexFormat::Int4:
return 4;
- case dawn::VertexFormat::Float3:
- case dawn::VertexFormat::UInt3:
- case dawn::VertexFormat::Int3:
+ case wgpu::VertexFormat::Float3:
+ case wgpu::VertexFormat::UInt3:
+ case wgpu::VertexFormat::Int3:
return 3;
- case dawn::VertexFormat::UChar2:
- case dawn::VertexFormat::Char2:
- case dawn::VertexFormat::UChar2Norm:
- case dawn::VertexFormat::Char2Norm:
- case dawn::VertexFormat::UShort2:
- case dawn::VertexFormat::Short2:
- case dawn::VertexFormat::UShort2Norm:
- case dawn::VertexFormat::Short2Norm:
- case dawn::VertexFormat::Half2:
- case dawn::VertexFormat::Float2:
- case dawn::VertexFormat::UInt2:
- case dawn::VertexFormat::Int2:
+ case wgpu::VertexFormat::UChar2:
+ case wgpu::VertexFormat::Char2:
+ case wgpu::VertexFormat::UChar2Norm:
+ case wgpu::VertexFormat::Char2Norm:
+ case wgpu::VertexFormat::UShort2:
+ case wgpu::VertexFormat::Short2:
+ case wgpu::VertexFormat::UShort2Norm:
+ case wgpu::VertexFormat::Short2Norm:
+ case wgpu::VertexFormat::Half2:
+ case wgpu::VertexFormat::Float2:
+ case wgpu::VertexFormat::UInt2:
+ case wgpu::VertexFormat::Int2:
return 2;
- case dawn::VertexFormat::Float:
- case dawn::VertexFormat::UInt:
- case dawn::VertexFormat::Int:
+ case wgpu::VertexFormat::Float:
+ case wgpu::VertexFormat::UInt:
+ case wgpu::VertexFormat::Int:
return 1;
default:
UNREACHABLE();
}
}
- size_t VertexFormatComponentSize(dawn::VertexFormat format) {
+ size_t VertexFormatComponentSize(wgpu::VertexFormat format) {
switch (format) {
- case dawn::VertexFormat::UChar2:
- case dawn::VertexFormat::UChar4:
- case dawn::VertexFormat::Char2:
- case dawn::VertexFormat::Char4:
- case dawn::VertexFormat::UChar2Norm:
- case dawn::VertexFormat::UChar4Norm:
- case dawn::VertexFormat::Char2Norm:
- case dawn::VertexFormat::Char4Norm:
+ case wgpu::VertexFormat::UChar2:
+ case wgpu::VertexFormat::UChar4:
+ case wgpu::VertexFormat::Char2:
+ case wgpu::VertexFormat::Char4:
+ case wgpu::VertexFormat::UChar2Norm:
+ case wgpu::VertexFormat::UChar4Norm:
+ case wgpu::VertexFormat::Char2Norm:
+ case wgpu::VertexFormat::Char4Norm:
return sizeof(char);
- case dawn::VertexFormat::UShort2:
- case dawn::VertexFormat::UShort4:
- case dawn::VertexFormat::UShort2Norm:
- case dawn::VertexFormat::UShort4Norm:
- case dawn::VertexFormat::Short2:
- case dawn::VertexFormat::Short4:
- case dawn::VertexFormat::Short2Norm:
- case dawn::VertexFormat::Short4Norm:
- case dawn::VertexFormat::Half2:
- case dawn::VertexFormat::Half4:
+ case wgpu::VertexFormat::UShort2:
+ case wgpu::VertexFormat::UShort4:
+ case wgpu::VertexFormat::UShort2Norm:
+ case wgpu::VertexFormat::UShort4Norm:
+ case wgpu::VertexFormat::Short2:
+ case wgpu::VertexFormat::Short4:
+ case wgpu::VertexFormat::Short2Norm:
+ case wgpu::VertexFormat::Short4Norm:
+ case wgpu::VertexFormat::Half2:
+ case wgpu::VertexFormat::Half4:
return sizeof(uint16_t);
- case dawn::VertexFormat::Float:
- case dawn::VertexFormat::Float2:
- case dawn::VertexFormat::Float3:
- case dawn::VertexFormat::Float4:
+ case wgpu::VertexFormat::Float:
+ case wgpu::VertexFormat::Float2:
+ case wgpu::VertexFormat::Float3:
+ case wgpu::VertexFormat::Float4:
return sizeof(float);
- case dawn::VertexFormat::UInt:
- case dawn::VertexFormat::UInt2:
- case dawn::VertexFormat::UInt3:
- case dawn::VertexFormat::UInt4:
- case dawn::VertexFormat::Int:
- case dawn::VertexFormat::Int2:
- case dawn::VertexFormat::Int3:
- case dawn::VertexFormat::Int4:
+ case wgpu::VertexFormat::UInt:
+ case wgpu::VertexFormat::UInt2:
+ case wgpu::VertexFormat::UInt3:
+ case wgpu::VertexFormat::UInt4:
+ case wgpu::VertexFormat::Int:
+ case wgpu::VertexFormat::Int2:
+ case wgpu::VertexFormat::Int3:
+ case wgpu::VertexFormat::Int4:
return sizeof(int32_t);
default:
UNREACHABLE();
}
}
- size_t VertexFormatSize(dawn::VertexFormat format) {
+ size_t VertexFormatSize(wgpu::VertexFormat format) {
return VertexFormatNumComponents(format) * VertexFormatComponentSize(format);
}
@@ -344,23 +344,23 @@
}
bool StencilTestEnabled(const DepthStencilStateDescriptor* mDepthStencilState) {
- return mDepthStencilState->stencilBack.compare != dawn::CompareFunction::Always ||
- mDepthStencilState->stencilBack.failOp != dawn::StencilOperation::Keep ||
- mDepthStencilState->stencilBack.depthFailOp != dawn::StencilOperation::Keep ||
- mDepthStencilState->stencilBack.passOp != dawn::StencilOperation::Keep ||
- mDepthStencilState->stencilFront.compare != dawn::CompareFunction::Always ||
- mDepthStencilState->stencilFront.failOp != dawn::StencilOperation::Keep ||
- mDepthStencilState->stencilFront.depthFailOp != dawn::StencilOperation::Keep ||
- mDepthStencilState->stencilFront.passOp != dawn::StencilOperation::Keep;
+ return mDepthStencilState->stencilBack.compare != wgpu::CompareFunction::Always ||
+ mDepthStencilState->stencilBack.failOp != wgpu::StencilOperation::Keep ||
+ mDepthStencilState->stencilBack.depthFailOp != wgpu::StencilOperation::Keep ||
+ mDepthStencilState->stencilBack.passOp != wgpu::StencilOperation::Keep ||
+ mDepthStencilState->stencilFront.compare != wgpu::CompareFunction::Always ||
+ mDepthStencilState->stencilFront.failOp != wgpu::StencilOperation::Keep ||
+ mDepthStencilState->stencilFront.depthFailOp != wgpu::StencilOperation::Keep ||
+ mDepthStencilState->stencilFront.passOp != wgpu::StencilOperation::Keep;
}
bool BlendEnabled(const ColorStateDescriptor* mColorState) {
- return mColorState->alphaBlend.operation != dawn::BlendOperation::Add ||
- mColorState->alphaBlend.srcFactor != dawn::BlendFactor::One ||
- mColorState->alphaBlend.dstFactor != dawn::BlendFactor::Zero ||
- mColorState->colorBlend.operation != dawn::BlendOperation::Add ||
- mColorState->colorBlend.srcFactor != dawn::BlendFactor::One ||
- mColorState->colorBlend.dstFactor != dawn::BlendFactor::Zero;
+ return mColorState->alphaBlend.operation != wgpu::BlendOperation::Add ||
+ mColorState->alphaBlend.srcFactor != wgpu::BlendFactor::One ||
+ mColorState->alphaBlend.dstFactor != wgpu::BlendFactor::Zero ||
+ mColorState->colorBlend.operation != wgpu::BlendOperation::Add ||
+ mColorState->colorBlend.srcFactor != wgpu::BlendFactor::One ||
+ mColorState->colorBlend.dstFactor != wgpu::BlendFactor::Zero;
}
// RenderPipelineBase
@@ -370,7 +370,7 @@
bool blueprint)
: PipelineBase(device,
descriptor->layout,
- dawn::ShaderStage::Vertex | dawn::ShaderStage::Fragment),
+ wgpu::ShaderStage::Vertex | wgpu::ShaderStage::Fragment),
mAttachmentState(device->GetOrCreateAttachmentState(descriptor)),
mPrimitiveTopology(descriptor->primitiveTopology),
mSampleMask(descriptor->sampleMask),
@@ -419,16 +419,16 @@
// The values indicate that depth and stencil test are disabled when backends
// set their own depth stencil states/descriptors according to the values in
// mDepthStencilState.
- mDepthStencilState.depthCompare = dawn::CompareFunction::Always;
+ mDepthStencilState.depthCompare = wgpu::CompareFunction::Always;
mDepthStencilState.depthWriteEnabled = false;
- mDepthStencilState.stencilBack.compare = dawn::CompareFunction::Always;
- mDepthStencilState.stencilBack.failOp = dawn::StencilOperation::Keep;
- mDepthStencilState.stencilBack.depthFailOp = dawn::StencilOperation::Keep;
- mDepthStencilState.stencilBack.passOp = dawn::StencilOperation::Keep;
- mDepthStencilState.stencilFront.compare = dawn::CompareFunction::Always;
- mDepthStencilState.stencilFront.failOp = dawn::StencilOperation::Keep;
- mDepthStencilState.stencilFront.depthFailOp = dawn::StencilOperation::Keep;
- mDepthStencilState.stencilFront.passOp = dawn::StencilOperation::Keep;
+ mDepthStencilState.stencilBack.compare = wgpu::CompareFunction::Always;
+ mDepthStencilState.stencilBack.failOp = wgpu::StencilOperation::Keep;
+ mDepthStencilState.stencilBack.depthFailOp = wgpu::StencilOperation::Keep;
+ mDepthStencilState.stencilBack.passOp = wgpu::StencilOperation::Keep;
+ mDepthStencilState.stencilFront.compare = wgpu::CompareFunction::Always;
+ mDepthStencilState.stencilFront.failOp = wgpu::StencilOperation::Keep;
+ mDepthStencilState.stencilFront.depthFailOp = wgpu::StencilOperation::Keep;
+ mDepthStencilState.stencilFront.passOp = wgpu::StencilOperation::Keep;
mDepthStencilState.stencilReadMask = 0xff;
mDepthStencilState.stencilWriteMask = 0xff;
}
@@ -496,17 +496,17 @@
return &mDepthStencilState;
}
- dawn::PrimitiveTopology RenderPipelineBase::GetPrimitiveTopology() const {
+ wgpu::PrimitiveTopology RenderPipelineBase::GetPrimitiveTopology() const {
ASSERT(!IsError());
return mPrimitiveTopology;
}
- dawn::CullMode RenderPipelineBase::GetCullMode() const {
+ wgpu::CullMode RenderPipelineBase::GetCullMode() const {
ASSERT(!IsError());
return mRasterizationState.cullMode;
}
- dawn::FrontFace RenderPipelineBase::GetFrontFace() const {
+ wgpu::FrontFace RenderPipelineBase::GetFrontFace() const {
ASSERT(!IsError());
return mRasterizationState.frontFace;
}
@@ -521,12 +521,12 @@
return mAttachmentState->HasDepthStencilAttachment();
}
- dawn::TextureFormat RenderPipelineBase::GetColorAttachmentFormat(uint32_t attachment) const {
+ wgpu::TextureFormat RenderPipelineBase::GetColorAttachmentFormat(uint32_t attachment) const {
ASSERT(!IsError());
return mColorStates[attachment].format;
}
- dawn::TextureFormat RenderPipelineBase::GetDepthStencilFormat() const {
+ wgpu::TextureFormat RenderPipelineBase::GetDepthStencilFormat() const {
ASSERT(!IsError());
ASSERT(mAttachmentState->HasDepthStencilAttachment());
return mDepthStencilState.format;
diff --git a/src/dawn_native/RenderPipeline.h b/src/dawn_native/RenderPipeline.h
index 490d178..aa5c49a 100644
--- a/src/dawn_native/RenderPipeline.h
+++ b/src/dawn_native/RenderPipeline.h
@@ -32,10 +32,10 @@
MaybeError ValidateRenderPipelineDescriptor(const DeviceBase* device,
const RenderPipelineDescriptor* descriptor);
- size_t IndexFormatSize(dawn::IndexFormat format);
- uint32_t VertexFormatNumComponents(dawn::VertexFormat format);
- size_t VertexFormatComponentSize(dawn::VertexFormat format);
- size_t VertexFormatSize(dawn::VertexFormat format);
+ size_t IndexFormatSize(wgpu::IndexFormat format);
+ uint32_t VertexFormatNumComponents(wgpu::VertexFormat format);
+ size_t VertexFormatComponentSize(wgpu::VertexFormat format);
+ size_t VertexFormatSize(wgpu::VertexFormat format);
bool StencilTestEnabled(const DepthStencilStateDescriptor* mDepthStencilState);
bool BlendEnabled(const ColorStateDescriptor* mColorState);
@@ -44,12 +44,12 @@
uint32_t shaderLocation;
uint32_t inputSlot;
uint64_t offset;
- dawn::VertexFormat format;
+ wgpu::VertexFormat format;
};
struct VertexBufferInfo {
uint64_t stride;
- dawn::InputStepMode stepMode;
+ wgpu::InputStepMode stepMode;
};
class RenderPipelineBase : public PipelineBase {
@@ -69,14 +69,14 @@
const ColorStateDescriptor* GetColorStateDescriptor(uint32_t attachmentSlot) const;
const DepthStencilStateDescriptor* GetDepthStencilStateDescriptor() const;
- dawn::PrimitiveTopology GetPrimitiveTopology() const;
- dawn::CullMode GetCullMode() const;
- dawn::FrontFace GetFrontFace() const;
+ wgpu::PrimitiveTopology GetPrimitiveTopology() const;
+ wgpu::CullMode GetCullMode() const;
+ wgpu::FrontFace GetFrontFace() const;
std::bitset<kMaxColorAttachments> GetColorAttachmentsMask() const;
bool HasDepthStencilAttachment() const;
- dawn::TextureFormat GetColorAttachmentFormat(uint32_t attachment) const;
- dawn::TextureFormat GetDepthStencilFormat() const;
+ wgpu::TextureFormat GetColorAttachmentFormat(uint32_t attachment) const;
+ wgpu::TextureFormat GetDepthStencilFormat() const;
uint32_t GetSampleCount() const;
const AttachmentState* GetAttachmentState() const;
@@ -108,7 +108,7 @@
std::array<ColorStateDescriptor, kMaxColorAttachments> mColorStates;
// Other state
- dawn::PrimitiveTopology mPrimitiveTopology;
+ wgpu::PrimitiveTopology mPrimitiveTopology;
RasterizationStateDescriptor mRasterizationState;
uint32_t mSampleMask;
bool mAlphaToCoverageEnabled;
diff --git a/src/dawn_native/Sampler.h b/src/dawn_native/Sampler.h
index 202f3cd..a64e4f2 100644
--- a/src/dawn_native/Sampler.h
+++ b/src/dawn_native/Sampler.h
@@ -47,15 +47,15 @@
SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag);
// TODO(cwallez@chromium.org): Store a crypto hash of the items instead?
- dawn::AddressMode mAddressModeU;
- dawn::AddressMode mAddressModeV;
- dawn::AddressMode mAddressModeW;
- dawn::FilterMode mMagFilter;
- dawn::FilterMode mMinFilter;
- dawn::FilterMode mMipmapFilter;
+ wgpu::AddressMode mAddressModeU;
+ wgpu::AddressMode mAddressModeV;
+ wgpu::AddressMode mAddressModeW;
+ wgpu::FilterMode mMagFilter;
+ wgpu::FilterMode mMinFilter;
+ wgpu::FilterMode mMipmapFilter;
float mLodMinClamp;
float mLodMaxClamp;
- dawn::CompareFunction mCompareFunction;
+ wgpu::CompareFunction mCompareFunction;
bool mIsBlueprint = false;
};
diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp
index f19a123..84c8efb 100644
--- a/src/dawn_native/ShaderModule.cpp
+++ b/src/dawn_native/ShaderModule.cpp
@@ -132,7 +132,7 @@
}
if (resources.push_constant_buffers.size() > 0) {
- GetDevice()->HandleError(dawn::ErrorType::Validation,
+ GetDevice()->HandleError(wgpu::ErrorType::Validation,
"Push constants aren't supported.");
}
@@ -140,7 +140,7 @@
auto ExtractResourcesBinding = [this](const spirv_cross::SmallVector<spirv_cross::Resource>&
resources,
const spirv_cross::Compiler& compiler,
- dawn::BindingType bindingType) {
+ wgpu::BindingType bindingType) {
for (const auto& resource : resources) {
ASSERT(compiler.get_decoration_bitset(resource.id).get(spv::DecorationBinding));
ASSERT(
@@ -150,7 +150,7 @@
uint32_t set = compiler.get_decoration(resource.id, spv::DecorationDescriptorSet);
if (binding >= kMaxBindingsPerGroup || set >= kMaxBindGroups) {
- GetDevice()->HandleError(dawn::ErrorType::Validation,
+ GetDevice()->HandleError(wgpu::ErrorType::Validation,
"Binding over limits in the SPIRV");
continue;
}
@@ -164,12 +164,12 @@
};
ExtractResourcesBinding(resources.uniform_buffers, compiler,
- dawn::BindingType::UniformBuffer);
+ wgpu::BindingType::UniformBuffer);
ExtractResourcesBinding(resources.separate_images, compiler,
- dawn::BindingType::SampledTexture);
- ExtractResourcesBinding(resources.separate_samplers, compiler, dawn::BindingType::Sampler);
+ wgpu::BindingType::SampledTexture);
+ ExtractResourcesBinding(resources.separate_samplers, compiler, wgpu::BindingType::Sampler);
ExtractResourcesBinding(resources.storage_buffers, compiler,
- dawn::BindingType::StorageBuffer);
+ wgpu::BindingType::StorageBuffer);
// Extract the vertex attributes
if (mExecutionModel == SingleShaderStage::Vertex) {
@@ -178,7 +178,7 @@
uint32_t location = compiler.get_decoration(attrib.id, spv::DecorationLocation);
if (location >= kMaxVertexAttributes) {
- device->HandleError(dawn::ErrorType::Validation,
+ device->HandleError(wgpu::ErrorType::Validation,
"Attribute location over limits in the SPIRV");
return;
}
@@ -190,7 +190,7 @@
// all the location 0, causing a compile error.
for (const auto& attrib : resources.stage_outputs) {
if (!compiler.get_decoration_bitset(attrib.id).get(spv::DecorationLocation)) {
- device->HandleError(dawn::ErrorType::Validation,
+ device->HandleError(wgpu::ErrorType::Validation,
"Need location qualifier on vertex output");
return;
}
@@ -202,7 +202,7 @@
// all the location 0, causing a compile error.
for (const auto& attrib : resources.stage_inputs) {
if (!compiler.get_decoration_bitset(attrib.id).get(spv::DecorationLocation)) {
- device->HandleError(dawn::ErrorType::Validation,
+ device->HandleError(wgpu::ErrorType::Validation,
"Need location qualifier on fragment input");
return;
}
@@ -214,7 +214,7 @@
uint32_t location =
compiler.get_decoration(fragmentOutput.id, spv::DecorationLocation);
if (location >= kMaxColorAttachments) {
- device->HandleError(dawn::ErrorType::Validation,
+ device->HandleError(wgpu::ErrorType::Validation,
"Fragment output location over limits in the SPIRV");
return;
}
diff --git a/src/dawn_native/ShaderModule.h b/src/dawn_native/ShaderModule.h
index f2c133c..a7c41bc 100644
--- a/src/dawn_native/ShaderModule.h
+++ b/src/dawn_native/ShaderModule.h
@@ -52,7 +52,7 @@
// The SPIRV ID of the resource.
uint32_t id;
uint32_t base_type_id;
- dawn::BindingType type;
+ wgpu::BindingType type;
bool used = false;
};
using ModuleBindingInfo =
diff --git a/src/dawn_native/SwapChain.cpp b/src/dawn_native/SwapChain.cpp
index 8194fe1..bb9eb63 100644
--- a/src/dawn_native/SwapChain.cpp
+++ b/src/dawn_native/SwapChain.cpp
@@ -80,8 +80,8 @@
return new ErrorSwapChain(device);
}
- void SwapChainBase::Configure(dawn::TextureFormat format,
- dawn::TextureUsage allowedUsage,
+ void SwapChainBase::Configure(wgpu::TextureFormat format,
+ wgpu::TextureUsage allowedUsage,
uint32_t width,
uint32_t height) {
if (GetDevice()->ConsumedError(ValidateConfigure(format, allowedUsage, width, height))) {
@@ -89,7 +89,7 @@
}
ASSERT(!IsError());
- allowedUsage |= dawn::TextureUsage::Present;
+ allowedUsage |= wgpu::TextureUsage::Present;
mFormat = format;
mAllowedUsage = allowedUsage;
@@ -106,7 +106,7 @@
ASSERT(!IsError());
TextureDescriptor descriptor;
- descriptor.dimension = dawn::TextureDimension::e2D;
+ descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.size.width = mWidth;
descriptor.size.height = mHeight;
descriptor.size.depth = 1;
@@ -138,8 +138,8 @@
return mImplementation;
}
- MaybeError SwapChainBase::ValidateConfigure(dawn::TextureFormat format,
- dawn::TextureUsage allowedUsage,
+ MaybeError SwapChainBase::ValidateConfigure(wgpu::TextureFormat format,
+ wgpu::TextureUsage allowedUsage,
uint32_t width,
uint32_t height) const {
DAWN_TRY(GetDevice()->ValidateObject(this));
diff --git a/src/dawn_native/SwapChain.h b/src/dawn_native/SwapChain.h
index c9b6502..0ae6a16 100644
--- a/src/dawn_native/SwapChain.h
+++ b/src/dawn_native/SwapChain.h
@@ -35,8 +35,8 @@
static SwapChainBase* MakeError(DeviceBase* device);
// Dawn API
- void Configure(dawn::TextureFormat format,
- dawn::TextureUsage allowedUsage,
+ void Configure(wgpu::TextureFormat format,
+ wgpu::TextureUsage allowedUsage,
uint32_t width,
uint32_t height);
TextureBase* GetNextTexture();
@@ -50,16 +50,16 @@
virtual MaybeError OnBeforePresent(TextureBase* texture) = 0;
private:
- MaybeError ValidateConfigure(dawn::TextureFormat format,
- dawn::TextureUsage allowedUsage,
+ MaybeError ValidateConfigure(wgpu::TextureFormat format,
+ wgpu::TextureUsage allowedUsage,
uint32_t width,
uint32_t height) const;
MaybeError ValidateGetNextTexture() const;
MaybeError ValidatePresent(TextureBase* texture) const;
DawnSwapChainImplementation mImplementation = {};
- dawn::TextureFormat mFormat = {};
- dawn::TextureUsage mAllowedUsage;
+ wgpu::TextureFormat mFormat = {};
+ wgpu::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 9485ab6..b6a50d6 100644
--- a/src/dawn_native/Texture.cpp
+++ b/src/dawn_native/Texture.cpp
@@ -37,14 +37,14 @@
// TODO(jiawei.shao@intel.com): support validation on all texture view dimensions
bool IsTextureViewDimensionCompatibleWithTextureDimension(
- dawn::TextureViewDimension textureViewDimension,
- dawn::TextureDimension textureDimension) {
+ wgpu::TextureViewDimension textureViewDimension,
+ wgpu::TextureDimension textureDimension) {
switch (textureViewDimension) {
- case dawn::TextureViewDimension::e2D:
- case dawn::TextureViewDimension::e2DArray:
- case dawn::TextureViewDimension::Cube:
- case dawn::TextureViewDimension::CubeArray:
- return textureDimension == dawn::TextureDimension::e2D;
+ case wgpu::TextureViewDimension::e2D:
+ case wgpu::TextureViewDimension::e2DArray:
+ case wgpu::TextureViewDimension::Cube:
+ case wgpu::TextureViewDimension::CubeArray:
+ return textureDimension == wgpu::TextureDimension::e2D;
default:
UNREACHABLE();
return false;
@@ -53,16 +53,16 @@
// TODO(jiawei.shao@intel.com): support validation on all texture view dimensions
bool IsArrayLayerValidForTextureViewDimension(
- dawn::TextureViewDimension textureViewDimension,
+ wgpu::TextureViewDimension textureViewDimension,
uint32_t textureViewArrayLayer) {
switch (textureViewDimension) {
- case dawn::TextureViewDimension::e2D:
+ case wgpu::TextureViewDimension::e2D:
return textureViewArrayLayer == 1u;
- case dawn::TextureViewDimension::e2DArray:
+ case wgpu::TextureViewDimension::e2DArray:
return true;
- case dawn::TextureViewDimension::Cube:
+ case wgpu::TextureViewDimension::Cube:
return textureViewArrayLayer == 6u;
- case dawn::TextureViewDimension::CubeArray:
+ case wgpu::TextureViewDimension::CubeArray:
return textureViewArrayLayer % 6 == 0;
default:
UNREACHABLE();
@@ -71,14 +71,14 @@
}
bool IsTextureSizeValidForTextureViewDimension(
- dawn::TextureViewDimension textureViewDimension,
+ wgpu::TextureViewDimension textureViewDimension,
const Extent3D& textureSize) {
switch (textureViewDimension) {
- case dawn::TextureViewDimension::Cube:
- case dawn::TextureViewDimension::CubeArray:
+ case wgpu::TextureViewDimension::Cube:
+ case wgpu::TextureViewDimension::CubeArray:
return textureSize.width == textureSize.height;
- case dawn::TextureViewDimension::e2D:
- case dawn::TextureViewDimension::e2DArray:
+ case wgpu::TextureViewDimension::e2D:
+ case wgpu::TextureViewDimension::e2DArray:
return true;
default:
UNREACHABLE();
@@ -159,21 +159,21 @@
MaybeError ValidateTextureUsage(const TextureDescriptor* descriptor, const Format* format) {
DAWN_TRY(dawn_native::ValidateTextureUsage(descriptor->usage));
- constexpr dawn::TextureUsage kValidCompressedUsages = dawn::TextureUsage::Sampled |
- dawn::TextureUsage::CopySrc |
- dawn::TextureUsage::CopyDst;
+ constexpr wgpu::TextureUsage kValidCompressedUsages = wgpu::TextureUsage::Sampled |
+ wgpu::TextureUsage::CopySrc |
+ wgpu::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::TextureUsage::OutputAttachment)) {
+ (descriptor->usage & wgpu::TextureUsage::OutputAttachment)) {
return DAWN_VALIDATION_ERROR(
"Non-renderable format used with OutputAttachment usage");
}
- if (descriptor->usage & dawn::TextureUsage::Storage) {
+ if (descriptor->usage & wgpu::TextureUsage::Storage) {
return DAWN_VALIDATION_ERROR("storage textures aren't supported (yet)");
}
@@ -205,7 +205,7 @@
return DAWN_VALIDATION_ERROR("Cannot create an empty texture");
}
- if (descriptor->dimension != dawn::TextureDimension::e2D) {
+ if (descriptor->dimension != wgpu::TextureDimension::e2D) {
return DAWN_VALIDATION_ERROR("Texture dimension must be 2D (for now)");
}
@@ -228,15 +228,15 @@
}
DAWN_TRY(ValidateTextureViewDimension(descriptor->dimension));
- if (descriptor->dimension == dawn::TextureViewDimension::e1D ||
- descriptor->dimension == dawn::TextureViewDimension::e3D) {
+ if (descriptor->dimension == wgpu::TextureViewDimension::e1D ||
+ descriptor->dimension == wgpu::TextureViewDimension::e3D) {
return DAWN_VALIDATION_ERROR("Texture view dimension must be 2D compatible.");
}
DAWN_TRY(ValidateTextureFormat(descriptor->format));
DAWN_TRY(ValidateTextureAspect(descriptor->aspect));
- if (descriptor->aspect != dawn::TextureAspect::All) {
+ if (descriptor->aspect != wgpu::TextureAspect::All) {
return DAWN_VALIDATION_ERROR("Texture aspect must be 'all'");
}
@@ -273,22 +273,22 @@
// The default value for the view dimension depends on the texture's dimension with a
// special case for 2DArray being chosen automatically if arrayLayerCount is unspecified.
- if (desc.dimension == dawn::TextureViewDimension::Undefined) {
+ if (desc.dimension == wgpu::TextureViewDimension::Undefined) {
switch (texture->GetDimension()) {
- case dawn::TextureDimension::e1D:
- desc.dimension = dawn::TextureViewDimension::e1D;
+ case wgpu::TextureDimension::e1D:
+ desc.dimension = wgpu::TextureViewDimension::e1D;
break;
- case dawn::TextureDimension::e2D:
+ case wgpu::TextureDimension::e2D:
if (texture->GetArrayLayers() > 1u && desc.arrayLayerCount == 0) {
- desc.dimension = dawn::TextureViewDimension::e2DArray;
+ desc.dimension = wgpu::TextureViewDimension::e2DArray;
} else {
- desc.dimension = dawn::TextureViewDimension::e2D;
+ desc.dimension = wgpu::TextureViewDimension::e2D;
}
break;
- case dawn::TextureDimension::e3D:
- desc.dimension = dawn::TextureViewDimension::e3D;
+ case wgpu::TextureDimension::e3D:
+ desc.dimension = wgpu::TextureViewDimension::e3D;
break;
default:
@@ -296,7 +296,7 @@
}
}
- if (desc.format == dawn::TextureFormat::Undefined) {
+ if (desc.format == wgpu::TextureFormat::Undefined) {
desc.format = texture->GetFormat().format;
}
if (desc.arrayLayerCount == 0) {
@@ -349,7 +349,7 @@
return new TextureBase(device, ObjectBase::kError);
}
- dawn::TextureDimension TextureBase::GetDimension() const {
+ wgpu::TextureDimension TextureBase::GetDimension() const {
ASSERT(!IsError());
return mDimension;
}
@@ -375,7 +375,7 @@
ASSERT(!IsError());
return mSampleCount;
}
- dawn::TextureUsage TextureBase::GetUsage() const {
+ wgpu::TextureUsage TextureBase::GetUsage() const {
ASSERT(!IsError());
return mUsage;
}
@@ -527,7 +527,7 @@
return mFormat;
}
- dawn::TextureViewDimension TextureViewBase::GetDimension() const {
+ wgpu::TextureViewDimension TextureViewBase::GetDimension() const {
ASSERT(!IsError());
return mDimension;
}
diff --git a/src/dawn_native/Texture.h b/src/dawn_native/Texture.h
index fafd46e..24a894f 100644
--- a/src/dawn_native/Texture.h
+++ b/src/dawn_native/Texture.h
@@ -34,12 +34,12 @@
bool IsValidSampleCount(uint32_t sampleCount);
- static constexpr dawn::TextureUsage kReadOnlyTextureUsages =
- dawn::TextureUsage::CopySrc | dawn::TextureUsage::Sampled | dawn::TextureUsage::Present;
+ static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
+ wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Present;
- static constexpr dawn::TextureUsage kWritableTextureUsages =
- dawn::TextureUsage::CopyDst | dawn::TextureUsage::Storage |
- dawn::TextureUsage::OutputAttachment;
+ static constexpr wgpu::TextureUsage kWritableTextureUsages =
+ wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Storage |
+ wgpu::TextureUsage::OutputAttachment;
class TextureBase : public ObjectBase {
public:
@@ -49,13 +49,13 @@
static TextureBase* MakeError(DeviceBase* device);
- dawn::TextureDimension GetDimension() const;
+ wgpu::TextureDimension GetDimension() const;
const Format& GetFormat() const;
const Extent3D& GetSize() const;
uint32_t GetArrayLayers() const;
uint32_t GetNumMipLevels() const;
uint32_t GetSampleCount() const;
- dawn::TextureUsage GetUsage() const;
+ wgpu::TextureUsage GetUsage() const;
TextureState GetTextureState() const;
uint32_t GetSubresourceIndex(uint32_t mipLevel, uint32_t arraySlice) const;
bool IsSubresourceContentInitialized(uint32_t baseMipLevel,
@@ -92,14 +92,14 @@
virtual void DestroyImpl();
MaybeError ValidateDestroy() const;
- dawn::TextureDimension mDimension;
+ wgpu::TextureDimension mDimension;
// TODO(cwallez@chromium.org): This should be deduplicated in the Device
const Format& mFormat;
Extent3D mSize;
uint32_t mArrayLayerCount;
uint32_t mMipLevelCount;
uint32_t mSampleCount;
- dawn::TextureUsage mUsage = dawn::TextureUsage::None;
+ wgpu::TextureUsage mUsage = wgpu::TextureUsage::None;
TextureState mState;
// TODO(natlee@microsoft.com): Use a more optimized data structure to save space
@@ -116,7 +116,7 @@
TextureBase* GetTexture();
const Format& GetFormat() const;
- dawn::TextureViewDimension GetDimension() const;
+ wgpu::TextureViewDimension GetDimension() const;
uint32_t GetBaseMipLevel() const;
uint32_t GetLevelCount() const;
uint32_t GetBaseArrayLayer() const;
@@ -129,7 +129,7 @@
// TODO(cwallez@chromium.org): This should be deduplicated in the Device
const Format& mFormat;
- dawn::TextureViewDimension mDimension;
+ wgpu::TextureViewDimension mDimension;
uint32_t mBaseMipLevel;
uint32_t mMipLevelCount;
uint32_t mBaseArrayLayer;
diff --git a/src/dawn_native/d3d12/BindGroupD3D12.cpp b/src/dawn_native/d3d12/BindGroupD3D12.cpp
index 0d9292b..38ca3a4 100644
--- a/src/dawn_native/d3d12/BindGroupD3D12.cpp
+++ b/src/dawn_native/d3d12/BindGroupD3D12.cpp
@@ -49,7 +49,7 @@
}
switch (layout.types[bindingIndex]) {
- case dawn::BindingType::UniformBuffer: {
+ case wgpu::BindingType::UniformBuffer: {
BufferBinding binding = GetBindingAsBufferBinding(bindingIndex);
D3D12_CONSTANT_BUFFER_VIEW_DESC desc;
@@ -62,7 +62,7 @@
&desc, cbvUavSrvHeapStart.GetCPUHandle(*cbvUavSrvHeapOffset +
bindingOffsets[bindingIndex]));
} break;
- case dawn::BindingType::StorageBuffer: {
+ case wgpu::BindingType::StorageBuffer: {
BufferBinding binding = GetBindingAsBufferBinding(bindingIndex);
// Since SPIRV-Cross outputs HLSL shaders with RWByteAddressBuffer,
@@ -86,7 +86,7 @@
cbvUavSrvHeapStart.GetCPUHandle(*cbvUavSrvHeapOffset +
bindingOffsets[bindingIndex]));
} break;
- case dawn::BindingType::SampledTexture: {
+ case wgpu::BindingType::SampledTexture: {
auto* view = ToBackend(GetBindingAsTextureView(bindingIndex));
auto& srv = view->GetSRVDescriptor();
d3d12Device->CreateShaderResourceView(
@@ -94,7 +94,7 @@
cbvUavSrvHeapStart.GetCPUHandle(*cbvUavSrvHeapOffset +
bindingOffsets[bindingIndex]));
} break;
- case dawn::BindingType::Sampler: {
+ case wgpu::BindingType::Sampler: {
auto* sampler = ToBackend(GetBindingAsSampler(bindingIndex));
auto& samplerDesc = sampler->GetSamplerDescriptor();
d3d12Device->CreateSampler(
@@ -102,8 +102,8 @@
bindingOffsets[bindingIndex]));
} break;
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
diff --git a/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp b/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp
index e0627b4..b810710 100644
--- a/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp
+++ b/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp
@@ -32,21 +32,21 @@
}
switch (groupInfo.types[binding]) {
- case dawn::BindingType::UniformBuffer:
+ case wgpu::BindingType::UniformBuffer:
mBindingOffsets[binding] = mDescriptorCounts[CBV]++;
break;
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
mBindingOffsets[binding] = mDescriptorCounts[UAV]++;
break;
- case dawn::BindingType::SampledTexture:
+ case wgpu::BindingType::SampledTexture:
mBindingOffsets[binding] = mDescriptorCounts[SRV]++;
break;
- case dawn::BindingType::Sampler:
+ case wgpu::BindingType::Sampler:
mBindingOffsets[binding] = mDescriptorCounts[Sampler]++;
break;
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
}
@@ -99,14 +99,14 @@
// Root descriptor needs to set this value to set correct register number in
// generated HLSL shader.
switch (groupInfo.types[binding]) {
- case dawn::BindingType::UniformBuffer:
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::UniformBuffer:
+ case wgpu::BindingType::StorageBuffer:
mBindingOffsets[binding] = baseRegister++;
break;
- case dawn::BindingType::SampledTexture:
- case dawn::BindingType::Sampler:
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::SampledTexture:
+ case wgpu::BindingType::Sampler:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
}
@@ -114,21 +114,21 @@
}
switch (groupInfo.types[binding]) {
- case dawn::BindingType::UniformBuffer:
+ case wgpu::BindingType::UniformBuffer:
mBindingOffsets[binding] += descriptorOffsets[CBV];
break;
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
mBindingOffsets[binding] += descriptorOffsets[UAV];
break;
- case dawn::BindingType::SampledTexture:
+ case wgpu::BindingType::SampledTexture:
mBindingOffsets[binding] += descriptorOffsets[SRV];
break;
- case dawn::BindingType::Sampler:
+ case wgpu::BindingType::Sampler:
mBindingOffsets[binding] += descriptorOffsets[Sampler];
break;
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
diff --git a/src/dawn_native/d3d12/BufferD3D12.cpp b/src/dawn_native/d3d12/BufferD3D12.cpp
index 12bcc1a..3c4feef 100644
--- a/src/dawn_native/d3d12/BufferD3D12.cpp
+++ b/src/dawn_native/d3d12/BufferD3D12.cpp
@@ -24,45 +24,45 @@
namespace dawn_native { namespace d3d12 {
namespace {
- D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::BufferUsage usage) {
+ D3D12_RESOURCE_FLAGS D3D12ResourceFlags(wgpu::BufferUsage usage) {
D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE;
- if (usage & dawn::BufferUsage::Storage) {
+ if (usage & wgpu::BufferUsage::Storage) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
}
return flags;
}
- D3D12_RESOURCE_STATES D3D12BufferUsage(dawn::BufferUsage usage) {
+ D3D12_RESOURCE_STATES D3D12BufferUsage(wgpu::BufferUsage usage) {
D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON;
- if (usage & dawn::BufferUsage::CopySrc) {
+ if (usage & wgpu::BufferUsage::CopySrc) {
resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE;
}
- if (usage & dawn::BufferUsage::CopyDst) {
+ if (usage & wgpu::BufferUsage::CopyDst) {
resourceState |= D3D12_RESOURCE_STATE_COPY_DEST;
}
- if (usage & (dawn::BufferUsage::Vertex | dawn::BufferUsage::Uniform)) {
+ if (usage & (wgpu::BufferUsage::Vertex | wgpu::BufferUsage::Uniform)) {
resourceState |= D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER;
}
- if (usage & dawn::BufferUsage::Index) {
+ if (usage & wgpu::BufferUsage::Index) {
resourceState |= D3D12_RESOURCE_STATE_INDEX_BUFFER;
}
- if (usage & dawn::BufferUsage::Storage) {
+ if (usage & wgpu::BufferUsage::Storage) {
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
}
- if (usage & dawn::BufferUsage::Indirect) {
+ if (usage & wgpu::BufferUsage::Indirect) {
resourceState |= D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT;
}
return resourceState;
}
- D3D12_HEAP_TYPE D3D12HeapType(dawn::BufferUsage allowedUsage) {
- if (allowedUsage & dawn::BufferUsage::MapRead) {
+ D3D12_HEAP_TYPE D3D12HeapType(wgpu::BufferUsage allowedUsage) {
+ if (allowedUsage & wgpu::BufferUsage::MapRead) {
return D3D12_HEAP_TYPE_READBACK;
- } else if (allowedUsage & dawn::BufferUsage::MapWrite) {
+ } else if (allowedUsage & wgpu::BufferUsage::MapWrite) {
return D3D12_HEAP_TYPE_UPLOAD;
} else {
return D3D12_HEAP_TYPE_DEFAULT;
@@ -88,7 +88,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::BufferUsage::CopyDst);
+ resourceDescriptor.Flags = D3D12ResourceFlags(GetUsage() | wgpu::BufferUsage::CopyDst);
auto heapType = D3D12HeapType(GetUsage());
auto bufferUsage = D3D12_RESOURCE_STATE_COMMON;
@@ -98,7 +98,7 @@
if (heapType == D3D12_HEAP_TYPE_READBACK) {
bufferUsage |= D3D12_RESOURCE_STATE_COPY_DEST;
mFixedResourceState = true;
- mLastUsage = dawn::BufferUsage::CopyDst;
+ mLastUsage = wgpu::BufferUsage::CopyDst;
}
// D3D12 requires buffers on the UPLOAD heap to have the D3D12_RESOURCE_STATE_GENERIC_READ
@@ -106,7 +106,7 @@
if (heapType == D3D12_HEAP_TYPE_UPLOAD) {
bufferUsage |= D3D12_RESOURCE_STATE_GENERIC_READ;
mFixedResourceState = true;
- mLastUsage = dawn::BufferUsage::CopySrc;
+ mLastUsage = wgpu::BufferUsage::CopySrc;
}
DAWN_TRY_ASSIGN(
@@ -133,7 +133,7 @@
// cause subsequent errors.
bool Buffer::TransitionUsageAndGetResourceBarrier(CommandRecordingContext* commandContext,
D3D12_RESOURCE_BARRIER* barrier,
- dawn::BufferUsage newUsage) {
+ wgpu::BufferUsage newUsage) {
// Resources in upload and readback heaps must be kept in the COPY_SOURCE/DEST state
if (mFixedResourceState) {
ASSERT(mLastUsage == newUsage);
@@ -204,7 +204,7 @@
}
void Buffer::TransitionUsageNow(CommandRecordingContext* commandContext,
- dawn::BufferUsage usage) {
+ wgpu::BufferUsage usage) {
D3D12_RESOURCE_BARRIER barrier;
if (TransitionUsageAndGetResourceBarrier(commandContext, &barrier, usage)) {
@@ -226,7 +226,7 @@
bool Buffer::IsMapWritable() const {
// TODO(enga): Handle CPU-visible memory on UMA
- return (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
+ return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::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 289c4ec..6a5b936 100644
--- a/src/dawn_native/d3d12/BufferD3D12.h
+++ b/src/dawn_native/d3d12/BufferD3D12.h
@@ -39,8 +39,8 @@
void OnMapCommandSerialFinished(uint32_t mapSerial, void* data, bool isWrite);
bool TransitionUsageAndGetResourceBarrier(CommandRecordingContext* commandContext,
D3D12_RESOURCE_BARRIER* barrier,
- dawn::BufferUsage newUsage);
- void TransitionUsageNow(CommandRecordingContext* commandContext, dawn::BufferUsage usage);
+ wgpu::BufferUsage newUsage);
+ void TransitionUsageNow(CommandRecordingContext* commandContext, wgpu::BufferUsage usage);
private:
// Dawn API
@@ -54,7 +54,7 @@
ResourceHeapAllocation mResourceAllocation;
bool mFixedResourceState = false;
- dawn::BufferUsage mLastUsage = dawn::BufferUsage::None;
+ wgpu::BufferUsage mLastUsage = wgpu::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 f1431db..a93f9a6 100644
--- a/src/dawn_native/d3d12/CommandBufferD3D12.cpp
+++ b/src/dawn_native/d3d12/CommandBufferD3D12.cpp
@@ -40,11 +40,11 @@
namespace {
- DXGI_FORMAT DXGIIndexFormat(dawn::IndexFormat format) {
+ DXGI_FORMAT DXGIIndexFormat(wgpu::IndexFormat format) {
switch (format) {
- case dawn::IndexFormat::Uint16:
+ case wgpu::IndexFormat::Uint16:
return DXGI_FORMAT_R16_UINT;
- case dawn::IndexFormat::Uint32:
+ case wgpu::IndexFormat::Uint32:
return DXGI_FORMAT_R32_UINT;
default:
UNREACHABLE();
@@ -149,21 +149,21 @@
if (mInCompute) {
for (uint32_t index : IterateBitSet(mBindGroupLayoutsMask)) {
for (uint32_t binding : IterateBitSet(mBuffersNeedingBarrier[index])) {
- dawn::BindingType bindingType = mBindingTypes[index][binding];
+ wgpu::BindingType bindingType = mBindingTypes[index][binding];
switch (bindingType) {
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
ToBackend(mBuffers[index][binding])
->TransitionUsageNow(commandContext,
- dawn::BufferUsage::Storage);
+ wgpu::BufferUsage::Storage);
break;
- case dawn::BindingType::StorageTexture:
+ case wgpu::BindingType::StorageTexture:
// Not implemented.
- case dawn::BindingType::UniformBuffer:
- case dawn::BindingType::ReadonlyStorageBuffer:
- case dawn::BindingType::Sampler:
- case dawn::BindingType::SampledTexture:
+ case wgpu::BindingType::UniformBuffer:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::Sampler:
+ case wgpu::BindingType::SampledTexture:
// Don't require barriers.
default:
@@ -224,7 +224,7 @@
ToBackend(binding.buffer)->GetVA() + offset;
switch (layout.types[bindingIndex]) {
- case dawn::BindingType::UniformBuffer:
+ case wgpu::BindingType::UniformBuffer:
if (mInCompute) {
commandList->SetComputeRootConstantBufferView(parameterIndex,
bufferLocation);
@@ -233,7 +233,7 @@
bufferLocation);
}
break;
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
if (mInCompute) {
commandList->SetComputeRootUnorderedAccessView(parameterIndex,
bufferLocation);
@@ -242,10 +242,10 @@
bufferLocation);
}
break;
- case dawn::BindingType::SampledTexture:
- case dawn::BindingType::Sampler:
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::SampledTexture:
+ case wgpu::BindingType::Sampler:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
}
@@ -619,7 +619,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::TextureUsage::OutputAttachment)) {
+ if (!(usages.textureUsages[i] & wgpu::TextureUsage::OutputAttachment)) {
texture->EnsureSubresourceContentInitialized(commandContext, 0,
texture->GetNumMipLevels(), 0,
texture->GetArrayLayers());
@@ -673,8 +673,8 @@
Buffer* srcBuffer = ToBackend(copy->source.Get());
Buffer* dstBuffer = ToBackend(copy->destination.Get());
- srcBuffer->TransitionUsageNow(commandContext, dawn::BufferUsage::CopySrc);
- dstBuffer->TransitionUsageNow(commandContext, dawn::BufferUsage::CopyDst);
+ srcBuffer->TransitionUsageNow(commandContext, wgpu::BufferUsage::CopySrc);
+ dstBuffer->TransitionUsageNow(commandContext, wgpu::BufferUsage::CopyDst);
commandList->CopyBufferRegion(
dstBuffer->GetD3D12Resource().Get(), copy->destinationOffset,
@@ -696,8 +696,8 @@
copy->destination.arrayLayer, 1);
}
- buffer->TransitionUsageNow(commandContext, dawn::BufferUsage::CopySrc);
- texture->TransitionUsageNow(commandContext, dawn::TextureUsage::CopyDst);
+ buffer->TransitionUsageNow(commandContext, wgpu::BufferUsage::CopySrc);
+ texture->TransitionUsageNow(commandContext, wgpu::TextureUsage::CopyDst);
auto copySplit = ComputeTextureCopySplit(
copy->destination.origin, copy->copySize, texture->GetFormat(),
@@ -731,8 +731,8 @@
texture->EnsureSubresourceContentInitialized(
commandContext, copy->source.mipLevel, 1, copy->source.arrayLayer, 1);
- texture->TransitionUsageNow(commandContext, dawn::TextureUsage::CopySrc);
- buffer->TransitionUsageNow(commandContext, dawn::BufferUsage::CopyDst);
+ texture->TransitionUsageNow(commandContext, wgpu::TextureUsage::CopySrc);
+ buffer->TransitionUsageNow(commandContext, wgpu::BufferUsage::CopyDst);
TextureCopySplit copySplit = ComputeTextureCopySplit(
copy->source.origin, copy->copySize, texture->GetFormat(),
@@ -778,8 +778,8 @@
commandContext, copy->destination.mipLevel, 1,
copy->destination.arrayLayer, 1);
}
- source->TransitionUsageNow(commandContext, dawn::TextureUsage::CopySrc);
- destination->TransitionUsageNow(commandContext, dawn::TextureUsage::CopyDst);
+ source->TransitionUsageNow(commandContext, wgpu::TextureUsage::CopySrc);
+ destination->TransitionUsageNow(commandContext, wgpu::TextureUsage::CopyDst);
if (CanUseCopyResource(source->GetNumMipLevels(), source->GetSize(),
destination->GetSize(), copy->copySize)) {
@@ -928,8 +928,8 @@
// Load op - color
ASSERT(view->GetLevelCount() == 1);
ASSERT(view->GetLayerCount() == 1);
- if (attachmentInfo.loadOp == dawn::LoadOp::Clear ||
- (attachmentInfo.loadOp == dawn::LoadOp::Load &&
+ if (attachmentInfo.loadOp == wgpu::LoadOp::Clear ||
+ (attachmentInfo.loadOp == wgpu::LoadOp::Load &&
!view->GetTexture()->IsSubresourceContentInitialized(
view->GetBaseMipLevel(), 1, view->GetBaseArrayLayer(), 1))) {
D3D12_CPU_DESCRIPTOR_HANDLE handle = args.RTVs[i];
@@ -949,12 +949,12 @@
}
switch (attachmentInfo.storeOp) {
- case dawn::StoreOp::Store: {
+ case wgpu::StoreOp::Store: {
view->GetTexture()->SetIsSubresourceContentInitialized(
true, view->GetBaseMipLevel(), 1, view->GetBaseArrayLayer(), 1);
} break;
- case dawn::StoreOp::Clear: {
+ case wgpu::StoreOp::Clear: {
view->GetTexture()->SetIsSubresourceContentInitialized(
false, view->GetBaseMipLevel(), 1, view->GetBaseArrayLayer(), 1);
} break;
@@ -974,9 +974,9 @@
// Load op - depth/stencil
bool doDepthClear = texture->GetFormat().HasDepth() &&
- (attachmentInfo.depthLoadOp == dawn::LoadOp::Clear);
+ (attachmentInfo.depthLoadOp == wgpu::LoadOp::Clear);
bool doStencilClear = texture->GetFormat().HasStencil() &&
- (attachmentInfo.stencilLoadOp == dawn::LoadOp::Clear);
+ (attachmentInfo.stencilLoadOp == wgpu::LoadOp::Clear);
D3D12_CLEAR_FLAGS clearFlags = {};
if (doDepthClear) {
@@ -991,12 +991,12 @@
view->GetBaseMipLevel(), view->GetLevelCount(), view->GetBaseArrayLayer(),
view->GetLayerCount())) {
if (texture->GetFormat().HasDepth() &&
- attachmentInfo.depthLoadOp == dawn::LoadOp::Load) {
+ attachmentInfo.depthLoadOp == wgpu::LoadOp::Load) {
clearDepth = 0.0f;
clearFlags |= D3D12_CLEAR_FLAG_DEPTH;
}
if (texture->GetFormat().HasStencil() &&
- attachmentInfo.stencilLoadOp == dawn::LoadOp::Load) {
+ attachmentInfo.stencilLoadOp == wgpu::LoadOp::Load) {
clearStencil = 0u;
clearFlags |= D3D12_CLEAR_FLAG_STENCIL;
}
@@ -1008,13 +1008,13 @@
0, nullptr);
}
- if (attachmentInfo.depthStoreOp == dawn::StoreOp::Store &&
- attachmentInfo.stencilStoreOp == dawn::StoreOp::Store) {
+ if (attachmentInfo.depthStoreOp == wgpu::StoreOp::Store &&
+ attachmentInfo.stencilStoreOp == wgpu::StoreOp::Store) {
texture->SetIsSubresourceContentInitialized(
true, view->GetBaseMipLevel(), view->GetLevelCount(),
view->GetBaseArrayLayer(), view->GetLayerCount());
- } else if (attachmentInfo.depthStoreOp == dawn::StoreOp::Clear &&
- attachmentInfo.stencilStoreOp == dawn::StoreOp::Clear) {
+ } else if (attachmentInfo.depthStoreOp == wgpu::StoreOp::Clear &&
+ attachmentInfo.stencilStoreOp == wgpu::StoreOp::Clear) {
texture->SetIsSubresourceContentInitialized(
false, view->GetBaseMipLevel(), view->GetLevelCount(),
view->GetBaseArrayLayer(), view->GetLayerCount());
diff --git a/src/dawn_native/d3d12/DeviceD3D12.cpp b/src/dawn_native/d3d12/DeviceD3D12.cpp
index 40097bf..9976ff5 100644
--- a/src/dawn_native/d3d12/DeviceD3D12.cpp
+++ b/src/dawn_native/d3d12/DeviceD3D12.cpp
@@ -304,7 +304,7 @@
DAWN_TRY_ASSIGN(commandRecordingContext, GetPendingCommandContext());
ToBackend(destination)
- ->TransitionUsageNow(commandRecordingContext, dawn::BufferUsage::CopyDst);
+ ->TransitionUsageNow(commandRecordingContext, wgpu::BufferUsage::CopyDst);
commandRecordingContext->GetCommandList()->CopyBufferRegion(
ToBackend(destination)->GetD3D12Resource().Get(), destinationOffset,
diff --git a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp
index 1231283..9b40497 100644
--- a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp
+++ b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.cpp
@@ -113,8 +113,8 @@
return DAWN_SWAP_CHAIN_NO_ERROR;
}
- dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
- return dawn::TextureFormat::RGBA8Unorm;
+ wgpu::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
+ return wgpu::TextureFormat::RGBA8Unorm;
}
}} // namespace dawn_native::d3d12
diff --git a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h
index 294a8a2..fa8e4fa 100644
--- a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h
+++ b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h
@@ -41,7 +41,7 @@
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
DawnSwapChainError Present();
- dawn::TextureFormat GetPreferredFormat() const;
+ wgpu::TextureFormat GetPreferredFormat() const;
private:
HWND mWindow = nullptr;
diff --git a/src/dawn_native/d3d12/PipelineLayoutD3D12.cpp b/src/dawn_native/d3d12/PipelineLayoutD3D12.cpp
index 6c38e68..2cdd6cf 100644
--- a/src/dawn_native/d3d12/PipelineLayoutD3D12.cpp
+++ b/src/dawn_native/d3d12/PipelineLayoutD3D12.cpp
@@ -25,14 +25,14 @@
namespace dawn_native { namespace d3d12 {
namespace {
- D3D12_SHADER_VISIBILITY ShaderVisibilityType(dawn::ShaderStage visibility) {
- ASSERT(visibility != dawn::ShaderStage::None);
+ D3D12_SHADER_VISIBILITY ShaderVisibilityType(wgpu::ShaderStage visibility) {
+ ASSERT(visibility != wgpu::ShaderStage::None);
- if (visibility == dawn::ShaderStage::Vertex) {
+ if (visibility == wgpu::ShaderStage::Vertex) {
return D3D12_SHADER_VISIBILITY_VERTEX;
}
- if (visibility == dawn::ShaderStage::Fragment) {
+ if (visibility == wgpu::ShaderStage::Fragment) {
return D3D12_SHADER_VISIBILITY_PIXEL;
}
@@ -40,16 +40,16 @@
return D3D12_SHADER_VISIBILITY_ALL;
}
- D3D12_ROOT_PARAMETER_TYPE RootParameterType(dawn::BindingType type) {
+ D3D12_ROOT_PARAMETER_TYPE RootParameterType(wgpu::BindingType type) {
switch (type) {
- case dawn::BindingType::UniformBuffer:
+ case wgpu::BindingType::UniformBuffer:
return D3D12_ROOT_PARAMETER_TYPE_CBV;
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
return D3D12_ROOT_PARAMETER_TYPE_UAV;
- case dawn::BindingType::SampledTexture:
- case dawn::BindingType::Sampler:
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::SampledTexture:
+ case wgpu::BindingType::Sampler:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
}
}
diff --git a/src/dawn_native/d3d12/RenderPipelineD3D12.cpp b/src/dawn_native/d3d12/RenderPipelineD3D12.cpp
index 82fd037..f8d90a7 100644
--- a/src/dawn_native/d3d12/RenderPipelineD3D12.cpp
+++ b/src/dawn_native/d3d12/RenderPipelineD3D12.cpp
@@ -28,95 +28,95 @@
namespace dawn_native { namespace d3d12 {
namespace {
- DXGI_FORMAT VertexFormatType(dawn::VertexFormat format) {
+ DXGI_FORMAT VertexFormatType(wgpu::VertexFormat format) {
switch (format) {
- case dawn::VertexFormat::UChar2:
+ case wgpu::VertexFormat::UChar2:
return DXGI_FORMAT_R8G8_UINT;
- case dawn::VertexFormat::UChar4:
+ case wgpu::VertexFormat::UChar4:
return DXGI_FORMAT_R8G8B8A8_UINT;
- case dawn::VertexFormat::Char2:
+ case wgpu::VertexFormat::Char2:
return DXGI_FORMAT_R8G8_SINT;
- case dawn::VertexFormat::Char4:
+ case wgpu::VertexFormat::Char4:
return DXGI_FORMAT_R8G8B8A8_SINT;
- case dawn::VertexFormat::UChar2Norm:
+ case wgpu::VertexFormat::UChar2Norm:
return DXGI_FORMAT_R8G8_UNORM;
- case dawn::VertexFormat::UChar4Norm:
+ case wgpu::VertexFormat::UChar4Norm:
return DXGI_FORMAT_R8G8B8A8_UNORM;
- case dawn::VertexFormat::Char2Norm:
+ case wgpu::VertexFormat::Char2Norm:
return DXGI_FORMAT_R8G8_SNORM;
- case dawn::VertexFormat::Char4Norm:
+ case wgpu::VertexFormat::Char4Norm:
return DXGI_FORMAT_R8G8B8A8_SNORM;
- case dawn::VertexFormat::UShort2:
+ case wgpu::VertexFormat::UShort2:
return DXGI_FORMAT_R16G16_UINT;
- case dawn::VertexFormat::UShort4:
+ case wgpu::VertexFormat::UShort4:
return DXGI_FORMAT_R16G16B16A16_UINT;
- case dawn::VertexFormat::Short2:
+ case wgpu::VertexFormat::Short2:
return DXGI_FORMAT_R16G16_SINT;
- case dawn::VertexFormat::Short4:
+ case wgpu::VertexFormat::Short4:
return DXGI_FORMAT_R16G16B16A16_SINT;
- case dawn::VertexFormat::UShort2Norm:
+ case wgpu::VertexFormat::UShort2Norm:
return DXGI_FORMAT_R16G16_UNORM;
- case dawn::VertexFormat::UShort4Norm:
+ case wgpu::VertexFormat::UShort4Norm:
return DXGI_FORMAT_R16G16B16A16_UNORM;
- case dawn::VertexFormat::Short2Norm:
+ case wgpu::VertexFormat::Short2Norm:
return DXGI_FORMAT_R16G16_SNORM;
- case dawn::VertexFormat::Short4Norm:
+ case wgpu::VertexFormat::Short4Norm:
return DXGI_FORMAT_R16G16B16A16_SNORM;
- case dawn::VertexFormat::Half2:
+ case wgpu::VertexFormat::Half2:
return DXGI_FORMAT_R16G16_FLOAT;
- case dawn::VertexFormat::Half4:
+ case wgpu::VertexFormat::Half4:
return DXGI_FORMAT_R16G16B16A16_FLOAT;
- case dawn::VertexFormat::Float:
+ case wgpu::VertexFormat::Float:
return DXGI_FORMAT_R32_FLOAT;
- case dawn::VertexFormat::Float2:
+ case wgpu::VertexFormat::Float2:
return DXGI_FORMAT_R32G32_FLOAT;
- case dawn::VertexFormat::Float3:
+ case wgpu::VertexFormat::Float3:
return DXGI_FORMAT_R32G32B32_FLOAT;
- case dawn::VertexFormat::Float4:
+ case wgpu::VertexFormat::Float4:
return DXGI_FORMAT_R32G32B32A32_FLOAT;
- case dawn::VertexFormat::UInt:
+ case wgpu::VertexFormat::UInt:
return DXGI_FORMAT_R32_UINT;
- case dawn::VertexFormat::UInt2:
+ case wgpu::VertexFormat::UInt2:
return DXGI_FORMAT_R32G32_UINT;
- case dawn::VertexFormat::UInt3:
+ case wgpu::VertexFormat::UInt3:
return DXGI_FORMAT_R32G32B32_UINT;
- case dawn::VertexFormat::UInt4:
+ case wgpu::VertexFormat::UInt4:
return DXGI_FORMAT_R32G32B32A32_UINT;
- case dawn::VertexFormat::Int:
+ case wgpu::VertexFormat::Int:
return DXGI_FORMAT_R32_SINT;
- case dawn::VertexFormat::Int2:
+ case wgpu::VertexFormat::Int2:
return DXGI_FORMAT_R32G32_SINT;
- case dawn::VertexFormat::Int3:
+ case wgpu::VertexFormat::Int3:
return DXGI_FORMAT_R32G32B32_SINT;
- case dawn::VertexFormat::Int4:
+ case wgpu::VertexFormat::Int4:
return DXGI_FORMAT_R32G32B32A32_SINT;
default:
UNREACHABLE();
}
}
- D3D12_INPUT_CLASSIFICATION InputStepModeFunction(dawn::InputStepMode mode) {
+ D3D12_INPUT_CLASSIFICATION InputStepModeFunction(wgpu::InputStepMode mode) {
switch (mode) {
- case dawn::InputStepMode::Vertex:
+ case wgpu::InputStepMode::Vertex:
return D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA;
- case dawn::InputStepMode::Instance:
+ case wgpu::InputStepMode::Instance:
return D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA;
default:
UNREACHABLE();
}
}
- D3D12_PRIMITIVE_TOPOLOGY D3D12PrimitiveTopology(dawn::PrimitiveTopology primitiveTopology) {
+ D3D12_PRIMITIVE_TOPOLOGY D3D12PrimitiveTopology(wgpu::PrimitiveTopology primitiveTopology) {
switch (primitiveTopology) {
- case dawn::PrimitiveTopology::PointList:
+ case wgpu::PrimitiveTopology::PointList:
return D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
- case dawn::PrimitiveTopology::LineList:
+ case wgpu::PrimitiveTopology::LineList:
return D3D_PRIMITIVE_TOPOLOGY_LINELIST;
- case dawn::PrimitiveTopology::LineStrip:
+ case wgpu::PrimitiveTopology::LineStrip:
return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
- case dawn::PrimitiveTopology::TriangleList:
+ case wgpu::PrimitiveTopology::TriangleList:
return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
- case dawn::PrimitiveTopology::TriangleStrip:
+ case wgpu::PrimitiveTopology::TriangleStrip:
return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
default:
UNREACHABLE();
@@ -124,95 +124,95 @@
}
D3D12_PRIMITIVE_TOPOLOGY_TYPE D3D12PrimitiveTopologyType(
- dawn::PrimitiveTopology primitiveTopology) {
+ wgpu::PrimitiveTopology primitiveTopology) {
switch (primitiveTopology) {
- case dawn::PrimitiveTopology::PointList:
+ case wgpu::PrimitiveTopology::PointList:
return D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT;
- case dawn::PrimitiveTopology::LineList:
- case dawn::PrimitiveTopology::LineStrip:
+ case wgpu::PrimitiveTopology::LineList:
+ case wgpu::PrimitiveTopology::LineStrip:
return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
- case dawn::PrimitiveTopology::TriangleList:
- case dawn::PrimitiveTopology::TriangleStrip:
+ case wgpu::PrimitiveTopology::TriangleList:
+ case wgpu::PrimitiveTopology::TriangleStrip:
return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
default:
UNREACHABLE();
}
}
- D3D12_CULL_MODE D3D12CullMode(dawn::CullMode mode) {
+ D3D12_CULL_MODE D3D12CullMode(wgpu::CullMode mode) {
switch (mode) {
- case dawn::CullMode::None:
+ case wgpu::CullMode::None:
return D3D12_CULL_MODE_NONE;
- case dawn::CullMode::Front:
+ case wgpu::CullMode::Front:
return D3D12_CULL_MODE_FRONT;
- case dawn::CullMode::Back:
+ case wgpu::CullMode::Back:
return D3D12_CULL_MODE_BACK;
default:
UNREACHABLE();
}
}
- D3D12_BLEND D3D12Blend(dawn::BlendFactor factor) {
+ D3D12_BLEND D3D12Blend(wgpu::BlendFactor factor) {
switch (factor) {
- case dawn::BlendFactor::Zero:
+ case wgpu::BlendFactor::Zero:
return D3D12_BLEND_ZERO;
- case dawn::BlendFactor::One:
+ case wgpu::BlendFactor::One:
return D3D12_BLEND_ONE;
- case dawn::BlendFactor::SrcColor:
+ case wgpu::BlendFactor::SrcColor:
return D3D12_BLEND_SRC_COLOR;
- case dawn::BlendFactor::OneMinusSrcColor:
+ case wgpu::BlendFactor::OneMinusSrcColor:
return D3D12_BLEND_INV_SRC_COLOR;
- case dawn::BlendFactor::SrcAlpha:
+ case wgpu::BlendFactor::SrcAlpha:
return D3D12_BLEND_SRC_ALPHA;
- case dawn::BlendFactor::OneMinusSrcAlpha:
+ case wgpu::BlendFactor::OneMinusSrcAlpha:
return D3D12_BLEND_INV_SRC_ALPHA;
- case dawn::BlendFactor::DstColor:
+ case wgpu::BlendFactor::DstColor:
return D3D12_BLEND_DEST_COLOR;
- case dawn::BlendFactor::OneMinusDstColor:
+ case wgpu::BlendFactor::OneMinusDstColor:
return D3D12_BLEND_INV_DEST_COLOR;
- case dawn::BlendFactor::DstAlpha:
+ case wgpu::BlendFactor::DstAlpha:
return D3D12_BLEND_DEST_ALPHA;
- case dawn::BlendFactor::OneMinusDstAlpha:
+ case wgpu::BlendFactor::OneMinusDstAlpha:
return D3D12_BLEND_INV_DEST_ALPHA;
- case dawn::BlendFactor::SrcAlphaSaturated:
+ case wgpu::BlendFactor::SrcAlphaSaturated:
return D3D12_BLEND_SRC_ALPHA_SAT;
- case dawn::BlendFactor::BlendColor:
+ case wgpu::BlendFactor::BlendColor:
return D3D12_BLEND_BLEND_FACTOR;
- case dawn::BlendFactor::OneMinusBlendColor:
+ case wgpu::BlendFactor::OneMinusBlendColor:
return D3D12_BLEND_INV_BLEND_FACTOR;
default:
UNREACHABLE();
}
}
- D3D12_BLEND_OP D3D12BlendOperation(dawn::BlendOperation operation) {
+ D3D12_BLEND_OP D3D12BlendOperation(wgpu::BlendOperation operation) {
switch (operation) {
- case dawn::BlendOperation::Add:
+ case wgpu::BlendOperation::Add:
return D3D12_BLEND_OP_ADD;
- case dawn::BlendOperation::Subtract:
+ case wgpu::BlendOperation::Subtract:
return D3D12_BLEND_OP_SUBTRACT;
- case dawn::BlendOperation::ReverseSubtract:
+ case wgpu::BlendOperation::ReverseSubtract:
return D3D12_BLEND_OP_REV_SUBTRACT;
- case dawn::BlendOperation::Min:
+ case wgpu::BlendOperation::Min:
return D3D12_BLEND_OP_MIN;
- case dawn::BlendOperation::Max:
+ case wgpu::BlendOperation::Max:
return D3D12_BLEND_OP_MAX;
default:
UNREACHABLE();
}
}
- uint8_t D3D12RenderTargetWriteMask(dawn::ColorWriteMask writeMask) {
- static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Red) ==
+ uint8_t D3D12RenderTargetWriteMask(wgpu::ColorWriteMask writeMask) {
+ static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(wgpu::ColorWriteMask::Red) ==
D3D12_COLOR_WRITE_ENABLE_RED,
"ColorWriteMask values must match");
- static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Green) ==
+ static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(wgpu::ColorWriteMask::Green) ==
D3D12_COLOR_WRITE_ENABLE_GREEN,
"ColorWriteMask values must match");
- static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Blue) ==
+ static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(wgpu::ColorWriteMask::Blue) ==
D3D12_COLOR_WRITE_ENABLE_BLUE,
"ColorWriteMask values must match");
- static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Alpha) ==
+ static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(wgpu::ColorWriteMask::Alpha) ==
D3D12_COLOR_WRITE_ENABLE_ALPHA,
"ColorWriteMask values must match");
return static_cast<uint8_t>(writeMask);
@@ -233,23 +233,23 @@
return blendDesc;
}
- D3D12_STENCIL_OP StencilOp(dawn::StencilOperation op) {
+ D3D12_STENCIL_OP StencilOp(wgpu::StencilOperation op) {
switch (op) {
- case dawn::StencilOperation::Keep:
+ case wgpu::StencilOperation::Keep:
return D3D12_STENCIL_OP_KEEP;
- case dawn::StencilOperation::Zero:
+ case wgpu::StencilOperation::Zero:
return D3D12_STENCIL_OP_ZERO;
- case dawn::StencilOperation::Replace:
+ case wgpu::StencilOperation::Replace:
return D3D12_STENCIL_OP_REPLACE;
- case dawn::StencilOperation::IncrementClamp:
+ case wgpu::StencilOperation::IncrementClamp:
return D3D12_STENCIL_OP_INCR_SAT;
- case dawn::StencilOperation::DecrementClamp:
+ case wgpu::StencilOperation::DecrementClamp:
return D3D12_STENCIL_OP_DECR_SAT;
- case dawn::StencilOperation::Invert:
+ case wgpu::StencilOperation::Invert:
return D3D12_STENCIL_OP_INVERT;
- case dawn::StencilOperation::IncrementWrap:
+ case wgpu::StencilOperation::IncrementWrap:
return D3D12_STENCIL_OP_INCR;
- case dawn::StencilOperation::DecrementWrap:
+ case wgpu::StencilOperation::DecrementWrap:
return D3D12_STENCIL_OP_DECR;
default:
UNREACHABLE();
@@ -313,7 +313,7 @@
PerStage<ComPtr<ID3DBlob>> compiledShader;
ComPtr<ID3DBlob> errors;
- dawn::ShaderStage renderStages = dawn::ShaderStage::Vertex | dawn::ShaderStage::Fragment;
+ wgpu::ShaderStage renderStages = wgpu::ShaderStage::Vertex | wgpu::ShaderStage::Fragment;
for (auto stage : IterateStages(renderStages)) {
const ShaderModule* module = nullptr;
const char* entryPoint = nullptr;
@@ -366,7 +366,7 @@
descriptorD3D12.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
descriptorD3D12.RasterizerState.CullMode = D3D12CullMode(GetCullMode());
descriptorD3D12.RasterizerState.FrontCounterClockwise =
- (GetFrontFace() == dawn::FrontFace::CCW) ? TRUE : FALSE;
+ (GetFrontFace() == wgpu::FrontFace::CCW) ? TRUE : FALSE;
descriptorD3D12.RasterizerState.DepthBias = D3D12_DEFAULT_DEPTH_BIAS;
descriptorD3D12.RasterizerState.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP;
descriptorD3D12.RasterizerState.SlopeScaledDepthBias =
diff --git a/src/dawn_native/d3d12/SamplerD3D12.cpp b/src/dawn_native/d3d12/SamplerD3D12.cpp
index a2d5b5f..ecea147 100644
--- a/src/dawn_native/d3d12/SamplerD3D12.cpp
+++ b/src/dawn_native/d3d12/SamplerD3D12.cpp
@@ -20,13 +20,13 @@
namespace dawn_native { namespace d3d12 {
namespace {
- D3D12_TEXTURE_ADDRESS_MODE AddressMode(dawn::AddressMode mode) {
+ D3D12_TEXTURE_ADDRESS_MODE AddressMode(wgpu::AddressMode mode) {
switch (mode) {
- case dawn::AddressMode::Repeat:
+ case wgpu::AddressMode::Repeat:
return D3D12_TEXTURE_ADDRESS_MODE_WRAP;
- case dawn::AddressMode::MirrorRepeat:
+ case wgpu::AddressMode::MirrorRepeat:
return D3D12_TEXTURE_ADDRESS_MODE_MIRROR;
- case dawn::AddressMode::ClampToEdge:
+ case wgpu::AddressMode::ClampToEdge:
return D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
default:
UNREACHABLE();
@@ -54,25 +54,25 @@
uint8_t mode = 0;
switch (descriptor->minFilter) {
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
break;
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
mode += 16;
break;
}
switch (descriptor->magFilter) {
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
break;
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
mode += 4;
break;
}
switch (descriptor->mipmapFilter) {
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
break;
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
mode += 1;
break;
}
diff --git a/src/dawn_native/d3d12/SwapChainD3D12.cpp b/src/dawn_native/d3d12/SwapChainD3D12.cpp
index ba38fb4..29acf57 100644
--- a/src/dawn_native/d3d12/SwapChainD3D12.cpp
+++ b/src/dawn_native/d3d12/SwapChainD3D12.cpp
@@ -29,7 +29,7 @@
im.Init(im.userData, &wsiContext);
ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_NONE);
- mTextureUsage = static_cast<dawn::TextureUsage>(im.textureUsage);
+ mTextureUsage = static_cast<wgpu::TextureUsage>(im.textureUsage);
}
SwapChain::~SwapChain() {
@@ -40,7 +40,7 @@
DawnSwapChainNextTexture next = {};
DawnSwapChainError error = im.GetNextTexture(im.userData, &next);
if (error) {
- GetDevice()->HandleError(dawn::ErrorType::Unknown, error);
+ GetDevice()->HandleError(wgpu::ErrorType::Unknown, error);
return nullptr;
}
diff --git a/src/dawn_native/d3d12/SwapChainD3D12.h b/src/dawn_native/d3d12/SwapChainD3D12.h
index 151994c..4b83ce4 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;
MaybeError OnBeforePresent(TextureBase* texture) override;
- dawn::TextureUsage mTextureUsage;
+ wgpu::TextureUsage mTextureUsage;
};
}} // namespace dawn_native::d3d12
diff --git a/src/dawn_native/d3d12/TextureD3D12.cpp b/src/dawn_native/d3d12/TextureD3D12.cpp
index 9caf2f3..f37dc76 100644
--- a/src/dawn_native/d3d12/TextureD3D12.cpp
+++ b/src/dawn_native/d3d12/TextureD3D12.cpp
@@ -30,28 +30,28 @@
namespace dawn_native { namespace d3d12 {
namespace {
- D3D12_RESOURCE_STATES D3D12TextureUsage(dawn::TextureUsage usage, const Format& format) {
+ D3D12_RESOURCE_STATES D3D12TextureUsage(wgpu::TextureUsage usage, const Format& format) {
D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON;
// Present is an exclusive flag.
- if (usage & dawn::TextureUsage::Present) {
+ if (usage & wgpu::TextureUsage::Present) {
return D3D12_RESOURCE_STATE_PRESENT;
}
- if (usage & dawn::TextureUsage::CopySrc) {
+ if (usage & wgpu::TextureUsage::CopySrc) {
resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE;
}
- if (usage & dawn::TextureUsage::CopyDst) {
+ if (usage & wgpu::TextureUsage::CopyDst) {
resourceState |= D3D12_RESOURCE_STATE_COPY_DEST;
}
- if (usage & dawn::TextureUsage::Sampled) {
+ if (usage & wgpu::TextureUsage::Sampled) {
resourceState |= (D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE |
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
}
- if (usage & dawn::TextureUsage::Storage) {
+ if (usage & wgpu::TextureUsage::Storage) {
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
}
- if (usage & dawn::TextureUsage::OutputAttachment) {
+ if (usage & wgpu::TextureUsage::OutputAttachment) {
if (format.HasDepthOrStencil()) {
resourceState |= D3D12_RESOURCE_STATE_DEPTH_WRITE;
} else {
@@ -62,12 +62,12 @@
return resourceState;
}
- D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::TextureUsage usage,
+ D3D12_RESOURCE_FLAGS D3D12ResourceFlags(wgpu::TextureUsage usage,
const Format& format,
bool isMultisampledTexture) {
D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE;
- if (usage & dawn::TextureUsage::Storage) {
+ if (usage & wgpu::TextureUsage::Storage) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
}
@@ -79,7 +79,7 @@
// flag is invalid.
// TODO(natlee@microsoft.com, jiawei.shao@intel.com): do not require render target for
// lazy clearing.
- if ((usage & dawn::TextureUsage::OutputAttachment) || isMultisampledTexture ||
+ if ((usage & wgpu::TextureUsage::OutputAttachment) || isMultisampledTexture ||
!format.isCompressed) {
if (format.HasDepthOrStencil()) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
@@ -93,9 +93,9 @@
return flags;
}
- D3D12_RESOURCE_DIMENSION D3D12TextureDimension(dawn::TextureDimension dimension) {
+ D3D12_RESOURCE_DIMENSION D3D12TextureDimension(wgpu::TextureDimension dimension) {
switch (dimension) {
- case dawn::TextureDimension::e2D:
+ case wgpu::TextureDimension::e2D:
return D3D12_RESOURCE_DIMENSION_TEXTURE2D;
default:
UNREACHABLE();
@@ -103,117 +103,117 @@
}
} // namespace
- DXGI_FORMAT D3D12TextureFormat(dawn::TextureFormat format) {
+ DXGI_FORMAT D3D12TextureFormat(wgpu::TextureFormat format) {
switch (format) {
- case dawn::TextureFormat::R8Unorm:
+ case wgpu::TextureFormat::R8Unorm:
return DXGI_FORMAT_R8_UNORM;
- case dawn::TextureFormat::R8Snorm:
+ case wgpu::TextureFormat::R8Snorm:
return DXGI_FORMAT_R8_SNORM;
- case dawn::TextureFormat::R8Uint:
+ case wgpu::TextureFormat::R8Uint:
return DXGI_FORMAT_R8_UINT;
- case dawn::TextureFormat::R8Sint:
+ case wgpu::TextureFormat::R8Sint:
return DXGI_FORMAT_R8_SINT;
- case dawn::TextureFormat::R16Uint:
+ case wgpu::TextureFormat::R16Uint:
return DXGI_FORMAT_R16_UINT;
- case dawn::TextureFormat::R16Sint:
+ case wgpu::TextureFormat::R16Sint:
return DXGI_FORMAT_R16_SINT;
- case dawn::TextureFormat::R16Float:
+ case wgpu::TextureFormat::R16Float:
return DXGI_FORMAT_R16_FLOAT;
- case dawn::TextureFormat::RG8Unorm:
+ case wgpu::TextureFormat::RG8Unorm:
return DXGI_FORMAT_R8G8_UNORM;
- case dawn::TextureFormat::RG8Snorm:
+ case wgpu::TextureFormat::RG8Snorm:
return DXGI_FORMAT_R8G8_SNORM;
- case dawn::TextureFormat::RG8Uint:
+ case wgpu::TextureFormat::RG8Uint:
return DXGI_FORMAT_R8G8_UINT;
- case dawn::TextureFormat::RG8Sint:
+ case wgpu::TextureFormat::RG8Sint:
return DXGI_FORMAT_R8G8_SINT;
- case dawn::TextureFormat::R32Uint:
+ case wgpu::TextureFormat::R32Uint:
return DXGI_FORMAT_R32_UINT;
- case dawn::TextureFormat::R32Sint:
+ case wgpu::TextureFormat::R32Sint:
return DXGI_FORMAT_R32_SINT;
- case dawn::TextureFormat::R32Float:
+ case wgpu::TextureFormat::R32Float:
return DXGI_FORMAT_R32_FLOAT;
- case dawn::TextureFormat::RG16Uint:
+ case wgpu::TextureFormat::RG16Uint:
return DXGI_FORMAT_R16G16_UINT;
- case dawn::TextureFormat::RG16Sint:
+ case wgpu::TextureFormat::RG16Sint:
return DXGI_FORMAT_R16G16_SINT;
- case dawn::TextureFormat::RG16Float:
+ case wgpu::TextureFormat::RG16Float:
return DXGI_FORMAT_R16G16_FLOAT;
- case dawn::TextureFormat::RGBA8Unorm:
+ case wgpu::TextureFormat::RGBA8Unorm:
return DXGI_FORMAT_R8G8B8A8_UNORM;
- case dawn::TextureFormat::RGBA8UnormSrgb:
+ case wgpu::TextureFormat::RGBA8UnormSrgb:
return DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
- case dawn::TextureFormat::RGBA8Snorm:
+ case wgpu::TextureFormat::RGBA8Snorm:
return DXGI_FORMAT_R8G8B8A8_SNORM;
- case dawn::TextureFormat::RGBA8Uint:
+ case wgpu::TextureFormat::RGBA8Uint:
return DXGI_FORMAT_R8G8B8A8_UINT;
- case dawn::TextureFormat::RGBA8Sint:
+ case wgpu::TextureFormat::RGBA8Sint:
return DXGI_FORMAT_R8G8B8A8_SINT;
- case dawn::TextureFormat::BGRA8Unorm:
+ case wgpu::TextureFormat::BGRA8Unorm:
return DXGI_FORMAT_B8G8R8A8_UNORM;
- case dawn::TextureFormat::BGRA8UnormSrgb:
+ case wgpu::TextureFormat::BGRA8UnormSrgb:
return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
- case dawn::TextureFormat::RGB10A2Unorm:
+ case wgpu::TextureFormat::RGB10A2Unorm:
return DXGI_FORMAT_R10G10B10A2_UNORM;
- case dawn::TextureFormat::RG11B10Float:
+ case wgpu::TextureFormat::RG11B10Float:
return DXGI_FORMAT_R11G11B10_FLOAT;
- case dawn::TextureFormat::RG32Uint:
+ case wgpu::TextureFormat::RG32Uint:
return DXGI_FORMAT_R32G32_UINT;
- case dawn::TextureFormat::RG32Sint:
+ case wgpu::TextureFormat::RG32Sint:
return DXGI_FORMAT_R32G32_SINT;
- case dawn::TextureFormat::RG32Float:
+ case wgpu::TextureFormat::RG32Float:
return DXGI_FORMAT_R32G32_FLOAT;
- case dawn::TextureFormat::RGBA16Uint:
+ case wgpu::TextureFormat::RGBA16Uint:
return DXGI_FORMAT_R16G16B16A16_UINT;
- case dawn::TextureFormat::RGBA16Sint:
+ case wgpu::TextureFormat::RGBA16Sint:
return DXGI_FORMAT_R16G16B16A16_SINT;
- case dawn::TextureFormat::RGBA16Float:
+ case wgpu::TextureFormat::RGBA16Float:
return DXGI_FORMAT_R16G16B16A16_FLOAT;
- case dawn::TextureFormat::RGBA32Uint:
+ case wgpu::TextureFormat::RGBA32Uint:
return DXGI_FORMAT_R32G32B32A32_UINT;
- case dawn::TextureFormat::RGBA32Sint:
+ case wgpu::TextureFormat::RGBA32Sint:
return DXGI_FORMAT_R32G32B32A32_SINT;
- case dawn::TextureFormat::RGBA32Float:
+ case wgpu::TextureFormat::RGBA32Float:
return DXGI_FORMAT_R32G32B32A32_FLOAT;
- case dawn::TextureFormat::Depth32Float:
+ case wgpu::TextureFormat::Depth32Float:
return DXGI_FORMAT_D32_FLOAT;
- case dawn::TextureFormat::Depth24Plus:
+ case wgpu::TextureFormat::Depth24Plus:
return DXGI_FORMAT_D32_FLOAT;
- case dawn::TextureFormat::Depth24PlusStencil8:
+ case wgpu::TextureFormat::Depth24PlusStencil8:
return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
- case dawn::TextureFormat::BC1RGBAUnorm:
+ case wgpu::TextureFormat::BC1RGBAUnorm:
return DXGI_FORMAT_BC1_UNORM;
- case dawn::TextureFormat::BC1RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC1RGBAUnormSrgb:
return DXGI_FORMAT_BC1_UNORM_SRGB;
- case dawn::TextureFormat::BC2RGBAUnorm:
+ case wgpu::TextureFormat::BC2RGBAUnorm:
return DXGI_FORMAT_BC2_UNORM;
- case dawn::TextureFormat::BC2RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC2RGBAUnormSrgb:
return DXGI_FORMAT_BC2_UNORM_SRGB;
- case dawn::TextureFormat::BC3RGBAUnorm:
+ case wgpu::TextureFormat::BC3RGBAUnorm:
return DXGI_FORMAT_BC3_UNORM;
- case dawn::TextureFormat::BC3RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC3RGBAUnormSrgb:
return DXGI_FORMAT_BC3_UNORM_SRGB;
- case dawn::TextureFormat::BC4RSnorm:
+ case wgpu::TextureFormat::BC4RSnorm:
return DXGI_FORMAT_BC4_SNORM;
- case dawn::TextureFormat::BC4RUnorm:
+ case wgpu::TextureFormat::BC4RUnorm:
return DXGI_FORMAT_BC4_UNORM;
- case dawn::TextureFormat::BC5RGSnorm:
+ case wgpu::TextureFormat::BC5RGSnorm:
return DXGI_FORMAT_BC5_SNORM;
- case dawn::TextureFormat::BC5RGUnorm:
+ case wgpu::TextureFormat::BC5RGUnorm:
return DXGI_FORMAT_BC5_UNORM;
- case dawn::TextureFormat::BC6HRGBSfloat:
+ case wgpu::TextureFormat::BC6HRGBSfloat:
return DXGI_FORMAT_BC6H_SF16;
- case dawn::TextureFormat::BC6HRGBUfloat:
+ case wgpu::TextureFormat::BC6HRGBUfloat:
return DXGI_FORMAT_BC6H_UF16;
- case dawn::TextureFormat::BC7RGBAUnorm:
+ case wgpu::TextureFormat::BC7RGBAUnorm:
return DXGI_FORMAT_BC7_UNORM;
- case dawn::TextureFormat::BC7RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC7RGBAUnormSrgb:
return DXGI_FORMAT_BC7_UNORM_SRGB;
default:
@@ -222,7 +222,7 @@
}
MaybeError ValidateTextureDescriptorCanBeWrapped(const TextureDescriptor* descriptor) {
- if (descriptor->dimension != dawn::TextureDimension::e2D) {
+ if (descriptor->dimension != wgpu::TextureDimension::e2D) {
return DAWN_VALIDATION_ERROR("Texture must be 2D");
}
@@ -397,7 +397,7 @@
UINT16 Texture::GetDepthOrArraySize() {
switch (GetDimension()) {
- case dawn::TextureDimension::e2D:
+ case wgpu::TextureDimension::e2D:
return static_cast<UINT16>(GetArrayLayers());
default:
UNREACHABLE();
@@ -409,7 +409,7 @@
// cause subsequent errors.
bool Texture::TransitionUsageAndGetResourceBarrier(CommandRecordingContext* commandContext,
D3D12_RESOURCE_BARRIER* barrier,
- dawn::TextureUsage newUsage) {
+ wgpu::TextureUsage newUsage) {
return TransitionUsageAndGetResourceBarrier(commandContext, barrier,
D3D12TextureUsage(newUsage, GetFormat()));
}
@@ -493,7 +493,7 @@
}
void Texture::TransitionUsageNow(CommandRecordingContext* commandContext,
- dawn::TextureUsage usage) {
+ wgpu::TextureUsage usage) {
TransitionUsageNow(commandContext, D3D12TextureUsage(usage, GetFormat()));
}
@@ -509,7 +509,7 @@
D3D12_RENDER_TARGET_VIEW_DESC Texture::GetRTVDescriptor(uint32_t baseMipLevel,
uint32_t baseArrayLayer,
uint32_t layerCount) const {
- ASSERT(GetDimension() == dawn::TextureDimension::e2D);
+ ASSERT(GetDimension() == wgpu::TextureDimension::e2D);
D3D12_RENDER_TARGET_VIEW_DESC rtvDesc;
rtvDesc.Format = GetD3D12Format();
if (IsMultisampledTexture()) {
@@ -696,9 +696,9 @@
// TODO(jiawei.shao@intel.com): support more texture view dimensions.
// TODO(jiawei.shao@intel.com): support creating SRV on multisampled textures.
switch (descriptor->dimension) {
- case dawn::TextureViewDimension::e2D:
- case dawn::TextureViewDimension::e2DArray:
- ASSERT(texture->GetDimension() == dawn::TextureDimension::e2D);
+ case wgpu::TextureViewDimension::e2D:
+ case wgpu::TextureViewDimension::e2DArray:
+ ASSERT(texture->GetDimension() == wgpu::TextureDimension::e2D);
mSrvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY;
mSrvDesc.Texture2DArray.ArraySize = descriptor->arrayLayerCount;
mSrvDesc.Texture2DArray.FirstArraySlice = descriptor->baseArrayLayer;
@@ -707,9 +707,9 @@
mSrvDesc.Texture2DArray.PlaneSlice = 0;
mSrvDesc.Texture2DArray.ResourceMinLODClamp = 0;
break;
- case dawn::TextureViewDimension::Cube:
- case dawn::TextureViewDimension::CubeArray:
- ASSERT(texture->GetDimension() == dawn::TextureDimension::e2D);
+ case wgpu::TextureViewDimension::Cube:
+ case wgpu::TextureViewDimension::CubeArray:
+ ASSERT(texture->GetDimension() == wgpu::TextureDimension::e2D);
ASSERT(descriptor->arrayLayerCount % 6 == 0);
mSrvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURECUBEARRAY;
mSrvDesc.TextureCubeArray.First2DArrayFace = descriptor->baseArrayLayer;
diff --git a/src/dawn_native/d3d12/TextureD3D12.h b/src/dawn_native/d3d12/TextureD3D12.h
index 1e10df9..332ab5a 100644
--- a/src/dawn_native/d3d12/TextureD3D12.h
+++ b/src/dawn_native/d3d12/TextureD3D12.h
@@ -26,7 +26,7 @@
class CommandRecordingContext;
class Device;
- DXGI_FORMAT D3D12TextureFormat(dawn::TextureFormat format);
+ DXGI_FORMAT D3D12TextureFormat(wgpu::TextureFormat format);
MaybeError ValidateD3D12TextureCanBeWrapped(ID3D12Resource* d3d12Resource,
const TextureDescriptor* descriptor);
MaybeError ValidateTextureDescriptorCanBeWrapped(const TextureDescriptor* descriptor);
@@ -49,8 +49,8 @@
ID3D12Resource* GetD3D12Resource() const;
bool TransitionUsageAndGetResourceBarrier(CommandRecordingContext* commandContext,
D3D12_RESOURCE_BARRIER* barrier,
- dawn::TextureUsage newUsage);
- void TransitionUsageNow(CommandRecordingContext* commandContext, dawn::TextureUsage usage);
+ wgpu::TextureUsage newUsage);
+ void TransitionUsageNow(CommandRecordingContext* commandContext, wgpu::TextureUsage usage);
void TransitionUsageNow(CommandRecordingContext* commandContext,
D3D12_RESOURCE_STATES newState);
diff --git a/src/dawn_native/d3d12/UtilsD3D12.cpp b/src/dawn_native/d3d12/UtilsD3D12.cpp
index 5db5890..a8acec9 100644
--- a/src/dawn_native/d3d12/UtilsD3D12.cpp
+++ b/src/dawn_native/d3d12/UtilsD3D12.cpp
@@ -18,23 +18,23 @@
namespace dawn_native { namespace d3d12 {
- D3D12_COMPARISON_FUNC ToD3D12ComparisonFunc(dawn::CompareFunction func) {
+ D3D12_COMPARISON_FUNC ToD3D12ComparisonFunc(wgpu::CompareFunction func) {
switch (func) {
- case dawn::CompareFunction::Always:
+ case wgpu::CompareFunction::Always:
return D3D12_COMPARISON_FUNC_ALWAYS;
- case dawn::CompareFunction::Equal:
+ case wgpu::CompareFunction::Equal:
return D3D12_COMPARISON_FUNC_EQUAL;
- case dawn::CompareFunction::Greater:
+ case wgpu::CompareFunction::Greater:
return D3D12_COMPARISON_FUNC_GREATER;
- case dawn::CompareFunction::GreaterEqual:
+ case wgpu::CompareFunction::GreaterEqual:
return D3D12_COMPARISON_FUNC_GREATER_EQUAL;
- case dawn::CompareFunction::Less:
+ case wgpu::CompareFunction::Less:
return D3D12_COMPARISON_FUNC_LESS;
- case dawn::CompareFunction::LessEqual:
+ case wgpu::CompareFunction::LessEqual:
return D3D12_COMPARISON_FUNC_LESS_EQUAL;
- case dawn::CompareFunction::Never:
+ case wgpu::CompareFunction::Never:
return D3D12_COMPARISON_FUNC_NEVER;
- case dawn::CompareFunction::NotEqual:
+ case wgpu::CompareFunction::NotEqual:
return D3D12_COMPARISON_FUNC_NOT_EQUAL;
default:
UNREACHABLE();
diff --git a/src/dawn_native/d3d12/UtilsD3D12.h b/src/dawn_native/d3d12/UtilsD3D12.h
index 2566a42..36a5abe 100644
--- a/src/dawn_native/d3d12/UtilsD3D12.h
+++ b/src/dawn_native/d3d12/UtilsD3D12.h
@@ -23,7 +23,7 @@
namespace dawn_native { namespace d3d12 {
- D3D12_COMPARISON_FUNC ToD3D12ComparisonFunc(dawn::CompareFunction func);
+ D3D12_COMPARISON_FUNC ToD3D12ComparisonFunc(wgpu::CompareFunction func);
D3D12_TEXTURE_COPY_LOCATION ComputeTextureCopyLocationForTexture(const Texture* texture,
uint32_t level,
diff --git a/src/dawn_native/dawn_platform.h b/src/dawn_native/dawn_platform.h
index 795c371..52ca916 100644
--- a/src/dawn_native/dawn_platform.h
+++ b/src/dawn_native/dawn_platform.h
@@ -15,11 +15,11 @@
#ifndef DAWNNATIVE_DAWNPLATFORM_H_
#define DAWNNATIVE_DAWNPLATFORM_H_
-// Use dawncpp to have the enum and bitfield definitions
-#include <dawn/dawncpp.h>
+// Use webgpu_cpp to have the enum and bitfield definitions
+#include <dawn/webgpu_cpp.h>
-// Use our autogenerated version of the dawn structures that point to dawn_native object types
-// (dawn::Buffer is dawn_native::BufferBase*)
-#include <dawn_native/dawn_structs_autogen.h>
+// Use our autogenerated version of the wgpu structures that point to dawn_native object types
+// (wgpu::Buffer is dawn_native::BufferBase*)
+#include <dawn_native/wgpu_structs_autogen.h>
#endif // DAWNNATIVE_DAWNPLATFORM_H_
diff --git a/src/dawn_native/metal/BufferMTL.mm b/src/dawn_native/metal/BufferMTL.mm
index 076e2b8..a3c2f4c 100644
--- a/src/dawn_native/metal/BufferMTL.mm
+++ b/src/dawn_native/metal/BufferMTL.mm
@@ -25,7 +25,7 @@
Buffer::Buffer(Device* device, const BufferDescriptor* descriptor)
: BufferBase(device, descriptor) {
MTLResourceOptions storageMode;
- if (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) {
+ if (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) {
storageMode = MTLResourceStorageModeShared;
} else {
storageMode = MTLResourceStorageModePrivate;
@@ -35,7 +35,7 @@
// Metal validation layer requires the size of uniform buffer and storage buffer to be no
// less than the size of the buffer block defined in shader, and the overall size of the
// buffer must be aligned to the largest alignment of its members.
- if (GetUsage() & (dawn::BufferUsage::Uniform | dawn::BufferUsage::Storage)) {
+ if (GetUsage() & (wgpu::BufferUsage::Uniform | wgpu::BufferUsage::Storage)) {
currentSize = Align(currentSize, kMinUniformOrStorageBufferAlignment);
}
@@ -61,7 +61,7 @@
bool Buffer::IsMapWritable() const {
// TODO(enga): Handle CPU-visible memory on UMA
- return (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
+ return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
}
MaybeError Buffer::MapAtCreationImpl(uint8_t** mappedPointer) {
diff --git a/src/dawn_native/metal/CommandBufferMTL.mm b/src/dawn_native/metal/CommandBufferMTL.mm
index fe46ae6..db3b416 100644
--- a/src/dawn_native/metal/CommandBufferMTL.mm
+++ b/src/dawn_native/metal/CommandBufferMTL.mm
@@ -56,7 +56,7 @@
IterateBitSet(renderPass->attachmentState->GetColorAttachmentsMask())) {
auto& attachmentInfo = renderPass->colorAttachments[i];
- if (attachmentInfo.loadOp == dawn::LoadOp::Clear) {
+ if (attachmentInfo.loadOp == wgpu::LoadOp::Clear) {
descriptor.colorAttachments[i].loadAction = MTLLoadActionClear;
descriptor.colorAttachments[i].clearColor =
MTLClearColorMake(attachmentInfo.clearColor.r, attachmentInfo.clearColor.g,
@@ -70,7 +70,7 @@
descriptor.colorAttachments[i].level = attachmentInfo.view->GetBaseMipLevel();
descriptor.colorAttachments[i].slice = attachmentInfo.view->GetBaseArrayLayer();
- if (attachmentInfo.storeOp == dawn::StoreOp::Store) {
+ if (attachmentInfo.storeOp == wgpu::StoreOp::Store) {
if (attachmentInfo.resolveTarget.Get() != nullptr) {
descriptor.colorAttachments[i].resolveTexture =
ToBackend(attachmentInfo.resolveTarget->GetTexture())->GetMTLTexture();
@@ -98,7 +98,7 @@
descriptor.depthAttachment.texture = texture;
descriptor.depthAttachment.storeAction = MTLStoreActionStore;
- if (attachmentInfo.depthLoadOp == dawn::LoadOp::Clear) {
+ if (attachmentInfo.depthLoadOp == wgpu::LoadOp::Clear) {
descriptor.depthAttachment.loadAction = MTLLoadActionClear;
descriptor.depthAttachment.clearDepth = attachmentInfo.clearDepth;
} else {
@@ -110,7 +110,7 @@
descriptor.stencilAttachment.texture = texture;
descriptor.stencilAttachment.storeAction = MTLStoreActionStore;
- if (attachmentInfo.stencilLoadOp == dawn::LoadOp::Clear) {
+ if (attachmentInfo.stencilLoadOp == wgpu::LoadOp::Clear) {
descriptor.stencilAttachment.loadAction = MTLLoadActionClear;
descriptor.stencilAttachment.clearStencil = attachmentInfo.clearStencil;
} else {
@@ -201,21 +201,21 @@
// length of storage buffers and can apply them to the reserved "buffer length buffer" when
// needed for a draw or a dispatch.
struct StorageBufferLengthTracker {
- dawn::ShaderStage dirtyStages = dawn::ShaderStage::None;
+ wgpu::ShaderStage dirtyStages = wgpu::ShaderStage::None;
// The lengths of buffers are stored as 32bit integers because that is the width the
// MSL code generated by SPIRV-Cross expects.
PerStage<std::array<uint32_t, kGenericMetalBufferSlots>> data;
void Apply(id<MTLRenderCommandEncoder> render, RenderPipeline* pipeline) {
- dawn::ShaderStage stagesToApply =
+ wgpu::ShaderStage stagesToApply =
dirtyStages & pipeline->GetStagesRequiringStorageBufferLength();
- if (stagesToApply == dawn::ShaderStage::None) {
+ if (stagesToApply == wgpu::ShaderStage::None) {
return;
}
- if (stagesToApply & dawn::ShaderStage::Vertex) {
+ if (stagesToApply & wgpu::ShaderStage::Vertex) {
uint32_t bufferCount = ToBackend(pipeline->GetLayout())
->GetBufferBindingCount(SingleShaderStage::Vertex);
[render setVertexBytes:data[SingleShaderStage::Vertex].data()
@@ -223,7 +223,7 @@
atIndex:kBufferLengthBufferSlot];
}
- if (stagesToApply & dawn::ShaderStage::Fragment) {
+ if (stagesToApply & wgpu::ShaderStage::Fragment) {
uint32_t bufferCount = ToBackend(pipeline->GetLayout())
->GetBufferBindingCount(SingleShaderStage::Fragment);
[render setFragmentBytes:data[SingleShaderStage::Fragment].data()
@@ -236,7 +236,7 @@
}
void Apply(id<MTLComputeCommandEncoder> compute, ComputePipeline* pipeline) {
- if (!(dirtyStages & dawn::ShaderStage::Compute)) {
+ if (!(dirtyStages & wgpu::ShaderStage::Compute)) {
return;
}
@@ -250,7 +250,7 @@
length:sizeof(uint32_t) * bufferCount
atIndex:kBufferLengthBufferSlot];
- dirtyStages ^= dawn::ShaderStage::Compute;
+ dirtyStages ^= wgpu::ShaderStage::Compute;
}
};
@@ -430,9 +430,9 @@
// call here.
for (uint32_t bindingIndex : IterateBitSet(layout.mask)) {
auto stage = layout.visibilities[bindingIndex];
- bool hasVertStage = stage & dawn::ShaderStage::Vertex && render != nil;
- bool hasFragStage = stage & dawn::ShaderStage::Fragment && render != nil;
- bool hasComputeStage = stage & dawn::ShaderStage::Compute && compute != nil;
+ bool hasVertStage = stage & wgpu::ShaderStage::Vertex && render != nil;
+ bool hasFragStage = stage & wgpu::ShaderStage::Fragment && render != nil;
+ bool hasComputeStage = stage & wgpu::ShaderStage::Compute && compute != nil;
uint32_t vertIndex = 0;
uint32_t fragIndex = 0;
@@ -452,8 +452,8 @@
}
switch (layout.types[bindingIndex]) {
- case dawn::BindingType::UniformBuffer:
- case dawn::BindingType::StorageBuffer: {
+ case wgpu::BindingType::UniformBuffer:
+ case wgpu::BindingType::StorageBuffer: {
const BufferBinding& binding =
group->GetBindingAsBufferBinding(bindingIndex);
const id<MTLBuffer> buffer = ToBackend(binding.buffer)->GetMTLBuffer();
@@ -469,7 +469,7 @@
if (hasVertStage) {
mLengthTracker->data[SingleShaderStage::Vertex][vertIndex] =
binding.size;
- mLengthTracker->dirtyStages |= dawn::ShaderStage::Vertex;
+ mLengthTracker->dirtyStages |= wgpu::ShaderStage::Vertex;
[render setVertexBuffers:&buffer
offsets:&offset
withRange:NSMakeRange(vertIndex, 1)];
@@ -477,7 +477,7 @@
if (hasFragStage) {
mLengthTracker->data[SingleShaderStage::Fragment][fragIndex] =
binding.size;
- mLengthTracker->dirtyStages |= dawn::ShaderStage::Fragment;
+ mLengthTracker->dirtyStages |= wgpu::ShaderStage::Fragment;
[render setFragmentBuffers:&buffer
offsets:&offset
withRange:NSMakeRange(fragIndex, 1)];
@@ -485,7 +485,7 @@
if (hasComputeStage) {
mLengthTracker->data[SingleShaderStage::Compute][computeIndex] =
binding.size;
- mLengthTracker->dirtyStages |= dawn::ShaderStage::Compute;
+ mLengthTracker->dirtyStages |= wgpu::ShaderStage::Compute;
[compute setBuffers:&buffer
offsets:&offset
withRange:NSMakeRange(computeIndex, 1)];
@@ -493,7 +493,7 @@
} break;
- case dawn::BindingType::Sampler: {
+ case wgpu::BindingType::Sampler: {
auto sampler = ToBackend(group->GetBindingAsSampler(bindingIndex));
if (hasVertStage) {
[render setVertexSamplerState:sampler->GetMTLSamplerState()
@@ -509,7 +509,7 @@
}
} break;
- case dawn::BindingType::SampledTexture: {
+ case wgpu::BindingType::SampledTexture: {
auto textureView =
ToBackend(group->GetBindingAsTextureView(bindingIndex));
if (hasVertStage) {
@@ -526,8 +526,8 @@
}
} break;
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
}
diff --git a/src/dawn_native/metal/ComputePipelineMTL.mm b/src/dawn_native/metal/ComputePipelineMTL.mm
index f62412a..fd72364 100644
--- a/src/dawn_native/metal/ComputePipelineMTL.mm
+++ b/src/dawn_native/metal/ComputePipelineMTL.mm
@@ -33,7 +33,7 @@
[mtlDevice newComputePipelineStateWithFunction:computeData.function error:&error];
if (error != nil) {
NSLog(@" error => %@", error);
- GetDevice()->HandleError(dawn::ErrorType::DeviceLost, "Error creating pipeline state");
+ GetDevice()->HandleError(wgpu::ErrorType::DeviceLost, "Error creating pipeline state");
return;
}
diff --git a/src/dawn_native/metal/PipelineLayoutMTL.mm b/src/dawn_native/metal/PipelineLayoutMTL.mm
index 491a70a..dc52891 100644
--- a/src/dawn_native/metal/PipelineLayoutMTL.mm
+++ b/src/dawn_native/metal/PipelineLayoutMTL.mm
@@ -39,21 +39,21 @@
}
switch (groupInfo.types[binding]) {
- case dawn::BindingType::UniformBuffer:
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::UniformBuffer:
+ case wgpu::BindingType::StorageBuffer:
mIndexInfo[stage][group][binding] = bufferIndex;
bufferIndex++;
break;
- case dawn::BindingType::Sampler:
+ case wgpu::BindingType::Sampler:
mIndexInfo[stage][group][binding] = samplerIndex;
samplerIndex++;
break;
- case dawn::BindingType::SampledTexture:
+ case wgpu::BindingType::SampledTexture:
mIndexInfo[stage][group][binding] = textureIndex;
textureIndex++;
break;
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
}
diff --git a/src/dawn_native/metal/RenderPipelineMTL.h b/src/dawn_native/metal/RenderPipelineMTL.h
index 1b764dd..bce358b 100644
--- a/src/dawn_native/metal/RenderPipelineMTL.h
+++ b/src/dawn_native/metal/RenderPipelineMTL.h
@@ -41,7 +41,7 @@
// vertex buffer table.
uint32_t GetMtlVertexBufferIndex(uint32_t dawnIndex) const;
- dawn::ShaderStage GetStagesRequiringStorageBufferLength() const;
+ wgpu::ShaderStage GetStagesRequiringStorageBufferLength() const;
private:
MTLVertexDescriptor* MakeVertexDesc();
@@ -54,7 +54,7 @@
id<MTLDepthStencilState> mMtlDepthStencilState = nil;
std::array<uint32_t, kMaxVertexBuffers> mMtlVertexBufferIndices;
- dawn::ShaderStage mStagesRequiringStorageBufferLength = dawn::ShaderStage::None;
+ wgpu::ShaderStage mStagesRequiringStorageBufferLength = wgpu::ShaderStage::None;
};
}} // namespace dawn_native::metal
diff --git a/src/dawn_native/metal/RenderPipelineMTL.mm b/src/dawn_native/metal/RenderPipelineMTL.mm
index 6683f1c..de85f4c 100644
--- a/src/dawn_native/metal/RenderPipelineMTL.mm
+++ b/src/dawn_native/metal/RenderPipelineMTL.mm
@@ -23,166 +23,166 @@
namespace dawn_native { namespace metal {
namespace {
- MTLVertexFormat VertexFormatType(dawn::VertexFormat format) {
+ MTLVertexFormat VertexFormatType(wgpu::VertexFormat format) {
switch (format) {
- case dawn::VertexFormat::UChar2:
+ case wgpu::VertexFormat::UChar2:
return MTLVertexFormatUChar2;
- case dawn::VertexFormat::UChar4:
+ case wgpu::VertexFormat::UChar4:
return MTLVertexFormatUChar4;
- case dawn::VertexFormat::Char2:
+ case wgpu::VertexFormat::Char2:
return MTLVertexFormatChar2;
- case dawn::VertexFormat::Char4:
+ case wgpu::VertexFormat::Char4:
return MTLVertexFormatChar4;
- case dawn::VertexFormat::UChar2Norm:
+ case wgpu::VertexFormat::UChar2Norm:
return MTLVertexFormatUChar2Normalized;
- case dawn::VertexFormat::UChar4Norm:
+ case wgpu::VertexFormat::UChar4Norm:
return MTLVertexFormatUChar4Normalized;
- case dawn::VertexFormat::Char2Norm:
+ case wgpu::VertexFormat::Char2Norm:
return MTLVertexFormatChar2Normalized;
- case dawn::VertexFormat::Char4Norm:
+ case wgpu::VertexFormat::Char4Norm:
return MTLVertexFormatChar4Normalized;
- case dawn::VertexFormat::UShort2:
+ case wgpu::VertexFormat::UShort2:
return MTLVertexFormatUShort2;
- case dawn::VertexFormat::UShort4:
+ case wgpu::VertexFormat::UShort4:
return MTLVertexFormatUShort4;
- case dawn::VertexFormat::Short2:
+ case wgpu::VertexFormat::Short2:
return MTLVertexFormatShort2;
- case dawn::VertexFormat::Short4:
+ case wgpu::VertexFormat::Short4:
return MTLVertexFormatShort4;
- case dawn::VertexFormat::UShort2Norm:
+ case wgpu::VertexFormat::UShort2Norm:
return MTLVertexFormatUShort2Normalized;
- case dawn::VertexFormat::UShort4Norm:
+ case wgpu::VertexFormat::UShort4Norm:
return MTLVertexFormatUShort4Normalized;
- case dawn::VertexFormat::Short2Norm:
+ case wgpu::VertexFormat::Short2Norm:
return MTLVertexFormatShort2Normalized;
- case dawn::VertexFormat::Short4Norm:
+ case wgpu::VertexFormat::Short4Norm:
return MTLVertexFormatShort4Normalized;
- case dawn::VertexFormat::Half2:
+ case wgpu::VertexFormat::Half2:
return MTLVertexFormatHalf2;
- case dawn::VertexFormat::Half4:
+ case wgpu::VertexFormat::Half4:
return MTLVertexFormatHalf4;
- case dawn::VertexFormat::Float:
+ case wgpu::VertexFormat::Float:
return MTLVertexFormatFloat;
- case dawn::VertexFormat::Float2:
+ case wgpu::VertexFormat::Float2:
return MTLVertexFormatFloat2;
- case dawn::VertexFormat::Float3:
+ case wgpu::VertexFormat::Float3:
return MTLVertexFormatFloat3;
- case dawn::VertexFormat::Float4:
+ case wgpu::VertexFormat::Float4:
return MTLVertexFormatFloat4;
- case dawn::VertexFormat::UInt:
+ case wgpu::VertexFormat::UInt:
return MTLVertexFormatUInt;
- case dawn::VertexFormat::UInt2:
+ case wgpu::VertexFormat::UInt2:
return MTLVertexFormatUInt2;
- case dawn::VertexFormat::UInt3:
+ case wgpu::VertexFormat::UInt3:
return MTLVertexFormatUInt3;
- case dawn::VertexFormat::UInt4:
+ case wgpu::VertexFormat::UInt4:
return MTLVertexFormatUInt4;
- case dawn::VertexFormat::Int:
+ case wgpu::VertexFormat::Int:
return MTLVertexFormatInt;
- case dawn::VertexFormat::Int2:
+ case wgpu::VertexFormat::Int2:
return MTLVertexFormatInt2;
- case dawn::VertexFormat::Int3:
+ case wgpu::VertexFormat::Int3:
return MTLVertexFormatInt3;
- case dawn::VertexFormat::Int4:
+ case wgpu::VertexFormat::Int4:
return MTLVertexFormatInt4;
}
}
- MTLVertexStepFunction InputStepModeFunction(dawn::InputStepMode mode) {
+ MTLVertexStepFunction InputStepModeFunction(wgpu::InputStepMode mode) {
switch (mode) {
- case dawn::InputStepMode::Vertex:
+ case wgpu::InputStepMode::Vertex:
return MTLVertexStepFunctionPerVertex;
- case dawn::InputStepMode::Instance:
+ case wgpu::InputStepMode::Instance:
return MTLVertexStepFunctionPerInstance;
}
}
- MTLPrimitiveType MTLPrimitiveTopology(dawn::PrimitiveTopology primitiveTopology) {
+ MTLPrimitiveType MTLPrimitiveTopology(wgpu::PrimitiveTopology primitiveTopology) {
switch (primitiveTopology) {
- case dawn::PrimitiveTopology::PointList:
+ case wgpu::PrimitiveTopology::PointList:
return MTLPrimitiveTypePoint;
- case dawn::PrimitiveTopology::LineList:
+ case wgpu::PrimitiveTopology::LineList:
return MTLPrimitiveTypeLine;
- case dawn::PrimitiveTopology::LineStrip:
+ case wgpu::PrimitiveTopology::LineStrip:
return MTLPrimitiveTypeLineStrip;
- case dawn::PrimitiveTopology::TriangleList:
+ case wgpu::PrimitiveTopology::TriangleList:
return MTLPrimitiveTypeTriangle;
- case dawn::PrimitiveTopology::TriangleStrip:
+ case wgpu::PrimitiveTopology::TriangleStrip:
return MTLPrimitiveTypeTriangleStrip;
}
}
MTLPrimitiveTopologyClass MTLInputPrimitiveTopology(
- dawn::PrimitiveTopology primitiveTopology) {
+ wgpu::PrimitiveTopology primitiveTopology) {
switch (primitiveTopology) {
- case dawn::PrimitiveTopology::PointList:
+ case wgpu::PrimitiveTopology::PointList:
return MTLPrimitiveTopologyClassPoint;
- case dawn::PrimitiveTopology::LineList:
- case dawn::PrimitiveTopology::LineStrip:
+ case wgpu::PrimitiveTopology::LineList:
+ case wgpu::PrimitiveTopology::LineStrip:
return MTLPrimitiveTopologyClassLine;
- case dawn::PrimitiveTopology::TriangleList:
- case dawn::PrimitiveTopology::TriangleStrip:
+ case wgpu::PrimitiveTopology::TriangleList:
+ case wgpu::PrimitiveTopology::TriangleStrip:
return MTLPrimitiveTopologyClassTriangle;
}
}
- MTLIndexType MTLIndexFormat(dawn::IndexFormat format) {
+ MTLIndexType MTLIndexFormat(wgpu::IndexFormat format) {
switch (format) {
- case dawn::IndexFormat::Uint16:
+ case wgpu::IndexFormat::Uint16:
return MTLIndexTypeUInt16;
- case dawn::IndexFormat::Uint32:
+ case wgpu::IndexFormat::Uint32:
return MTLIndexTypeUInt32;
}
}
- MTLBlendFactor MetalBlendFactor(dawn::BlendFactor factor, bool alpha) {
+ MTLBlendFactor MetalBlendFactor(wgpu::BlendFactor factor, bool alpha) {
switch (factor) {
- case dawn::BlendFactor::Zero:
+ case wgpu::BlendFactor::Zero:
return MTLBlendFactorZero;
- case dawn::BlendFactor::One:
+ case wgpu::BlendFactor::One:
return MTLBlendFactorOne;
- case dawn::BlendFactor::SrcColor:
+ case wgpu::BlendFactor::SrcColor:
return MTLBlendFactorSourceColor;
- case dawn::BlendFactor::OneMinusSrcColor:
+ case wgpu::BlendFactor::OneMinusSrcColor:
return MTLBlendFactorOneMinusSourceColor;
- case dawn::BlendFactor::SrcAlpha:
+ case wgpu::BlendFactor::SrcAlpha:
return MTLBlendFactorSourceAlpha;
- case dawn::BlendFactor::OneMinusSrcAlpha:
+ case wgpu::BlendFactor::OneMinusSrcAlpha:
return MTLBlendFactorOneMinusSourceAlpha;
- case dawn::BlendFactor::DstColor:
+ case wgpu::BlendFactor::DstColor:
return MTLBlendFactorDestinationColor;
- case dawn::BlendFactor::OneMinusDstColor:
+ case wgpu::BlendFactor::OneMinusDstColor:
return MTLBlendFactorOneMinusDestinationColor;
- case dawn::BlendFactor::DstAlpha:
+ case wgpu::BlendFactor::DstAlpha:
return MTLBlendFactorDestinationAlpha;
- case dawn::BlendFactor::OneMinusDstAlpha:
+ case wgpu::BlendFactor::OneMinusDstAlpha:
return MTLBlendFactorOneMinusDestinationAlpha;
- case dawn::BlendFactor::SrcAlphaSaturated:
+ case wgpu::BlendFactor::SrcAlphaSaturated:
return MTLBlendFactorSourceAlphaSaturated;
- case dawn::BlendFactor::BlendColor:
+ case wgpu::BlendFactor::BlendColor:
return alpha ? MTLBlendFactorBlendAlpha : MTLBlendFactorBlendColor;
- case dawn::BlendFactor::OneMinusBlendColor:
+ case wgpu::BlendFactor::OneMinusBlendColor:
return alpha ? MTLBlendFactorOneMinusBlendAlpha
: MTLBlendFactorOneMinusBlendColor;
}
}
- MTLBlendOperation MetalBlendOperation(dawn::BlendOperation operation) {
+ MTLBlendOperation MetalBlendOperation(wgpu::BlendOperation operation) {
switch (operation) {
- case dawn::BlendOperation::Add:
+ case wgpu::BlendOperation::Add:
return MTLBlendOperationAdd;
- case dawn::BlendOperation::Subtract:
+ case wgpu::BlendOperation::Subtract:
return MTLBlendOperationSubtract;
- case dawn::BlendOperation::ReverseSubtract:
+ case wgpu::BlendOperation::ReverseSubtract:
return MTLBlendOperationReverseSubtract;
- case dawn::BlendOperation::Min:
+ case wgpu::BlendOperation::Min:
return MTLBlendOperationMin;
- case dawn::BlendOperation::Max:
+ case wgpu::BlendOperation::Max:
return MTLBlendOperationMax;
}
}
- MTLColorWriteMask MetalColorWriteMask(dawn::ColorWriteMask writeMask,
+ MTLColorWriteMask MetalColorWriteMask(wgpu::ColorWriteMask writeMask,
bool isDeclaredInFragmentShader) {
if (!isDeclaredInFragmentShader) {
return MTLColorWriteMaskNone;
@@ -190,16 +190,16 @@
MTLColorWriteMask mask = MTLColorWriteMaskNone;
- if (writeMask & dawn::ColorWriteMask::Red) {
+ if (writeMask & wgpu::ColorWriteMask::Red) {
mask |= MTLColorWriteMaskRed;
}
- if (writeMask & dawn::ColorWriteMask::Green) {
+ if (writeMask & wgpu::ColorWriteMask::Green) {
mask |= MTLColorWriteMaskGreen;
}
- if (writeMask & dawn::ColorWriteMask::Blue) {
+ if (writeMask & wgpu::ColorWriteMask::Blue) {
mask |= MTLColorWriteMaskBlue;
}
- if (writeMask & dawn::ColorWriteMask::Alpha) {
+ if (writeMask & wgpu::ColorWriteMask::Alpha) {
mask |= MTLColorWriteMaskAlpha;
}
@@ -224,23 +224,23 @@
MetalColorWriteMask(descriptor->writeMask, isDeclaredInFragmentShader);
}
- MTLStencilOperation MetalStencilOperation(dawn::StencilOperation stencilOperation) {
+ MTLStencilOperation MetalStencilOperation(wgpu::StencilOperation stencilOperation) {
switch (stencilOperation) {
- case dawn::StencilOperation::Keep:
+ case wgpu::StencilOperation::Keep:
return MTLStencilOperationKeep;
- case dawn::StencilOperation::Zero:
+ case wgpu::StencilOperation::Zero:
return MTLStencilOperationZero;
- case dawn::StencilOperation::Replace:
+ case wgpu::StencilOperation::Replace:
return MTLStencilOperationReplace;
- case dawn::StencilOperation::Invert:
+ case wgpu::StencilOperation::Invert:
return MTLStencilOperationInvert;
- case dawn::StencilOperation::IncrementClamp:
+ case wgpu::StencilOperation::IncrementClamp:
return MTLStencilOperationIncrementClamp;
- case dawn::StencilOperation::DecrementClamp:
+ case wgpu::StencilOperation::DecrementClamp:
return MTLStencilOperationDecrementClamp;
- case dawn::StencilOperation::IncrementWrap:
+ case wgpu::StencilOperation::IncrementWrap:
return MTLStencilOperationIncrementWrap;
- case dawn::StencilOperation::DecrementWrap:
+ case wgpu::StencilOperation::DecrementWrap:
return MTLStencilOperationDecrementWrap;
}
}
@@ -289,22 +289,22 @@
return mtlDepthStencilDescriptor;
}
- MTLWinding MTLFrontFace(dawn::FrontFace face) {
+ MTLWinding MTLFrontFace(wgpu::FrontFace face) {
switch (face) {
- case dawn::FrontFace::CW:
+ case wgpu::FrontFace::CW:
return MTLWindingClockwise;
- case dawn::FrontFace::CCW:
+ case wgpu::FrontFace::CCW:
return MTLWindingCounterClockwise;
}
}
- MTLCullMode ToMTLCullMode(dawn::CullMode mode) {
+ MTLCullMode ToMTLCullMode(wgpu::CullMode mode) {
switch (mode) {
- case dawn::CullMode::None:
+ case wgpu::CullMode::None:
return MTLCullModeNone;
- case dawn::CullMode::Front:
+ case wgpu::CullMode::Front:
return MTLCullModeFront;
- case dawn::CullMode::Back:
+ case wgpu::CullMode::Back:
return MTLCullModeBack;
}
}
@@ -327,7 +327,7 @@
vertexEntryPoint, SingleShaderStage::Vertex, ToBackend(GetLayout()));
descriptorMTL.vertexFunction = vertexData.function;
if (vertexData.needsStorageBufferLength) {
- mStagesRequiringStorageBufferLength |= dawn::ShaderStage::Vertex;
+ mStagesRequiringStorageBufferLength |= wgpu::ShaderStage::Vertex;
}
const ShaderModule* fragmentModule = ToBackend(descriptor->fragmentStage->module);
@@ -336,12 +336,12 @@
fragmentEntryPoint, SingleShaderStage::Fragment, ToBackend(GetLayout()));
descriptorMTL.fragmentFunction = fragmentData.function;
if (fragmentData.needsStorageBufferLength) {
- mStagesRequiringStorageBufferLength |= dawn::ShaderStage::Fragment;
+ mStagesRequiringStorageBufferLength |= wgpu::ShaderStage::Fragment;
}
if (HasDepthStencilAttachment()) {
// TODO(kainino@chromium.org): Handle depth-only and stencil-only formats.
- dawn::TextureFormat depthStencilFormat = GetDepthStencilFormat();
+ wgpu::TextureFormat depthStencilFormat = GetDepthStencilFormat();
descriptorMTL.depthAttachmentPixelFormat = MetalPixelFormat(depthStencilFormat);
descriptorMTL.stencilAttachmentPixelFormat = MetalPixelFormat(depthStencilFormat);
}
@@ -372,7 +372,7 @@
[descriptorMTL release];
if (error != nil) {
NSLog(@" error => %@", error);
- device->HandleError(dawn::ErrorType::DeviceLost,
+ device->HandleError(wgpu::ErrorType::DeviceLost,
"Error creating rendering pipeline state");
return;
}
@@ -421,7 +421,7 @@
return mMtlVertexBufferIndices[dawnIndex];
}
- dawn::ShaderStage RenderPipeline::GetStagesRequiringStorageBufferLength() const {
+ wgpu::ShaderStage RenderPipeline::GetStagesRequiringStorageBufferLength() const {
return mStagesRequiringStorageBufferLength;
}
diff --git a/src/dawn_native/metal/SamplerMTL.mm b/src/dawn_native/metal/SamplerMTL.mm
index 720f371..c58e582 100644
--- a/src/dawn_native/metal/SamplerMTL.mm
+++ b/src/dawn_native/metal/SamplerMTL.mm
@@ -20,31 +20,31 @@
namespace dawn_native { namespace metal {
namespace {
- MTLSamplerMinMagFilter FilterModeToMinMagFilter(dawn::FilterMode mode) {
+ MTLSamplerMinMagFilter FilterModeToMinMagFilter(wgpu::FilterMode mode) {
switch (mode) {
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
return MTLSamplerMinMagFilterNearest;
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
return MTLSamplerMinMagFilterLinear;
}
}
- MTLSamplerMipFilter FilterModeToMipFilter(dawn::FilterMode mode) {
+ MTLSamplerMipFilter FilterModeToMipFilter(wgpu::FilterMode mode) {
switch (mode) {
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
return MTLSamplerMipFilterNearest;
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
return MTLSamplerMipFilterLinear;
}
}
- MTLSamplerAddressMode AddressMode(dawn::AddressMode mode) {
+ MTLSamplerAddressMode AddressMode(wgpu::AddressMode mode) {
switch (mode) {
- case dawn::AddressMode::Repeat:
+ case wgpu::AddressMode::Repeat:
return MTLSamplerAddressModeRepeat;
- case dawn::AddressMode::MirrorRepeat:
+ case wgpu::AddressMode::MirrorRepeat:
return MTLSamplerAddressModeMirrorRepeat;
- case dawn::AddressMode::ClampToEdge:
+ case wgpu::AddressMode::ClampToEdge:
return MTLSamplerAddressModeClampToEdge;
}
}
diff --git a/src/dawn_native/metal/SwapChainMTL.mm b/src/dawn_native/metal/SwapChainMTL.mm
index 92458a2..4a35e41 100644
--- a/src/dawn_native/metal/SwapChainMTL.mm
+++ b/src/dawn_native/metal/SwapChainMTL.mm
@@ -38,7 +38,7 @@
DawnSwapChainNextTexture next = {};
DawnSwapChainError error = im.GetNextTexture(im.userData, &next);
if (error) {
- GetDevice()->HandleError(dawn::ErrorType::Unknown, error);
+ GetDevice()->HandleError(wgpu::ErrorType::Unknown, error);
return nullptr;
}
diff --git a/src/dawn_native/metal/TextureMTL.h b/src/dawn_native/metal/TextureMTL.h
index 13c30f8..13ba986 100644
--- a/src/dawn_native/metal/TextureMTL.h
+++ b/src/dawn_native/metal/TextureMTL.h
@@ -24,7 +24,7 @@
class Device;
- MTLPixelFormat MetalPixelFormat(dawn::TextureFormat format);
+ MTLPixelFormat MetalPixelFormat(wgpu::TextureFormat format);
MaybeError ValidateIOSurfaceCanBeWrapped(const DeviceBase* device,
const TextureDescriptor* descriptor,
IOSurfaceRef ioSurface,
diff --git a/src/dawn_native/metal/TextureMTL.mm b/src/dawn_native/metal/TextureMTL.mm
index c0f3428..9d7701b 100644
--- a/src/dawn_native/metal/TextureMTL.mm
+++ b/src/dawn_native/metal/TextureMTL.mm
@@ -20,24 +20,24 @@
namespace dawn_native { namespace metal {
namespace {
- bool UsageNeedsTextureView(dawn::TextureUsage usage) {
- constexpr dawn::TextureUsage kUsageNeedsTextureView =
- dawn::TextureUsage::Storage | dawn::TextureUsage::Sampled;
+ bool UsageNeedsTextureView(wgpu::TextureUsage usage) {
+ constexpr wgpu::TextureUsage kUsageNeedsTextureView =
+ wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled;
return usage & kUsageNeedsTextureView;
}
- MTLTextureUsage MetalTextureUsage(dawn::TextureUsage usage) {
+ MTLTextureUsage MetalTextureUsage(wgpu::TextureUsage usage) {
MTLTextureUsage result = MTLTextureUsageUnknown; // This is 0
- if (usage & (dawn::TextureUsage::Storage)) {
+ if (usage & (wgpu::TextureUsage::Storage)) {
result |= MTLTextureUsageShaderWrite | MTLTextureUsageShaderRead;
}
- if (usage & (dawn::TextureUsage::Sampled)) {
+ if (usage & (wgpu::TextureUsage::Sampled)) {
result |= MTLTextureUsageShaderRead;
}
- if (usage & (dawn::TextureUsage::OutputAttachment)) {
+ if (usage & (wgpu::TextureUsage::OutputAttachment)) {
result |= MTLTextureUsageRenderTarget;
}
@@ -48,11 +48,11 @@
return result;
}
- MTLTextureType MetalTextureType(dawn::TextureDimension dimension,
+ MTLTextureType MetalTextureType(wgpu::TextureDimension dimension,
unsigned int arrayLayers,
unsigned int sampleCount) {
switch (dimension) {
- case dawn::TextureDimension::e2D:
+ case wgpu::TextureDimension::e2D:
if (sampleCount > 1) {
ASSERT(arrayLayers == 1);
return MTLTextureType2DMultisample;
@@ -64,16 +64,16 @@
}
}
- MTLTextureType MetalTextureViewType(dawn::TextureViewDimension dimension,
+ MTLTextureType MetalTextureViewType(wgpu::TextureViewDimension dimension,
unsigned int sampleCount) {
switch (dimension) {
- case dawn::TextureViewDimension::e2D:
+ case wgpu::TextureViewDimension::e2D:
return (sampleCount > 1) ? MTLTextureType2DMultisample : MTLTextureType2D;
- case dawn::TextureViewDimension::e2DArray:
+ case wgpu::TextureViewDimension::e2DArray:
return MTLTextureType2DArray;
- case dawn::TextureViewDimension::Cube:
+ case wgpu::TextureViewDimension::Cube:
return MTLTextureTypeCube;
- case dawn::TextureViewDimension::CubeArray:
+ case wgpu::TextureViewDimension::CubeArray:
return MTLTextureTypeCubeArray;
default:
UNREACHABLE();
@@ -96,8 +96,8 @@
}
switch (textureViewDescriptor->dimension) {
- case dawn::TextureViewDimension::Cube:
- case dawn::TextureViewDimension::CubeArray:
+ case wgpu::TextureViewDimension::Cube:
+ case wgpu::TextureViewDimension::CubeArray:
return true;
default:
break;
@@ -106,16 +106,16 @@
return false;
}
- ResultOrError<dawn::TextureFormat> GetFormatEquivalentToIOSurfaceFormat(uint32_t format) {
+ ResultOrError<wgpu::TextureFormat> GetFormatEquivalentToIOSurfaceFormat(uint32_t format) {
switch (format) {
case 'RGBA':
- return dawn::TextureFormat::RGBA8Unorm;
+ return wgpu::TextureFormat::RGBA8Unorm;
case 'BGRA':
- return dawn::TextureFormat::BGRA8Unorm;
+ return wgpu::TextureFormat::BGRA8Unorm;
case '2C08':
- return dawn::TextureFormat::RG8Unorm;
+ return wgpu::TextureFormat::RG8Unorm;
case 'L008':
- return dawn::TextureFormat::R8Unorm;
+ return wgpu::TextureFormat::R8Unorm;
default:
return DAWN_VALIDATION_ERROR("Unsupported IOSurface format");
}
@@ -130,118 +130,118 @@
#endif
}
- MTLPixelFormat MetalPixelFormat(dawn::TextureFormat format) {
+ MTLPixelFormat MetalPixelFormat(wgpu::TextureFormat format) {
switch (format) {
- case dawn::TextureFormat::R8Unorm:
+ case wgpu::TextureFormat::R8Unorm:
return MTLPixelFormatR8Unorm;
- case dawn::TextureFormat::R8Snorm:
+ case wgpu::TextureFormat::R8Snorm:
return MTLPixelFormatR8Snorm;
- case dawn::TextureFormat::R8Uint:
+ case wgpu::TextureFormat::R8Uint:
return MTLPixelFormatR8Uint;
- case dawn::TextureFormat::R8Sint:
+ case wgpu::TextureFormat::R8Sint:
return MTLPixelFormatR8Sint;
- case dawn::TextureFormat::R16Uint:
+ case wgpu::TextureFormat::R16Uint:
return MTLPixelFormatR16Uint;
- case dawn::TextureFormat::R16Sint:
+ case wgpu::TextureFormat::R16Sint:
return MTLPixelFormatR16Sint;
- case dawn::TextureFormat::R16Float:
+ case wgpu::TextureFormat::R16Float:
return MTLPixelFormatR16Float;
- case dawn::TextureFormat::RG8Unorm:
+ case wgpu::TextureFormat::RG8Unorm:
return MTLPixelFormatRG8Unorm;
- case dawn::TextureFormat::RG8Snorm:
+ case wgpu::TextureFormat::RG8Snorm:
return MTLPixelFormatRG8Snorm;
- case dawn::TextureFormat::RG8Uint:
+ case wgpu::TextureFormat::RG8Uint:
return MTLPixelFormatRG8Uint;
- case dawn::TextureFormat::RG8Sint:
+ case wgpu::TextureFormat::RG8Sint:
return MTLPixelFormatRG8Sint;
- case dawn::TextureFormat::R32Uint:
+ case wgpu::TextureFormat::R32Uint:
return MTLPixelFormatR32Uint;
- case dawn::TextureFormat::R32Sint:
+ case wgpu::TextureFormat::R32Sint:
return MTLPixelFormatR32Sint;
- case dawn::TextureFormat::R32Float:
+ case wgpu::TextureFormat::R32Float:
return MTLPixelFormatR32Float;
- case dawn::TextureFormat::RG16Uint:
+ case wgpu::TextureFormat::RG16Uint:
return MTLPixelFormatRG16Uint;
- case dawn::TextureFormat::RG16Sint:
+ case wgpu::TextureFormat::RG16Sint:
return MTLPixelFormatRG16Sint;
- case dawn::TextureFormat::RG16Float:
+ case wgpu::TextureFormat::RG16Float:
return MTLPixelFormatRG16Float;
- case dawn::TextureFormat::RGBA8Unorm:
+ case wgpu::TextureFormat::RGBA8Unorm:
return MTLPixelFormatRGBA8Unorm;
- case dawn::TextureFormat::RGBA8UnormSrgb:
+ case wgpu::TextureFormat::RGBA8UnormSrgb:
return MTLPixelFormatRGBA8Unorm_sRGB;
- case dawn::TextureFormat::RGBA8Snorm:
+ case wgpu::TextureFormat::RGBA8Snorm:
return MTLPixelFormatRGBA8Snorm;
- case dawn::TextureFormat::RGBA8Uint:
+ case wgpu::TextureFormat::RGBA8Uint:
return MTLPixelFormatRGBA8Uint;
- case dawn::TextureFormat::RGBA8Sint:
+ case wgpu::TextureFormat::RGBA8Sint:
return MTLPixelFormatRGBA8Sint;
- case dawn::TextureFormat::BGRA8Unorm:
+ case wgpu::TextureFormat::BGRA8Unorm:
return MTLPixelFormatBGRA8Unorm;
- case dawn::TextureFormat::BGRA8UnormSrgb:
+ case wgpu::TextureFormat::BGRA8UnormSrgb:
return MTLPixelFormatBGRA8Unorm_sRGB;
- case dawn::TextureFormat::RGB10A2Unorm:
+ case wgpu::TextureFormat::RGB10A2Unorm:
return MTLPixelFormatRGB10A2Unorm;
- case dawn::TextureFormat::RG11B10Float:
+ case wgpu::TextureFormat::RG11B10Float:
return MTLPixelFormatRG11B10Float;
- case dawn::TextureFormat::RG32Uint:
+ case wgpu::TextureFormat::RG32Uint:
return MTLPixelFormatRG32Uint;
- case dawn::TextureFormat::RG32Sint:
+ case wgpu::TextureFormat::RG32Sint:
return MTLPixelFormatRG32Sint;
- case dawn::TextureFormat::RG32Float:
+ case wgpu::TextureFormat::RG32Float:
return MTLPixelFormatRG32Float;
- case dawn::TextureFormat::RGBA16Uint:
+ case wgpu::TextureFormat::RGBA16Uint:
return MTLPixelFormatRGBA16Uint;
- case dawn::TextureFormat::RGBA16Sint:
+ case wgpu::TextureFormat::RGBA16Sint:
return MTLPixelFormatRGBA16Sint;
- case dawn::TextureFormat::RGBA16Float:
+ case wgpu::TextureFormat::RGBA16Float:
return MTLPixelFormatRGBA16Float;
- case dawn::TextureFormat::RGBA32Uint:
+ case wgpu::TextureFormat::RGBA32Uint:
return MTLPixelFormatRGBA32Uint;
- case dawn::TextureFormat::RGBA32Sint:
+ case wgpu::TextureFormat::RGBA32Sint:
return MTLPixelFormatRGBA32Sint;
- case dawn::TextureFormat::RGBA32Float:
+ case wgpu::TextureFormat::RGBA32Float:
return MTLPixelFormatRGBA32Float;
- case dawn::TextureFormat::Depth32Float:
+ case wgpu::TextureFormat::Depth32Float:
return MTLPixelFormatDepth32Float;
- case dawn::TextureFormat::Depth24Plus:
+ case wgpu::TextureFormat::Depth24Plus:
return MTLPixelFormatDepth32Float;
- case dawn::TextureFormat::Depth24PlusStencil8:
+ case wgpu::TextureFormat::Depth24PlusStencil8:
return MTLPixelFormatDepth32Float_Stencil8;
#if defined(DAWN_PLATFORM_MACOS)
- case dawn::TextureFormat::BC1RGBAUnorm:
+ case wgpu::TextureFormat::BC1RGBAUnorm:
return MTLPixelFormatBC1_RGBA;
- case dawn::TextureFormat::BC1RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC1RGBAUnormSrgb:
return MTLPixelFormatBC1_RGBA_sRGB;
- case dawn::TextureFormat::BC2RGBAUnorm:
+ case wgpu::TextureFormat::BC2RGBAUnorm:
return MTLPixelFormatBC2_RGBA;
- case dawn::TextureFormat::BC2RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC2RGBAUnormSrgb:
return MTLPixelFormatBC2_RGBA_sRGB;
- case dawn::TextureFormat::BC3RGBAUnorm:
+ case wgpu::TextureFormat::BC3RGBAUnorm:
return MTLPixelFormatBC3_RGBA;
- case dawn::TextureFormat::BC3RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC3RGBAUnormSrgb:
return MTLPixelFormatBC3_RGBA_sRGB;
- case dawn::TextureFormat::BC4RSnorm:
+ case wgpu::TextureFormat::BC4RSnorm:
return MTLPixelFormatBC4_RSnorm;
- case dawn::TextureFormat::BC4RUnorm:
+ case wgpu::TextureFormat::BC4RUnorm:
return MTLPixelFormatBC4_RUnorm;
- case dawn::TextureFormat::BC5RGSnorm:
+ case wgpu::TextureFormat::BC5RGSnorm:
return MTLPixelFormatBC5_RGSnorm;
- case dawn::TextureFormat::BC5RGUnorm:
+ case wgpu::TextureFormat::BC5RGUnorm:
return MTLPixelFormatBC5_RGUnorm;
- case dawn::TextureFormat::BC6HRGBSfloat:
+ case wgpu::TextureFormat::BC6HRGBSfloat:
return MTLPixelFormatBC6H_RGBFloat;
- case dawn::TextureFormat::BC6HRGBUfloat:
+ case wgpu::TextureFormat::BC6HRGBUfloat:
return MTLPixelFormatBC6H_RGBUfloat;
- case dawn::TextureFormat::BC7RGBAUnorm:
+ case wgpu::TextureFormat::BC7RGBAUnorm:
return MTLPixelFormatBC7_RGBAUnorm;
- case dawn::TextureFormat::BC7RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC7RGBAUnormSrgb:
return MTLPixelFormatBC7_RGBAUnorm_sRGB;
#endif
@@ -261,7 +261,7 @@
return DAWN_VALIDATION_ERROR("IOSurface plane doesn't exist");
}
- if (descriptor->dimension != dawn::TextureDimension::e2D) {
+ if (descriptor->dimension != wgpu::TextureDimension::e2D) {
return DAWN_VALIDATION_ERROR("IOSurface texture must be 2D");
}
@@ -283,7 +283,7 @@
return DAWN_VALIDATION_ERROR("IOSurface size doesn't match descriptor");
}
- dawn::TextureFormat ioSurfaceFormat;
+ wgpu::TextureFormat ioSurfaceFormat;
DAWN_TRY_ASSIGN(ioSurfaceFormat,
GetFormatEquivalentToIOSurfaceFormat(IOSurfaceGetPixelFormat(ioSurface)));
if (descriptor->format != ioSurfaceFormat) {
diff --git a/src/dawn_native/metal/UtilsMetal.h b/src/dawn_native/metal/UtilsMetal.h
index 574036d..091d828 100644
--- a/src/dawn_native/metal/UtilsMetal.h
+++ b/src/dawn_native/metal/UtilsMetal.h
@@ -21,7 +21,7 @@
namespace dawn_native { namespace metal {
- MTLCompareFunction ToMetalCompareFunction(dawn::CompareFunction compareFunction);
+ MTLCompareFunction ToMetalCompareFunction(wgpu::CompareFunction compareFunction);
}} // namespace dawn_native::metal
diff --git a/src/dawn_native/metal/UtilsMetal.mm b/src/dawn_native/metal/UtilsMetal.mm
index 8621037..190c0e9 100644
--- a/src/dawn_native/metal/UtilsMetal.mm
+++ b/src/dawn_native/metal/UtilsMetal.mm
@@ -16,23 +16,23 @@
namespace dawn_native { namespace metal {
- MTLCompareFunction ToMetalCompareFunction(dawn::CompareFunction compareFunction) {
+ MTLCompareFunction ToMetalCompareFunction(wgpu::CompareFunction compareFunction) {
switch (compareFunction) {
- case dawn::CompareFunction::Never:
+ case wgpu::CompareFunction::Never:
return MTLCompareFunctionNever;
- case dawn::CompareFunction::Less:
+ case wgpu::CompareFunction::Less:
return MTLCompareFunctionLess;
- case dawn::CompareFunction::LessEqual:
+ case wgpu::CompareFunction::LessEqual:
return MTLCompareFunctionLessEqual;
- case dawn::CompareFunction::Greater:
+ case wgpu::CompareFunction::Greater:
return MTLCompareFunctionGreater;
- case dawn::CompareFunction::GreaterEqual:
+ case wgpu::CompareFunction::GreaterEqual:
return MTLCompareFunctionGreaterEqual;
- case dawn::CompareFunction::NotEqual:
+ case wgpu::CompareFunction::NotEqual:
return MTLCompareFunctionNotEqual;
- case dawn::CompareFunction::Equal:
+ case wgpu::CompareFunction::Equal:
return MTLCompareFunctionEqual;
- case dawn::CompareFunction::Always:
+ case wgpu::CompareFunction::Always:
return MTLCompareFunctionAlways;
}
}
diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp
index 08e39b2..35a2cfd 100644
--- a/src/dawn_native/null/DeviceNull.cpp
+++ b/src/dawn_native/null/DeviceNull.cpp
@@ -241,7 +241,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::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
+ return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
}
MaybeError Buffer::MapAtCreationImpl(uint8_t** mappedPointer) {
@@ -363,8 +363,8 @@
return DAWN_SWAP_CHAIN_NO_ERROR;
}
- dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
- return dawn::TextureFormat::RGBA8Unorm;
+ wgpu::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
+ return wgpu::TextureFormat::RGBA8Unorm;
}
// StagingBuffer
diff --git a/src/dawn_native/null/DeviceNull.h b/src/dawn_native/null/DeviceNull.h
index ef98719..9a87942 100644
--- a/src/dawn_native/null/DeviceNull.h
+++ b/src/dawn_native/null/DeviceNull.h
@@ -214,7 +214,7 @@
uint32_t height);
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
DawnSwapChainError Present();
- dawn::TextureFormat GetPreferredFormat() const;
+ wgpu::TextureFormat GetPreferredFormat() const;
};
class StagingBuffer : public StagingBufferBase {
diff --git a/src/dawn_native/opengl/CommandBufferGL.cpp b/src/dawn_native/opengl/CommandBufferGL.cpp
index 5f3c822..b508538 100644
--- a/src/dawn_native/opengl/CommandBufferGL.cpp
+++ b/src/dawn_native/opengl/CommandBufferGL.cpp
@@ -36,96 +36,96 @@
namespace {
- GLenum IndexFormatType(dawn::IndexFormat format) {
+ GLenum IndexFormatType(wgpu::IndexFormat format) {
switch (format) {
- case dawn::IndexFormat::Uint16:
+ case wgpu::IndexFormat::Uint16:
return GL_UNSIGNED_SHORT;
- case dawn::IndexFormat::Uint32:
+ case wgpu::IndexFormat::Uint32:
return GL_UNSIGNED_INT;
default:
UNREACHABLE();
}
}
- GLenum VertexFormatType(dawn::VertexFormat format) {
+ GLenum VertexFormatType(wgpu::VertexFormat format) {
switch (format) {
- case dawn::VertexFormat::UChar2:
- case dawn::VertexFormat::UChar4:
- case dawn::VertexFormat::UChar2Norm:
- case dawn::VertexFormat::UChar4Norm:
+ case wgpu::VertexFormat::UChar2:
+ case wgpu::VertexFormat::UChar4:
+ case wgpu::VertexFormat::UChar2Norm:
+ case wgpu::VertexFormat::UChar4Norm:
return GL_UNSIGNED_BYTE;
- case dawn::VertexFormat::Char2:
- case dawn::VertexFormat::Char4:
- case dawn::VertexFormat::Char2Norm:
- case dawn::VertexFormat::Char4Norm:
+ case wgpu::VertexFormat::Char2:
+ case wgpu::VertexFormat::Char4:
+ case wgpu::VertexFormat::Char2Norm:
+ case wgpu::VertexFormat::Char4Norm:
return GL_BYTE;
- case dawn::VertexFormat::UShort2:
- case dawn::VertexFormat::UShort4:
- case dawn::VertexFormat::UShort2Norm:
- case dawn::VertexFormat::UShort4Norm:
+ case wgpu::VertexFormat::UShort2:
+ case wgpu::VertexFormat::UShort4:
+ case wgpu::VertexFormat::UShort2Norm:
+ case wgpu::VertexFormat::UShort4Norm:
return GL_UNSIGNED_SHORT;
- case dawn::VertexFormat::Short2:
- case dawn::VertexFormat::Short4:
- case dawn::VertexFormat::Short2Norm:
- case dawn::VertexFormat::Short4Norm:
+ case wgpu::VertexFormat::Short2:
+ case wgpu::VertexFormat::Short4:
+ case wgpu::VertexFormat::Short2Norm:
+ case wgpu::VertexFormat::Short4Norm:
return GL_SHORT;
- case dawn::VertexFormat::Half2:
- case dawn::VertexFormat::Half4:
+ case wgpu::VertexFormat::Half2:
+ case wgpu::VertexFormat::Half4:
return GL_HALF_FLOAT;
- case dawn::VertexFormat::Float:
- case dawn::VertexFormat::Float2:
- case dawn::VertexFormat::Float3:
- case dawn::VertexFormat::Float4:
+ case wgpu::VertexFormat::Float:
+ case wgpu::VertexFormat::Float2:
+ case wgpu::VertexFormat::Float3:
+ case wgpu::VertexFormat::Float4:
return GL_FLOAT;
- case dawn::VertexFormat::UInt:
- case dawn::VertexFormat::UInt2:
- case dawn::VertexFormat::UInt3:
- case dawn::VertexFormat::UInt4:
+ case wgpu::VertexFormat::UInt:
+ case wgpu::VertexFormat::UInt2:
+ case wgpu::VertexFormat::UInt3:
+ case wgpu::VertexFormat::UInt4:
return GL_UNSIGNED_INT;
- case dawn::VertexFormat::Int:
- case dawn::VertexFormat::Int2:
- case dawn::VertexFormat::Int3:
- case dawn::VertexFormat::Int4:
+ case wgpu::VertexFormat::Int:
+ case wgpu::VertexFormat::Int2:
+ case wgpu::VertexFormat::Int3:
+ case wgpu::VertexFormat::Int4:
return GL_INT;
default:
UNREACHABLE();
}
}
- GLboolean VertexFormatIsNormalized(dawn::VertexFormat format) {
+ GLboolean VertexFormatIsNormalized(wgpu::VertexFormat format) {
switch (format) {
- case dawn::VertexFormat::UChar2Norm:
- case dawn::VertexFormat::UChar4Norm:
- case dawn::VertexFormat::Char2Norm:
- case dawn::VertexFormat::Char4Norm:
- case dawn::VertexFormat::UShort2Norm:
- case dawn::VertexFormat::UShort4Norm:
- case dawn::VertexFormat::Short2Norm:
- case dawn::VertexFormat::Short4Norm:
+ case wgpu::VertexFormat::UChar2Norm:
+ case wgpu::VertexFormat::UChar4Norm:
+ case wgpu::VertexFormat::Char2Norm:
+ case wgpu::VertexFormat::Char4Norm:
+ case wgpu::VertexFormat::UShort2Norm:
+ case wgpu::VertexFormat::UShort4Norm:
+ case wgpu::VertexFormat::Short2Norm:
+ case wgpu::VertexFormat::Short4Norm:
return GL_TRUE;
default:
return GL_FALSE;
}
}
- bool VertexFormatIsInt(dawn::VertexFormat format) {
+ bool VertexFormatIsInt(wgpu::VertexFormat format) {
switch (format) {
- case dawn::VertexFormat::UChar2:
- case dawn::VertexFormat::UChar4:
- case dawn::VertexFormat::Char2:
- case dawn::VertexFormat::Char4:
- case dawn::VertexFormat::UShort2:
- case dawn::VertexFormat::UShort4:
- case dawn::VertexFormat::Short2:
- case dawn::VertexFormat::Short4:
- case dawn::VertexFormat::UInt:
- case dawn::VertexFormat::UInt2:
- case dawn::VertexFormat::UInt3:
- case dawn::VertexFormat::UInt4:
- case dawn::VertexFormat::Int:
- case dawn::VertexFormat::Int2:
- case dawn::VertexFormat::Int3:
- case dawn::VertexFormat::Int4:
+ case wgpu::VertexFormat::UChar2:
+ case wgpu::VertexFormat::UChar4:
+ case wgpu::VertexFormat::Char2:
+ case wgpu::VertexFormat::Char4:
+ case wgpu::VertexFormat::UShort2:
+ case wgpu::VertexFormat::UShort4:
+ case wgpu::VertexFormat::Short2:
+ case wgpu::VertexFormat::Short4:
+ case wgpu::VertexFormat::UInt:
+ case wgpu::VertexFormat::UInt2:
+ case wgpu::VertexFormat::UInt3:
+ case wgpu::VertexFormat::UInt4:
+ case wgpu::VertexFormat::Int:
+ case wgpu::VertexFormat::Int2:
+ case wgpu::VertexFormat::Int3:
+ case wgpu::VertexFormat::Int4:
return true;
default:
return false;
@@ -242,7 +242,7 @@
for (uint32_t bindingIndex : IterateBitSet(layout.mask)) {
switch (layout.types[bindingIndex]) {
- case dawn::BindingType::UniformBuffer: {
+ case wgpu::BindingType::UniformBuffer: {
BufferBinding binding = group->GetBindingAsBufferBinding(bindingIndex);
GLuint buffer = ToBackend(binding.buffer)->GetHandle();
GLuint uboIndex = indices[bindingIndex];
@@ -257,7 +257,7 @@
binding.size);
} break;
- case dawn::BindingType::Sampler: {
+ case wgpu::BindingType::Sampler: {
Sampler* sampler = ToBackend(group->GetBindingAsSampler(bindingIndex));
GLuint samplerIndex = indices[bindingIndex];
@@ -273,7 +273,7 @@
}
} break;
- case dawn::BindingType::SampledTexture: {
+ case wgpu::BindingType::SampledTexture: {
TextureView* view =
ToBackend(group->GetBindingAsTextureView(bindingIndex));
GLuint handle = view->GetHandle();
@@ -286,7 +286,7 @@
}
} break;
- case dawn::BindingType::StorageBuffer: {
+ case wgpu::BindingType::StorageBuffer: {
BufferBinding binding = group->GetBindingAsBufferBinding(bindingIndex);
GLuint buffer = ToBackend(binding.buffer)->GetHandle();
GLuint ssboIndex = indices[bindingIndex];
@@ -301,8 +301,8 @@
binding.size);
} break;
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
@@ -410,7 +410,7 @@
// We count the lazy clears for non output attachment textures in order to match the
// backdoor lazy clear counts in Vulkan and D3D12.
bool isLazyClear =
- !(usages.textureUsages[i] & dawn::TextureUsage::OutputAttachment);
+ !(usages.textureUsages[i] & wgpu::TextureUsage::OutputAttachment);
texture->EnsureSubresourceContentInitialized(
0, texture->GetNumMipLevels(), 0, texture->GetArrayLayers(), isLazyClear);
}
@@ -483,7 +483,7 @@
gl.PixelStorei(GL_UNPACK_COMPRESSED_BLOCK_HEIGHT, formatInfo.blockHeight);
gl.PixelStorei(GL_UNPACK_COMPRESSED_BLOCK_DEPTH, 1);
- ASSERT(texture->GetDimension() == dawn::TextureDimension::e2D);
+ ASSERT(texture->GetDimension() == wgpu::TextureDimension::e2D);
uint64_t copyDataSize = (copySize.width / formatInfo.blockWidth) *
(copySize.height / formatInfo.blockHeight) *
formatInfo.blockByteSize;
@@ -503,7 +503,7 @@
}
} else {
switch (texture->GetDimension()) {
- case dawn::TextureDimension::e2D:
+ case wgpu::TextureDimension::e2D:
if (texture->GetArrayLayers() > 1) {
gl.TexSubImage3D(target, dst.mipLevel, dst.origin.x,
dst.origin.y, dst.arrayLayer, copySize.width,
@@ -556,7 +556,7 @@
gl.GenFramebuffers(1, &readFBO);
gl.BindFramebuffer(GL_READ_FRAMEBUFFER, readFBO);
switch (texture->GetDimension()) {
- case dawn::TextureDimension::e2D:
+ case wgpu::TextureDimension::e2D:
if (texture->GetArrayLayers() > 1) {
gl.FramebufferTextureLayer(
GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture->GetHandle(),
@@ -785,19 +785,19 @@
// componentType: things work for now because the clear color is always a float, but
// when that's fixed will lose precision on integer formats when converting to
// float.
- if (attachmentInfo->loadOp == dawn::LoadOp::Clear) {
+ if (attachmentInfo->loadOp == wgpu::LoadOp::Clear) {
gl.ColorMaski(i, true, true, true, true);
gl.ClearBufferfv(GL_COLOR, i, &attachmentInfo->clearColor.r);
}
switch (attachmentInfo->storeOp) {
- case dawn::StoreOp::Store: {
+ case wgpu::StoreOp::Store: {
view->GetTexture()->SetIsSubresourceContentInitialized(
true, view->GetBaseMipLevel(), view->GetLevelCount(),
view->GetBaseArrayLayer(), view->GetLayerCount());
} break;
- case dawn::StoreOp::Clear: {
+ case wgpu::StoreOp::Clear: {
// TODO(natlee@microsoft.com): call glDiscard to do optimization
view->GetTexture()->SetIsSubresourceContentInitialized(
false, view->GetBaseMipLevel(), view->GetLevelCount(),
@@ -817,9 +817,9 @@
// Load op - depth/stencil
bool doDepthClear = attachmentFormat.HasDepth() &&
- (attachmentInfo->depthLoadOp == dawn::LoadOp::Clear);
+ (attachmentInfo->depthLoadOp == wgpu::LoadOp::Clear);
bool doStencilClear = attachmentFormat.HasStencil() &&
- (attachmentInfo->stencilLoadOp == dawn::LoadOp::Clear);
+ (attachmentInfo->stencilLoadOp == wgpu::LoadOp::Clear);
if (doDepthClear) {
gl.DepthMask(GL_TRUE);
@@ -838,13 +838,13 @@
gl.ClearBufferiv(GL_STENCIL, 0, &clearStencil);
}
- if (attachmentInfo->depthStoreOp == dawn::StoreOp::Store &&
- attachmentInfo->stencilStoreOp == dawn::StoreOp::Store) {
+ if (attachmentInfo->depthStoreOp == wgpu::StoreOp::Store &&
+ attachmentInfo->stencilStoreOp == wgpu::StoreOp::Store) {
view->GetTexture()->SetIsSubresourceContentInitialized(
true, view->GetBaseMipLevel(), view->GetLevelCount(),
view->GetBaseArrayLayer(), view->GetLayerCount());
- } else if (attachmentInfo->depthStoreOp == dawn::StoreOp::Clear &&
- attachmentInfo->stencilStoreOp == dawn::StoreOp::Clear) {
+ } else if (attachmentInfo->depthStoreOp == wgpu::StoreOp::Clear &&
+ attachmentInfo->stencilStoreOp == wgpu::StoreOp::Clear) {
view->GetTexture()->SetIsSubresourceContentInitialized(
false, view->GetBaseMipLevel(), view->GetLevelCount(),
view->GetBaseArrayLayer(), view->GetLayerCount());
@@ -882,7 +882,7 @@
inputBuffers.Apply(gl);
bindGroupTracker.Apply(gl);
- dawn::IndexFormat indexFormat =
+ wgpu::IndexFormat indexFormat =
lastPipeline->GetVertexInputDescriptor()->indexFormat;
size_t formatSize = IndexFormatSize(indexFormat);
GLenum formatType = IndexFormatType(indexFormat);
@@ -922,7 +922,7 @@
inputBuffers.Apply(gl);
bindGroupTracker.Apply(gl);
- dawn::IndexFormat indexFormat =
+ wgpu::IndexFormat indexFormat =
lastPipeline->GetVertexInputDescriptor()->indexFormat;
GLenum formatType = IndexFormatType(indexFormat);
diff --git a/src/dawn_native/opengl/GLFormat.cpp b/src/dawn_native/opengl/GLFormat.cpp
index 460690c..35b129f 100644
--- a/src/dawn_native/opengl/GLFormat.cpp
+++ b/src/dawn_native/opengl/GLFormat.cpp
@@ -21,7 +21,7 @@
using Type = GLFormat::ComponentType;
- auto AddFormat = [&table](dawn::TextureFormat dawnFormat, GLenum internalFormat,
+ auto AddFormat = [&table](wgpu::TextureFormat dawnFormat, GLenum internalFormat,
GLenum format, GLenum type, Type componentType) {
size_t index = ComputeFormatIndex(dawnFormat);
ASSERT(index < table.size());
@@ -44,71 +44,71 @@
// clang-format off
// 1 byte color formats
- AddFormat(dawn::TextureFormat::R8Unorm, GL_R8, GL_RED, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::R8Snorm, GL_R8_SNORM, GL_RED, GL_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::R8Uint, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, Type::Uint);
- AddFormat(dawn::TextureFormat::R8Sint, GL_R8I, GL_RED_INTEGER, GL_BYTE, Type::Int);
+ AddFormat(wgpu::TextureFormat::R8Unorm, GL_R8, GL_RED, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::R8Snorm, GL_R8_SNORM, GL_RED, GL_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::R8Uint, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, Type::Uint);
+ AddFormat(wgpu::TextureFormat::R8Sint, GL_R8I, GL_RED_INTEGER, GL_BYTE, Type::Int);
// 2 bytes color formats
- AddFormat(dawn::TextureFormat::R16Uint, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, Type::Uint);
- AddFormat(dawn::TextureFormat::R16Sint, GL_R16I, GL_RED_INTEGER, GL_SHORT, Type::Int);
- AddFormat(dawn::TextureFormat::R16Float, GL_R16F, GL_RED, GL_HALF_FLOAT, Type::Float);
- AddFormat(dawn::TextureFormat::RG8Unorm, GL_RG8, GL_RG, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::RG8Snorm, GL_RG8_SNORM, GL_RG, GL_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::RG8Uint, GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE, Type::Uint);
- AddFormat(dawn::TextureFormat::RG8Sint, GL_RG8I, GL_RG_INTEGER, GL_BYTE, Type::Int);
+ AddFormat(wgpu::TextureFormat::R16Uint, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, Type::Uint);
+ AddFormat(wgpu::TextureFormat::R16Sint, GL_R16I, GL_RED_INTEGER, GL_SHORT, Type::Int);
+ AddFormat(wgpu::TextureFormat::R16Float, GL_R16F, GL_RED, GL_HALF_FLOAT, Type::Float);
+ AddFormat(wgpu::TextureFormat::RG8Unorm, GL_RG8, GL_RG, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::RG8Snorm, GL_RG8_SNORM, GL_RG, GL_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::RG8Uint, GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE, Type::Uint);
+ AddFormat(wgpu::TextureFormat::RG8Sint, GL_RG8I, GL_RG_INTEGER, GL_BYTE, Type::Int);
// 4 bytes color formats
- AddFormat(dawn::TextureFormat::R32Uint, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, Type::Uint);
- AddFormat(dawn::TextureFormat::R32Sint, GL_R32I, GL_RED_INTEGER, GL_INT, Type::Int);
- AddFormat(dawn::TextureFormat::R32Float, GL_R32F, GL_RED, GL_FLOAT, Type::Float);
- AddFormat(dawn::TextureFormat::RG16Uint, GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, Type::Uint);
- AddFormat(dawn::TextureFormat::RG16Sint, GL_RG16I, GL_RG_INTEGER, GL_SHORT, Type::Int);
- AddFormat(dawn::TextureFormat::RG16Float, GL_RG16F, GL_RG, GL_HALF_FLOAT, Type::Float);
- AddFormat(dawn::TextureFormat::RGBA8Unorm, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::RGBA8UnormSrgb, GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::RGBA8Snorm, GL_RGBA8_SNORM, GL_RGBA, GL_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::RGBA8Uint, GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, Type::Uint);
- AddFormat(dawn::TextureFormat::RGBA8Sint, GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE, Type::Int);
+ AddFormat(wgpu::TextureFormat::R32Uint, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, Type::Uint);
+ AddFormat(wgpu::TextureFormat::R32Sint, GL_R32I, GL_RED_INTEGER, GL_INT, Type::Int);
+ AddFormat(wgpu::TextureFormat::R32Float, GL_R32F, GL_RED, GL_FLOAT, Type::Float);
+ AddFormat(wgpu::TextureFormat::RG16Uint, GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, Type::Uint);
+ AddFormat(wgpu::TextureFormat::RG16Sint, GL_RG16I, GL_RG_INTEGER, GL_SHORT, Type::Int);
+ AddFormat(wgpu::TextureFormat::RG16Float, GL_RG16F, GL_RG, GL_HALF_FLOAT, Type::Float);
+ AddFormat(wgpu::TextureFormat::RGBA8Unorm, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::RGBA8UnormSrgb, GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::RGBA8Snorm, GL_RGBA8_SNORM, GL_RGBA, GL_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::RGBA8Uint, GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, Type::Uint);
+ AddFormat(wgpu::TextureFormat::RGBA8Sint, GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE, Type::Int);
// This doesn't have an enum for the internal format in OpenGL, so use RGBA8.
- AddFormat(dawn::TextureFormat::BGRA8Unorm, GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::RGB10A2Unorm, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, Type::Float);
- AddFormat(dawn::TextureFormat::RG11B10Float, GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, Type::Float);
+ AddFormat(wgpu::TextureFormat::BGRA8Unorm, GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::RGB10A2Unorm, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, Type::Float);
+ AddFormat(wgpu::TextureFormat::RG11B10Float, GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, Type::Float);
// 8 bytes color formats
- AddFormat(dawn::TextureFormat::RG32Uint, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, Type::Uint);
- AddFormat(dawn::TextureFormat::RG32Sint, GL_RG32I, GL_RG_INTEGER, GL_INT, Type::Int);
- AddFormat(dawn::TextureFormat::RG32Float, GL_RG32F, GL_RG, GL_FLOAT, Type::Float);
- AddFormat(dawn::TextureFormat::RGBA16Uint, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, Type::Uint);
- AddFormat(dawn::TextureFormat::RGBA16Sint, GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT, Type::Int);
- AddFormat(dawn::TextureFormat::RGBA16Float, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, Type::Float);
+ AddFormat(wgpu::TextureFormat::RG32Uint, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, Type::Uint);
+ AddFormat(wgpu::TextureFormat::RG32Sint, GL_RG32I, GL_RG_INTEGER, GL_INT, Type::Int);
+ AddFormat(wgpu::TextureFormat::RG32Float, GL_RG32F, GL_RG, GL_FLOAT, Type::Float);
+ AddFormat(wgpu::TextureFormat::RGBA16Uint, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, Type::Uint);
+ AddFormat(wgpu::TextureFormat::RGBA16Sint, GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT, Type::Int);
+ AddFormat(wgpu::TextureFormat::RGBA16Float, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, Type::Float);
// 16 bytes color formats
- AddFormat(dawn::TextureFormat::RGBA32Uint, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, Type::Uint);
- AddFormat(dawn::TextureFormat::RGBA32Sint, GL_RGBA32I, GL_RGBA_INTEGER, GL_INT, Type::Int);
- AddFormat(dawn::TextureFormat::RGBA32Float, GL_RGBA32F, GL_RGBA, GL_FLOAT, Type::Float);
+ AddFormat(wgpu::TextureFormat::RGBA32Uint, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, Type::Uint);
+ AddFormat(wgpu::TextureFormat::RGBA32Sint, GL_RGBA32I, GL_RGBA_INTEGER, GL_INT, Type::Int);
+ AddFormat(wgpu::TextureFormat::RGBA32Float, GL_RGBA32F, GL_RGBA, GL_FLOAT, Type::Float);
// Depth stencil formats
- AddFormat(dawn::TextureFormat::Depth32Float, GL_DEPTH_COMPONENT32F, GL_DEPTH, GL_FLOAT, Type::DepthStencil);
- AddFormat(dawn::TextureFormat::Depth24Plus, GL_DEPTH_COMPONENT32F, GL_DEPTH, GL_FLOAT, Type::DepthStencil);
- AddFormat(dawn::TextureFormat::Depth24PlusStencil8, GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, Type::DepthStencil);
+ AddFormat(wgpu::TextureFormat::Depth32Float, GL_DEPTH_COMPONENT32F, GL_DEPTH, GL_FLOAT, Type::DepthStencil);
+ AddFormat(wgpu::TextureFormat::Depth24Plus, GL_DEPTH_COMPONENT32F, GL_DEPTH, GL_FLOAT, Type::DepthStencil);
+ AddFormat(wgpu::TextureFormat::Depth24PlusStencil8, GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, Type::DepthStencil);
// Block compressed formats
- AddFormat(dawn::TextureFormat::BC1RGBAUnorm, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC1RGBAUnormSrgb, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC2RGBAUnorm, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC2RGBAUnormSrgb, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC3RGBAUnorm, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC3RGBAUnormSrgb, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC4RSnorm, GL_COMPRESSED_SIGNED_RED_RGTC1, GL_RED, GL_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC4RUnorm, GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC5RGSnorm, GL_COMPRESSED_SIGNED_RG_RGTC2, GL_RG, GL_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC5RGUnorm, GL_COMPRESSED_RG_RGTC2, GL_RG, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC6HRGBSfloat, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, GL_RGB, GL_HALF_FLOAT, Type::Float);
- AddFormat(dawn::TextureFormat::BC6HRGBUfloat, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, GL_RGB, GL_HALF_FLOAT, Type::Float);
- AddFormat(dawn::TextureFormat::BC7RGBAUnorm, GL_COMPRESSED_RGBA_BPTC_UNORM, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
- AddFormat(dawn::TextureFormat::BC7RGBAUnormSrgb, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC1RGBAUnorm, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC1RGBAUnormSrgb, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC2RGBAUnorm, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC2RGBAUnormSrgb, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC3RGBAUnorm, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC3RGBAUnormSrgb, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC4RSnorm, GL_COMPRESSED_SIGNED_RED_RGTC1, GL_RED, GL_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC4RUnorm, GL_COMPRESSED_RED_RGTC1, GL_RED, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC5RGSnorm, GL_COMPRESSED_SIGNED_RG_RGTC2, GL_RG, GL_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC5RGUnorm, GL_COMPRESSED_RG_RGTC2, GL_RG, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC6HRGBSfloat, GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT, GL_RGB, GL_HALF_FLOAT, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC6HRGBUfloat, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT, GL_RGB, GL_HALF_FLOAT, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC7RGBAUnorm, GL_COMPRESSED_RGBA_BPTC_UNORM, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
+ AddFormat(wgpu::TextureFormat::BC7RGBAUnormSrgb, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM, GL_RGBA, GL_UNSIGNED_BYTE, Type::Float);
// clang-format on
diff --git a/src/dawn_native/opengl/NativeSwapChainImplGL.cpp b/src/dawn_native/opengl/NativeSwapChainImplGL.cpp
index f107875..0b5f294 100644
--- a/src/dawn_native/opengl/NativeSwapChainImplGL.cpp
+++ b/src/dawn_native/opengl/NativeSwapChainImplGL.cpp
@@ -80,8 +80,8 @@
return DAWN_SWAP_CHAIN_NO_ERROR;
}
- dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
- return dawn::TextureFormat::RGBA8Unorm;
+ wgpu::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
+ return wgpu::TextureFormat::RGBA8Unorm;
}
}} // namespace dawn_native::opengl
diff --git a/src/dawn_native/opengl/NativeSwapChainImplGL.h b/src/dawn_native/opengl/NativeSwapChainImplGL.h
index 81a5dc9..2729e4c 100644
--- a/src/dawn_native/opengl/NativeSwapChainImplGL.h
+++ b/src/dawn_native/opengl/NativeSwapChainImplGL.h
@@ -39,7 +39,7 @@
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
DawnSwapChainError Present();
- dawn::TextureFormat GetPreferredFormat() const;
+ wgpu::TextureFormat GetPreferredFormat() const;
private:
PresentCallback mPresentCallback;
diff --git a/src/dawn_native/opengl/PipelineGL.cpp b/src/dawn_native/opengl/PipelineGL.cpp
index 57d7264..d76b091 100644
--- a/src/dawn_native/opengl/PipelineGL.cpp
+++ b/src/dawn_native/opengl/PipelineGL.cpp
@@ -74,7 +74,7 @@
mProgram = gl.CreateProgram();
- dawn::ShaderStage activeStages = dawn::ShaderStage::None;
+ wgpu::ShaderStage activeStages = wgpu::ShaderStage::None;
for (SingleShaderStage stage : IterateStages(kAllStages)) {
if (modules[stage] != nullptr) {
activeStages |= StageBit(stage);
@@ -118,14 +118,14 @@
std::string name = GetBindingName(group, binding);
switch (groupInfo.types[binding]) {
- case dawn::BindingType::UniformBuffer: {
+ case wgpu::BindingType::UniformBuffer: {
GLint location = gl.GetUniformBlockIndex(mProgram, name.c_str());
if (location != -1) {
gl.UniformBlockBinding(mProgram, location, indices[group][binding]);
}
} break;
- case dawn::BindingType::StorageBuffer: {
+ case wgpu::BindingType::StorageBuffer: {
GLuint location = gl.GetProgramResourceIndex(
mProgram, GL_SHADER_STORAGE_BLOCK, name.c_str());
if (location != GL_INVALID_INDEX) {
@@ -134,14 +134,14 @@
}
} break;
- case dawn::BindingType::Sampler:
- case dawn::BindingType::SampledTexture:
+ case wgpu::BindingType::Sampler:
+ case wgpu::BindingType::SampledTexture:
// These binding types are handled in the separate sampler and texture
// emulation
break;
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
@@ -177,11 +177,11 @@
indices[combined.textureLocation.group][combined.textureLocation.binding];
mUnitsForTextures[textureIndex].push_back(textureUnit);
- dawn::TextureComponentType componentType =
+ wgpu::TextureComponentType componentType =
layout->GetBindGroupLayout(combined.textureLocation.group)
->GetBindingInfo()
.textureComponentTypes[combined.textureLocation.binding];
- bool shouldUseFiltering = componentType == dawn::TextureComponentType::Float;
+ bool shouldUseFiltering = componentType == wgpu::TextureComponentType::Float;
GLuint samplerIndex =
indices[combined.samplerLocation.group][combined.samplerLocation.binding];
diff --git a/src/dawn_native/opengl/PipelineLayoutGL.cpp b/src/dawn_native/opengl/PipelineLayoutGL.cpp
index 713c2bc..2884dfa 100644
--- a/src/dawn_native/opengl/PipelineLayoutGL.cpp
+++ b/src/dawn_native/opengl/PipelineLayoutGL.cpp
@@ -36,26 +36,26 @@
}
switch (groupInfo.types[binding]) {
- case dawn::BindingType::UniformBuffer:
+ case wgpu::BindingType::UniformBuffer:
mIndexInfo[group][binding] = uboIndex;
uboIndex++;
break;
- case dawn::BindingType::Sampler:
+ case wgpu::BindingType::Sampler:
mIndexInfo[group][binding] = samplerIndex;
samplerIndex++;
break;
- case dawn::BindingType::SampledTexture:
+ case wgpu::BindingType::SampledTexture:
mIndexInfo[group][binding] = sampledTextureIndex;
sampledTextureIndex++;
break;
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
mIndexInfo[group][binding] = ssboIndex;
ssboIndex++;
break;
- case dawn::BindingType::StorageTexture:
- case dawn::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::StorageTexture:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
UNREACHABLE();
break;
diff --git a/src/dawn_native/opengl/RenderPipelineGL.cpp b/src/dawn_native/opengl/RenderPipelineGL.cpp
index efbe761..b7e7448 100644
--- a/src/dawn_native/opengl/RenderPipelineGL.cpp
+++ b/src/dawn_native/opengl/RenderPipelineGL.cpp
@@ -23,17 +23,17 @@
namespace {
- GLenum GLPrimitiveTopology(dawn::PrimitiveTopology primitiveTopology) {
+ GLenum GLPrimitiveTopology(wgpu::PrimitiveTopology primitiveTopology) {
switch (primitiveTopology) {
- case dawn::PrimitiveTopology::PointList:
+ case wgpu::PrimitiveTopology::PointList:
return GL_POINTS;
- case dawn::PrimitiveTopology::LineList:
+ case wgpu::PrimitiveTopology::LineList:
return GL_LINES;
- case dawn::PrimitiveTopology::LineStrip:
+ case wgpu::PrimitiveTopology::LineStrip:
return GL_LINE_STRIP;
- case dawn::PrimitiveTopology::TriangleList:
+ case wgpu::PrimitiveTopology::TriangleList:
return GL_TRIANGLES;
- case dawn::PrimitiveTopology::TriangleStrip:
+ case wgpu::PrimitiveTopology::TriangleStrip:
return GL_TRIANGLE_STRIP;
default:
UNREACHABLE();
@@ -41,66 +41,66 @@
}
void ApplyFrontFaceAndCulling(const OpenGLFunctions& gl,
- dawn::FrontFace face,
- dawn::CullMode mode) {
- if (mode == dawn::CullMode::None) {
+ wgpu::FrontFace face,
+ wgpu::CullMode mode) {
+ if (mode == wgpu::CullMode::None) {
gl.Disable(GL_CULL_FACE);
} else {
gl.Enable(GL_CULL_FACE);
// Note that we invert winding direction in OpenGL. Because Y axis is up in OpenGL,
// which is different from WebGPU and other backends (Y axis is down).
- GLenum direction = (face == dawn::FrontFace::CCW) ? GL_CW : GL_CCW;
+ GLenum direction = (face == wgpu::FrontFace::CCW) ? GL_CW : GL_CCW;
gl.FrontFace(direction);
- GLenum cullMode = (mode == dawn::CullMode::Front) ? GL_FRONT : GL_BACK;
+ GLenum cullMode = (mode == wgpu::CullMode::Front) ? GL_FRONT : GL_BACK;
gl.CullFace(cullMode);
}
}
- GLenum GLBlendFactor(dawn::BlendFactor factor, bool alpha) {
+ GLenum GLBlendFactor(wgpu::BlendFactor factor, bool alpha) {
switch (factor) {
- case dawn::BlendFactor::Zero:
+ case wgpu::BlendFactor::Zero:
return GL_ZERO;
- case dawn::BlendFactor::One:
+ case wgpu::BlendFactor::One:
return GL_ONE;
- case dawn::BlendFactor::SrcColor:
+ case wgpu::BlendFactor::SrcColor:
return GL_SRC_COLOR;
- case dawn::BlendFactor::OneMinusSrcColor:
+ case wgpu::BlendFactor::OneMinusSrcColor:
return GL_ONE_MINUS_SRC_COLOR;
- case dawn::BlendFactor::SrcAlpha:
+ case wgpu::BlendFactor::SrcAlpha:
return GL_SRC_ALPHA;
- case dawn::BlendFactor::OneMinusSrcAlpha:
+ case wgpu::BlendFactor::OneMinusSrcAlpha:
return GL_ONE_MINUS_SRC_ALPHA;
- case dawn::BlendFactor::DstColor:
+ case wgpu::BlendFactor::DstColor:
return GL_DST_COLOR;
- case dawn::BlendFactor::OneMinusDstColor:
+ case wgpu::BlendFactor::OneMinusDstColor:
return GL_ONE_MINUS_DST_COLOR;
- case dawn::BlendFactor::DstAlpha:
+ case wgpu::BlendFactor::DstAlpha:
return GL_DST_ALPHA;
- case dawn::BlendFactor::OneMinusDstAlpha:
+ case wgpu::BlendFactor::OneMinusDstAlpha:
return GL_ONE_MINUS_DST_ALPHA;
- case dawn::BlendFactor::SrcAlphaSaturated:
+ case wgpu::BlendFactor::SrcAlphaSaturated:
return GL_SRC_ALPHA_SATURATE;
- case dawn::BlendFactor::BlendColor:
+ case wgpu::BlendFactor::BlendColor:
return alpha ? GL_CONSTANT_ALPHA : GL_CONSTANT_COLOR;
- case dawn::BlendFactor::OneMinusBlendColor:
+ case wgpu::BlendFactor::OneMinusBlendColor:
return alpha ? GL_ONE_MINUS_CONSTANT_ALPHA : GL_ONE_MINUS_CONSTANT_COLOR;
default:
UNREACHABLE();
}
}
- GLenum GLBlendMode(dawn::BlendOperation operation) {
+ GLenum GLBlendMode(wgpu::BlendOperation operation) {
switch (operation) {
- case dawn::BlendOperation::Add:
+ case wgpu::BlendOperation::Add:
return GL_FUNC_ADD;
- case dawn::BlendOperation::Subtract:
+ case wgpu::BlendOperation::Subtract:
return GL_FUNC_SUBTRACT;
- case dawn::BlendOperation::ReverseSubtract:
+ case wgpu::BlendOperation::ReverseSubtract:
return GL_FUNC_REVERSE_SUBTRACT;
- case dawn::BlendOperation::Min:
+ case wgpu::BlendOperation::Min:
return GL_MIN;
- case dawn::BlendOperation::Max:
+ case wgpu::BlendOperation::Max:
return GL_MAX;
default:
UNREACHABLE();
@@ -122,29 +122,29 @@
} else {
gl.Disablei(GL_BLEND, attachment);
}
- gl.ColorMaski(attachment, descriptor->writeMask & dawn::ColorWriteMask::Red,
- descriptor->writeMask & dawn::ColorWriteMask::Green,
- descriptor->writeMask & dawn::ColorWriteMask::Blue,
- descriptor->writeMask & dawn::ColorWriteMask::Alpha);
+ gl.ColorMaski(attachment, descriptor->writeMask & wgpu::ColorWriteMask::Red,
+ descriptor->writeMask & wgpu::ColorWriteMask::Green,
+ descriptor->writeMask & wgpu::ColorWriteMask::Blue,
+ descriptor->writeMask & wgpu::ColorWriteMask::Alpha);
}
- GLuint OpenGLStencilOperation(dawn::StencilOperation stencilOperation) {
+ GLuint OpenGLStencilOperation(wgpu::StencilOperation stencilOperation) {
switch (stencilOperation) {
- case dawn::StencilOperation::Keep:
+ case wgpu::StencilOperation::Keep:
return GL_KEEP;
- case dawn::StencilOperation::Zero:
+ case wgpu::StencilOperation::Zero:
return GL_ZERO;
- case dawn::StencilOperation::Replace:
+ case wgpu::StencilOperation::Replace:
return GL_REPLACE;
- case dawn::StencilOperation::Invert:
+ case wgpu::StencilOperation::Invert:
return GL_INVERT;
- case dawn::StencilOperation::IncrementClamp:
+ case wgpu::StencilOperation::IncrementClamp:
return GL_INCR;
- case dawn::StencilOperation::DecrementClamp:
+ case wgpu::StencilOperation::DecrementClamp:
return GL_DECR;
- case dawn::StencilOperation::IncrementWrap:
+ case wgpu::StencilOperation::IncrementWrap:
return GL_INCR_WRAP;
- case dawn::StencilOperation::DecrementWrap:
+ case wgpu::StencilOperation::DecrementWrap:
return GL_DECR_WRAP;
default:
UNREACHABLE();
@@ -155,7 +155,7 @@
const DepthStencilStateDescriptor* descriptor,
PersistentPipelineState* persistentPipelineState) {
// Depth writes only occur if depth is enabled
- if (descriptor->depthCompare == dawn::CompareFunction::Always &&
+ if (descriptor->depthCompare == wgpu::CompareFunction::Always &&
!descriptor->depthWriteEnabled) {
gl.Disable(GL_DEPTH_TEST);
} else {
@@ -234,9 +234,9 @@
gl.VertexAttribDivisor(location, 0xffffffff);
} else {
switch (input.stepMode) {
- case dawn::InputStepMode::Vertex:
+ case wgpu::InputStepMode::Vertex:
break;
- case dawn::InputStepMode::Instance:
+ case wgpu::InputStepMode::Instance:
gl.VertexAttribDivisor(location, 1);
break;
default:
diff --git a/src/dawn_native/opengl/SamplerGL.cpp b/src/dawn_native/opengl/SamplerGL.cpp
index 17bf353..aef7abb 100644
--- a/src/dawn_native/opengl/SamplerGL.cpp
+++ b/src/dawn_native/opengl/SamplerGL.cpp
@@ -21,33 +21,33 @@
namespace dawn_native { namespace opengl {
namespace {
- GLenum MagFilterMode(dawn::FilterMode filter) {
+ GLenum MagFilterMode(wgpu::FilterMode filter) {
switch (filter) {
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
return GL_NEAREST;
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
return GL_LINEAR;
default:
UNREACHABLE();
}
}
- GLenum MinFilterMode(dawn::FilterMode minFilter, dawn::FilterMode mipMapFilter) {
+ GLenum MinFilterMode(wgpu::FilterMode minFilter, wgpu::FilterMode mipMapFilter) {
switch (minFilter) {
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
switch (mipMapFilter) {
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
return GL_NEAREST_MIPMAP_NEAREST;
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
return GL_NEAREST_MIPMAP_LINEAR;
default:
UNREACHABLE();
}
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
switch (mipMapFilter) {
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
return GL_LINEAR_MIPMAP_NEAREST;
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
return GL_LINEAR_MIPMAP_LINEAR;
default:
UNREACHABLE();
@@ -57,13 +57,13 @@
}
}
- GLenum WrapMode(dawn::AddressMode mode) {
+ GLenum WrapMode(wgpu::AddressMode mode) {
switch (mode) {
- case dawn::AddressMode::Repeat:
+ case wgpu::AddressMode::Repeat:
return GL_REPEAT;
- case dawn::AddressMode::MirrorRepeat:
+ case wgpu::AddressMode::MirrorRepeat:
return GL_MIRRORED_REPEAT;
- case dawn::AddressMode::ClampToEdge:
+ case wgpu::AddressMode::ClampToEdge:
return GL_CLAMP_TO_EDGE;
default:
UNREACHABLE();
diff --git a/src/dawn_native/opengl/SwapChainGL.cpp b/src/dawn_native/opengl/SwapChainGL.cpp
index bbd7074..ea72bca 100644
--- a/src/dawn_native/opengl/SwapChainGL.cpp
+++ b/src/dawn_native/opengl/SwapChainGL.cpp
@@ -36,7 +36,7 @@
DawnSwapChainNextTexture next = {};
DawnSwapChainError error = im.GetNextTexture(im.userData, &next);
if (error) {
- GetDevice()->HandleError(dawn::ErrorType::Unknown, error);
+ GetDevice()->HandleError(wgpu::ErrorType::Unknown, error);
return nullptr;
}
GLuint nativeTexture = next.texture.u32;
diff --git a/src/dawn_native/opengl/TextureGL.cpp b/src/dawn_native/opengl/TextureGL.cpp
index 1eed793..7647d21 100644
--- a/src/dawn_native/opengl/TextureGL.cpp
+++ b/src/dawn_native/opengl/TextureGL.cpp
@@ -27,7 +27,7 @@
GLenum TargetForTexture(const TextureDescriptor* descriptor) {
switch (descriptor->dimension) {
- case dawn::TextureDimension::e2D:
+ case wgpu::TextureDimension::e2D:
if (descriptor->arrayLayerCount > 1) {
ASSERT(descriptor->sampleCount == 1);
return GL_TEXTURE_2D_ARRAY;
@@ -45,17 +45,17 @@
}
}
- GLenum TargetForTextureViewDimension(dawn::TextureViewDimension dimension,
+ GLenum TargetForTextureViewDimension(wgpu::TextureViewDimension dimension,
uint32_t sampleCount) {
switch (dimension) {
- case dawn::TextureViewDimension::e2D:
+ case wgpu::TextureViewDimension::e2D:
return (sampleCount > 1) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;
- case dawn::TextureViewDimension::e2DArray:
+ case wgpu::TextureViewDimension::e2DArray:
ASSERT(sampleCount == 1);
return GL_TEXTURE_2D_ARRAY;
- case dawn::TextureViewDimension::Cube:
+ case wgpu::TextureViewDimension::Cube:
return GL_TEXTURE_CUBE_MAP;
- case dawn::TextureViewDimension::CubeArray:
+ case wgpu::TextureViewDimension::CubeArray:
return GL_TEXTURE_CUBE_MAP_ARRAY;
default:
UNREACHABLE();
@@ -69,9 +69,9 @@
return handle;
}
- bool UsageNeedsTextureView(dawn::TextureUsage usage) {
- constexpr dawn::TextureUsage kUsageNeedingTextureView =
- dawn::TextureUsage::Storage | dawn::TextureUsage::Sampled;
+ bool UsageNeedsTextureView(wgpu::TextureUsage usage) {
+ constexpr wgpu::TextureUsage kUsageNeedingTextureView =
+ wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled;
return usage & kUsageNeedingTextureView;
}
@@ -90,8 +90,8 @@
}
switch (textureViewDescriptor->dimension) {
- case dawn::TextureViewDimension::Cube:
- case dawn::TextureViewDimension::CubeArray:
+ case wgpu::TextureViewDimension::Cube:
+ case wgpu::TextureViewDimension::CubeArray:
return true;
default:
break;
@@ -122,7 +122,7 @@
// GL_TRUE, so the storage of the texture must be allocated with glTexStorage*D.
// https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTextureView.xhtml
switch (GetDimension()) {
- case dawn::TextureDimension::e2D:
+ case wgpu::TextureDimension::e2D:
if (arrayLayers > 1) {
ASSERT(!IsMultisampledTexture());
gl.TexStorage3D(mTarget, levels, glFormat.internalFormat, width, height,
@@ -254,7 +254,7 @@
return DAWN_OUT_OF_MEMORY_ERROR("Unable to allocate buffer.");
}
descriptor.nextInChain = nullptr;
- descriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::MapWrite;
+ descriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::MapWrite;
// TODO(natlee@microsoft.com): use Dynamic Uplaoder here for temp buffer
Ref<Buffer> srcBuffer = ToBackend(device->CreateBuffer(&descriptor));
// Call release here to prevent memory leak since CreateBuffer will up the ref count to
@@ -280,7 +280,7 @@
Extent3D size = GetMipLevelPhysicalSize(level);
switch (GetDimension()) {
- case dawn::TextureDimension::e2D:
+ case wgpu::TextureDimension::e2D:
// TODO(natlee@microsoft.com): This will break when layerCount is greater
// than 1, because the buffer is only sized for one layer.
ASSERT(layerCount == 1);
diff --git a/src/dawn_native/opengl/UtilsGL.cpp b/src/dawn_native/opengl/UtilsGL.cpp
index 00a4fca..3905b26 100644
--- a/src/dawn_native/opengl/UtilsGL.cpp
+++ b/src/dawn_native/opengl/UtilsGL.cpp
@@ -18,32 +18,32 @@
namespace dawn_native { namespace opengl {
- GLuint ToOpenGLCompareFunction(dawn::CompareFunction compareFunction) {
+ GLuint ToOpenGLCompareFunction(wgpu::CompareFunction compareFunction) {
switch (compareFunction) {
- case dawn::CompareFunction::Never:
+ case wgpu::CompareFunction::Never:
return GL_NEVER;
- case dawn::CompareFunction::Less:
+ case wgpu::CompareFunction::Less:
return GL_LESS;
- case dawn::CompareFunction::LessEqual:
+ case wgpu::CompareFunction::LessEqual:
return GL_LEQUAL;
- case dawn::CompareFunction::Greater:
+ case wgpu::CompareFunction::Greater:
return GL_GREATER;
- case dawn::CompareFunction::GreaterEqual:
+ case wgpu::CompareFunction::GreaterEqual:
return GL_GEQUAL;
- case dawn::CompareFunction::NotEqual:
+ case wgpu::CompareFunction::NotEqual:
return GL_NOTEQUAL;
- case dawn::CompareFunction::Equal:
+ case wgpu::CompareFunction::Equal:
return GL_EQUAL;
- case dawn::CompareFunction::Always:
+ case wgpu::CompareFunction::Always:
return GL_ALWAYS;
default:
UNREACHABLE();
}
}
- GLint GetStencilMaskFromStencilFormat(dawn::TextureFormat depthStencilFormat) {
+ GLint GetStencilMaskFromStencilFormat(wgpu::TextureFormat depthStencilFormat) {
switch (depthStencilFormat) {
- case dawn::TextureFormat::Depth24PlusStencil8:
+ case wgpu::TextureFormat::Depth24PlusStencil8:
return 0xFF;
default:
UNREACHABLE();
diff --git a/src/dawn_native/opengl/UtilsGL.h b/src/dawn_native/opengl/UtilsGL.h
index 5c8f8ed..2f87b37 100644
--- a/src/dawn_native/opengl/UtilsGL.h
+++ b/src/dawn_native/opengl/UtilsGL.h
@@ -20,8 +20,8 @@
namespace dawn_native { namespace opengl {
- GLuint ToOpenGLCompareFunction(dawn::CompareFunction compareFunction);
- GLint GetStencilMaskFromStencilFormat(dawn::TextureFormat depthStencilFormat);
+ GLuint ToOpenGLCompareFunction(wgpu::CompareFunction compareFunction);
+ GLint GetStencilMaskFromStencilFormat(wgpu::TextureFormat depthStencilFormat);
}} // namespace dawn_native::opengl
#endif // DAWNNATIVE_OPENGL_UTILSGL_H_
diff --git a/src/dawn_native/vulkan/BindGroupLayoutVk.cpp b/src/dawn_native/vulkan/BindGroupLayoutVk.cpp
index 336d9a6..48e200a 100644
--- a/src/dawn_native/vulkan/BindGroupLayoutVk.cpp
+++ b/src/dawn_native/vulkan/BindGroupLayoutVk.cpp
@@ -22,16 +22,16 @@
namespace {
- VkShaderStageFlags VulkanShaderStageFlags(dawn::ShaderStage stages) {
+ VkShaderStageFlags VulkanShaderStageFlags(wgpu::ShaderStage stages) {
VkShaderStageFlags flags = 0;
- if (stages & dawn::ShaderStage::Vertex) {
+ if (stages & wgpu::ShaderStage::Vertex) {
flags |= VK_SHADER_STAGE_VERTEX_BIT;
}
- if (stages & dawn::ShaderStage::Fragment) {
+ if (stages & wgpu::ShaderStage::Fragment) {
flags |= VK_SHADER_STAGE_FRAGMENT_BIT;
}
- if (stages & dawn::ShaderStage::Compute) {
+ if (stages & wgpu::ShaderStage::Compute) {
flags |= VK_SHADER_STAGE_COMPUTE_BIT;
}
@@ -40,18 +40,18 @@
} // anonymous namespace
- VkDescriptorType VulkanDescriptorType(dawn::BindingType type, bool isDynamic) {
+ VkDescriptorType VulkanDescriptorType(wgpu::BindingType type, bool isDynamic) {
switch (type) {
- case dawn::BindingType::UniformBuffer:
+ case wgpu::BindingType::UniformBuffer:
if (isDynamic) {
return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
}
return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
- case dawn::BindingType::Sampler:
+ case wgpu::BindingType::Sampler:
return VK_DESCRIPTOR_TYPE_SAMPLER;
- case dawn::BindingType::SampledTexture:
+ case wgpu::BindingType::SampledTexture:
return VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
if (isDynamic) {
return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC;
}
@@ -132,15 +132,15 @@
MAX_TYPE,
};
static_assert(MAX_TYPE == kMaxPoolSizesNeeded, "");
- auto ToDescriptorType = [](dawn::BindingType type) -> DescriptorType {
+ auto ToDescriptorType = [](wgpu::BindingType type) -> DescriptorType {
switch (type) {
- case dawn::BindingType::UniformBuffer:
+ case wgpu::BindingType::UniformBuffer:
return UNIFORM_BUFFER;
- case dawn::BindingType::Sampler:
+ case wgpu::BindingType::Sampler:
return SAMPLER;
- case dawn::BindingType::SampledTexture:
+ case wgpu::BindingType::SampledTexture:
return SAMPLED_IMAGE;
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
return STORAGE_BUFFER;
default:
UNREACHABLE();
diff --git a/src/dawn_native/vulkan/BindGroupLayoutVk.h b/src/dawn_native/vulkan/BindGroupLayoutVk.h
index 12ba2b6..0a71cc2 100644
--- a/src/dawn_native/vulkan/BindGroupLayoutVk.h
+++ b/src/dawn_native/vulkan/BindGroupLayoutVk.h
@@ -23,7 +23,7 @@
class Device;
- VkDescriptorType VulkanDescriptorType(dawn::BindingType type, bool isDynamic);
+ VkDescriptorType VulkanDescriptorType(wgpu::BindingType type, bool isDynamic);
class BindGroupLayout : public BindGroupLayoutBase {
public:
diff --git a/src/dawn_native/vulkan/BindGroupVk.cpp b/src/dawn_native/vulkan/BindGroupVk.cpp
index aa0f5b5..f4f4709 100644
--- a/src/dawn_native/vulkan/BindGroupVk.cpp
+++ b/src/dawn_native/vulkan/BindGroupVk.cpp
@@ -88,8 +88,8 @@
layoutInfo.hasDynamicOffset[bindingIndex]);
switch (layoutInfo.types[bindingIndex]) {
- case dawn::BindingType::UniformBuffer:
- case dawn::BindingType::StorageBuffer: {
+ case wgpu::BindingType::UniformBuffer:
+ case wgpu::BindingType::StorageBuffer: {
BufferBinding binding = GetBindingAsBufferBinding(bindingIndex);
writeBufferInfo[numWrites].buffer = ToBackend(binding.buffer)->GetHandle();
@@ -98,13 +98,13 @@
write.pBufferInfo = &writeBufferInfo[numWrites];
} break;
- case dawn::BindingType::Sampler: {
+ case wgpu::BindingType::Sampler: {
Sampler* sampler = ToBackend(GetBindingAsSampler(bindingIndex));
writeImageInfo[numWrites].sampler = sampler->GetHandle();
write.pImageInfo = &writeImageInfo[numWrites];
} break;
- case dawn::BindingType::SampledTexture: {
+ case wgpu::BindingType::SampledTexture: {
TextureView* view = ToBackend(GetBindingAsTextureView(bindingIndex));
writeImageInfo[numWrites].imageView = view->GetHandle();
diff --git a/src/dawn_native/vulkan/BufferVk.cpp b/src/dawn_native/vulkan/BufferVk.cpp
index 2133457..d4841fd 100644
--- a/src/dawn_native/vulkan/BufferVk.cpp
+++ b/src/dawn_native/vulkan/BufferVk.cpp
@@ -26,86 +26,86 @@
namespace {
- VkBufferUsageFlags VulkanBufferUsage(dawn::BufferUsage usage) {
+ VkBufferUsageFlags VulkanBufferUsage(wgpu::BufferUsage usage) {
VkBufferUsageFlags flags = 0;
- if (usage & dawn::BufferUsage::CopySrc) {
+ if (usage & wgpu::BufferUsage::CopySrc) {
flags |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
}
- if (usage & dawn::BufferUsage::CopyDst) {
+ if (usage & wgpu::BufferUsage::CopyDst) {
flags |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;
}
- if (usage & dawn::BufferUsage::Index) {
+ if (usage & wgpu::BufferUsage::Index) {
flags |= VK_BUFFER_USAGE_INDEX_BUFFER_BIT;
}
- if (usage & dawn::BufferUsage::Vertex) {
+ if (usage & wgpu::BufferUsage::Vertex) {
flags |= VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
}
- if (usage & dawn::BufferUsage::Uniform) {
+ if (usage & wgpu::BufferUsage::Uniform) {
flags |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
}
- if (usage & dawn::BufferUsage::Storage) {
+ if (usage & wgpu::BufferUsage::Storage) {
flags |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
}
- if (usage & dawn::BufferUsage::Indirect) {
+ if (usage & wgpu::BufferUsage::Indirect) {
flags |= VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT;
}
return flags;
}
- VkPipelineStageFlags VulkanPipelineStage(dawn::BufferUsage usage) {
+ VkPipelineStageFlags VulkanPipelineStage(wgpu::BufferUsage usage) {
VkPipelineStageFlags flags = 0;
- if (usage & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) {
+ if (usage & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) {
flags |= VK_PIPELINE_STAGE_HOST_BIT;
}
- if (usage & (dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst)) {
+ if (usage & (wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst)) {
flags |= VK_PIPELINE_STAGE_TRANSFER_BIT;
}
- if (usage & (dawn::BufferUsage::Index | dawn::BufferUsage::Vertex)) {
+ if (usage & (wgpu::BufferUsage::Index | wgpu::BufferUsage::Vertex)) {
flags |= VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
}
- if (usage & (dawn::BufferUsage::Uniform | dawn::BufferUsage::Storage)) {
+ if (usage & (wgpu::BufferUsage::Uniform | wgpu::BufferUsage::Storage)) {
flags |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT |
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
}
- if (usage & dawn::BufferUsage::Indirect) {
+ if (usage & wgpu::BufferUsage::Indirect) {
flags |= VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT;
}
return flags;
}
- VkAccessFlags VulkanAccessFlags(dawn::BufferUsage usage) {
+ VkAccessFlags VulkanAccessFlags(wgpu::BufferUsage usage) {
VkAccessFlags flags = 0;
- if (usage & dawn::BufferUsage::MapRead) {
+ if (usage & wgpu::BufferUsage::MapRead) {
flags |= VK_ACCESS_HOST_READ_BIT;
}
- if (usage & dawn::BufferUsage::MapWrite) {
+ if (usage & wgpu::BufferUsage::MapWrite) {
flags |= VK_ACCESS_HOST_WRITE_BIT;
}
- if (usage & dawn::BufferUsage::CopySrc) {
+ if (usage & wgpu::BufferUsage::CopySrc) {
flags |= VK_ACCESS_TRANSFER_READ_BIT;
}
- if (usage & dawn::BufferUsage::CopyDst) {
+ if (usage & wgpu::BufferUsage::CopyDst) {
flags |= VK_ACCESS_TRANSFER_WRITE_BIT;
}
- if (usage & dawn::BufferUsage::Index) {
+ if (usage & wgpu::BufferUsage::Index) {
flags |= VK_ACCESS_INDEX_READ_BIT;
}
- if (usage & dawn::BufferUsage::Vertex) {
+ if (usage & wgpu::BufferUsage::Vertex) {
flags |= VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT;
}
- if (usage & dawn::BufferUsage::Uniform) {
+ if (usage & wgpu::BufferUsage::Uniform) {
flags |= VK_ACCESS_UNIFORM_READ_BIT;
}
- if (usage & dawn::BufferUsage::Storage) {
+ if (usage & wgpu::BufferUsage::Storage) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
- if (usage & dawn::BufferUsage::Indirect) {
+ if (usage & wgpu::BufferUsage::Indirect) {
flags |= VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
}
@@ -129,7 +129,7 @@
createInfo.size = GetSize();
// Add CopyDst for non-mappable buffer initialization in CreateBufferMapped
// and robust resource initialization.
- createInfo.usage = VulkanBufferUsage(GetUsage() | dawn::BufferUsage::CopyDst);
+ createInfo.usage = VulkanBufferUsage(GetUsage() | wgpu::BufferUsage::CopyDst);
createInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
createInfo.queueFamilyIndexCount = 0;
createInfo.pQueueFamilyIndices = 0;
@@ -143,7 +143,7 @@
device->fn.GetBufferMemoryRequirements(device->GetVkDevice(), mHandle, &requirements);
bool requestMappable =
- (GetUsage() & (dawn::BufferUsage::MapRead | dawn::BufferUsage::MapWrite)) != 0;
+ (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
DAWN_TRY_ASSIGN(mMemoryAllocation, device->AllocateMemory(requirements, requestMappable));
DAWN_TRY(CheckVkSuccess(
@@ -172,7 +172,7 @@
}
void Buffer::TransitionUsageNow(CommandRecordingContext* recordingContext,
- dawn::BufferUsage usage) {
+ wgpu::BufferUsage usage) {
bool lastIncludesTarget = (mLastUsage & usage) == usage;
bool lastReadOnly = (mLastUsage & kReadOnlyBufferUsages) == mLastUsage;
@@ -182,7 +182,7 @@
}
// Special-case for the initial transition: Vulkan doesn't allow access flags to be 0.
- if (mLastUsage == dawn::BufferUsage::None) {
+ if (mLastUsage == wgpu::BufferUsage::None) {
mLastUsage = usage;
return;
}
@@ -222,7 +222,7 @@
Device* device = ToBackend(GetDevice());
CommandRecordingContext* recordingContext = device->GetPendingRecordingContext();
- TransitionUsageNow(recordingContext, dawn::BufferUsage::MapRead);
+ TransitionUsageNow(recordingContext, wgpu::BufferUsage::MapRead);
uint8_t* memory = mMemoryAllocation.GetMappedPointer();
ASSERT(memory != nullptr);
@@ -236,7 +236,7 @@
Device* device = ToBackend(GetDevice());
CommandRecordingContext* recordingContext = device->GetPendingRecordingContext();
- TransitionUsageNow(recordingContext, dawn::BufferUsage::MapWrite);
+ TransitionUsageNow(recordingContext, wgpu::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 210fadc..ff8cf62 100644
--- a/src/dawn_native/vulkan/BufferVk.h
+++ b/src/dawn_native/vulkan/BufferVk.h
@@ -40,7 +40,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::BufferUsage usage);
+ void TransitionUsageNow(CommandRecordingContext* recordingContext, wgpu::BufferUsage usage);
private:
using BufferBase::BufferBase;
@@ -58,7 +58,7 @@
VkBuffer mHandle = VK_NULL_HANDLE;
ResourceMemoryAllocation mMemoryAllocation;
- dawn::BufferUsage mLastUsage = dawn::BufferUsage::None;
+ wgpu::BufferUsage mLastUsage = wgpu::BufferUsage::None;
};
class MapRequestTracker {
diff --git a/src/dawn_native/vulkan/CommandBufferVk.cpp b/src/dawn_native/vulkan/CommandBufferVk.cpp
index dc3d670..0836b01 100644
--- a/src/dawn_native/vulkan/CommandBufferVk.cpp
+++ b/src/dawn_native/vulkan/CommandBufferVk.cpp
@@ -35,11 +35,11 @@
namespace {
- VkIndexType VulkanIndexType(dawn::IndexFormat format) {
+ VkIndexType VulkanIndexType(wgpu::IndexFormat format) {
switch (format) {
- case dawn::IndexFormat::Uint16:
+ case wgpu::IndexFormat::Uint16:
return VK_INDEX_TYPE_UINT16;
- case dawn::IndexFormat::Uint32:
+ case wgpu::IndexFormat::Uint32:
return VK_INDEX_TYPE_UINT32;
default:
UNREACHABLE();
@@ -142,19 +142,19 @@
for (uint32_t index : IterateBitSet(mBindGroupLayoutsMask)) {
for (uint32_t binding : IterateBitSet(mBuffersNeedingBarrier[index])) {
switch (mBindingTypes[index][binding]) {
- case dawn::BindingType::StorageBuffer:
+ case wgpu::BindingType::StorageBuffer:
ToBackend(mBuffers[index][binding])
->TransitionUsageNow(recordingContext,
- dawn::BufferUsage::Storage);
+ wgpu::BufferUsage::Storage);
break;
- case dawn::BindingType::StorageTexture:
+ case wgpu::BindingType::StorageTexture:
// Not implemented.
- case dawn::BindingType::UniformBuffer:
- case dawn::BindingType::ReadonlyStorageBuffer:
- case dawn::BindingType::Sampler:
- case dawn::BindingType::SampledTexture:
+ case wgpu::BindingType::UniformBuffer:
+ case wgpu::BindingType::ReadonlyStorageBuffer:
+ case wgpu::BindingType::Sampler:
+ case wgpu::BindingType::SampledTexture:
// Don't require barriers.
default:
@@ -183,13 +183,13 @@
TextureView* view = ToBackend(attachmentInfo.view.Get());
bool hasResolveTarget = attachmentInfo.resolveTarget.Get() != nullptr;
- dawn::LoadOp loadOp = attachmentInfo.loadOp;
+ wgpu::LoadOp loadOp = attachmentInfo.loadOp;
ASSERT(view->GetLayerCount() == 1);
ASSERT(view->GetLevelCount() == 1);
- if (loadOp == dawn::LoadOp::Load &&
+ if (loadOp == wgpu::LoadOp::Load &&
!view->GetTexture()->IsSubresourceContentInitialized(
view->GetBaseMipLevel(), 1, view->GetBaseArrayLayer(), 1)) {
- loadOp = dawn::LoadOp::Clear;
+ loadOp = wgpu::LoadOp::Clear;
}
if (hasResolveTarget) {
@@ -204,12 +204,12 @@
}
switch (attachmentInfo.storeOp) {
- case dawn::StoreOp::Store: {
+ case wgpu::StoreOp::Store: {
view->GetTexture()->SetIsSubresourceContentInitialized(
true, view->GetBaseMipLevel(), 1, view->GetBaseArrayLayer(), 1);
} break;
- case dawn::StoreOp::Clear: {
+ case wgpu::StoreOp::Clear: {
view->GetTexture()->SetIsSubresourceContentInitialized(
false, view->GetBaseMipLevel(), 1, view->GetBaseArrayLayer(), 1);
} break;
@@ -231,26 +231,26 @@
view->GetBaseMipLevel(), view->GetLevelCount(),
view->GetBaseArrayLayer(), view->GetLayerCount())) {
if (view->GetTexture()->GetFormat().HasDepth() &&
- attachmentInfo.depthLoadOp == dawn::LoadOp::Load) {
+ attachmentInfo.depthLoadOp == wgpu::LoadOp::Load) {
attachmentInfo.clearDepth = 0.0f;
- attachmentInfo.depthLoadOp = dawn::LoadOp::Clear;
+ attachmentInfo.depthLoadOp = wgpu::LoadOp::Clear;
}
if (view->GetTexture()->GetFormat().HasStencil() &&
- attachmentInfo.stencilLoadOp == dawn::LoadOp::Load) {
+ attachmentInfo.stencilLoadOp == wgpu::LoadOp::Load) {
attachmentInfo.clearStencil = 0u;
- attachmentInfo.stencilLoadOp = dawn::LoadOp::Clear;
+ attachmentInfo.stencilLoadOp = wgpu::LoadOp::Clear;
}
}
query.SetDepthStencil(view->GetTexture()->GetFormat().format,
attachmentInfo.depthLoadOp, attachmentInfo.stencilLoadOp);
- if (attachmentInfo.depthStoreOp == dawn::StoreOp::Store &&
- attachmentInfo.stencilStoreOp == dawn::StoreOp::Store) {
+ if (attachmentInfo.depthStoreOp == wgpu::StoreOp::Store &&
+ attachmentInfo.stencilStoreOp == wgpu::StoreOp::Store) {
view->GetTexture()->SetIsSubresourceContentInitialized(
true, view->GetBaseMipLevel(), view->GetLevelCount(),
view->GetBaseArrayLayer(), view->GetLayerCount());
- } else if (attachmentInfo.depthStoreOp == dawn::StoreOp::Clear &&
- attachmentInfo.stencilStoreOp == dawn::StoreOp::Clear) {
+ } else if (attachmentInfo.depthStoreOp == wgpu::StoreOp::Clear &&
+ attachmentInfo.stencilStoreOp == wgpu::StoreOp::Clear) {
view->GetTexture()->SetIsSubresourceContentInitialized(
false, view->GetBaseMipLevel(), view->GetLevelCount(),
view->GetBaseArrayLayer(), view->GetLayerCount());
@@ -382,7 +382,7 @@
format.blockByteSize;
BufferDescriptor tempBufferDescriptor;
tempBufferDescriptor.size = tempBufferSize;
- tempBufferDescriptor.usage = dawn::BufferUsage::CopySrc | dawn::BufferUsage::CopyDst;
+ tempBufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
Device* device = ToBackend(GetDevice());
Ref<Buffer> tempBuffer = AcquireRef(ToBackend(device->CreateBuffer(&tempBufferDescriptor)));
@@ -397,7 +397,7 @@
VkImage srcImage = ToBackend(srcCopy.texture)->GetHandle();
VkImage dstImage = ToBackend(dstCopy.texture)->GetHandle();
- tempBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopyDst);
+ tempBuffer->TransitionUsageNow(recordingContext, wgpu::BufferUsage::CopyDst);
VkBufferImageCopy srcToTempBufferRegion =
ComputeBufferImageCopyRegion(tempBufferCopy, srcCopy, copySize);
@@ -405,7 +405,7 @@
device->fn.CmdCopyImageToBuffer(commands, srcImage, VK_IMAGE_LAYOUT_GENERAL,
tempBuffer->GetHandle(), 1, &srcToTempBufferRegion);
- tempBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
+ tempBuffer->TransitionUsageNow(recordingContext, wgpu::BufferUsage::CopySrc);
VkBufferImageCopy tempBufferToDstRegion =
ComputeBufferImageCopyRegion(tempBufferCopy, dstCopy, copySize);
@@ -434,7 +434,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::TextureUsage::OutputAttachment)) {
+ if (!(usages.textureUsages[i] & wgpu::TextureUsage::OutputAttachment)) {
texture->EnsureSubresourceContentInitialized(recordingContext, 0,
texture->GetNumMipLevels(), 0,
texture->GetArrayLayers());
@@ -453,8 +453,8 @@
Buffer* srcBuffer = ToBackend(copy->source.Get());
Buffer* dstBuffer = ToBackend(copy->destination.Get());
- srcBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
- dstBuffer->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopyDst);
+ srcBuffer->TransitionUsageNow(recordingContext, wgpu::BufferUsage::CopySrc);
+ dstBuffer->TransitionUsageNow(recordingContext, wgpu::BufferUsage::CopyDst);
VkBufferCopy region;
region.srcOffset = copy->sourceOffset;
@@ -487,9 +487,9 @@
subresource.baseArrayLayer, 1);
}
ToBackend(src.buffer)
- ->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopySrc);
+ ->TransitionUsageNow(recordingContext, wgpu::BufferUsage::CopySrc);
ToBackend(dst.texture)
- ->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopyDst);
+ ->TransitionUsageNow(recordingContext, wgpu::TextureUsage::CopyDst);
VkBuffer srcBuffer = ToBackend(src.buffer)->GetHandle();
VkImage dstImage = ToBackend(dst.texture)->GetHandle();
@@ -515,9 +515,9 @@
subresource.baseArrayLayer, 1);
ToBackend(src.texture)
- ->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopySrc);
+ ->TransitionUsageNow(recordingContext, wgpu::TextureUsage::CopySrc);
ToBackend(dst.buffer)
- ->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopyDst);
+ ->TransitionUsageNow(recordingContext, wgpu::BufferUsage::CopyDst);
VkImage srcImage = ToBackend(src.texture)->GetHandle();
VkBuffer dstBuffer = ToBackend(dst.buffer)->GetHandle();
@@ -547,9 +547,9 @@
}
ToBackend(src.texture)
- ->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopySrc);
+ ->TransitionUsageNow(recordingContext, wgpu::TextureUsage::CopySrc);
ToBackend(dst.texture)
- ->TransitionUsageNow(recordingContext, dawn::TextureUsage::CopyDst);
+ ->TransitionUsageNow(recordingContext, wgpu::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 15385ab..c57f2e8 100644
--- a/src/dawn_native/vulkan/DeviceVk.cpp
+++ b/src/dawn_native/vulkan/DeviceVk.cpp
@@ -572,7 +572,7 @@
// Insert pipeline barrier to ensure correct ordering with previous memory operations on the
// buffer.
- ToBackend(destination)->TransitionUsageNow(recordingContext, dawn::BufferUsage::CopyDst);
+ ToBackend(destination)->TransitionUsageNow(recordingContext, wgpu::BufferUsage::CopyDst);
VkBufferCopy copy;
copy.srcOffset = sourceOffset;
diff --git a/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp b/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp
index bd7e499..76b66ca 100644
--- a/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp
+++ b/src/dawn_native/vulkan/NativeSwapChainImplVk.cpp
@@ -52,7 +52,7 @@
// driver. Need to generalize
config->nativeFormat = VK_FORMAT_B8G8R8A8_UNORM;
config->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
- config->format = dawn::TextureFormat::BGRA8Unorm;
+ config->format = wgpu::TextureFormat::BGRA8Unorm;
config->minImageCount = 3;
// TODO(cwallez@chromium.org): This is upside down compared to what we want, at least
// on Linux
@@ -121,7 +121,7 @@
createInfo.imageExtent.width = width;
createInfo.imageExtent.height = height;
createInfo.imageArrayLayers = 1;
- createInfo.imageUsage = VulkanImageUsage(static_cast<dawn::TextureUsage>(usage),
+ createInfo.imageUsage = VulkanImageUsage(static_cast<wgpu::TextureUsage>(usage),
mDevice->GetValidInternalFormat(mConfig.format));
createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
createInfo.queueFamilyIndexCount = 0;
@@ -236,7 +236,7 @@
return DAWN_SWAP_CHAIN_NO_ERROR;
}
- dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
+ wgpu::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
return mConfig.format;
}
diff --git a/src/dawn_native/vulkan/NativeSwapChainImplVk.h b/src/dawn_native/vulkan/NativeSwapChainImplVk.h
index c213cb4..e4e2658 100644
--- a/src/dawn_native/vulkan/NativeSwapChainImplVk.h
+++ b/src/dawn_native/vulkan/NativeSwapChainImplVk.h
@@ -39,11 +39,11 @@
DawnSwapChainError GetNextTexture(DawnSwapChainNextTexture* nextTexture);
DawnSwapChainError Present();
- dawn::TextureFormat GetPreferredFormat() const;
+ wgpu::TextureFormat GetPreferredFormat() const;
struct ChosenConfig {
VkFormat nativeFormat;
- dawn::TextureFormat format;
+ wgpu::TextureFormat format;
VkColorSpaceKHR colorSpace;
VkSurfaceTransformFlagBitsKHR preTransform;
uint32_t minImageCount;
diff --git a/src/dawn_native/vulkan/RenderPassCache.cpp b/src/dawn_native/vulkan/RenderPassCache.cpp
index e6c79f1..1f3f940 100644
--- a/src/dawn_native/vulkan/RenderPassCache.cpp
+++ b/src/dawn_native/vulkan/RenderPassCache.cpp
@@ -23,11 +23,11 @@
namespace dawn_native { namespace vulkan {
namespace {
- VkAttachmentLoadOp VulkanAttachmentLoadOp(dawn::LoadOp op) {
+ VkAttachmentLoadOp VulkanAttachmentLoadOp(wgpu::LoadOp op) {
switch (op) {
- case dawn::LoadOp::Load:
+ case wgpu::LoadOp::Load:
return VK_ATTACHMENT_LOAD_OP_LOAD;
- case dawn::LoadOp::Clear:
+ case wgpu::LoadOp::Clear:
return VK_ATTACHMENT_LOAD_OP_CLEAR;
default:
UNREACHABLE();
@@ -38,8 +38,8 @@
// RenderPassCacheQuery
void RenderPassCacheQuery::SetColor(uint32_t index,
- dawn::TextureFormat format,
- dawn::LoadOp loadOp,
+ wgpu::TextureFormat format,
+ wgpu::LoadOp loadOp,
bool hasResolveTarget) {
colorMask.set(index);
colorFormats[index] = format;
@@ -47,9 +47,9 @@
resolveTargetMask[index] = hasResolveTarget;
}
- void RenderPassCacheQuery::SetDepthStencil(dawn::TextureFormat format,
- dawn::LoadOp depthLoadOp,
- dawn::LoadOp stencilLoadOp) {
+ void RenderPassCacheQuery::SetDepthStencil(wgpu::TextureFormat format,
+ wgpu::LoadOp depthLoadOp,
+ wgpu::LoadOp stencilLoadOp) {
hasDepthStencil = true;
depthStencilFormat = format;
this->depthLoadOp = depthLoadOp;
diff --git a/src/dawn_native/vulkan/RenderPassCache.h b/src/dawn_native/vulkan/RenderPassCache.h
index 3a4eeee..6af675b 100644
--- a/src/dawn_native/vulkan/RenderPassCache.h
+++ b/src/dawn_native/vulkan/RenderPassCache.h
@@ -35,23 +35,23 @@
// Use these helpers to build the query, they make sure all relevant data is initialized and
// masks set.
void SetColor(uint32_t index,
- dawn::TextureFormat format,
- dawn::LoadOp loadOp,
+ wgpu::TextureFormat format,
+ wgpu::LoadOp loadOp,
bool hasResolveTarget);
- void SetDepthStencil(dawn::TextureFormat format,
- dawn::LoadOp depthLoadOp,
- dawn::LoadOp stencilLoadOp);
+ void SetDepthStencil(wgpu::TextureFormat format,
+ wgpu::LoadOp depthLoadOp,
+ wgpu::LoadOp stencilLoadOp);
void SetSampleCount(uint32_t sampleCount);
std::bitset<kMaxColorAttachments> colorMask;
std::bitset<kMaxColorAttachments> resolveTargetMask;
- std::array<dawn::TextureFormat, kMaxColorAttachments> colorFormats;
- std::array<dawn::LoadOp, kMaxColorAttachments> colorLoadOp;
+ std::array<wgpu::TextureFormat, kMaxColorAttachments> colorFormats;
+ std::array<wgpu::LoadOp, kMaxColorAttachments> colorLoadOp;
bool hasDepthStencil = false;
- dawn::TextureFormat depthStencilFormat;
- dawn::LoadOp depthLoadOp;
- dawn::LoadOp stencilLoadOp;
+ wgpu::TextureFormat depthStencilFormat;
+ wgpu::LoadOp depthLoadOp;
+ wgpu::LoadOp stencilLoadOp;
uint32_t sampleCount;
};
diff --git a/src/dawn_native/vulkan/RenderPipelineVk.cpp b/src/dawn_native/vulkan/RenderPipelineVk.cpp
index 2e84df0..9a32628 100644
--- a/src/dawn_native/vulkan/RenderPipelineVk.cpp
+++ b/src/dawn_native/vulkan/RenderPipelineVk.cpp
@@ -27,200 +27,200 @@
namespace {
- VkVertexInputRate VulkanInputRate(dawn::InputStepMode stepMode) {
+ VkVertexInputRate VulkanInputRate(wgpu::InputStepMode stepMode) {
switch (stepMode) {
- case dawn::InputStepMode::Vertex:
+ case wgpu::InputStepMode::Vertex:
return VK_VERTEX_INPUT_RATE_VERTEX;
- case dawn::InputStepMode::Instance:
+ case wgpu::InputStepMode::Instance:
return VK_VERTEX_INPUT_RATE_INSTANCE;
default:
UNREACHABLE();
}
}
- VkFormat VulkanVertexFormat(dawn::VertexFormat format) {
+ VkFormat VulkanVertexFormat(wgpu::VertexFormat format) {
switch (format) {
- case dawn::VertexFormat::UChar2:
+ case wgpu::VertexFormat::UChar2:
return VK_FORMAT_R8G8_UINT;
- case dawn::VertexFormat::UChar4:
+ case wgpu::VertexFormat::UChar4:
return VK_FORMAT_R8G8B8A8_UINT;
- case dawn::VertexFormat::Char2:
+ case wgpu::VertexFormat::Char2:
return VK_FORMAT_R8G8_SINT;
- case dawn::VertexFormat::Char4:
+ case wgpu::VertexFormat::Char4:
return VK_FORMAT_R8G8B8A8_SINT;
- case dawn::VertexFormat::UChar2Norm:
+ case wgpu::VertexFormat::UChar2Norm:
return VK_FORMAT_R8G8_UNORM;
- case dawn::VertexFormat::UChar4Norm:
+ case wgpu::VertexFormat::UChar4Norm:
return VK_FORMAT_R8G8B8A8_UNORM;
- case dawn::VertexFormat::Char2Norm:
+ case wgpu::VertexFormat::Char2Norm:
return VK_FORMAT_R8G8_SNORM;
- case dawn::VertexFormat::Char4Norm:
+ case wgpu::VertexFormat::Char4Norm:
return VK_FORMAT_R8G8B8A8_SNORM;
- case dawn::VertexFormat::UShort2:
+ case wgpu::VertexFormat::UShort2:
return VK_FORMAT_R16G16_UINT;
- case dawn::VertexFormat::UShort4:
+ case wgpu::VertexFormat::UShort4:
return VK_FORMAT_R16G16B16A16_UINT;
- case dawn::VertexFormat::Short2:
+ case wgpu::VertexFormat::Short2:
return VK_FORMAT_R16G16_SINT;
- case dawn::VertexFormat::Short4:
+ case wgpu::VertexFormat::Short4:
return VK_FORMAT_R16G16B16A16_SINT;
- case dawn::VertexFormat::UShort2Norm:
+ case wgpu::VertexFormat::UShort2Norm:
return VK_FORMAT_R16G16_UNORM;
- case dawn::VertexFormat::UShort4Norm:
+ case wgpu::VertexFormat::UShort4Norm:
return VK_FORMAT_R16G16B16A16_UNORM;
- case dawn::VertexFormat::Short2Norm:
+ case wgpu::VertexFormat::Short2Norm:
return VK_FORMAT_R16G16_SNORM;
- case dawn::VertexFormat::Short4Norm:
+ case wgpu::VertexFormat::Short4Norm:
return VK_FORMAT_R16G16B16A16_SNORM;
- case dawn::VertexFormat::Half2:
+ case wgpu::VertexFormat::Half2:
return VK_FORMAT_R16G16_SFLOAT;
- case dawn::VertexFormat::Half4:
+ case wgpu::VertexFormat::Half4:
return VK_FORMAT_R16G16B16A16_SFLOAT;
- case dawn::VertexFormat::Float:
+ case wgpu::VertexFormat::Float:
return VK_FORMAT_R32_SFLOAT;
- case dawn::VertexFormat::Float2:
+ case wgpu::VertexFormat::Float2:
return VK_FORMAT_R32G32_SFLOAT;
- case dawn::VertexFormat::Float3:
+ case wgpu::VertexFormat::Float3:
return VK_FORMAT_R32G32B32_SFLOAT;
- case dawn::VertexFormat::Float4:
+ case wgpu::VertexFormat::Float4:
return VK_FORMAT_R32G32B32A32_SFLOAT;
- case dawn::VertexFormat::UInt:
+ case wgpu::VertexFormat::UInt:
return VK_FORMAT_R32_UINT;
- case dawn::VertexFormat::UInt2:
+ case wgpu::VertexFormat::UInt2:
return VK_FORMAT_R32G32_UINT;
- case dawn::VertexFormat::UInt3:
+ case wgpu::VertexFormat::UInt3:
return VK_FORMAT_R32G32B32_UINT;
- case dawn::VertexFormat::UInt4:
+ case wgpu::VertexFormat::UInt4:
return VK_FORMAT_R32G32B32A32_UINT;
- case dawn::VertexFormat::Int:
+ case wgpu::VertexFormat::Int:
return VK_FORMAT_R32_SINT;
- case dawn::VertexFormat::Int2:
+ case wgpu::VertexFormat::Int2:
return VK_FORMAT_R32G32_SINT;
- case dawn::VertexFormat::Int3:
+ case wgpu::VertexFormat::Int3:
return VK_FORMAT_R32G32B32_SINT;
- case dawn::VertexFormat::Int4:
+ case wgpu::VertexFormat::Int4:
return VK_FORMAT_R32G32B32A32_SINT;
default:
UNREACHABLE();
}
}
- VkPrimitiveTopology VulkanPrimitiveTopology(dawn::PrimitiveTopology topology) {
+ VkPrimitiveTopology VulkanPrimitiveTopology(wgpu::PrimitiveTopology topology) {
switch (topology) {
- case dawn::PrimitiveTopology::PointList:
+ case wgpu::PrimitiveTopology::PointList:
return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
- case dawn::PrimitiveTopology::LineList:
+ case wgpu::PrimitiveTopology::LineList:
return VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
- case dawn::PrimitiveTopology::LineStrip:
+ case wgpu::PrimitiveTopology::LineStrip:
return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
- case dawn::PrimitiveTopology::TriangleList:
+ case wgpu::PrimitiveTopology::TriangleList:
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
- case dawn::PrimitiveTopology::TriangleStrip:
+ case wgpu::PrimitiveTopology::TriangleStrip:
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
default:
UNREACHABLE();
}
}
- bool ShouldEnablePrimitiveRestart(dawn::PrimitiveTopology topology) {
+ bool ShouldEnablePrimitiveRestart(wgpu::PrimitiveTopology topology) {
// Primitive restart is always enabled in WebGPU but Vulkan validation rules ask that
// primitive restart be only enabled on primitive topologies that support restarting.
switch (topology) {
- case dawn::PrimitiveTopology::PointList:
- case dawn::PrimitiveTopology::LineList:
- case dawn::PrimitiveTopology::TriangleList:
+ case wgpu::PrimitiveTopology::PointList:
+ case wgpu::PrimitiveTopology::LineList:
+ case wgpu::PrimitiveTopology::TriangleList:
return false;
- case dawn::PrimitiveTopology::LineStrip:
- case dawn::PrimitiveTopology::TriangleStrip:
+ case wgpu::PrimitiveTopology::LineStrip:
+ case wgpu::PrimitiveTopology::TriangleStrip:
return true;
default:
UNREACHABLE();
}
}
- VkFrontFace VulkanFrontFace(dawn::FrontFace face) {
+ VkFrontFace VulkanFrontFace(wgpu::FrontFace face) {
switch (face) {
- case dawn::FrontFace::CCW:
+ case wgpu::FrontFace::CCW:
return VK_FRONT_FACE_COUNTER_CLOCKWISE;
- case dawn::FrontFace::CW:
+ case wgpu::FrontFace::CW:
return VK_FRONT_FACE_CLOCKWISE;
}
}
- VkCullModeFlagBits VulkanCullMode(dawn::CullMode mode) {
+ VkCullModeFlagBits VulkanCullMode(wgpu::CullMode mode) {
switch (mode) {
- case dawn::CullMode::None:
+ case wgpu::CullMode::None:
return VK_CULL_MODE_NONE;
- case dawn::CullMode::Front:
+ case wgpu::CullMode::Front:
return VK_CULL_MODE_FRONT_BIT;
- case dawn::CullMode::Back:
+ case wgpu::CullMode::Back:
return VK_CULL_MODE_BACK_BIT;
}
}
- VkBlendFactor VulkanBlendFactor(dawn::BlendFactor factor) {
+ VkBlendFactor VulkanBlendFactor(wgpu::BlendFactor factor) {
switch (factor) {
- case dawn::BlendFactor::Zero:
+ case wgpu::BlendFactor::Zero:
return VK_BLEND_FACTOR_ZERO;
- case dawn::BlendFactor::One:
+ case wgpu::BlendFactor::One:
return VK_BLEND_FACTOR_ONE;
- case dawn::BlendFactor::SrcColor:
+ case wgpu::BlendFactor::SrcColor:
return VK_BLEND_FACTOR_SRC_COLOR;
- case dawn::BlendFactor::OneMinusSrcColor:
+ case wgpu::BlendFactor::OneMinusSrcColor:
return VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR;
- case dawn::BlendFactor::SrcAlpha:
+ case wgpu::BlendFactor::SrcAlpha:
return VK_BLEND_FACTOR_SRC_ALPHA;
- case dawn::BlendFactor::OneMinusSrcAlpha:
+ case wgpu::BlendFactor::OneMinusSrcAlpha:
return VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
- case dawn::BlendFactor::DstColor:
+ case wgpu::BlendFactor::DstColor:
return VK_BLEND_FACTOR_DST_COLOR;
- case dawn::BlendFactor::OneMinusDstColor:
+ case wgpu::BlendFactor::OneMinusDstColor:
return VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR;
- case dawn::BlendFactor::DstAlpha:
+ case wgpu::BlendFactor::DstAlpha:
return VK_BLEND_FACTOR_DST_ALPHA;
- case dawn::BlendFactor::OneMinusDstAlpha:
+ case wgpu::BlendFactor::OneMinusDstAlpha:
return VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA;
- case dawn::BlendFactor::SrcAlphaSaturated:
+ case wgpu::BlendFactor::SrcAlphaSaturated:
return VK_BLEND_FACTOR_SRC_ALPHA_SATURATE;
- case dawn::BlendFactor::BlendColor:
+ case wgpu::BlendFactor::BlendColor:
return VK_BLEND_FACTOR_CONSTANT_COLOR;
- case dawn::BlendFactor::OneMinusBlendColor:
+ case wgpu::BlendFactor::OneMinusBlendColor:
return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR;
default:
UNREACHABLE();
}
}
- VkBlendOp VulkanBlendOperation(dawn::BlendOperation operation) {
+ VkBlendOp VulkanBlendOperation(wgpu::BlendOperation operation) {
switch (operation) {
- case dawn::BlendOperation::Add:
+ case wgpu::BlendOperation::Add:
return VK_BLEND_OP_ADD;
- case dawn::BlendOperation::Subtract:
+ case wgpu::BlendOperation::Subtract:
return VK_BLEND_OP_SUBTRACT;
- case dawn::BlendOperation::ReverseSubtract:
+ case wgpu::BlendOperation::ReverseSubtract:
return VK_BLEND_OP_REVERSE_SUBTRACT;
- case dawn::BlendOperation::Min:
+ case wgpu::BlendOperation::Min:
return VK_BLEND_OP_MIN;
- case dawn::BlendOperation::Max:
+ case wgpu::BlendOperation::Max:
return VK_BLEND_OP_MAX;
default:
UNREACHABLE();
}
}
- VkColorComponentFlags VulkanColorWriteMask(dawn::ColorWriteMask mask,
+ VkColorComponentFlags VulkanColorWriteMask(wgpu::ColorWriteMask mask,
bool isDeclaredInFragmentShader) {
// Vulkan and Dawn color write masks match, static assert it and return the mask
- static_assert(static_cast<VkColorComponentFlagBits>(dawn::ColorWriteMask::Red) ==
+ static_assert(static_cast<VkColorComponentFlagBits>(wgpu::ColorWriteMask::Red) ==
VK_COLOR_COMPONENT_R_BIT,
"");
- static_assert(static_cast<VkColorComponentFlagBits>(dawn::ColorWriteMask::Green) ==
+ static_assert(static_cast<VkColorComponentFlagBits>(wgpu::ColorWriteMask::Green) ==
VK_COLOR_COMPONENT_G_BIT,
"");
- static_assert(static_cast<VkColorComponentFlagBits>(dawn::ColorWriteMask::Blue) ==
+ static_assert(static_cast<VkColorComponentFlagBits>(wgpu::ColorWriteMask::Blue) ==
VK_COLOR_COMPONENT_B_BIT,
"");
- static_assert(static_cast<VkColorComponentFlagBits>(dawn::ColorWriteMask::Alpha) ==
+ static_assert(static_cast<VkColorComponentFlagBits>(wgpu::ColorWriteMask::Alpha) ==
VK_COLOR_COMPONENT_A_BIT,
"");
@@ -247,23 +247,23 @@
return attachment;
}
- VkStencilOp VulkanStencilOp(dawn::StencilOperation op) {
+ VkStencilOp VulkanStencilOp(wgpu::StencilOperation op) {
switch (op) {
- case dawn::StencilOperation::Keep:
+ case wgpu::StencilOperation::Keep:
return VK_STENCIL_OP_KEEP;
- case dawn::StencilOperation::Zero:
+ case wgpu::StencilOperation::Zero:
return VK_STENCIL_OP_ZERO;
- case dawn::StencilOperation::Replace:
+ case wgpu::StencilOperation::Replace:
return VK_STENCIL_OP_REPLACE;
- case dawn::StencilOperation::IncrementClamp:
+ case wgpu::StencilOperation::IncrementClamp:
return VK_STENCIL_OP_INCREMENT_AND_CLAMP;
- case dawn::StencilOperation::DecrementClamp:
+ case wgpu::StencilOperation::DecrementClamp:
return VK_STENCIL_OP_DECREMENT_AND_CLAMP;
- case dawn::StencilOperation::Invert:
+ case wgpu::StencilOperation::Invert:
return VK_STENCIL_OP_INVERT;
- case dawn::StencilOperation::IncrementWrap:
+ case wgpu::StencilOperation::IncrementWrap:
return VK_STENCIL_OP_INCREMENT_AND_WRAP;
- case dawn::StencilOperation::DecrementWrap:
+ case wgpu::StencilOperation::DecrementWrap:
return VK_STENCIL_OP_DECREMENT_AND_WRAP;
default:
UNREACHABLE();
@@ -279,7 +279,7 @@
// Depth writes only occur if depth is enabled
depthStencilState.depthTestEnable =
- (descriptor->depthCompare == dawn::CompareFunction::Always &&
+ (descriptor->depthCompare == wgpu::CompareFunction::Always &&
!descriptor->depthWriteEnabled)
? VK_FALSE
: VK_TRUE;
@@ -464,12 +464,12 @@
RenderPassCacheQuery query;
for (uint32_t i : IterateBitSet(GetColorAttachmentsMask())) {
- query.SetColor(i, GetColorAttachmentFormat(i), dawn::LoadOp::Load, false);
+ query.SetColor(i, GetColorAttachmentFormat(i), wgpu::LoadOp::Load, false);
}
if (HasDepthStencilAttachment()) {
- query.SetDepthStencil(GetDepthStencilFormat(), dawn::LoadOp::Load,
- dawn::LoadOp::Load);
+ query.SetDepthStencil(GetDepthStencilFormat(), wgpu::LoadOp::Load,
+ wgpu::LoadOp::Load);
}
query.SetSampleCount(GetSampleCount());
diff --git a/src/dawn_native/vulkan/SamplerVk.cpp b/src/dawn_native/vulkan/SamplerVk.cpp
index 633fb5d..05baf71 100644
--- a/src/dawn_native/vulkan/SamplerVk.cpp
+++ b/src/dawn_native/vulkan/SamplerVk.cpp
@@ -22,35 +22,35 @@
namespace dawn_native { namespace vulkan {
namespace {
- VkSamplerAddressMode VulkanSamplerAddressMode(dawn::AddressMode mode) {
+ VkSamplerAddressMode VulkanSamplerAddressMode(wgpu::AddressMode mode) {
switch (mode) {
- case dawn::AddressMode::Repeat:
+ case wgpu::AddressMode::Repeat:
return VK_SAMPLER_ADDRESS_MODE_REPEAT;
- case dawn::AddressMode::MirrorRepeat:
+ case wgpu::AddressMode::MirrorRepeat:
return VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT;
- case dawn::AddressMode::ClampToEdge:
+ case wgpu::AddressMode::ClampToEdge:
return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
default:
UNREACHABLE();
}
}
- VkFilter VulkanSamplerFilter(dawn::FilterMode filter) {
+ VkFilter VulkanSamplerFilter(wgpu::FilterMode filter) {
switch (filter) {
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
return VK_FILTER_LINEAR;
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
return VK_FILTER_NEAREST;
default:
UNREACHABLE();
}
}
- VkSamplerMipmapMode VulkanMipMapMode(dawn::FilterMode filter) {
+ VkSamplerMipmapMode VulkanMipMapMode(wgpu::FilterMode filter) {
switch (filter) {
- case dawn::FilterMode::Linear:
+ case wgpu::FilterMode::Linear:
return VK_SAMPLER_MIPMAP_MODE_LINEAR;
- case dawn::FilterMode::Nearest:
+ case wgpu::FilterMode::Nearest:
return VK_SAMPLER_MIPMAP_MODE_NEAREST;
default:
UNREACHABLE();
diff --git a/src/dawn_native/vulkan/SwapChainVk.cpp b/src/dawn_native/vulkan/SwapChainVk.cpp
index b465bd0..eb36627 100644
--- a/src/dawn_native/vulkan/SwapChainVk.cpp
+++ b/src/dawn_native/vulkan/SwapChainVk.cpp
@@ -31,7 +31,7 @@
im.Init(im.userData, &wsiContext);
ASSERT(im.textureUsage != DAWN_TEXTURE_USAGE_NONE);
- mTextureUsage = static_cast<dawn::TextureUsage>(im.textureUsage);
+ mTextureUsage = static_cast<wgpu::TextureUsage>(im.textureUsage);
}
SwapChain::~SwapChain() {
@@ -43,7 +43,7 @@
DawnSwapChainError error = im.GetNextTexture(im.userData, &next);
if (error) {
- GetDevice()->HandleError(dawn::ErrorType::Unknown, error);
+ GetDevice()->HandleError(wgpu::ErrorType::Unknown, error);
return nullptr;
}
diff --git a/src/dawn_native/vulkan/SwapChainVk.h b/src/dawn_native/vulkan/SwapChainVk.h
index 339d9da..1d8ce43 100644
--- a/src/dawn_native/vulkan/SwapChainVk.h
+++ b/src/dawn_native/vulkan/SwapChainVk.h
@@ -35,7 +35,7 @@
MaybeError OnBeforePresent(TextureBase* texture) override;
private:
- dawn::TextureUsage mTextureUsage;
+ wgpu::TextureUsage mTextureUsage;
};
}} // namespace dawn_native::vulkan
diff --git a/src/dawn_native/vulkan/TextureVk.cpp b/src/dawn_native/vulkan/TextureVk.cpp
index 40d6ef7..695eceb 100644
--- a/src/dawn_native/vulkan/TextureVk.cpp
+++ b/src/dawn_native/vulkan/TextureVk.cpp
@@ -34,9 +34,9 @@
// Converts an Dawn texture dimension to a Vulkan image type.
// Note that in Vulkan dimensionality is only 1D, 2D, 3D. Arrays and cube maps are expressed
// via the array size and a "cubemap compatible" flag.
- VkImageType VulkanImageType(dawn::TextureDimension dimension) {
+ VkImageType VulkanImageType(wgpu::TextureDimension dimension) {
switch (dimension) {
- case dawn::TextureDimension::e2D:
+ case wgpu::TextureDimension::e2D:
return VK_IMAGE_TYPE_2D;
default:
UNREACHABLE();
@@ -45,15 +45,15 @@
// Converts an Dawn texture dimension to a Vulkan image view type.
// Contrary to image types, image view types include arrayness and cubemapness
- VkImageViewType VulkanImageViewType(dawn::TextureViewDimension dimension) {
+ VkImageViewType VulkanImageViewType(wgpu::TextureViewDimension dimension) {
switch (dimension) {
- case dawn::TextureViewDimension::e2D:
+ case wgpu::TextureViewDimension::e2D:
return VK_IMAGE_VIEW_TYPE_2D;
- case dawn::TextureViewDimension::e2DArray:
+ case wgpu::TextureViewDimension::e2DArray:
return VK_IMAGE_VIEW_TYPE_2D_ARRAY;
- case dawn::TextureViewDimension::Cube:
+ case wgpu::TextureViewDimension::Cube:
return VK_IMAGE_VIEW_TYPE_CUBE;
- case dawn::TextureViewDimension::CubeArray:
+ case wgpu::TextureViewDimension::CubeArray:
return VK_IMAGE_VIEW_TYPE_CUBE_ARRAY;
default:
UNREACHABLE();
@@ -61,22 +61,22 @@
}
// Computes which vulkan access type could be required for the given Dawn usage.
- VkAccessFlags VulkanAccessFlags(dawn::TextureUsage usage, const Format& format) {
+ VkAccessFlags VulkanAccessFlags(wgpu::TextureUsage usage, const Format& format) {
VkAccessFlags flags = 0;
- if (usage & dawn::TextureUsage::CopySrc) {
+ if (usage & wgpu::TextureUsage::CopySrc) {
flags |= VK_ACCESS_TRANSFER_READ_BIT;
}
- if (usage & dawn::TextureUsage::CopyDst) {
+ if (usage & wgpu::TextureUsage::CopyDst) {
flags |= VK_ACCESS_TRANSFER_WRITE_BIT;
}
- if (usage & dawn::TextureUsage::Sampled) {
+ if (usage & wgpu::TextureUsage::Sampled) {
flags |= VK_ACCESS_SHADER_READ_BIT;
}
- if (usage & dawn::TextureUsage::Storage) {
+ if (usage & wgpu::TextureUsage::Storage) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
- if (usage & dawn::TextureUsage::OutputAttachment) {
+ if (usage & wgpu::TextureUsage::OutputAttachment) {
if (format.HasDepthOrStencil()) {
flags |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
@@ -85,7 +85,7 @@
VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
}
}
- if (usage & dawn::TextureUsage::Present) {
+ if (usage & wgpu::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
@@ -98,38 +98,38 @@
}
// Chooses which Vulkan image layout should be used for the given Dawn usage
- VkImageLayout VulkanImageLayout(dawn::TextureUsage usage, const Format& format) {
- if (usage == dawn::TextureUsage::None) {
+ VkImageLayout VulkanImageLayout(wgpu::TextureUsage usage, const Format& format) {
+ if (usage == wgpu::TextureUsage::None) {
return VK_IMAGE_LAYOUT_UNDEFINED;
}
- if (!dawn::HasZeroOrOneBits(usage)) {
+ if (!wgpu::HasZeroOrOneBits(usage)) {
return VK_IMAGE_LAYOUT_GENERAL;
}
// Usage has a single bit so we can switch on its value directly.
switch (usage) {
- case dawn::TextureUsage::CopyDst:
+ case wgpu::TextureUsage::CopyDst:
return VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
- case dawn::TextureUsage::Sampled:
+ case wgpu::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::TextureUsage::CopySrc:
+ case wgpu::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::TextureUsage::Storage:
+ case wgpu::TextureUsage::Storage:
return VK_IMAGE_LAYOUT_GENERAL;
- case dawn::TextureUsage::OutputAttachment:
+ case wgpu::TextureUsage::OutputAttachment:
if (format.HasDepthOrStencil()) {
return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
} else {
return VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
}
- case dawn::TextureUsage::Present:
+ case wgpu::TextureUsage::Present:
return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
default:
UNREACHABLE();
@@ -137,23 +137,23 @@
}
// Computes which Vulkan pipeline stage can access a texture in the given Dawn usage
- VkPipelineStageFlags VulkanPipelineStage(dawn::TextureUsage usage, const Format& format) {
+ VkPipelineStageFlags VulkanPipelineStage(wgpu::TextureUsage usage, const Format& format) {
VkPipelineStageFlags flags = 0;
- if (usage == dawn::TextureUsage::None) {
+ if (usage == wgpu::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::TextureUsage::CopySrc | dawn::TextureUsage::CopyDst)) {
+ if (usage & (wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst)) {
flags |= VK_PIPELINE_STAGE_TRANSFER_BIT;
}
- if (usage & (dawn::TextureUsage::Sampled | dawn::TextureUsage::Storage)) {
+ if (usage & (wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage)) {
flags |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT |
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
}
- if (usage & dawn::TextureUsage::OutputAttachment) {
+ if (usage & wgpu::TextureUsage::OutputAttachment) {
if (format.HasDepthOrStencil()) {
flags |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
@@ -163,7 +163,7 @@
flags |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
}
}
- if (usage & dawn::TextureUsage::Present) {
+ if (usage & wgpu::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
@@ -218,117 +218,117 @@
} // namespace
// Converts Dawn texture format to Vulkan formats.
- VkFormat VulkanImageFormat(dawn::TextureFormat format) {
+ VkFormat VulkanImageFormat(wgpu::TextureFormat format) {
switch (format) {
- case dawn::TextureFormat::R8Unorm:
+ case wgpu::TextureFormat::R8Unorm:
return VK_FORMAT_R8_UNORM;
- case dawn::TextureFormat::R8Snorm:
+ case wgpu::TextureFormat::R8Snorm:
return VK_FORMAT_R8_SNORM;
- case dawn::TextureFormat::R8Uint:
+ case wgpu::TextureFormat::R8Uint:
return VK_FORMAT_R8_UINT;
- case dawn::TextureFormat::R8Sint:
+ case wgpu::TextureFormat::R8Sint:
return VK_FORMAT_R8_SINT;
- case dawn::TextureFormat::R16Uint:
+ case wgpu::TextureFormat::R16Uint:
return VK_FORMAT_R16_UINT;
- case dawn::TextureFormat::R16Sint:
+ case wgpu::TextureFormat::R16Sint:
return VK_FORMAT_R16_SINT;
- case dawn::TextureFormat::R16Float:
+ case wgpu::TextureFormat::R16Float:
return VK_FORMAT_R16_SFLOAT;
- case dawn::TextureFormat::RG8Unorm:
+ case wgpu::TextureFormat::RG8Unorm:
return VK_FORMAT_R8G8_UNORM;
- case dawn::TextureFormat::RG8Snorm:
+ case wgpu::TextureFormat::RG8Snorm:
return VK_FORMAT_R8G8_SNORM;
- case dawn::TextureFormat::RG8Uint:
+ case wgpu::TextureFormat::RG8Uint:
return VK_FORMAT_R8G8_UINT;
- case dawn::TextureFormat::RG8Sint:
+ case wgpu::TextureFormat::RG8Sint:
return VK_FORMAT_R8G8_SINT;
- case dawn::TextureFormat::R32Uint:
+ case wgpu::TextureFormat::R32Uint:
return VK_FORMAT_R32_UINT;
- case dawn::TextureFormat::R32Sint:
+ case wgpu::TextureFormat::R32Sint:
return VK_FORMAT_R32_SINT;
- case dawn::TextureFormat::R32Float:
+ case wgpu::TextureFormat::R32Float:
return VK_FORMAT_R32_SFLOAT;
- case dawn::TextureFormat::RG16Uint:
+ case wgpu::TextureFormat::RG16Uint:
return VK_FORMAT_R16G16_UINT;
- case dawn::TextureFormat::RG16Sint:
+ case wgpu::TextureFormat::RG16Sint:
return VK_FORMAT_R16G16_SINT;
- case dawn::TextureFormat::RG16Float:
+ case wgpu::TextureFormat::RG16Float:
return VK_FORMAT_R16G16_SFLOAT;
- case dawn::TextureFormat::RGBA8Unorm:
+ case wgpu::TextureFormat::RGBA8Unorm:
return VK_FORMAT_R8G8B8A8_UNORM;
- case dawn::TextureFormat::RGBA8UnormSrgb:
+ case wgpu::TextureFormat::RGBA8UnormSrgb:
return VK_FORMAT_R8G8B8A8_SRGB;
- case dawn::TextureFormat::RGBA8Snorm:
+ case wgpu::TextureFormat::RGBA8Snorm:
return VK_FORMAT_R8G8B8A8_SNORM;
- case dawn::TextureFormat::RGBA8Uint:
+ case wgpu::TextureFormat::RGBA8Uint:
return VK_FORMAT_R8G8B8A8_UINT;
- case dawn::TextureFormat::RGBA8Sint:
+ case wgpu::TextureFormat::RGBA8Sint:
return VK_FORMAT_R8G8B8A8_SINT;
- case dawn::TextureFormat::BGRA8Unorm:
+ case wgpu::TextureFormat::BGRA8Unorm:
return VK_FORMAT_B8G8R8A8_UNORM;
- case dawn::TextureFormat::BGRA8UnormSrgb:
+ case wgpu::TextureFormat::BGRA8UnormSrgb:
return VK_FORMAT_B8G8R8A8_SRGB;
- case dawn::TextureFormat::RGB10A2Unorm:
+ case wgpu::TextureFormat::RGB10A2Unorm:
return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
- case dawn::TextureFormat::RG11B10Float:
+ case wgpu::TextureFormat::RG11B10Float:
return VK_FORMAT_B10G11R11_UFLOAT_PACK32;
- case dawn::TextureFormat::RG32Uint:
+ case wgpu::TextureFormat::RG32Uint:
return VK_FORMAT_R32G32_UINT;
- case dawn::TextureFormat::RG32Sint:
+ case wgpu::TextureFormat::RG32Sint:
return VK_FORMAT_R32G32_SINT;
- case dawn::TextureFormat::RG32Float:
+ case wgpu::TextureFormat::RG32Float:
return VK_FORMAT_R32G32_SFLOAT;
- case dawn::TextureFormat::RGBA16Uint:
+ case wgpu::TextureFormat::RGBA16Uint:
return VK_FORMAT_R16G16B16A16_UINT;
- case dawn::TextureFormat::RGBA16Sint:
+ case wgpu::TextureFormat::RGBA16Sint:
return VK_FORMAT_R16G16B16A16_SINT;
- case dawn::TextureFormat::RGBA16Float:
+ case wgpu::TextureFormat::RGBA16Float:
return VK_FORMAT_R16G16B16A16_SFLOAT;
- case dawn::TextureFormat::RGBA32Uint:
+ case wgpu::TextureFormat::RGBA32Uint:
return VK_FORMAT_R32G32B32A32_UINT;
- case dawn::TextureFormat::RGBA32Sint:
+ case wgpu::TextureFormat::RGBA32Sint:
return VK_FORMAT_R32G32B32A32_SINT;
- case dawn::TextureFormat::RGBA32Float:
+ case wgpu::TextureFormat::RGBA32Float:
return VK_FORMAT_R32G32B32A32_SFLOAT;
- case dawn::TextureFormat::Depth32Float:
+ case wgpu::TextureFormat::Depth32Float:
return VK_FORMAT_D32_SFLOAT;
- case dawn::TextureFormat::Depth24Plus:
+ case wgpu::TextureFormat::Depth24Plus:
return VK_FORMAT_D32_SFLOAT;
- case dawn::TextureFormat::Depth24PlusStencil8:
+ case wgpu::TextureFormat::Depth24PlusStencil8:
return VK_FORMAT_D32_SFLOAT_S8_UINT;
- case dawn::TextureFormat::BC1RGBAUnorm:
+ case wgpu::TextureFormat::BC1RGBAUnorm:
return VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
- case dawn::TextureFormat::BC1RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC1RGBAUnormSrgb:
return VK_FORMAT_BC1_RGBA_SRGB_BLOCK;
- case dawn::TextureFormat::BC2RGBAUnorm:
+ case wgpu::TextureFormat::BC2RGBAUnorm:
return VK_FORMAT_BC2_UNORM_BLOCK;
- case dawn::TextureFormat::BC2RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC2RGBAUnormSrgb:
return VK_FORMAT_BC2_SRGB_BLOCK;
- case dawn::TextureFormat::BC3RGBAUnorm:
+ case wgpu::TextureFormat::BC3RGBAUnorm:
return VK_FORMAT_BC3_UNORM_BLOCK;
- case dawn::TextureFormat::BC3RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC3RGBAUnormSrgb:
return VK_FORMAT_BC3_SRGB_BLOCK;
- case dawn::TextureFormat::BC4RSnorm:
+ case wgpu::TextureFormat::BC4RSnorm:
return VK_FORMAT_BC4_SNORM_BLOCK;
- case dawn::TextureFormat::BC4RUnorm:
+ case wgpu::TextureFormat::BC4RUnorm:
return VK_FORMAT_BC4_UNORM_BLOCK;
- case dawn::TextureFormat::BC5RGSnorm:
+ case wgpu::TextureFormat::BC5RGSnorm:
return VK_FORMAT_BC5_SNORM_BLOCK;
- case dawn::TextureFormat::BC5RGUnorm:
+ case wgpu::TextureFormat::BC5RGUnorm:
return VK_FORMAT_BC5_UNORM_BLOCK;
- case dawn::TextureFormat::BC6HRGBSfloat:
+ case wgpu::TextureFormat::BC6HRGBSfloat:
return VK_FORMAT_BC6H_SFLOAT_BLOCK;
- case dawn::TextureFormat::BC6HRGBUfloat:
+ case wgpu::TextureFormat::BC6HRGBUfloat:
return VK_FORMAT_BC6H_UFLOAT_BLOCK;
- case dawn::TextureFormat::BC7RGBAUnorm:
+ case wgpu::TextureFormat::BC7RGBAUnorm:
return VK_FORMAT_BC7_UNORM_BLOCK;
- case dawn::TextureFormat::BC7RGBAUnormSrgb:
+ case wgpu::TextureFormat::BC7RGBAUnormSrgb:
return VK_FORMAT_BC7_SRGB_BLOCK;
default:
@@ -338,22 +338,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::TextureUsage usage, const Format& format) {
+ VkImageUsageFlags VulkanImageUsage(wgpu::TextureUsage usage, const Format& format) {
VkImageUsageFlags flags = 0;
- if (usage & dawn::TextureUsage::CopySrc) {
+ if (usage & wgpu::TextureUsage::CopySrc) {
flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
}
- if (usage & dawn::TextureUsage::CopyDst) {
+ if (usage & wgpu::TextureUsage::CopyDst) {
flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
}
- if (usage & dawn::TextureUsage::Sampled) {
+ if (usage & wgpu::TextureUsage::Sampled) {
flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
}
- if (usage & dawn::TextureUsage::Storage) {
+ if (usage & wgpu::TextureUsage::Storage) {
flags |= VK_IMAGE_USAGE_STORAGE_BIT;
}
- if (usage & dawn::TextureUsage::OutputAttachment) {
+ if (usage & wgpu::TextureUsage::OutputAttachment) {
if (format.HasDepthOrStencil()) {
flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
} else {
@@ -377,7 +377,7 @@
MaybeError ValidateVulkanImageCanBeWrapped(const DeviceBase*,
const TextureDescriptor* descriptor) {
- if (descriptor->dimension != dawn::TextureDimension::e2D) {
+ if (descriptor->dimension != wgpu::TextureDimension::e2D) {
return DAWN_VALIDATION_ERROR("Texture must be 2D");
}
@@ -558,7 +558,7 @@
// Release the texture
mExternalState = ExternalState::PendingRelease;
- TransitionUsageNow(device->GetPendingRecordingContext(), dawn::TextureUsage::None);
+ TransitionUsageNow(device->GetPendingRecordingContext(), wgpu::TextureUsage::None);
// Queue submit to signal we are done with the texture
device->GetPendingRecordingContext()->signalSemaphores.push_back(mSignalSemaphore);
@@ -613,7 +613,7 @@
}
void Texture::TransitionUsageNow(CommandRecordingContext* recordingContext,
- dawn::TextureUsage usage) {
+ wgpu::TextureUsage usage) {
// Avoid encoding barriers when it isn't needed.
bool lastReadOnly = (mLastUsage & kReadOnlyTextureUsages) == mLastUsage;
if (lastReadOnly && mLastUsage == usage && mLastExternalState == mExternalState) {
@@ -634,7 +634,7 @@
barrier.newLayout = VulkanImageLayout(usage, format);
barrier.image = mHandle;
// This transitions the whole resource but assumes it is a 2D texture
- ASSERT(GetDimension() == dawn::TextureDimension::e2D);
+ ASSERT(GetDimension() == wgpu::TextureDimension::e2D);
barrier.subresourceRange.aspectMask = VulkanAspectMask(format);
barrier.subresourceRange.baseMipLevel = 0;
barrier.subresourceRange.levelCount = GetNumMipLevels();
@@ -688,7 +688,7 @@
range.layerCount = layerCount;
uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1;
- TransitionUsageNow(recordingContext, dawn::TextureUsage::CopyDst);
+ TransitionUsageNow(recordingContext, wgpu::TextureUsage::CopyDst);
if (GetFormat().isRenderable) {
if (GetFormat().HasDepthOrStencil()) {
VkClearDepthStencilValue clearDepthStencilValue[1];
diff --git a/src/dawn_native/vulkan/TextureVk.h b/src/dawn_native/vulkan/TextureVk.h
index dd1d5f5..627d96a 100644
--- a/src/dawn_native/vulkan/TextureVk.h
+++ b/src/dawn_native/vulkan/TextureVk.h
@@ -26,8 +26,8 @@
struct CommandRecordingContext;
struct ExternalImageDescriptor;
- VkFormat VulkanImageFormat(dawn::TextureFormat format);
- VkImageUsageFlags VulkanImageUsage(dawn::TextureUsage usage, const Format& format);
+ VkFormat VulkanImageFormat(wgpu::TextureFormat format);
+ VkImageUsageFlags VulkanImageUsage(wgpu::TextureUsage usage, const Format& format);
VkSampleCountFlagBits VulkanSampleCount(uint32_t sampleCount);
MaybeError ValidateVulkanImageCanBeWrapped(const DeviceBase* device,
@@ -59,7 +59,7 @@
// `commands`.
// TODO(cwallez@chromium.org): coalesce barriers and do them early when possible.
void TransitionUsageNow(CommandRecordingContext* recordingContext,
- dawn::TextureUsage usage);
+ wgpu::TextureUsage usage);
void EnsureSubresourceContentInitialized(CommandRecordingContext* recordingContext,
uint32_t baseMipLevel,
uint32_t levelCount,
@@ -103,7 +103,7 @@
// A usage of none will make sure the texture is transitioned before its first use as
// required by the Vulkan spec.
- dawn::TextureUsage mLastUsage = dawn::TextureUsage::None;
+ wgpu::TextureUsage mLastUsage = wgpu::TextureUsage::None;
};
class TextureView : public TextureViewBase {
diff --git a/src/dawn_native/vulkan/UtilsVulkan.cpp b/src/dawn_native/vulkan/UtilsVulkan.cpp
index dd81f3f..790336b 100644
--- a/src/dawn_native/vulkan/UtilsVulkan.cpp
+++ b/src/dawn_native/vulkan/UtilsVulkan.cpp
@@ -21,23 +21,23 @@
namespace dawn_native { namespace vulkan {
- VkCompareOp ToVulkanCompareOp(dawn::CompareFunction op) {
+ VkCompareOp ToVulkanCompareOp(wgpu::CompareFunction op) {
switch (op) {
- case dawn::CompareFunction::Always:
+ case wgpu::CompareFunction::Always:
return VK_COMPARE_OP_ALWAYS;
- case dawn::CompareFunction::Equal:
+ case wgpu::CompareFunction::Equal:
return VK_COMPARE_OP_EQUAL;
- case dawn::CompareFunction::Greater:
+ case wgpu::CompareFunction::Greater:
return VK_COMPARE_OP_GREATER;
- case dawn::CompareFunction::GreaterEqual:
+ case wgpu::CompareFunction::GreaterEqual:
return VK_COMPARE_OP_GREATER_OR_EQUAL;
- case dawn::CompareFunction::Less:
+ case wgpu::CompareFunction::Less:
return VK_COMPARE_OP_LESS;
- case dawn::CompareFunction::LessEqual:
+ case wgpu::CompareFunction::LessEqual:
return VK_COMPARE_OP_LESS_OR_EQUAL;
- case dawn::CompareFunction::Never:
+ case wgpu::CompareFunction::Never:
return VK_COMPARE_OP_NEVER;
- case dawn::CompareFunction::NotEqual:
+ case wgpu::CompareFunction::NotEqual:
return VK_COMPARE_OP_NOT_EQUAL;
default:
UNREACHABLE();
diff --git a/src/dawn_native/vulkan/UtilsVulkan.h b/src/dawn_native/vulkan/UtilsVulkan.h
index 8f4b5ac..02ef6d3 100644
--- a/src/dawn_native/vulkan/UtilsVulkan.h
+++ b/src/dawn_native/vulkan/UtilsVulkan.h
@@ -21,7 +21,7 @@
namespace dawn_native { namespace vulkan {
- VkCompareOp ToVulkanCompareOp(dawn::CompareFunction op);
+ VkCompareOp ToVulkanCompareOp(wgpu::CompareFunction op);
Extent3D ComputeTextureCopyExtent(const TextureCopy& textureCopy, const Extent3D& copySize);
VkBufferImageCopy ComputeBufferImageCopyRegion(const BufferCopy& bufferCopy,
diff --git a/src/include/dawn/EnumClassBitmasks.h b/src/include/dawn/EnumClassBitmasks.h
index 3c6cb3f..93d2be4 100644
--- a/src/include/dawn/EnumClassBitmasks.h
+++ b/src/include/dawn/EnumClassBitmasks.h
@@ -17,16 +17,6 @@
#include <type_traits>
-namespace dawn {
-
- template <typename T>
- constexpr bool HasZeroOrOneBits(T value) {
- using Integral = typename std::underlying_type<T>::type;
- return (static_cast<Integral>(value) & (static_cast<Integral>(value) - 1)) == 0;
- }
-
-} // namespace dawn
-
namespace wgpu {
template <typename T>
@@ -142,6 +132,13 @@
l = l ^ r;
return l;
}
+
+ template <typename T>
+ constexpr bool HasZeroOrOneBits(T value) {
+ using Integral = typename std::underlying_type<T>::type;
+ return (static_cast<Integral>(value) & (static_cast<Integral>(value) - 1)) == 0;
+ }
+
} // namespace wgpu
#endif // DAWN_ENUM_CLASS_BITMASKS_H_
diff --git a/src/tests/unittests/EnumClassBitmasksTests.cpp b/src/tests/unittests/EnumClassBitmasksTests.cpp
index 11c3801..b706e49 100644
--- a/src/tests/unittests/EnumClassBitmasksTests.cpp
+++ b/src/tests/unittests/EnumClassBitmasksTests.cpp
@@ -80,14 +80,14 @@
TEST(BitmaskTests, ZeroOrOneBits) {
Color zero = static_cast<Color>(0);
- ASSERT_TRUE(dawn::HasZeroOrOneBits(zero));
- ASSERT_TRUE(dawn::HasZeroOrOneBits(Color::R));
- ASSERT_TRUE(dawn::HasZeroOrOneBits(Color::G));
- ASSERT_TRUE(dawn::HasZeroOrOneBits(Color::B));
- ASSERT_TRUE(dawn::HasZeroOrOneBits(Color::A));
- ASSERT_FALSE(dawn::HasZeroOrOneBits(static_cast<Color>(Color::R | Color::G)));
- ASSERT_FALSE(dawn::HasZeroOrOneBits(static_cast<Color>(Color::G | Color::B)));
- ASSERT_FALSE(dawn::HasZeroOrOneBits(static_cast<Color>(Color::B | Color::A)));
+ ASSERT_TRUE(wgpu::HasZeroOrOneBits(zero));
+ ASSERT_TRUE(wgpu::HasZeroOrOneBits(Color::R));
+ ASSERT_TRUE(wgpu::HasZeroOrOneBits(Color::G));
+ ASSERT_TRUE(wgpu::HasZeroOrOneBits(Color::B));
+ ASSERT_TRUE(wgpu::HasZeroOrOneBits(Color::A));
+ ASSERT_FALSE(wgpu::HasZeroOrOneBits(static_cast<Color>(Color::R | Color::G)));
+ ASSERT_FALSE(wgpu::HasZeroOrOneBits(static_cast<Color>(Color::G | Color::B)));
+ ASSERT_FALSE(wgpu::HasZeroOrOneBits(static_cast<Color>(Color::B | Color::A)));
}
} // namespace wgpu
diff --git a/src/tests/unittests/GetProcAddressTests.cpp b/src/tests/unittests/GetProcAddressTests.cpp
index 4ecaa78..ac9c67d 100644
--- a/src/tests/unittests/GetProcAddressTests.cpp
+++ b/src/tests/unittests/GetProcAddressTests.cpp
@@ -58,8 +58,8 @@
void SetUp() override {
switch (GetParam()) {
case DawnFlavor::Native: {
- mDevice = dawn::Device::Acquire(
- reinterpret_cast<DawnDevice>(mNativeAdapter.CreateDevice(nullptr)));
+ mDevice = wgpu::Device::Acquire(
+ reinterpret_cast<WGPUDevice>(mNativeAdapter.CreateDevice(nullptr)));
mProcs = dawn_native::GetProcs();
break;
}
@@ -71,7 +71,7 @@
clientDesc.serializer = mC2sBuf.get();
mWireClient = std::make_unique<dawn_wire::WireClient>(clientDesc);
- mDevice = dawn::Device::Acquire(mWireClient->GetDevice());
+ mDevice = wgpu::Device::Acquire(mWireClient->GetDevice());
mProcs = mWireClient->GetProcs();
break;
}
@@ -86,7 +86,7 @@
void TearDown() override {
// Destroy the device before freeing the instance or the wire client in the destructor
- mDevice = dawn::Device();
+ mDevice = wgpu::Device();
}
protected:
@@ -96,20 +96,20 @@
std::unique_ptr<utils::TerribleCommandBuffer> mC2sBuf;
std::unique_ptr<dawn_wire::WireClient> mWireClient;
- dawn::Device mDevice;
+ wgpu::Device mDevice;
DawnProcTable mProcs;
};
// Test GetProcAddress with and without devices on some valid examples
TEST_P(GetProcAddressTests, ValidExamples) {
ASSERT_EQ(mProcs.getProcAddress(nullptr, "wgpuDeviceCreateBuffer"),
- reinterpret_cast<DawnProc>(mProcs.deviceCreateBuffer));
+ reinterpret_cast<WGPUProc>(mProcs.deviceCreateBuffer));
ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "wgpuDeviceCreateBuffer"),
- reinterpret_cast<DawnProc>(mProcs.deviceCreateBuffer));
+ reinterpret_cast<WGPUProc>(mProcs.deviceCreateBuffer));
ASSERT_EQ(mProcs.getProcAddress(nullptr, "wgpuQueueSubmit"),
- reinterpret_cast<DawnProc>(mProcs.queueSubmit));
+ reinterpret_cast<WGPUProc>(mProcs.queueSubmit));
ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "wgpuQueueSubmit"),
- reinterpret_cast<DawnProc>(mProcs.queueSubmit));
+ reinterpret_cast<WGPUProc>(mProcs.queueSubmit));
}
// Test GetProcAddress with and without devices on nullptr procName
@@ -140,9 +140,9 @@
// freestanding function and not a method on an object.
TEST_P(GetProcAddressTests, GetProcAddressItself) {
ASSERT_EQ(mProcs.getProcAddress(nullptr, "wgpuGetProcAddress"),
- reinterpret_cast<DawnProc>(mProcs.getProcAddress));
+ reinterpret_cast<WGPUProc>(mProcs.getProcAddress));
ASSERT_EQ(mProcs.getProcAddress(mDevice.Get(), "wgpuGetProcAddress"),
- reinterpret_cast<DawnProc>(mProcs.getProcAddress));
+ reinterpret_cast<WGPUProc>(mProcs.getProcAddress));
}
INSTANTIATE_TEST_SUITE_P(,
diff --git a/src/tests/unittests/PerStageTests.cpp b/src/tests/unittests/PerStageTests.cpp
index af4d445..a8c4cf4 100644
--- a/src/tests/unittests/PerStageTests.cpp
+++ b/src/tests/unittests/PerStageTests.cpp
@@ -20,24 +20,24 @@
// Tests for StageBit
TEST(PerStage, StageBit) {
- ASSERT_EQ(StageBit(SingleShaderStage::Vertex), dawn::ShaderStage::Vertex);
- ASSERT_EQ(StageBit(SingleShaderStage::Fragment), dawn::ShaderStage::Fragment);
- ASSERT_EQ(StageBit(SingleShaderStage::Compute), dawn::ShaderStage::Compute);
+ ASSERT_EQ(StageBit(SingleShaderStage::Vertex), wgpu::ShaderStage::Vertex);
+ ASSERT_EQ(StageBit(SingleShaderStage::Fragment), wgpu::ShaderStage::Fragment);
+ ASSERT_EQ(StageBit(SingleShaderStage::Compute), wgpu::ShaderStage::Compute);
}
// Basic test for the PerStage container
TEST(PerStage, PerStage) {
PerStage<int> data;
- // Store data using dawn::ShaderStage
+ // Store data using wgpu::ShaderStage
data[SingleShaderStage::Vertex] = 42;
data[SingleShaderStage::Fragment] = 3;
data[SingleShaderStage::Compute] = -1;
- // Load it using dawn::ShaderStage
- ASSERT_EQ(data[dawn::ShaderStage::Vertex], 42);
- ASSERT_EQ(data[dawn::ShaderStage::Fragment], 3);
- ASSERT_EQ(data[dawn::ShaderStage::Compute], -1);
+ // Load it using wgpu::ShaderStage
+ ASSERT_EQ(data[wgpu::ShaderStage::Vertex], 42);
+ ASSERT_EQ(data[wgpu::ShaderStage::Fragment], 3);
+ ASSERT_EQ(data[wgpu::ShaderStage::Compute], -1);
}
// Test IterateStages with kAllStages
@@ -51,9 +51,9 @@
counts[stage] ++;
}
- ASSERT_EQ(counts[dawn::ShaderStage::Vertex], 1);
- ASSERT_EQ(counts[dawn::ShaderStage::Fragment], 1);
- ASSERT_EQ(counts[dawn::ShaderStage::Compute], 1);
+ ASSERT_EQ(counts[wgpu::ShaderStage::Vertex], 1);
+ ASSERT_EQ(counts[wgpu::ShaderStage::Fragment], 1);
+ ASSERT_EQ(counts[wgpu::ShaderStage::Compute], 1);
}
// Test IterateStages with one stage
@@ -63,13 +63,13 @@
counts[SingleShaderStage::Fragment] = 0;
counts[SingleShaderStage::Compute] = 0;
- for (auto stage : IterateStages(dawn::ShaderStage::Fragment)) {
+ for (auto stage : IterateStages(wgpu::ShaderStage::Fragment)) {
counts[stage] ++;
}
- ASSERT_EQ(counts[dawn::ShaderStage::Vertex], 0);
- ASSERT_EQ(counts[dawn::ShaderStage::Fragment], 1);
- ASSERT_EQ(counts[dawn::ShaderStage::Compute], 0);
+ ASSERT_EQ(counts[wgpu::ShaderStage::Vertex], 0);
+ ASSERT_EQ(counts[wgpu::ShaderStage::Fragment], 1);
+ ASSERT_EQ(counts[wgpu::ShaderStage::Compute], 0);
}
// Test IterateStages with no stage
@@ -79,11 +79,11 @@
counts[SingleShaderStage::Fragment] = 0;
counts[SingleShaderStage::Compute] = 0;
- for (auto stage : IterateStages(dawn::ShaderStage::Fragment & dawn::ShaderStage::Vertex)) {
+ for (auto stage : IterateStages(wgpu::ShaderStage::Fragment & wgpu::ShaderStage::Vertex)) {
counts[stage] ++;
}
- ASSERT_EQ(counts[dawn::ShaderStage::Vertex], 0);
- ASSERT_EQ(counts[dawn::ShaderStage::Fragment], 0);
- ASSERT_EQ(counts[dawn::ShaderStage::Compute], 0);
+ ASSERT_EQ(counts[wgpu::ShaderStage::Vertex], 0);
+ ASSERT_EQ(counts[wgpu::ShaderStage::Fragment], 0);
+ ASSERT_EQ(counts[wgpu::ShaderStage::Compute], 0);
}