Retain descriptor labels for error objects

Since these objects are more likely to be included in error messages
it's important that we keep the labels that the developer has given
them.

Bug: dawn:1771
Change-Id: I78f4ccc23ce40d8eeceed8ca7dd563dff949b4fb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128420
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
Brandon Jones 2023-04-20 23:35:14 +00:00 committed by Dawn LUCI CQ
parent 8cc6205bf7
commit 6cb055b6aa
43 changed files with 171 additions and 129 deletions

View File

@ -475,12 +475,12 @@ void BindGroupBase::DeleteThis() {
ApiObjectBase::DeleteThis(); ApiObjectBase::DeleteThis();
} }
BindGroupBase::BindGroupBase(DeviceBase* device, ObjectBase::ErrorTag tag) BindGroupBase::BindGroupBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
: ApiObjectBase(device, tag), mBindingData() {} : ApiObjectBase(device, tag, label), mBindingData() {}
// static // static
BindGroupBase* BindGroupBase::MakeError(DeviceBase* device) { BindGroupBase* BindGroupBase::MakeError(DeviceBase* device, const char* label) {
return new BindGroupBase(device, ObjectBase::kError); return new BindGroupBase(device, ObjectBase::kError, label);
} }
ObjectType BindGroupBase::GetType() const { ObjectType BindGroupBase::GetType() const {

View File

@ -44,7 +44,7 @@ struct BufferBinding {
class BindGroupBase : public ApiObjectBase { class BindGroupBase : public ApiObjectBase {
public: public:
static BindGroupBase* MakeError(DeviceBase* device); static BindGroupBase* MakeError(DeviceBase* device, const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -81,7 +81,7 @@ class BindGroupBase : public ApiObjectBase {
~BindGroupBase() override; ~BindGroupBase() override;
private: private:
BindGroupBase(DeviceBase* device, ObjectBase::ErrorTag tag); BindGroupBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
void DeleteThis() override; void DeleteThis() override;
Ref<BindGroupLayoutBase> mLayout; Ref<BindGroupLayoutBase> mLayout;

View File

@ -491,8 +491,10 @@ BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device,
GetObjectTrackingList()->Track(this); GetObjectTrackingList()->Track(this);
} }
BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag) BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device,
: ApiObjectBase(device, tag) {} ObjectBase::ErrorTag tag,
const char* label)
: ApiObjectBase(device, tag, label) {}
BindGroupLayoutBase::~BindGroupLayoutBase() = default; BindGroupLayoutBase::~BindGroupLayoutBase() = default;
@ -504,8 +506,8 @@ void BindGroupLayoutBase::DestroyImpl() {
} }
// static // static
BindGroupLayoutBase* BindGroupLayoutBase::MakeError(DeviceBase* device) { BindGroupLayoutBase* BindGroupLayoutBase::MakeError(DeviceBase* device, const char* label) {
return new BindGroupLayoutBase(device, ObjectBase::kError); return new BindGroupLayoutBase(device, ObjectBase::kError, label);
} }
ObjectType BindGroupLayoutBase::GetType() const { ObjectType BindGroupLayoutBase::GetType() const {

View File

@ -61,7 +61,7 @@ class BindGroupLayoutBase : public ApiObjectBase, public CachedObject {
PipelineCompatibilityToken pipelineCompatibilityToken); PipelineCompatibilityToken pipelineCompatibilityToken);
~BindGroupLayoutBase() override; ~BindGroupLayoutBase() override;
static BindGroupLayoutBase* MakeError(DeviceBase* device); static BindGroupLayoutBase* MakeError(DeviceBase* device, const char* label = nullptr);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -147,7 +147,7 @@ class BindGroupLayoutBase : public ApiObjectBase, public CachedObject {
} }
private: private:
BindGroupLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag); BindGroupLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
BindingCounts mBindingCounts = {}; BindingCounts mBindingCounts = {};
ityp::vector<BindingIndex, BindingInfo> mBindingInfo; ityp::vector<BindingIndex, BindingInfo> mBindingInfo;

View File

@ -177,7 +177,7 @@ BufferBase::BufferBase(DeviceBase* device, const BufferDescriptor* descriptor)
BufferBase::BufferBase(DeviceBase* device, BufferBase::BufferBase(DeviceBase* device,
const BufferDescriptor* descriptor, const BufferDescriptor* descriptor,
ObjectBase::ErrorTag tag) ObjectBase::ErrorTag tag)
: ApiObjectBase(device, tag), : ApiObjectBase(device, tag, descriptor->label),
mSize(descriptor->size), mSize(descriptor->size),
mUsage(descriptor->usage), mUsage(descriptor->usage),
mState(BufferState::Unmapped) { mState(BufferState::Unmapped) {

View File

@ -33,12 +33,14 @@ CommandBufferBase::CommandBufferBase(CommandEncoder* encoder,
GetObjectTrackingList()->Track(this); GetObjectTrackingList()->Track(this);
} }
CommandBufferBase::CommandBufferBase(DeviceBase* device, ObjectBase::ErrorTag tag) CommandBufferBase::CommandBufferBase(DeviceBase* device,
: ApiObjectBase(device, tag) {} ObjectBase::ErrorTag tag,
const char* label)
: ApiObjectBase(device, tag, label) {}
// static // static
CommandBufferBase* CommandBufferBase::MakeError(DeviceBase* device) { CommandBufferBase* CommandBufferBase::MakeError(DeviceBase* device, const char* label) {
return new CommandBufferBase(device, ObjectBase::kError); return new CommandBufferBase(device, ObjectBase::kError, label);
} }
ObjectType CommandBufferBase::GetType() const { ObjectType CommandBufferBase::GetType() const {

View File

@ -34,7 +34,7 @@ class CommandBufferBase : public ApiObjectBase {
public: public:
CommandBufferBase(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor); CommandBufferBase(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor);
static CommandBufferBase* MakeError(DeviceBase* device); static CommandBufferBase* MakeError(DeviceBase* device, const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -50,7 +50,7 @@ class CommandBufferBase : public ApiObjectBase {
CommandIterator mCommands; CommandIterator mCommands;
private: private:
CommandBufferBase(DeviceBase* device, ObjectBase::ErrorTag tag); CommandBufferBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
CommandBufferResourceUsage mResourceUsages; CommandBufferResourceUsage mResourceUsages;
}; };

View File

@ -710,8 +710,8 @@ Ref<CommandEncoder> CommandEncoder::Create(DeviceBase* device,
} }
// static // static
CommandEncoder* CommandEncoder::MakeError(DeviceBase* device) { CommandEncoder* CommandEncoder::MakeError(DeviceBase* device, const char* label) {
return new CommandEncoder(device, ObjectBase::kError); return new CommandEncoder(device, ObjectBase::kError, label);
} }
CommandEncoder::CommandEncoder(DeviceBase* device, const CommandEncoderDescriptor* descriptor) CommandEncoder::CommandEncoder(DeviceBase* device, const CommandEncoderDescriptor* descriptor)
@ -728,8 +728,8 @@ CommandEncoder::CommandEncoder(DeviceBase* device, const CommandEncoderDescripto
} }
} }
CommandEncoder::CommandEncoder(DeviceBase* device, ObjectBase::ErrorTag tag) CommandEncoder::CommandEncoder(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
: ApiObjectBase(device, tag), : ApiObjectBase(device, tag, label),
mEncodingContext(device, this), mEncodingContext(device, this),
mUsageValidationMode(UsageValidationMode::Default) { mUsageValidationMode(UsageValidationMode::Default) {
mEncodingContext.HandleError(DAWN_VALIDATION_ERROR("%s is invalid.", this)); mEncodingContext.HandleError(DAWN_VALIDATION_ERROR("%s is invalid.", this));
@ -830,7 +830,8 @@ Ref<ComputePassEncoder> CommandEncoder::BeginComputePass(const ComputePassDescri
return passEncoder; return passEncoder;
} }
return ComputePassEncoder::MakeError(device, this, &mEncodingContext); return ComputePassEncoder::MakeError(device, this, &mEncodingContext,
descriptor ? descriptor->label : nullptr);
} }
RenderPassEncoder* CommandEncoder::APIBeginRenderPass(const RenderPassDescriptor* descriptor) { RenderPassEncoder* CommandEncoder::APIBeginRenderPass(const RenderPassDescriptor* descriptor) {
@ -1011,14 +1012,16 @@ Ref<RenderPassEncoder> CommandEncoder::BeginRenderPass(const RenderPassDescripto
MaybeError error = MaybeError error =
ApplyClearBigIntegerColorValueWithDraw(passEncoder.Get(), descriptor); ApplyClearBigIntegerColorValueWithDraw(passEncoder.Get(), descriptor);
if (error.IsError()) { if (error.IsError()) {
return RenderPassEncoder::MakeError(device, this, &mEncodingContext); return RenderPassEncoder::MakeError(device, this, &mEncodingContext,
descriptor ? descriptor->label : nullptr);
} }
} }
return passEncoder; return passEncoder;
} }
return RenderPassEncoder::MakeError(device, this, &mEncodingContext); return RenderPassEncoder::MakeError(device, this, &mEncodingContext,
descriptor ? descriptor->label : nullptr);
} }
// This function handles render pass workarounds. Because some cases may require // This function handles render pass workarounds. Because some cases may require
@ -1627,7 +1630,7 @@ CommandBufferBase* CommandEncoder::APIFinish(const CommandBufferDescriptor* desc
Ref<CommandBufferBase> commandBuffer; Ref<CommandBufferBase> commandBuffer;
if (GetDevice()->ConsumedError(Finish(descriptor), &commandBuffer)) { if (GetDevice()->ConsumedError(Finish(descriptor), &commandBuffer)) {
return CommandBufferBase::MakeError(GetDevice()); return CommandBufferBase::MakeError(GetDevice(), descriptor ? descriptor->label : nullptr);
} }
ASSERT(!IsError()); ASSERT(!IsError());
return commandBuffer.Detach(); return commandBuffer.Detach();

View File

@ -40,7 +40,7 @@ class CommandEncoder final : public ApiObjectBase {
public: public:
static Ref<CommandEncoder> Create(DeviceBase* device, static Ref<CommandEncoder> Create(DeviceBase* device,
const CommandEncoderDescriptor* descriptor); const CommandEncoderDescriptor* descriptor);
static CommandEncoder* MakeError(DeviceBase* device); static CommandEncoder* MakeError(DeviceBase* device, const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -119,7 +119,7 @@ class CommandEncoder final : public ApiObjectBase {
private: private:
CommandEncoder(DeviceBase* device, const CommandEncoderDescriptor* descriptor); CommandEncoder(DeviceBase* device, const CommandEncoderDescriptor* descriptor);
CommandEncoder(DeviceBase* device, ObjectBase::ErrorTag tag); CommandEncoder(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
void DestroyImpl() override; void DestroyImpl() override;

View File

@ -128,15 +128,18 @@ Ref<ComputePassEncoder> ComputePassEncoder::Create(DeviceBase* device,
ComputePassEncoder::ComputePassEncoder(DeviceBase* device, ComputePassEncoder::ComputePassEncoder(DeviceBase* device,
CommandEncoder* commandEncoder, CommandEncoder* commandEncoder,
EncodingContext* encodingContext, EncodingContext* encodingContext,
ErrorTag errorTag) ErrorTag errorTag,
: ProgrammableEncoder(device, encodingContext, errorTag), mCommandEncoder(commandEncoder) {} const char* label)
: ProgrammableEncoder(device, encodingContext, errorTag, label),
mCommandEncoder(commandEncoder) {}
// static // static
Ref<ComputePassEncoder> ComputePassEncoder::MakeError(DeviceBase* device, Ref<ComputePassEncoder> ComputePassEncoder::MakeError(DeviceBase* device,
CommandEncoder* commandEncoder, CommandEncoder* commandEncoder,
EncodingContext* encodingContext) { EncodingContext* encodingContext,
const char* label) {
return AcquireRef( return AcquireRef(
new ComputePassEncoder(device, commandEncoder, encodingContext, ObjectBase::kError)); new ComputePassEncoder(device, commandEncoder, encodingContext, ObjectBase::kError, label));
} }
void ComputePassEncoder::DestroyImpl() { void ComputePassEncoder::DestroyImpl() {

View File

@ -36,7 +36,8 @@ class ComputePassEncoder final : public ProgrammableEncoder {
EncodingContext* encodingContext); EncodingContext* encodingContext);
static Ref<ComputePassEncoder> MakeError(DeviceBase* device, static Ref<ComputePassEncoder> MakeError(DeviceBase* device,
CommandEncoder* commandEncoder, CommandEncoder* commandEncoder,
EncodingContext* encodingContext); EncodingContext* encodingContext,
const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -75,7 +76,8 @@ class ComputePassEncoder final : public ProgrammableEncoder {
ComputePassEncoder(DeviceBase* device, ComputePassEncoder(DeviceBase* device,
CommandEncoder* commandEncoder, CommandEncoder* commandEncoder,
EncodingContext* encodingContext, EncodingContext* encodingContext,
ErrorTag errorTag); ErrorTag errorTag,
const char* label);
private: private:
void DestroyImpl() override; void DestroyImpl() override;

View File

@ -56,8 +56,10 @@ ComputePipelineBase::ComputePipelineBase(DeviceBase* device,
StreamIn(&mCacheKey, CacheKey::Type::ComputePipeline, device->GetCacheKey()); StreamIn(&mCacheKey, CacheKey::Type::ComputePipeline, device->GetCacheKey());
} }
ComputePipelineBase::ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag) ComputePipelineBase::ComputePipelineBase(DeviceBase* device,
: PipelineBase(device, tag) {} ObjectBase::ErrorTag tag,
const char* label)
: PipelineBase(device, tag, label) {}
ComputePipelineBase::~ComputePipelineBase() = default; ComputePipelineBase::~ComputePipelineBase() = default;
@ -69,11 +71,11 @@ void ComputePipelineBase::DestroyImpl() {
} }
// static // static
ComputePipelineBase* ComputePipelineBase::MakeError(DeviceBase* device) { ComputePipelineBase* ComputePipelineBase::MakeError(DeviceBase* device, const char* label) {
class ErrorComputePipeline final : public ComputePipelineBase { class ErrorComputePipeline final : public ComputePipelineBase {
public: public:
explicit ErrorComputePipeline(DeviceBase* device) explicit ErrorComputePipeline(DeviceBase* device, const char* label)
: ComputePipelineBase(device, ObjectBase::kError) {} : ComputePipelineBase(device, ObjectBase::kError, label) {}
MaybeError Initialize() override { MaybeError Initialize() override {
UNREACHABLE(); UNREACHABLE();
@ -81,7 +83,7 @@ ComputePipelineBase* ComputePipelineBase::MakeError(DeviceBase* device) {
} }
}; };
return new ErrorComputePipeline(device); return new ErrorComputePipeline(device, label);
} }
ObjectType ComputePipelineBase::GetType() const { ObjectType ComputePipelineBase::GetType() const {

View File

@ -32,7 +32,7 @@ class ComputePipelineBase : public PipelineBase {
ComputePipelineBase(DeviceBase* device, const ComputePipelineDescriptor* descriptor); ComputePipelineBase(DeviceBase* device, const ComputePipelineDescriptor* descriptor);
~ComputePipelineBase() override; ~ComputePipelineBase() override;
static ComputePipelineBase* MakeError(DeviceBase* device); static ComputePipelineBase* MakeError(DeviceBase* device, const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -45,7 +45,7 @@ class ComputePipelineBase : public PipelineBase {
void DestroyImpl() override; void DestroyImpl() override;
private: private:
ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag); ComputePipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
}; };
} // namespace dawn::native } // namespace dawn::native

View File

@ -1107,7 +1107,7 @@ BindGroupBase* DeviceBase::APICreateBindGroup(const BindGroupDescriptor* descrip
Ref<BindGroupBase> result; Ref<BindGroupBase> result;
if (ConsumedError(CreateBindGroup(descriptor), &result, "calling %s.CreateBindGroup(%s).", this, if (ConsumedError(CreateBindGroup(descriptor), &result, "calling %s.CreateBindGroup(%s).", this,
descriptor)) { descriptor)) {
return BindGroupBase::MakeError(this); return BindGroupBase::MakeError(this, descriptor ? descriptor->label : nullptr);
} }
return result.Detach(); return result.Detach();
} }
@ -1116,7 +1116,7 @@ BindGroupLayoutBase* DeviceBase::APICreateBindGroupLayout(
Ref<BindGroupLayoutBase> result; Ref<BindGroupLayoutBase> result;
if (ConsumedError(CreateBindGroupLayout(descriptor), &result, if (ConsumedError(CreateBindGroupLayout(descriptor), &result,
"calling %s.CreateBindGroupLayout(%s).", this, descriptor)) { "calling %s.CreateBindGroupLayout(%s).", this, descriptor)) {
return BindGroupLayoutBase::MakeError(this); return BindGroupLayoutBase::MakeError(this, descriptor ? descriptor->label : nullptr);
} }
return result.Detach(); return result.Detach();
} }
@ -1133,7 +1133,7 @@ CommandEncoder* DeviceBase::APICreateCommandEncoder(const CommandEncoderDescript
Ref<CommandEncoder> result; Ref<CommandEncoder> result;
if (ConsumedError(CreateCommandEncoder(descriptor), &result, if (ConsumedError(CreateCommandEncoder(descriptor), &result,
"calling %s.CreateCommandEncoder(%s).", this, descriptor)) { "calling %s.CreateCommandEncoder(%s).", this, descriptor)) {
return CommandEncoder::MakeError(this); return CommandEncoder::MakeError(this, descriptor ? descriptor->label : nullptr);
} }
return result.Detach(); return result.Detach();
} }
@ -1145,7 +1145,7 @@ ComputePipelineBase* DeviceBase::APICreateComputePipeline(
Ref<ComputePipelineBase> result; Ref<ComputePipelineBase> result;
if (ConsumedError(CreateComputePipeline(descriptor), &result, if (ConsumedError(CreateComputePipeline(descriptor), &result,
"calling %s.CreateComputePipeline(%s).", this, descriptor)) { "calling %s.CreateComputePipeline(%s).", this, descriptor)) {
return ComputePipelineBase::MakeError(this); return ComputePipelineBase::MakeError(this, descriptor ? descriptor->label : nullptr);
} }
return result.Detach(); return result.Detach();
} }
@ -1176,7 +1176,7 @@ PipelineLayoutBase* DeviceBase::APICreatePipelineLayout(
Ref<PipelineLayoutBase> result; Ref<PipelineLayoutBase> result;
if (ConsumedError(CreatePipelineLayout(descriptor), &result, if (ConsumedError(CreatePipelineLayout(descriptor), &result,
"calling %s.CreatePipelineLayout(%s).", this, descriptor)) { "calling %s.CreatePipelineLayout(%s).", this, descriptor)) {
return PipelineLayoutBase::MakeError(this); return PipelineLayoutBase::MakeError(this, descriptor ? descriptor->label : nullptr);
} }
return result.Detach(); return result.Detach();
} }
@ -1192,7 +1192,7 @@ SamplerBase* DeviceBase::APICreateSampler(const SamplerDescriptor* descriptor) {
Ref<SamplerBase> result; Ref<SamplerBase> result;
if (ConsumedError(CreateSampler(descriptor), &result, "calling %s.CreateSampler(%s).", this, if (ConsumedError(CreateSampler(descriptor), &result, "calling %s.CreateSampler(%s).", this,
descriptor)) { descriptor)) {
return SamplerBase::MakeError(this); return SamplerBase::MakeError(this, descriptor ? descriptor->label : nullptr);
} }
return result.Detach(); return result.Detach();
} }
@ -1223,7 +1223,7 @@ RenderBundleEncoder* DeviceBase::APICreateRenderBundleEncoder(
Ref<RenderBundleEncoder> result; Ref<RenderBundleEncoder> result;
if (ConsumedError(CreateRenderBundleEncoder(descriptor), &result, if (ConsumedError(CreateRenderBundleEncoder(descriptor), &result,
"calling %s.CreateRenderBundleEncoder(%s).", this, descriptor)) { "calling %s.CreateRenderBundleEncoder(%s).", this, descriptor)) {
return RenderBundleEncoder::MakeError(this); return RenderBundleEncoder::MakeError(this, descriptor ? descriptor->label : nullptr);
} }
return result.Detach(); return result.Detach();
} }
@ -1235,7 +1235,7 @@ RenderPipelineBase* DeviceBase::APICreateRenderPipeline(
Ref<RenderPipelineBase> result; Ref<RenderPipelineBase> result;
if (ConsumedError(CreateRenderPipeline(descriptor), &result, if (ConsumedError(CreateRenderPipeline(descriptor), &result,
"calling %s.CreateRenderPipeline(%s).", this, descriptor)) { "calling %s.CreateRenderPipeline(%s).", this, descriptor)) {
return RenderPipelineBase::MakeError(this); return RenderPipelineBase::MakeError(this, descriptor ? descriptor->label : nullptr);
} }
return result.Detach(); return result.Detach();
} }
@ -1249,7 +1249,7 @@ ShaderModuleBase* DeviceBase::APICreateShaderModule(const ShaderModuleDescriptor
if (ConsumedError(CreateShaderModule(descriptor, compilationMessages.get()), &result, if (ConsumedError(CreateShaderModule(descriptor, compilationMessages.get()), &result,
"calling %s.CreateShaderModule(%s).", this, descriptor)) { "calling %s.CreateShaderModule(%s).", this, descriptor)) {
DAWN_ASSERT(result == nullptr); DAWN_ASSERT(result == nullptr);
result = ShaderModuleBase::MakeError(this); result = ShaderModuleBase::MakeError(this, descriptor ? descriptor->label : nullptr);
} }
// Move compilation messages into ShaderModuleBase and emit tint errors and warnings // Move compilation messages into ShaderModuleBase and emit tint errors and warnings
// after all other operations are finished, even if any of them is failed and result // after all other operations are finished, even if any of them is failed and result

View File

@ -138,8 +138,10 @@ ExternalTextureBase::ExternalTextureBase(DeviceBase* device,
} }
// Error external texture cannot be used in bind group. // Error external texture cannot be used in bind group.
ExternalTextureBase::ExternalTextureBase(DeviceBase* device, ObjectBase::ErrorTag tag) ExternalTextureBase::ExternalTextureBase(DeviceBase* device,
: ApiObjectBase(device, tag), mState(ExternalTextureState::Destroyed) {} ObjectBase::ErrorTag tag,
const char* label)
: ApiObjectBase(device, tag, label), mState(ExternalTextureState::Destroyed) {}
ExternalTextureBase::~ExternalTextureBase() = default; ExternalTextureBase::~ExternalTextureBase() = default;
@ -371,8 +373,8 @@ void ExternalTextureBase::DestroyImpl() {
} }
// static // static
ExternalTextureBase* ExternalTextureBase::MakeError(DeviceBase* device) { ExternalTextureBase* ExternalTextureBase::MakeError(DeviceBase* device, const char* label) {
return new ExternalTextureBase(device, ObjectBase::kError); return new ExternalTextureBase(device, ObjectBase::kError, label);
} }
BufferBase* ExternalTextureBase::GetParamsBuffer() const { BufferBase* ExternalTextureBase::GetParamsBuffer() const {

View File

@ -55,7 +55,7 @@ class ExternalTextureBase : public ApiObjectBase {
const Origin2D& GetVisibleOrigin() const; const Origin2D& GetVisibleOrigin() const;
MaybeError ValidateCanUseInSubmitNow() const; MaybeError ValidateCanUseInSubmitNow() const;
static ExternalTextureBase* MakeError(DeviceBase* device); static ExternalTextureBase* MakeError(DeviceBase* device, const char* label = nullptr);
void APIExpire(); void APIExpire();
void APIDestroy(); void APIDestroy();
@ -71,7 +71,7 @@ class ExternalTextureBase : public ApiObjectBase {
private: private:
enum class ExternalTextureState { Active, Expired, Destroyed }; enum class ExternalTextureState { Active, Expired, Destroyed };
ExternalTextureBase(DeviceBase* device, ObjectBase::ErrorTag tag); ExternalTextureBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
MaybeError ValidateRefresh(); MaybeError ValidateRefresh();
MaybeError ValidateExpire(); MaybeError ValidateExpire();

View File

@ -68,7 +68,12 @@ ApiObjectBase::ApiObjectBase(DeviceBase* device, const char* label) : ObjectBase
} }
} }
ApiObjectBase::ApiObjectBase(DeviceBase* device, ErrorTag tag) : ObjectBase(device, tag) {} ApiObjectBase::ApiObjectBase(DeviceBase* device, ErrorTag tag, const char* label)
: ObjectBase(device, tag) {
if (label) {
mLabel = label;
}
}
ApiObjectBase::ApiObjectBase(DeviceBase* device, LabelNotImplementedTag tag) : ObjectBase(device) {} ApiObjectBase::ApiObjectBase(DeviceBase* device, LabelNotImplementedTag tag) : ObjectBase(device) {}

