dawn_node: Fix default adapter selection

The Null adapter was always being used when no backend override was
specified, instead of the platform's default adapter.

Change-Id: I3d8ae62aacda1309a141c3ca39d6e03252fc5e94
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75700
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price 2022-01-07 09:19:08 +00:00 committed by Dawn LUCI CQ
parent c3a4666eea
commit 72ba3039eb
1 changed files with 15 additions and 11 deletions

View File

@ -136,6 +136,7 @@ namespace wgpu::binding {
promise.Reject("unknown backend '" + forceBackend + "'");
return promise;
}
}
bool found = false;
for (size_t i = 0; i < adapters.size(); ++i) {
@ -148,9 +149,12 @@ namespace wgpu::binding {
}
}
if (!found) {
if (!forceBackend.empty()) {
promise.Reject("backend '" + forceBackend + "' not found");
return promise;
} else {
promise.Reject("no suitable backends found");
}
return promise;
}
auto adapter = GPUAdapter::Create<GPUAdapter>(env, adapters[adapterIndex], flags_);