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>
This commit is contained in:
Brandon Jones 2021-08-23 23:14:36 +00:00 committed by Dawn LUCI CQ
parent 63b2fb9500
commit 5ae66fbcc7
18 changed files with 25 additions and 21 deletions

View File

@ -130,7 +130,7 @@ namespace dawn_native {
}
AttachmentState::AttachmentState(DeviceBase* device, const AttachmentStateBlueprint& blueprint)
: AttachmentStateBlueprint(blueprint), CachedObject(device) {
: AttachmentStateBlueprint(blueprint), CachedObject(device, kLabelNotImplemented) {
}
AttachmentState::~AttachmentState() {

View File

@ -309,7 +309,7 @@ namespace dawn_native {
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) {

View File

@ -363,7 +363,8 @@ namespace dawn_native {
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);

View File

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

View File

@ -492,7 +492,7 @@ namespace dawn_native {
} // namespace
CommandEncoder::CommandEncoder(DeviceBase* device, const CommandEncoderDescriptor*)
: ObjectBase(device), mEncodingContext(device, this) {
: ObjectBase(device, kLabelNotImplemented), mEncodingContext(device, this) {
}
CommandBufferResourceUsage CommandEncoder::AcquireResourceUsages() {

View File

@ -86,7 +86,7 @@ namespace dawn_native {
ExternalTextureBase::ExternalTextureBase(DeviceBase* device,
const ExternalTextureDescriptor* descriptor)
: ObjectBase(device), mState(ExternalTextureState::Alive) {
: ObjectBase(device, kLabelNotImplemented), mState(ExternalTextureState::Alive) {
textureViews[0] = descriptor->plane0;
}

View File

@ -19,10 +19,8 @@ namespace dawn_native {
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 @@ namespace dawn_native {
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;

View File

@ -27,8 +27,10 @@ namespace dawn_native {
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);

View File

@ -51,7 +51,7 @@ namespace dawn_native {
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) {

View File

@ -49,7 +49,7 @@ namespace dawn_native {
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) {

View File

@ -29,7 +29,7 @@ namespace dawn_native {
ProgrammablePassEncoder::ProgrammablePassEncoder(DeviceBase* device,
EncodingContext* encodingContext)
: ObjectBase(device),
: ObjectBase(device, kLabelNotImplemented),
mEncodingContext(encodingContext),
mValidationEnabled(device->IsValidationEnabled()) {
}

View File

@ -114,7 +114,7 @@ namespace dawn_native {
}
QuerySetBase::QuerySetBase(DeviceBase* device, const QuerySetDescriptor* descriptor)
: ObjectBase(device),
: ObjectBase(device, kLabelNotImplemented),
mQueryType(descriptor->type),
mQueryCount(descriptor->count),
mState(QuerySetState::Available) {

View File

@ -161,7 +161,7 @@ namespace dawn_native {
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) {

View File

@ -25,7 +25,7 @@ namespace dawn_native {
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)) {

View File

@ -72,7 +72,7 @@ namespace dawn_native {
// SamplerBase
SamplerBase::SamplerBase(DeviceBase* device, const SamplerDescriptor* descriptor)
: CachedObject(device),
: CachedObject(device, kLabelNotImplemented),
mAddressModeU(descriptor->addressModeU),
mAddressModeV(descriptor->addressModeV),
mAddressModeW(descriptor->addressModeW),

View File

@ -1124,7 +1124,7 @@ namespace dawn_native {
// 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);

View File

@ -112,7 +112,7 @@ namespace dawn_native {
// SwapChainBase
SwapChainBase::SwapChainBase(DeviceBase* device) : ObjectBase(device) {
SwapChainBase::SwapChainBase(DeviceBase* device) : ObjectBase(device, kLabelNotImplemented) {
}
SwapChainBase::SwapChainBase(DeviceBase* device, ObjectBase::ErrorTag tag)

View File

@ -678,7 +678,7 @@ namespace dawn_native {
// 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),