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:
parent
c3a4666eea
commit
72ba3039eb
|
@ -136,21 +136,25 @@ namespace wgpu::binding {
|
||||||
promise.Reject("unknown backend '" + forceBackend + "'");
|
promise.Reject("unknown backend '" + forceBackend + "'");
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (size_t i = 0; i < adapters.size(); ++i) {
|
for (size_t i = 0; i < adapters.size(); ++i) {
|
||||||
wgpu::AdapterProperties props;
|
wgpu::AdapterProperties props;
|
||||||
adapters[i].GetProperties(&props);
|
adapters[i].GetProperties(&props);
|
||||||
if (props.backendType == targetBackendType) {
|
if (props.backendType == targetBackendType) {
|
||||||
adapterIndex = i;
|
adapterIndex = i;
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!found) {
|
}
|
||||||
|
if (!found) {
|
||||||
|
if (!forceBackend.empty()) {
|
||||||
promise.Reject("backend '" + forceBackend + "' not found");
|
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_);
|
auto adapter = GPUAdapter::Create<GPUAdapter>(env, adapters[adapterIndex], flags_);
|
||||||
|
|
Loading…
Reference in New Issue