Make validation error formatting more consistent
- Updates error message formatting to ensure they end with a newline to prevent errors from running together. - Updated all encoder/device context messages to normalize their format and include more information. - Update Abseil formatter to make objects indicate if they are an error object in the formatted string. (ie: [Invalid BindGroup]) - Added fallback code in case a context message doesn't format correctly to aid in debugging. Bug: dawn:1154 Change-Id: Id27b11305cf8efcca343597f90489dde5552c775 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/68200 Commit-Queue: Brandon Jones <bajones@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
0a873d8eb1
commit
2514566d82
|
@ -113,6 +113,6 @@ Context messages should follow these guidelines:
|
||||||
* Example: `("validating % against %", descriptor, descriptor->layout)`
|
* Example: `("validating % against %", descriptor, descriptor->layout)`
|
||||||
* Output: `- While validating [BindGroupDescriptor "Label"] against [BindGroupLayout]`
|
* Output: `- While validating [BindGroupDescriptor "Label"] against [BindGroupLayout]`
|
||||||
|
|
||||||
**When possible, indicate the function call being made as the top-level context.**
|
**When possible, indicate the function call being made as the top-level context, as well as the parameters passed.**
|
||||||
* Example: `("calling CreatePipelineLayout")`
|
* Example: `("calling %s.CreatePipelineLayout(%s).", this, descriptor)`
|
||||||
* Output: `- While calling CreatePipelineLayout`
|
* Output: `- While calling [Device].CreatePipelineLayout([PipelineLayoutDescriptor]).`
|
||||||
|
|
|
@ -94,6 +94,9 @@ namespace dawn_native {
|
||||||
return {true};
|
return {true};
|
||||||
}
|
}
|
||||||
s->Append("[");
|
s->Append("[");
|
||||||
|
if (value->IsError()) {
|
||||||
|
s->Append("Invalid ");
|
||||||
|
}
|
||||||
s->Append(ObjectTypeAsString(value->GetType()));
|
s->Append(ObjectTypeAsString(value->GetType()));
|
||||||
const std::string& label = value->GetLabel();
|
const std::string& label = value->GetLabel();
|
||||||
if (!label.empty()) {
|
if (!label.empty()) {
|
||||||
|
@ -112,6 +115,9 @@ namespace dawn_native {
|
||||||
return {true};
|
return {true};
|
||||||
}
|
}
|
||||||
s->Append("[");
|
s->Append("[");
|
||||||
|
if (value->IsError()) {
|
||||||
|
s->Append("Invalid ");
|
||||||
|
}
|
||||||
s->Append(ObjectTypeAsString(value->GetType()));
|
s->Append(ObjectTypeAsString(value->GetType()));
|
||||||
const std::string& label = value->GetLabel();
|
const std::string& label = value->GetLabel();
|
||||||
if (!label.empty()) {
|
if (!label.empty()) {
|
||||||
|
|
|
@ -344,7 +344,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
WGPUBufferMapAsyncStatus status;
|
WGPUBufferMapAsyncStatus status;
|
||||||
if (GetDevice()->ConsumedError(ValidateMapAsync(mode, offset, size, &status),
|
if (GetDevice()->ConsumedError(ValidateMapAsync(mode, offset, size, &status),
|
||||||
"calling %s.MapAsync(%s, %u, %u, ...)", this, mode, offset,
|
"calling %s.MapAsync(%s, %u, %u, ...).", this, mode, offset,
|
||||||
size)) {
|
size)) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(status, userdata);
|
callback(status, userdata);
|
||||||
|
@ -416,7 +416,7 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferBase::APIUnmap() {
|
void BufferBase::APIUnmap() {
|
||||||
if (GetDevice()->ConsumedError(ValidateUnmap(), "calling %s.Unmap()", this)) {
|
if (GetDevice()->ConsumedError(ValidateUnmap(), "calling %s.Unmap().", this)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Unmap();
|
Unmap();
|
||||||
|
|
|
@ -513,7 +513,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding BeginComputePass(%s).", descriptor);
|
"encoding %s.BeginComputePass(%s).", this, descriptor);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
ComputePassEncoder* passEncoder =
|
ComputePassEncoder* passEncoder =
|
||||||
|
@ -618,7 +618,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding BeginRenderPass(%s).", descriptor);
|
"encoding %s.BeginRenderPass(%s).", this, descriptor);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
RenderPassEncoder* passEncoder =
|
RenderPassEncoder* passEncoder =
|
||||||
|
@ -673,8 +673,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding CopyBufferToBuffer(%s, %u, %s, %u, %u).", source, sourceOffset, destination,
|
"encoding %s.CopyBufferToBuffer(%s, %u, %s, %u, %u).", this, source, sourceOffset,
|
||||||
destinationOffset, size);
|
destination, destinationOffset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::APICopyBufferToTexture(const ImageCopyBuffer* source,
|
void CommandEncoder::APICopyBufferToTexture(const ImageCopyBuffer* source,
|
||||||
|
@ -732,8 +732,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding CopyBufferToTexture(%s, %s, %s).", source->buffer, destination->texture,
|
"encoding %s.CopyBufferToTexture(%s, %s, %s).", this, source->buffer,
|
||||||
copySize);
|
destination->texture, copySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::APICopyTextureToBuffer(const ImageCopyTexture* source,
|
void CommandEncoder::APICopyTextureToBuffer(const ImageCopyTexture* source,
|
||||||
|
@ -790,8 +790,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding CopyTextureToBuffer(%s, %s, %s).", source->texture, destination->buffer,
|
"encoding %s.CopyTextureToBuffer(%s, %s, %s).", this, source->texture,
|
||||||
copySize);
|
destination->buffer, copySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::APICopyTextureToTexture(const ImageCopyTexture* source,
|
void CommandEncoder::APICopyTextureToTexture(const ImageCopyTexture* source,
|
||||||
|
@ -862,8 +862,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding CopyTextureToTexture(%s, %s, %s).", source->texture, destination->texture,
|
"encoding %s.CopyTextureToTexture(%s, %s, %s).", this, source->texture,
|
||||||
copySize);
|
destination->texture, copySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::APIInjectValidationError(const char* message) {
|
void CommandEncoder::APIInjectValidationError(const char* message) {
|
||||||
|
@ -885,7 +885,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding InsertDebugMarker(\"%s\").", groupLabel);
|
"encoding %s.InsertDebugMarker(\"%s\").", this, groupLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::APIPopDebugGroup() {
|
void CommandEncoder::APIPopDebugGroup() {
|
||||||
|
@ -903,7 +903,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding PopDebugGroup().");
|
"encoding %s.PopDebugGroup().", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::APIPushDebugGroup(const char* groupLabel) {
|
void CommandEncoder::APIPushDebugGroup(const char* groupLabel) {
|
||||||
|
@ -922,7 +922,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding PushDebugGroup(\"%s\").", groupLabel);
|
"encoding %s.PushDebugGroup(\"%s\").", this, groupLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::APIResolveQuerySet(QuerySetBase* querySet,
|
void CommandEncoder::APIResolveQuerySet(QuerySetBase* querySet,
|
||||||
|
@ -962,8 +962,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding ResolveQuerySet(%s, %u, %u, %s, %u).", querySet, firstQuery, queryCount,
|
"encoding %s.ResolveQuerySet(%s, %u, %u, %s, %u).", this, querySet, firstQuery,
|
||||||
destination, destinationOffset);
|
queryCount, destination, destinationOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::APIWriteBuffer(BufferBase* buffer,
|
void CommandEncoder::APIWriteBuffer(BufferBase* buffer,
|
||||||
|
@ -989,7 +989,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding WriteBuffer(%s, %u, ..., %u).", buffer, bufferOffset, size);
|
"encoding %s.WriteBuffer(%s, %u, ..., %u).", this, buffer, bufferOffset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandEncoder::APIWriteTimestamp(QuerySetBase* querySet, uint32_t queryIndex) {
|
void CommandEncoder::APIWriteTimestamp(QuerySetBase* querySet, uint32_t queryIndex) {
|
||||||
|
@ -1010,7 +1010,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding WriteTimestamp(%s, %u).", querySet, queryIndex);
|
"encoding %s.WriteTimestamp(%s, %u).", this, querySet, queryIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandBufferBase* CommandEncoder::APIFinish(const CommandBufferDescriptor* descriptor) {
|
CommandBufferBase* CommandEncoder::APIFinish(const CommandBufferDescriptor* descriptor) {
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding EndPass()")) {
|
"encoding %s.EndPass().", this)) {
|
||||||
mEncodingContext->ExitComputePass(this, mUsageTracker.AcquireResourceUsage());
|
mEncodingContext->ExitComputePass(this, mUsageTracker.AcquireResourceUsage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding Dispatch (x: %u, y: %u, z: %u)", x, y, z);
|
"encoding %s.Dispatch(%u, %u, %u).", this, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<std::pair<Ref<BufferBase>, uint64_t>>
|
ResultOrError<std::pair<Ref<BufferBase>, uint64_t>>
|
||||||
|
@ -348,7 +348,7 @@ namespace dawn_native {
|
||||||
dispatch->indirectOffset = indirectOffset;
|
dispatch->indirectOffset = indirectOffset;
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding DispatchIndirect with %s", indirectBuffer);
|
"encoding %s.DispatchIndirect(%s, %u).", this, indirectBuffer, indirectOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComputePassEncoder::APISetPipeline(ComputePipelineBase* pipeline) {
|
void ComputePassEncoder::APISetPipeline(ComputePipelineBase* pipeline) {
|
||||||
|
@ -367,7 +367,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding SetPipeline with %s", pipeline);
|
"encoding %s.SetPipeline(%s).", this, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComputePassEncoder::APISetBindGroup(uint32_t groupIndexIn,
|
void ComputePassEncoder::APISetBindGroup(uint32_t groupIndexIn,
|
||||||
|
@ -392,7 +392,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding SetBindGroup with %s at index %u", group, groupIndexIn);
|
"encoding %s.SetBindGroup(%u, %s, %u, ...).", this, groupIndexIn, group,
|
||||||
|
dynamicOffsetCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComputePassEncoder::APIWriteTimestamp(QuerySetBase* querySet, uint32_t queryIndex) {
|
void ComputePassEncoder::APIWriteTimestamp(QuerySetBase* querySet, uint32_t queryIndex) {
|
||||||
|
@ -413,7 +414,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding WriteTimestamp to %s.", querySet);
|
"encoding %s.WriteTimestamp(%s, %u).", this, querySet, queryIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComputePassEncoder::AddDispatchSyncScope(SyncScopeUsageTracker scope) {
|
void ComputePassEncoder::AddDispatchSyncScope(SyncScopeUsageTracker scope) {
|
||||||
|
|
|
@ -506,7 +506,7 @@ namespace dawn_native {
|
||||||
object->GetDevice(), this);
|
object->GetDevice(), this);
|
||||||
|
|
||||||
// TODO(dawn:563): Preserve labels for error objects.
|
// TODO(dawn:563): Preserve labels for error objects.
|
||||||
DAWN_INVALID_IF(object->IsError(), "%s is an error.", object);
|
DAWN_INVALID_IF(object->IsError(), "%s is invalid.", object);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -868,8 +868,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
BindGroupBase* DeviceBase::APICreateBindGroup(const BindGroupDescriptor* descriptor) {
|
BindGroupBase* DeviceBase::APICreateBindGroup(const BindGroupDescriptor* descriptor) {
|
||||||
Ref<BindGroupBase> result;
|
Ref<BindGroupBase> result;
|
||||||
if (ConsumedError(CreateBindGroup(descriptor), &result, "calling CreateBindGroup(%s).",
|
if (ConsumedError(CreateBindGroup(descriptor), &result, "calling %s.CreateBindGroup(%s).",
|
||||||
descriptor)) {
|
this, descriptor)) {
|
||||||
return BindGroupBase::MakeError(this);
|
return BindGroupBase::MakeError(this);
|
||||||
}
|
}
|
||||||
return result.Detach();
|
return result.Detach();
|
||||||
|
@ -878,14 +878,14 @@ namespace dawn_native {
|
||||||
const BindGroupLayoutDescriptor* descriptor) {
|
const BindGroupLayoutDescriptor* descriptor) {
|
||||||
Ref<BindGroupLayoutBase> result;
|
Ref<BindGroupLayoutBase> result;
|
||||||
if (ConsumedError(CreateBindGroupLayout(descriptor), &result,
|
if (ConsumedError(CreateBindGroupLayout(descriptor), &result,
|
||||||
"calling CreateBindGroupLayout(%s).", descriptor)) {
|
"calling %s.CreateBindGroupLayout(%s).", this, descriptor)) {
|
||||||
return BindGroupLayoutBase::MakeError(this);
|
return BindGroupLayoutBase::MakeError(this);
|
||||||
}
|
}
|
||||||
return result.Detach();
|
return result.Detach();
|
||||||
}
|
}
|
||||||
BufferBase* DeviceBase::APICreateBuffer(const BufferDescriptor* descriptor) {
|
BufferBase* DeviceBase::APICreateBuffer(const BufferDescriptor* descriptor) {
|
||||||
Ref<BufferBase> result = nullptr;
|
Ref<BufferBase> result = nullptr;
|
||||||
if (ConsumedError(CreateBuffer(descriptor), &result, "calling CreateBuffer(%s).",
|
if (ConsumedError(CreateBuffer(descriptor), &result, "calling %s.CreateBuffer(%s).", this,
|
||||||
descriptor)) {
|
descriptor)) {
|
||||||
ASSERT(result == nullptr);
|
ASSERT(result == nullptr);
|
||||||
return BufferBase::MakeError(this, descriptor);
|
return BufferBase::MakeError(this, descriptor);
|
||||||
|
@ -901,7 +901,7 @@ namespace dawn_native {
|
||||||
TRACE_EVENT0(GetPlatform(), General, "DeviceBase::APICreateComputePipeline");
|
TRACE_EVENT0(GetPlatform(), General, "DeviceBase::APICreateComputePipeline");
|
||||||
Ref<ComputePipelineBase> result;
|
Ref<ComputePipelineBase> result;
|
||||||
if (ConsumedError(CreateComputePipeline(descriptor), &result,
|
if (ConsumedError(CreateComputePipeline(descriptor), &result,
|
||||||
"calling CreateComputePipeline(%s).", descriptor)) {
|
"calling %s.CreateComputePipeline(%s).", this, descriptor)) {
|
||||||
return ComputePipelineBase::MakeError(this);
|
return ComputePipelineBase::MakeError(this);
|
||||||
}
|
}
|
||||||
return result.Detach();
|
return result.Detach();
|
||||||
|
@ -925,22 +925,22 @@ namespace dawn_native {
|
||||||
const PipelineLayoutDescriptor* descriptor) {
|
const PipelineLayoutDescriptor* descriptor) {
|
||||||
Ref<PipelineLayoutBase> result;
|
Ref<PipelineLayoutBase> result;
|
||||||
if (ConsumedError(CreatePipelineLayout(descriptor), &result,
|
if (ConsumedError(CreatePipelineLayout(descriptor), &result,
|
||||||
"calling CreatePipelineLayout(%s).", descriptor)) {
|
"calling %s.CreatePipelineLayout(%s).", this, descriptor)) {
|
||||||
return PipelineLayoutBase::MakeError(this);
|
return PipelineLayoutBase::MakeError(this);
|
||||||
}
|
}
|
||||||
return result.Detach();
|
return result.Detach();
|
||||||
}
|
}
|
||||||
QuerySetBase* DeviceBase::APICreateQuerySet(const QuerySetDescriptor* descriptor) {
|
QuerySetBase* DeviceBase::APICreateQuerySet(const QuerySetDescriptor* descriptor) {
|
||||||
Ref<QuerySetBase> result;
|
Ref<QuerySetBase> result;
|
||||||
if (ConsumedError(CreateQuerySet(descriptor), &result, "calling CreateQuerySet(%s).",
|
if (ConsumedError(CreateQuerySet(descriptor), &result, "calling %s.CreateQuerySet(%s).",
|
||||||
descriptor)) {
|
this, descriptor)) {
|
||||||
return QuerySetBase::MakeError(this);
|
return QuerySetBase::MakeError(this);
|
||||||
}
|
}
|
||||||
return result.Detach();
|
return result.Detach();
|
||||||
}
|
}
|
||||||
SamplerBase* DeviceBase::APICreateSampler(const SamplerDescriptor* descriptor) {
|
SamplerBase* DeviceBase::APICreateSampler(const SamplerDescriptor* descriptor) {
|
||||||
Ref<SamplerBase> result;
|
Ref<SamplerBase> result;
|
||||||
if (ConsumedError(CreateSampler(descriptor), &result, "calling CreateSampler(%s).",
|
if (ConsumedError(CreateSampler(descriptor), &result, "calling %s.CreateSampler(%s).", this,
|
||||||
descriptor)) {
|
descriptor)) {
|
||||||
return SamplerBase::MakeError(this);
|
return SamplerBase::MakeError(this);
|
||||||
}
|
}
|
||||||
|
@ -966,7 +966,7 @@ namespace dawn_native {
|
||||||
const RenderBundleEncoderDescriptor* descriptor) {
|
const RenderBundleEncoderDescriptor* descriptor) {
|
||||||
Ref<RenderBundleEncoder> result;
|
Ref<RenderBundleEncoder> result;
|
||||||
if (ConsumedError(CreateRenderBundleEncoder(descriptor), &result,
|
if (ConsumedError(CreateRenderBundleEncoder(descriptor), &result,
|
||||||
"calling CreateRenderBundleEncoder(%s).", descriptor)) {
|
"calling %s.CreateRenderBundleEncoder(%s).", this, descriptor)) {
|
||||||
return RenderBundleEncoder::MakeError(this);
|
return RenderBundleEncoder::MakeError(this);
|
||||||
}
|
}
|
||||||
return result.Detach();
|
return result.Detach();
|
||||||
|
@ -976,7 +976,7 @@ namespace dawn_native {
|
||||||
TRACE_EVENT0(GetPlatform(), General, "DeviceBase::APICreateRenderPipeline");
|
TRACE_EVENT0(GetPlatform(), General, "DeviceBase::APICreateRenderPipeline");
|
||||||
Ref<RenderPipelineBase> result;
|
Ref<RenderPipelineBase> result;
|
||||||
if (ConsumedError(CreateRenderPipeline(descriptor), &result,
|
if (ConsumedError(CreateRenderPipeline(descriptor), &result,
|
||||||
"calling CreateRenderPipeline(%s).", descriptor)) {
|
"calling %s.CreateRenderPipeline(%s).", this, descriptor)) {
|
||||||
return RenderPipelineBase::MakeError(this);
|
return RenderPipelineBase::MakeError(this);
|
||||||
}
|
}
|
||||||
return result.Detach();
|
return result.Detach();
|
||||||
|
@ -987,7 +987,7 @@ namespace dawn_native {
|
||||||
std::unique_ptr<OwnedCompilationMessages> compilationMessages(
|
std::unique_ptr<OwnedCompilationMessages> compilationMessages(
|
||||||
std::make_unique<OwnedCompilationMessages>());
|
std::make_unique<OwnedCompilationMessages>());
|
||||||
if (ConsumedError(CreateShaderModule(descriptor, compilationMessages.get()), &result,
|
if (ConsumedError(CreateShaderModule(descriptor, compilationMessages.get()), &result,
|
||||||
"calling CreateShaderModule(%s).", descriptor)) {
|
"calling %s.CreateShaderModule(%s).", this, descriptor)) {
|
||||||
DAWN_ASSERT(result == nullptr);
|
DAWN_ASSERT(result == nullptr);
|
||||||
result = ShaderModuleBase::MakeError(this);
|
result = ShaderModuleBase::MakeError(this);
|
||||||
}
|
}
|
||||||
|
@ -1001,14 +1001,14 @@ namespace dawn_native {
|
||||||
const SwapChainDescriptor* descriptor) {
|
const SwapChainDescriptor* descriptor) {
|
||||||
Ref<SwapChainBase> result;
|
Ref<SwapChainBase> result;
|
||||||
if (ConsumedError(CreateSwapChain(surface, descriptor), &result,
|
if (ConsumedError(CreateSwapChain(surface, descriptor), &result,
|
||||||
"calling CreateSwapChain(%s).", descriptor)) {
|
"calling %s.CreateSwapChain(%s).", this, descriptor)) {
|
||||||
return SwapChainBase::MakeError(this);
|
return SwapChainBase::MakeError(this);
|
||||||
}
|
}
|
||||||
return result.Detach();
|
return result.Detach();
|
||||||
}
|
}
|
||||||
TextureBase* DeviceBase::APICreateTexture(const TextureDescriptor* descriptor) {
|
TextureBase* DeviceBase::APICreateTexture(const TextureDescriptor* descriptor) {
|
||||||
Ref<TextureBase> result;
|
Ref<TextureBase> result;
|
||||||
if (ConsumedError(CreateTexture(descriptor), &result, "calling CreateTexture(%s).",
|
if (ConsumedError(CreateTexture(descriptor), &result, "calling %s.CreateTexture(%s).", this,
|
||||||
descriptor)) {
|
descriptor)) {
|
||||||
return TextureBase::MakeError(this);
|
return TextureBase::MakeError(this);
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1077,7 @@ namespace dawn_native {
|
||||||
const ExternalTextureDescriptor* descriptor) {
|
const ExternalTextureDescriptor* descriptor) {
|
||||||
Ref<ExternalTextureBase> result = nullptr;
|
Ref<ExternalTextureBase> result = nullptr;
|
||||||
if (ConsumedError(CreateExternalTexture(descriptor), &result,
|
if (ConsumedError(CreateExternalTexture(descriptor), &result,
|
||||||
"calling CreateExternalTexture(%s).", descriptor)) {
|
"calling %s.CreateExternalTexture(%s).", this, descriptor)) {
|
||||||
return ExternalTextureBase::MakeError(this);
|
return ExternalTextureBase::MakeError(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,9 @@ namespace dawn_native {
|
||||||
absl::UntypedFormatSpec format(formatStr);
|
absl::UntypedFormatSpec format(formatStr);
|
||||||
if (absl::FormatUntyped(&out, format, {absl::FormatArg(args)...})) {
|
if (absl::FormatUntyped(&out, format, {absl::FormatArg(args)...})) {
|
||||||
error->AppendContext(std::move(out));
|
error->AppendContext(std::move(out));
|
||||||
|
} else {
|
||||||
|
error->AppendContext(
|
||||||
|
absl::StrFormat("[Failed to format error: \"%s\"]", formatStr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConsumeError(std::move(error));
|
ConsumeError(std::move(error));
|
||||||
|
@ -108,6 +111,9 @@ namespace dawn_native {
|
||||||
absl::UntypedFormatSpec format(formatStr);
|
absl::UntypedFormatSpec format(formatStr);
|
||||||
if (absl::FormatUntyped(&out, format, {absl::FormatArg(args)...})) {
|
if (absl::FormatUntyped(&out, format, {absl::FormatArg(args)...})) {
|
||||||
error->AppendContext(std::move(out));
|
error->AppendContext(std::move(out));
|
||||||
|
} else {
|
||||||
|
error->AppendContext(
|
||||||
|
absl::StrFormat("[Failed to format error: \"%s\"]", formatStr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConsumeError(std::move(error));
|
ConsumeError(std::move(error));
|
||||||
|
|
|
@ -62,6 +62,9 @@ namespace dawn_native {
|
||||||
absl::UntypedFormatSpec format(formatStr);
|
absl::UntypedFormatSpec format(formatStr);
|
||||||
if (absl::FormatUntyped(&out, format, {absl::FormatArg(args)...})) {
|
if (absl::FormatUntyped(&out, format, {absl::FormatArg(args)...})) {
|
||||||
error->AppendContext(std::move(out));
|
error->AppendContext(std::move(out));
|
||||||
|
} else {
|
||||||
|
error->AppendContext(absl::StrFormat(
|
||||||
|
"[Failed to format error message: \"%s\"].", formatStr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HandleError(std::move(error));
|
HandleError(std::move(error));
|
||||||
|
|
|
@ -73,23 +73,23 @@ namespace dawn_native {
|
||||||
|
|
||||||
std::string ErrorData::GetFormattedMessage() const {
|
std::string ErrorData::GetFormattedMessage() const {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << mMessage;
|
ss << mMessage << "\n";
|
||||||
|
|
||||||
if (!mContexts.empty()) {
|
if (!mContexts.empty()) {
|
||||||
for (auto context : mContexts) {
|
for (auto context : mContexts) {
|
||||||
ss << "\n - While " << context;
|
ss << " - While " << context << "\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (const auto& callsite : mBacktrace) {
|
for (const auto& callsite : mBacktrace) {
|
||||||
ss << "\n at " << callsite.function << " (" << callsite.file << ":"
|
ss << " at " << callsite.function << " (" << callsite.file << ":"
|
||||||
<< callsite.line << ")";
|
<< callsite.line << ")\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mDebugGroups.empty()) {
|
if (!mDebugGroups.empty()) {
|
||||||
ss << "\n\nDebug group stack: ";
|
ss << "\nDebug group stack:\n";
|
||||||
for (auto label : mDebugGroups) {
|
for (auto label : mDebugGroups) {
|
||||||
ss << "\n > \"" << label << "\"";
|
ss << " > \"" << label << "\"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding InsertDebugMarker(\"%s\")", groupLabel);
|
"encoding %s.InsertDebugMarker(\"%s\").", this, groupLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgrammablePassEncoder::APIPopDebugGroup() {
|
void ProgrammablePassEncoder::APIPopDebugGroup() {
|
||||||
|
@ -92,7 +92,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding PopDebugGroup()");
|
"encoding %s.PopDebugGroup().", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgrammablePassEncoder::APIPushDebugGroup(const char* groupLabel) {
|
void ProgrammablePassEncoder::APIPushDebugGroup(const char* groupLabel) {
|
||||||
|
@ -111,7 +111,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding PushDebugGroup(\"%s\")", groupLabel);
|
"encoding %s.PushDebugGroup(\"%s\").", this, groupLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError ProgrammablePassEncoder::ValidateSetBindGroup(
|
MaybeError ProgrammablePassEncoder::ValidateSetBindGroup(
|
||||||
|
|
|
@ -123,8 +123,8 @@ namespace dawn_native {
|
||||||
RenderBundleBase* RenderBundleEncoder::APIFinish(const RenderBundleDescriptor* descriptor) {
|
RenderBundleBase* RenderBundleEncoder::APIFinish(const RenderBundleDescriptor* descriptor) {
|
||||||
RenderBundleBase* result = nullptr;
|
RenderBundleBase* result = nullptr;
|
||||||
|
|
||||||
if (GetDevice()->ConsumedError(FinishImpl(descriptor), &result, "calling Finish(%s).",
|
if (GetDevice()->ConsumedError(FinishImpl(descriptor), &result, "calling %s.Finish(%s).",
|
||||||
descriptor)) {
|
this, descriptor)) {
|
||||||
return RenderBundleBase::MakeError(GetDevice());
|
return RenderBundleBase::MakeError(GetDevice());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding Draw(%u, %u, %u, %u).", vertexCount, instanceCount, firstVertex,
|
"encoding %s.Draw(%u, %u, %u, %u).", this, vertexCount, instanceCount, firstVertex,
|
||||||
firstInstance);
|
firstInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,8 +140,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding DrawIndexed(%u, %u, %u, %i, %u).", indexCount, instanceCount, firstIndex,
|
"encoding %s.DrawIndexed(%u, %u, %u, %i, %u).", this, indexCount, instanceCount,
|
||||||
baseVertex, firstInstance);
|
firstIndex, baseVertex, firstInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderEncoderBase::APIDrawIndirect(BufferBase* indirectBuffer, uint64_t indirectOffset) {
|
void RenderEncoderBase::APIDrawIndirect(BufferBase* indirectBuffer, uint64_t indirectOffset) {
|
||||||
|
@ -171,7 +171,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding DrawIndirect(%s, %u).", indirectBuffer, indirectOffset);
|
"encoding %s.DrawIndirect(%s, %u).", this, indirectBuffer, indirectOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderEncoderBase::APIDrawIndexedIndirect(BufferBase* indirectBuffer,
|
void RenderEncoderBase::APIDrawIndexedIndirect(BufferBase* indirectBuffer,
|
||||||
|
@ -220,7 +220,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding DrawIndexedIndirect(%s, %u).", indirectBuffer, indirectOffset);
|
"encoding %s.DrawIndexedIndirect(%s, %u).", this, indirectBuffer, indirectOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderEncoderBase::APISetPipeline(RenderPipelineBase* pipeline) {
|
void RenderEncoderBase::APISetPipeline(RenderPipelineBase* pipeline) {
|
||||||
|
@ -254,7 +254,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding SetPipeline(%s).", pipeline);
|
"encoding %s.SetPipeline(%s).", this, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderEncoderBase::APISetIndexBuffer(BufferBase* buffer,
|
void RenderEncoderBase::APISetIndexBuffer(BufferBase* buffer,
|
||||||
|
@ -325,7 +325,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding SetIndexBuffer(%s, %s, %u, %u).", buffer, format, offset, size);
|
"encoding %s.SetIndexBuffer(%s, %s, %u, %u).", this, buffer, format, offset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderEncoderBase::APISetVertexBuffer(uint32_t slot,
|
void RenderEncoderBase::APISetVertexBuffer(uint32_t slot,
|
||||||
|
@ -393,7 +393,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding SetVertexBuffer(%u, %s, %u, %u).", slot, buffer, offset, size);
|
"encoding %s.SetVertexBuffer(%u, %s, %u, %u).", this, slot, buffer, offset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderEncoderBase::APISetBindGroup(uint32_t groupIndexIn,
|
void RenderEncoderBase::APISetBindGroup(uint32_t groupIndexIn,
|
||||||
|
@ -418,7 +418,8 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding SetBindGroup(%u, %s, %u).", groupIndexIn, group, dynamicOffsetCount);
|
"encoding %s.SetBindGroup(%u, %s, %u, ...).", this, groupIndexIn, group,
|
||||||
|
dynamicOffsetCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dawn_native
|
} // namespace dawn_native
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace dawn_native {
|
||||||
std::move(mIndirectDrawMetadata)));
|
std::move(mIndirectDrawMetadata)));
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding EndPass().")) {
|
"encoding %s.EndPass().", this)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding SetStencilReference(%u)", reference);
|
"encoding %s.SetStencilReference(%u).", this, reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::APISetBlendConstant(const Color* color) {
|
void RenderPassEncoder::APISetBlendConstant(const Color* color) {
|
||||||
|
@ -144,7 +144,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding SetBlendConstant(%s).", color);
|
"encoding %s.SetBlendConstant(%s).", this, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::APISetViewport(float x,
|
void RenderPassEncoder::APISetViewport(float x,
|
||||||
|
@ -195,7 +195,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding SetViewport(%f, %f, %f, %f, %f, %f).", x, y, width, height, minDepth,
|
"encoding %s.SetViewport(%f, %f, %f, %f, %f, %f).", this, x, y, width, height, minDepth,
|
||||||
maxDepth);
|
maxDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding SetScissorRect(%u, %u, %u, %u).", x, y, width, height);
|
"encoding %s.SetScissorRect(%u, %u, %u, %u).", this, x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::APIExecuteBundles(uint32_t count,
|
void RenderPassEncoder::APIExecuteBundles(uint32_t count,
|
||||||
|
@ -290,7 +290,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding ExecuteBundles(%u, ...)", count);
|
"encoding %s.ExecuteBundles(%u, ...).", this, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::APIBeginOcclusionQuery(uint32_t queryIndex) {
|
void RenderPassEncoder::APIBeginOcclusionQuery(uint32_t queryIndex) {
|
||||||
|
@ -330,7 +330,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding BeginOcclusionQuery(%u)", queryIndex);
|
"encoding %s.BeginOcclusionQuery(%u).", this, queryIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::APIEndOcclusionQuery() {
|
void RenderPassEncoder::APIEndOcclusionQuery() {
|
||||||
|
@ -352,7 +352,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding EndOcclusionQuery()");
|
"encoding %s.EndOcclusionQuery().", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPassEncoder::APIWriteTimestamp(QuerySetBase* querySet, uint32_t queryIndex) {
|
void RenderPassEncoder::APIWriteTimestamp(QuerySetBase* querySet, uint32_t queryIndex) {
|
||||||
|
@ -377,7 +377,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
"encoding WriteTimestamp(%s, %u).", querySet, queryIndex);
|
"encoding %s.WriteTimestamp(%s, %u).", this, querySet, queryIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dawn_native
|
} // namespace dawn_native
|
||||||
|
|
Loading…
Reference in New Issue