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) AttachmentState::AttachmentState(DeviceBase* device, const AttachmentStateBlueprint& blueprint)
: AttachmentStateBlueprint(blueprint), CachedObject(device) { : AttachmentStateBlueprint(blueprint), CachedObject(device, kLabelNotImplemented) {
} }
AttachmentState::~AttachmentState() { AttachmentState::~AttachmentState() {

View File

@ -309,7 +309,7 @@ namespace dawn_native {
BindGroupBase::BindGroupBase(DeviceBase* device, BindGroupBase::BindGroupBase(DeviceBase* device,
const BindGroupDescriptor* descriptor, const BindGroupDescriptor* descriptor,
void* bindingDataStart) void* bindingDataStart)
: ObjectBase(device), : ObjectBase(device, kLabelNotImplemented),
mLayout(descriptor->layout), mLayout(descriptor->layout),
mBindingData(mLayout->ComputeBindingDataPointers(bindingDataStart)) { mBindingData(mLayout->ComputeBindingDataPointers(bindingDataStart)) {
for (BindingIndex i{0}; i < mLayout->GetBindingCount(); ++i) { for (BindingIndex i{0}; i < mLayout->GetBindingCount(); ++i) {

View File

@ -363,7 +363,8 @@ namespace dawn_native {
BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device, BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device,
const BindGroupLayoutDescriptor* descriptor) const BindGroupLayoutDescriptor* descriptor)
: CachedObject(device), mBindingInfo(BindingIndex(descriptor->entryCount)) { : CachedObject(device, kLabelNotImplemented),
mBindingInfo(BindingIndex(descriptor->entryCount)) {
std::vector<BindGroupLayoutEntry> sortedBindings( std::vector<BindGroupLayoutEntry> sortedBindings(
descriptor->entries, descriptor->entries + descriptor->entryCount); descriptor->entries, descriptor->entries + descriptor->entryCount);

View File

@ -25,7 +25,7 @@
namespace dawn_native { namespace dawn_native {
CommandBufferBase::CommandBufferBase(CommandEncoder* encoder, const CommandBufferDescriptor*) CommandBufferBase::CommandBufferBase(CommandEncoder* encoder, const CommandBufferDescriptor*)
: ObjectBase(encoder->GetDevice()), : ObjectBase(encoder->GetDevice(), kLabelNotImplemented),
mCommands(encoder->AcquireCommands()), mCommands(encoder->AcquireCommands()),
mResourceUsages(encoder->AcquireResourceUsages()) { mResourceUsages(encoder->AcquireResourceUsages()) {
} }

View File

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

View File

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

View File

@ -19,10 +19,8 @@ namespace dawn_native {
static constexpr uint64_t kErrorPayload = 0; static constexpr uint64_t kErrorPayload = 0;
static constexpr uint64_t kNotErrorPayload = 1; static constexpr uint64_t kNotErrorPayload = 1;
ObjectBase::ObjectBase(DeviceBase* device) : RefCounted(kNotErrorPayload), mDevice(device) { ObjectBase::ObjectBase(DeviceBase* device, const char* label)
} : RefCounted(kNotErrorPayload), mDevice(device) {
ObjectBase::ObjectBase(DeviceBase* device, const char* label) : ObjectBase(device) {
if (label) { if (label) {
mLabel = label; mLabel = label;
} }
@ -31,6 +29,9 @@ namespace dawn_native {
ObjectBase::ObjectBase(DeviceBase* device, ErrorTag) ObjectBase::ObjectBase(DeviceBase* device, ErrorTag)
: RefCounted(kErrorPayload), mDevice(device) { : RefCounted(kErrorPayload), mDevice(device) {
} }
ObjectBase::ObjectBase(DeviceBase* device, LabelNotImplementedTag)
: RefCounted(kNotErrorPayload), mDevice(device) {
}
const std::string& ObjectBase::GetLabel() { const std::string& ObjectBase::GetLabel() {
return mLabel; return mLabel;

View File

@ -27,8 +27,10 @@ namespace dawn_native {
public: public:
struct ErrorTag {}; struct ErrorTag {};
static constexpr ErrorTag kError = {}; 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, const char* label);
ObjectBase(DeviceBase* device, ErrorTag tag); ObjectBase(DeviceBase* device, ErrorTag tag);

View File

@ -51,7 +51,7 @@ namespace dawn_native {
PipelineBase::PipelineBase(DeviceBase* device, PipelineBase::PipelineBase(DeviceBase* device,
PipelineLayoutBase* layout, PipelineLayoutBase* layout,
std::vector<StageAndDescriptor> stages) std::vector<StageAndDescriptor> stages)
: CachedObject(device), mLayout(layout) { : CachedObject(device, kLabelNotImplemented), mLayout(layout) {
ASSERT(!stages.empty()); ASSERT(!stages.empty());
for (const StageAndDescriptor& stage : stages) { for (const StageAndDescriptor& stage : stages) {

View File

@ -49,7 +49,7 @@ namespace dawn_native {
PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device, PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device,
const PipelineLayoutDescriptor* descriptor) const PipelineLayoutDescriptor* descriptor)
: CachedObject(device) { : CachedObject(device, kLabelNotImplemented) {
ASSERT(descriptor->bindGroupLayoutCount <= kMaxBindGroups); ASSERT(descriptor->bindGroupLayoutCount <= kMaxBindGroups);
for (BindGroupIndex group(0); group < BindGroupIndex(descriptor->bindGroupLayoutCount); for (BindGroupIndex group(0); group < BindGroupIndex(descriptor->bindGroupLayoutCount);
++group) { ++group) {

View File

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

View File

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

View File

@ -161,7 +161,7 @@ namespace dawn_native {
QueueBase::TaskInFlight::~TaskInFlight() { 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) { QueueBase::QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag) : ObjectBase(device, tag) {

View File

@ -25,7 +25,7 @@ namespace dawn_native {
const RenderBundleDescriptor* descriptor, const RenderBundleDescriptor* descriptor,
Ref<AttachmentState> attachmentState, Ref<AttachmentState> attachmentState,
RenderPassResourceUsage resourceUsage) RenderPassResourceUsage resourceUsage)
: ObjectBase(encoder->GetDevice()), : ObjectBase(encoder->GetDevice(), kLabelNotImplemented),
mCommands(encoder->AcquireCommands()), mCommands(encoder->AcquireCommands()),
mAttachmentState(std::move(attachmentState)), mAttachmentState(std::move(attachmentState)),
mResourceUsage(std::move(resourceUsage)) { mResourceUsage(std::move(resourceUsage)) {

View File

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

View File

@ -1124,7 +1124,7 @@ namespace dawn_native {
// ShaderModuleBase // ShaderModuleBase
ShaderModuleBase::ShaderModuleBase(DeviceBase* device, const ShaderModuleDescriptor* descriptor) ShaderModuleBase::ShaderModuleBase(DeviceBase* device, const ShaderModuleDescriptor* descriptor)
: CachedObject(device), mType(Type::Undefined) { : CachedObject(device, kLabelNotImplemented), mType(Type::Undefined) {
ASSERT(descriptor->nextInChain != nullptr); ASSERT(descriptor->nextInChain != nullptr);
const ShaderModuleSPIRVDescriptor* spirvDesc = nullptr; const ShaderModuleSPIRVDescriptor* spirvDesc = nullptr;
FindInChain(descriptor->nextInChain, &spirvDesc); FindInChain(descriptor->nextInChain, &spirvDesc);

View File

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

View File

@ -678,7 +678,7 @@ namespace dawn_native {
// TextureViewBase // TextureViewBase
TextureViewBase::TextureViewBase(TextureBase* texture, const TextureViewDescriptor* descriptor) TextureViewBase::TextureViewBase(TextureBase* texture, const TextureViewDescriptor* descriptor)
: ObjectBase(texture->GetDevice()), : ObjectBase(texture->GetDevice(), kLabelNotImplemented),
mTexture(texture), mTexture(texture),
mFormat(GetDevice()->GetValidInternalFormat(descriptor->format)), mFormat(GetDevice()->GetValidInternalFormat(descriptor->format)),
mDimension(descriptor->dimension), mDimension(descriptor->dimension),