View File

@ -79,7 +79,7 @@ class ApiObjectBase : public ObjectBase, public LinkNode<ApiObjectBase> {
ApiObjectBase(DeviceBase* device, LabelNotImplementedTag tag); ApiObjectBase(DeviceBase* device, LabelNotImplementedTag tag);
ApiObjectBase(DeviceBase* device, const char* label); ApiObjectBase(DeviceBase* device, const char* label);
ApiObjectBase(DeviceBase* device, ErrorTag tag); ApiObjectBase(DeviceBase* device, ErrorTag tag, const char* label = nullptr);
~ApiObjectBase() override; ~ApiObjectBase() override;
virtual ObjectType GetType() const = 0; virtual ObjectType GetType() const = 0;

View File

@ -213,8 +213,8 @@ PipelineBase::PipelineBase(DeviceBase* device,
} }
} }
PipelineBase::PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag) PipelineBase::PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
: ApiObjectBase(device, tag) {} : ApiObjectBase(device, tag, label) {}
PipelineBase::~PipelineBase() = default; PipelineBase::~PipelineBase() = default;

View File

@ -81,7 +81,7 @@ class PipelineBase : public ApiObjectBase, public CachedObject {
PipelineLayoutBase* layout, PipelineLayoutBase* layout,
const char* label, const char* label,
std::vector<StageAndDescriptor> stages); std::vector<StageAndDescriptor> stages);
PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag); PipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
private: private:
MaybeError ValidateGetBindGroupLayout(BindGroupIndex group); MaybeError ValidateGetBindGroupLayout(BindGroupIndex group);

