Merge DAWN_FORMAT_VALIDATION_ERROR in DAWN_VALIDATION_ERROR.
Done with changes to Error.h and the following command:
git grep -l DAWN_FORMAT_VALIDATION_ERROR | xargs sed -i "" "s/DAWN_FORMAT_VALIDATION_ERROR/DAWN_VALIDATION_ERROR/"
then fixing compilation errors in ErrorTests.cpp, Pipeline.cpp and
CommandEncoder.cpp.
Bug: dawn:563
Change-Id: I081a514d662e81f4842b6d7fadfcea67c12720d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100468
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/generator/templates/dawn/native/ValidationUtils.cpp b/generator/templates/dawn/native/ValidationUtils.cpp
index a5efb01..9c170b7 100644
--- a/generator/templates/dawn/native/ValidationUtils.cpp
+++ b/generator/templates/dawn/native/ValidationUtils.cpp
@@ -29,7 +29,7 @@
return {};
{% endfor %}
default:
- return DAWN_FORMAT_VALIDATION_ERROR("Value %i is invalid for {{as_cType(type.name)}}.", static_cast<uint32_t>(value));
+ return DAWN_VALIDATION_ERROR("Value %i is invalid for {{as_cType(type.name)}}.", static_cast<uint32_t>(value));
}
}
@@ -40,7 +40,7 @@
if ((value & static_cast<{{namespace}}::{{as_cppType(type.name)}}>(~{{type.full_mask}})) == 0) {
return {};
}
- return DAWN_FORMAT_VALIDATION_ERROR("Value %i is invalid for {{as_cType(type.name)}}.", static_cast<uint32_t>(value));
+ return DAWN_VALIDATION_ERROR("Value %i is invalid for {{as_cType(type.name)}}.", static_cast<uint32_t>(value));
}
{% endfor %}
diff --git a/src/dawn/native/BackendConnection.cpp b/src/dawn/native/BackendConnection.cpp
index 0c54731..8dcd19f 100644
--- a/src/dawn/native/BackendConnection.cpp
+++ b/src/dawn/native/BackendConnection.cpp
@@ -29,7 +29,7 @@
ResultOrError<std::vector<Ref<AdapterBase>>> BackendConnection::DiscoverAdapters(
const AdapterDiscoveryOptionsBase* options) {
- return DAWN_FORMAT_VALIDATION_ERROR("DiscoverAdapters not implemented for this backend.");
+ return DAWN_VALIDATION_ERROR("DiscoverAdapters not implemented for this backend.");
}
} // namespace dawn::native
diff --git a/src/dawn/native/BindGroupLayout.cpp b/src/dawn/native/BindGroupLayout.cpp
index b57cd69..ae4f071 100644
--- a/src/dawn/native/BindGroupLayout.cpp
+++ b/src/dawn/native/BindGroupLayout.cpp
@@ -48,8 +48,8 @@
switch (dimension) {
case wgpu::TextureViewDimension::Cube:
case wgpu::TextureViewDimension::CubeArray:
- return DAWN_FORMAT_VALIDATION_ERROR(
- "%s texture views cannot be used as storage textures.", dimension);
+ return DAWN_VALIDATION_ERROR("%s texture views cannot be used as storage textures.",
+ dimension);
case wgpu::TextureViewDimension::e1D:
case wgpu::TextureViewDimension::e2D:
diff --git a/src/dawn/native/Buffer.cpp b/src/dawn/native/Buffer.cpp
index b9b2e3d..3c0f4e1 100644
--- a/src/dawn/native/Buffer.cpp
+++ b/src/dawn/native/Buffer.cpp
@@ -292,10 +292,10 @@
switch (mState) {
case BufferState::Destroyed:
- return DAWN_FORMAT_VALIDATION_ERROR("%s used in submit while destroyed.", this);
+ return DAWN_VALIDATION_ERROR("%s used in submit while destroyed.", this);
case BufferState::Mapped:
case BufferState::MappedAtCreation:
- return DAWN_FORMAT_VALIDATION_ERROR("%s used in submit while mapped.", this);
+ return DAWN_VALIDATION_ERROR("%s used in submit while mapped.", this);
case BufferState::Unmapped:
return {};
}
@@ -463,9 +463,9 @@
switch (mState) {
case BufferState::Mapped:
case BufferState::MappedAtCreation:
- return DAWN_FORMAT_VALIDATION_ERROR("%s is already mapped.", this);
+ return DAWN_VALIDATION_ERROR("%s is already mapped.", this);
case BufferState::Destroyed:
- return DAWN_FORMAT_VALIDATION_ERROR("%s is destroyed.", this);
+ return DAWN_VALIDATION_ERROR("%s is destroyed.", this);
case BufferState::Unmapped:
break;
}
@@ -540,9 +540,9 @@
// even if it did not have a mappable usage.
return {};
case BufferState::Unmapped:
- return DAWN_FORMAT_VALIDATION_ERROR("%s is unmapped.", this);
+ return DAWN_VALIDATION_ERROR("%s is unmapped.", this);
case BufferState::Destroyed:
- return DAWN_FORMAT_VALIDATION_ERROR("%s is destroyed.", this);
+ return DAWN_VALIDATION_ERROR("%s is destroyed.", this);
}
UNREACHABLE();
}
diff --git a/src/dawn/native/CommandBufferStateTracker.cpp b/src/dawn/native/CommandBufferStateTracker.cpp
index 3a213fe..ebf00ad 100644
--- a/src/dawn/native/CommandBufferStateTracker.cpp
+++ b/src/dawn/native/CommandBufferStateTracker.cpp
@@ -297,7 +297,7 @@
// because to have invalid aspects one of the above conditions must have failed earlier.
// If this is reached, make sure lazy aspects and the error checks above are consistent.
UNREACHABLE();
- return DAWN_FORMAT_VALIDATION_ERROR("Index buffer is invalid.");
+ return DAWN_VALIDATION_ERROR("Index buffer is invalid.");
}
// TODO(dawn:563): Indicate which slots were not set.
@@ -355,7 +355,7 @@
// because to have invalid aspects one of the above conditions must have failed earlier.
// If this is reached, make sure lazy aspects and the error checks above are consistent.
UNREACHABLE();
- return DAWN_FORMAT_VALIDATION_ERROR("Bind groups are invalid.");
+ return DAWN_VALIDATION_ERROR("Bind groups are invalid.");
}
UNREACHABLE();
diff --git a/src/dawn/native/CommandEncoder.cpp b/src/dawn/native/CommandEncoder.cpp
index 9bb8c0d..1ac551a 100644
--- a/src/dawn/native/CommandEncoder.cpp
+++ b/src/dawn/native/CommandEncoder.cpp
@@ -88,7 +88,7 @@
switch (src.texture->GetFormat().format) {
case wgpu::TextureFormat::Depth24Plus:
case wgpu::TextureFormat::Depth24PlusStencil8:
- return DAWN_FORMAT_VALIDATION_ERROR(
+ return DAWN_VALIDATION_ERROR(
"The depth aspect of %s format %s cannot be selected in a texture to "
"buffer copy.",
src.texture, src.texture->GetFormat().format);
@@ -734,7 +734,7 @@
: ApiObjectBase(device, tag),
mEncodingContext(device, this),
mUsageValidationMode(UsageValidationMode::Default) {
- mEncodingContext.HandleError(DAWN_FORMAT_VALIDATION_ERROR("%s is invalid.", this));
+ mEncodingContext.HandleError(DAWN_VALIDATION_ERROR("%s is invalid.", this));
}
ObjectType CommandEncoder::GetType() const {
@@ -1300,7 +1300,7 @@
void CommandEncoder::APIInjectValidationError(const char* message) {
if (mEncodingContext.CheckCurrentEncoder(this)) {
- mEncodingContext.HandleError(DAWN_VALIDATION_ERROR(message));
+ mEncodingContext.HandleError(DAWN_MAKE_ERROR(InternalErrorType::Validation, message));
}
}
diff --git a/src/dawn/native/CommandValidation.cpp b/src/dawn/native/CommandValidation.cpp
index d0bdb0c..a3929f3 100644
--- a/src/dawn/native/CommandValidation.cpp
+++ b/src/dawn/native/CommandValidation.cpp
@@ -55,7 +55,7 @@
bool readOnly = IsSubset(usage, kReadOnlyTextureUsages);
bool singleUse = wgpu::HasZeroOrOneBits(usage);
if (!readOnly && !singleUse && !error.IsError()) {
- error = DAWN_FORMAT_VALIDATION_ERROR(
+ error = DAWN_VALIDATION_ERROR(
"%s usage (%s) includes writable usage and another usage in the same "
"synchronization scope.",
scope.textures[i], usage);
@@ -420,7 +420,7 @@
switch (src.texture->GetDimension()) {
case wgpu::TextureDimension::e1D:
ASSERT(src.mipLevel == 0 && src.origin.z == 0 && dst.origin.z == 0);
- return DAWN_FORMAT_VALIDATION_ERROR("Copy is from %s to itself.", src.texture);
+ return DAWN_VALIDATION_ERROR("Copy is from %s to itself.", src.texture);
case wgpu::TextureDimension::e2D:
DAWN_INVALID_IF(
diff --git a/src/dawn/native/ComputePipeline.cpp b/src/dawn/native/ComputePipeline.cpp
index b0b574d..eca8467 100644
--- a/src/dawn/native/ComputePipeline.cpp
+++ b/src/dawn/native/ComputePipeline.cpp
@@ -23,7 +23,7 @@
MaybeError ValidateComputePipelineDescriptor(DeviceBase* device,
const ComputePipelineDescriptor* descriptor) {
if (descriptor->nextInChain != nullptr) {
- return DAWN_FORMAT_VALIDATION_ERROR("nextInChain must be nullptr.");
+ return DAWN_VALIDATION_ERROR("nextInChain must be nullptr.");
}
if (descriptor->layout != nullptr) {
diff --git a/src/dawn/native/CopyTextureForBrowserHelper.cpp b/src/dawn/native/CopyTextureForBrowserHelper.cpp
index f8cece1..d7890ed 100644
--- a/src/dawn/native/CopyTextureForBrowserHelper.cpp
+++ b/src/dawn/native/CopyTextureForBrowserHelper.cpp
@@ -242,8 +242,7 @@
case wgpu::TextureFormat::RGBA16Float:
break;
default:
- return DAWN_FORMAT_VALIDATION_ERROR("Source texture format (%s) is not supported.",
- srcFormat);
+ return DAWN_VALIDATION_ERROR("Source texture format (%s) is not supported.", srcFormat);
}
switch (dstFormat) {
@@ -262,8 +261,8 @@
case wgpu::TextureFormat::RGBA32Float:
break;
default:
- return DAWN_FORMAT_VALIDATION_ERROR("Destination texture format (%s) is not supported.",
- dstFormat);
+ return DAWN_VALIDATION_ERROR("Destination texture format (%s) is not supported.",
+ dstFormat);
}
return {};
diff --git a/src/dawn/native/EncodingContext.cpp b/src/dawn/native/EncodingContext.cpp
index d222927..9b7f367 100644
--- a/src/dawn/native/EncodingContext.cpp
+++ b/src/dawn/native/EncodingContext.cpp
@@ -44,7 +44,7 @@
// If we weren't already finished, then we want to handle an error here so that any calls
// to Finish after Destroy will return a meaningful error.
if (!IsFinished()) {
- HandleError(DAWN_FORMAT_VALIDATION_ERROR("Destroyed encoder cannot be finished."));
+ HandleError(DAWN_VALIDATION_ERROR("Destroyed encoder cannot be finished."));
}
mDestroyed = true;
mCurrentEncoder = nullptr;
@@ -151,8 +151,8 @@
if (mCurrentEncoder != mTopLevelEncoder && mCurrentEncoder == passEncoder) {
// The current pass encoder is being deleted. Implicitly end the pass with an error.
mCurrentEncoder = mTopLevelEncoder;
- HandleError(DAWN_FORMAT_VALIDATION_ERROR(
- "Command buffer recording ended before %s was ended.", passEncoder));
+ HandleError(DAWN_VALIDATION_ERROR("Command buffer recording ended before %s was ended.",
+ passEncoder));
}
}
diff --git a/src/dawn/native/EncodingContext.h b/src/dawn/native/EncodingContext.h
index 020132e..3614a09 100644
--- a/src/dawn/native/EncodingContext.h
+++ b/src/dawn/native/EncodingContext.h
@@ -80,18 +80,17 @@
inline bool CheckCurrentEncoder(const ApiObjectBase* encoder) {
if (mDestroyed) {
- HandleError(
- DAWN_FORMAT_VALIDATION_ERROR("Recording in a destroyed %s.", mCurrentEncoder));
+ HandleError(DAWN_VALIDATION_ERROR("Recording in a destroyed %s.", mCurrentEncoder));
return false;
}
if (DAWN_UNLIKELY(encoder != mCurrentEncoder)) {
if (mCurrentEncoder != mTopLevelEncoder) {
// The top level encoder was used when a pass encoder was current.
- HandleError(DAWN_FORMAT_VALIDATION_ERROR(
- "Command cannot be recorded while %s is active.", mCurrentEncoder));
+ HandleError(DAWN_VALIDATION_ERROR("Command cannot be recorded while %s is active.",
+ mCurrentEncoder));
} else {
- HandleError(DAWN_FORMAT_VALIDATION_ERROR(
- "Recording in an error or already ended %s.", encoder));
+ HandleError(
+ DAWN_VALIDATION_ERROR("Recording in an error or already ended %s.", encoder));
}
return false;
}
diff --git a/src/dawn/native/Error.h b/src/dawn/native/Error.h
index 0b71644..1f12864 100644
--- a/src/dawn/native/Error.h
+++ b/src/dawn/native/Error.h
@@ -43,7 +43,7 @@
// return DAWN_MAKE_ERROR(errorType, "My error message");
//
// but shorthand version for specific error types are preferred:
-// return DAWN_VALIDATION_ERROR("My error message");
+// return DAWN_VALIDATION_ERROR("My error message with details %s", details);
//
// There are different types of errors that should be used for different purpose:
//
@@ -71,11 +71,7 @@
#define DAWN_MAKE_ERROR(TYPE, MESSAGE) \
::dawn::native::ErrorData::Create(TYPE, MESSAGE, __FILE__, __func__, __LINE__)
-#define DAWN_VALIDATION_ERROR(MESSAGE) DAWN_MAKE_ERROR(InternalErrorType::Validation, MESSAGE)
-
-// TODO(dawn:563): Rename to DAWN_VALIDATION_ERROR once all message format strings have been
-// converted to constexpr.
-#define DAWN_FORMAT_VALIDATION_ERROR(...) \
+#define DAWN_VALIDATION_ERROR(...) \
DAWN_MAKE_ERROR(InternalErrorType::Validation, absl::StrFormat(__VA_ARGS__))
#define DAWN_INVALID_IF(EXPR, ...) \
diff --git a/src/dawn/native/ExternalTexture.cpp b/src/dawn/native/ExternalTexture.cpp
index a23faa7..42a511b 100644
--- a/src/dawn/native/ExternalTexture.cpp
+++ b/src/dawn/native/ExternalTexture.cpp
@@ -91,7 +91,7 @@
DAWN_TRY(ValidateExternalTexturePlane(descriptor->plane0));
break;
default:
- return DAWN_FORMAT_VALIDATION_ERROR(
+ return DAWN_VALIDATION_ERROR(
"The external texture plane (%s) format (%s) is not a supported format "
"(%s, %s, %s).",
descriptor->plane0, plane0Format, wgpu::TextureFormat::RGBA8Unorm,
diff --git a/src/dawn/native/Instance.cpp b/src/dawn/native/Instance.cpp
index 78afd8e..4e734ca 100644
--- a/src/dawn/native/Instance.cpp
+++ b/src/dawn/native/Instance.cpp
@@ -385,7 +385,7 @@
DAWN_TRY(ValidateBackendType(backendType));
if (!GetEnabledBackends()[backendType]) {
- return DAWN_FORMAT_VALIDATION_ERROR("%s not supported.", backendType);
+ return DAWN_VALIDATION_ERROR("%s not supported.", backendType);
}
EnsureBackendConnection(backendType);
diff --git a/src/dawn/native/Pipeline.cpp b/src/dawn/native/Pipeline.cpp
index 513bd2a..50a4b9c 100644
--- a/src/dawn/native/Pipeline.cpp
+++ b/src/dawn/native/Pipeline.cpp
@@ -42,12 +42,12 @@
const EntryPointMetadata& metadata = module->GetEntryPoint(entryPoint);
if (!metadata.infringedLimitErrors.empty()) {
- std::ostringstream out;
- out << "Entry point \"" << entryPoint << "\" infringes limits:\n";
+ std::ostringstream limitList;
for (const std::string& limit : metadata.infringedLimitErrors) {
- out << " - " << limit << "\n";
+ limitList << " - " << limit << "\n";
}
- return DAWN_VALIDATION_ERROR(out.str());
+ return DAWN_VALIDATION_ERROR("Entry point \"%s\" infringes limits:\n%s", entryPoint,
+ limitList.str());
}
DAWN_INVALID_IF(metadata.stage != stage,
@@ -81,7 +81,7 @@
stageInitializedConstantIdentifiers.insert(constants[i].key);
} else {
// There are duplicate initializations
- return DAWN_FORMAT_VALIDATION_ERROR(
+ return DAWN_VALIDATION_ERROR(
"Pipeline overridable constants \"%s\" is set more than once in %s",
constants[i].key, module);
}
@@ -104,7 +104,7 @@
uninitializedConstantsArray.append(identifier);
}
- return DAWN_FORMAT_VALIDATION_ERROR(
+ return DAWN_VALIDATION_ERROR(
"There are uninitialized pipeline overridable constants in shader module %s, their "
"identifiers:[%s]",
module, uninitializedConstantsArray);
diff --git a/src/dawn/native/ProgrammableEncoder.cpp b/src/dawn/native/ProgrammableEncoder.cpp
index 29a0f03..ce3140b 100644
--- a/src/dawn/native/ProgrammableEncoder.cpp
+++ b/src/dawn/native/ProgrammableEncoder.cpp
@@ -170,7 +170,7 @@
static_cast<uint32_t>(i), dynamicOffsets[i], bufferBinding.buffer,
bufferBinding.buffer->GetSize(), bufferBinding.offset, bufferBinding.size);
- return DAWN_FORMAT_VALIDATION_ERROR(
+ return DAWN_VALIDATION_ERROR(
"Dynamic Offset[%u] (%u) is out of bounds of "
"%s with a size of %u and a bound range of (offset: %u, size: %u).",
static_cast<uint32_t>(i), dynamicOffsets[i], bufferBinding.buffer,
diff --git a/src/dawn/native/Sampler.cpp b/src/dawn/native/Sampler.cpp
index 7e436fc..5d87157 100644
--- a/src/dawn/native/Sampler.cpp
+++ b/src/dawn/native/Sampler.cpp
@@ -46,8 +46,8 @@
descriptor->magFilter, descriptor->minFilter, descriptor->mipmapFilter,
wgpu::FilterMode::Linear, descriptor->maxAnisotropy);
} else if (descriptor->maxAnisotropy == 0u) {
- return DAWN_FORMAT_VALIDATION_ERROR("Max anisotropy (%f) is less than 1.",
- descriptor->maxAnisotropy);
+ return DAWN_VALIDATION_ERROR("Max anisotropy (%f) is less than 1.",
+ descriptor->maxAnisotropy);
}
DAWN_TRY(ValidateFilterMode(descriptor->minFilter));
diff --git a/src/dawn/native/ShaderModule.cpp b/src/dawn/native/ShaderModule.cpp
index c9871e8..6769f7e 100644
--- a/src/dawn/native/ShaderModule.cpp
+++ b/src/dawn/native/ShaderModule.cpp
@@ -299,13 +299,12 @@
outMessages->AddMessages(program.Diagnostics());
}
if (!program.IsValid()) {
- return DAWN_FORMAT_VALIDATION_ERROR("Tint WGSL reader failure: %s\n",
- program.Diagnostics().str());
+ return DAWN_VALIDATION_ERROR("Tint WGSL reader failure: %s\n", program.Diagnostics().str());
}
return std::move(program);
#else
- return DAWN_FORMAT_VALIDATION_ERROR("TINT_BUILD_WGSL_READER is not defined.");
+ return DAWN_VALIDATION_ERROR("TINT_BUILD_WGSL_READER is not defined.");
#endif
}
@@ -317,13 +316,13 @@
outMessages->AddMessages(program.Diagnostics());
}
if (!program.IsValid()) {
- return DAWN_FORMAT_VALIDATION_ERROR("Tint SPIR-V reader failure:\nParser: %s\n",
- program.Diagnostics().str());
+ return DAWN_VALIDATION_ERROR("Tint SPIR-V reader failure:\nParser: %s\n",
+ program.Diagnostics().str());
}
return std::move(program);
#else
- return DAWN_FORMAT_VALIDATION_ERROR("TINT_BUILD_SPV_READER is not defined.");
+ return DAWN_VALIDATION_ERROR("TINT_BUILD_SPV_READER is not defined.");
#endif
}
diff --git a/src/dawn/native/Surface.cpp b/src/dawn/native/Surface.cpp
index 6822dbb..39b0cbb 100644
--- a/src/dawn/native/Surface.cpp
+++ b/src/dawn/native/Surface.cpp
@@ -162,7 +162,7 @@
}
#endif // defined(DAWN_USE_X11)
- return DAWN_FORMAT_VALIDATION_ERROR("Unsupported sType (%s)", descriptor->nextInChain->sType);
+ return DAWN_VALIDATION_ERROR("Unsupported sType (%s)", descriptor->nextInChain->sType);
}
// static
diff --git a/src/dawn/native/SwapChain.cpp b/src/dawn/native/SwapChain.cpp
index 1908929..60cd62b 100644
--- a/src/dawn/native/SwapChain.cpp
+++ b/src/dawn/native/SwapChain.cpp
@@ -35,16 +35,16 @@
wgpu::TextureUsage allowedUsage,
uint32_t width,
uint32_t height) override {
- GetDevice()->ConsumedError(DAWN_FORMAT_VALIDATION_ERROR("%s is an error swapchain.", this));
+ GetDevice()->ConsumedError(DAWN_VALIDATION_ERROR("%s is an error swapchain.", this));
}
TextureViewBase* APIGetCurrentTextureView() override {
- GetDevice()->ConsumedError(DAWN_FORMAT_VALIDATION_ERROR("%s is an error swapchain.", this));
+ GetDevice()->ConsumedError(DAWN_VALIDATION_ERROR("%s is an error swapchain.", this));
return TextureViewBase::MakeError(GetDevice());
}
void APIPresent() override {
- GetDevice()->ConsumedError(DAWN_FORMAT_VALIDATION_ERROR("%s is an error swapchain.", this));
+ GetDevice()->ConsumedError(DAWN_VALIDATION_ERROR("%s is an error swapchain.", this));
}
};
@@ -301,7 +301,7 @@
uint32_t width,
uint32_t height) {
GetDevice()->ConsumedError(
- DAWN_FORMAT_VALIDATION_ERROR("Configure is invalid for surface-based swapchains."));
+ DAWN_VALIDATION_ERROR("Configure is invalid for surface-based swapchains."));
}
TextureViewBase* NewSwapChainBase::APIGetCurrentTextureView() {
diff --git a/src/dawn/native/Texture.cpp b/src/dawn/native/Texture.cpp
index d170bff..7efbbf8 100644
--- a/src/dawn/native/Texture.cpp
+++ b/src/dawn/native/Texture.cpp
@@ -54,7 +54,7 @@
if (viewFormat.format == aspectFormat) {
return {};
} else {
- return DAWN_FORMAT_VALIDATION_ERROR(
+ return DAWN_VALIDATION_ERROR(
"The view format (%s) is not compatible with %s of %s (%s).", viewFormat.format,
aspect, format.format, aspectFormat);
}
@@ -78,7 +78,7 @@
// The view format isn't compatible with the format at all. Return an error
// that indicates this, in addition to reporting that it's missing from the
// list.
- return DAWN_FORMAT_VALIDATION_ERROR(
+ return DAWN_VALIDATION_ERROR(
"The texture view format (%s) is not compatible with the "
"texture format (%s)."
"The formats must be compatible, and the view format "
@@ -86,7 +86,7 @@
viewFormat.format, format.format);
} else {
// The view format is compatible, but not in the list.
- return DAWN_FORMAT_VALIDATION_ERROR(
+ return DAWN_VALIDATION_ERROR(
"%s was not created with the texture view format (%s) "
"in the list of compatible view formats.",
texture, viewFormat.format);
diff --git a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
index ce83dbe..9e1b9e9 100644
--- a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
+++ b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
@@ -282,8 +282,8 @@
ComPtr<IDxcBlobEncoding> errors;
DAWN_TRY(CheckHRESULT(result->GetErrorBuffer(&errors), "DXC get error buffer"));
- return DAWN_FORMAT_VALIDATION_ERROR("DXC compile failed with: %s",
- static_cast<char*>(errors->GetBufferPointer()));
+ return DAWN_VALIDATION_ERROR("DXC compile failed with: %s",
+ static_cast<char*>(errors->GetBufferPointer()));
}
ComPtr<IDxcBlob> compiledShader;
@@ -447,15 +447,14 @@
*remappedEntryPointName = r.entryPointName;
}
} else {
- return DAWN_FORMAT_VALIDATION_ERROR("Transform output missing renamer data.");
+ return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
}
if (r.stage == SingleShaderStage::Vertex) {
if (auto* data = transformOutputs.Get<tint::transform::FirstIndexOffset::Data>()) {
*usesVertexOrInstanceIndex = data->has_vertex_or_instance_index;
} else {
- return DAWN_FORMAT_VALIDATION_ERROR(
- "Transform output missing first index offset data.");
+ return DAWN_VALIDATION_ERROR("Transform output missing first index offset data.");
}
}
diff --git a/src/dawn/native/d3d12/TextureD3D12.cpp b/src/dawn/native/d3d12/TextureD3D12.cpp
index 41bc0a0..1d0e6d4 100644
--- a/src/dawn/native/d3d12/TextureD3D12.cpp
+++ b/src/dawn/native/d3d12/TextureD3D12.cpp
@@ -490,7 +490,7 @@
break;
}
- return DAWN_FORMAT_VALIDATION_ERROR("DXGI format does not support cross-API sharing.");
+ return DAWN_VALIDATION_ERROR("DXGI format does not support cross-API sharing.");
}
// static
diff --git a/src/dawn/native/metal/ShaderModuleMTL.mm b/src/dawn/native/metal/ShaderModuleMTL.mm
index 5a72f30..5d4196b 100644
--- a/src/dawn/native/metal/ShaderModuleMTL.mm
+++ b/src/dawn/native/metal/ShaderModuleMTL.mm
@@ -227,7 +227,7 @@
remappedEntryPointName = r.entryPointName;
}
} else {
- return DAWN_FORMAT_VALIDATION_ERROR("Transform output missing renamer data.");
+ return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
}
tint::writer::msl::Options options;
@@ -335,8 +335,8 @@
error:&error]);
if (error != nullptr) {
if (error.code != MTLLibraryErrorCompileWarning) {
- return DAWN_FORMAT_VALIDATION_ERROR(
- "Function compile error: %s", [error.localizedDescription UTF8String]);
+ return DAWN_VALIDATION_ERROR("Function compile error: %s",
+ [error.localizedDescription UTF8String]);
}
}
ASSERT(out->function != nil);
diff --git a/src/dawn/native/metal/TextureMTL.mm b/src/dawn/native/metal/TextureMTL.mm
index a508b65..98d4f31 100644
--- a/src/dawn/native/metal/TextureMTL.mm
+++ b/src/dawn/native/metal/TextureMTL.mm
@@ -197,7 +197,7 @@
case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
return wgpu::TextureFormat::R8BG8Biplanar420Unorm;
default:
- return DAWN_FORMAT_VALIDATION_ERROR("Unsupported IOSurface format (%x).", format);
+ return DAWN_VALIDATION_ERROR("Unsupported IOSurface format (%x).", format);
}
}
diff --git a/src/dawn/native/opengl/DeviceGL.cpp b/src/dawn/native/opengl/DeviceGL.cpp
index 35ff4ef..4246d5f 100644
--- a/src/dawn/native/opengl/DeviceGL.cpp
+++ b/src/dawn/native/opengl/DeviceGL.cpp
@@ -299,7 +299,7 @@
Surface* surface,
NewSwapChainBase* previousSwapChain,
const SwapChainDescriptor* descriptor) {
- return DAWN_FORMAT_VALIDATION_ERROR("New swapchains not implemented.");
+ return DAWN_VALIDATION_ERROR("New swapchains not implemented.");
}
ResultOrError<Ref<TextureBase>> Device::CreateTextureImpl(const TextureDescriptor* descriptor) {
return AcquireRef(new Texture(this, descriptor));
@@ -364,7 +364,7 @@
if (textureDescriptor->size.width != static_cast<uint32_t>(width) ||
textureDescriptor->size.height != static_cast<uint32_t>(height) ||
textureDescriptor->size.depthOrArrayLayers != 1) {
- ConsumedError(DAWN_FORMAT_VALIDATION_ERROR(
+ ConsumedError(DAWN_VALIDATION_ERROR(
"EGLImage size (width: %u, height: %u, depth: 1) doesn't match descriptor size %s.",
width, height, &textureDescriptor->size));
gl.DeleteTextures(1, &tex);
diff --git a/src/dawn/native/opengl/PipelineGL.cpp b/src/dawn/native/opengl/PipelineGL.cpp
index 701102c..2226be9 100644
--- a/src/dawn/native/opengl/PipelineGL.cpp
+++ b/src/dawn/native/opengl/PipelineGL.cpp
@@ -82,7 +82,7 @@
if (infoLogLength > 1) {
std::vector<char> buffer(infoLogLength);
gl.GetProgramInfoLog(mProgram, infoLogLength, nullptr, &buffer[0]);
- return DAWN_FORMAT_VALIDATION_ERROR("Program link failed:\n%s", buffer.data());
+ return DAWN_VALIDATION_ERROR("Program link failed:\n%s", buffer.data());
}
}
diff --git a/src/dawn/native/opengl/ShaderModuleGL.cpp b/src/dawn/native/opengl/ShaderModuleGL.cpp
index 6c427ee..172d401 100644
--- a/src/dawn/native/opengl/ShaderModuleGL.cpp
+++ b/src/dawn/native/opengl/ShaderModuleGL.cpp
@@ -264,8 +264,8 @@
std::vector<char> buffer(infoLogLength);
gl.GetShaderInfoLog(shader, infoLogLength, nullptr, &buffer[0]);
gl.DeleteShader(shader);
- return DAWN_FORMAT_VALIDATION_ERROR("%s\nProgram compilation failed:\n%s", source,
- buffer.data());
+ return DAWN_VALIDATION_ERROR("%s\nProgram compilation failed:\n%s", source,
+ buffer.data());
}
}
diff --git a/src/dawn/native/vulkan/SwapChainVk.cpp b/src/dawn/native/vulkan/SwapChainVk.cpp
index 0a17baf..c452488 100644
--- a/src/dawn/native/vulkan/SwapChainVk.cpp
+++ b/src/dawn/native/vulkan/SwapChainVk.cpp
@@ -225,8 +225,7 @@
break;
}
- return DAWN_FORMAT_VALIDATION_ERROR("Unsupported surface type (%s) for Vulkan.",
- surface->GetType());
+ return DAWN_VALIDATION_ERROR("Unsupported surface type (%s) for Vulkan.", surface->GetType());
}
VkPresentModeKHR ToVulkanPresentMode(wgpu::PresentMode mode) {
diff --git a/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp b/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp
index 0729d47..2f6445a 100644
--- a/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp
+++ b/src/dawn/native/vulkan/external_memory/MemoryServiceDmaBuf.cpp
@@ -69,7 +69,7 @@
if (GetFormatModifierProps(fn, physicalDevice, format, modifier, &props)) {
return static_cast<uint32_t>(props.drmFormatModifierPlaneCount);
}
- return DAWN_FORMAT_VALIDATION_ERROR("DRM format modifier not supported.");
+ return DAWN_VALIDATION_ERROR("DRM format modifier not supported.");
}
bool IsMultiPlanarVkFormat(VkFormat format) {
diff --git a/src/dawn/tests/unittests/ErrorTests.cpp b/src/dawn/tests/unittests/ErrorTests.cpp
index 53c06cf..524a94d 100644
--- a/src/dawn/tests/unittests/ErrorTests.cpp
+++ b/src/dawn/tests/unittests/ErrorTests.cpp
@@ -22,7 +22,7 @@
namespace {
int placeholderSuccess = 0xbeef;
-const char* placeholderErrorMessage = "I am an error message :3";
+constexpr const char* placeholderErrorMessage = "I am an error message :3";
// Check returning a success MaybeError with {};
TEST(ErrorTests, Error_Success) {