DawnTest: only choose one adapter from those with same name and backendType
When running Dawn end2end tests on latest Windows 10 (20H2) in a Remote Desktop session there can be multiple adapters with same name and type, which will cause the crash of Dawn end2end tests as the GTest framework doesn't allow two cases having the same name. This patch fixes this issue by only choosing one adapter from the ones with same name and backendType in DawnTests. BUG=dawn:396 TEST=dawn_end2end_tests Change-Id: I42de7fc1f3e9f8919af251c047cd873ba84d7190 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31583 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
6564890116
commit
e87a8c466f
|
@ -352,6 +352,7 @@ void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn_native::In
|
|||
}
|
||||
}
|
||||
|
||||
std::set<std::pair<wgpu::BackendType, std::string>> adapterNameSet;
|
||||
for (const dawn_native::Adapter& adapter : instance->GetAdapters()) {
|
||||
wgpu::AdapterProperties properties;
|
||||
adapter.GetProperties(&properties);
|
||||
|
@ -386,8 +387,16 @@ void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn_native::In
|
|||
selected = true;
|
||||
}
|
||||
|
||||
// In Windows Remote Desktop sessions we may be able to discover multiple adapters that
|
||||
// have the same name and backend type. We will just choose one adapter from them in our
|
||||
// tests.
|
||||
const auto adapterTypeAndName =
|
||||
std::make_pair(properties.backendType, std::string(properties.name));
|
||||
if (adapterNameSet.find(adapterTypeAndName) == adapterNameSet.end()) {
|
||||
adapterNameSet.insert(adapterTypeAndName);
|
||||
mAdapterProperties.emplace_back(properties, selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<AdapterTestParam> DawnTestEnvironment::GetAvailableAdapterTestParamsForBackends(
|
||||
|
|
Loading…
Reference in New Issue