View File

@ -74,8 +74,10 @@ PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device,
GetObjectTrackingList()->Track(this); GetObjectTrackingList()->Track(this);
} }
PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag) PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device,
: ApiObjectBase(device, tag) {} ObjectBase::ErrorTag tag,
const char* label)
: ApiObjectBase(device, tag, label) {}
PipelineLayoutBase::~PipelineLayoutBase() = default; PipelineLayoutBase::~PipelineLayoutBase() = default;
@ -87,8 +89,8 @@ void PipelineLayoutBase::DestroyImpl() {
} }
// static // static
PipelineLayoutBase* PipelineLayoutBase::MakeError(DeviceBase* device) { PipelineLayoutBase* PipelineLayoutBase::MakeError(DeviceBase* device, const char* label) {
return new PipelineLayoutBase(device, ObjectBase::kError); return new PipelineLayoutBase(device, ObjectBase::kError, label);
} }
// static // static

View File

@ -57,7 +57,7 @@ class PipelineLayoutBase : public ApiObjectBase, public CachedObject {
PipelineLayoutBase(DeviceBase* device, const PipelineLayoutDescriptor* descriptor); PipelineLayoutBase(DeviceBase* device, const PipelineLayoutDescriptor* descriptor);
~PipelineLayoutBase() override; ~PipelineLayoutBase() override;
static PipelineLayoutBase* MakeError(DeviceBase* device); static PipelineLayoutBase* MakeError(DeviceBase* device, const char* label);
static ResultOrError<Ref<PipelineLayoutBase>> CreateDefault( static ResultOrError<Ref<PipelineLayoutBase>> CreateDefault(
DeviceBase* device, DeviceBase* device,
std::vector<StageAndDescriptor> stages); std::vector<StageAndDescriptor> stages);
@ -84,7 +84,7 @@ class PipelineLayoutBase : public ApiObjectBase, public CachedObject {
}; };
protected: protected:
PipelineLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag); PipelineLayoutBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
void DestroyImpl() override; void DestroyImpl() override;
BindGroupLayoutArray mBindGroupLayouts; BindGroupLayoutArray mBindGroupLayouts;

