Instance: Only discover default adapters once.

BUG=dawn:109

Change-Id: I9e54550dc8d3cdea289b3ad529a69a4cf3d5a35b
Reviewed-on: https://dawn-review.googlesource.com/c/5040
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2019-02-25 17:42:56 +00:00 committed by Commit Bot service account
parent b92fa10557
commit 9b8d2b0bbf
2 changed files with 7 additions and 0 deletions

View File

@ -54,6 +54,10 @@ namespace dawn_native {
void InstanceBase::DiscoverDefaultAdapters() {
EnsureBackendConnections();
if (mDiscoveredDefaultAdapters) {
return;
}
// Query and merge all default adapters for all backends
for (std::unique_ptr<BackendConnection>& backend : mBackends) {
std::vector<std::unique_ptr<AdapterBase>> backendAdapters =
@ -65,6 +69,8 @@ namespace dawn_native {
mAdapters.push_back(std::move(adapter));
}
}
mDiscoveredDefaultAdapters = true;
}
// This is just a wrapper around the real logic that uses Error.h error handling.

View File

@ -50,6 +50,7 @@ namespace dawn_native {
MaybeError DiscoverAdaptersInternal(const AdapterDiscoveryOptionsBase* options);
bool mBackendsConnected = false;
bool mDiscoveredDefaultAdapters = false;
std::vector<std::unique_ptr<BackendConnection>> mBackends;
std::vector<std::unique_ptr<AdapterBase>> mAdapters;