dawn: Make adapter creation error less scary in stdout.

Bug: chromium:1348664
Change-Id: Ieba886ccc6c0d8813cd175c648849c92b3820f2a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97840
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Corentin Wallez 2022-08-02 16:46:25 +00:00 committed by Dawn LUCI CQ
parent cae5547aee
commit bdc619f5ef
1 changed files with 18 additions and 2 deletions

View File

@ -180,7 +180,14 @@ ResultOrError<Ref<AdapterBase>> InstanceBase::RequestAdapterInternal(
if (GetEnabledBackends()[wgpu::BackendType::Vulkan]) {
dawn_native::vulkan::AdapterDiscoveryOptions vulkanOptions;
vulkanOptions.forceSwiftShader = true;
DAWN_TRY(DiscoverAdaptersInternal(&vulkanOptions));
MaybeError result = DiscoverAdaptersInternal(&vulkanOptions);
if (result.IsError()) {
dawn::WarningLog()
<< "Skipping Vulkan Swiftshader adapter because initialization failed: "
<< result.AcquireError()->GetFormattedMessage();
return Ref<AdapterBase>(nullptr);
}
}
#else
return Ref<AdapterBase>(nullptr);
@ -276,7 +283,16 @@ void InstanceBase::DiscoverDefaultAdapters() {
// This is just a wrapper around the real logic that uses Error.h error handling.
bool InstanceBase::DiscoverAdapters(const AdapterDiscoveryOptionsBase* options) {
return !ConsumedError(DiscoverAdaptersInternal(options));
MaybeError result = DiscoverAdaptersInternal(options);
if (result.IsError()) {
dawn::WarningLog() << "Skipping " << options->backendType
<< " adapter because initialization failed: "
<< result.AcquireError()->GetFormattedMessage();
return false;
}
return true;
}
const ToggleInfo* InstanceBase::GetToggleInfo(const char* toggleName) {