View File

@ -37,8 +37,9 @@ ProgrammableEncoder::ProgrammableEncoder(DeviceBase* device,
ProgrammableEncoder::ProgrammableEncoder(DeviceBase* device, ProgrammableEncoder::ProgrammableEncoder(DeviceBase* device,
EncodingContext* encodingContext, EncodingContext* encodingContext,
ErrorTag errorTag) ErrorTag errorTag,
: ApiObjectBase(device, errorTag), const char* label)
: ApiObjectBase(device, errorTag, label),
mEncodingContext(encodingContext), mEncodingContext(encodingContext),
mValidationEnabled(device->IsValidationEnabled()) {} mValidationEnabled(device->IsValidationEnabled()) {}

View File

@ -53,7 +53,10 @@ class ProgrammableEncoder : public ApiObjectBase {
const uint32_t* dynamicOffsets) const; const uint32_t* dynamicOffsets) const;
// Construct an "error" programmable pass encoder. // Construct an "error" programmable pass encoder.
ProgrammableEncoder(DeviceBase* device, EncodingContext* encodingContext, ErrorTag errorTag); ProgrammableEncoder(DeviceBase* device,
EncodingContext* encodingContext,
ErrorTag errorTag,
const char* label);
EncodingContext* mEncodingContext = nullptr; EncodingContext* mEncodingContext = nullptr;

