forked from StrafesNET/strafe-client
rank device types and ignore user preference
This commit is contained in:
parent
c868a91a06
commit
6da4c81826
@ -191,17 +191,23 @@ async fn setup<E: Example>(title: &str) -> Setup {
|
|||||||
let adapters = instance.enumerate_adapters(backends);
|
let adapters = instance.enumerate_adapters(backends);
|
||||||
|
|
||||||
let mut chosen_adapter = None;
|
let mut chosen_adapter = None;
|
||||||
|
let mut chosen_adapter_score=0;
|
||||||
for adapter in adapters {
|
for adapter in adapters {
|
||||||
if !adapter.is_surface_supported(&surface) {
|
if !adapter.is_surface_supported(&surface) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let score=match adapter.get_info().device_type{
|
||||||
|
wgpu::DeviceType::IntegratedGpu=>3,
|
||||||
|
wgpu::DeviceType::DiscreteGpu=>4,
|
||||||
|
wgpu::DeviceType::VirtualGpu=>2,
|
||||||
|
wgpu::DeviceType::Other|wgpu::DeviceType::Cpu=>1,
|
||||||
|
};
|
||||||
|
|
||||||
let adapter_features = adapter.features();
|
let adapter_features = adapter.features();
|
||||||
if adapter_features.contains(required_features) {
|
if chosen_adapter_score<score&&adapter_features.contains(required_features) {
|
||||||
chosen_adapter = Some(adapter);
|
chosen_adapter_score=score;
|
||||||
if adapter_features.contains(optional_features) {
|
chosen_adapter=Some(adapter);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user