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>
This commit is contained in:
Corentin Wallez 2022-08-30 13:39:47 +00:00 committed by Dawn LUCI CQ
parent 1eb6d2dd02
commit 1105ec78fe
31 changed files with 73 additions and 82 deletions

View File

@ -29,7 +29,7 @@ namespace {{native_namespace}} {
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 @@ namespace {{native_namespace}} {
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 %}

View File

@ -29,7 +29,7 @@ InstanceBase* BackendConnection::GetInstance() const {
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

View File

@ -48,8 +48,8 @@ MaybeError ValidateStorageTextureViewDimension(wgpu::TextureViewDimension dimens
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:

View File

@ -292,10 +292,10 @@ MaybeError BufferBase::ValidateCanUseOnQueueNow() const {
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 @@ MaybeError BufferBase::ValidateMapAsync(wgpu::MapMode mode,
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 @@ MaybeError BufferBase::ValidateUnmap() const {
// 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();
}

View File

@ -297,7 +297,7 @@ MaybeError CommandBufferStateTracker::CheckMissingAspects(ValidationAspects aspe
// 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 @@ MaybeError CommandBufferStateTracker::CheckMissingAspects(ValidationAspects aspe
// 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();

View File

@ -88,7 +88,7 @@ MaybeError ValidateTextureDepthStencilToBufferCopyRestrictions(const ImageCopyTe
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 @@ CommandEncoder::CommandEncoder(DeviceBase* device, ObjectBase::ErrorTag tag)
: 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::APIClearBuffer(BufferBase* buffer, uint64_t offset, uint64_
void CommandEncoder::APIInjectValidationError(const char* message) {
if (mEncodingContext.CheckCurrentEncoder(this)) {
mEncodingContext.HandleError(DAWN_VALIDATION_ERROR(message));
mEncodingContext.HandleError(DAWN_MAKE_ERROR(InternalErrorType::Validation, message));
}
}

View File

@ -55,7 +55,7 @@ MaybeError ValidateSyncScopeResourceUsage(const SyncScopeResourceUsage& scope) {
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 @@ MaybeError ValidateTextureToTextureCopyCommonRestrictions(const ImageCopyTexture
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(

View File

@ -23,7 +23,7 @@ namespace dawn::native {
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) {

View File

@ -242,8 +242,7 @@ MaybeError ValidateCopyTextureFormatConversion(const wgpu::TextureFormat srcForm
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 @@ MaybeError ValidateCopyTextureFormatConversion(const wgpu::TextureFormat srcForm
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 {};

View File

@ -44,7 +44,7 @@ void EncodingContext::Destroy() {
// 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 @@ void EncodingContext::EnsurePassExited(const ApiObjectBase* passEncoder) {
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));
}
}

View File

@ -80,18 +80,17 @@ class EncodingContext {
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;
}

View File

@ -43,7 +43,7 @@ using ResultOrError = Result<T, ErrorData>;
// 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 @@ using ResultOrError = Result<T, ErrorData>;
#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, ...) \

View File

@ -91,7 +91,7 @@ MaybeError ValidateExternalTextureDescriptor(const DeviceBase* device,
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,

View File

@ -385,7 +385,7 @@ MaybeError InstanceBase::DiscoverAdaptersInternal(const AdapterDiscoveryOptionsB
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);

View File

@ -42,12 +42,12 @@ MaybeError ValidateProgrammableStage(DeviceBase* device,
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 @@ MaybeError ValidateProgrammableStage(DeviceBase* device,
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 @@ MaybeError ValidateProgrammableStage(DeviceBase* device,
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);

View File

@ -170,7 +170,7 @@ MaybeError ProgrammableEncoder::ValidateSetBindGroup(BindGroupIndex index,
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,

View File

@ -46,8 +46,8 @@ MaybeError ValidateSamplerDescriptor(DeviceBase*, const SamplerDescriptor* descr
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));

View File

@ -299,13 +299,12 @@ ResultOrError<tint::Program> ParseWGSL(const tint::Source::File* file,
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 @@ ResultOrError<tint::Program> ParseSPIRV(const std::vector<uint32_t>& spirv,
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
}

View File

@ -162,7 +162,7 @@ MaybeError ValidateSurfaceDescriptor(const InstanceBase* instance,
}
#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

View File

@ -35,16 +35,16 @@ class ErrorSwapChain final : public SwapChainBase {
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 @@ void NewSwapChainBase::APIConfigure(wgpu::TextureFormat format,
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() {

View File

@ -54,7 +54,7 @@ MaybeError ValidateCanViewTextureAs(const DeviceBase* device,
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 @@ MaybeError ValidateCanViewTextureAs(const DeviceBase* device,
// 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 @@ MaybeError ValidateCanViewTextureAs(const DeviceBase* device,
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);

View File

@ -282,8 +282,8 @@ ResultOrError<ComPtr<IDxcBlob>> CompileShaderDXC(const D3DBytecodeCompilationReq
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 @@ ResultOrError<std::string> TranslateToHLSL(
*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.");
}
}

View File

@ -490,7 +490,7 @@ MaybeError ValidateD3D12VideoTextureCanBeShared(Device* device, DXGI_FORMAT text
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

View File

@ -227,7 +227,7 @@ ResultOrError<CacheResult<MslCompilation>> TranslateToMSL(DeviceBase* device,
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 @@ MaybeError ShaderModule::CreateFunction(const char* entryPointName,
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);

View File

@ -197,7 +197,7 @@ ResultOrError<wgpu::TextureFormat> GetFormatEquivalentToIOSurfaceFormat(uint32_t
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);
}
}

View File

@ -299,7 +299,7 @@ ResultOrError<Ref<NewSwapChainBase>> Device::CreateSwapChainImpl(
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 @@ TextureBase* Device::CreateTextureWrappingEGLImage(const ExternalImageDescriptor
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);

View File

@ -82,7 +82,7 @@ MaybeError PipelineGL::InitializeBase(const OpenGLFunctions& gl,
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());
}
}

View File

@ -264,8 +264,8 @@ ResultOrError<GLuint> ShaderModule::CompileShader(const OpenGLFunctions& gl,
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());
}
}

View File

@ -225,8 +225,7 @@ ResultOrError<VkSurfaceKHR> CreateVulkanSurface(Adapter* adapter, Surface* surfa
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) {

View File

@ -69,7 +69,7 @@ ResultOrError<uint32_t> GetModifierPlaneCount(const VulkanFunctions& fn,
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) {

View File

@ -22,7 +22,7 @@ namespace dawn::native {
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) {