Add Tag for Unimplemented Labels to ObjectBase Constructor
Adds the LabelNotImplemented tag param to the main constructor of
ObjectBase to document objects that still require labels.
Bug: dawn:840
Change-Id: Idd19664e797e4d622401e28e5d278331acefb7a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/62461
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones (Intel) <brandon1.jones@intel.com>
diff --git a/src/dawn_native/AttachmentState.cpp b/src/dawn_native/AttachmentState.cpp
index 5878b44..0aed5fa 100644
--- a/src/dawn_native/AttachmentState.cpp
+++ b/src/dawn_native/AttachmentState.cpp
@@ -130,7 +130,7 @@
}
AttachmentState::AttachmentState(DeviceBase* device, const AttachmentStateBlueprint& blueprint)
- : AttachmentStateBlueprint(blueprint), CachedObject(device) {
+ : AttachmentStateBlueprint(blueprint), CachedObject(device, kLabelNotImplemented) {
}
AttachmentState::~AttachmentState() {
diff --git a/src/dawn_native/BindGroup.cpp b/src/dawn_native/BindGroup.cpp
index d32ddd1..f1efa20 100644
--- a/src/dawn_native/BindGroup.cpp
+++ b/src/dawn_native/BindGroup.cpp
@@ -309,7 +309,7 @@
BindGroupBase::BindGroupBase(DeviceBase* device,
const BindGroupDescriptor* descriptor,
void* bindingDataStart)
- : ObjectBase(device),
+ : ObjectBase(device, kLabelNotImplemented),
mLayout(descriptor->layout),
mBindingData(mLayout->ComputeBindingDataPointers(bindingDataStart)) {
for (BindingIndex i{0}; i < mLayout->GetBindingCount(); ++i) {
diff --git a/src/dawn_native/BindGroupLayout.cpp b/src/dawn_native/BindGroupLayout.cpp
index 1fc4a40..cd6a7aa 100644
--- a/src/dawn_native/BindGroupLayout.cpp
+++ b/src/dawn_native/BindGroupLayout.cpp
@@ -363,7 +363,8 @@
BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device,
const BindGroupLayoutDescriptor* descriptor)
- : CachedObject(device), mBindingInfo(BindingIndex(descriptor->entryCount)) {
+ : CachedObject(device, kLabelNotImplemented),
+ mBindingInfo(BindingIndex(descriptor->entryCount)) {
std::vector<BindGroupLayoutEntry> sortedBindings(
descriptor->entries, descriptor->entries + descriptor->entryCount);
diff --git a/src/dawn_native/CommandBuffer.cpp b/src/dawn_native/CommandBuffer.cpp
index b6ba4f0..748cc31 100644
--- a/src/dawn_native/CommandBuffer.cpp
+++ b/src/dawn_native/CommandBuffer.cpp
@@ -25,7 +25,7 @@
namespace dawn_native {
CommandBufferBase::CommandBufferBase(CommandEncoder* encoder, const CommandBufferDescriptor*)
- : ObjectBase(encoder->GetDevice()),
+ : ObjectBase(encoder->GetDevice(), kLabelNotImplemented),
mCommands(encoder->AcquireCommands()),
mResourceUsages(encoder->AcquireResourceUsages()) {
}
diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp
index 431c7c2..3fc0aef 100644
--- a/src/dawn_native/CommandEncoder.cpp
+++ b/src/dawn_native/CommandEncoder.cpp
@@ -492,7 +492,7 @@
} // namespace
CommandEncoder::CommandEncoder(DeviceBase* device, const CommandEncoderDescriptor*)
- : ObjectBase(device), mEncodingContext(device, this) {
+ : ObjectBase(device, kLabelNotImplemented), mEncodingContext(device, this) {
}
CommandBufferResourceUsage CommandEncoder::AcquireResourceUsages() {
diff --git a/src/dawn_native/ExternalTexture.cpp b/src/dawn_native/ExternalTexture.cpp
index 1ff5330..5923ef0 100644
--- a/src/dawn_native/ExternalTexture.cpp
+++ b/src/dawn_native/ExternalTexture.cpp
@@ -86,7 +86,7 @@
ExternalTextureBase::ExternalTextureBase(DeviceBase* device,
const ExternalTextureDescriptor* descriptor)
- : ObjectBase(device), mState(ExternalTextureState::Alive) {
+ : ObjectBase(device, kLabelNotImplemented), mState(ExternalTextureState::Alive) {
textureViews[0] = descriptor->plane0;
}
diff --git a/src/dawn_native/ObjectBase.cpp b/src/dawn_native/ObjectBase.cpp
index 05ba33e..f711723 100644
--- a/src/dawn_native/ObjectBase.cpp
+++ b/src/dawn_native/ObjectBase.cpp
@@ -19,10 +19,8 @@
static constexpr uint64_t kErrorPayload = 0;
static constexpr uint64_t kNotErrorPayload = 1;
- ObjectBase::ObjectBase(DeviceBase* device) : RefCounted(kNotErrorPayload), mDevice(device) {
- }
-
- ObjectBase::ObjectBase(DeviceBase* device, const char* label) : ObjectBase(device) {
+ ObjectBase::ObjectBase(DeviceBase* device, const char* label)
+ : RefCounted(kNotErrorPayload), mDevice(device) {
if (label) {
mLabel = label;
}
@@ -31,6 +29,9 @@
ObjectBase::ObjectBase(DeviceBase* device, ErrorTag)
: RefCounted(kErrorPayload), mDevice(device) {
}
+ ObjectBase::ObjectBase(DeviceBase* device, LabelNotImplementedTag)
+ : RefCounted(kNotErrorPayload), mDevice(device) {
+ }
const std::string& ObjectBase::GetLabel() {
return mLabel;
diff --git a/src/dawn_native/ObjectBase.h b/src/dawn_native/ObjectBase.h
index 41a4dcf..51da201 100644
--- a/src/dawn_native/ObjectBase.h
+++ b/src/dawn_native/ObjectBase.h
@@ -27,8 +27,10 @@
public:
struct ErrorTag {};
static constexpr ErrorTag kError = {};
+ struct LabelNotImplementedTag {};
+ static constexpr LabelNotImplementedTag kLabelNotImplemented = {};
- ObjectBase(DeviceBase* device);
+ ObjectBase(DeviceBase* device, LabelNotImplementedTag tag);
ObjectBase(DeviceBase* device, const char* label);
ObjectBase(DeviceBase* device, ErrorTag tag);
diff --git a/src/dawn_native/Pipeline.cpp b/src/dawn_native/Pipeline.cpp
index c650afa..d1aa665 100644
--- a/src/dawn_native/Pipeline.cpp
+++ b/src/dawn_native/Pipeline.cpp
@@ -51,7 +51,7 @@
PipelineBase::PipelineBase(DeviceBase* device,
PipelineLayoutBase* layout,
std::vector<StageAndDescriptor> stages)
- : CachedObject(device), mLayout(layout) {
+ : CachedObject(device, kLabelNotImplemented), mLayout(layout) {
ASSERT(!stages.empty());
for (const StageAndDescriptor& stage : stages) {
diff --git a/src/dawn_native/PipelineLayout.cpp b/src/dawn_native/PipelineLayout.cpp
index ef163a5..e99ad22 100644
--- a/src/dawn_native/PipelineLayout.cpp
+++ b/src/dawn_native/PipelineLayout.cpp
@@ -49,7 +49,7 @@
PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device,
const PipelineLayoutDescriptor* descriptor)
- : CachedObject(device) {
+ : CachedObject(device, kLabelNotImplemented) {
ASSERT(descriptor->bindGroupLayoutCount <= kMaxBindGroups);
for (BindGroupIndex group(0); group < BindGroupIndex(descriptor->bindGroupLayoutCount);
++group) {
diff --git a/src/dawn_native/ProgrammablePassEncoder.cpp b/src/dawn_native/ProgrammablePassEncoder.cpp
index 47d0953..8384620 100644
--- a/src/dawn_native/ProgrammablePassEncoder.cpp
+++ b/src/dawn_native/ProgrammablePassEncoder.cpp
@@ -29,7 +29,7 @@
ProgrammablePassEncoder::ProgrammablePassEncoder(DeviceBase* device,
EncodingContext* encodingContext)
- : ObjectBase(device),
+ : ObjectBase(device, kLabelNotImplemented),
mEncodingContext(encodingContext),
mValidationEnabled(device->IsValidationEnabled()) {
}
diff --git a/src/dawn_native/QuerySet.cpp b/src/dawn_native/QuerySet.cpp
index 598bac2..84f5da2 100644
--- a/src/dawn_native/QuerySet.cpp
+++ b/src/dawn_native/QuerySet.cpp
@@ -114,7 +114,7 @@
}
QuerySetBase::QuerySetBase(DeviceBase* device, const QuerySetDescriptor* descriptor)
- : ObjectBase(device),
+ : ObjectBase(device, kLabelNotImplemented),
mQueryType(descriptor->type),
mQueryCount(descriptor->count),
mState(QuerySetState::Available) {
diff --git a/src/dawn_native/Queue.cpp b/src/dawn_native/Queue.cpp
index 9aac22b..5c5aa350 100644
--- a/src/dawn_native/Queue.cpp
+++ b/src/dawn_native/Queue.cpp
@@ -161,7 +161,7 @@
QueueBase::TaskInFlight::~TaskInFlight() {
}
- QueueBase::QueueBase(DeviceBase* device) : ObjectBase(device) {
+ QueueBase::QueueBase(DeviceBase* device) : ObjectBase(device, kLabelNotImplemented) {
}
QueueBase::QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag) : ObjectBase(device, tag) {
diff --git a/src/dawn_native/RenderBundle.cpp b/src/dawn_native/RenderBundle.cpp
index f4e0a8c..028dde7 100644
--- a/src/dawn_native/RenderBundle.cpp
+++ b/src/dawn_native/RenderBundle.cpp
@@ -25,7 +25,7 @@
const RenderBundleDescriptor* descriptor,
Ref<AttachmentState> attachmentState,
RenderPassResourceUsage resourceUsage)
- : ObjectBase(encoder->GetDevice()),
+ : ObjectBase(encoder->GetDevice(), kLabelNotImplemented),
mCommands(encoder->AcquireCommands()),
mAttachmentState(std::move(attachmentState)),
mResourceUsage(std::move(resourceUsage)) {
diff --git a/src/dawn_native/Sampler.cpp b/src/dawn_native/Sampler.cpp
index 1637b16..935d57f 100644
--- a/src/dawn_native/Sampler.cpp
+++ b/src/dawn_native/Sampler.cpp
@@ -72,7 +72,7 @@
// SamplerBase
SamplerBase::SamplerBase(DeviceBase* device, const SamplerDescriptor* descriptor)
- : CachedObject(device),
+ : CachedObject(device, kLabelNotImplemented),
mAddressModeU(descriptor->addressModeU),
mAddressModeV(descriptor->addressModeV),
mAddressModeW(descriptor->addressModeW),
diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp
index c7a9ba1..4d9f173 100644
--- a/src/dawn_native/ShaderModule.cpp
+++ b/src/dawn_native/ShaderModule.cpp
@@ -1124,7 +1124,7 @@
// ShaderModuleBase
ShaderModuleBase::ShaderModuleBase(DeviceBase* device, const ShaderModuleDescriptor* descriptor)
- : CachedObject(device), mType(Type::Undefined) {
+ : CachedObject(device, kLabelNotImplemented), mType(Type::Undefined) {
ASSERT(descriptor->nextInChain != nullptr);
const ShaderModuleSPIRVDescriptor* spirvDesc = nullptr;
FindInChain(descriptor->nextInChain, &spirvDesc);
diff --git a/src/dawn_native/SwapChain.cpp b/src/dawn_native/SwapChain.cpp
index b81d906..46d8a69 100644
--- a/src/dawn_native/SwapChain.cpp
+++ b/src/dawn_native/SwapChain.cpp
@@ -112,7 +112,7 @@
// SwapChainBase
- SwapChainBase::SwapChainBase(DeviceBase* device) : ObjectBase(device) {
+ SwapChainBase::SwapChainBase(DeviceBase* device) : ObjectBase(device, kLabelNotImplemented) {
}
SwapChainBase::SwapChainBase(DeviceBase* device, ObjectBase::ErrorTag tag)
diff --git a/src/dawn_native/Texture.cpp b/src/dawn_native/Texture.cpp
index 1b9a708..889d706 100644
--- a/src/dawn_native/Texture.cpp
+++ b/src/dawn_native/Texture.cpp
@@ -678,7 +678,7 @@
// TextureViewBase
TextureViewBase::TextureViewBase(TextureBase* texture, const TextureViewDescriptor* descriptor)
- : ObjectBase(texture->GetDevice()),
+ : ObjectBase(texture->GetDevice(), kLabelNotImplemented),
mTexture(texture),
mFormat(GetDevice()->GetValidInternalFormat(descriptor->format)),
mDimension(descriptor->dimension),