Rename nxt:: to dawn:: in the backends
diff --git a/src/backend/BindGroup.cpp b/src/backend/BindGroup.cpp
index 340977b..233984b 100644
--- a/src/backend/BindGroup.cpp
+++ b/src/backend/BindGroup.cpp
@@ -35,29 +35,29 @@
return mLayout.Get();
}
- nxt::BindGroupUsage BindGroupBase::GetUsage() const {
+ dawn::BindGroupUsage BindGroupBase::GetUsage() const {
return mUsage;
}
BufferViewBase* BindGroupBase::GetBindingAsBufferView(size_t binding) {
ASSERT(binding < kMaxBindingsPerGroup);
ASSERT(mLayout->GetBindingInfo().mask[binding]);
- ASSERT(mLayout->GetBindingInfo().types[binding] == nxt::BindingType::UniformBuffer ||
- mLayout->GetBindingInfo().types[binding] == nxt::BindingType::StorageBuffer);
+ ASSERT(mLayout->GetBindingInfo().types[binding] == dawn::BindingType::UniformBuffer ||
+ mLayout->GetBindingInfo().types[binding] == dawn::BindingType::StorageBuffer);
return reinterpret_cast<BufferViewBase*>(mBindings[binding].Get());
}
SamplerBase* BindGroupBase::GetBindingAsSampler(size_t binding) {
ASSERT(binding < kMaxBindingsPerGroup);
ASSERT(mLayout->GetBindingInfo().mask[binding]);
- ASSERT(mLayout->GetBindingInfo().types[binding] == nxt::BindingType::Sampler);
+ ASSERT(mLayout->GetBindingInfo().types[binding] == dawn::BindingType::Sampler);
return reinterpret_cast<SamplerBase*>(mBindings[binding].Get());
}
TextureViewBase* BindGroupBase::GetBindingAsTextureView(size_t binding) {
ASSERT(binding < kMaxBindingsPerGroup);
ASSERT(mLayout->GetBindingInfo().mask[binding]);
- ASSERT(mLayout->GetBindingInfo().types[binding] == nxt::BindingType::SampledTexture);
+ ASSERT(mLayout->GetBindingInfo().types[binding] == dawn::BindingType::SampledTexture);
return reinterpret_cast<TextureViewBase*>(mBindings[binding].Get());
}
@@ -100,7 +100,7 @@
mPropertiesSet |= BINDGROUP_PROPERTY_LAYOUT;
}
- void BindGroupBuilder::SetUsage(nxt::BindGroupUsage usage) {
+ void BindGroupBuilder::SetUsage(dawn::BindGroupUsage usage) {
if ((mPropertiesSet & BINDGROUP_PROPERTY_USAGE) != 0) {
HandleError("Bindgroup usage property set multiple times");
return;
@@ -119,18 +119,18 @@
const auto& layoutInfo = mLayout->GetBindingInfo();
for (size_t i = start, j = 0; i < start + count; ++i, ++j) {
- nxt::BufferUsageBit requiredBit = nxt::BufferUsageBit::None;
+ dawn::BufferUsageBit requiredBit = dawn::BufferUsageBit::None;
switch (layoutInfo.types[i]) {
- case nxt::BindingType::UniformBuffer:
- requiredBit = nxt::BufferUsageBit::Uniform;
+ case dawn::BindingType::UniformBuffer:
+ requiredBit = dawn::BufferUsageBit::Uniform;
break;
- case nxt::BindingType::StorageBuffer:
- requiredBit = nxt::BufferUsageBit::Storage;
+ case dawn::BindingType::StorageBuffer:
+ requiredBit = dawn::BufferUsageBit::Storage;
break;
- case nxt::BindingType::Sampler:
- case nxt::BindingType::SampledTexture:
+ case dawn::BindingType::Sampler:
+ case dawn::BindingType::SampledTexture:
HandleError("Setting buffer for a wrong binding type");
return;
}
@@ -158,7 +158,7 @@
const auto& layoutInfo = mLayout->GetBindingInfo();
for (size_t i = start, j = 0; i < start + count; ++i, ++j) {
- if (layoutInfo.types[i] != nxt::BindingType::Sampler) {
+ if (layoutInfo.types[i] != dawn::BindingType::Sampler) {
HandleError("Setting binding for a wrong layout binding type");
return;
}
@@ -176,13 +176,13 @@
const auto& layoutInfo = mLayout->GetBindingInfo();
for (size_t i = start, j = 0; i < start + count; ++i, ++j) {
- if (layoutInfo.types[i] != nxt::BindingType::SampledTexture) {
+ if (layoutInfo.types[i] != dawn::BindingType::SampledTexture) {
HandleError("Setting binding for a wrong layout binding type");
return;
}
if (!(textureViews[j]->GetTexture()->GetAllowedUsage() &
- nxt::TextureUsageBit::Sampled)) {
+ dawn::TextureUsageBit::Sampled)) {
HandleError("Texture needs to allow the sampled usage bit");
return;
}
diff --git a/src/backend/BindGroup.h b/src/backend/BindGroup.h
index f430c86..7a4ad02 100644
--- a/src/backend/BindGroup.h
+++ b/src/backend/BindGroup.h
@@ -34,7 +34,7 @@
BindGroupBase(BindGroupBuilder* builder);
const BindGroupLayoutBase* GetLayout() const;
- nxt::BindGroupUsage GetUsage() const;
+ dawn::BindGroupUsage GetUsage() const;
BufferViewBase* GetBindingAsBufferView(size_t binding);
SamplerBase* GetBindingAsSampler(size_t binding);
TextureViewBase* GetBindingAsTextureView(size_t binding);
@@ -43,7 +43,7 @@
private:
Ref<BindGroupLayoutBase> mLayout;
- nxt::BindGroupUsage mUsage;
+ dawn::BindGroupUsage mUsage;
std::array<Ref<RefCounted>, kMaxBindingsPerGroup> mBindings;
};
@@ -53,7 +53,7 @@
// NXT API
void SetLayout(BindGroupLayoutBase* layout);
- void SetUsage(nxt::BindGroupUsage usage);
+ void SetUsage(dawn::BindGroupUsage usage);
template <typename T>
void SetBufferViews(uint32_t start, uint32_t count, T* const* bufferViews) {
@@ -87,7 +87,7 @@
int mPropertiesSet = 0;
Ref<BindGroupLayoutBase> mLayout;
- nxt::BindGroupUsage mUsage;
+ dawn::BindGroupUsage mUsage;
std::array<Ref<RefCounted>, kMaxBindingsPerGroup> mBindings;
};
diff --git a/src/backend/BindGroupLayout.cpp b/src/backend/BindGroupLayout.cpp
index 6403b73..a5fda46 100644
--- a/src/backend/BindGroupLayout.cpp
+++ b/src/backend/BindGroupLayout.cpp
@@ -23,8 +23,9 @@
namespace backend {
- MaybeError ValidateBindGroupLayoutDescriptor(DeviceBase*,
- const nxt::BindGroupLayoutDescriptor* descriptor) {
+ MaybeError ValidateBindGroupLayoutDescriptor(
+ DeviceBase*,
+ const dawn::BindGroupLayoutDescriptor* descriptor) {
NXT_TRY_ASSERT(descriptor->nextInChain == nullptr, "nextInChain must be nullptr");
std::bitset<kMaxBindingsPerGroup> bindingsSet;
@@ -72,7 +73,7 @@
// BindGroupLayoutBase
BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device,
- const nxt::BindGroupLayoutDescriptor* descriptor,
+ const dawn::BindGroupLayoutDescriptor* descriptor,
bool blueprint)
: mDevice(device), mIsBlueprint(blueprint) {
for (uint32_t i = 0; i < descriptor->numBindings; ++i) {
diff --git a/src/backend/BindGroupLayout.h b/src/backend/BindGroupLayout.h
index 9f30aa1..32f1b31 100644
--- a/src/backend/BindGroupLayout.h
+++ b/src/backend/BindGroupLayout.h
@@ -28,18 +28,18 @@
namespace backend {
MaybeError ValidateBindGroupLayoutDescriptor(DeviceBase*,
- const nxt::BindGroupLayoutDescriptor* descriptor);
+ const dawn::BindGroupLayoutDescriptor* descriptor);
class BindGroupLayoutBase : public RefCounted {
public:
BindGroupLayoutBase(DeviceBase* device,
- const nxt::BindGroupLayoutDescriptor* descriptor,
+ const dawn::BindGroupLayoutDescriptor* descriptor,
bool blueprint = false);
~BindGroupLayoutBase() override;
struct LayoutBindingInfo {
- std::array<nxt::ShaderStageBit, kMaxBindingsPerGroup> visibilities;
- std::array<nxt::BindingType, kMaxBindingsPerGroup> types;
+ std::array<dawn::ShaderStageBit, kMaxBindingsPerGroup> visibilities;
+ std::array<dawn::BindingType, kMaxBindingsPerGroup> types;
std::bitset<kMaxBindingsPerGroup> mask;
};
const LayoutBindingInfo& GetBindingInfo() const;
diff --git a/src/backend/BlendState.cpp b/src/backend/BlendState.cpp
index b82a87f..97a9be0 100644
--- a/src/backend/BlendState.cpp
+++ b/src/backend/BlendState.cpp
@@ -54,9 +54,9 @@
mBlendInfo.blendEnabled = blendEnabled;
}
- void BlendStateBuilder::SetAlphaBlend(nxt::BlendOperation blendOperation,
- nxt::BlendFactor srcFactor,
- nxt::BlendFactor dstFactor) {
+ void BlendStateBuilder::SetAlphaBlend(dawn::BlendOperation blendOperation,
+ dawn::BlendFactor srcFactor,
+ dawn::BlendFactor dstFactor) {
if ((mPropertiesSet & BLEND_STATE_PROPERTY_ALPHA_BLEND) != 0) {
HandleError("Alpha blend property set multiple times");
return;
@@ -67,9 +67,9 @@
mBlendInfo.alphaBlend = {blendOperation, srcFactor, dstFactor};
}
- void BlendStateBuilder::SetColorBlend(nxt::BlendOperation blendOperation,
- nxt::BlendFactor srcFactor,
- nxt::BlendFactor dstFactor) {
+ void BlendStateBuilder::SetColorBlend(dawn::BlendOperation blendOperation,
+ dawn::BlendFactor srcFactor,
+ dawn::BlendFactor dstFactor) {
if ((mPropertiesSet & BLEND_STATE_PROPERTY_COLOR_BLEND) != 0) {
HandleError("Color blend property set multiple times");
return;
@@ -80,7 +80,7 @@
mBlendInfo.colorBlend = {blendOperation, srcFactor, dstFactor};
}
- void BlendStateBuilder::SetColorWriteMask(nxt::ColorWriteMask colorWriteMask) {
+ void BlendStateBuilder::SetColorWriteMask(dawn::ColorWriteMask colorWriteMask) {
if ((mPropertiesSet & BLEND_STATE_PROPERTY_COLOR_WRITE_MASK) != 0) {
HandleError("Color write mask property set multiple times");
return;
diff --git a/src/backend/BlendState.h b/src/backend/BlendState.h
index 9f271a3..9f86b44 100644
--- a/src/backend/BlendState.h
+++ b/src/backend/BlendState.h
@@ -29,15 +29,15 @@
struct BlendInfo {
struct BlendOpFactor {
- nxt::BlendOperation operation = nxt::BlendOperation::Add;
- nxt::BlendFactor srcFactor = nxt::BlendFactor::One;
- nxt::BlendFactor dstFactor = nxt::BlendFactor::Zero;
+ dawn::BlendOperation operation = dawn::BlendOperation::Add;
+ dawn::BlendFactor srcFactor = dawn::BlendFactor::One;
+ dawn::BlendFactor dstFactor = dawn::BlendFactor::Zero;
};
bool blendEnabled = false;
BlendOpFactor alphaBlend;
BlendOpFactor colorBlend;
- nxt::ColorWriteMask colorWriteMask = nxt::ColorWriteMask::All;
+ dawn::ColorWriteMask colorWriteMask = dawn::ColorWriteMask::All;
};
const BlendInfo& GetBlendInfo() const;
@@ -52,13 +52,13 @@
// NXT API
void SetBlendEnabled(bool blendEnabled);
- void SetAlphaBlend(nxt::BlendOperation blendOperation,
- nxt::BlendFactor srcFactor,
- nxt::BlendFactor dstFactor);
- void SetColorBlend(nxt::BlendOperation blendOperation,
- nxt::BlendFactor srcFactor,
- nxt::BlendFactor dstFactor);
- void SetColorWriteMask(nxt::ColorWriteMask colorWriteMask);
+ void SetAlphaBlend(dawn::BlendOperation blendOperation,
+ dawn::BlendFactor srcFactor,
+ dawn::BlendFactor dstFactor);
+ void SetColorBlend(dawn::BlendOperation blendOperation,
+ dawn::BlendFactor srcFactor,
+ dawn::BlendFactor dstFactor);
+ void SetColorWriteMask(dawn::ColorWriteMask colorWriteMask);
private:
friend class BlendStateBase;
diff --git a/src/backend/Buffer.cpp b/src/backend/Buffer.cpp
index 79b6c15..c0c27b3 100644
--- a/src/backend/Buffer.cpp
+++ b/src/backend/Buffer.cpp
@@ -47,7 +47,7 @@
return mSize;
}
- nxt::BufferUsageBit BufferBase::GetAllowedUsage() const {
+ dawn::BufferUsageBit BufferBase::GetAllowedUsage() const {
return mAllowedUsage;
}
@@ -83,7 +83,7 @@
return;
}
- if (!(mAllowedUsage & nxt::BufferUsageBit::TransferDst)) {
+ if (!(mAllowedUsage & dawn::BufferUsageBit::TransferDst)) {
mDevice->HandleError("Buffer needs the transfer dst usage bit");
return;
}
@@ -95,7 +95,7 @@
uint32_t size,
nxtBufferMapReadCallback callback,
nxtCallbackUserdata userdata) {
- if (!ValidateMapBase(start, size, nxt::BufferUsageBit::MapRead)) {
+ if (!ValidateMapBase(start, size, dawn::BufferUsageBit::MapRead)) {
callback(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata);
return;
}
@@ -115,7 +115,7 @@
uint32_t size,
nxtBufferMapWriteCallback callback,
nxtCallbackUserdata userdata) {
- if (!ValidateMapBase(start, size, nxt::BufferUsageBit::MapWrite)) {
+ if (!ValidateMapBase(start, size, dawn::BufferUsageBit::MapWrite)) {
callback(NXT_BUFFER_MAP_ASYNC_STATUS_ERROR, nullptr, userdata);
return;
}
@@ -150,7 +150,7 @@
bool BufferBase::ValidateMapBase(uint32_t start,
uint32_t size,
- nxt::BufferUsageBit requiredUsage) {
+ dawn::BufferUsageBit requiredUsage) {
// TODO(cwallez@chromium.org): check for overflows.
if (start + size > GetSize()) {
mDevice->HandleError("Buffer map read out of range");
@@ -187,17 +187,17 @@
return nullptr;
}
- const nxt::BufferUsageBit kMapWriteAllowedUsages =
- nxt::BufferUsageBit::MapWrite | nxt::BufferUsageBit::TransferSrc;
- if (mAllowedUsage & nxt::BufferUsageBit::MapWrite &&
+ const dawn::BufferUsageBit kMapWriteAllowedUsages =
+ dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferSrc;
+ if (mAllowedUsage & dawn::BufferUsageBit::MapWrite &&
(mAllowedUsage & kMapWriteAllowedUsages) != mAllowedUsage) {
HandleError("Only TransferSrc is allowed with MapWrite");
return nullptr;
}
- const nxt::BufferUsageBit kMapReadAllowedUsages =
- nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::TransferDst;
- if (mAllowedUsage & nxt::BufferUsageBit::MapRead &&
+ const dawn::BufferUsageBit kMapReadAllowedUsages =
+ dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferDst;
+ if (mAllowedUsage & dawn::BufferUsageBit::MapRead &&
(mAllowedUsage & kMapReadAllowedUsages) != mAllowedUsage) {
HandleError("Only TransferDst is allowed with MapRead");
return nullptr;
@@ -206,7 +206,7 @@
return mDevice->CreateBuffer(this);
}
- void BufferBuilder::SetAllowedUsage(nxt::BufferUsageBit usage) {
+ void BufferBuilder::SetAllowedUsage(dawn::BufferUsageBit usage) {
if ((mPropertiesSet & BUFFER_PROPERTY_ALLOWED_USAGE) != 0) {
HandleError("Buffer allowedUsage property set multiple times");
return;
diff --git a/src/backend/Buffer.h b/src/backend/Buffer.h
index eb7e9ce..abed940 100644
--- a/src/backend/Buffer.h
+++ b/src/backend/Buffer.h
@@ -23,13 +23,13 @@
namespace backend {
- static constexpr nxt::BufferUsageBit kReadOnlyBufferUsages =
- nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::TransferSrc |
- nxt::BufferUsageBit::Index | nxt::BufferUsageBit::Vertex | nxt::BufferUsageBit::Uniform;
+ static constexpr dawn::BufferUsageBit kReadOnlyBufferUsages =
+ dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::TransferSrc |
+ dawn::BufferUsageBit::Index | dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Uniform;
- static constexpr nxt::BufferUsageBit kWritableBufferUsages = nxt::BufferUsageBit::MapWrite |
- nxt::BufferUsageBit::TransferDst |
- nxt::BufferUsageBit::Storage;
+ static constexpr dawn::BufferUsageBit kWritableBufferUsages =
+ dawn::BufferUsageBit::MapWrite | dawn::BufferUsageBit::TransferDst |
+ dawn::BufferUsageBit::Storage;
class BufferBase : public RefCounted {
public:
@@ -37,7 +37,7 @@
~BufferBase();
uint32_t GetSize() const;
- nxt::BufferUsageBit GetAllowedUsage() const;
+ dawn::BufferUsageBit GetAllowedUsage() const;
DeviceBase* GetDevice() const;
@@ -66,11 +66,11 @@
virtual void MapWriteAsyncImpl(uint32_t serial, uint32_t start, uint32_t size) = 0;
virtual void UnmapImpl() = 0;
- bool ValidateMapBase(uint32_t start, uint32_t size, nxt::BufferUsageBit requiredUsage);
+ bool ValidateMapBase(uint32_t start, uint32_t size, dawn::BufferUsageBit requiredUsage);
DeviceBase* mDevice;
uint32_t mSize;
- nxt::BufferUsageBit mAllowedUsage = nxt::BufferUsageBit::None;
+ dawn::BufferUsageBit mAllowedUsage = dawn::BufferUsageBit::None;
nxtBufferMapReadCallback mMapReadCallback = nullptr;
nxtBufferMapWriteCallback mMapWriteCallback = nullptr;
@@ -85,8 +85,8 @@
BufferBuilder(DeviceBase* device);
// NXT API
- void SetAllowedUsage(nxt::BufferUsageBit usage);
- void SetInitialUsage(nxt::BufferUsageBit usage);
+ void SetAllowedUsage(dawn::BufferUsageBit usage);
+ void SetInitialUsage(dawn::BufferUsageBit usage);
void SetSize(uint32_t size);
private:
@@ -95,8 +95,8 @@
BufferBase* GetResultImpl() override;
uint32_t mSize;
- nxt::BufferUsageBit mAllowedUsage = nxt::BufferUsageBit::None;
- nxt::BufferUsageBit mCurrentUsage = nxt::BufferUsageBit::None;
+ dawn::BufferUsageBit mAllowedUsage = dawn::BufferUsageBit::None;
+ dawn::BufferUsageBit mCurrentUsage = dawn::BufferUsageBit::None;
int mPropertiesSet = 0;
};
diff --git a/src/backend/Builder.cpp b/src/backend/Builder.cpp
index ca3a39f..023824e 100644
--- a/src/backend/Builder.cpp
+++ b/src/backend/Builder.cpp
@@ -28,12 +28,12 @@
}
void BuilderBase::HandleError(const char* message) {
- SetStatus(nxt::BuilderErrorStatus::Error, message);
+ SetStatus(dawn::BuilderErrorStatus::Error, message);
}
- void BuilderBase::SetErrorCallback(nxt::BuilderErrorCallback callback,
- nxt::CallbackUserdata userdata1,
- nxt::CallbackUserdata userdata2) {
+ void BuilderBase::SetErrorCallback(dawn::BuilderErrorCallback callback,
+ dawn::CallbackUserdata userdata1,
+ dawn::CallbackUserdata userdata2) {
mCallback = callback;
mUserdata1 = userdata1;
mUserdata2 = userdata2;
@@ -49,9 +49,9 @@
}
}
- void BuilderBase::SetStatus(nxt::BuilderErrorStatus status, const char* message) {
- ASSERT(status != nxt::BuilderErrorStatus::Success);
- ASSERT(status != nxt::BuilderErrorStatus::Unknown);
+ void BuilderBase::SetStatus(dawn::BuilderErrorStatus status, const char* message) {
+ ASSERT(status != dawn::BuilderErrorStatus::Success);
+ ASSERT(status != dawn::BuilderErrorStatus::Unknown);
ASSERT(!mGotStatus); // This is not strictly necessary but something to strive for.
mGotStatus = true;
@@ -69,7 +69,7 @@
// If we have any error, then we have to return nullptr
if (mGotStatus) {
- ASSERT(mStoredStatus != nxt::BuilderErrorStatus::Success);
+ ASSERT(mStoredStatus != dawn::BuilderErrorStatus::Success);
// The application will never see "result" so we need to remove the
// external ref here.
@@ -82,7 +82,7 @@
if (!mCallback)
mDevice->HandleError(("Unhandled builder error: " + mStoredMessage).c_str());
} else {
- ASSERT(mStoredStatus == nxt::BuilderErrorStatus::Success);
+ ASSERT(mStoredStatus == dawn::BuilderErrorStatus::Success);
ASSERT(mStoredMessage.empty());
}
diff --git a/src/backend/Builder.h b/src/backend/Builder.h
index 1e2a1be..ae4efd0 100644
--- a/src/backend/Builder.h
+++ b/src/backend/Builder.h
@@ -50,9 +50,9 @@
bool HandleResult(RefCounted* result);
// NXT API
- void SetErrorCallback(nxt::BuilderErrorCallback callback,
- nxt::CallbackUserdata userdata1,
- nxt::CallbackUserdata userdata2);
+ void SetErrorCallback(dawn::BuilderErrorCallback callback,
+ dawn::CallbackUserdata userdata1,
+ dawn::CallbackUserdata userdata2);
protected:
BuilderBase(DeviceBase* device);
@@ -62,13 +62,13 @@
bool mGotStatus = false;
private:
- void SetStatus(nxt::BuilderErrorStatus status, const char* message);
+ void SetStatus(dawn::BuilderErrorStatus status, const char* message);
- nxt::BuilderErrorCallback mCallback = nullptr;
- nxt::CallbackUserdata mUserdata1 = 0;
- nxt::CallbackUserdata mUserdata2 = 0;
+ dawn::BuilderErrorCallback mCallback = nullptr;
+ dawn::CallbackUserdata mUserdata1 = 0;
+ dawn::CallbackUserdata mUserdata2 = 0;
- nxt::BuilderErrorStatus mStoredStatus = nxt::BuilderErrorStatus::Success;
+ dawn::BuilderErrorStatus mStoredStatus = dawn::BuilderErrorStatus::Success;
std::string mStoredMessage;
bool mIsConsumed = false;
diff --git a/src/backend/CommandBuffer.cpp b/src/backend/CommandBuffer.cpp
index 8eabacb..283707f 100644
--- a/src/backend/CommandBuffer.cpp
+++ b/src/backend/CommandBuffer.cpp
@@ -109,7 +109,7 @@
return {};
}
- MaybeError ValidateCanUseAs(BufferBase* buffer, nxt::BufferUsageBit usage) {
+ MaybeError ValidateCanUseAs(BufferBase* buffer, dawn::BufferUsageBit usage) {
ASSERT(HasZeroOrOneBits(usage));
if (!(buffer->GetAllowedUsage() & usage)) {
NXT_RETURN_ERROR("buffer doesn't have the required usage.");
@@ -118,7 +118,7 @@
return {};
}
- MaybeError ValidateCanUseAs(TextureBase* texture, nxt::TextureUsageBit usage) {
+ MaybeError ValidateCanUseAs(TextureBase* texture, dawn::TextureUsageBit usage) {
ASSERT(HasZeroOrOneBits(usage));
if (!(texture->GetAllowedUsage() & usage)) {
NXT_RETURN_ERROR("texture doesn't have the required usage.");
@@ -138,26 +138,26 @@
// information.
class PassResourceUsageTracker {
public:
- void BufferUsedAs(BufferBase* buffer, nxt::BufferUsageBit usage) {
+ void BufferUsedAs(BufferBase* buffer, dawn::BufferUsageBit usage) {
// std::map's operator[] will create the key and return 0 if the key didn't exist
// before.
- nxt::BufferUsageBit& storedUsage = mBufferUsages[buffer];
+ dawn::BufferUsageBit& storedUsage = mBufferUsages[buffer];
- if (usage == nxt::BufferUsageBit::Storage &&
- storedUsage & nxt::BufferUsageBit::Storage) {
+ if (usage == dawn::BufferUsageBit::Storage &&
+ storedUsage & dawn::BufferUsageBit::Storage) {
mStorageUsedMultipleTimes = true;
}
storedUsage |= usage;
}
- void TextureUsedAs(TextureBase* texture, nxt::TextureUsageBit usage) {
+ void TextureUsedAs(TextureBase* texture, dawn::TextureUsageBit usage) {
// std::map's operator[] will create the key and return 0 if the key didn't exist
// before.
- nxt::TextureUsageBit& storedUsage = mTextureUsages[texture];
+ dawn::TextureUsageBit& storedUsage = mTextureUsages[texture];
- if (usage == nxt::TextureUsageBit::Storage &&
- storedUsage & nxt::TextureUsageBit::Storage) {
+ if (usage == dawn::TextureUsageBit::Storage &&
+ storedUsage & dawn::TextureUsageBit::Storage) {
mStorageUsedMultipleTimes = true;
}
@@ -174,14 +174,14 @@
// Buffers can only be used as single-write or multiple read.
for (auto& it : mBufferUsages) {
BufferBase* buffer = it.first;
- nxt::BufferUsageBit usage = it.second;
+ dawn::BufferUsageBit usage = it.second;
if (usage & ~buffer->GetAllowedUsage()) {
NXT_RETURN_ERROR("Buffer missing usage for the pass");
}
bool readOnly = (usage & kReadOnlyBufferUsages) == usage;
- bool singleUse = nxt::HasZeroOrOneBits(usage);
+ bool singleUse = dawn::HasZeroOrOneBits(usage);
if (!readOnly && !singleUse) {
NXT_RETURN_ERROR(
@@ -193,7 +193,7 @@
// TODO(cwallez@chromium.org): implement per-subresource tracking
for (auto& it : mTextureUsages) {
TextureBase* texture = it.first;
- nxt::TextureUsageBit usage = it.second;
+ dawn::TextureUsageBit usage = it.second;
if (usage & ~texture->GetAllowedUsage()) {
NXT_RETURN_ERROR("Texture missing usage for the pass");
@@ -201,7 +201,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 (!nxt::HasZeroOrOneBits(it.second)) {
+ if (!dawn::HasZeroOrOneBits(it.second)) {
NXT_RETURN_ERROR("Texture used with more than one usage in pass");
}
}
@@ -231,8 +231,8 @@
}
private:
- std::map<BufferBase*, nxt::BufferUsageBit> mBufferUsages;
- std::map<TextureBase*, nxt::TextureUsageBit> mTextureUsages;
+ std::map<BufferBase*, dawn::BufferUsageBit> mBufferUsages;
+ std::map<TextureBase*, dawn::TextureUsageBit> mTextureUsages;
bool mStorageUsedMultipleTimes = false;
};
@@ -240,25 +240,25 @@
const auto& layoutInfo = group->GetLayout()->GetBindingInfo();
for (uint32_t i : IterateBitSet(layoutInfo.mask)) {
- nxt::BindingType type = layoutInfo.types[i];
+ dawn::BindingType type = layoutInfo.types[i];
switch (type) {
- case nxt::BindingType::UniformBuffer: {
+ case dawn::BindingType::UniformBuffer: {
BufferBase* buffer = group->GetBindingAsBufferView(i)->GetBuffer();
- tracker->BufferUsedAs(buffer, nxt::BufferUsageBit::Uniform);
+ tracker->BufferUsedAs(buffer, dawn::BufferUsageBit::Uniform);
} break;
- case nxt::BindingType::StorageBuffer: {
+ case dawn::BindingType::StorageBuffer: {
BufferBase* buffer = group->GetBindingAsBufferView(i)->GetBuffer();
- tracker->BufferUsedAs(buffer, nxt::BufferUsageBit::Storage);
+ tracker->BufferUsedAs(buffer, dawn::BufferUsageBit::Storage);
} break;
- case nxt::BindingType::SampledTexture: {
+ case dawn::BindingType::SampledTexture: {
TextureBase* texture = group->GetBindingAsTextureView(i)->GetTexture();
- tracker->TextureUsedAs(texture, nxt::TextureUsageBit::Sampled);
+ tracker->TextureUsedAs(texture, dawn::TextureUsageBit::Sampled);
} break;
- case nxt::BindingType::Sampler:
+ case dawn::BindingType::Sampler:
break;
}
}
@@ -339,9 +339,9 @@
NXT_TRY(ValidateCopySizeFitsInBuffer(copy->destination, copy->size));
NXT_TRY(ValidateCanUseAs(copy->source.buffer.Get(),
- nxt::BufferUsageBit::TransferSrc));
+ dawn::BufferUsageBit::TransferSrc));
NXT_TRY(ValidateCanUseAs(copy->destination.buffer.Get(),
- nxt::BufferUsageBit::TransferDst));
+ dawn::BufferUsageBit::TransferDst));
} break;
case Command::CopyBufferToTexture: {
@@ -358,9 +358,9 @@
ValidateTexelBufferOffset(copy->destination.texture.Get(), copy->source));
NXT_TRY(ValidateCanUseAs(copy->source.buffer.Get(),
- nxt::BufferUsageBit::TransferSrc));
+ dawn::BufferUsageBit::TransferSrc));
NXT_TRY(ValidateCanUseAs(copy->destination.texture.Get(),
- nxt::TextureUsageBit::TransferDst));
+ dawn::TextureUsageBit::TransferDst));
} break;
case Command::CopyTextureToBuffer: {
@@ -377,9 +377,9 @@
ValidateTexelBufferOffset(copy->source.texture.Get(), copy->destination));
NXT_TRY(ValidateCanUseAs(copy->source.texture.Get(),
- nxt::TextureUsageBit::TransferSrc));
+ dawn::TextureUsageBit::TransferSrc));
NXT_TRY(ValidateCanUseAs(copy->destination.buffer.Get(),
- nxt::BufferUsageBit::TransferDst));
+ dawn::BufferUsageBit::TransferDst));
} break;
default:
@@ -423,7 +423,7 @@
// Validation of count and offset has already been done when the command was
// recorded because it impacts the size of an allocation in the
// CommandAllocator.
- if (cmd->stages & ~nxt::ShaderStageBit::Compute) {
+ if (cmd->stages & ~dawn::ShaderStageBit::Compute) {
NXT_RETURN_ERROR(
"SetPushConstants stage must be compute or 0 in compute passes");
}
@@ -450,12 +450,12 @@
// Track usage of the render pass attachments
for (uint32_t i : IterateBitSet(renderPass->GetColorAttachmentMask())) {
TextureBase* texture = renderPass->GetColorAttachment(i).view->GetTexture();
- usageTracker.TextureUsedAs(texture, nxt::TextureUsageBit::OutputAttachment);
+ usageTracker.TextureUsedAs(texture, dawn::TextureUsageBit::OutputAttachment);
}
if (renderPass->HasDepthStencilAttachment()) {
TextureBase* texture = renderPass->GetDepthStencilAttachment().view->GetTexture();
- usageTracker.TextureUsedAs(texture, nxt::TextureUsageBit::OutputAttachment);
+ usageTracker.TextureUsedAs(texture, dawn::TextureUsageBit::OutputAttachment);
}
Command type;
@@ -499,7 +499,7 @@
// recorded because it impacts the size of an allocation in the
// CommandAllocator.
if (cmd->stages &
- ~(nxt::ShaderStageBit::Vertex | nxt::ShaderStageBit::Fragment)) {
+ ~(dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment)) {
NXT_RETURN_ERROR(
"SetPushConstants stage must be a subset of (vertex|fragment) in "
"render passes");
@@ -528,7 +528,7 @@
case Command::SetIndexBuffer: {
SetIndexBufferCmd* cmd = mIterator.NextCommand<SetIndexBufferCmd>();
- usageTracker.BufferUsedAs(cmd->buffer.Get(), nxt::BufferUsageBit::Index);
+ usageTracker.BufferUsedAs(cmd->buffer.Get(), dawn::BufferUsageBit::Index);
NXT_TRY(mState->SetIndexBuffer());
} break;
@@ -538,7 +538,7 @@
mIterator.NextData<uint32_t>(cmd->count);
for (uint32_t i = 0; i < cmd->count; ++i) {
- usageTracker.BufferUsedAs(buffers[i].Get(), nxt::BufferUsageBit::Vertex);
+ usageTracker.BufferUsedAs(buffers[i].Get(), dawn::BufferUsageBit::Vertex);
NXT_TRY(mState->SetVertexBuffer(cmd->startSlot + i));
}
} break;
@@ -692,7 +692,7 @@
cmd->pipeline = pipeline;
}
- void CommandBufferBuilder::SetPushConstants(nxt::ShaderStageBit stages,
+ void CommandBufferBuilder::SetPushConstants(dawn::ShaderStageBit stages,
uint32_t offset,
uint32_t count,
const void* data) {
diff --git a/src/backend/CommandBuffer.h b/src/backend/CommandBuffer.h
index 3bddb7c..b488e2d 100644
--- a/src/backend/CommandBuffer.h
+++ b/src/backend/CommandBuffer.h
@@ -101,7 +101,7 @@
uint32_t firstInstance);
void EndComputePass();
void EndRenderPass();
- void SetPushConstants(nxt::ShaderStageBit stages,
+ void SetPushConstants(dawn::ShaderStageBit stages,
uint32_t offset,
uint32_t count,
const void* data);
@@ -127,7 +127,7 @@
BufferBase* const* buffers,
uint32_t const* offsets);
- void TransitionBufferUsage(BufferBase* buffer, nxt::BufferUsageBit usage);
+ void TransitionBufferUsage(BufferBase* buffer, dawn::BufferUsageBit usage);
private:
friend class CommandBufferBase;
diff --git a/src/backend/Commands.h b/src/backend/Commands.h
index 0611428..e826447 100644
--- a/src/backend/Commands.h
+++ b/src/backend/Commands.h
@@ -117,7 +117,7 @@
};
struct SetPushConstantsCmd {
- nxt::ShaderStageBit stages;
+ dawn::ShaderStageBit stages;
uint32_t offset;
uint32_t count;
};
diff --git a/src/backend/ComputePipeline.cpp b/src/backend/ComputePipeline.cpp
index 7ffc48a..bf4cdef 100644
--- a/src/backend/ComputePipeline.cpp
+++ b/src/backend/ComputePipeline.cpp
@@ -22,7 +22,7 @@
ComputePipelineBase::ComputePipelineBase(ComputePipelineBuilder* builder)
: PipelineBase(builder) {
- if (GetStageMask() != nxt::ShaderStageBit::Compute) {
+ if (GetStageMask() != dawn::ShaderStageBit::Compute) {
builder->HandleError("Compute pipeline should have exactly a compute stage");
return;
}
diff --git a/src/backend/DepthStencilState.cpp b/src/backend/DepthStencilState.cpp
index a6a6352..fe573f5 100644
--- a/src/backend/DepthStencilState.cpp
+++ b/src/backend/DepthStencilState.cpp
@@ -25,14 +25,14 @@
}
bool DepthStencilStateBase::StencilTestEnabled() const {
- return mStencilInfo.back.compareFunction != nxt::CompareFunction::Always ||
- mStencilInfo.back.stencilFail != nxt::StencilOperation::Keep ||
- mStencilInfo.back.depthFail != nxt::StencilOperation::Keep ||
- mStencilInfo.back.depthStencilPass != nxt::StencilOperation::Keep ||
- mStencilInfo.front.compareFunction != nxt::CompareFunction::Always ||
- mStencilInfo.front.stencilFail != nxt::StencilOperation::Keep ||
- mStencilInfo.front.depthFail != nxt::StencilOperation::Keep ||
- mStencilInfo.front.depthStencilPass != nxt::StencilOperation::Keep;
+ return mStencilInfo.back.compareFunction != dawn::CompareFunction::Always ||
+ mStencilInfo.back.stencilFail != dawn::StencilOperation::Keep ||
+ mStencilInfo.back.depthFail != dawn::StencilOperation::Keep ||
+ mStencilInfo.back.depthStencilPass != dawn::StencilOperation::Keep ||
+ mStencilInfo.front.compareFunction != dawn::CompareFunction::Always ||
+ mStencilInfo.front.stencilFail != dawn::StencilOperation::Keep ||
+ mStencilInfo.front.depthFail != dawn::StencilOperation::Keep ||
+ mStencilInfo.front.depthStencilPass != dawn::StencilOperation::Keep;
}
const DepthStencilStateBase::DepthInfo& DepthStencilStateBase::GetDepth() const {
@@ -61,7 +61,7 @@
}
void DepthStencilStateBuilder::SetDepthCompareFunction(
- nxt::CompareFunction depthCompareFunction) {
+ dawn::CompareFunction depthCompareFunction) {
if ((mPropertiesSet & DEPTH_STENCIL_STATE_PROPERTY_DEPTH_COMPARE_FUNCTION) != 0) {
HandleError("Depth compare property set multiple times");
return;
@@ -83,17 +83,17 @@
mDepthInfo.depthWriteEnabled = enabled;
}
- void DepthStencilStateBuilder::SetStencilFunction(nxt::Face face,
- nxt::CompareFunction stencilCompareFunction,
- nxt::StencilOperation stencilFail,
- nxt::StencilOperation depthFail,
- nxt::StencilOperation depthStencilPass) {
- if (face == nxt::Face::None) {
+ void DepthStencilStateBuilder::SetStencilFunction(dawn::Face face,
+ dawn::CompareFunction stencilCompareFunction,
+ dawn::StencilOperation stencilFail,
+ dawn::StencilOperation depthFail,
+ dawn::StencilOperation depthStencilPass) {
+ if (face == dawn::Face::None) {
HandleError("Can't set stencil function of None face");
return;
}
- if (face & nxt::Face::Back) {
+ if (face & dawn::Face::Back) {
if ((mPropertiesSet & DEPTH_STENCIL_STATE_PROPERTY_STENCIL_BACK_FUNCTION) != 0) {
HandleError("Stencil back function property set multiple times");
return;
@@ -106,7 +106,7 @@
mStencilInfo.back.depthFail = depthFail;
mStencilInfo.back.depthStencilPass = depthStencilPass;
}
- if (face & nxt::Face::Front) {
+ if (face & dawn::Face::Front) {
if ((mPropertiesSet & DEPTH_STENCIL_STATE_PROPERTY_STENCIL_FRONT_FUNCTION) != 0) {
HandleError("Stencil front function property set multiple times");
return;
diff --git a/src/backend/DepthStencilState.h b/src/backend/DepthStencilState.h
index 536d2b2..8d198e7 100644
--- a/src/backend/DepthStencilState.h
+++ b/src/backend/DepthStencilState.h
@@ -28,15 +28,15 @@
DepthStencilStateBase(DepthStencilStateBuilder* builder);
struct DepthInfo {
- nxt::CompareFunction compareFunction = nxt::CompareFunction::Always;
+ dawn::CompareFunction compareFunction = dawn::CompareFunction::Always;
bool depthWriteEnabled = false;
};
struct StencilFaceInfo {
- nxt::CompareFunction compareFunction = nxt::CompareFunction::Always;
- nxt::StencilOperation stencilFail = nxt::StencilOperation::Keep;
- nxt::StencilOperation depthFail = nxt::StencilOperation::Keep;
- nxt::StencilOperation depthStencilPass = nxt::StencilOperation::Keep;
+ dawn::CompareFunction compareFunction = dawn::CompareFunction::Always;
+ dawn::StencilOperation stencilFail = dawn::StencilOperation::Keep;
+ dawn::StencilOperation depthFail = dawn::StencilOperation::Keep;
+ dawn::StencilOperation depthStencilPass = dawn::StencilOperation::Keep;
};
struct StencilInfo {
@@ -60,13 +60,13 @@
DepthStencilStateBuilder(DeviceBase* device);
// NXT API
- void SetDepthCompareFunction(nxt::CompareFunction depthCompareFunction);
+ void SetDepthCompareFunction(dawn::CompareFunction depthCompareFunction);
void SetDepthWriteEnabled(bool enabled);
- void SetStencilFunction(nxt::Face face,
- nxt::CompareFunction stencilCompareFunction,
- nxt::StencilOperation stencilFail,
- nxt::StencilOperation depthFail,
- nxt::StencilOperation depthStencilPass);
+ void SetStencilFunction(dawn::Face face,
+ dawn::CompareFunction stencilCompareFunction,
+ dawn::StencilOperation stencilFail,
+ dawn::StencilOperation depthFail,
+ dawn::StencilOperation depthStencilPass);
void SetStencilMask(uint32_t readMask, uint32_t writeMask);
private:
diff --git a/src/backend/Device.cpp b/src/backend/Device.cpp
index 67f3bb5..24fe60b 100644
--- a/src/backend/Device.cpp
+++ b/src/backend/Device.cpp
@@ -63,8 +63,8 @@
}
}
- void DeviceBase::SetErrorCallback(nxt::DeviceErrorCallback callback,
- nxt::CallbackUserdata userdata) {
+ void DeviceBase::SetErrorCallback(dawn::DeviceErrorCallback callback,
+ dawn::CallbackUserdata userdata) {
mErrorCallback = callback;
mErrorUserdata = userdata;
}
@@ -74,7 +74,7 @@
}
ResultOrError<BindGroupLayoutBase*> DeviceBase::GetOrCreateBindGroupLayout(
- const nxt::BindGroupLayoutDescriptor* descriptor) {
+ const dawn::BindGroupLayoutDescriptor* descriptor) {
BindGroupLayoutBase blueprint(this, descriptor, true);
auto iter = mCaches->bindGroupLayouts.find(&blueprint);
@@ -99,7 +99,7 @@
return new BindGroupBuilder(this);
}
BindGroupLayoutBase* DeviceBase::CreateBindGroupLayout(
- const nxt::BindGroupLayoutDescriptor* descriptor) {
+ const dawn::BindGroupLayoutDescriptor* descriptor) {
BindGroupLayoutBase* result = nullptr;
if (ConsumedError(CreateBindGroupLayoutInternal(&result, descriptor))) {
@@ -127,7 +127,7 @@
return new InputStateBuilder(this);
}
PipelineLayoutBase* DeviceBase::CreatePipelineLayout(
- const nxt::PipelineLayoutDescriptor* descriptor) {
+ const dawn::PipelineLayoutDescriptor* descriptor) {
PipelineLayoutBase* result = nullptr;
if (ConsumedError(CreatePipelineLayoutInternal(&result, descriptor))) {
@@ -151,7 +151,7 @@
RenderPipelineBuilder* DeviceBase::CreateRenderPipelineBuilder() {
return new RenderPipelineBuilder(this);
}
- SamplerBase* DeviceBase::CreateSampler(const nxt::SamplerDescriptor* descriptor) {
+ SamplerBase* DeviceBase::CreateSampler(const dawn::SamplerDescriptor* descriptor) {
SamplerBase* result = nullptr;
if (ConsumedError(CreateSamplerInternal(&result, descriptor))) {
@@ -193,7 +193,7 @@
MaybeError DeviceBase::CreateBindGroupLayoutInternal(
BindGroupLayoutBase** result,
- const nxt::BindGroupLayoutDescriptor* descriptor) {
+ const dawn::BindGroupLayoutDescriptor* descriptor) {
NXT_TRY(ValidateBindGroupLayoutDescriptor(this, descriptor));
NXT_TRY_ASSIGN(*result, GetOrCreateBindGroupLayout(descriptor));
return {};
@@ -201,7 +201,7 @@
MaybeError DeviceBase::CreatePipelineLayoutInternal(
PipelineLayoutBase** result,
- const nxt::PipelineLayoutDescriptor* descriptor) {
+ const dawn::PipelineLayoutDescriptor* descriptor) {
NXT_TRY(ValidatePipelineLayoutDescriptor(this, descriptor));
NXT_TRY_ASSIGN(*result, CreatePipelineLayoutImpl(descriptor));
return {};
@@ -213,7 +213,7 @@
}
MaybeError DeviceBase::CreateSamplerInternal(SamplerBase** result,
- const nxt::SamplerDescriptor* descriptor) {
+ const dawn::SamplerDescriptor* descriptor) {
NXT_TRY(ValidateSamplerDescriptor(this, descriptor));
NXT_TRY_ASSIGN(*result, CreateSamplerImpl(descriptor));
return {};
diff --git a/src/backend/Device.h b/src/backend/Device.h
index 98afec3..363703b 100644
--- a/src/backend/Device.h
+++ b/src/backend/Device.h
@@ -77,49 +77,49 @@
// instead of a backend Foo object. If the blueprint doesn't match an object in the
// cache, then the builder is used to make a new object.
ResultOrError<BindGroupLayoutBase*> GetOrCreateBindGroupLayout(
- const nxt::BindGroupLayoutDescriptor* descriptor);
+ const dawn::BindGroupLayoutDescriptor* descriptor);
void UncacheBindGroupLayout(BindGroupLayoutBase* obj);
// NXT API
BindGroupBuilder* CreateBindGroupBuilder();
BindGroupLayoutBase* CreateBindGroupLayout(
- const nxt::BindGroupLayoutDescriptor* descriptor);
+ const dawn::BindGroupLayoutDescriptor* descriptor);
BlendStateBuilder* CreateBlendStateBuilder();
BufferBuilder* CreateBufferBuilder();
CommandBufferBuilder* CreateCommandBufferBuilder();
ComputePipelineBuilder* CreateComputePipelineBuilder();
DepthStencilStateBuilder* CreateDepthStencilStateBuilder();
InputStateBuilder* CreateInputStateBuilder();
- PipelineLayoutBase* CreatePipelineLayout(const nxt::PipelineLayoutDescriptor* descriptor);
+ PipelineLayoutBase* CreatePipelineLayout(const dawn::PipelineLayoutDescriptor* descriptor);
QueueBase* CreateQueue();
RenderPassDescriptorBuilder* CreateRenderPassDescriptorBuilder();
RenderPipelineBuilder* CreateRenderPipelineBuilder();
- SamplerBase* CreateSampler(const nxt::SamplerDescriptor* descriptor);
+ SamplerBase* CreateSampler(const dawn::SamplerDescriptor* descriptor);
ShaderModuleBuilder* CreateShaderModuleBuilder();
SwapChainBuilder* CreateSwapChainBuilder();
TextureBuilder* CreateTextureBuilder();
void Tick();
- void SetErrorCallback(nxt::DeviceErrorCallback callback, nxt::CallbackUserdata userdata);
+ void SetErrorCallback(dawn::DeviceErrorCallback callback, dawn::CallbackUserdata userdata);
void Reference();
void Release();
private:
virtual ResultOrError<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) = 0;
+ const dawn::BindGroupLayoutDescriptor* descriptor) = 0;
virtual ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) = 0;
+ const dawn::PipelineLayoutDescriptor* descriptor) = 0;
virtual ResultOrError<QueueBase*> CreateQueueImpl() = 0;
virtual ResultOrError<SamplerBase*> CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) = 0;
+ const dawn::SamplerDescriptor* descriptor) = 0;
MaybeError CreateBindGroupLayoutInternal(BindGroupLayoutBase** result,
- const nxt::BindGroupLayoutDescriptor* descriptor);
+ const dawn::BindGroupLayoutDescriptor* descriptor);
MaybeError CreatePipelineLayoutInternal(PipelineLayoutBase** result,
- const nxt::PipelineLayoutDescriptor* descriptor);
+ const dawn::PipelineLayoutDescriptor* descriptor);
MaybeError CreateQueueInternal(QueueBase** result);
MaybeError CreateSamplerInternal(SamplerBase** result,
- const nxt::SamplerDescriptor* descriptor);
+ const dawn::SamplerDescriptor* descriptor);
void ConsumeError(ErrorData* error);
@@ -128,8 +128,8 @@
struct Caches;
Caches* mCaches = nullptr;
- nxt::DeviceErrorCallback mErrorCallback = nullptr;
- nxt::CallbackUserdata mErrorUserdata = 0;
+ dawn::DeviceErrorCallback mErrorCallback = nullptr;
+ dawn::CallbackUserdata mErrorUserdata = 0;
uint32_t mRefCount = 1;
};
diff --git a/src/backend/InputState.cpp b/src/backend/InputState.cpp
index 51cc30d..837d49c 100644
--- a/src/backend/InputState.cpp
+++ b/src/backend/InputState.cpp
@@ -21,64 +21,64 @@
// InputState helpers
- size_t IndexFormatSize(nxt::IndexFormat format) {
+ size_t IndexFormatSize(dawn::IndexFormat format) {
switch (format) {
- case nxt::IndexFormat::Uint16:
+ case dawn::IndexFormat::Uint16:
return sizeof(uint16_t);
- case nxt::IndexFormat::Uint32:
+ case dawn::IndexFormat::Uint32:
return sizeof(uint32_t);
default:
UNREACHABLE();
}
}
- uint32_t VertexFormatNumComponents(nxt::VertexFormat format) {
+ uint32_t VertexFormatNumComponents(dawn::VertexFormat format) {
switch (format) {
- case nxt::VertexFormat::FloatR32G32B32A32:
- case nxt::VertexFormat::IntR32G32B32A32:
- case nxt::VertexFormat::UshortR16G16B16A16:
- case nxt::VertexFormat::UnormR8G8B8A8:
+ case dawn::VertexFormat::FloatR32G32B32A32:
+ case dawn::VertexFormat::IntR32G32B32A32:
+ case dawn::VertexFormat::UshortR16G16B16A16:
+ case dawn::VertexFormat::UnormR8G8B8A8:
return 4;
- case nxt::VertexFormat::FloatR32G32B32:
- case nxt::VertexFormat::IntR32G32B32:
+ case dawn::VertexFormat::FloatR32G32B32:
+ case dawn::VertexFormat::IntR32G32B32:
return 3;
- case nxt::VertexFormat::FloatR32G32:
- case nxt::VertexFormat::IntR32G32:
- case nxt::VertexFormat::UshortR16G16:
- case nxt::VertexFormat::UnormR8G8:
+ case dawn::VertexFormat::FloatR32G32:
+ case dawn::VertexFormat::IntR32G32:
+ case dawn::VertexFormat::UshortR16G16:
+ case dawn::VertexFormat::UnormR8G8:
return 2;
- case nxt::VertexFormat::FloatR32:
- case nxt::VertexFormat::IntR32:
+ case dawn::VertexFormat::FloatR32:
+ case dawn::VertexFormat::IntR32:
return 1;
default:
UNREACHABLE();
}
}
- size_t VertexFormatComponentSize(nxt::VertexFormat format) {
+ size_t VertexFormatComponentSize(dawn::VertexFormat format) {
switch (format) {
- case nxt::VertexFormat::FloatR32G32B32A32:
- case nxt::VertexFormat::FloatR32G32B32:
- case nxt::VertexFormat::FloatR32G32:
- case nxt::VertexFormat::FloatR32:
+ case dawn::VertexFormat::FloatR32G32B32A32:
+ case dawn::VertexFormat::FloatR32G32B32:
+ case dawn::VertexFormat::FloatR32G32:
+ case dawn::VertexFormat::FloatR32:
return sizeof(float);
- case nxt::VertexFormat::IntR32G32B32A32:
- case nxt::VertexFormat::IntR32G32B32:
- case nxt::VertexFormat::IntR32G32:
- case nxt::VertexFormat::IntR32:
+ case dawn::VertexFormat::IntR32G32B32A32:
+ case dawn::VertexFormat::IntR32G32B32:
+ case dawn::VertexFormat::IntR32G32:
+ case dawn::VertexFormat::IntR32:
return sizeof(int32_t);
- case nxt::VertexFormat::UshortR16G16B16A16:
- case nxt::VertexFormat::UshortR16G16:
+ case dawn::VertexFormat::UshortR16G16B16A16:
+ case dawn::VertexFormat::UshortR16G16:
return sizeof(uint16_t);
- case nxt::VertexFormat::UnormR8G8B8A8:
- case nxt::VertexFormat::UnormR8G8:
+ case dawn::VertexFormat::UnormR8G8B8A8:
+ case dawn::VertexFormat::UnormR8G8:
return sizeof(uint8_t);
default:
UNREACHABLE();
}
}
- size_t VertexFormatSize(nxt::VertexFormat format) {
+ size_t VertexFormatSize(dawn::VertexFormat format) {
return VertexFormatNumComponents(format) * VertexFormatComponentSize(format);
}
@@ -128,7 +128,7 @@
void InputStateBuilder::SetAttribute(uint32_t shaderLocation,
uint32_t bindingSlot,
- nxt::VertexFormat format,
+ dawn::VertexFormat format,
uint32_t offset) {
if (shaderLocation >= kMaxVertexAttributes) {
HandleError("Setting attribute out of bounds");
@@ -152,7 +152,7 @@
void InputStateBuilder::SetInput(uint32_t bindingSlot,
uint32_t stride,
- nxt::InputStepMode stepMode) {
+ dawn::InputStepMode stepMode) {
if (bindingSlot >= kMaxVertexInputs) {
HandleError("Setting input out of bounds");
return;
diff --git a/src/backend/InputState.h b/src/backend/InputState.h
index 88db85a..8256b5e 100644
--- a/src/backend/InputState.h
+++ b/src/backend/InputState.h
@@ -27,10 +27,10 @@
namespace backend {
- size_t IndexFormatSize(nxt::IndexFormat format);
- uint32_t VertexFormatNumComponents(nxt::VertexFormat format);
- size_t VertexFormatComponentSize(nxt::VertexFormat format);
- size_t VertexFormatSize(nxt::VertexFormat format);
+ size_t IndexFormatSize(dawn::IndexFormat format);
+ uint32_t VertexFormatNumComponents(dawn::VertexFormat format);
+ size_t VertexFormatComponentSize(dawn::VertexFormat format);
+ size_t VertexFormatSize(dawn::VertexFormat format);
class InputStateBase : public RefCounted {
public:
@@ -38,13 +38,13 @@
struct AttributeInfo {
uint32_t bindingSlot;
- nxt::VertexFormat format;
+ dawn::VertexFormat format;
uint32_t offset;
};
struct InputInfo {
uint32_t stride;
- nxt::InputStepMode stepMode;
+ dawn::InputStepMode stepMode;
};
const std::bitset<kMaxVertexAttributes>& GetAttributesSetMask() const;
@@ -66,9 +66,9 @@
// NXT API
void SetAttribute(uint32_t shaderLocation,
uint32_t bindingSlot,
- nxt::VertexFormat format,
+ dawn::VertexFormat format,
uint32_t offset);
- void SetInput(uint32_t bindingSlot, uint32_t stride, nxt::InputStepMode stepMode);
+ void SetInput(uint32_t bindingSlot, uint32_t stride, dawn::InputStepMode stepMode);
private:
friend class InputStateBase;
diff --git a/src/backend/PassResourceUsage.h b/src/backend/PassResourceUsage.h
index 5849d58..7c47263 100644
--- a/src/backend/PassResourceUsage.h
+++ b/src/backend/PassResourceUsage.h
@@ -29,10 +29,10 @@
// re-compute it.
struct PassResourceUsage {
std::vector<BufferBase*> buffers;
- std::vector<nxt::BufferUsageBit> bufferUsages;
+ std::vector<dawn::BufferUsageBit> bufferUsages;
std::vector<TextureBase*> textures;
- std::vector<nxt::TextureUsageBit> textureUsages;
+ std::vector<dawn::TextureUsageBit> textureUsages;
};
} // namespace backend
diff --git a/src/backend/PerStage.cpp b/src/backend/PerStage.cpp
index bf9a839..d37dce5 100644
--- a/src/backend/PerStage.cpp
+++ b/src/backend/PerStage.cpp
@@ -16,14 +16,14 @@
namespace backend {
- BitSetIterator<kNumStages, nxt::ShaderStage> IterateStages(nxt::ShaderStageBit stages) {
+ BitSetIterator<kNumStages, dawn::ShaderStage> IterateStages(dawn::ShaderStageBit stages) {
std::bitset<kNumStages> bits(static_cast<uint32_t>(stages));
- return BitSetIterator<kNumStages, nxt::ShaderStage>(bits);
+ return BitSetIterator<kNumStages, dawn::ShaderStage>(bits);
}
- nxt::ShaderStageBit StageBit(nxt::ShaderStage stage) {
+ dawn::ShaderStageBit StageBit(dawn::ShaderStage stage) {
ASSERT(static_cast<uint32_t>(stage) < kNumStages);
- return static_cast<nxt::ShaderStageBit>(1 << static_cast<uint32_t>(stage));
+ return static_cast<dawn::ShaderStageBit>(1 << static_cast<uint32_t>(stage));
}
} // namespace backend
diff --git a/src/backend/PerStage.h b/src/backend/PerStage.h
index a9d3c73..d615ebe 100644
--- a/src/backend/PerStage.h
+++ b/src/backend/PerStage.h
@@ -25,44 +25,44 @@
namespace backend {
- static_assert(static_cast<uint32_t>(nxt::ShaderStage::Vertex) < kNumStages, "");
- static_assert(static_cast<uint32_t>(nxt::ShaderStage::Fragment) < kNumStages, "");
- static_assert(static_cast<uint32_t>(nxt::ShaderStage::Compute) < kNumStages, "");
+ static_assert(static_cast<uint32_t>(dawn::ShaderStage::Vertex) < kNumStages, "");
+ static_assert(static_cast<uint32_t>(dawn::ShaderStage::Fragment) < kNumStages, "");
+ static_assert(static_cast<uint32_t>(dawn::ShaderStage::Compute) < kNumStages, "");
- static_assert(static_cast<uint32_t>(nxt::ShaderStageBit::Vertex) ==
- (1 << static_cast<uint32_t>(nxt::ShaderStage::Vertex)),
+ static_assert(static_cast<uint32_t>(dawn::ShaderStageBit::Vertex) ==
+ (1 << static_cast<uint32_t>(dawn::ShaderStage::Vertex)),
"");
- static_assert(static_cast<uint32_t>(nxt::ShaderStageBit::Fragment) ==
- (1 << static_cast<uint32_t>(nxt::ShaderStage::Fragment)),
+ static_assert(static_cast<uint32_t>(dawn::ShaderStageBit::Fragment) ==
+ (1 << static_cast<uint32_t>(dawn::ShaderStage::Fragment)),
"");
- static_assert(static_cast<uint32_t>(nxt::ShaderStageBit::Compute) ==
- (1 << static_cast<uint32_t>(nxt::ShaderStage::Compute)),
+ static_assert(static_cast<uint32_t>(dawn::ShaderStageBit::Compute) ==
+ (1 << static_cast<uint32_t>(dawn::ShaderStage::Compute)),
"");
- BitSetIterator<kNumStages, nxt::ShaderStage> IterateStages(nxt::ShaderStageBit stages);
- nxt::ShaderStageBit StageBit(nxt::ShaderStage stage);
+ BitSetIterator<kNumStages, dawn::ShaderStage> IterateStages(dawn::ShaderStageBit stages);
+ dawn::ShaderStageBit StageBit(dawn::ShaderStage stage);
- static constexpr nxt::ShaderStageBit kAllStages =
- static_cast<nxt::ShaderStageBit>((1 << kNumStages) - 1);
+ static constexpr dawn::ShaderStageBit kAllStages =
+ static_cast<dawn::ShaderStageBit>((1 << kNumStages) - 1);
template <typename T>
class PerStage {
public:
- T& operator[](nxt::ShaderStage stage) {
+ T& operator[](dawn::ShaderStage stage) {
NXT_ASSERT(static_cast<uint32_t>(stage) < kNumStages);
return mData[static_cast<uint32_t>(stage)];
}
- const T& operator[](nxt::ShaderStage stage) const {
+ const T& operator[](dawn::ShaderStage stage) const {
NXT_ASSERT(static_cast<uint32_t>(stage) < kNumStages);
return mData[static_cast<uint32_t>(stage)];
}
- T& operator[](nxt::ShaderStageBit stageBit) {
+ T& operator[](dawn::ShaderStageBit stageBit) {
uint32_t bit = static_cast<uint32_t>(stageBit);
NXT_ASSERT(bit != 0 && IsPowerOfTwo(bit) && bit <= (1 << kNumStages));
return mData[Log2(bit)];
}
- const T& operator[](nxt::ShaderStageBit stageBit) const {
+ const T& operator[](dawn::ShaderStageBit stageBit) const {
uint32_t bit = static_cast<uint32_t>(stageBit);
NXT_ASSERT(bit != 0 && IsPowerOfTwo(bit) && bit <= (1 << kNumStages));
return mData[Log2(bit)];
diff --git a/src/backend/Pipeline.cpp b/src/backend/Pipeline.cpp
index 493fc70..5b9f226 100644
--- a/src/backend/Pipeline.cpp
+++ b/src/backend/Pipeline.cpp
@@ -27,7 +27,7 @@
PipelineBase::PipelineBase(PipelineBuilder* builder)
: mStageMask(builder->mStageMask), mLayout(std::move(builder->mLayout)) {
if (!mLayout) {
- nxt::PipelineLayoutDescriptor descriptor;
+ dawn::PipelineLayoutDescriptor descriptor;
descriptor.numBindGroupLayouts = 0;
descriptor.bindGroupLayouts = nullptr;
mLayout = builder->GetParentBuilder()->GetDevice()->CreatePipelineLayout(&descriptor);
@@ -63,11 +63,11 @@
}
const PipelineBase::PushConstantInfo& PipelineBase::GetPushConstants(
- nxt::ShaderStage stage) const {
+ dawn::ShaderStage stage) const {
return mPushConstants[stage];
}
- nxt::ShaderStageBit PipelineBase::GetStageMask() const {
+ dawn::ShaderStageBit PipelineBase::GetStageMask() const {
return mStageMask;
}
@@ -78,10 +78,10 @@
// PipelineBuilder
PipelineBuilder::PipelineBuilder(BuilderBase* parentBuilder)
- : mParentBuilder(parentBuilder), mStageMask(static_cast<nxt::ShaderStageBit>(0)) {
+ : mParentBuilder(parentBuilder), mStageMask(static_cast<dawn::ShaderStageBit>(0)) {
}
- const PipelineBuilder::StageInfo& PipelineBuilder::GetStageInfo(nxt::ShaderStage stage) const {
+ const PipelineBuilder::StageInfo& PipelineBuilder::GetStageInfo(dawn::ShaderStage stage) const {
ASSERT(mStageMask & StageBit(stage));
return mStages[stage];
}
@@ -94,7 +94,7 @@
mLayout = layout;
}
- void PipelineBuilder::SetStage(nxt::ShaderStage stage,
+ void PipelineBuilder::SetStage(dawn::ShaderStage stage,
ShaderModuleBase* module,
const char* entryPoint) {
if (entryPoint != std::string("main")) {
@@ -107,7 +107,7 @@
return;
}
- nxt::ShaderStageBit bit = StageBit(stage);
+ dawn::ShaderStageBit bit = StageBit(stage);
if (mStageMask & bit) {
mParentBuilder->HandleError("Setting already set stage");
return;
diff --git a/src/backend/Pipeline.h b/src/backend/Pipeline.h
index 9e3dd2e..8781abb 100644
--- a/src/backend/Pipeline.h
+++ b/src/backend/Pipeline.h
@@ -45,13 +45,13 @@
std::bitset<kMaxPushConstants> mask;
std::array<PushConstantType, kMaxPushConstants> types;
};
- const PushConstantInfo& GetPushConstants(nxt::ShaderStage stage) const;
- nxt::ShaderStageBit GetStageMask() const;
+ const PushConstantInfo& GetPushConstants(dawn::ShaderStage stage) const;
+ dawn::ShaderStageBit GetStageMask() const;
PipelineLayoutBase* GetLayout();
private:
- nxt::ShaderStageBit mStageMask;
+ dawn::ShaderStageBit mStageMask;
Ref<PipelineLayoutBase> mLayout;
PerStage<PushConstantInfo> mPushConstants;
};
@@ -64,19 +64,19 @@
std::string entryPoint;
Ref<ShaderModuleBase> module;
};
- const StageInfo& GetStageInfo(nxt::ShaderStage stage) const;
+ const StageInfo& GetStageInfo(dawn::ShaderStage stage) const;
BuilderBase* GetParentBuilder() const;
// NXT API
void SetLayout(PipelineLayoutBase* layout);
- void SetStage(nxt::ShaderStage stage, ShaderModuleBase* module, const char* entryPoint);
+ void SetStage(dawn::ShaderStage stage, ShaderModuleBase* module, const char* entryPoint);
private:
friend class PipelineBase;
BuilderBase* mParentBuilder;
Ref<PipelineLayoutBase> mLayout;
- nxt::ShaderStageBit mStageMask;
+ dawn::ShaderStageBit mStageMask;
PerStage<StageInfo> mStages;
};
diff --git a/src/backend/PipelineLayout.cpp b/src/backend/PipelineLayout.cpp
index 4b469a7..369c80b 100644
--- a/src/backend/PipelineLayout.cpp
+++ b/src/backend/PipelineLayout.cpp
@@ -21,7 +21,7 @@
namespace backend {
MaybeError ValidatePipelineLayoutDescriptor(DeviceBase*,
- const nxt::PipelineLayoutDescriptor* descriptor) {
+ const dawn::PipelineLayoutDescriptor* descriptor) {
NXT_TRY_ASSERT(descriptor->nextInChain == nullptr, "nextInChain must be nullptr");
NXT_TRY_ASSERT(descriptor->numBindGroupLayouts <= kMaxBindGroups,
"too many bind group layouts");
@@ -35,7 +35,7 @@
// PipelineLayoutBase
PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device,
- const nxt::PipelineLayoutDescriptor* descriptor)
+ const dawn::PipelineLayoutDescriptor* descriptor)
: mDevice(device) {
ASSERT(descriptor->numBindGroupLayouts <= kMaxBindGroups);
for (uint32_t group = 0; group < descriptor->numBindGroupLayouts; ++group) {
diff --git a/src/backend/PipelineLayout.h b/src/backend/PipelineLayout.h
index 5fdc89c..78187fc 100644
--- a/src/backend/PipelineLayout.h
+++ b/src/backend/PipelineLayout.h
@@ -28,13 +28,13 @@
namespace backend {
MaybeError ValidatePipelineLayoutDescriptor(DeviceBase*,
- const nxt::PipelineLayoutDescriptor* descriptor);
+ const dawn::PipelineLayoutDescriptor* descriptor);
using BindGroupLayoutArray = std::array<Ref<BindGroupLayoutBase>, kMaxBindGroups>;
class PipelineLayoutBase : public RefCounted {
public:
- PipelineLayoutBase(DeviceBase* device, const nxt::PipelineLayoutDescriptor* descriptor);
+ PipelineLayoutBase(DeviceBase* device, const dawn::PipelineLayoutDescriptor* descriptor);
const BindGroupLayoutBase* GetBindGroupLayout(size_t group) const;
const std::bitset<kMaxBindGroups> GetBindGroupLayoutsMask() const;
diff --git a/src/backend/RenderPassDescriptor.cpp b/src/backend/RenderPassDescriptor.cpp
index 2b64c68..b1c621c 100644
--- a/src/backend/RenderPassDescriptor.cpp
+++ b/src/backend/RenderPassDescriptor.cpp
@@ -126,7 +126,7 @@
void RenderPassDescriptorBuilder::SetColorAttachment(uint32_t attachment,
TextureViewBase* textureView,
- nxt::LoadOp loadOp) {
+ dawn::LoadOp loadOp) {
if (attachment >= kMaxColorAttachments) {
HandleError("Setting color attachment out of bounds");
return;
@@ -159,8 +159,8 @@
}
void RenderPassDescriptorBuilder::SetDepthStencilAttachment(TextureViewBase* textureView,
- nxt::LoadOp depthLoadOp,
- nxt::LoadOp stencilLoadOp) {
+ dawn::LoadOp depthLoadOp,
+ dawn::LoadOp stencilLoadOp) {
if (!TextureFormatHasDepthOrStencil(textureView->GetTexture()->GetFormat())) {
HandleError("Using color texture as depth stencil attachment");
return;
diff --git a/src/backend/RenderPassDescriptor.h b/src/backend/RenderPassDescriptor.h
index 8df3d15..56e2bc3 100644
--- a/src/backend/RenderPassDescriptor.h
+++ b/src/backend/RenderPassDescriptor.h
@@ -29,14 +29,14 @@
namespace backend {
struct RenderPassColorAttachmentInfo {
- nxt::LoadOp loadOp;
+ dawn::LoadOp loadOp;
std::array<float, 4> clearColor = {{0.0f, 0.0f, 0.0f, 0.0f}};
Ref<TextureViewBase> view;
};
struct RenderPassDepthStencilAttachmentInfo {
- nxt::LoadOp depthLoadOp;
- nxt::LoadOp stencilLoadOp;
+ dawn::LoadOp depthLoadOp;
+ dawn::LoadOp stencilLoadOp;
float clearDepth = 1.0f;
uint32_t clearStencil = 0;
Ref<TextureViewBase> view;
@@ -80,15 +80,15 @@
RenderPassDescriptorBase* GetResultImpl() override;
void SetColorAttachment(uint32_t attachment,
TextureViewBase* textureView,
- nxt::LoadOp loadOp);
+ dawn::LoadOp loadOp);
void SetColorAttachmentClearColor(uint32_t attachment,
float clearR,
float clearG,
float clearB,
float clearA);
void SetDepthStencilAttachment(TextureViewBase* textureView,
- nxt::LoadOp depthLoadOp,
- nxt::LoadOp stencilLoadOp);
+ dawn::LoadOp depthLoadOp,
+ dawn::LoadOp stencilLoadOp);
void SetDepthStencilAttachmentClearValue(float clearDepth, uint32_t clearStencil);
private:
diff --git a/src/backend/RenderPipeline.cpp b/src/backend/RenderPipeline.cpp
index 5bff466..47788bc 100644
--- a/src/backend/RenderPipeline.cpp
+++ b/src/backend/RenderPipeline.cpp
@@ -37,14 +37,14 @@
mColorAttachmentFormats(builder->mColorAttachmentFormats),
mDepthStencilFormatSet(builder->mDepthStencilFormatSet),
mDepthStencilFormat(builder->mDepthStencilFormat) {
- if (GetStageMask() != (nxt::ShaderStageBit::Vertex | nxt::ShaderStageBit::Fragment)) {
+ if (GetStageMask() != (dawn::ShaderStageBit::Vertex | dawn::ShaderStageBit::Fragment)) {
builder->HandleError("Render pipeline should have exactly a vertex and fragment stage");
return;
}
// TODO(kainino@chromium.org): Need to verify the pipeline against its render subpass.
- if ((builder->GetStageInfo(nxt::ShaderStage::Vertex).module->GetUsedVertexAttributes() &
+ if ((builder->GetStageInfo(dawn::ShaderStage::Vertex).module->GetUsedVertexAttributes() &
~mInputState->GetAttributesSetMask())
.any()) {
builder->HandleError("Pipeline vertex stage uses inputs not in the input state");
@@ -74,7 +74,7 @@
return mDepthStencilState.Get();
}
- nxt::IndexFormat RenderPipelineBase::GetIndexFormat() const {
+ dawn::IndexFormat RenderPipelineBase::GetIndexFormat() const {
return mIndexFormat;
}
@@ -82,7 +82,7 @@
return mInputState.Get();
}
- nxt::PrimitiveTopology RenderPipelineBase::GetPrimitiveTopology() const {
+ dawn::PrimitiveTopology RenderPipelineBase::GetPrimitiveTopology() const {
return mPrimitiveTopology;
}
@@ -94,11 +94,11 @@
return mDepthStencilFormatSet;
}
- nxt::TextureFormat RenderPipelineBase::GetColorAttachmentFormat(uint32_t attachment) const {
+ dawn::TextureFormat RenderPipelineBase::GetColorAttachmentFormat(uint32_t attachment) const {
return mColorAttachmentFormats[attachment];
}
- nxt::TextureFormat RenderPipelineBase::GetDepthStencilFormat() const {
+ dawn::TextureFormat RenderPipelineBase::GetDepthStencilFormat() const {
return mDepthStencilFormat;
}
@@ -172,7 +172,7 @@
}
void RenderPipelineBuilder::SetColorAttachmentFormat(uint32_t attachmentSlot,
- nxt::TextureFormat format) {
+ dawn::TextureFormat format) {
if (attachmentSlot >= kMaxColorAttachments) {
HandleError("Attachment index out of bounds");
return;
@@ -201,12 +201,12 @@
mDepthStencilState = depthStencilState;
}
- void RenderPipelineBuilder::SetDepthStencilAttachmentFormat(nxt::TextureFormat format) {
+ void RenderPipelineBuilder::SetDepthStencilAttachmentFormat(dawn::TextureFormat format) {
mDepthStencilFormatSet = true;
mDepthStencilFormat = format;
}
- void RenderPipelineBuilder::SetIndexFormat(nxt::IndexFormat format) {
+ void RenderPipelineBuilder::SetIndexFormat(dawn::IndexFormat format) {
mIndexFormat = format;
}
@@ -214,7 +214,7 @@
mInputState = inputState;
}
- void RenderPipelineBuilder::SetPrimitiveTopology(nxt::PrimitiveTopology primitiveTopology) {
+ void RenderPipelineBuilder::SetPrimitiveTopology(dawn::PrimitiveTopology primitiveTopology) {
mPrimitiveTopology = primitiveTopology;
}
diff --git a/src/backend/RenderPipeline.h b/src/backend/RenderPipeline.h
index eda7e11..c13ed27 100644
--- a/src/backend/RenderPipeline.h
+++ b/src/backend/RenderPipeline.h
@@ -33,14 +33,14 @@
BlendStateBase* GetBlendState(uint32_t attachmentSlot);
DepthStencilStateBase* GetDepthStencilState();
- nxt::IndexFormat GetIndexFormat() const;
+ dawn::IndexFormat GetIndexFormat() const;
InputStateBase* GetInputState();
- nxt::PrimitiveTopology GetPrimitiveTopology() const;
+ dawn::PrimitiveTopology GetPrimitiveTopology() const;
std::bitset<kMaxColorAttachments> GetColorAttachmentsMask() const;
bool HasDepthStencilAttachment() const;
- nxt::TextureFormat GetColorAttachmentFormat(uint32_t attachment) const;
- nxt::TextureFormat GetDepthStencilFormat() const;
+ dawn::TextureFormat GetColorAttachmentFormat(uint32_t attachment) const;
+ dawn::TextureFormat GetDepthStencilFormat() const;
// A pipeline can be used in a render pass if its attachment info matches the actual
// attachments in the render pass. This returns whether it is the case.
@@ -48,15 +48,15 @@
private:
Ref<DepthStencilStateBase> mDepthStencilState;
- nxt::IndexFormat mIndexFormat;
+ dawn::IndexFormat mIndexFormat;
Ref<InputStateBase> mInputState;
- nxt::PrimitiveTopology mPrimitiveTopology;
+ dawn::PrimitiveTopology mPrimitiveTopology;
std::array<Ref<BlendStateBase>, kMaxColorAttachments> mBlendStates;
std::bitset<kMaxColorAttachments> mColorAttachmentsSet;
- std::array<nxt::TextureFormat, kMaxColorAttachments> mColorAttachmentFormats;
+ std::array<dawn::TextureFormat, kMaxColorAttachments> mColorAttachmentFormats;
bool mDepthStencilFormatSet = false;
- nxt::TextureFormat mDepthStencilFormat;
+ dawn::TextureFormat mDepthStencilFormat;
};
class RenderPipelineBuilder : public Builder<RenderPipelineBase>, public PipelineBuilder {
@@ -64,12 +64,12 @@
RenderPipelineBuilder(DeviceBase* device);
// NXT API
- void SetColorAttachmentFormat(uint32_t attachmentSlot, nxt::TextureFormat format);
+ void SetColorAttachmentFormat(uint32_t attachmentSlot, dawn::TextureFormat format);
void SetColorAttachmentBlendState(uint32_t attachmentSlot, BlendStateBase* blendState);
- void SetDepthStencilAttachmentFormat(nxt::TextureFormat format);
+ void SetDepthStencilAttachmentFormat(dawn::TextureFormat format);
void SetDepthStencilState(DepthStencilStateBase* depthStencilState);
- void SetPrimitiveTopology(nxt::PrimitiveTopology primitiveTopology);
- void SetIndexFormat(nxt::IndexFormat format);
+ void SetPrimitiveTopology(dawn::PrimitiveTopology primitiveTopology);
+ void SetIndexFormat(dawn::IndexFormat format);
void SetInputState(InputStateBase* inputState);
private:
@@ -81,14 +81,14 @@
Ref<InputStateBase> mInputState;
// TODO(enga@google.com): Remove default when we validate that all required properties are
// set
- nxt::PrimitiveTopology mPrimitiveTopology = nxt::PrimitiveTopology::TriangleList;
- nxt::IndexFormat mIndexFormat = nxt::IndexFormat::Uint32;
+ dawn::PrimitiveTopology mPrimitiveTopology = dawn::PrimitiveTopology::TriangleList;
+ dawn::IndexFormat mIndexFormat = dawn::IndexFormat::Uint32;
std::bitset<kMaxColorAttachments> mBlendStatesSet;
std::array<Ref<BlendStateBase>, kMaxColorAttachments> mBlendStates;
std::bitset<kMaxColorAttachments> mColorAttachmentsSet;
- std::array<nxt::TextureFormat, kMaxColorAttachments> mColorAttachmentFormats;
+ std::array<dawn::TextureFormat, kMaxColorAttachments> mColorAttachmentFormats;
bool mDepthStencilFormatSet = false;
- nxt::TextureFormat mDepthStencilFormat;
+ dawn::TextureFormat mDepthStencilFormat;
};
} // namespace backend
diff --git a/src/backend/Sampler.cpp b/src/backend/Sampler.cpp
index 51c417c..6f48d7c 100644
--- a/src/backend/Sampler.cpp
+++ b/src/backend/Sampler.cpp
@@ -19,7 +19,7 @@
namespace backend {
- MaybeError ValidateSamplerDescriptor(DeviceBase*, const nxt::SamplerDescriptor* descriptor) {
+ MaybeError ValidateSamplerDescriptor(DeviceBase*, const dawn::SamplerDescriptor* descriptor) {
NXT_TRY_ASSERT(descriptor->nextInChain == nullptr, "nextInChain must be nullptr");
NXT_TRY(ValidateFilterMode(descriptor->minFilter));
NXT_TRY(ValidateFilterMode(descriptor->magFilter));
@@ -32,7 +32,7 @@
// SamplerBase
- SamplerBase::SamplerBase(DeviceBase*, const nxt::SamplerDescriptor*) {
+ SamplerBase::SamplerBase(DeviceBase*, const dawn::SamplerDescriptor*) {
}
} // namespace backend
diff --git a/src/backend/Sampler.h b/src/backend/Sampler.h
index 77d2160..a3445bf 100644
--- a/src/backend/Sampler.h
+++ b/src/backend/Sampler.h
@@ -25,11 +25,11 @@
class DeviceBase;
MaybeError ValidateSamplerDescriptor(DeviceBase* device,
- const nxt::SamplerDescriptor* descriptor);
+ const dawn::SamplerDescriptor* descriptor);
class SamplerBase : public RefCounted {
public:
- SamplerBase(DeviceBase* device, const nxt::SamplerDescriptor* descriptor);
+ SamplerBase(DeviceBase* device, const dawn::SamplerDescriptor* descriptor);
};
} // namespace backend
diff --git a/src/backend/ShaderModule.cpp b/src/backend/ShaderModule.cpp
index bc99a1c..eec4bcf 100644
--- a/src/backend/ShaderModule.cpp
+++ b/src/backend/ShaderModule.cpp
@@ -37,13 +37,13 @@
switch (compiler.get_execution_model()) {
case spv::ExecutionModelVertex:
- mExecutionModel = nxt::ShaderStage::Vertex;
+ mExecutionModel = dawn::ShaderStage::Vertex;
break;
case spv::ExecutionModelFragment:
- mExecutionModel = nxt::ShaderStage::Fragment;
+ mExecutionModel = dawn::ShaderStage::Fragment;
break;
case spv::ExecutionModelGLCompute:
- mExecutionModel = nxt::ShaderStage::Compute;
+ mExecutionModel = dawn::ShaderStage::Compute;
break;
default:
UNREACHABLE();
@@ -103,7 +103,7 @@
// Fill in bindingInfo with the SPIRV bindings
auto ExtractResourcesBinding = [this](const std::vector<spirv_cross::Resource>& resources,
const spirv_cross::Compiler& compiler,
- nxt::BindingType bindingType) {
+ dawn::BindingType bindingType) {
constexpr uint64_t requiredBindingDecorationMask =
(1ull << spv::DecorationBinding) | (1ull << spv::DecorationDescriptorSet);
@@ -127,15 +127,15 @@
};
ExtractResourcesBinding(resources.uniform_buffers, compiler,
- nxt::BindingType::UniformBuffer);
+ dawn::BindingType::UniformBuffer);
ExtractResourcesBinding(resources.separate_images, compiler,
- nxt::BindingType::SampledTexture);
- ExtractResourcesBinding(resources.separate_samplers, compiler, nxt::BindingType::Sampler);
+ dawn::BindingType::SampledTexture);
+ ExtractResourcesBinding(resources.separate_samplers, compiler, dawn::BindingType::Sampler);
ExtractResourcesBinding(resources.storage_buffers, compiler,
- nxt::BindingType::StorageBuffer);
+ dawn::BindingType::StorageBuffer);
// Extract the vertex attributes
- if (mExecutionModel == nxt::ShaderStage::Vertex) {
+ if (mExecutionModel == dawn::ShaderStage::Vertex) {
for (const auto& attrib : resources.stage_inputs) {
ASSERT(compiler.get_decoration_mask(attrib.id) & (1ull << spv::DecorationLocation));
uint32_t location = compiler.get_decoration(attrib.id, spv::DecorationLocation);
@@ -159,7 +159,7 @@
}
}
- if (mExecutionModel == nxt::ShaderStage::Fragment) {
+ if (mExecutionModel == dawn::ShaderStage::Fragment) {
// Without a location qualifier on vertex inputs, spirv_cross::CompilerMSL gives them
// all the location 0, causing a compile error.
for (const auto& attrib : resources.stage_inputs) {
@@ -184,7 +184,7 @@
return mUsedVertexAttributes;
}
- nxt::ShaderStage ShaderModuleBase::GetExecutionModel() const {
+ dawn::ShaderStage ShaderModuleBase::GetExecutionModel() const {
return mExecutionModel;
}
diff --git a/src/backend/ShaderModule.h b/src/backend/ShaderModule.h
index 7f8dfbd..44d58a9 100644
--- a/src/backend/ShaderModule.h
+++ b/src/backend/ShaderModule.h
@@ -52,7 +52,7 @@
// The SPIRV ID of the resource.
uint32_t id;
uint32_t base_type_id;
- nxt::BindingType type;
+ dawn::BindingType type;
bool used = false;
};
using ModuleBindingInfo =
@@ -61,7 +61,7 @@
const PushConstantInfo& GetPushConstants() const;
const ModuleBindingInfo& GetBindingInfo() const;
const std::bitset<kMaxVertexAttributes>& GetUsedVertexAttributes() const;
- nxt::ShaderStage GetExecutionModel() const;
+ dawn::ShaderStage GetExecutionModel() const;
bool IsCompatibleWithPipelineLayout(const PipelineLayoutBase* layout);
@@ -72,7 +72,7 @@
PushConstantInfo mPushConstants = {};
ModuleBindingInfo mBindingInfo;
std::bitset<kMaxVertexAttributes> mUsedVertexAttributes;
- nxt::ShaderStage mExecutionModel;
+ dawn::ShaderStage mExecutionModel;
};
class ShaderModuleBuilder : public Builder<ShaderModuleBase> {
diff --git a/src/backend/SwapChain.cpp b/src/backend/SwapChain.cpp
index e51ee94..c85a4ae 100644
--- a/src/backend/SwapChain.cpp
+++ b/src/backend/SwapChain.cpp
@@ -34,15 +34,15 @@
return mDevice;
}
- void SwapChainBase::Configure(nxt::TextureFormat format,
- nxt::TextureUsageBit allowedUsage,
+ void SwapChainBase::Configure(dawn::TextureFormat format,
+ dawn::TextureUsageBit allowedUsage,
uint32_t width,
uint32_t height) {
if (width == 0 || height == 0) {
mDevice->HandleError("Swap chain cannot be configured to zero size");
return;
}
- allowedUsage |= nxt::TextureUsageBit::Present;
+ allowedUsage |= dawn::TextureUsageBit::Present;
mFormat = format;
mAllowedUsage = allowedUsage;
@@ -60,7 +60,7 @@
}
auto* builder = mDevice->CreateTextureBuilder();
- builder->SetDimension(nxt::TextureDimension::e2D);
+ builder->SetDimension(dawn::TextureDimension::e2D);
builder->SetExtent(mWidth, mHeight, 1);
builder->SetFormat(mFormat);
builder->SetMipLevels(1);
diff --git a/src/backend/SwapChain.h b/src/backend/SwapChain.h
index badbc10..3fd133d 100644
--- a/src/backend/SwapChain.h
+++ b/src/backend/SwapChain.h
@@ -32,8 +32,8 @@
DeviceBase* GetDevice();
// NXT API
- void Configure(nxt::TextureFormat format,
- nxt::TextureUsageBit allowedUsage,
+ void Configure(dawn::TextureFormat format,
+ dawn::TextureUsageBit allowedUsage,
uint32_t width,
uint32_t height);
TextureBase* GetNextTexture();
@@ -47,8 +47,8 @@
private:
DeviceBase* mDevice = nullptr;
nxtSwapChainImplementation mImplementation = {};
- nxt::TextureFormat mFormat = {};
- nxt::TextureUsageBit mAllowedUsage;
+ dawn::TextureFormat mFormat = {};
+ dawn::TextureUsageBit mAllowedUsage;
uint32_t mWidth = 0;
uint32_t mHeight = 0;
TextureBase* mLastNextTexture = nullptr;
diff --git a/src/backend/Texture.cpp b/src/backend/Texture.cpp
index 55ea82d..2af352e 100644
--- a/src/backend/Texture.cpp
+++ b/src/backend/Texture.cpp
@@ -19,46 +19,46 @@
namespace backend {
- uint32_t TextureFormatPixelSize(nxt::TextureFormat format) {
+ uint32_t TextureFormatPixelSize(dawn::TextureFormat format) {
switch (format) {
- case nxt::TextureFormat::R8Unorm:
- case nxt::TextureFormat::R8Uint:
+ case dawn::TextureFormat::R8Unorm:
+ case dawn::TextureFormat::R8Uint:
return 1;
- case nxt::TextureFormat::R8G8Unorm:
- case nxt::TextureFormat::R8G8Uint:
+ case dawn::TextureFormat::R8G8Unorm:
+ case dawn::TextureFormat::R8G8Uint:
return 2;
- case nxt::TextureFormat::R8G8B8A8Unorm:
- case nxt::TextureFormat::R8G8B8A8Uint:
- case nxt::TextureFormat::B8G8R8A8Unorm:
+ case dawn::TextureFormat::R8G8B8A8Unorm:
+ case dawn::TextureFormat::R8G8B8A8Uint:
+ case dawn::TextureFormat::B8G8R8A8Unorm:
return 4;
- case nxt::TextureFormat::D32FloatS8Uint:
+ case dawn::TextureFormat::D32FloatS8Uint:
return 8;
default:
UNREACHABLE();
}
}
- bool TextureFormatHasDepth(nxt::TextureFormat format) {
+ bool TextureFormatHasDepth(dawn::TextureFormat format) {
switch (format) {
- case nxt::TextureFormat::D32FloatS8Uint:
+ case dawn::TextureFormat::D32FloatS8Uint:
return true;
default:
return false;
}
}
- bool TextureFormatHasStencil(nxt::TextureFormat format) {
+ bool TextureFormatHasStencil(dawn::TextureFormat format) {
switch (format) {
- case nxt::TextureFormat::D32FloatS8Uint:
+ case dawn::TextureFormat::D32FloatS8Uint:
return true;
default:
return false;
}
}
- bool TextureFormatHasDepthOrStencil(nxt::TextureFormat format) {
+ bool TextureFormatHasDepthOrStencil(dawn::TextureFormat format) {
switch (format) {
- case nxt::TextureFormat::D32FloatS8Uint:
+ case dawn::TextureFormat::D32FloatS8Uint:
return true;
default:
return false;
@@ -82,10 +82,10 @@
return mDevice;
}
- nxt::TextureDimension TextureBase::GetDimension() const {
+ dawn::TextureDimension TextureBase::GetDimension() const {
return mDimension;
}
- nxt::TextureFormat TextureBase::GetFormat() const {
+ dawn::TextureFormat TextureBase::GetFormat() const {
return mFormat;
}
uint32_t TextureBase::GetWidth() const {
@@ -100,7 +100,7 @@
uint32_t TextureBase::GetNumMipLevels() const {
return mNumMipLevels;
}
- nxt::TextureUsageBit TextureBase::GetAllowedUsage() const {
+ dawn::TextureUsageBit TextureBase::GetAllowedUsage() const {
return mAllowedUsage;
}
@@ -135,7 +135,7 @@
return mDevice->CreateTexture(this);
}
- void TextureBuilder::SetDimension(nxt::TextureDimension dimension) {
+ void TextureBuilder::SetDimension(dawn::TextureDimension dimension) {
if ((mPropertiesSet & TEXTURE_PROPERTY_DIMENSION) != 0) {
HandleError("Texture dimension property set multiple times");
return;
@@ -162,7 +162,7 @@
mDepth = depth;
}
- void TextureBuilder::SetFormat(nxt::TextureFormat format) {
+ void TextureBuilder::SetFormat(dawn::TextureFormat format) {
if ((mPropertiesSet & TEXTURE_PROPERTY_FORMAT) != 0) {
HandleError("Texture format property set multiple times");
return;
@@ -182,7 +182,7 @@
mNumMipLevels = numMipLevels;
}
- void TextureBuilder::SetAllowedUsage(nxt::TextureUsageBit usage) {
+ void TextureBuilder::SetAllowedUsage(dawn::TextureUsageBit usage) {
if ((mPropertiesSet & TEXTURE_PROPERTY_ALLOWED_USAGE) != 0) {
HandleError("Texture allowed usage property set multiple times");
return;
diff --git a/src/backend/Texture.h b/src/backend/Texture.h
index 02336d0..7080fbc 100644
--- a/src/backend/Texture.h
+++ b/src/backend/Texture.h
@@ -23,30 +23,30 @@
namespace backend {
- uint32_t TextureFormatPixelSize(nxt::TextureFormat format);
- bool TextureFormatHasDepth(nxt::TextureFormat format);
- bool TextureFormatHasStencil(nxt::TextureFormat format);
- bool TextureFormatHasDepthOrStencil(nxt::TextureFormat format);
+ uint32_t TextureFormatPixelSize(dawn::TextureFormat format);
+ bool TextureFormatHasDepth(dawn::TextureFormat format);
+ bool TextureFormatHasStencil(dawn::TextureFormat format);
+ bool TextureFormatHasDepthOrStencil(dawn::TextureFormat format);
- static constexpr nxt::TextureUsageBit kReadOnlyTextureUsages =
- nxt::TextureUsageBit::TransferSrc | nxt::TextureUsageBit::Sampled |
- nxt::TextureUsageBit::Present;
+ static constexpr dawn::TextureUsageBit kReadOnlyTextureUsages =
+ dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::Sampled |
+ dawn::TextureUsageBit::Present;
- static constexpr nxt::TextureUsageBit kWritableTextureUsages =
- nxt::TextureUsageBit::TransferDst | nxt::TextureUsageBit::Storage |
- nxt::TextureUsageBit::OutputAttachment;
+ static constexpr dawn::TextureUsageBit kWritableTextureUsages =
+ dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Storage |
+ dawn::TextureUsageBit::OutputAttachment;
class TextureBase : public RefCounted {
public:
TextureBase(TextureBuilder* builder);
- nxt::TextureDimension GetDimension() const;
- nxt::TextureFormat GetFormat() const;
+ dawn::TextureDimension GetDimension() const;
+ dawn::TextureFormat GetFormat() const;
uint32_t GetWidth() const;
uint32_t GetHeight() const;
uint32_t GetDepth() const;
uint32_t GetNumMipLevels() const;
- nxt::TextureUsageBit GetAllowedUsage() const;
+ dawn::TextureUsageBit GetAllowedUsage() const;
DeviceBase* GetDevice() const;
// NXT API
@@ -55,11 +55,11 @@
private:
DeviceBase* mDevice;
- nxt::TextureDimension mDimension;
- nxt::TextureFormat mFormat;
+ dawn::TextureDimension mDimension;
+ dawn::TextureFormat mFormat;
uint32_t mWidth, mHeight, mDepth;
uint32_t mNumMipLevels;
- nxt::TextureUsageBit mAllowedUsage = nxt::TextureUsageBit::None;
+ dawn::TextureUsageBit mAllowedUsage = dawn::TextureUsageBit::None;
};
class TextureBuilder : public Builder<TextureBase> {
@@ -67,12 +67,12 @@
TextureBuilder(DeviceBase* device);
// NXT API
- void SetDimension(nxt::TextureDimension dimension);
+ void SetDimension(dawn::TextureDimension dimension);
void SetExtent(uint32_t width, uint32_t height, uint32_t depth);
- void SetFormat(nxt::TextureFormat format);
+ void SetFormat(dawn::TextureFormat format);
void SetMipLevels(uint32_t numMipLevels);
- void SetAllowedUsage(nxt::TextureUsageBit usage);
- void SetInitialUsage(nxt::TextureUsageBit usage);
+ void SetAllowedUsage(dawn::TextureUsageBit usage);
+ void SetInitialUsage(dawn::TextureUsageBit usage);
private:
friend class TextureBase;
@@ -81,11 +81,11 @@
int mPropertiesSet = 0;
- nxt::TextureDimension mDimension;
+ dawn::TextureDimension mDimension;
uint32_t mWidth, mHeight, mDepth;
- nxt::TextureFormat mFormat;
+ dawn::TextureFormat mFormat;
uint32_t mNumMipLevels;
- nxt::TextureUsageBit mAllowedUsage = nxt::TextureUsageBit::None;
+ dawn::TextureUsageBit mAllowedUsage = dawn::TextureUsageBit::None;
};
class TextureViewBase : public RefCounted {
diff --git a/src/backend/d3d12/BindGroupD3D12.cpp b/src/backend/d3d12/BindGroupD3D12.cpp
index 19bb0a3..44d82cc 100644
--- a/src/backend/d3d12/BindGroupD3D12.cpp
+++ b/src/backend/d3d12/BindGroupD3D12.cpp
@@ -46,14 +46,14 @@
auto d3d12Device = mDevice->GetD3D12Device();
for (uint32_t binding : IterateBitSet(layout.mask)) {
switch (layout.types[binding]) {
- case nxt::BindingType::UniformBuffer: {
+ case dawn::BindingType::UniformBuffer: {
auto* view = ToBackend(GetBindingAsBufferView(binding));
auto& cbv = view->GetCBVDescriptor();
d3d12Device->CreateConstantBufferView(
&cbv, cbvUavSrvHeapStart.GetCPUHandle(*cbvUavSrvHeapOffset +
bindingOffsets[binding]));
} break;
- case nxt::BindingType::StorageBuffer: {
+ case dawn::BindingType::StorageBuffer: {
auto* view = ToBackend(GetBindingAsBufferView(binding));
auto& uav = view->GetUAVDescriptor();
d3d12Device->CreateUnorderedAccessView(
@@ -61,7 +61,7 @@
cbvUavSrvHeapStart.GetCPUHandle(*cbvUavSrvHeapOffset +
bindingOffsets[binding]));
} break;
- case nxt::BindingType::SampledTexture: {
+ case dawn::BindingType::SampledTexture: {
auto* view = ToBackend(GetBindingAsTextureView(binding));
auto& srv = view->GetSRVDescriptor();
d3d12Device->CreateShaderResourceView(
@@ -69,7 +69,7 @@
cbvUavSrvHeapStart.GetCPUHandle(*cbvUavSrvHeapOffset +
bindingOffsets[binding]));
} break;
- case nxt::BindingType::Sampler: {
+ case dawn::BindingType::Sampler: {
auto* sampler = ToBackend(GetBindingAsSampler(binding));
auto& samplerDesc = sampler->GetSamplerDescriptor();
d3d12Device->CreateSampler(
diff --git a/src/backend/d3d12/BindGroupLayoutD3D12.cpp b/src/backend/d3d12/BindGroupLayoutD3D12.cpp
index bf4d6d2..10ed158 100644
--- a/src/backend/d3d12/BindGroupLayoutD3D12.cpp
+++ b/src/backend/d3d12/BindGroupLayoutD3D12.cpp
@@ -20,22 +20,22 @@
namespace backend { namespace d3d12 {
BindGroupLayout::BindGroupLayout(Device* device,
- const nxt::BindGroupLayoutDescriptor* descriptor)
+ const dawn::BindGroupLayoutDescriptor* descriptor)
: BindGroupLayoutBase(device, descriptor), mDescriptorCounts{} {
const auto& groupInfo = GetBindingInfo();
for (uint32_t binding : IterateBitSet(groupInfo.mask)) {
switch (groupInfo.types[binding]) {
- case nxt::BindingType::UniformBuffer:
+ case dawn::BindingType::UniformBuffer:
mBindingOffsets[binding] = mDescriptorCounts[CBV]++;
break;
- case nxt::BindingType::StorageBuffer:
+ case dawn::BindingType::StorageBuffer:
mBindingOffsets[binding] = mDescriptorCounts[UAV]++;
break;
- case nxt::BindingType::SampledTexture:
+ case dawn::BindingType::SampledTexture:
mBindingOffsets[binding] = mDescriptorCounts[SRV]++;
break;
- case nxt::BindingType::Sampler:
+ case dawn::BindingType::Sampler:
mBindingOffsets[binding] = mDescriptorCounts[Sampler]++;
break;
}
@@ -85,16 +85,16 @@
for (uint32_t binding : IterateBitSet(groupInfo.mask)) {
switch (groupInfo.types[binding]) {
- case nxt::BindingType::UniformBuffer:
+ case dawn::BindingType::UniformBuffer:
mBindingOffsets[binding] += descriptorOffsets[CBV];
break;
- case nxt::BindingType::StorageBuffer:
+ case dawn::BindingType::StorageBuffer:
mBindingOffsets[binding] += descriptorOffsets[UAV];
break;
- case nxt::BindingType::SampledTexture:
+ case dawn::BindingType::SampledTexture:
mBindingOffsets[binding] += descriptorOffsets[SRV];
break;
- case nxt::BindingType::Sampler:
+ case dawn::BindingType::Sampler:
mBindingOffsets[binding] += descriptorOffsets[Sampler];
break;
}
diff --git a/src/backend/d3d12/BindGroupLayoutD3D12.h b/src/backend/d3d12/BindGroupLayoutD3D12.h
index 1c7e67c..b6d224a 100644
--- a/src/backend/d3d12/BindGroupLayoutD3D12.h
+++ b/src/backend/d3d12/BindGroupLayoutD3D12.h
@@ -25,7 +25,7 @@
class BindGroupLayout : public BindGroupLayoutBase {
public:
- BindGroupLayout(Device* device, const nxt::BindGroupLayoutDescriptor* descriptor);
+ BindGroupLayout(Device* device, const dawn::BindGroupLayoutDescriptor* descriptor);
enum DescriptorType {
CBV,
diff --git a/src/backend/d3d12/BlendStateD3D12.cpp b/src/backend/d3d12/BlendStateD3D12.cpp
index 071d354..babe2ce 100644
--- a/src/backend/d3d12/BlendStateD3D12.cpp
+++ b/src/backend/d3d12/BlendStateD3D12.cpp
@@ -20,67 +20,67 @@
namespace backend { namespace d3d12 {
namespace {
- D3D12_BLEND D3D12Blend(nxt::BlendFactor factor) {
+ D3D12_BLEND D3D12Blend(dawn::BlendFactor factor) {
switch (factor) {
- case nxt::BlendFactor::Zero:
+ case dawn::BlendFactor::Zero:
return D3D12_BLEND_ZERO;
- case nxt::BlendFactor::One:
+ case dawn::BlendFactor::One:
return D3D12_BLEND_ONE;
- case nxt::BlendFactor::SrcColor:
+ case dawn::BlendFactor::SrcColor:
return D3D12_BLEND_SRC_COLOR;
- case nxt::BlendFactor::OneMinusSrcColor:
+ case dawn::BlendFactor::OneMinusSrcColor:
return D3D12_BLEND_INV_SRC_COLOR;
- case nxt::BlendFactor::SrcAlpha:
+ case dawn::BlendFactor::SrcAlpha:
return D3D12_BLEND_SRC_ALPHA;
- case nxt::BlendFactor::OneMinusSrcAlpha:
+ case dawn::BlendFactor::OneMinusSrcAlpha:
return D3D12_BLEND_INV_SRC_ALPHA;
- case nxt::BlendFactor::DstColor:
+ case dawn::BlendFactor::DstColor:
return D3D12_BLEND_DEST_COLOR;
- case nxt::BlendFactor::OneMinusDstColor:
+ case dawn::BlendFactor::OneMinusDstColor:
return D3D12_BLEND_INV_DEST_COLOR;
- case nxt::BlendFactor::DstAlpha:
+ case dawn::BlendFactor::DstAlpha:
return D3D12_BLEND_DEST_ALPHA;
- case nxt::BlendFactor::OneMinusDstAlpha:
+ case dawn::BlendFactor::OneMinusDstAlpha:
return D3D12_BLEND_INV_DEST_ALPHA;
- case nxt::BlendFactor::SrcAlphaSaturated:
+ case dawn::BlendFactor::SrcAlphaSaturated:
return D3D12_BLEND_SRC_ALPHA_SAT;
- case nxt::BlendFactor::BlendColor:
+ case dawn::BlendFactor::BlendColor:
return D3D12_BLEND_BLEND_FACTOR;
- case nxt::BlendFactor::OneMinusBlendColor:
+ case dawn::BlendFactor::OneMinusBlendColor:
return D3D12_BLEND_INV_BLEND_FACTOR;
default:
UNREACHABLE();
}
}
- D3D12_BLEND_OP D3D12BlendOperation(nxt::BlendOperation operation) {
+ D3D12_BLEND_OP D3D12BlendOperation(dawn::BlendOperation operation) {
switch (operation) {
- case nxt::BlendOperation::Add:
+ case dawn::BlendOperation::Add:
return D3D12_BLEND_OP_ADD;
- case nxt::BlendOperation::Subtract:
+ case dawn::BlendOperation::Subtract:
return D3D12_BLEND_OP_SUBTRACT;
- case nxt::BlendOperation::ReverseSubtract:
+ case dawn::BlendOperation::ReverseSubtract:
return D3D12_BLEND_OP_REV_SUBTRACT;
- case nxt::BlendOperation::Min:
+ case dawn::BlendOperation::Min:
return D3D12_BLEND_OP_MIN;
- case nxt::BlendOperation::Max:
+ case dawn::BlendOperation::Max:
return D3D12_BLEND_OP_MAX;
default:
UNREACHABLE();
}
}
- uint8_t D3D12RenderTargetWriteMask(nxt::ColorWriteMask colorWriteMask) {
- static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(nxt::ColorWriteMask::Red) ==
+ uint8_t D3D12RenderTargetWriteMask(dawn::ColorWriteMask colorWriteMask) {
+ static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Red) ==
D3D12_COLOR_WRITE_ENABLE_RED,
"ColorWriteMask values must match");
- static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(nxt::ColorWriteMask::Green) ==
+ static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Green) ==
D3D12_COLOR_WRITE_ENABLE_GREEN,
"ColorWriteMask values must match");
- static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(nxt::ColorWriteMask::Blue) ==
+ static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Blue) ==
D3D12_COLOR_WRITE_ENABLE_BLUE,
"ColorWriteMask values must match");
- static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(nxt::ColorWriteMask::Alpha) ==
+ static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Alpha) ==
D3D12_COLOR_WRITE_ENABLE_ALPHA,
"ColorWriteMask values must match");
return static_cast<uint8_t>(colorWriteMask);
diff --git a/src/backend/d3d12/BufferD3D12.cpp b/src/backend/d3d12/BufferD3D12.cpp
index 85e1c7c..b3927e3 100644
--- a/src/backend/d3d12/BufferD3D12.cpp
+++ b/src/backend/d3d12/BufferD3D12.cpp
@@ -24,42 +24,42 @@
namespace backend { namespace d3d12 {
namespace {
- D3D12_RESOURCE_FLAGS D3D12ResourceFlags(nxt::BufferUsageBit usage) {
+ D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::BufferUsageBit usage) {
D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE;
- if (usage & nxt::BufferUsageBit::Storage) {
+ if (usage & dawn::BufferUsageBit::Storage) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
}
return flags;
}
- D3D12_RESOURCE_STATES D3D12BufferUsage(nxt::BufferUsageBit usage) {
+ D3D12_RESOURCE_STATES D3D12BufferUsage(dawn::BufferUsageBit usage) {
D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON;
- if (usage & nxt::BufferUsageBit::TransferSrc) {
+ if (usage & dawn::BufferUsageBit::TransferSrc) {
resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE;
}
- if (usage & nxt::BufferUsageBit::TransferDst) {
+ if (usage & dawn::BufferUsageBit::TransferDst) {
resourceState |= D3D12_RESOURCE_STATE_COPY_DEST;
}
- if (usage & (nxt::BufferUsageBit::Vertex | nxt::BufferUsageBit::Uniform)) {
+ if (usage & (dawn::BufferUsageBit::Vertex | dawn::BufferUsageBit::Uniform)) {
resourceState |= D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER;
}
- if (usage & nxt::BufferUsageBit::Index) {
+ if (usage & dawn::BufferUsageBit::Index) {
resourceState |= D3D12_RESOURCE_STATE_INDEX_BUFFER;
}
- if (usage & nxt::BufferUsageBit::Storage) {
+ if (usage & dawn::BufferUsageBit::Storage) {
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
}
return resourceState;
}
- D3D12_HEAP_TYPE D3D12HeapType(nxt::BufferUsageBit allowedUsage) {
- if (allowedUsage & nxt::BufferUsageBit::MapRead) {
+ D3D12_HEAP_TYPE D3D12HeapType(dawn::BufferUsageBit allowedUsage) {
+ if (allowedUsage & dawn::BufferUsageBit::MapRead) {
return D3D12_HEAP_TYPE_READBACK;
- } else if (allowedUsage & nxt::BufferUsageBit::MapWrite) {
+ } else if (allowedUsage & dawn::BufferUsageBit::MapWrite) {
return D3D12_HEAP_TYPE_UPLOAD;
} else {
return D3D12_HEAP_TYPE_DEFAULT;
@@ -89,7 +89,7 @@
if (heapType == D3D12_HEAP_TYPE_READBACK) {
bufferUsage |= D3D12_RESOURCE_STATE_COPY_DEST;
mFixedResourceState = true;
- mLastUsage = nxt::BufferUsageBit::TransferDst;
+ mLastUsage = dawn::BufferUsageBit::TransferDst;
}
// D3D12 requires buffers on the UPLOAD heap to have the D3D12_RESOURCE_STATE_GENERIC_READ
@@ -97,7 +97,7 @@
if (heapType == D3D12_HEAP_TYPE_UPLOAD) {
bufferUsage |= D3D12_RESOURCE_STATE_GENERIC_READ;
mFixedResourceState = true;
- mLastUsage = nxt::BufferUsageBit::TransferSrc;
+ mLastUsage = dawn::BufferUsageBit::TransferSrc;
}
mResource = ToBackend(GetDevice())
@@ -119,7 +119,7 @@
}
void Buffer::TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
- nxt::BufferUsageBit usage) {
+ dawn::BufferUsageBit usage) {
// Resources in upload and readback heaps must be kept in the COPY_SOURCE/DEST state
if (mFixedResourceState) {
ASSERT(usage == mLastUsage);
@@ -164,7 +164,7 @@
void Buffer::SetSubDataImpl(uint32_t start, uint32_t count, const uint8_t* data) {
Device* device = ToBackend(GetDevice());
- TransitionUsageNow(device->GetPendingCommandList(), nxt::BufferUsageBit::TransferDst);
+ TransitionUsageNow(device->GetPendingCommandList(), dawn::BufferUsageBit::TransferDst);
device->GetResourceUploader()->BufferSubData(mResource, start, count, data);
}
diff --git a/src/backend/d3d12/BufferD3D12.h b/src/backend/d3d12/BufferD3D12.h
index 37ee584..8441231 100644
--- a/src/backend/d3d12/BufferD3D12.h
+++ b/src/backend/d3d12/BufferD3D12.h
@@ -35,7 +35,7 @@
void OnMapCommandSerialFinished(uint32_t mapSerial, void* data, bool isWrite);
void TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
- nxt::BufferUsageBit usage);
+ dawn::BufferUsageBit usage);
private:
// NXT API
@@ -46,7 +46,7 @@
ComPtr<ID3D12Resource> mResource;
bool mFixedResourceState = false;
- nxt::BufferUsageBit mLastUsage = nxt::BufferUsageBit::None;
+ dawn::BufferUsageBit mLastUsage = dawn::BufferUsageBit::None;
};
class BufferView : public BufferViewBase {
diff --git a/src/backend/d3d12/CommandBufferD3D12.cpp b/src/backend/d3d12/CommandBufferD3D12.cpp
index 5b75ab4..ae61691 100644
--- a/src/backend/d3d12/CommandBufferD3D12.cpp
+++ b/src/backend/d3d12/CommandBufferD3D12.cpp
@@ -34,11 +34,11 @@
namespace backend { namespace d3d12 {
namespace {
- DXGI_FORMAT DXGIIndexFormat(nxt::IndexFormat format) {
+ DXGI_FORMAT DXGIIndexFormat(dawn::IndexFormat format) {
switch (format) {
- case nxt::IndexFormat::Uint16:
+ case dawn::IndexFormat::Uint16:
return DXGI_FORMAT_R16_UINT;
- case nxt::IndexFormat::Uint32:
+ case dawn::IndexFormat::Uint32:
return DXGI_FORMAT_R32_UINT;
default:
UNREACHABLE();
@@ -308,8 +308,8 @@
Buffer* srcBuffer = ToBackend(copy->source.buffer.Get());
Buffer* dstBuffer = ToBackend(copy->destination.buffer.Get());
- srcBuffer->TransitionUsageNow(commandList, nxt::BufferUsageBit::TransferSrc);
- dstBuffer->TransitionUsageNow(commandList, nxt::BufferUsageBit::TransferDst);
+ srcBuffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferSrc);
+ dstBuffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferDst);
commandList->CopyBufferRegion(
dstBuffer->GetD3D12Resource().Get(), copy->destination.offset,
@@ -321,8 +321,8 @@
Buffer* buffer = ToBackend(copy->source.buffer.Get());
Texture* texture = ToBackend(copy->destination.texture.Get());
- buffer->TransitionUsageNow(commandList, nxt::BufferUsageBit::TransferSrc);
- texture->TransitionUsageNow(commandList, nxt::TextureUsageBit::TransferDst);
+ buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferSrc);
+ texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::TransferDst);
auto copySplit = ComputeTextureCopySplit(
copy->destination.x, copy->destination.y, copy->destination.z,
@@ -367,8 +367,8 @@
Texture* texture = ToBackend(copy->source.texture.Get());
Buffer* buffer = ToBackend(copy->destination.buffer.Get());
- texture->TransitionUsageNow(commandList, nxt::TextureUsageBit::TransferSrc);
- buffer->TransitionUsageNow(commandList, nxt::BufferUsageBit::TransferDst);
+ texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::TransferSrc);
+ buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferDst);
auto copySplit = ComputeTextureCopySplit(
copy->source.x, copy->source.y, copy->source.z, copy->source.width,
@@ -462,7 +462,7 @@
auto& attachmentInfo = renderPass->GetColorAttachment(i);
// Load op - color
- if (attachmentInfo.loadOp == nxt::LoadOp::Clear) {
+ if (attachmentInfo.loadOp == dawn::LoadOp::Clear) {
D3D12_CPU_DESCRIPTOR_HANDLE handle = renderPass->GetRTVDescriptor(i);
commandList->ClearRenderTargetView(handle, attachmentInfo.clearColor.data(), 0,
nullptr);
@@ -475,9 +475,9 @@
// Load op - depth/stencil
bool doDepthClear = TextureFormatHasDepth(texture->GetFormat()) &&
- (attachmentInfo.depthLoadOp == nxt::LoadOp::Clear);
+ (attachmentInfo.depthLoadOp == dawn::LoadOp::Clear);
bool doStencilClear = TextureFormatHasStencil(texture->GetFormat()) &&
- (attachmentInfo.stencilLoadOp == nxt::LoadOp::Clear);
+ (attachmentInfo.stencilLoadOp == dawn::LoadOp::Clear);
D3D12_CLEAR_FLAGS clearFlags = {};
if (doDepthClear) {
diff --git a/src/backend/d3d12/ComputePipelineD3D12.cpp b/src/backend/d3d12/ComputePipelineD3D12.cpp
index d982c73..1784fe8 100644
--- a/src/backend/d3d12/ComputePipelineD3D12.cpp
+++ b/src/backend/d3d12/ComputePipelineD3D12.cpp
@@ -33,8 +33,8 @@
// SPRIV-cross does matrix multiplication expecting row major matrices
compileFlags |= D3DCOMPILE_PACK_MATRIX_ROW_MAJOR;
- const auto& module = ToBackend(builder->GetStageInfo(nxt::ShaderStage::Compute).module);
- const auto& entryPoint = builder->GetStageInfo(nxt::ShaderStage::Compute).entryPoint;
+ const auto& module = ToBackend(builder->GetStageInfo(dawn::ShaderStage::Compute).module);
+ const auto& entryPoint = builder->GetStageInfo(dawn::ShaderStage::Compute).entryPoint;
const auto& hlslSource = module->GetHLSLSource();
ComPtr<ID3DBlob> compiledShader;
diff --git a/src/backend/d3d12/DepthStencilStateD3D12.cpp b/src/backend/d3d12/DepthStencilStateD3D12.cpp
index f05d98e..9411136 100644
--- a/src/backend/d3d12/DepthStencilStateD3D12.cpp
+++ b/src/backend/d3d12/DepthStencilStateD3D12.cpp
@@ -18,46 +18,46 @@
namespace backend { namespace d3d12 {
- static D3D12_STENCIL_OP StencilOp(nxt::StencilOperation op) {
+ static D3D12_STENCIL_OP StencilOp(dawn::StencilOperation op) {
switch (op) {
- case nxt::StencilOperation::Keep:
+ case dawn::StencilOperation::Keep:
return D3D12_STENCIL_OP_KEEP;
- case nxt::StencilOperation::Zero:
+ case dawn::StencilOperation::Zero:
return D3D12_STENCIL_OP_ZERO;
- case nxt::StencilOperation::Replace:
+ case dawn::StencilOperation::Replace:
return D3D12_STENCIL_OP_REPLACE;
- case nxt::StencilOperation::IncrementClamp:
+ case dawn::StencilOperation::IncrementClamp:
return D3D12_STENCIL_OP_INCR_SAT;
- case nxt::StencilOperation::DecrementClamp:
+ case dawn::StencilOperation::DecrementClamp:
return D3D12_STENCIL_OP_DECR_SAT;
- case nxt::StencilOperation::Invert:
+ case dawn::StencilOperation::Invert:
return D3D12_STENCIL_OP_INVERT;
- case nxt::StencilOperation::IncrementWrap:
+ case dawn::StencilOperation::IncrementWrap:
return D3D12_STENCIL_OP_INCR;
- case nxt::StencilOperation::DecrementWrap:
+ case dawn::StencilOperation::DecrementWrap:
return D3D12_STENCIL_OP_DECR;
default:
UNREACHABLE();
}
}
- static D3D12_COMPARISON_FUNC ComparisonFunc(nxt::CompareFunction func) {
+ static D3D12_COMPARISON_FUNC ComparisonFunc(dawn::CompareFunction func) {
switch (func) {
- case nxt::CompareFunction::Always:
+ case dawn::CompareFunction::Always:
return D3D12_COMPARISON_FUNC_ALWAYS;
- case nxt::CompareFunction::Equal:
+ case dawn::CompareFunction::Equal:
return D3D12_COMPARISON_FUNC_EQUAL;
- case nxt::CompareFunction::Greater:
+ case dawn::CompareFunction::Greater:
return D3D12_COMPARISON_FUNC_GREATER;
- case nxt::CompareFunction::GreaterEqual:
+ case dawn::CompareFunction::GreaterEqual:
return D3D12_COMPARISON_FUNC_GREATER_EQUAL;
- case nxt::CompareFunction::Less:
+ case dawn::CompareFunction::Less:
return D3D12_COMPARISON_FUNC_LESS;
- case nxt::CompareFunction::LessEqual:
+ case dawn::CompareFunction::LessEqual:
return D3D12_COMPARISON_FUNC_LESS_EQUAL;
- case nxt::CompareFunction::Never:
+ case dawn::CompareFunction::Never:
return D3D12_COMPARISON_FUNC_NEVER;
- case nxt::CompareFunction::NotEqual:
+ case dawn::CompareFunction::NotEqual:
return D3D12_COMPARISON_FUNC_NOT_EQUAL;
default:
UNREACHABLE();
diff --git a/src/backend/d3d12/DeviceD3D12.cpp b/src/backend/d3d12/DeviceD3D12.cpp
index 60c5dab..f997405 100644
--- a/src/backend/d3d12/DeviceD3D12.cpp
+++ b/src/backend/d3d12/DeviceD3D12.cpp
@@ -267,7 +267,7 @@
return new BindGroup(this, builder);
}
ResultOrError<BindGroupLayoutBase*> Device::CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) {
+ const dawn::BindGroupLayoutDescriptor* descriptor) {
return new BindGroupLayout(this, descriptor);
}
BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) {
@@ -292,7 +292,7 @@
return new InputState(this, builder);
}
ResultOrError<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) {
+ const dawn::PipelineLayoutDescriptor* descriptor) {
return new PipelineLayout(this, descriptor);
}
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
@@ -306,7 +306,7 @@
return new RenderPipeline(builder);
}
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) {
+ const dawn::SamplerDescriptor* descriptor) {
return new Sampler(this, descriptor);
}
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
diff --git a/src/backend/d3d12/DeviceD3D12.h b/src/backend/d3d12/DeviceD3D12.h
index a43089a..1d96fec 100644
--- a/src/backend/d3d12/DeviceD3D12.h
+++ b/src/backend/d3d12/DeviceD3D12.h
@@ -78,12 +78,12 @@
private:
ResultOrError<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) override;
+ const dawn::BindGroupLayoutDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) override;
+ const dawn::PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) override;
+ const dawn::SamplerDescriptor* descriptor) override;
uint64_t mSerial = 0;
ComPtr<ID3D12Fence> mFence;
diff --git a/src/backend/d3d12/InputStateD3D12.cpp b/src/backend/d3d12/InputStateD3D12.cpp
index 1cd8b85..82c8e11 100644
--- a/src/backend/d3d12/InputStateD3D12.cpp
+++ b/src/backend/d3d12/InputStateD3D12.cpp
@@ -18,42 +18,42 @@
namespace backend { namespace d3d12 {
- static DXGI_FORMAT VertexFormatType(nxt::VertexFormat format) {
+ static DXGI_FORMAT VertexFormatType(dawn::VertexFormat format) {
switch (format) {
- case nxt::VertexFormat::FloatR32G32B32A32:
+ case dawn::VertexFormat::FloatR32G32B32A32:
return DXGI_FORMAT_R32G32B32A32_FLOAT;
- case nxt::VertexFormat::FloatR32G32B32:
+ case dawn::VertexFormat::FloatR32G32B32:
return DXGI_FORMAT_R32G32B32_FLOAT;
- case nxt::VertexFormat::FloatR32G32:
+ case dawn::VertexFormat::FloatR32G32:
return DXGI_FORMAT_R32G32_FLOAT;
- case nxt::VertexFormat::FloatR32:
+ case dawn::VertexFormat::FloatR32:
return DXGI_FORMAT_R32_FLOAT;
- case nxt::VertexFormat::IntR32G32B32A32:
+ case dawn::VertexFormat::IntR32G32B32A32:
return DXGI_FORMAT_R32G32B32A32_SINT;
- case nxt::VertexFormat::IntR32G32B32:
+ case dawn::VertexFormat::IntR32G32B32:
return DXGI_FORMAT_R32G32B32_SINT;
- case nxt::VertexFormat::IntR32G32:
+ case dawn::VertexFormat::IntR32G32:
return DXGI_FORMAT_R32G32_SINT;
- case nxt::VertexFormat::IntR32:
+ case dawn::VertexFormat::IntR32:
return DXGI_FORMAT_R32_SINT;
- case nxt::VertexFormat::UshortR16G16B16A16:
+ case dawn::VertexFormat::UshortR16G16B16A16:
return DXGI_FORMAT_R16G16B16A16_UINT;
- case nxt::VertexFormat::UshortR16G16:
+ case dawn::VertexFormat::UshortR16G16:
return DXGI_FORMAT_R16G16_UINT;
- case nxt::VertexFormat::UnormR8G8B8A8:
+ case dawn::VertexFormat::UnormR8G8B8A8:
return DXGI_FORMAT_R8G8B8A8_UNORM;
- case nxt::VertexFormat::UnormR8G8:
+ case dawn::VertexFormat::UnormR8G8:
return DXGI_FORMAT_R8G8_UNORM;
default:
UNREACHABLE();
}
}
- static D3D12_INPUT_CLASSIFICATION InputStepModeFunction(nxt::InputStepMode mode) {
+ static D3D12_INPUT_CLASSIFICATION InputStepModeFunction(dawn::InputStepMode mode) {
switch (mode) {
- case nxt::InputStepMode::Vertex:
+ case dawn::InputStepMode::Vertex:
return D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA;
- case nxt::InputStepMode::Instance:
+ case dawn::InputStepMode::Instance:
return D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA;
default:
UNREACHABLE();
diff --git a/src/backend/d3d12/NativeSwapChainImplD3D12.cpp b/src/backend/d3d12/NativeSwapChainImplD3D12.cpp
index 9c0bb68..e9ce8a7 100644
--- a/src/backend/d3d12/NativeSwapChainImplD3D12.cpp
+++ b/src/backend/d3d12/NativeSwapChainImplD3D12.cpp
@@ -111,8 +111,8 @@
return NXT_SWAP_CHAIN_NO_ERROR;
}
- nxt::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
- return nxt::TextureFormat::R8G8B8A8Unorm;
+ dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
+ return dawn::TextureFormat::R8G8B8A8Unorm;
}
}} // namespace backend::d3d12
diff --git a/src/backend/d3d12/NativeSwapChainImplD3D12.h b/src/backend/d3d12/NativeSwapChainImplD3D12.h
index 0387d57..3bce534 100644
--- a/src/backend/d3d12/NativeSwapChainImplD3D12.h
+++ b/src/backend/d3d12/NativeSwapChainImplD3D12.h
@@ -41,7 +41,7 @@
nxtSwapChainError GetNextTexture(nxtSwapChainNextTexture* nextTexture);
nxtSwapChainError Present();
- nxt::TextureFormat GetPreferredFormat() const;
+ dawn::TextureFormat GetPreferredFormat() const;
private:
HWND mWindow = nullptr;
diff --git a/src/backend/d3d12/PipelineLayoutD3D12.cpp b/src/backend/d3d12/PipelineLayoutD3D12.cpp
index 031dbca..cf2ecfb 100644
--- a/src/backend/d3d12/PipelineLayoutD3D12.cpp
+++ b/src/backend/d3d12/PipelineLayoutD3D12.cpp
@@ -23,7 +23,7 @@
namespace backend { namespace d3d12 {
- PipelineLayout::PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor)
+ PipelineLayout::PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor)
: PipelineLayoutBase(device, descriptor) {
D3D12_ROOT_PARAMETER rootParameters[kMaxBindGroups * 2];
diff --git a/src/backend/d3d12/PipelineLayoutD3D12.h b/src/backend/d3d12/PipelineLayoutD3D12.h
index 214f9cf..87cbd4a 100644
--- a/src/backend/d3d12/PipelineLayoutD3D12.h
+++ b/src/backend/d3d12/PipelineLayoutD3D12.h
@@ -25,7 +25,7 @@
class PipelineLayout : public PipelineLayoutBase {
public:
- PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor);
+ PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor);
uint32_t GetCbvUavSrvRootParameterIndex(uint32_t group) const;
uint32_t GetSamplerRootParameterIndex(uint32_t group) const;
diff --git a/src/backend/d3d12/RenderPipelineD3D12.cpp b/src/backend/d3d12/RenderPipelineD3D12.cpp
index 362a4fa..ea21210 100644
--- a/src/backend/d3d12/RenderPipelineD3D12.cpp
+++ b/src/backend/d3d12/RenderPipelineD3D12.cpp
@@ -28,17 +28,17 @@
namespace backend { namespace d3d12 {
namespace {
- D3D12_PRIMITIVE_TOPOLOGY D3D12PrimitiveTopology(nxt::PrimitiveTopology primitiveTopology) {
+ D3D12_PRIMITIVE_TOPOLOGY D3D12PrimitiveTopology(dawn::PrimitiveTopology primitiveTopology) {
switch (primitiveTopology) {
- case nxt::PrimitiveTopology::PointList:
+ case dawn::PrimitiveTopology::PointList:
return D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
- case nxt::PrimitiveTopology::LineList:
+ case dawn::PrimitiveTopology::LineList:
return D3D_PRIMITIVE_TOPOLOGY_LINELIST;
- case nxt::PrimitiveTopology::LineStrip:
+ case dawn::PrimitiveTopology::LineStrip:
return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
- case nxt::PrimitiveTopology::TriangleList:
+ case dawn::PrimitiveTopology::TriangleList:
return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
- case nxt::PrimitiveTopology::TriangleStrip:
+ case dawn::PrimitiveTopology::TriangleStrip:
return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
default:
UNREACHABLE();
@@ -46,15 +46,15 @@
}
D3D12_PRIMITIVE_TOPOLOGY_TYPE D3D12PrimitiveTopologyType(
- nxt::PrimitiveTopology primitiveTopology) {
+ dawn::PrimitiveTopology primitiveTopology) {
switch (primitiveTopology) {
- case nxt::PrimitiveTopology::PointList:
+ case dawn::PrimitiveTopology::PointList:
return D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT;
- case nxt::PrimitiveTopology::LineList:
- case nxt::PrimitiveTopology::LineStrip:
+ case dawn::PrimitiveTopology::LineList:
+ case dawn::PrimitiveTopology::LineStrip:
return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
- case nxt::PrimitiveTopology::TriangleList:
- case nxt::PrimitiveTopology::TriangleStrip:
+ case dawn::PrimitiveTopology::TriangleList:
+ case dawn::PrimitiveTopology::TriangleStrip:
return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
default:
UNREACHABLE();
@@ -88,15 +88,15 @@
D3D12_SHADER_BYTECODE* shader = nullptr;
switch (stage) {
- case nxt::ShaderStage::Vertex:
+ case dawn::ShaderStage::Vertex:
shader = &descriptor.VS;
compileTarget = "vs_5_1";
break;
- case nxt::ShaderStage::Fragment:
+ case dawn::ShaderStage::Fragment:
shader = &descriptor.PS;
compileTarget = "ps_5_1";
break;
- case nxt::ShaderStage::Compute:
+ case dawn::ShaderStage::Compute:
UNREACHABLE();
break;
}
diff --git a/src/backend/d3d12/SamplerD3D12.cpp b/src/backend/d3d12/SamplerD3D12.cpp
index b7d4ecc..c0a60d7 100644
--- a/src/backend/d3d12/SamplerD3D12.cpp
+++ b/src/backend/d3d12/SamplerD3D12.cpp
@@ -19,13 +19,13 @@
namespace backend { namespace d3d12 {
namespace {
- D3D12_TEXTURE_ADDRESS_MODE AddressMode(nxt::AddressMode mode) {
+ D3D12_TEXTURE_ADDRESS_MODE AddressMode(dawn::AddressMode mode) {
switch (mode) {
- case nxt::AddressMode::Repeat:
+ case dawn::AddressMode::Repeat:
return D3D12_TEXTURE_ADDRESS_MODE_WRAP;
- case nxt::AddressMode::MirroredRepeat:
+ case dawn::AddressMode::MirroredRepeat:
return D3D12_TEXTURE_ADDRESS_MODE_MIRROR;
- case nxt::AddressMode::ClampToEdge:
+ case dawn::AddressMode::ClampToEdge:
return D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
default:
UNREACHABLE();
@@ -33,7 +33,7 @@
}
} // namespace
- Sampler::Sampler(Device* device, const nxt::SamplerDescriptor* descriptor)
+ Sampler::Sampler(Device* device, const dawn::SamplerDescriptor* descriptor)
: SamplerBase(device, descriptor) {
// https://msdn.microsoft.com/en-us/library/windows/desktop/dn770367(v=vs.85).aspx
// hex value, decimal value, min linear, mag linear, mip linear
@@ -53,25 +53,25 @@
uint8_t mode = 0;
switch (descriptor->minFilter) {
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
break;
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
mode += 16;
break;
}
switch (descriptor->magFilter) {
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
break;
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
mode += 4;
break;
}
switch (descriptor->mipmapFilter) {
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
break;
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
mode += 1;
break;
}
diff --git a/src/backend/d3d12/SamplerD3D12.h b/src/backend/d3d12/SamplerD3D12.h
index 2c444e8..014ef7a 100644
--- a/src/backend/d3d12/SamplerD3D12.h
+++ b/src/backend/d3d12/SamplerD3D12.h
@@ -25,7 +25,7 @@
class Sampler : public SamplerBase {
public:
- Sampler(Device* device, const nxt::SamplerDescriptor* descriptor);
+ Sampler(Device* device, const dawn::SamplerDescriptor* descriptor);
const D3D12_SAMPLER_DESC& GetSamplerDescriptor() const;
diff --git a/src/backend/d3d12/ShaderModuleD3D12.cpp b/src/backend/d3d12/ShaderModuleD3D12.cpp
index 97f5a3f..fd505c8 100644
--- a/src/backend/d3d12/ShaderModuleD3D12.cpp
+++ b/src/backend/d3d12/ShaderModuleD3D12.cpp
@@ -24,15 +24,15 @@
template <typename T>
class BindingTypeMap {
public:
- T& operator[](nxt::BindingType type) {
+ T& operator[](dawn::BindingType type) {
switch (type) {
- case nxt::BindingType::UniformBuffer:
+ case dawn::BindingType::UniformBuffer:
return mMap[0];
- case nxt::BindingType::Sampler:
+ case dawn::BindingType::Sampler:
return mMap[1];
- case nxt::BindingType::SampledTexture:
+ case dawn::BindingType::SampledTexture:
return mMap[2];
- case nxt::BindingType::StorageBuffer:
+ case dawn::BindingType::StorageBuffer:
return mMap[3];
default:
NXT_UNREACHABLE();
diff --git a/src/backend/d3d12/SwapChainD3D12.cpp b/src/backend/d3d12/SwapChainD3D12.cpp
index d8ae565..97c4de9 100644
--- a/src/backend/d3d12/SwapChainD3D12.cpp
+++ b/src/backend/d3d12/SwapChainD3D12.cpp
@@ -28,7 +28,7 @@
im.Init(im.userData, &wsiContext);
ASSERT(im.textureUsage != NXT_TEXTURE_USAGE_BIT_NONE);
- mTextureUsage = static_cast<nxt::TextureUsageBit>(im.textureUsage);
+ mTextureUsage = static_cast<dawn::TextureUsageBit>(im.textureUsage);
}
SwapChain::~SwapChain() {
diff --git a/src/backend/d3d12/SwapChainD3D12.h b/src/backend/d3d12/SwapChainD3D12.h
index edb5989..02e0167 100644
--- a/src/backend/d3d12/SwapChainD3D12.h
+++ b/src/backend/d3d12/SwapChainD3D12.h
@@ -28,7 +28,7 @@
TextureBase* GetNextTextureImpl(TextureBuilder* builder) override;
void OnBeforePresent(TextureBase* texture) override;
- nxt::TextureUsageBit mTextureUsage;
+ dawn::TextureUsageBit mTextureUsage;
};
}} // namespace backend::d3d12
diff --git a/src/backend/d3d12/TextureD3D12.cpp b/src/backend/d3d12/TextureD3D12.cpp
index a85c416..c7ee7b8 100644
--- a/src/backend/d3d12/TextureD3D12.cpp
+++ b/src/backend/d3d12/TextureD3D12.cpp
@@ -20,29 +20,29 @@
namespace backend { namespace d3d12 {
namespace {
- D3D12_RESOURCE_STATES D3D12TextureUsage(nxt::TextureUsageBit usage,
- nxt::TextureFormat format) {
+ D3D12_RESOURCE_STATES D3D12TextureUsage(dawn::TextureUsageBit usage,
+ dawn::TextureFormat format) {
D3D12_RESOURCE_STATES resourceState = D3D12_RESOURCE_STATE_COMMON;
// Present is an exclusive flag.
- if (usage & nxt::TextureUsageBit::Present) {
+ if (usage & dawn::TextureUsageBit::Present) {
return D3D12_RESOURCE_STATE_PRESENT;
}
- if (usage & nxt::TextureUsageBit::TransferSrc) {
+ if (usage & dawn::TextureUsageBit::TransferSrc) {
resourceState |= D3D12_RESOURCE_STATE_COPY_SOURCE;
}
- if (usage & nxt::TextureUsageBit::TransferDst) {
+ if (usage & dawn::TextureUsageBit::TransferDst) {
resourceState |= D3D12_RESOURCE_STATE_COPY_DEST;
}
- if (usage & nxt::TextureUsageBit::Sampled) {
+ if (usage & dawn::TextureUsageBit::Sampled) {
resourceState |= (D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE |
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
}
- if (usage & nxt::TextureUsageBit::Storage) {
+ if (usage & dawn::TextureUsageBit::Storage) {
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
}
- if (usage & nxt::TextureUsageBit::OutputAttachment) {
+ if (usage & dawn::TextureUsageBit::OutputAttachment) {
if (TextureFormatHasDepth(format) || TextureFormatHasStencil(format)) {
resourceState |= D3D12_RESOURCE_STATE_DEPTH_WRITE;
} else {
@@ -53,14 +53,14 @@
return resourceState;
}
- D3D12_RESOURCE_FLAGS D3D12ResourceFlags(nxt::TextureUsageBit usage,
- nxt::TextureFormat format) {
+ D3D12_RESOURCE_FLAGS D3D12ResourceFlags(dawn::TextureUsageBit usage,
+ dawn::TextureFormat format) {
D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE;
- if (usage & nxt::TextureUsageBit::Storage) {
+ if (usage & dawn::TextureUsageBit::Storage) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
}
- if (usage & nxt::TextureUsageBit::OutputAttachment) {
+ if (usage & dawn::TextureUsageBit::OutputAttachment) {
if (TextureFormatHasDepth(format) || TextureFormatHasStencil(format)) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
} else {
@@ -73,9 +73,9 @@
return flags;
}
- D3D12_RESOURCE_DIMENSION D3D12TextureDimension(nxt::TextureDimension dimension) {
+ D3D12_RESOURCE_DIMENSION D3D12TextureDimension(dawn::TextureDimension dimension) {
switch (dimension) {
- case nxt::TextureDimension::e2D:
+ case dawn::TextureDimension::e2D:
return D3D12_RESOURCE_DIMENSION_TEXTURE2D;
default:
UNREACHABLE();
@@ -84,23 +84,23 @@
} // namespace
- DXGI_FORMAT D3D12TextureFormat(nxt::TextureFormat format) {
+ DXGI_FORMAT D3D12TextureFormat(dawn::TextureFormat format) {
switch (format) {
- case nxt::TextureFormat::R8G8B8A8Unorm:
+ case dawn::TextureFormat::R8G8B8A8Unorm:
return DXGI_FORMAT_R8G8B8A8_UNORM;
- case nxt::TextureFormat::R8G8Unorm:
+ case dawn::TextureFormat::R8G8Unorm:
return DXGI_FORMAT_R8G8_UNORM;
- case nxt::TextureFormat::R8Unorm:
+ case dawn::TextureFormat::R8Unorm:
return DXGI_FORMAT_R8_UNORM;
- case nxt::TextureFormat::R8G8B8A8Uint:
+ case dawn::TextureFormat::R8G8B8A8Uint:
return DXGI_FORMAT_R8G8B8A8_UINT;
- case nxt::TextureFormat::R8G8Uint:
+ case dawn::TextureFormat::R8G8Uint:
return DXGI_FORMAT_R8G8_UINT;
- case nxt::TextureFormat::R8Uint:
+ case dawn::TextureFormat::R8Uint:
return DXGI_FORMAT_R8_UINT;
- case nxt::TextureFormat::B8G8R8A8Unorm:
+ case dawn::TextureFormat::B8G8R8A8Unorm:
return DXGI_FORMAT_B8G8R8A8_UNORM;
- case nxt::TextureFormat::D32FloatS8Uint:
+ case dawn::TextureFormat::D32FloatS8Uint:
return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
default:
UNREACHABLE();
@@ -150,7 +150,7 @@
}
void Texture::TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
- nxt::TextureUsageBit usage) {
+ dawn::TextureUsageBit usage) {
// Avoid transitioning the texture when it isn't needed.
// TODO(cwallez@chromium.org): Need some form of UAV barriers at some point.
if (usage == mLastUsage) {
@@ -177,7 +177,7 @@
mSrvDesc.Format = D3D12TextureFormat(GetTexture()->GetFormat());
mSrvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
switch (GetTexture()->GetDimension()) {
- case nxt::TextureDimension::e2D:
+ case dawn::TextureDimension::e2D:
mSrvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
mSrvDesc.Texture2D.MostDetailedMip = 0;
mSrvDesc.Texture2D.MipLevels = GetTexture()->GetNumMipLevels();
diff --git a/src/backend/d3d12/TextureD3D12.h b/src/backend/d3d12/TextureD3D12.h
index 51cb809..c07c36a 100644
--- a/src/backend/d3d12/TextureD3D12.h
+++ b/src/backend/d3d12/TextureD3D12.h
@@ -23,7 +23,7 @@
class Device;
- DXGI_FORMAT D3D12TextureFormat(nxt::TextureFormat format);
+ DXGI_FORMAT D3D12TextureFormat(dawn::TextureFormat format);
class Texture : public TextureBase {
public:
@@ -35,13 +35,13 @@
ID3D12Resource* GetD3D12Resource();
void TransitionUsageNow(ComPtr<ID3D12GraphicsCommandList> commandList,
- nxt::TextureUsageBit usage);
+ dawn::TextureUsageBit usage);
private:
Device* mDevice;
ComPtr<ID3D12Resource> mResource = {};
ID3D12Resource* mResourcePtr = nullptr;
- nxt::TextureUsageBit mLastUsage = nxt::TextureUsageBit::None;
+ dawn::TextureUsageBit mLastUsage = dawn::TextureUsageBit::None;
};
class TextureView : public TextureViewBase {
diff --git a/src/backend/metal/BlendStateMTL.mm b/src/backend/metal/BlendStateMTL.mm
index 2b87d7e..3b5fb38 100644
--- a/src/backend/metal/BlendStateMTL.mm
+++ b/src/backend/metal/BlendStateMTL.mm
@@ -18,64 +18,64 @@
namespace {
- MTLBlendFactor MetalBlendFactor(nxt::BlendFactor factor, bool alpha) {
+ MTLBlendFactor MetalBlendFactor(dawn::BlendFactor factor, bool alpha) {
switch (factor) {
- case nxt::BlendFactor::Zero:
+ case dawn::BlendFactor::Zero:
return MTLBlendFactorZero;
- case nxt::BlendFactor::One:
+ case dawn::BlendFactor::One:
return MTLBlendFactorOne;
- case nxt::BlendFactor::SrcColor:
+ case dawn::BlendFactor::SrcColor:
return MTLBlendFactorSourceColor;
- case nxt::BlendFactor::OneMinusSrcColor:
+ case dawn::BlendFactor::OneMinusSrcColor:
return MTLBlendFactorOneMinusSourceColor;
- case nxt::BlendFactor::SrcAlpha:
+ case dawn::BlendFactor::SrcAlpha:
return MTLBlendFactorSourceAlpha;
- case nxt::BlendFactor::OneMinusSrcAlpha:
+ case dawn::BlendFactor::OneMinusSrcAlpha:
return MTLBlendFactorOneMinusSourceAlpha;
- case nxt::BlendFactor::DstColor:
+ case dawn::BlendFactor::DstColor:
return MTLBlendFactorDestinationColor;
- case nxt::BlendFactor::OneMinusDstColor:
+ case dawn::BlendFactor::OneMinusDstColor:
return MTLBlendFactorOneMinusDestinationColor;
- case nxt::BlendFactor::DstAlpha:
+ case dawn::BlendFactor::DstAlpha:
return MTLBlendFactorDestinationAlpha;
- case nxt::BlendFactor::OneMinusDstAlpha:
+ case dawn::BlendFactor::OneMinusDstAlpha:
return MTLBlendFactorOneMinusDestinationAlpha;
- case nxt::BlendFactor::SrcAlphaSaturated:
+ case dawn::BlendFactor::SrcAlphaSaturated:
return MTLBlendFactorSourceAlphaSaturated;
- case nxt::BlendFactor::BlendColor:
+ case dawn::BlendFactor::BlendColor:
return alpha ? MTLBlendFactorBlendAlpha : MTLBlendFactorBlendColor;
- case nxt::BlendFactor::OneMinusBlendColor:
+ case dawn::BlendFactor::OneMinusBlendColor:
return alpha ? MTLBlendFactorOneMinusBlendAlpha
: MTLBlendFactorOneMinusBlendColor;
}
}
- MTLBlendOperation MetalBlendOperation(nxt::BlendOperation operation) {
+ MTLBlendOperation MetalBlendOperation(dawn::BlendOperation operation) {
switch (operation) {
- case nxt::BlendOperation::Add:
+ case dawn::BlendOperation::Add:
return MTLBlendOperationAdd;
- case nxt::BlendOperation::Subtract:
+ case dawn::BlendOperation::Subtract:
return MTLBlendOperationSubtract;
- case nxt::BlendOperation::ReverseSubtract:
+ case dawn::BlendOperation::ReverseSubtract:
return MTLBlendOperationReverseSubtract;
- case nxt::BlendOperation::Min:
+ case dawn::BlendOperation::Min:
return MTLBlendOperationMin;
- case nxt::BlendOperation::Max:
+ case dawn::BlendOperation::Max:
return MTLBlendOperationMax;
}
}
- MTLColorWriteMask MetalColorWriteMask(nxt::ColorWriteMask colorWriteMask) {
- return (((colorWriteMask & nxt::ColorWriteMask::Red) != nxt::ColorWriteMask::None
+ MTLColorWriteMask MetalColorWriteMask(dawn::ColorWriteMask colorWriteMask) {
+ return (((colorWriteMask & dawn::ColorWriteMask::Red) != dawn::ColorWriteMask::None
? MTLColorWriteMaskRed
: MTLColorWriteMaskNone) |
- ((colorWriteMask & nxt::ColorWriteMask::Green) != nxt::ColorWriteMask::None
+ ((colorWriteMask & dawn::ColorWriteMask::Green) != dawn::ColorWriteMask::None
? MTLColorWriteMaskGreen
: MTLColorWriteMaskNone) |
- ((colorWriteMask & nxt::ColorWriteMask::Blue) != nxt::ColorWriteMask::None
+ ((colorWriteMask & dawn::ColorWriteMask::Blue) != dawn::ColorWriteMask::None
? MTLColorWriteMaskBlue
: MTLColorWriteMaskNone) |
- ((colorWriteMask & nxt::ColorWriteMask::Alpha) != nxt::ColorWriteMask::None
+ ((colorWriteMask & dawn::ColorWriteMask::Alpha) != dawn::ColorWriteMask::None
? MTLColorWriteMaskAlpha
: MTLColorWriteMaskNone));
}
diff --git a/src/backend/metal/BufferMTL.mm b/src/backend/metal/BufferMTL.mm
index 8a15164..67ef3a5 100644
--- a/src/backend/metal/BufferMTL.mm
+++ b/src/backend/metal/BufferMTL.mm
@@ -21,7 +21,7 @@
Buffer::Buffer(BufferBuilder* builder) : BufferBase(builder) {
MTLResourceOptions storageMode;
- if (GetAllowedUsage() & (nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::MapWrite)) {
+ if (GetAllowedUsage() & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) {
storageMode = MTLResourceStorageModeShared;
} else {
storageMode = MTLResourceStorageModePrivate;
diff --git a/src/backend/metal/CommandBufferMTL.mm b/src/backend/metal/CommandBufferMTL.mm
index 1b36882..0a1130c 100644
--- a/src/backend/metal/CommandBufferMTL.mm
+++ b/src/backend/metal/CommandBufferMTL.mm
@@ -54,7 +54,7 @@
for (uint32_t i : IterateBitSet(desc->GetColorAttachmentMask())) {
auto& attachmentInfo = desc->GetColorAttachment(i);
- if (attachmentInfo.loadOp == nxt::LoadOp::Clear) {
+ if (attachmentInfo.loadOp == dawn::LoadOp::Clear) {
descriptor.colorAttachments[i].loadAction = MTLLoadActionClear;
descriptor.colorAttachments[i].clearColor = MTLClearColorMake(
attachmentInfo.clearColor[0], attachmentInfo.clearColor[1],
@@ -73,13 +73,13 @@
id<MTLTexture> texture =
ToBackend(attachmentInfo.view->GetTexture())->GetMTLTexture();
- nxt::TextureFormat format = attachmentInfo.view->GetTexture()->GetFormat();
+ dawn::TextureFormat format = attachmentInfo.view->GetTexture()->GetFormat();
if (TextureFormatHasDepth(format)) {
descriptor.depthAttachment.texture = texture;
descriptor.depthAttachment.storeAction = MTLStoreActionStore;
- if (attachmentInfo.depthLoadOp == nxt::LoadOp::Clear) {
+ if (attachmentInfo.depthLoadOp == dawn::LoadOp::Clear) {
descriptor.depthAttachment.loadAction = MTLLoadActionClear;
descriptor.depthAttachment.clearDepth = attachmentInfo.clearDepth;
} else {
@@ -91,7 +91,7 @@
descriptor.stencilAttachment.texture = texture;
descriptor.stencilAttachment.storeAction = MTLStoreActionStore;
- if (attachmentInfo.stencilLoadOp == nxt::LoadOp::Clear) {
+ if (attachmentInfo.stencilLoadOp == dawn::LoadOp::Clear) {
descriptor.stencilAttachment.loadAction = MTLLoadActionClear;
descriptor.stencilAttachment.clearStencil = attachmentInfo.clearStencil;
} else {
@@ -123,9 +123,9 @@
}
auto stage = layout.visibilities[binding];
- bool hasVertStage = stage & nxt::ShaderStageBit::Vertex && render != nil;
- bool hasFragStage = stage & nxt::ShaderStageBit::Fragment && render != nil;
- bool hasComputeStage = stage & nxt::ShaderStageBit::Compute && compute != nil;
+ bool hasVertStage = stage & dawn::ShaderStageBit::Vertex && render != nil;
+ bool hasFragStage = stage & dawn::ShaderStageBit::Fragment && render != nil;
+ bool hasComputeStage = stage & dawn::ShaderStageBit::Compute && compute != nil;
uint32_t vertIndex = 0;
uint32_t fragIndex = 0;
@@ -133,20 +133,20 @@
if (hasVertStage) {
vertIndex = pipelineLayout->GetBindingIndexInfo(
- nxt::ShaderStage::Vertex)[index][binding];
+ dawn::ShaderStage::Vertex)[index][binding];
}
if (hasFragStage) {
fragIndex = pipelineLayout->GetBindingIndexInfo(
- nxt::ShaderStage::Fragment)[index][binding];
+ dawn::ShaderStage::Fragment)[index][binding];
}
if (hasComputeStage) {
computeIndex = pipelineLayout->GetBindingIndexInfo(
- nxt::ShaderStage::Compute)[index][binding];
+ dawn::ShaderStage::Compute)[index][binding];
}
switch (layout.types[binding]) {
- case nxt::BindingType::UniformBuffer:
- case nxt::BindingType::StorageBuffer: {
+ case dawn::BindingType::UniformBuffer:
+ case dawn::BindingType::StorageBuffer: {
BufferView* view = ToBackend(group->GetBindingAsBufferView(binding));
auto b = ToBackend(view->GetBuffer());
const id<MTLBuffer> buffer = b->GetMTLBuffer();
@@ -170,7 +170,7 @@
} break;
- case nxt::BindingType::Sampler: {
+ case dawn::BindingType::Sampler: {
auto sampler = ToBackend(group->GetBindingAsSampler(binding));
if (hasVertStage) {
[render setVertexSamplerState:sampler->GetMTLSamplerState()
@@ -186,7 +186,7 @@
}
} break;
- case nxt::BindingType::SampledTexture: {
+ case dawn::BindingType::SampledTexture: {
auto texture =
ToBackend(group->GetBindingAsTextureView(binding)->GetTexture());
if (hasVertStage) {
@@ -348,7 +348,7 @@
SetPushConstantsCmd* cmd = mCommands.NextCommand<SetPushConstantsCmd>();
uint32_t* values = mCommands.NextData<uint32_t>(cmd->count);
- if (cmd->stages & nxt::ShaderStageBit::Compute) {
+ if (cmd->stages & dawn::ShaderStageBit::Compute) {
memcpy(&pushConstants[cmd->offset], values, cmd->count * sizeof(uint32_t));
[encoder setBytes:&pushConstants
@@ -443,7 +443,7 @@
SetPushConstantsCmd* cmd = mCommands.NextCommand<SetPushConstantsCmd>();
uint32_t* values = mCommands.NextData<uint32_t>(cmd->count);
- if (cmd->stages & nxt::ShaderStageBit::Vertex) {
+ if (cmd->stages & dawn::ShaderStageBit::Vertex) {
memcpy(&vertexPushConstants[cmd->offset], values,
cmd->count * sizeof(uint32_t));
[encoder setVertexBytes:&vertexPushConstants
@@ -451,7 +451,7 @@
atIndex:0];
}
- if (cmd->stages & nxt::ShaderStageBit::Fragment) {
+ if (cmd->stages & dawn::ShaderStageBit::Fragment) {
memcpy(&fragmentPushConstants[cmd->offset], values,
cmd->count * sizeof(uint32_t));
[encoder setFragmentBytes:&fragmentPushConstants
diff --git a/src/backend/metal/ComputePipelineMTL.mm b/src/backend/metal/ComputePipelineMTL.mm
index a6ea547..f2918bd 100644
--- a/src/backend/metal/ComputePipelineMTL.mm
+++ b/src/backend/metal/ComputePipelineMTL.mm
@@ -23,8 +23,8 @@
: ComputePipelineBase(builder) {
auto mtlDevice = ToBackend(builder->GetDevice())->GetMTLDevice();
- const auto& module = ToBackend(builder->GetStageInfo(nxt::ShaderStage::Compute).module);
- const auto& entryPoint = builder->GetStageInfo(nxt::ShaderStage::Compute).entryPoint;
+ const auto& module = ToBackend(builder->GetStageInfo(dawn::ShaderStage::Compute).module);
+ const auto& entryPoint = builder->GetStageInfo(dawn::ShaderStage::Compute).entryPoint;
auto compilationData = module->GetFunction(entryPoint.c_str(), ToBackend(GetLayout()));
diff --git a/src/backend/metal/DepthStencilStateMTL.mm b/src/backend/metal/DepthStencilStateMTL.mm
index fc81dd8..1b5a5bc 100644
--- a/src/backend/metal/DepthStencilStateMTL.mm
+++ b/src/backend/metal/DepthStencilStateMTL.mm
@@ -19,44 +19,44 @@
namespace backend { namespace metal {
namespace {
- MTLCompareFunction MetalDepthStencilCompareFunction(nxt::CompareFunction compareFunction) {
+ MTLCompareFunction MetalDepthStencilCompareFunction(dawn::CompareFunction compareFunction) {
switch (compareFunction) {
- case nxt::CompareFunction::Never:
+ case dawn::CompareFunction::Never:
return MTLCompareFunctionNever;
- case nxt::CompareFunction::Less:
+ case dawn::CompareFunction::Less:
return MTLCompareFunctionLess;
- case nxt::CompareFunction::LessEqual:
+ case dawn::CompareFunction::LessEqual:
return MTLCompareFunctionLessEqual;
- case nxt::CompareFunction::Greater:
+ case dawn::CompareFunction::Greater:
return MTLCompareFunctionGreater;
- case nxt::CompareFunction::GreaterEqual:
+ case dawn::CompareFunction::GreaterEqual:
return MTLCompareFunctionGreaterEqual;
- case nxt::CompareFunction::NotEqual:
+ case dawn::CompareFunction::NotEqual:
return MTLCompareFunctionNotEqual;
- case nxt::CompareFunction::Equal:
+ case dawn::CompareFunction::Equal:
return MTLCompareFunctionEqual;
- case nxt::CompareFunction::Always:
+ case dawn::CompareFunction::Always:
return MTLCompareFunctionAlways;
}
}
- MTLStencilOperation MetalStencilOperation(nxt::StencilOperation stencilOperation) {
+ MTLStencilOperation MetalStencilOperation(dawn::StencilOperation stencilOperation) {
switch (stencilOperation) {
- case nxt::StencilOperation::Keep:
+ case dawn::StencilOperation::Keep:
return MTLStencilOperationKeep;
- case nxt::StencilOperation::Zero:
+ case dawn::StencilOperation::Zero:
return MTLStencilOperationZero;
- case nxt::StencilOperation::Replace:
+ case dawn::StencilOperation::Replace:
return MTLStencilOperationReplace;
- case nxt::StencilOperation::Invert:
+ case dawn::StencilOperation::Invert:
return MTLStencilOperationInvert;
- case nxt::StencilOperation::IncrementClamp:
+ case dawn::StencilOperation::IncrementClamp:
return MTLStencilOperationIncrementClamp;
- case nxt::StencilOperation::DecrementClamp:
+ case dawn::StencilOperation::DecrementClamp:
return MTLStencilOperationDecrementClamp;
- case nxt::StencilOperation::IncrementWrap:
+ case dawn::StencilOperation::IncrementWrap:
return MTLStencilOperationIncrementWrap;
- case nxt::StencilOperation::DecrementWrap:
+ case dawn::StencilOperation::DecrementWrap:
return MTLStencilOperationDecrementWrap;
}
}
diff --git a/src/backend/metal/DeviceMTL.h b/src/backend/metal/DeviceMTL.h
index 2920ce9..cca39e1 100644
--- a/src/backend/metal/DeviceMTL.h
+++ b/src/backend/metal/DeviceMTL.h
@@ -64,12 +64,12 @@
private:
ResultOrError<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) override;
+ const dawn::BindGroupLayoutDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) override;
+ const dawn::PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) override;
+ const dawn::SamplerDescriptor* descriptor) override;
void OnCompletedHandler();
diff --git a/src/backend/metal/DeviceMTL.mm b/src/backend/metal/DeviceMTL.mm
index f16fde3..7fd6b49 100644
--- a/src/backend/metal/DeviceMTL.mm
+++ b/src/backend/metal/DeviceMTL.mm
@@ -86,7 +86,7 @@
return new BindGroup(builder);
}
ResultOrError<BindGroupLayoutBase*> Device::CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) {
+ const dawn::BindGroupLayoutDescriptor* descriptor) {
return new BindGroupLayout(this, descriptor);
}
BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) {
@@ -111,7 +111,7 @@
return new InputState(builder);
}
ResultOrError<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) {
+ const dawn::PipelineLayoutDescriptor* descriptor) {
return new PipelineLayout(this, descriptor);
}
RenderPassDescriptorBase* Device::CreateRenderPassDescriptor(
@@ -125,7 +125,7 @@
return new Queue(this);
}
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) {
+ const dawn::SamplerDescriptor* descriptor) {
return new Sampler(this, descriptor);
}
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
diff --git a/src/backend/metal/InputStateMTL.mm b/src/backend/metal/InputStateMTL.mm
index 75c3529..f33491b 100644
--- a/src/backend/metal/InputStateMTL.mm
+++ b/src/backend/metal/InputStateMTL.mm
@@ -19,40 +19,40 @@
namespace backend { namespace metal {
namespace {
- MTLVertexFormat VertexFormatType(nxt::VertexFormat format) {
+ MTLVertexFormat VertexFormatType(dawn::VertexFormat format) {
switch (format) {
- case nxt::VertexFormat::FloatR32G32B32A32:
+ case dawn::VertexFormat::FloatR32G32B32A32:
return MTLVertexFormatFloat4;
- case nxt::VertexFormat::FloatR32G32B32:
+ case dawn::VertexFormat::FloatR32G32B32:
return MTLVertexFormatFloat3;
- case nxt::VertexFormat::FloatR32G32:
+ case dawn::VertexFormat::FloatR32G32:
return MTLVertexFormatFloat2;
- case nxt::VertexFormat::FloatR32:
+ case dawn::VertexFormat::FloatR32:
return MTLVertexFormatFloat;
- case nxt::VertexFormat::IntR32G32B32A32:
+ case dawn::VertexFormat::IntR32G32B32A32:
return MTLVertexFormatInt4;
- case nxt::VertexFormat::IntR32G32B32:
+ case dawn::VertexFormat::IntR32G32B32:
return MTLVertexFormatInt3;
- case nxt::VertexFormat::IntR32G32:
+ case dawn::VertexFormat::IntR32G32:
return MTLVertexFormatInt2;
- case nxt::VertexFormat::IntR32:
+ case dawn::VertexFormat::IntR32:
return MTLVertexFormatInt;
- case nxt::VertexFormat::UshortR16G16B16A16:
+ case dawn::VertexFormat::UshortR16G16B16A16:
return MTLVertexFormatUShort4;
- case nxt::VertexFormat::UshortR16G16:
+ case dawn::VertexFormat::UshortR16G16:
return MTLVertexFormatUShort2;
- case nxt::VertexFormat::UnormR8G8B8A8:
+ case dawn::VertexFormat::UnormR8G8B8A8:
return MTLVertexFormatUChar4Normalized;
- case nxt::VertexFormat::UnormR8G8:
+ case dawn::VertexFormat::UnormR8G8:
return MTLVertexFormatUChar2Normalized;
}
}
- MTLVertexStepFunction InputStepModeFunction(nxt::InputStepMode mode) {
+ MTLVertexStepFunction InputStepModeFunction(dawn::InputStepMode mode) {
switch (mode) {
- case nxt::InputStepMode::Vertex:
+ case dawn::InputStepMode::Vertex:
return MTLVertexStepFunctionPerVertex;
- case nxt::InputStepMode::Instance:
+ case dawn::InputStepMode::Instance:
return MTLVertexStepFunctionPerInstance;
}
}
diff --git a/src/backend/metal/PipelineLayoutMTL.h b/src/backend/metal/PipelineLayoutMTL.h
index 9cf5470..d68630b 100644
--- a/src/backend/metal/PipelineLayoutMTL.h
+++ b/src/backend/metal/PipelineLayoutMTL.h
@@ -31,11 +31,11 @@
class PipelineLayout : public PipelineLayoutBase {
public:
- PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor);
+ PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor);
using BindingIndexInfo =
std::array<std::array<uint32_t, kMaxBindingsPerGroup>, kMaxBindGroups>;
- const BindingIndexInfo& GetBindingIndexInfo(nxt::ShaderStage stage) const;
+ const BindingIndexInfo& GetBindingIndexInfo(dawn::ShaderStage stage) const;
private:
PerStage<BindingIndexInfo> mIndexInfo;
diff --git a/src/backend/metal/PipelineLayoutMTL.mm b/src/backend/metal/PipelineLayoutMTL.mm
index 90d80b8..a2f106d 100644
--- a/src/backend/metal/PipelineLayoutMTL.mm
+++ b/src/backend/metal/PipelineLayoutMTL.mm
@@ -20,7 +20,7 @@
namespace backend { namespace metal {
- PipelineLayout::PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor)
+ PipelineLayout::PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor)
: PipelineLayoutBase(device, descriptor) {
// Each stage has its own numbering namespace in CompilerMSL.
for (auto stage : IterateStages(kAllStages)) {
@@ -40,16 +40,16 @@
}
switch (groupInfo.types[binding]) {
- case nxt::BindingType::UniformBuffer:
- case nxt::BindingType::StorageBuffer:
+ case dawn::BindingType::UniformBuffer:
+ case dawn::BindingType::StorageBuffer:
mIndexInfo[stage][group][binding] = bufferIndex;
bufferIndex++;
break;
- case nxt::BindingType::Sampler:
+ case dawn::BindingType::Sampler:
mIndexInfo[stage][group][binding] = samplerIndex;
samplerIndex++;
break;
- case nxt::BindingType::SampledTexture:
+ case dawn::BindingType::SampledTexture:
mIndexInfo[stage][group][binding] = textureIndex;
textureIndex++;
break;
@@ -60,7 +60,7 @@
}
const PipelineLayout::BindingIndexInfo& PipelineLayout::GetBindingIndexInfo(
- nxt::ShaderStage stage) const {
+ dawn::ShaderStage stage) const {
return mIndexInfo[stage];
}
diff --git a/src/backend/metal/RenderPipelineMTL.mm b/src/backend/metal/RenderPipelineMTL.mm
index 5fae1e0..36ffd53 100644
--- a/src/backend/metal/RenderPipelineMTL.mm
+++ b/src/backend/metal/RenderPipelineMTL.mm
@@ -25,40 +25,40 @@
namespace backend { namespace metal {
namespace {
- MTLPrimitiveType MTLPrimitiveTopology(nxt::PrimitiveTopology primitiveTopology) {
+ MTLPrimitiveType MTLPrimitiveTopology(dawn::PrimitiveTopology primitiveTopology) {
switch (primitiveTopology) {
- case nxt::PrimitiveTopology::PointList:
+ case dawn::PrimitiveTopology::PointList:
return MTLPrimitiveTypePoint;
- case nxt::PrimitiveTopology::LineList:
+ case dawn::PrimitiveTopology::LineList:
return MTLPrimitiveTypeLine;
- case nxt::PrimitiveTopology::LineStrip:
+ case dawn::PrimitiveTopology::LineStrip:
return MTLPrimitiveTypeLineStrip;
- case nxt::PrimitiveTopology::TriangleList:
+ case dawn::PrimitiveTopology::TriangleList:
return MTLPrimitiveTypeTriangle;
- case nxt::PrimitiveTopology::TriangleStrip:
+ case dawn::PrimitiveTopology::TriangleStrip:
return MTLPrimitiveTypeTriangleStrip;
}
}
MTLPrimitiveTopologyClass MTLInputPrimitiveTopology(
- nxt::PrimitiveTopology primitiveTopology) {
+ dawn::PrimitiveTopology primitiveTopology) {
switch (primitiveTopology) {
- case nxt::PrimitiveTopology::PointList:
+ case dawn::PrimitiveTopology::PointList:
return MTLPrimitiveTopologyClassPoint;
- case nxt::PrimitiveTopology::LineList:
- case nxt::PrimitiveTopology::LineStrip:
+ case dawn::PrimitiveTopology::LineList:
+ case dawn::PrimitiveTopology::LineStrip:
return MTLPrimitiveTopologyClassLine;
- case nxt::PrimitiveTopology::TriangleList:
- case nxt::PrimitiveTopology::TriangleStrip:
+ case dawn::PrimitiveTopology::TriangleList:
+ case dawn::PrimitiveTopology::TriangleStrip:
return MTLPrimitiveTopologyClassTriangle;
}
}
- MTLIndexType MTLIndexFormat(nxt::IndexFormat format) {
+ MTLIndexType MTLIndexFormat(dawn::IndexFormat format) {
switch (format) {
- case nxt::IndexFormat::Uint16:
+ case dawn::IndexFormat::Uint16:
return MTLIndexTypeUInt16;
- case nxt::IndexFormat::Uint32:
+ case dawn::IndexFormat::Uint32:
return MTLIndexTypeUInt32;
}
}
@@ -81,20 +81,20 @@
id<MTLFunction> function = data.function;
switch (stage) {
- case nxt::ShaderStage::Vertex:
+ case dawn::ShaderStage::Vertex:
descriptor.vertexFunction = function;
break;
- case nxt::ShaderStage::Fragment:
+ case dawn::ShaderStage::Fragment:
descriptor.fragmentFunction = function;
break;
- case nxt::ShaderStage::Compute:
+ case dawn::ShaderStage::Compute:
UNREACHABLE();
}
}
if (HasDepthStencilAttachment()) {
// TODO(kainino@chromium.org): Handle depth-only and stencil-only formats.
- nxt::TextureFormat depthStencilFormat = GetDepthStencilFormat();
+ dawn::TextureFormat depthStencilFormat = GetDepthStencilFormat();
descriptor.depthAttachmentPixelFormat = MetalPixelFormat(depthStencilFormat);
descriptor.stencilAttachmentPixelFormat = MetalPixelFormat(depthStencilFormat);
}
diff --git a/src/backend/metal/SamplerMTL.h b/src/backend/metal/SamplerMTL.h
index 72cf0b6..3437c1c 100644
--- a/src/backend/metal/SamplerMTL.h
+++ b/src/backend/metal/SamplerMTL.h
@@ -25,7 +25,7 @@
class Sampler : public SamplerBase {
public:
- Sampler(Device* device, const nxt::SamplerDescriptor* descriptor);
+ Sampler(Device* device, const dawn::SamplerDescriptor* descriptor);
~Sampler();
id<MTLSamplerState> GetMTLSamplerState();
diff --git a/src/backend/metal/SamplerMTL.mm b/src/backend/metal/SamplerMTL.mm
index 6a0f538..d6cbbaf 100644
--- a/src/backend/metal/SamplerMTL.mm
+++ b/src/backend/metal/SamplerMTL.mm
@@ -19,37 +19,37 @@
namespace backend { namespace metal {
namespace {
- MTLSamplerMinMagFilter FilterModeToMinMagFilter(nxt::FilterMode mode) {
+ MTLSamplerMinMagFilter FilterModeToMinMagFilter(dawn::FilterMode mode) {
switch (mode) {
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
return MTLSamplerMinMagFilterNearest;
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
return MTLSamplerMinMagFilterLinear;
}
}
- MTLSamplerMipFilter FilterModeToMipFilter(nxt::FilterMode mode) {
+ MTLSamplerMipFilter FilterModeToMipFilter(dawn::FilterMode mode) {
switch (mode) {
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
return MTLSamplerMipFilterNearest;
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
return MTLSamplerMipFilterLinear;
}
}
- MTLSamplerAddressMode AddressMode(nxt::AddressMode mode) {
+ MTLSamplerAddressMode AddressMode(dawn::AddressMode mode) {
switch (mode) {
- case nxt::AddressMode::Repeat:
+ case dawn::AddressMode::Repeat:
return MTLSamplerAddressModeRepeat;
- case nxt::AddressMode::MirroredRepeat:
+ case dawn::AddressMode::MirroredRepeat:
return MTLSamplerAddressModeMirrorRepeat;
- case nxt::AddressMode::ClampToEdge:
+ case dawn::AddressMode::ClampToEdge:
return MTLSamplerAddressModeClampToEdge;
}
}
}
- Sampler::Sampler(Device* device, const nxt::SamplerDescriptor* descriptor)
+ Sampler::Sampler(Device* device, const dawn::SamplerDescriptor* descriptor)
: SamplerBase(device, descriptor) {
MTLSamplerDescriptor* mtlDesc = [MTLSamplerDescriptor new];
[mtlDesc autorelease];
diff --git a/src/backend/metal/ShaderModuleMTL.mm b/src/backend/metal/ShaderModuleMTL.mm
index efd5b56..7377c4b 100644
--- a/src/backend/metal/ShaderModuleMTL.mm
+++ b/src/backend/metal/ShaderModuleMTL.mm
@@ -26,13 +26,13 @@
namespace {
- spv::ExecutionModel SpirvExecutionModelForStage(nxt::ShaderStage stage) {
+ spv::ExecutionModel SpirvExecutionModelForStage(dawn::ShaderStage stage) {
switch (stage) {
- case nxt::ShaderStage::Vertex:
+ case dawn::ShaderStage::Vertex:
return spv::ExecutionModelVertex;
- case nxt::ShaderStage::Fragment:
+ case dawn::ShaderStage::Fragment:
return spv::ExecutionModelFragment;
- case nxt::ShaderStage::Compute:
+ case dawn::ShaderStage::Compute:
return spv::ExecutionModelGLCompute;
default:
UNREACHABLE();
diff --git a/src/backend/metal/TextureMTL.h b/src/backend/metal/TextureMTL.h
index 57b7171..088f58c 100644
--- a/src/backend/metal/TextureMTL.h
+++ b/src/backend/metal/TextureMTL.h
@@ -21,7 +21,7 @@
namespace backend { namespace metal {
- MTLPixelFormat MetalPixelFormat(nxt::TextureFormat format);
+ MTLPixelFormat MetalPixelFormat(dawn::TextureFormat format);
class Texture : public TextureBase {
public:
diff --git a/src/backend/metal/TextureMTL.mm b/src/backend/metal/TextureMTL.mm
index feae33f..31800e9 100644
--- a/src/backend/metal/TextureMTL.mm
+++ b/src/backend/metal/TextureMTL.mm
@@ -18,49 +18,49 @@
namespace backend { namespace metal {
- MTLPixelFormat MetalPixelFormat(nxt::TextureFormat format) {
+ MTLPixelFormat MetalPixelFormat(dawn::TextureFormat format) {
switch (format) {
- case nxt::TextureFormat::R8G8B8A8Unorm:
+ case dawn::TextureFormat::R8G8B8A8Unorm:
return MTLPixelFormatRGBA8Unorm;
- case nxt::TextureFormat::R8G8Unorm:
+ case dawn::TextureFormat::R8G8Unorm:
return MTLPixelFormatRG8Unorm;
- case nxt::TextureFormat::R8Unorm:
+ case dawn::TextureFormat::R8Unorm:
return MTLPixelFormatR8Unorm;
- case nxt::TextureFormat::R8G8B8A8Uint:
+ case dawn::TextureFormat::R8G8B8A8Uint:
return MTLPixelFormatRGBA8Uint;
- case nxt::TextureFormat::R8G8Uint:
+ case dawn::TextureFormat::R8G8Uint:
return MTLPixelFormatRG8Uint;
- case nxt::TextureFormat::R8Uint:
+ case dawn::TextureFormat::R8Uint:
return MTLPixelFormatR8Uint;
- case nxt::TextureFormat::B8G8R8A8Unorm:
+ case dawn::TextureFormat::B8G8R8A8Unorm:
return MTLPixelFormatBGRA8Unorm;
- case nxt::TextureFormat::D32FloatS8Uint:
+ case dawn::TextureFormat::D32FloatS8Uint:
return MTLPixelFormatDepth32Float_Stencil8;
}
}
namespace {
- MTLTextureUsage MetalTextureUsage(nxt::TextureUsageBit usage) {
+ MTLTextureUsage MetalTextureUsage(dawn::TextureUsageBit usage) {
MTLTextureUsage result = MTLTextureUsageUnknown; // This is 0
- if (usage & (nxt::TextureUsageBit::Storage)) {
+ if (usage & (dawn::TextureUsageBit::Storage)) {
result |= MTLTextureUsageShaderWrite | MTLTextureUsageShaderRead;
}
- if (usage & (nxt::TextureUsageBit::Sampled)) {
+ if (usage & (dawn::TextureUsageBit::Sampled)) {
result |= MTLTextureUsageShaderRead;
}
- if (usage & (nxt::TextureUsageBit::OutputAttachment)) {
+ if (usage & (dawn::TextureUsageBit::OutputAttachment)) {
result |= MTLTextureUsageRenderTarget;
}
return result;
}
- MTLTextureType MetalTextureType(nxt::TextureDimension dimension) {
+ MTLTextureType MetalTextureType(dawn::TextureDimension dimension) {
switch (dimension) {
- case nxt::TextureDimension::e2D:
+ case dawn::TextureDimension::e2D:
return MTLTextureType2D;
}
}
diff --git a/src/backend/null/NullBackend.cpp b/src/backend/null/NullBackend.cpp
index f07a658..bc02d49 100644
--- a/src/backend/null/NullBackend.cpp
+++ b/src/backend/null/NullBackend.cpp
@@ -40,7 +40,7 @@
return new BindGroup(builder);
}
ResultOrError<BindGroupLayoutBase*> Device::CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) {
+ const dawn::BindGroupLayoutDescriptor* descriptor) {
return new BindGroupLayout(this, descriptor);
}
BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) {
@@ -65,7 +65,7 @@
return new InputState(builder);
}
ResultOrError<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) {
+ const dawn::PipelineLayoutDescriptor* descriptor) {
return new PipelineLayout(this, descriptor);
}
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
@@ -79,7 +79,7 @@
return new RenderPipeline(builder);
}
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) {
+ const dawn::SamplerDescriptor* descriptor) {
return new Sampler(this, descriptor);
}
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
@@ -124,8 +124,8 @@
};
Buffer::Buffer(BufferBuilder* builder) : BufferBase(builder) {
- if (GetAllowedUsage() & (nxt::BufferUsageBit::TransferDst | nxt::BufferUsageBit::MapRead |
- nxt::BufferUsageBit::MapWrite)) {
+ if (GetAllowedUsage() & (dawn::BufferUsageBit::TransferDst | dawn::BufferUsageBit::MapRead |
+ dawn::BufferUsageBit::MapWrite)) {
mBackingData = std::unique_ptr<char[]>(new char[GetSize()]);
}
}
diff --git a/src/backend/null/NullBackend.h b/src/backend/null/NullBackend.h
index e4bd08c..c4f851e3 100644
--- a/src/backend/null/NullBackend.h
+++ b/src/backend/null/NullBackend.h
@@ -118,12 +118,12 @@
private:
ResultOrError<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) override;
+ const dawn::BindGroupLayoutDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) override;
+ const dawn::PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) override;
+ const dawn::SamplerDescriptor* descriptor) override;
std::vector<std::unique_ptr<PendingOperation>> mPendingOperations;
};
diff --git a/src/backend/opengl/BlendStateGL.cpp b/src/backend/opengl/BlendStateGL.cpp
index 45f1a0a..faa81b4 100644
--- a/src/backend/opengl/BlendStateGL.cpp
+++ b/src/backend/opengl/BlendStateGL.cpp
@@ -19,50 +19,50 @@
namespace backend { namespace opengl {
namespace {
- GLenum GLBlendFactor(nxt::BlendFactor factor, bool alpha) {
+ GLenum GLBlendFactor(dawn::BlendFactor factor, bool alpha) {
switch (factor) {
- case nxt::BlendFactor::Zero:
+ case dawn::BlendFactor::Zero:
return GL_ZERO;
- case nxt::BlendFactor::One:
+ case dawn::BlendFactor::One:
return GL_ONE;
- case nxt::BlendFactor::SrcColor:
+ case dawn::BlendFactor::SrcColor:
return GL_SRC_COLOR;
- case nxt::BlendFactor::OneMinusSrcColor:
+ case dawn::BlendFactor::OneMinusSrcColor:
return GL_ONE_MINUS_SRC_COLOR;
- case nxt::BlendFactor::SrcAlpha:
+ case dawn::BlendFactor::SrcAlpha:
return GL_SRC_ALPHA;
- case nxt::BlendFactor::OneMinusSrcAlpha:
+ case dawn::BlendFactor::OneMinusSrcAlpha:
return GL_ONE_MINUS_SRC_ALPHA;
- case nxt::BlendFactor::DstColor:
+ case dawn::BlendFactor::DstColor:
return GL_DST_COLOR;
- case nxt::BlendFactor::OneMinusDstColor:
+ case dawn::BlendFactor::OneMinusDstColor:
return GL_ONE_MINUS_DST_COLOR;
- case nxt::BlendFactor::DstAlpha:
+ case dawn::BlendFactor::DstAlpha:
return GL_DST_ALPHA;
- case nxt::BlendFactor::OneMinusDstAlpha:
+ case dawn::BlendFactor::OneMinusDstAlpha:
return GL_ONE_MINUS_DST_ALPHA;
- case nxt::BlendFactor::SrcAlphaSaturated:
+ case dawn::BlendFactor::SrcAlphaSaturated:
return GL_SRC_ALPHA_SATURATE;
- case nxt::BlendFactor::BlendColor:
+ case dawn::BlendFactor::BlendColor:
return alpha ? GL_CONSTANT_ALPHA : GL_CONSTANT_COLOR;
- case nxt::BlendFactor::OneMinusBlendColor:
+ case dawn::BlendFactor::OneMinusBlendColor:
return alpha ? GL_ONE_MINUS_CONSTANT_ALPHA : GL_ONE_MINUS_CONSTANT_COLOR;
default:
UNREACHABLE();
}
}
- GLenum GLBlendMode(nxt::BlendOperation operation) {
+ GLenum GLBlendMode(dawn::BlendOperation operation) {
switch (operation) {
- case nxt::BlendOperation::Add:
+ case dawn::BlendOperation::Add:
return GL_FUNC_ADD;
- case nxt::BlendOperation::Subtract:
+ case dawn::BlendOperation::Subtract:
return GL_FUNC_SUBTRACT;
- case nxt::BlendOperation::ReverseSubtract:
+ case dawn::BlendOperation::ReverseSubtract:
return GL_FUNC_REVERSE_SUBTRACT;
- case nxt::BlendOperation::Min:
+ case dawn::BlendOperation::Min:
return GL_MIN;
- case nxt::BlendOperation::Max:
+ case dawn::BlendOperation::Max:
return GL_MAX;
default:
UNREACHABLE();
@@ -87,10 +87,10 @@
} else {
glDisablei(GL_BLEND, attachment);
}
- glColorMaski(attachment, info.colorWriteMask & nxt::ColorWriteMask::Red,
- info.colorWriteMask & nxt::ColorWriteMask::Green,
- info.colorWriteMask & nxt::ColorWriteMask::Blue,
- info.colorWriteMask & nxt::ColorWriteMask::Alpha);
+ glColorMaski(attachment, info.colorWriteMask & dawn::ColorWriteMask::Red,
+ info.colorWriteMask & dawn::ColorWriteMask::Green,
+ info.colorWriteMask & dawn::ColorWriteMask::Blue,
+ info.colorWriteMask & dawn::ColorWriteMask::Alpha);
}
}} // namespace backend::opengl
diff --git a/src/backend/opengl/CommandBufferGL.cpp b/src/backend/opengl/CommandBufferGL.cpp
index 2ea4ffe..5b4a17b 100644
--- a/src/backend/opengl/CommandBufferGL.cpp
+++ b/src/backend/opengl/CommandBufferGL.cpp
@@ -32,44 +32,44 @@
namespace {
- GLenum IndexFormatType(nxt::IndexFormat format) {
+ GLenum IndexFormatType(dawn::IndexFormat format) {
switch (format) {
- case nxt::IndexFormat::Uint16:
+ case dawn::IndexFormat::Uint16:
return GL_UNSIGNED_SHORT;
- case nxt::IndexFormat::Uint32:
+ case dawn::IndexFormat::Uint32:
return GL_UNSIGNED_INT;
default:
UNREACHABLE();
}
}
- GLenum VertexFormatType(nxt::VertexFormat format) {
+ GLenum VertexFormatType(dawn::VertexFormat format) {
switch (format) {
- case nxt::VertexFormat::FloatR32G32B32A32:
- case nxt::VertexFormat::FloatR32G32B32:
- case nxt::VertexFormat::FloatR32G32:
- case nxt::VertexFormat::FloatR32:
+ case dawn::VertexFormat::FloatR32G32B32A32:
+ case dawn::VertexFormat::FloatR32G32B32:
+ case dawn::VertexFormat::FloatR32G32:
+ case dawn::VertexFormat::FloatR32:
return GL_FLOAT;
- case nxt::VertexFormat::IntR32G32B32A32:
- case nxt::VertexFormat::IntR32G32B32:
- case nxt::VertexFormat::IntR32G32:
- case nxt::VertexFormat::IntR32:
+ case dawn::VertexFormat::IntR32G32B32A32:
+ case dawn::VertexFormat::IntR32G32B32:
+ case dawn::VertexFormat::IntR32G32:
+ case dawn::VertexFormat::IntR32:
return GL_INT;
- case nxt::VertexFormat::UshortR16G16B16A16:
- case nxt::VertexFormat::UshortR16G16:
+ case dawn::VertexFormat::UshortR16G16B16A16:
+ case dawn::VertexFormat::UshortR16G16:
return GL_UNSIGNED_SHORT;
- case nxt::VertexFormat::UnormR8G8B8A8:
- case nxt::VertexFormat::UnormR8G8:
+ case dawn::VertexFormat::UnormR8G8B8A8:
+ case dawn::VertexFormat::UnormR8G8:
return GL_UNSIGNED_BYTE;
default:
UNREACHABLE();
}
}
- GLboolean VertexFormatIsNormalized(nxt::VertexFormat format) {
+ GLboolean VertexFormatIsNormalized(dawn::VertexFormat format) {
switch (format) {
- case nxt::VertexFormat::UnormR8G8B8A8:
- case nxt::VertexFormat::UnormR8G8:
+ case dawn::VertexFormat::UnormR8G8B8A8:
+ case dawn::VertexFormat::UnormR8G8:
return GL_TRUE;
default:
return GL_FALSE;
@@ -92,7 +92,7 @@
}
}
- void OnSetPushConstants(nxt::ShaderStageBit stages,
+ void OnSetPushConstants(dawn::ShaderStageBit stages,
uint32_t count,
uint32_t offset,
const uint32_t* data) {
@@ -237,7 +237,7 @@
for (uint32_t binding : IterateBitSet(layout.mask)) {
switch (layout.types[binding]) {
- case nxt::BindingType::UniformBuffer: {
+ case dawn::BindingType::UniformBuffer: {
BufferView* view = ToBackend(group->GetBindingAsBufferView(binding));
GLuint buffer = ToBackend(view->GetBuffer())->GetHandle();
GLuint uboIndex = indices[binding];
@@ -246,7 +246,7 @@
view->GetSize());
} break;
- case nxt::BindingType::Sampler: {
+ case dawn::BindingType::Sampler: {
GLuint sampler =
ToBackend(group->GetBindingAsSampler(binding))->GetHandle();
GLuint samplerIndex = indices[binding];
@@ -256,7 +256,7 @@
}
} break;
- case nxt::BindingType::SampledTexture: {
+ case dawn::BindingType::SampledTexture: {
TextureView* view = ToBackend(group->GetBindingAsTextureView(binding));
Texture* texture = ToBackend(view->GetTexture());
GLuint handle = texture->GetHandle();
@@ -269,7 +269,7 @@
}
} break;
- case nxt::BindingType::StorageBuffer: {
+ case dawn::BindingType::StorageBuffer: {
BufferView* view = ToBackend(group->GetBindingAsBufferView(binding));
GLuint buffer = ToBackend(view->GetBuffer())->GetHandle();
GLuint ssboIndex = indices[binding];
@@ -331,7 +331,7 @@
glActiveTexture(GL_TEXTURE0);
glBindTexture(target, texture->GetHandle());
- ASSERT(texture->GetDimension() == nxt::TextureDimension::e2D);
+ ASSERT(texture->GetDimension() == dawn::TextureDimension::e2D);
glPixelStorei(GL_UNPACK_ROW_LENGTH,
copy->rowPitch / TextureFormatPixelSize(texture->GetFormat()));
glTexSubImage2D(target, dst.level, dst.x, dst.y, dst.width, dst.height,
@@ -351,7 +351,7 @@
// The only way to move data from a texture to a buffer in GL is via
// glReadPixels with a pack buffer. Create a temporary FBO for the copy.
- ASSERT(texture->GetDimension() == nxt::TextureDimension::e2D);
+ ASSERT(texture->GetDimension() == dawn::TextureDimension::e2D);
glBindTexture(GL_TEXTURE_2D, texture->GetHandle());
GLuint readFBO = 0;
@@ -462,18 +462,18 @@
// TODO(kainino@chromium.org): the color clears (later in
// this function) may be undefined for non-normalized integer formats.
- nxt::TextureFormat format = textureView->GetTexture()->GetFormat();
- ASSERT(format == nxt::TextureFormat::R8G8B8A8Unorm ||
- format == nxt::TextureFormat::R8G8Unorm ||
- format == nxt::TextureFormat::R8Unorm ||
- format == nxt::TextureFormat::B8G8R8A8Unorm);
+ dawn::TextureFormat format = textureView->GetTexture()->GetFormat();
+ ASSERT(format == dawn::TextureFormat::R8G8B8A8Unorm ||
+ format == dawn::TextureFormat::R8G8Unorm ||
+ format == dawn::TextureFormat::R8Unorm ||
+ format == dawn::TextureFormat::B8G8R8A8Unorm);
}
glDrawBuffers(attachmentCount, drawBuffers.data());
if (renderPass->HasDepthStencilAttachment()) {
TextureViewBase* textureView = renderPass->GetDepthStencilAttachment().view.Get();
GLuint texture = ToBackend(textureView->GetTexture())->GetHandle();
- nxt::TextureFormat format = textureView->GetTexture()->GetFormat();
+ dawn::TextureFormat format = textureView->GetTexture()->GetFormat();
// Attach depth/stencil buffer.
GLenum glAttachment = 0;
@@ -494,7 +494,7 @@
// TODO(kainino@chromium.org): the depth/stencil clears (later in
// this function) may be undefined for other texture formats.
- ASSERT(format == nxt::TextureFormat::D32FloatS8Uint);
+ ASSERT(format == dawn::TextureFormat::D32FloatS8Uint);
}
}
@@ -504,21 +504,21 @@
const auto& attachmentInfo = renderPass->GetColorAttachment(i);
// Load op - color
- if (attachmentInfo.loadOp == nxt::LoadOp::Clear) {
+ if (attachmentInfo.loadOp == dawn::LoadOp::Clear) {
glClearBufferfv(GL_COLOR, i, attachmentInfo.clearColor.data());
}
}
if (renderPass->HasDepthStencilAttachment()) {
const auto& attachmentInfo = renderPass->GetDepthStencilAttachment();
- nxt::TextureFormat attachmentFormat =
+ dawn::TextureFormat attachmentFormat =
attachmentInfo.view->GetTexture()->GetFormat();
// Load op - depth/stencil
bool doDepthClear = TextureFormatHasDepth(attachmentFormat) &&
- (attachmentInfo.depthLoadOp == nxt::LoadOp::Clear);
+ (attachmentInfo.depthLoadOp == dawn::LoadOp::Clear);
bool doStencilClear = TextureFormatHasStencil(attachmentFormat) &&
- (attachmentInfo.stencilLoadOp == nxt::LoadOp::Clear);
+ (attachmentInfo.stencilLoadOp == dawn::LoadOp::Clear);
if (doDepthClear && doStencilClear) {
glClearBufferfi(GL_DEPTH_STENCIL, 0, attachmentInfo.clearDepth,
attachmentInfo.clearStencil);
@@ -576,7 +576,7 @@
pushConstants.Apply(lastPipeline, lastPipeline);
inputBuffers.Apply();
- nxt::IndexFormat indexFormat = lastPipeline->GetIndexFormat();
+ dawn::IndexFormat indexFormat = lastPipeline->GetIndexFormat();
size_t formatSize = IndexFormatSize(indexFormat);
GLenum formatType = IndexFormatType(indexFormat);
diff --git a/src/backend/opengl/DepthStencilStateGL.cpp b/src/backend/opengl/DepthStencilStateGL.cpp
index 0bc7960..49f1b04 100644
--- a/src/backend/opengl/DepthStencilStateGL.cpp
+++ b/src/backend/opengl/DepthStencilStateGL.cpp
@@ -20,46 +20,46 @@
namespace backend { namespace opengl {
namespace {
- GLuint OpenGLCompareFunction(nxt::CompareFunction compareFunction) {
+ GLuint OpenGLCompareFunction(dawn::CompareFunction compareFunction) {
switch (compareFunction) {
- case nxt::CompareFunction::Never:
+ case dawn::CompareFunction::Never:
return GL_NEVER;
- case nxt::CompareFunction::Less:
+ case dawn::CompareFunction::Less:
return GL_LESS;
- case nxt::CompareFunction::LessEqual:
+ case dawn::CompareFunction::LessEqual:
return GL_LEQUAL;
- case nxt::CompareFunction::Greater:
+ case dawn::CompareFunction::Greater:
return GL_GREATER;
- case nxt::CompareFunction::GreaterEqual:
+ case dawn::CompareFunction::GreaterEqual:
return GL_GEQUAL;
- case nxt::CompareFunction::NotEqual:
+ case dawn::CompareFunction::NotEqual:
return GL_NOTEQUAL;
- case nxt::CompareFunction::Equal:
+ case dawn::CompareFunction::Equal:
return GL_EQUAL;
- case nxt::CompareFunction::Always:
+ case dawn::CompareFunction::Always:
return GL_ALWAYS;
default:
UNREACHABLE();
}
}
- GLuint OpenGLStencilOperation(nxt::StencilOperation stencilOperation) {
+ GLuint OpenGLStencilOperation(dawn::StencilOperation stencilOperation) {
switch (stencilOperation) {
- case nxt::StencilOperation::Keep:
+ case dawn::StencilOperation::Keep:
return GL_KEEP;
- case nxt::StencilOperation::Zero:
+ case dawn::StencilOperation::Zero:
return GL_ZERO;
- case nxt::StencilOperation::Replace:
+ case dawn::StencilOperation::Replace:
return GL_REPLACE;
- case nxt::StencilOperation::Invert:
+ case dawn::StencilOperation::Invert:
return GL_INVERT;
- case nxt::StencilOperation::IncrementClamp:
+ case dawn::StencilOperation::IncrementClamp:
return GL_INCR;
- case nxt::StencilOperation::DecrementClamp:
+ case dawn::StencilOperation::DecrementClamp:
return GL_DECR;
- case nxt::StencilOperation::IncrementWrap:
+ case dawn::StencilOperation::IncrementWrap:
return GL_INCR_WRAP;
- case nxt::StencilOperation::DecrementWrap:
+ case dawn::StencilOperation::DecrementWrap:
return GL_DECR_WRAP;
default:
UNREACHABLE();
@@ -75,7 +75,7 @@
auto& depthInfo = GetDepth();
// Depth writes only occur if depth is enabled
- if (depthInfo.compareFunction == nxt::CompareFunction::Always &&
+ if (depthInfo.compareFunction == dawn::CompareFunction::Always &&
!depthInfo.depthWriteEnabled) {
glDisable(GL_DEPTH_TEST);
} else {
diff --git a/src/backend/opengl/DeviceGL.cpp b/src/backend/opengl/DeviceGL.cpp
index 3ba1f43..fbf188a 100644
--- a/src/backend/opengl/DeviceGL.cpp
+++ b/src/backend/opengl/DeviceGL.cpp
@@ -54,7 +54,7 @@
return new BindGroup(builder);
}
ResultOrError<BindGroupLayoutBase*> Device::CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) {
+ const dawn::BindGroupLayoutDescriptor* descriptor) {
return new BindGroupLayout(this, descriptor);
}
BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) {
@@ -79,7 +79,7 @@
return new InputState(builder);
}
ResultOrError<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) {
+ const dawn::PipelineLayoutDescriptor* descriptor) {
return new PipelineLayout(this, descriptor);
}
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
@@ -93,7 +93,7 @@
return new RenderPipeline(builder);
}
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) {
+ const dawn::SamplerDescriptor* descriptor) {
return new Sampler(this, descriptor);
}
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
diff --git a/src/backend/opengl/DeviceGL.h b/src/backend/opengl/DeviceGL.h
index aa8a6a6..65cf19f 100644
--- a/src/backend/opengl/DeviceGL.h
+++ b/src/backend/opengl/DeviceGL.h
@@ -52,12 +52,12 @@
private:
ResultOrError<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) override;
+ const dawn::BindGroupLayoutDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) override;
+ const dawn::PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) override;
+ const dawn::SamplerDescriptor* descriptor) override;
};
}} // namespace backend::opengl
diff --git a/src/backend/opengl/InputStateGL.cpp b/src/backend/opengl/InputStateGL.cpp
index cfe0f4f..915272d 100644
--- a/src/backend/opengl/InputStateGL.cpp
+++ b/src/backend/opengl/InputStateGL.cpp
@@ -38,9 +38,9 @@
glVertexAttribDivisor(location, 0xffffffff);
} else {
switch (input.stepMode) {
- case nxt::InputStepMode::Vertex:
+ case dawn::InputStepMode::Vertex:
break;
- case nxt::InputStepMode::Instance:
+ case dawn::InputStepMode::Instance:
glVertexAttribDivisor(location, 1);
break;
default:
diff --git a/src/backend/opengl/PipelineGL.cpp b/src/backend/opengl/PipelineGL.cpp
index 4808722..984a583 100644
--- a/src/backend/opengl/PipelineGL.cpp
+++ b/src/backend/opengl/PipelineGL.cpp
@@ -28,13 +28,13 @@
namespace {
- GLenum GLShaderType(nxt::ShaderStage stage) {
+ GLenum GLShaderType(dawn::ShaderStage stage) {
switch (stage) {
- case nxt::ShaderStage::Vertex:
+ case dawn::ShaderStage::Vertex:
return GL_VERTEX_SHADER;
- case nxt::ShaderStage::Fragment:
+ case dawn::ShaderStage::Fragment:
return GL_FRAGMENT_SHADER;
- case nxt::ShaderStage::Compute:
+ case dawn::ShaderStage::Compute:
return GL_COMPUTE_SHADER;
default:
UNREACHABLE();
@@ -136,19 +136,19 @@
std::string name = GetBindingName(group, binding);
switch (groupInfo.types[binding]) {
- case nxt::BindingType::UniformBuffer: {
+ case dawn::BindingType::UniformBuffer: {
GLint location = glGetUniformBlockIndex(mProgram, name.c_str());
glUniformBlockBinding(mProgram, location, indices[group][binding]);
} break;
- case nxt::BindingType::StorageBuffer: {
+ case dawn::BindingType::StorageBuffer: {
GLuint location = glGetProgramResourceIndex(
mProgram, GL_SHADER_STORAGE_BLOCK, name.c_str());
glShaderStorageBlockBinding(mProgram, location, indices[group][binding]);
} break;
- case nxt::BindingType::Sampler:
- case nxt::BindingType::SampledTexture:
+ case dawn::BindingType::Sampler:
+ case dawn::BindingType::SampledTexture:
// These binding types are handled in the separate sampler and texture
// emulation
break;
@@ -190,7 +190,7 @@
}
const PipelineGL::GLPushConstantInfo& PipelineGL::GetGLPushConstants(
- nxt::ShaderStage stage) const {
+ dawn::ShaderStage stage) const {
return mGlPushConstants[stage];
}
diff --git a/src/backend/opengl/PipelineGL.h b/src/backend/opengl/PipelineGL.h
index 6c375b0..e0c9de3 100644
--- a/src/backend/opengl/PipelineGL.h
+++ b/src/backend/opengl/PipelineGL.h
@@ -35,7 +35,7 @@
using BindingLocations =
std::array<std::array<GLint, kMaxBindingsPerGroup>, kMaxBindGroups>;
- const GLPushConstantInfo& GetGLPushConstants(nxt::ShaderStage stage) const;
+ const GLPushConstantInfo& GetGLPushConstants(dawn::ShaderStage stage) const;
const std::vector<GLuint>& GetTextureUnitsForSampler(GLuint index) const;
const std::vector<GLuint>& GetTextureUnitsForTexture(GLuint index) const;
GLuint GetProgramHandle() const;
diff --git a/src/backend/opengl/PipelineLayoutGL.cpp b/src/backend/opengl/PipelineLayoutGL.cpp
index 259cfe0..266cc15 100644
--- a/src/backend/opengl/PipelineLayoutGL.cpp
+++ b/src/backend/opengl/PipelineLayoutGL.cpp
@@ -20,7 +20,7 @@
namespace backend { namespace opengl {
- PipelineLayout::PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor)
+ PipelineLayout::PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor)
: PipelineLayoutBase(device, descriptor) {
GLuint uboIndex = 0;
GLuint samplerIndex = 0;
@@ -36,20 +36,20 @@
}
switch (groupInfo.types[binding]) {
- case nxt::BindingType::UniformBuffer:
+ case dawn::BindingType::UniformBuffer:
mIndexInfo[group][binding] = uboIndex;
uboIndex++;
break;
- case nxt::BindingType::Sampler:
+ case dawn::BindingType::Sampler:
mIndexInfo[group][binding] = samplerIndex;
samplerIndex++;
break;
- case nxt::BindingType::SampledTexture:
+ case dawn::BindingType::SampledTexture:
mIndexInfo[group][binding] = sampledTextureIndex;
sampledTextureIndex++;
break;
- case nxt::BindingType::StorageBuffer:
+ case dawn::BindingType::StorageBuffer:
mIndexInfo[group][binding] = ssboIndex;
ssboIndex++;
break;
diff --git a/src/backend/opengl/PipelineLayoutGL.h b/src/backend/opengl/PipelineLayoutGL.h
index 208a6da..8c268c1 100644
--- a/src/backend/opengl/PipelineLayoutGL.h
+++ b/src/backend/opengl/PipelineLayoutGL.h
@@ -25,7 +25,7 @@
class PipelineLayout : public PipelineLayoutBase {
public:
- PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor);
+ PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor);
using BindingIndexInfo =
std::array<std::array<GLuint, kMaxBindingsPerGroup>, kMaxBindGroups>;
diff --git a/src/backend/opengl/RenderPipelineGL.cpp b/src/backend/opengl/RenderPipelineGL.cpp
index a68dd10..12eb116 100644
--- a/src/backend/opengl/RenderPipelineGL.cpp
+++ b/src/backend/opengl/RenderPipelineGL.cpp
@@ -23,17 +23,17 @@
namespace backend { namespace opengl {
namespace {
- GLenum GLPrimitiveTopology(nxt::PrimitiveTopology primitiveTopology) {
+ GLenum GLPrimitiveTopology(dawn::PrimitiveTopology primitiveTopology) {
switch (primitiveTopology) {
- case nxt::PrimitiveTopology::PointList:
+ case dawn::PrimitiveTopology::PointList:
return GL_POINTS;
- case nxt::PrimitiveTopology::LineList:
+ case dawn::PrimitiveTopology::LineList:
return GL_LINES;
- case nxt::PrimitiveTopology::LineStrip:
+ case dawn::PrimitiveTopology::LineStrip:
return GL_LINE_STRIP;
- case nxt::PrimitiveTopology::TriangleList:
+ case dawn::PrimitiveTopology::TriangleList:
return GL_TRIANGLES;
- case nxt::PrimitiveTopology::TriangleStrip:
+ case dawn::PrimitiveTopology::TriangleStrip:
return GL_TRIANGLE_STRIP;
default:
UNREACHABLE();
diff --git a/src/backend/opengl/SamplerGL.cpp b/src/backend/opengl/SamplerGL.cpp
index ce6752e..c86cc10 100644
--- a/src/backend/opengl/SamplerGL.cpp
+++ b/src/backend/opengl/SamplerGL.cpp
@@ -20,33 +20,33 @@
namespace backend { namespace opengl {
namespace {
- GLenum MagFilterMode(nxt::FilterMode filter) {
+ GLenum MagFilterMode(dawn::FilterMode filter) {
switch (filter) {
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
return GL_NEAREST;
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
return GL_LINEAR;
default:
UNREACHABLE();
}
}
- GLenum MinFilterMode(nxt::FilterMode minFilter, nxt::FilterMode mipMapFilter) {
+ GLenum MinFilterMode(dawn::FilterMode minFilter, dawn::FilterMode mipMapFilter) {
switch (minFilter) {
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
switch (mipMapFilter) {
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
return GL_NEAREST_MIPMAP_NEAREST;
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
return GL_NEAREST_MIPMAP_LINEAR;
default:
UNREACHABLE();
}
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
switch (mipMapFilter) {
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
return GL_LINEAR_MIPMAP_NEAREST;
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
return GL_LINEAR_MIPMAP_LINEAR;
default:
UNREACHABLE();
@@ -56,13 +56,13 @@
}
}
- GLenum WrapMode(nxt::AddressMode mode) {
+ GLenum WrapMode(dawn::AddressMode mode) {
switch (mode) {
- case nxt::AddressMode::Repeat:
+ case dawn::AddressMode::Repeat:
return GL_REPEAT;
- case nxt::AddressMode::MirroredRepeat:
+ case dawn::AddressMode::MirroredRepeat:
return GL_MIRRORED_REPEAT;
- case nxt::AddressMode::ClampToEdge:
+ case dawn::AddressMode::ClampToEdge:
return GL_CLAMP_TO_EDGE;
default:
UNREACHABLE();
@@ -71,7 +71,7 @@
} // namespace
- Sampler::Sampler(Device* device, const nxt::SamplerDescriptor* descriptor)
+ Sampler::Sampler(Device* device, const dawn::SamplerDescriptor* descriptor)
: SamplerBase(device, descriptor) {
glGenSamplers(1, &mHandle);
glSamplerParameteri(mHandle, GL_TEXTURE_MAG_FILTER, MagFilterMode(descriptor->magFilter));
diff --git a/src/backend/opengl/SamplerGL.h b/src/backend/opengl/SamplerGL.h
index 38a1cdd..d4cf9e7 100644
--- a/src/backend/opengl/SamplerGL.h
+++ b/src/backend/opengl/SamplerGL.h
@@ -25,7 +25,7 @@
class Sampler : public SamplerBase {
public:
- Sampler(Device* device, const nxt::SamplerDescriptor* descriptor);
+ Sampler(Device* device, const dawn::SamplerDescriptor* descriptor);
GLuint GetHandle() const;
diff --git a/src/backend/opengl/TextureGL.cpp b/src/backend/opengl/TextureGL.cpp
index aee41ef..ce0dd35 100644
--- a/src/backend/opengl/TextureGL.cpp
+++ b/src/backend/opengl/TextureGL.cpp
@@ -23,33 +23,33 @@
namespace {
- GLenum TargetForDimension(nxt::TextureDimension dimension) {
+ GLenum TargetForDimension(dawn::TextureDimension dimension) {
switch (dimension) {
- case nxt::TextureDimension::e2D:
+ case dawn::TextureDimension::e2D:
return GL_TEXTURE_2D;
default:
UNREACHABLE();
}
}
- TextureFormatInfo GetGLFormatInfo(nxt::TextureFormat format) {
+ TextureFormatInfo GetGLFormatInfo(dawn::TextureFormat format) {
switch (format) {
- case nxt::TextureFormat::R8G8B8A8Unorm:
+ case dawn::TextureFormat::R8G8B8A8Unorm:
return {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE};
- case nxt::TextureFormat::R8G8Unorm:
+ case dawn::TextureFormat::R8G8Unorm:
return {GL_RG8, GL_RG, GL_UNSIGNED_BYTE};
- case nxt::TextureFormat::R8Unorm:
+ case dawn::TextureFormat::R8Unorm:
return {GL_R8, GL_RED, GL_UNSIGNED_BYTE};
- case nxt::TextureFormat::R8G8B8A8Uint:
+ case dawn::TextureFormat::R8G8B8A8Uint:
return {GL_RGBA8UI, GL_RGBA, GL_UNSIGNED_INT};
- case nxt::TextureFormat::R8G8Uint:
+ case dawn::TextureFormat::R8G8Uint:
return {GL_RG8UI, GL_RG, GL_UNSIGNED_INT};
- case nxt::TextureFormat::R8Uint:
+ case dawn::TextureFormat::R8Uint:
return {GL_R8UI, GL_RED, GL_UNSIGNED_INT};
- case nxt::TextureFormat::B8G8R8A8Unorm:
+ case dawn::TextureFormat::B8G8R8A8Unorm:
// This doesn't have an enum for the internal format in OpenGL, so use RGBA8.
return {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE};
- case nxt::TextureFormat::D32FloatS8Uint:
+ case dawn::TextureFormat::D32FloatS8Uint:
return {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL,
GL_FLOAT_32_UNSIGNED_INT_24_8_REV};
default:
diff --git a/src/backend/vulkan/BindGroupLayoutVk.cpp b/src/backend/vulkan/BindGroupLayoutVk.cpp
index f92156a..4aa5715 100644
--- a/src/backend/vulkan/BindGroupLayoutVk.cpp
+++ b/src/backend/vulkan/BindGroupLayoutVk.cpp
@@ -21,16 +21,16 @@
namespace {
- VkShaderStageFlags VulkanShaderStageFlags(nxt::ShaderStageBit stages) {
+ VkShaderStageFlags VulkanShaderStageFlags(dawn::ShaderStageBit stages) {
VkShaderStageFlags flags = 0;
- if (stages & nxt::ShaderStageBit::Vertex) {
+ if (stages & dawn::ShaderStageBit::Vertex) {
flags |= VK_SHADER_STAGE_VERTEX_BIT;
}
- if (stages & nxt::ShaderStageBit::Fragment) {
+ if (stages & dawn::ShaderStageBit::Fragment) {
flags |= VK_SHADER_STAGE_FRAGMENT_BIT;
}
- if (stages & nxt::ShaderStageBit::Compute) {
+ if (stages & dawn::ShaderStageBit::Compute) {
flags |= VK_SHADER_STAGE_COMPUTE_BIT;
}
@@ -39,15 +39,15 @@
} // anonymous namespace
- VkDescriptorType VulkanDescriptorType(nxt::BindingType type) {
+ VkDescriptorType VulkanDescriptorType(dawn::BindingType type) {
switch (type) {
- case nxt::BindingType::UniformBuffer:
+ case dawn::BindingType::UniformBuffer:
return VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
- case nxt::BindingType::Sampler:
+ case dawn::BindingType::Sampler:
return VK_DESCRIPTOR_TYPE_SAMPLER;
- case nxt::BindingType::SampledTexture:
+ case dawn::BindingType::SampledTexture:
return VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
- case nxt::BindingType::StorageBuffer:
+ case dawn::BindingType::StorageBuffer:
return VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
default:
UNREACHABLE();
@@ -55,7 +55,7 @@
}
BindGroupLayout::BindGroupLayout(Device* device,
- const nxt::BindGroupLayoutDescriptor* descriptor)
+ const dawn::BindGroupLayoutDescriptor* descriptor)
: BindGroupLayoutBase(device, descriptor) {
const auto& info = GetBindingInfo();
@@ -116,15 +116,15 @@
MAX_TYPE,
};
static_assert(MAX_TYPE == kMaxPoolSizesNeeded, "");
- auto ToDescriptorType = [](nxt::BindingType type) -> DescriptorType {
+ auto ToDescriptorType = [](dawn::BindingType type) -> DescriptorType {
switch (type) {
- case nxt::BindingType::UniformBuffer:
+ case dawn::BindingType::UniformBuffer:
return UNIFORM_BUFFER;
- case nxt::BindingType::Sampler:
+ case dawn::BindingType::Sampler:
return SAMPLER;
- case nxt::BindingType::SampledTexture:
+ case dawn::BindingType::SampledTexture:
return SAMPLED_IMAGE;
- case nxt::BindingType::StorageBuffer:
+ case dawn::BindingType::StorageBuffer:
return STORAGE_BUFFER;
default:
UNREACHABLE();
diff --git a/src/backend/vulkan/BindGroupLayoutVk.h b/src/backend/vulkan/BindGroupLayoutVk.h
index 9f8265e..5c251a4 100644
--- a/src/backend/vulkan/BindGroupLayoutVk.h
+++ b/src/backend/vulkan/BindGroupLayoutVk.h
@@ -23,11 +23,11 @@
class Device;
- VkDescriptorType VulkanDescriptorType(nxt::BindingType type);
+ VkDescriptorType VulkanDescriptorType(dawn::BindingType type);
class BindGroupLayout : public BindGroupLayoutBase {
public:
- BindGroupLayout(Device* device, const nxt::BindGroupLayoutDescriptor* descriptor);
+ BindGroupLayout(Device* device, const dawn::BindGroupLayoutDescriptor* descriptor);
~BindGroupLayout();
VkDescriptorSetLayout GetHandle() const;
diff --git a/src/backend/vulkan/BindGroupVk.cpp b/src/backend/vulkan/BindGroupVk.cpp
index 8bbea2f..6cbad79 100644
--- a/src/backend/vulkan/BindGroupVk.cpp
+++ b/src/backend/vulkan/BindGroupVk.cpp
@@ -80,8 +80,8 @@
write.descriptorType = VulkanDescriptorType(layoutInfo.types[bindingIndex]);
switch (layoutInfo.types[bindingIndex]) {
- case nxt::BindingType::UniformBuffer:
- case nxt::BindingType::StorageBuffer: {
+ case dawn::BindingType::UniformBuffer:
+ case dawn::BindingType::StorageBuffer: {
BufferViewBase* view = GetBindingAsBufferView(bindingIndex);
Buffer* buffer = ToBackend(view->GetBuffer());
@@ -92,13 +92,13 @@
write.pBufferInfo = &writeBufferInfo[numWrites];
} break;
- case nxt::BindingType::Sampler: {
+ case dawn::BindingType::Sampler: {
Sampler* sampler = ToBackend(GetBindingAsSampler(bindingIndex));
writeImageInfo[numWrites].sampler = sampler->GetHandle();
write.pImageInfo = &writeImageInfo[numWrites];
} break;
- case nxt::BindingType::SampledTexture: {
+ case dawn::BindingType::SampledTexture: {
TextureView* view = ToBackend(GetBindingAsTextureView(bindingIndex));
writeImageInfo[numWrites].imageView = view->GetHandle();
diff --git a/src/backend/vulkan/BlendStateVk.cpp b/src/backend/vulkan/BlendStateVk.cpp
index fecab86..3dd2afe 100644
--- a/src/backend/vulkan/BlendStateVk.cpp
+++ b/src/backend/vulkan/BlendStateVk.cpp
@@ -19,68 +19,68 @@
namespace backend { namespace vulkan {
namespace {
- VkBlendFactor VulkanBlendFactor(nxt::BlendFactor factor) {
+ VkBlendFactor VulkanBlendFactor(dawn::BlendFactor factor) {
switch (factor) {
- case nxt::BlendFactor::Zero:
+ case dawn::BlendFactor::Zero:
return VK_BLEND_FACTOR_ZERO;
- case nxt::BlendFactor::One:
+ case dawn::BlendFactor::One:
return VK_BLEND_FACTOR_ONE;
- case nxt::BlendFactor::SrcColor:
+ case dawn::BlendFactor::SrcColor:
return VK_BLEND_FACTOR_SRC_COLOR;
- case nxt::BlendFactor::OneMinusSrcColor:
+ case dawn::BlendFactor::OneMinusSrcColor:
return VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR;
- case nxt::BlendFactor::SrcAlpha:
+ case dawn::BlendFactor::SrcAlpha:
return VK_BLEND_FACTOR_SRC_ALPHA;
- case nxt::BlendFactor::OneMinusSrcAlpha:
+ case dawn::BlendFactor::OneMinusSrcAlpha:
return VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
- case nxt::BlendFactor::DstColor:
+ case dawn::BlendFactor::DstColor:
return VK_BLEND_FACTOR_DST_COLOR;
- case nxt::BlendFactor::OneMinusDstColor:
+ case dawn::BlendFactor::OneMinusDstColor:
return VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR;
- case nxt::BlendFactor::DstAlpha:
+ case dawn::BlendFactor::DstAlpha:
return VK_BLEND_FACTOR_DST_ALPHA;
- case nxt::BlendFactor::OneMinusDstAlpha:
+ case dawn::BlendFactor::OneMinusDstAlpha:
return VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA;
- case nxt::BlendFactor::SrcAlphaSaturated:
+ case dawn::BlendFactor::SrcAlphaSaturated:
return VK_BLEND_FACTOR_SRC_ALPHA_SATURATE;
- case nxt::BlendFactor::BlendColor:
+ case dawn::BlendFactor::BlendColor:
return VK_BLEND_FACTOR_CONSTANT_COLOR;
- case nxt::BlendFactor::OneMinusBlendColor:
+ case dawn::BlendFactor::OneMinusBlendColor:
return VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR;
default:
UNREACHABLE();
}
}
- VkBlendOp VulkanBlendOperation(nxt::BlendOperation operation) {
+ VkBlendOp VulkanBlendOperation(dawn::BlendOperation operation) {
switch (operation) {
- case nxt::BlendOperation::Add:
+ case dawn::BlendOperation::Add:
return VK_BLEND_OP_ADD;
- case nxt::BlendOperation::Subtract:
+ case dawn::BlendOperation::Subtract:
return VK_BLEND_OP_SUBTRACT;
- case nxt::BlendOperation::ReverseSubtract:
+ case dawn::BlendOperation::ReverseSubtract:
return VK_BLEND_OP_REVERSE_SUBTRACT;
- case nxt::BlendOperation::Min:
+ case dawn::BlendOperation::Min:
return VK_BLEND_OP_MIN;
- case nxt::BlendOperation::Max:
+ case dawn::BlendOperation::Max:
return VK_BLEND_OP_MAX;
default:
UNREACHABLE();
}
}
- VkColorComponentFlagBits VulkanColorWriteMask(nxt::ColorWriteMask mask) {
+ VkColorComponentFlagBits VulkanColorWriteMask(dawn::ColorWriteMask mask) {
// Vulkan and NXT color write masks match, static assert it and return the mask
- static_assert(static_cast<VkColorComponentFlagBits>(nxt::ColorWriteMask::Red) ==
+ static_assert(static_cast<VkColorComponentFlagBits>(dawn::ColorWriteMask::Red) ==
VK_COLOR_COMPONENT_R_BIT,
"");
- static_assert(static_cast<VkColorComponentFlagBits>(nxt::ColorWriteMask::Green) ==
+ static_assert(static_cast<VkColorComponentFlagBits>(dawn::ColorWriteMask::Green) ==
VK_COLOR_COMPONENT_G_BIT,
"");
- static_assert(static_cast<VkColorComponentFlagBits>(nxt::ColorWriteMask::Blue) ==
+ static_assert(static_cast<VkColorComponentFlagBits>(dawn::ColorWriteMask::Blue) ==
VK_COLOR_COMPONENT_B_BIT,
"");
- static_assert(static_cast<VkColorComponentFlagBits>(nxt::ColorWriteMask::Alpha) ==
+ static_assert(static_cast<VkColorComponentFlagBits>(dawn::ColorWriteMask::Alpha) ==
VK_COLOR_COMPONENT_A_BIT,
"");
diff --git a/src/backend/vulkan/BufferVk.cpp b/src/backend/vulkan/BufferVk.cpp
index 18dcaa6..57a4c19 100644
--- a/src/backend/vulkan/BufferVk.cpp
+++ b/src/backend/vulkan/BufferVk.cpp
@@ -24,44 +24,44 @@
namespace {
- VkBufferUsageFlags VulkanBufferUsage(nxt::BufferUsageBit usage) {
+ VkBufferUsageFlags VulkanBufferUsage(dawn::BufferUsageBit usage) {
VkBufferUsageFlags flags = 0;
- if (usage & nxt::BufferUsageBit::TransferSrc) {
+ if (usage & dawn::BufferUsageBit::TransferSrc) {
flags |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
}
- if (usage & nxt::BufferUsageBit::TransferDst) {
+ if (usage & dawn::BufferUsageBit::TransferDst) {
flags |= VK_BUFFER_USAGE_TRANSFER_DST_BIT;
}
- if (usage & nxt::BufferUsageBit::Index) {
+ if (usage & dawn::BufferUsageBit::Index) {
flags |= VK_BUFFER_USAGE_INDEX_BUFFER_BIT;
}
- if (usage & nxt::BufferUsageBit::Vertex) {
+ if (usage & dawn::BufferUsageBit::Vertex) {
flags |= VK_BUFFER_USAGE_VERTEX_BUFFER_BIT;
}
- if (usage & nxt::BufferUsageBit::Uniform) {
+ if (usage & dawn::BufferUsageBit::Uniform) {
flags |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT;
}
- if (usage & nxt::BufferUsageBit::Storage) {
+ if (usage & dawn::BufferUsageBit::Storage) {
flags |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
}
return flags;
}
- VkPipelineStageFlags VulkanPipelineStage(nxt::BufferUsageBit usage) {
+ VkPipelineStageFlags VulkanPipelineStage(dawn::BufferUsageBit usage) {
VkPipelineStageFlags flags = 0;
- if (usage & (nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::MapWrite)) {
+ if (usage & (dawn::BufferUsageBit::MapRead | dawn::BufferUsageBit::MapWrite)) {
flags |= VK_PIPELINE_STAGE_HOST_BIT;
}
- if (usage & (nxt::BufferUsageBit::TransferSrc | nxt::BufferUsageBit::TransferDst)) {
+ if (usage & (dawn::BufferUsageBit::TransferSrc | dawn::BufferUsageBit::TransferDst)) {
flags |= VK_PIPELINE_STAGE_TRANSFER_BIT;
}
- if (usage & (nxt::BufferUsageBit::Index | nxt::BufferUsageBit::Vertex)) {
+ if (usage & (dawn::BufferUsageBit::Index | dawn::BufferUsageBit::Vertex)) {
flags |= VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
}
- if (usage & (nxt::BufferUsageBit::Uniform | nxt::BufferUsageBit::Storage)) {
+ if (usage & (dawn::BufferUsageBit::Uniform | dawn::BufferUsageBit::Storage)) {
flags |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT |
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
@@ -70,31 +70,31 @@
return flags;
}
- VkAccessFlags VulkanAccessFlags(nxt::BufferUsageBit usage) {
+ VkAccessFlags VulkanAccessFlags(dawn::BufferUsageBit usage) {
VkAccessFlags flags = 0;
- if (usage & nxt::BufferUsageBit::MapRead) {
+ if (usage & dawn::BufferUsageBit::MapRead) {
flags |= VK_ACCESS_HOST_READ_BIT;
}
- if (usage & nxt::BufferUsageBit::MapWrite) {
+ if (usage & dawn::BufferUsageBit::MapWrite) {
flags |= VK_ACCESS_HOST_WRITE_BIT;
}
- if (usage & nxt::BufferUsageBit::TransferSrc) {
+ if (usage & dawn::BufferUsageBit::TransferSrc) {
flags |= VK_ACCESS_TRANSFER_READ_BIT;
}
- if (usage & nxt::BufferUsageBit::TransferDst) {
+ if (usage & dawn::BufferUsageBit::TransferDst) {
flags |= VK_ACCESS_TRANSFER_WRITE_BIT;
}
- if (usage & nxt::BufferUsageBit::Index) {
+ if (usage & dawn::BufferUsageBit::Index) {
flags |= VK_ACCESS_INDEX_READ_BIT;
}
- if (usage & nxt::BufferUsageBit::Vertex) {
+ if (usage & dawn::BufferUsageBit::Vertex) {
flags |= VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT;
}
- if (usage & nxt::BufferUsageBit::Uniform) {
+ if (usage & dawn::BufferUsageBit::Uniform) {
flags |= VK_ACCESS_UNIFORM_READ_BIT;
}
- if (usage & nxt::BufferUsageBit::Storage) {
+ if (usage & dawn::BufferUsageBit::Storage) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
@@ -124,9 +124,8 @@
VkMemoryRequirements requirements;
device->fn.GetBufferMemoryRequirements(device->GetVkDevice(), mHandle, &requirements);
- bool requestMappable =
- (GetAllowedUsage() & (nxt::BufferUsageBit::MapRead | nxt::BufferUsageBit::MapWrite)) !=
- 0;
+ bool requestMappable = (GetAllowedUsage() & (dawn::BufferUsageBit::MapRead |
+ dawn::BufferUsageBit::MapWrite)) != 0;
if (!device->GetMemoryAllocator()->Allocate(requirements, requestMappable,
&mMemoryAllocation)) {
ASSERT(false);
@@ -162,7 +161,7 @@
return mHandle;
}
- void Buffer::TransitionUsageNow(VkCommandBuffer commands, nxt::BufferUsageBit usage) {
+ void Buffer::TransitionUsageNow(VkCommandBuffer commands, dawn::BufferUsageBit usage) {
bool lastIncludesTarget = (mLastUsage & usage) == usage;
bool lastReadOnly = (mLastUsage & kReadOnlyBufferUsages) == mLastUsage;
@@ -172,7 +171,7 @@
}
// Special-case for the initial transition: Vulkan doesn't allow access flags to be 0.
- if (mLastUsage == nxt::BufferUsageBit::None) {
+ if (mLastUsage == dawn::BufferUsageBit::None) {
mLastUsage = usage;
return;
}
@@ -202,7 +201,7 @@
Device* device = ToBackend(GetDevice());
VkCommandBuffer commands = device->GetPendingCommandBuffer();
- TransitionUsageNow(commands, nxt::BufferUsageBit::TransferDst);
+ TransitionUsageNow(commands, dawn::BufferUsageBit::TransferDst);
BufferUploader* uploader = device->GetBufferUploader();
uploader->BufferSubData(mHandle, start, count, data);
@@ -212,7 +211,7 @@
Device* device = ToBackend(GetDevice());
VkCommandBuffer commands = device->GetPendingCommandBuffer();
- TransitionUsageNow(commands, nxt::BufferUsageBit::MapRead);
+ TransitionUsageNow(commands, dawn::BufferUsageBit::MapRead);
uint8_t* memory = mMemoryAllocation.GetMappedPointer();
ASSERT(memory != nullptr);
@@ -225,7 +224,7 @@
Device* device = ToBackend(GetDevice());
VkCommandBuffer commands = device->GetPendingCommandBuffer();
- TransitionUsageNow(commands, nxt::BufferUsageBit::MapWrite);
+ TransitionUsageNow(commands, dawn::BufferUsageBit::MapWrite);
uint8_t* memory = mMemoryAllocation.GetMappedPointer();
ASSERT(memory != nullptr);
diff --git a/src/backend/vulkan/BufferVk.h b/src/backend/vulkan/BufferVk.h
index eb38a08..61b1643 100644
--- a/src/backend/vulkan/BufferVk.h
+++ b/src/backend/vulkan/BufferVk.h
@@ -38,7 +38,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(VkCommandBuffer commands, nxt::BufferUsageBit usage);
+ void TransitionUsageNow(VkCommandBuffer commands, dawn::BufferUsageBit usage);
private:
void SetSubDataImpl(uint32_t start, uint32_t count, const uint8_t* data) override;
@@ -49,7 +49,7 @@
VkBuffer mHandle = VK_NULL_HANDLE;
DeviceMemoryAllocation mMemoryAllocation;
- nxt::BufferUsageBit mLastUsage = nxt::BufferUsageBit::None;
+ dawn::BufferUsageBit mLastUsage = dawn::BufferUsageBit::None;
};
using BufferView = BufferViewBase;
diff --git a/src/backend/vulkan/CommandBufferVk.cpp b/src/backend/vulkan/CommandBufferVk.cpp
index cde8d31..57f7846 100644
--- a/src/backend/vulkan/CommandBufferVk.cpp
+++ b/src/backend/vulkan/CommandBufferVk.cpp
@@ -28,11 +28,11 @@
namespace {
- VkIndexType VulkanIndexType(nxt::IndexFormat format) {
+ VkIndexType VulkanIndexType(dawn::IndexFormat format) {
switch (format) {
- case nxt::IndexFormat::Uint16:
+ case dawn::IndexFormat::Uint16:
return VK_INDEX_TYPE_UINT16;
- case nxt::IndexFormat::Uint32:
+ case dawn::IndexFormat::Uint32:
return VK_INDEX_TYPE_UINT32;
default:
UNREACHABLE();
@@ -146,9 +146,9 @@
auto& dst = copy->destination;
ToBackend(src.buffer)
- ->TransitionUsageNow(commands, nxt::BufferUsageBit::TransferSrc);
+ ->TransitionUsageNow(commands, dawn::BufferUsageBit::TransferSrc);
ToBackend(dst.buffer)
- ->TransitionUsageNow(commands, nxt::BufferUsageBit::TransferDst);
+ ->TransitionUsageNow(commands, dawn::BufferUsageBit::TransferDst);
VkBufferCopy region;
region.srcOffset = src.offset;
@@ -166,9 +166,9 @@
auto& dst = copy->destination;
ToBackend(src.buffer)
- ->TransitionUsageNow(commands, nxt::BufferUsageBit::TransferSrc);
+ ->TransitionUsageNow(commands, dawn::BufferUsageBit::TransferSrc);
ToBackend(dst.texture)
- ->TransitionUsageNow(commands, nxt::TextureUsageBit::TransferDst);
+ ->TransitionUsageNow(commands, dawn::TextureUsageBit::TransferDst);
VkBuffer srcBuffer = ToBackend(src.buffer)->GetHandle();
VkImage dstImage = ToBackend(dst.texture)->GetHandle();
@@ -189,9 +189,9 @@
auto& dst = copy->destination;
ToBackend(src.texture)
- ->TransitionUsageNow(commands, nxt::TextureUsageBit::TransferSrc);
+ ->TransitionUsageNow(commands, dawn::TextureUsageBit::TransferSrc);
ToBackend(dst.buffer)
- ->TransitionUsageNow(commands, nxt::BufferUsageBit::TransferDst);
+ ->TransitionUsageNow(commands, dawn::BufferUsageBit::TransferDst);
VkImage srcImage = ToBackend(src.texture)->GetHandle();
VkBuffer dstBuffer = ToBackend(dst.buffer)->GetHandle();
diff --git a/src/backend/vulkan/ComputePipelineVk.cpp b/src/backend/vulkan/ComputePipelineVk.cpp
index fd09b4e..13e02f3 100644
--- a/src/backend/vulkan/ComputePipelineVk.cpp
+++ b/src/backend/vulkan/ComputePipelineVk.cpp
@@ -31,7 +31,7 @@
createInfo.basePipelineHandle = VK_NULL_HANDLE;
createInfo.basePipelineIndex = -1;
- const auto& stageInfo = builder->GetStageInfo(nxt::ShaderStage::Compute);
+ const auto& stageInfo = builder->GetStageInfo(dawn::ShaderStage::Compute);
createInfo.stage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
createInfo.stage.pNext = nullptr;
createInfo.stage.flags = 0;
diff --git a/src/backend/vulkan/DepthStencilStateVk.cpp b/src/backend/vulkan/DepthStencilStateVk.cpp
index a46fb53..eb40dcf 100644
--- a/src/backend/vulkan/DepthStencilStateVk.cpp
+++ b/src/backend/vulkan/DepthStencilStateVk.cpp
@@ -19,46 +19,46 @@
namespace backend { namespace vulkan {
namespace {
- VkCompareOp VulkanCompareOp(nxt::CompareFunction op) {
+ VkCompareOp VulkanCompareOp(dawn::CompareFunction op) {
switch (op) {
- case nxt::CompareFunction::Always:
+ case dawn::CompareFunction::Always:
return VK_COMPARE_OP_ALWAYS;
- case nxt::CompareFunction::Equal:
+ case dawn::CompareFunction::Equal:
return VK_COMPARE_OP_EQUAL;
- case nxt::CompareFunction::Greater:
+ case dawn::CompareFunction::Greater:
return VK_COMPARE_OP_GREATER;
- case nxt::CompareFunction::GreaterEqual:
+ case dawn::CompareFunction::GreaterEqual:
return VK_COMPARE_OP_GREATER_OR_EQUAL;
- case nxt::CompareFunction::Less:
+ case dawn::CompareFunction::Less:
return VK_COMPARE_OP_LESS;
- case nxt::CompareFunction::LessEqual:
+ case dawn::CompareFunction::LessEqual:
return VK_COMPARE_OP_LESS_OR_EQUAL;
- case nxt::CompareFunction::Never:
+ case dawn::CompareFunction::Never:
return VK_COMPARE_OP_NEVER;
- case nxt::CompareFunction::NotEqual:
+ case dawn::CompareFunction::NotEqual:
return VK_COMPARE_OP_NOT_EQUAL;
default:
UNREACHABLE();
}
}
- VkStencilOp VulkanStencilOp(nxt::StencilOperation op) {
+ VkStencilOp VulkanStencilOp(dawn::StencilOperation op) {
switch (op) {
- case nxt::StencilOperation::Keep:
+ case dawn::StencilOperation::Keep:
return VK_STENCIL_OP_KEEP;
- case nxt::StencilOperation::Zero:
+ case dawn::StencilOperation::Zero:
return VK_STENCIL_OP_ZERO;
- case nxt::StencilOperation::Replace:
+ case dawn::StencilOperation::Replace:
return VK_STENCIL_OP_REPLACE;
- case nxt::StencilOperation::IncrementClamp:
+ case dawn::StencilOperation::IncrementClamp:
return VK_STENCIL_OP_INCREMENT_AND_CLAMP;
- case nxt::StencilOperation::DecrementClamp:
+ case dawn::StencilOperation::DecrementClamp:
return VK_STENCIL_OP_DECREMENT_AND_CLAMP;
- case nxt::StencilOperation::Invert:
+ case dawn::StencilOperation::Invert:
return VK_STENCIL_OP_INVERT;
- case nxt::StencilOperation::IncrementWrap:
+ case dawn::StencilOperation::IncrementWrap:
return VK_STENCIL_OP_INCREMENT_AND_WRAP;
- case nxt::StencilOperation::DecrementWrap:
+ case dawn::StencilOperation::DecrementWrap:
return VK_STENCIL_OP_DECREMENT_AND_WRAP;
default:
UNREACHABLE();
diff --git a/src/backend/vulkan/DeviceVk.cpp b/src/backend/vulkan/DeviceVk.cpp
index 494a82a..10a459d 100644
--- a/src/backend/vulkan/DeviceVk.cpp
+++ b/src/backend/vulkan/DeviceVk.cpp
@@ -224,7 +224,7 @@
return new BindGroup(builder);
}
ResultOrError<BindGroupLayoutBase*> Device::CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) {
+ const dawn::BindGroupLayoutDescriptor* descriptor) {
return new BindGroupLayout(this, descriptor);
}
BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) {
@@ -249,7 +249,7 @@
return new InputState(builder);
}
ResultOrError<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) {
+ const dawn::PipelineLayoutDescriptor* descriptor) {
return new PipelineLayout(this, descriptor);
}
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
@@ -263,7 +263,7 @@
return new RenderPipeline(builder);
}
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) {
+ const dawn::SamplerDescriptor* descriptor) {
return new Sampler(this, descriptor);
}
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
diff --git a/src/backend/vulkan/DeviceVk.h b/src/backend/vulkan/DeviceVk.h
index 1e7e195..b85f0ee 100644
--- a/src/backend/vulkan/DeviceVk.h
+++ b/src/backend/vulkan/DeviceVk.h
@@ -83,12 +83,12 @@
private:
ResultOrError<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
- const nxt::BindGroupLayoutDescriptor* descriptor) override;
+ const dawn::BindGroupLayoutDescriptor* descriptor) override;
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
- const nxt::PipelineLayoutDescriptor* descriptor) override;
+ const dawn::PipelineLayoutDescriptor* descriptor) override;
ResultOrError<QueueBase*> CreateQueueImpl() override;
ResultOrError<SamplerBase*> CreateSamplerImpl(
- const nxt::SamplerDescriptor* descriptor) override;
+ const dawn::SamplerDescriptor* descriptor) override;
bool CreateInstance(VulkanGlobalKnobs* usedKnobs,
const std::vector<const char*>& requiredExtensions);
diff --git a/src/backend/vulkan/InputStateVk.cpp b/src/backend/vulkan/InputStateVk.cpp
index a801e9f..8d7eb0c 100644
--- a/src/backend/vulkan/InputStateVk.cpp
+++ b/src/backend/vulkan/InputStateVk.cpp
@@ -20,42 +20,42 @@
namespace {
- VkVertexInputRate VulkanInputRate(nxt::InputStepMode stepMode) {
+ VkVertexInputRate VulkanInputRate(dawn::InputStepMode stepMode) {
switch (stepMode) {
- case nxt::InputStepMode::Vertex:
+ case dawn::InputStepMode::Vertex:
return VK_VERTEX_INPUT_RATE_VERTEX;
- case nxt::InputStepMode::Instance:
+ case dawn::InputStepMode::Instance:
return VK_VERTEX_INPUT_RATE_INSTANCE;
default:
UNREACHABLE();
}
}
- VkFormat VulkanVertexFormat(nxt::VertexFormat format) {
+ VkFormat VulkanVertexFormat(dawn::VertexFormat format) {
switch (format) {
- case nxt::VertexFormat::FloatR32G32B32A32:
+ case dawn::VertexFormat::FloatR32G32B32A32:
return VK_FORMAT_R32G32B32A32_SFLOAT;
- case nxt::VertexFormat::FloatR32G32B32:
+ case dawn::VertexFormat::FloatR32G32B32:
return VK_FORMAT_R32G32B32_SFLOAT;
- case nxt::VertexFormat::FloatR32G32:
+ case dawn::VertexFormat::FloatR32G32:
return VK_FORMAT_R32G32_SFLOAT;
- case nxt::VertexFormat::FloatR32:
+ case dawn::VertexFormat::FloatR32:
return VK_FORMAT_R32_SFLOAT;
- case nxt::VertexFormat::IntR32G32B32A32:
+ case dawn::VertexFormat::IntR32G32B32A32:
return VK_FORMAT_R32G32B32A32_SINT;
- case nxt::VertexFormat::IntR32G32B32:
+ case dawn::VertexFormat::IntR32G32B32:
return VK_FORMAT_R32G32B32_SINT;
- case nxt::VertexFormat::IntR32G32:
+ case dawn::VertexFormat::IntR32G32:
return VK_FORMAT_R32G32_SINT;
- case nxt::VertexFormat::IntR32:
+ case dawn::VertexFormat::IntR32:
return VK_FORMAT_R32_SINT;
- case nxt::VertexFormat::UshortR16G16B16A16:
+ case dawn::VertexFormat::UshortR16G16B16A16:
return VK_FORMAT_R16G16B16A16_UINT;
- case nxt::VertexFormat::UshortR16G16:
+ case dawn::VertexFormat::UshortR16G16:
return VK_FORMAT_R16G16_UINT;
- case nxt::VertexFormat::UnormR8G8B8A8:
+ case dawn::VertexFormat::UnormR8G8B8A8:
return VK_FORMAT_R8G8B8A8_UNORM;
- case nxt::VertexFormat::UnormR8G8:
+ case dawn::VertexFormat::UnormR8G8:
return VK_FORMAT_R8G8_UNORM;
default:
UNREACHABLE();
diff --git a/src/backend/vulkan/NativeSwapChainImplVk.cpp b/src/backend/vulkan/NativeSwapChainImplVk.cpp
index 9e87fca..866a56a 100644
--- a/src/backend/vulkan/NativeSwapChainImplVk.cpp
+++ b/src/backend/vulkan/NativeSwapChainImplVk.cpp
@@ -30,7 +30,7 @@
// driver. Need to generalize
config->nativeFormat = VK_FORMAT_B8G8R8A8_UNORM;
config->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
- config->format = nxt::TextureFormat::B8G8R8A8Unorm;
+ config->format = dawn::TextureFormat::B8G8R8A8Unorm;
config->minImageCount = 3;
// TODO(cwallez@chromium.org): This is upside down compared to what we want, at least
// on Linux
@@ -92,7 +92,7 @@
createInfo.imageExtent.height = height;
createInfo.imageArrayLayers = 1;
createInfo.imageUsage =
- VulkanImageUsage(static_cast<nxt::TextureUsageBit>(usage), mConfig.format);
+ VulkanImageUsage(static_cast<dawn::TextureUsageBit>(usage), mConfig.format);
createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
createInfo.queueFamilyIndexCount = 0;
createInfo.pQueueFamilyIndices = nullptr;
@@ -202,7 +202,7 @@
return NXT_SWAP_CHAIN_NO_ERROR;
}
- nxt::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
+ dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
return mConfig.format;
}
diff --git a/src/backend/vulkan/NativeSwapChainImplVk.h b/src/backend/vulkan/NativeSwapChainImplVk.h
index 848c554..39d1661 100644
--- a/src/backend/vulkan/NativeSwapChainImplVk.h
+++ b/src/backend/vulkan/NativeSwapChainImplVk.h
@@ -39,11 +39,11 @@
nxtSwapChainError GetNextTexture(nxtSwapChainNextTexture* nextTexture);
nxtSwapChainError Present();
- nxt::TextureFormat GetPreferredFormat() const;
+ dawn::TextureFormat GetPreferredFormat() const;
struct ChosenConfig {
VkFormat nativeFormat;
- nxt::TextureFormat format;
+ dawn::TextureFormat format;
VkColorSpaceKHR colorSpace;
VkSurfaceTransformFlagBitsKHR preTransform;
uint32_t minImageCount;
diff --git a/src/backend/vulkan/PipelineLayoutVk.cpp b/src/backend/vulkan/PipelineLayoutVk.cpp
index faf8362..f790090 100644
--- a/src/backend/vulkan/PipelineLayoutVk.cpp
+++ b/src/backend/vulkan/PipelineLayoutVk.cpp
@@ -22,7 +22,7 @@
namespace backend { namespace vulkan {
- PipelineLayout::PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor)
+ PipelineLayout::PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor)
: PipelineLayoutBase(device, descriptor) {
// Compute the array of VkDescriptorSetLayouts that will be chained in the create info.
// TODO(cwallez@chromium.org) Vulkan doesn't allow holes in this array, should we expose
diff --git a/src/backend/vulkan/PipelineLayoutVk.h b/src/backend/vulkan/PipelineLayoutVk.h
index 8352aba..344c2cd 100644
--- a/src/backend/vulkan/PipelineLayoutVk.h
+++ b/src/backend/vulkan/PipelineLayoutVk.h
@@ -25,7 +25,7 @@
class PipelineLayout : public PipelineLayoutBase {
public:
- PipelineLayout(Device* device, const nxt::PipelineLayoutDescriptor* descriptor);
+ PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor);
~PipelineLayout();
VkPipelineLayout GetHandle() const;
diff --git a/src/backend/vulkan/RenderPassCache.cpp b/src/backend/vulkan/RenderPassCache.cpp
index 78cb700..6f05c28 100644
--- a/src/backend/vulkan/RenderPassCache.cpp
+++ b/src/backend/vulkan/RenderPassCache.cpp
@@ -22,11 +22,11 @@
namespace backend { namespace vulkan {
namespace {
- VkAttachmentLoadOp VulkanAttachmentLoadOp(nxt::LoadOp op) {
+ VkAttachmentLoadOp VulkanAttachmentLoadOp(dawn::LoadOp op) {
switch (op) {
- case nxt::LoadOp::Load:
+ case dawn::LoadOp::Load:
return VK_ATTACHMENT_LOAD_OP_LOAD;
- case nxt::LoadOp::Clear:
+ case dawn::LoadOp::Clear:
return VK_ATTACHMENT_LOAD_OP_CLEAR;
default:
UNREACHABLE();
@@ -37,16 +37,16 @@
// RenderPassCacheQuery
void RenderPassCacheQuery::SetColor(uint32_t index,
- nxt::TextureFormat format,
- nxt::LoadOp loadOp) {
+ dawn::TextureFormat format,
+ dawn::LoadOp loadOp) {
colorMask.set(index);
colorFormats[index] = format;
colorLoadOp[index] = loadOp;
}
- void RenderPassCacheQuery::SetDepthStencil(nxt::TextureFormat format,
- nxt::LoadOp depthLoadOp,
- nxt::LoadOp stencilLoadOp) {
+ void RenderPassCacheQuery::SetDepthStencil(dawn::TextureFormat format,
+ dawn::LoadOp depthLoadOp,
+ dawn::LoadOp stencilLoadOp) {
hasDepthStencil = true;
depthStencilFormat = format;
this->depthLoadOp = depthLoadOp;
diff --git a/src/backend/vulkan/RenderPassCache.h b/src/backend/vulkan/RenderPassCache.h
index 436a20e..465a132 100644
--- a/src/backend/vulkan/RenderPassCache.h
+++ b/src/backend/vulkan/RenderPassCache.h
@@ -34,19 +34,19 @@
struct RenderPassCacheQuery {
// Use these helpers to build the query, they make sure all relevant data is initialized and
// masks set.
- void SetColor(uint32_t index, nxt::TextureFormat format, nxt::LoadOp loadOp);
- void SetDepthStencil(nxt::TextureFormat format,
- nxt::LoadOp depthLoadOp,
- nxt::LoadOp stencilLoadOp);
+ void SetColor(uint32_t index, dawn::TextureFormat format, dawn::LoadOp loadOp);
+ void SetDepthStencil(dawn::TextureFormat format,
+ dawn::LoadOp depthLoadOp,
+ dawn::LoadOp stencilLoadOp);
std::bitset<kMaxColorAttachments> colorMask;
- std::array<nxt::TextureFormat, kMaxColorAttachments> colorFormats;
- std::array<nxt::LoadOp, kMaxColorAttachments> colorLoadOp;
+ std::array<dawn::TextureFormat, kMaxColorAttachments> colorFormats;
+ std::array<dawn::LoadOp, kMaxColorAttachments> colorLoadOp;
bool hasDepthStencil = false;
- nxt::TextureFormat depthStencilFormat;
- nxt::LoadOp depthLoadOp;
- nxt::LoadOp stencilLoadOp;
+ dawn::TextureFormat depthStencilFormat;
+ dawn::LoadOp depthLoadOp;
+ dawn::LoadOp stencilLoadOp;
};
// Caches VkRenderPasses so that we don't create duplicate ones for every RenderPipeline or
diff --git a/src/backend/vulkan/RenderPipelineVk.cpp b/src/backend/vulkan/RenderPipelineVk.cpp
index 5d92553..b6b65a1 100644
--- a/src/backend/vulkan/RenderPipelineVk.cpp
+++ b/src/backend/vulkan/RenderPipelineVk.cpp
@@ -28,17 +28,17 @@
namespace {
- VkPrimitiveTopology VulkanPrimitiveTopology(nxt::PrimitiveTopology topology) {
+ VkPrimitiveTopology VulkanPrimitiveTopology(dawn::PrimitiveTopology topology) {
switch (topology) {
- case nxt::PrimitiveTopology::PointList:
+ case dawn::PrimitiveTopology::PointList:
return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
- case nxt::PrimitiveTopology::LineList:
+ case dawn::PrimitiveTopology::LineList:
return VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
- case nxt::PrimitiveTopology::LineStrip:
+ case dawn::PrimitiveTopology::LineStrip:
return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
- case nxt::PrimitiveTopology::TriangleList:
+ case dawn::PrimitiveTopology::TriangleList:
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
- case nxt::PrimitiveTopology::TriangleStrip:
+ case dawn::PrimitiveTopology::TriangleStrip:
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
default:
UNREACHABLE();
@@ -55,8 +55,8 @@
VkPipelineShaderStageCreateInfo shaderStages[2];
{
- const auto& vertexStageInfo = builder->GetStageInfo(nxt::ShaderStage::Vertex);
- const auto& fragmentStageInfo = builder->GetStageInfo(nxt::ShaderStage::Fragment);
+ const auto& vertexStageInfo = builder->GetStageInfo(dawn::ShaderStage::Vertex);
+ const auto& fragmentStageInfo = builder->GetStageInfo(dawn::ShaderStage::Fragment);
shaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
shaderStages[0].pNext = nullptr;
@@ -178,12 +178,12 @@
RenderPassCacheQuery query;
for (uint32_t i : IterateBitSet(GetColorAttachmentsMask())) {
- query.SetColor(i, GetColorAttachmentFormat(i), nxt::LoadOp::Load);
+ query.SetColor(i, GetColorAttachmentFormat(i), dawn::LoadOp::Load);
}
if (HasDepthStencilAttachment()) {
- query.SetDepthStencil(GetDepthStencilFormat(), nxt::LoadOp::Load,
- nxt::LoadOp::Load);
+ query.SetDepthStencil(GetDepthStencilFormat(), dawn::LoadOp::Load,
+ dawn::LoadOp::Load);
}
renderPass = mDevice->GetRenderPassCache()->GetRenderPass(query);
diff --git a/src/backend/vulkan/SamplerVk.cpp b/src/backend/vulkan/SamplerVk.cpp
index e96d870..6b1fecb 100644
--- a/src/backend/vulkan/SamplerVk.cpp
+++ b/src/backend/vulkan/SamplerVk.cpp
@@ -20,35 +20,35 @@
namespace backend { namespace vulkan {
namespace {
- VkSamplerAddressMode VulkanSamplerAddressMode(nxt::AddressMode mode) {
+ VkSamplerAddressMode VulkanSamplerAddressMode(dawn::AddressMode mode) {
switch (mode) {
- case nxt::AddressMode::Repeat:
+ case dawn::AddressMode::Repeat:
return VK_SAMPLER_ADDRESS_MODE_REPEAT;
- case nxt::AddressMode::MirroredRepeat:
+ case dawn::AddressMode::MirroredRepeat:
return VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT;
- case nxt::AddressMode::ClampToEdge:
+ case dawn::AddressMode::ClampToEdge:
return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
default:
UNREACHABLE();
}
}
- VkFilter VulkanSamplerFilter(nxt::FilterMode filter) {
+ VkFilter VulkanSamplerFilter(dawn::FilterMode filter) {
switch (filter) {
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
return VK_FILTER_LINEAR;
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
return VK_FILTER_NEAREST;
default:
UNREACHABLE();
}
}
- VkSamplerMipmapMode VulkanMipMapMode(nxt::FilterMode filter) {
+ VkSamplerMipmapMode VulkanMipMapMode(dawn::FilterMode filter) {
switch (filter) {
- case nxt::FilterMode::Linear:
+ case dawn::FilterMode::Linear:
return VK_SAMPLER_MIPMAP_MODE_LINEAR;
- case nxt::FilterMode::Nearest:
+ case dawn::FilterMode::Nearest:
return VK_SAMPLER_MIPMAP_MODE_NEAREST;
default:
UNREACHABLE();
@@ -56,7 +56,7 @@
}
} // anonymous namespace
- Sampler::Sampler(Device* device, const nxt::SamplerDescriptor* descriptor)
+ Sampler::Sampler(Device* device, const dawn::SamplerDescriptor* descriptor)
: SamplerBase(device, descriptor), mDevice(device) {
VkSamplerCreateInfo createInfo;
createInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
diff --git a/src/backend/vulkan/SamplerVk.h b/src/backend/vulkan/SamplerVk.h
index 335380a..c3999f0 100644
--- a/src/backend/vulkan/SamplerVk.h
+++ b/src/backend/vulkan/SamplerVk.h
@@ -24,7 +24,7 @@
class Sampler : public SamplerBase {
public:
- Sampler(Device* device, const nxt::SamplerDescriptor* descriptor);
+ Sampler(Device* device, const dawn::SamplerDescriptor* descriptor);
~Sampler();
VkSampler GetHandle() const;
diff --git a/src/backend/vulkan/SwapChainVk.cpp b/src/backend/vulkan/SwapChainVk.cpp
index 197fbf4..95cfd3e 100644
--- a/src/backend/vulkan/SwapChainVk.cpp
+++ b/src/backend/vulkan/SwapChainVk.cpp
@@ -25,7 +25,7 @@
im.Init(im.userData, &wsiContext);
ASSERT(im.textureUsage != NXT_TEXTURE_USAGE_BIT_NONE);
- mTextureUsage = static_cast<nxt::TextureUsageBit>(im.textureUsage);
+ mTextureUsage = static_cast<dawn::TextureUsageBit>(im.textureUsage);
}
SwapChain::~SwapChain() {
diff --git a/src/backend/vulkan/SwapChainVk.h b/src/backend/vulkan/SwapChainVk.h
index fc414e5..aca16c1 100644
--- a/src/backend/vulkan/SwapChainVk.h
+++ b/src/backend/vulkan/SwapChainVk.h
@@ -31,7 +31,7 @@
void OnBeforePresent(TextureBase* texture) override;
private:
- nxt::TextureUsageBit mTextureUsage;
+ dawn::TextureUsageBit mTextureUsage;
};
}} // namespace backend::vulkan
diff --git a/src/backend/vulkan/TextureVk.cpp b/src/backend/vulkan/TextureVk.cpp
index eb62b2b..ab270c0 100644
--- a/src/backend/vulkan/TextureVk.cpp
+++ b/src/backend/vulkan/TextureVk.cpp
@@ -23,9 +23,9 @@
// Converts an NXT 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(nxt::TextureDimension dimension) {
+ VkImageType VulkanImageType(dawn::TextureDimension dimension) {
switch (dimension) {
- case nxt::TextureDimension::e2D:
+ case dawn::TextureDimension::e2D:
return VK_IMAGE_TYPE_2D;
default:
UNREACHABLE();
@@ -34,9 +34,9 @@
// Converts an NXT texture dimension to a Vulkan image view type.
// Contrary to image types, image view types include arrayness and cubemapness
- VkImageViewType VulkanImageViewType(nxt::TextureDimension dimension) {
+ VkImageViewType VulkanImageViewType(dawn::TextureDimension dimension) {
switch (dimension) {
- case nxt::TextureDimension::e2D:
+ case dawn::TextureDimension::e2D:
return VK_IMAGE_VIEW_TYPE_2D;
default:
UNREACHABLE();
@@ -44,22 +44,22 @@
}
// Computes which vulkan access type could be required for the given NXT usage.
- VkAccessFlags VulkanAccessFlags(nxt::TextureUsageBit usage, nxt::TextureFormat format) {
+ VkAccessFlags VulkanAccessFlags(dawn::TextureUsageBit usage, dawn::TextureFormat format) {
VkAccessFlags flags = 0;
- if (usage & nxt::TextureUsageBit::TransferSrc) {
+ if (usage & dawn::TextureUsageBit::TransferSrc) {
flags |= VK_ACCESS_TRANSFER_READ_BIT;
}
- if (usage & nxt::TextureUsageBit::TransferDst) {
+ if (usage & dawn::TextureUsageBit::TransferDst) {
flags |= VK_ACCESS_TRANSFER_WRITE_BIT;
}
- if (usage & nxt::TextureUsageBit::Sampled) {
+ if (usage & dawn::TextureUsageBit::Sampled) {
flags |= VK_ACCESS_SHADER_READ_BIT;
}
- if (usage & nxt::TextureUsageBit::Storage) {
+ if (usage & dawn::TextureUsageBit::Storage) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
- if (usage & nxt::TextureUsageBit::OutputAttachment) {
+ if (usage & dawn::TextureUsageBit::OutputAttachment) {
if (TextureFormatHasDepthOrStencil(format)) {
flags |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
@@ -68,7 +68,7 @@
VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
}
}
- if (usage & nxt::TextureUsageBit::Present) {
+ if (usage & dawn::TextureUsageBit::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
@@ -81,38 +81,38 @@
}
// Chooses which Vulkan image layout should be used for the given NXT usage
- VkImageLayout VulkanImageLayout(nxt::TextureUsageBit usage, nxt::TextureFormat format) {
- if (usage == nxt::TextureUsageBit::None) {
+ VkImageLayout VulkanImageLayout(dawn::TextureUsageBit usage, dawn::TextureFormat format) {
+ if (usage == dawn::TextureUsageBit::None) {
return VK_IMAGE_LAYOUT_UNDEFINED;
}
- if (!nxt::HasZeroOrOneBits(usage)) {
+ if (!dawn::HasZeroOrOneBits(usage)) {
return VK_IMAGE_LAYOUT_GENERAL;
}
// Usage has a single bit so we can switch on its value directly.
switch (usage) {
- case nxt::TextureUsageBit::TransferDst:
+ case dawn::TextureUsageBit::TransferDst:
return VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
- case nxt::TextureUsageBit::Sampled:
+ case dawn::TextureUsageBit::Sampled:
return VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
// Vulkan texture copy functions require the image to be in _one_ known layout.
// Depending on whether parts of the texture have been transitioned to only
// TransferSrc or a combination with something else, the texture could be in a
// combination of GENERAL and TRANSFER_SRC_OPTIMAL. This would be a problem, so we
// make TransferSrc use GENERAL.
- case nxt::TextureUsageBit::TransferSrc:
+ case dawn::TextureUsageBit::TransferSrc:
// Writable storage textures must use general. If we could know the texture is read
// only we could use SHADER_READ_ONLY_OPTIMAL
- case nxt::TextureUsageBit::Storage:
+ case dawn::TextureUsageBit::Storage:
return VK_IMAGE_LAYOUT_GENERAL;
- case nxt::TextureUsageBit::OutputAttachment:
+ case dawn::TextureUsageBit::OutputAttachment:
if (TextureFormatHasDepthOrStencil(format)) {
return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
} else {
return VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
}
- case nxt::TextureUsageBit::Present:
+ case dawn::TextureUsageBit::Present:
return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR;
default:
UNREACHABLE();
@@ -120,24 +120,24 @@
}
// Computes which Vulkan pipeline stage can access a texture in the given NXT usage
- VkPipelineStageFlags VulkanPipelineStage(nxt::TextureUsageBit usage,
- nxt::TextureFormat format) {
+ VkPipelineStageFlags VulkanPipelineStage(dawn::TextureUsageBit usage,
+ dawn::TextureFormat format) {
VkPipelineStageFlags flags = 0;
- if (usage == nxt::TextureUsageBit::None) {
+ if (usage == dawn::TextureUsageBit::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 & (nxt::TextureUsageBit::TransferSrc | nxt::TextureUsageBit::TransferDst)) {
+ if (usage & (dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst)) {
flags |= VK_PIPELINE_STAGE_TRANSFER_BIT;
}
- if (usage & (nxt::TextureUsageBit::Sampled | nxt::TextureUsageBit::Storage)) {
+ if (usage & (dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::Storage)) {
flags |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT |
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
}
- if (usage & nxt::TextureUsageBit::OutputAttachment) {
+ if (usage & dawn::TextureUsageBit::OutputAttachment) {
if (TextureFormatHasDepthOrStencil(format)) {
flags |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
@@ -147,7 +147,7 @@
flags |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
}
}
- if (usage & nxt::TextureUsageBit::Present) {
+ if (usage & dawn::TextureUsageBit::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
@@ -163,7 +163,7 @@
}
// Computes which Vulkan texture aspects are relevant for the given NXT format
- VkImageAspectFlags VulkanAspectMask(nxt::TextureFormat format) {
+ VkImageAspectFlags VulkanAspectMask(dawn::TextureFormat format) {
bool isDepth = TextureFormatHasDepth(format);
bool isStencil = TextureFormatHasStencil(format);
@@ -184,23 +184,23 @@
} // namespace
// Converts NXT texture format to Vulkan formats.
- VkFormat VulkanImageFormat(nxt::TextureFormat format) {
+ VkFormat VulkanImageFormat(dawn::TextureFormat format) {
switch (format) {
- case nxt::TextureFormat::R8G8B8A8Unorm:
+ case dawn::TextureFormat::R8G8B8A8Unorm:
return VK_FORMAT_R8G8B8A8_UNORM;
- case nxt::TextureFormat::R8G8Unorm:
+ case dawn::TextureFormat::R8G8Unorm:
return VK_FORMAT_R8G8_UNORM;
- case nxt::TextureFormat::R8Unorm:
+ case dawn::TextureFormat::R8Unorm:
return VK_FORMAT_R8_UNORM;
- case nxt::TextureFormat::R8G8B8A8Uint:
+ case dawn::TextureFormat::R8G8B8A8Uint:
return VK_FORMAT_R8G8B8A8_UINT;
- case nxt::TextureFormat::R8G8Uint:
+ case dawn::TextureFormat::R8G8Uint:
return VK_FORMAT_R8G8_UINT;
- case nxt::TextureFormat::R8Uint:
+ case dawn::TextureFormat::R8Uint:
return VK_FORMAT_R8_UINT;
- case nxt::TextureFormat::B8G8R8A8Unorm:
+ case dawn::TextureFormat::B8G8R8A8Unorm:
return VK_FORMAT_B8G8R8A8_UNORM;
- case nxt::TextureFormat::D32FloatS8Uint:
+ case dawn::TextureFormat::D32FloatS8Uint:
return VK_FORMAT_D32_SFLOAT_S8_UINT;
default:
UNREACHABLE();
@@ -209,22 +209,22 @@
// Converts the NXT usage flags to Vulkan usage flags. Also needs the format to choose
// between color and depth attachment usages.
- VkImageUsageFlags VulkanImageUsage(nxt::TextureUsageBit usage, nxt::TextureFormat format) {
+ VkImageUsageFlags VulkanImageUsage(dawn::TextureUsageBit usage, dawn::TextureFormat format) {
VkImageUsageFlags flags = 0;
- if (usage & nxt::TextureUsageBit::TransferSrc) {
+ if (usage & dawn::TextureUsageBit::TransferSrc) {
flags |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
}
- if (usage & nxt::TextureUsageBit::TransferDst) {
+ if (usage & dawn::TextureUsageBit::TransferDst) {
flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
}
- if (usage & nxt::TextureUsageBit::Sampled) {
+ if (usage & dawn::TextureUsageBit::Sampled) {
flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
}
- if (usage & nxt::TextureUsageBit::Storage) {
+ if (usage & dawn::TextureUsageBit::Storage) {
flags |= VK_IMAGE_USAGE_STORAGE_BIT;
}
- if (usage & nxt::TextureUsageBit::OutputAttachment) {
+ if (usage & dawn::TextureUsageBit::OutputAttachment) {
if (TextureFormatHasDepthOrStencil(format)) {
flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
} else {
@@ -306,14 +306,14 @@
return VulkanAspectMask(GetFormat());
}
- void Texture::TransitionUsageNow(VkCommandBuffer commands, nxt::TextureUsageBit usage) {
+ void Texture::TransitionUsageNow(VkCommandBuffer commands, dawn::TextureUsageBit usage) {
// Avoid encoding barriers when it isn't needed.
bool lastReadOnly = (mLastUsage & kReadOnlyTextureUsages) == mLastUsage;
if (lastReadOnly && mLastUsage == usage) {
return;
}
- nxt::TextureFormat format = GetFormat();
+ dawn::TextureFormat format = GetFormat();
VkPipelineStageFlags srcStages = VulkanPipelineStage(mLastUsage, format);
VkPipelineStageFlags dstStages = VulkanPipelineStage(usage, format);
@@ -329,7 +329,7 @@
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
barrier.image = mHandle;
// This transitions the whole resource but assumes it is a 2D texture
- ASSERT(GetDimension() == nxt::TextureDimension::e2D);
+ ASSERT(GetDimension() == dawn::TextureDimension::e2D);
barrier.subresourceRange.aspectMask = VulkanAspectMask(format);
barrier.subresourceRange.baseMipLevel = 0;
barrier.subresourceRange.levelCount = GetNumMipLevels();
diff --git a/src/backend/vulkan/TextureVk.h b/src/backend/vulkan/TextureVk.h
index e50d8d4..96c51d7 100644
--- a/src/backend/vulkan/TextureVk.h
+++ b/src/backend/vulkan/TextureVk.h
@@ -22,8 +22,8 @@
namespace backend { namespace vulkan {
- VkFormat VulkanImageFormat(nxt::TextureFormat format);
- VkImageUsageFlags VulkanImageUsage(nxt::TextureUsageBit usage, nxt::TextureFormat format);
+ VkFormat VulkanImageFormat(dawn::TextureFormat format);
+ VkImageUsageFlags VulkanImageUsage(dawn::TextureUsageBit usage, dawn::TextureFormat format);
class Texture : public TextureBase {
public:
@@ -37,7 +37,7 @@
// Transitions the texture 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(VkCommandBuffer commands, nxt::TextureUsageBit usage);
+ void TransitionUsageNow(VkCommandBuffer commands, dawn::TextureUsageBit usage);
private:
VkImage mHandle = VK_NULL_HANDLE;
@@ -45,7 +45,7 @@
// A usage of none will make sure the texture is transitioned before its first use as
// required by the spec.
- nxt::TextureUsageBit mLastUsage = nxt::TextureUsageBit::None;
+ dawn::TextureUsageBit mLastUsage = dawn::TextureUsageBit::None;
};
class TextureView : public TextureViewBase {