View File

@ -114,7 +114,9 @@ QuerySetBase::QuerySetBase(DeviceBase* device, const QuerySetDescriptor* descrip
QuerySetBase::QuerySetBase(DeviceBase* device, QuerySetBase::QuerySetBase(DeviceBase* device,
const QuerySetDescriptor* descriptor, const QuerySetDescriptor* descriptor,
ObjectBase::ErrorTag tag) ObjectBase::ErrorTag tag)
: ApiObjectBase(device, tag), mQueryType(descriptor->type), mQueryCount(descriptor->count) {} : ApiObjectBase(device, tag, descriptor->label),
mQueryType(descriptor->type),
mQueryCount(descriptor->count) {}
QuerySetBase::~QuerySetBase() { QuerySetBase::~QuerySetBase() {
// Uninitialized or already destroyed // Uninitialized or already destroyed

View File

@ -159,7 +159,8 @@ struct SubmittedWorkDone : TrackTaskCallback {
class ErrorQueue : public QueueBase { class ErrorQueue : public QueueBase {
public: public:
explicit ErrorQueue(DeviceBase* device) : QueueBase(device, ObjectBase::kError) {} explicit ErrorQueue(DeviceBase* device, const char* label)
: QueueBase(device, ObjectBase::kError, label) {}
private: private:
MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override { MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override {
@ -177,7 +178,8 @@ void TrackTaskCallback::SetFinishedSerial(ExecutionSerial serial) {
QueueBase::QueueBase(DeviceBase* device, const QueueDescriptor* descriptor) QueueBase::QueueBase(DeviceBase* device, const QueueDescriptor* descriptor)
: ApiObjectBase(device, descriptor->label) {} : ApiObjectBase(device, descriptor->label) {}
QueueBase::QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag) : ApiObjectBase(device, tag) {} QueueBase::QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
: ApiObjectBase(device, tag, label) {}
QueueBase::~QueueBase() { QueueBase::~QueueBase() {
ASSERT(mTasksInFlight.Empty()); ASSERT(mTasksInFlight.Empty());
@ -186,8 +188,8 @@ QueueBase::~QueueBase() {
void QueueBase::DestroyImpl() {} void QueueBase::DestroyImpl() {}
// static // static
QueueBase* QueueBase::MakeError(DeviceBase* device) { QueueBase* QueueBase::MakeError(DeviceBase* device, const char* label) {
return new ErrorQueue(device); return new ErrorQueue(device, label);
} }
ObjectType QueueBase::GetType() const { ObjectType QueueBase::GetType() const {

View File

@ -49,7 +49,7 @@ class QueueBase : public ApiObjectBase {
public: public:
~QueueBase() override; ~QueueBase() override;
static QueueBase* MakeError(DeviceBase* device); static QueueBase* MakeError(DeviceBase* device, const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -84,7 +84,7 @@ class QueueBase : public ApiObjectBase {
protected: protected:
QueueBase(DeviceBase* device, const QueueDescriptor* descriptor); QueueBase(DeviceBase* device, const QueueDescriptor* descriptor);
QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag); QueueBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
void DestroyImpl() override; void DestroyImpl() override;
private: private:

View File

@ -51,12 +51,12 @@ void RenderBundleBase::DestroyImpl() {
} }
// static // static
RenderBundleBase* RenderBundleBase::MakeError(DeviceBase* device) { RenderBundleBase* RenderBundleBase::MakeError(DeviceBase* device, const char* label) {
return new RenderBundleBase(device, ObjectBase::kError); return new RenderBundleBase(device, ObjectBase::kError, label);
} }
RenderBundleBase::RenderBundleBase(DeviceBase* device, ErrorTag errorTag) RenderBundleBase::RenderBundleBase(DeviceBase* device, ErrorTag errorTag, const char* label)
: ApiObjectBase(device, errorTag), mIndirectDrawMetadata(device->GetLimits()) {} : ApiObjectBase(device, errorTag, label), mIndirectDrawMetadata(device->GetLimits()) {}
ObjectType RenderBundleBase::GetType() const { ObjectType RenderBundleBase::GetType() const {
return ObjectType::RenderBundle; return ObjectType::RenderBundle;

View File

@ -43,7 +43,7 @@ class RenderBundleBase final : public ApiObjectBase {
RenderPassResourceUsage resourceUsage, RenderPassResourceUsage resourceUsage,
IndirectDrawMetadata indirectDrawMetadata); IndirectDrawMetadata indirectDrawMetadata);
static RenderBundleBase* MakeError(DeviceBase* device); static RenderBundleBase* MakeError(DeviceBase* device, const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -57,7 +57,7 @@ class RenderBundleBase final : public ApiObjectBase {
const IndirectDrawMetadata& GetIndirectDrawMetadata(); const IndirectDrawMetadata& GetIndirectDrawMetadata();
private: private:
RenderBundleBase(DeviceBase* device, ErrorTag errorTag); RenderBundleBase(DeviceBase* device, ErrorTag errorTag, const char* label);
void DestroyImpl() override; void DestroyImpl() override;

View File

@ -108,8 +108,8 @@ RenderBundleEncoder::RenderBundleEncoder(DeviceBase* device,
GetObjectTrackingList()->Track(this); GetObjectTrackingList()->Track(this);
} }
RenderBundleEncoder::RenderBundleEncoder(DeviceBase* device, ErrorTag errorTag) RenderBundleEncoder::RenderBundleEncoder(DeviceBase* device, ErrorTag errorTag, const char* label)
: RenderEncoderBase(device, &mBundleEncodingContext, errorTag), : RenderEncoderBase(device, &mBundleEncodingContext, errorTag, label),
mBundleEncodingContext(device, this) {} mBundleEncodingContext(device, this) {}
void RenderBundleEncoder::DestroyImpl() { void RenderBundleEncoder::DestroyImpl() {
@ -125,8 +125,8 @@ Ref<RenderBundleEncoder> RenderBundleEncoder::Create(
} }
// static // static
RenderBundleEncoder* RenderBundleEncoder::MakeError(DeviceBase* device) { RenderBundleEncoder* RenderBundleEncoder::MakeError(DeviceBase* device, const char* label) {
return new RenderBundleEncoder(device, ObjectBase::kError); return new RenderBundleEncoder(device, ObjectBase::kError, label);
} }
ObjectType RenderBundleEncoder::GetType() const { ObjectType RenderBundleEncoder::GetType() const {
@ -142,7 +142,7 @@ RenderBundleBase* RenderBundleEncoder::APIFinish(const RenderBundleDescriptor* d
if (GetDevice()->ConsumedError(FinishImpl(descriptor), &result, "calling %s.Finish(%s).", this, if (GetDevice()->ConsumedError(FinishImpl(descriptor), &result, "calling %s.Finish(%s).", this,
descriptor)) { descriptor)) {
return RenderBundleBase::MakeError(GetDevice()); return RenderBundleBase::MakeError(GetDevice(), descriptor ? descriptor->label : nullptr);
} }
return result; return result;

View File

@ -30,7 +30,7 @@ class RenderBundleEncoder final : public RenderEncoderBase {
public: public:
static Ref<RenderBundleEncoder> Create(DeviceBase* device, static Ref<RenderBundleEncoder> Create(DeviceBase* device,
const RenderBundleEncoderDescriptor* descriptor); const RenderBundleEncoderDescriptor* descriptor);
static RenderBundleEncoder* MakeError(DeviceBase* device); static RenderBundleEncoder* MakeError(DeviceBase* device, const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -40,7 +40,7 @@ class RenderBundleEncoder final : public RenderEncoderBase {
private: private:
RenderBundleEncoder(DeviceBase* device, const RenderBundleEncoderDescriptor* descriptor); RenderBundleEncoder(DeviceBase* device, const RenderBundleEncoderDescriptor* descriptor);
RenderBundleEncoder(DeviceBase* device, ErrorTag errorTag); RenderBundleEncoder(DeviceBase* device, ErrorTag errorTag, const char* label);
void DestroyImpl() override; void DestroyImpl() override;

View File

@ -47,8 +47,9 @@ RenderEncoderBase::RenderEncoderBase(DeviceBase* device,
RenderEncoderBase::RenderEncoderBase(DeviceBase* device, RenderEncoderBase::RenderEncoderBase(DeviceBase* device,
EncodingContext* encodingContext, EncodingContext* encodingContext,
ErrorTag errorTag) ErrorTag errorTag,
: ProgrammableEncoder(device, encodingContext, errorTag), const char* label)
: ProgrammableEncoder(device, encodingContext, errorTag, label),
mIndirectDrawMetadata(device->GetLimits()), mIndirectDrawMetadata(device->GetLimits()),
mDisableBaseVertex(device->IsToggleEnabled(Toggle::DisableBaseVertex)), mDisableBaseVertex(device->IsToggleEnabled(Toggle::DisableBaseVertex)),
mDisableBaseInstance(device->IsToggleEnabled(Toggle::DisableBaseInstance)) {} mDisableBaseInstance(device->IsToggleEnabled(Toggle::DisableBaseInstance)) {}

View File

@ -67,7 +67,10 @@ class RenderEncoderBase : public ProgrammableEncoder {
protected: protected:
// Construct an "error" render encoder base. // Construct an "error" render encoder base.
RenderEncoderBase(DeviceBase* device, EncodingContext* encodingContext, ErrorTag errorTag); RenderEncoderBase(DeviceBase* device,
EncodingContext* encodingContext,
ErrorTag errorTag,
const char* label);
void DestroyImpl() override; void DestroyImpl() override;

View File

@ -102,15 +102,18 @@ Ref<RenderPassEncoder> RenderPassEncoder::Create(DeviceBase* device,
RenderPassEncoder::RenderPassEncoder(DeviceBase* device, RenderPassEncoder::RenderPassEncoder(DeviceBase* device,
CommandEncoder* commandEncoder, CommandEncoder* commandEncoder,
EncodingContext* encodingContext, EncodingContext* encodingContext,
ErrorTag errorTag) ErrorTag errorTag,
: RenderEncoderBase(device, encodingContext, errorTag), mCommandEncoder(commandEncoder) {} const char* label)
: RenderEncoderBase(device, encodingContext, errorTag, label),
mCommandEncoder(commandEncoder) {}
// static // static
Ref<RenderPassEncoder> RenderPassEncoder::MakeError(DeviceBase* device, Ref<RenderPassEncoder> RenderPassEncoder::MakeError(DeviceBase* device,
CommandEncoder* commandEncoder, CommandEncoder* commandEncoder,
EncodingContext* encodingContext) { EncodingContext* encodingContext,
const char* label) {
return AcquireRef( return AcquireRef(
new RenderPassEncoder(device, commandEncoder, encodingContext, ObjectBase::kError)); new RenderPassEncoder(device, commandEncoder, encodingContext, ObjectBase::kError, label));
} }
void RenderPassEncoder::DestroyImpl() { void RenderPassEncoder::DestroyImpl() {

View File

@ -40,7 +40,8 @@ class RenderPassEncoder final : public RenderEncoderBase {
std::function<void()> endCallback = nullptr); std::function<void()> endCallback = nullptr);
static Ref<RenderPassEncoder> MakeError(DeviceBase* device, static Ref<RenderPassEncoder> MakeError(DeviceBase* device,
CommandEncoder* commandEncoder, CommandEncoder* commandEncoder,
EncodingContext* encodingContext); EncodingContext* encodingContext,
const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -84,7 +85,8 @@ class RenderPassEncoder final : public RenderEncoderBase {
RenderPassEncoder(DeviceBase* device, RenderPassEncoder(DeviceBase* device,
CommandEncoder* commandEncoder, CommandEncoder* commandEncoder,
EncodingContext* encodingContext, EncodingContext* encodingContext,
ErrorTag errorTag); ErrorTag errorTag,
const char* label);
private: private:
void DestroyImpl() override; void DestroyImpl() override;

View File

@ -730,8 +730,10 @@ RenderPipelineBase::RenderPipelineBase(DeviceBase* device,
StreamIn(&mCacheKey, CacheKey::Type::RenderPipeline, device->GetCacheKey()); StreamIn(&mCacheKey, CacheKey::Type::RenderPipeline, device->GetCacheKey());
} }
RenderPipelineBase::RenderPipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag) RenderPipelineBase::RenderPipelineBase(DeviceBase* device,
: PipelineBase(device, tag) {} ObjectBase::ErrorTag tag,
const char* label)
: PipelineBase(device, tag, label) {}
RenderPipelineBase::~RenderPipelineBase() = default; RenderPipelineBase::~RenderPipelineBase() = default;
@ -747,11 +749,11 @@ void RenderPipelineBase::DestroyImpl() {
} }
// static // static
RenderPipelineBase* RenderPipelineBase::MakeError(DeviceBase* device) { RenderPipelineBase* RenderPipelineBase::MakeError(DeviceBase* device, const char* label) {
class ErrorRenderPipeline final : public RenderPipelineBase { class ErrorRenderPipeline final : public RenderPipelineBase {
public: public:
explicit ErrorRenderPipeline(DeviceBase* device) explicit ErrorRenderPipeline(DeviceBase* device, const char* label)
: RenderPipelineBase(device, ObjectBase::kError) {} : RenderPipelineBase(device, ObjectBase::kError, label) {}
MaybeError Initialize() override { MaybeError Initialize() override {
UNREACHABLE(); UNREACHABLE();
@ -759,7 +761,7 @@ RenderPipelineBase* RenderPipelineBase::MakeError(DeviceBase* device) {
} }
}; };
return new ErrorRenderPipeline(device); return new ErrorRenderPipeline(device, label);
} }
ObjectType RenderPipelineBase::GetType() const { ObjectType RenderPipelineBase::GetType() const {

View File

@ -65,7 +65,7 @@ class RenderPipelineBase : public PipelineBase {
RenderPipelineBase(DeviceBase* device, const RenderPipelineDescriptor* descriptor); RenderPipelineBase(DeviceBase* device, const RenderPipelineDescriptor* descriptor);
~RenderPipelineBase() override; ~RenderPipelineBase() override;
static RenderPipelineBase* MakeError(DeviceBase* device); static RenderPipelineBase* MakeError(DeviceBase* device, const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -116,7 +116,7 @@ class RenderPipelineBase : public PipelineBase {
void DestroyImpl() override; void DestroyImpl() override;
private: private:
RenderPipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag); RenderPipelineBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
// Vertex state // Vertex state
uint32_t mVertexBufferCount; uint32_t mVertexBufferCount;

View File

@ -89,8 +89,8 @@ SamplerBase::SamplerBase(DeviceBase* device, const SamplerDescriptor* descriptor
GetObjectTrackingList()->Track(this); GetObjectTrackingList()->Track(this);
} }
SamplerBase::SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag) SamplerBase::SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
: ApiObjectBase(device, tag) {} : ApiObjectBase(device, tag, label) {}
SamplerBase::~SamplerBase() = default; SamplerBase::~SamplerBase() = default;
@ -102,8 +102,8 @@ void SamplerBase::DestroyImpl() {
} }
// static // static
SamplerBase* SamplerBase::MakeError(DeviceBase* device) { SamplerBase* SamplerBase::MakeError(DeviceBase* device, const char* label) {
return new SamplerBase(device, ObjectBase::kError); return new SamplerBase(device, ObjectBase::kError, label);
} }
ObjectType SamplerBase::GetType() const { ObjectType SamplerBase::GetType() const {

View File

@ -36,7 +36,7 @@ class SamplerBase : public ApiObjectBase, public CachedObject {
SamplerBase(DeviceBase* device, const SamplerDescriptor* descriptor); SamplerBase(DeviceBase* device, const SamplerDescriptor* descriptor);
~SamplerBase() override; ~SamplerBase() override;
static SamplerBase* MakeError(DeviceBase* device); static SamplerBase* MakeError(DeviceBase* device, const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -56,7 +56,7 @@ class SamplerBase : public ApiObjectBase, public CachedObject {
void DestroyImpl() override; void DestroyImpl() override;
private: private:
SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag); SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
// TODO(cwallez@chromium.org): Store a crypto hash of the items instead? // TODO(cwallez@chromium.org): Store a crypto hash of the items instead?
wgpu::AddressMode mAddressModeU; wgpu::AddressMode mAddressModeU;

View File

@ -1110,8 +1110,8 @@ ShaderModuleBase::ShaderModuleBase(DeviceBase* device, const ShaderModuleDescrip
GetObjectTrackingList()->Track(this); GetObjectTrackingList()->Track(this);
} }
ShaderModuleBase::ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag) ShaderModuleBase::ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
: ApiObjectBase(device, tag), mType(Type::Undefined) {} : ApiObjectBase(device, tag, label), mType(Type::Undefined) {}
ShaderModuleBase::~ShaderModuleBase() = default; ShaderModuleBase::~ShaderModuleBase() = default;
@ -1123,8 +1123,8 @@ void ShaderModuleBase::DestroyImpl() {
} }
// static // static
Ref<ShaderModuleBase> ShaderModuleBase::MakeError(DeviceBase* device) { Ref<ShaderModuleBase> ShaderModuleBase::MakeError(DeviceBase* device, const char* label) {
return AcquireRef(new ShaderModuleBase(device, ObjectBase::kError)); return AcquireRef(new ShaderModuleBase(device, ObjectBase::kError, label));
} }
ObjectType ShaderModuleBase::GetType() const { ObjectType ShaderModuleBase::GetType() const {

View File

@ -258,7 +258,7 @@ class ShaderModuleBase : public ApiObjectBase, public CachedObject {
ShaderModuleBase(DeviceBase* device, const ShaderModuleDescriptor* descriptor); ShaderModuleBase(DeviceBase* device, const ShaderModuleDescriptor* descriptor);
~ShaderModuleBase() override; ~ShaderModuleBase() override;
static Ref<ShaderModuleBase> MakeError(DeviceBase* device); static Ref<ShaderModuleBase> MakeError(DeviceBase* device, const char* label);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -292,7 +292,7 @@ class ShaderModuleBase : public ApiObjectBase, public CachedObject {
OwnedCompilationMessages* compilationMessages); OwnedCompilationMessages* compilationMessages);
private: private:
ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag); ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
// The original data in the descriptor for caching. // The original data in the descriptor for caching.
enum class Type { Undefined, Spirv, Wgsl }; enum class Type { Undefined, Spirv, Wgsl };

View File

@ -584,7 +584,7 @@ static constexpr Format kUnusedFormat;
TextureBase::TextureBase(DeviceBase* device, TextureBase::TextureBase(DeviceBase* device,
const TextureDescriptor* descriptor, const TextureDescriptor* descriptor,
ObjectBase::ErrorTag tag) ObjectBase::ErrorTag tag)
: ApiObjectBase(device, tag), : ApiObjectBase(device, tag, descriptor->label),
mDimension(descriptor->dimension), mDimension(descriptor->dimension),
mFormat(kUnusedFormat), mFormat(kUnusedFormat),
mSize(descriptor->size), mSize(descriptor->size),
@ -796,7 +796,7 @@ TextureViewBase* TextureBase::APICreateView(const TextureViewDescriptor* descrip
Ref<TextureViewBase> result; Ref<TextureViewBase> result;
if (device->ConsumedError(CreateView(descriptor), &result, "calling %s.CreateView(%s).", this, if (device->ConsumedError(CreateView(descriptor), &result, "calling %s.CreateView(%s).", this,
descriptor)) { descriptor)) {
return TextureViewBase::MakeError(device); return TextureViewBase::MakeError(device, descriptor ? descriptor->label : nullptr);
} }
return result.Detach(); return result.Detach();
} }
@ -849,16 +849,16 @@ TextureViewBase::TextureViewBase(TextureBase* texture, const TextureViewDescript
GetObjectTrackingList()->Track(this); GetObjectTrackingList()->Track(this);
} }
TextureViewBase::TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag) TextureViewBase::TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label)
: ApiObjectBase(device, tag), mFormat(kUnusedFormat) {} : ApiObjectBase(device, tag, label), mFormat(kUnusedFormat) {}
TextureViewBase::~TextureViewBase() = default; TextureViewBase::~TextureViewBase() = default;
void TextureViewBase::DestroyImpl() {} void TextureViewBase::DestroyImpl() {}
// static // static
TextureViewBase* TextureViewBase::MakeError(DeviceBase* device) { TextureViewBase* TextureViewBase::MakeError(DeviceBase* device, const char* label) {
return new TextureViewBase(device, ObjectBase::kError); return new TextureViewBase(device, ObjectBase::kError, label);
} }
ObjectType TextureViewBase::GetType() const { ObjectType TextureViewBase::GetType() const {

View File

@ -140,7 +140,7 @@ class TextureViewBase : public ApiObjectBase {
TextureViewBase(TextureBase* texture, const TextureViewDescriptor* descriptor); TextureViewBase(TextureBase* texture, const TextureViewDescriptor* descriptor);
~TextureViewBase() override; ~TextureViewBase() override;
static TextureViewBase* MakeError(DeviceBase* device); static TextureViewBase* MakeError(DeviceBase* device, const char* label = nullptr);
ObjectType GetType() const override; ObjectType GetType() const override;
@ -160,7 +160,7 @@ class TextureViewBase : public ApiObjectBase {
void DestroyImpl() override; void DestroyImpl() override;
private: private:
TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag); TextureViewBase(DeviceBase* device, ObjectBase::ErrorTag tag, const char* label);
ApiObjectList* GetObjectTrackingList() override; ApiObjectList* GetObjectTrackingList() override;