improv(wgpu): adapter selection
This commit is contained in:
parent
1444d5c43e
commit
347d91f7ea
1 changed files with 13 additions and 7 deletions
|
|
@ -76,18 +76,23 @@ impl Compositor {
|
|||
.or_else(|| get_x11_device_ids(window))
|
||||
});
|
||||
|
||||
#[cfg(all(
|
||||
unix,
|
||||
not(feature = "cctk"),
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
let ids = compatible_window
|
||||
.as_ref()
|
||||
.and_then(|window| get_x11_device_ids(window));
|
||||
|
||||
// HACK:
|
||||
// 1. If we specifically didn't select an nvidia gpu
|
||||
// 2. and the user didn't specifically request an nvidia gpu
|
||||
// 3. and the user didn't set an adapter name,
|
||||
// 4. and the user didn't request the high power pref
|
||||
// => don't load the nvidia icd, as it might power on the gpu in hybrid setups causing severe delays
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "redox")))]
|
||||
if !matches!(ids, Some((0x10de, _)))
|
||||
&& std::env::var_os("__NV_PRIME_RENDER_OFFLOAD")
|
||||
.is_none_or(|var| var == "0")
|
||||
|
|
@ -149,7 +154,6 @@ impl Compositor {
|
|||
if std::env::var_os("WGPU_ADAPTER_NAME").is_none() {
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "cctk",
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "redox")
|
||||
))]
|
||||
|
|
@ -187,6 +191,8 @@ impl Compositor {
|
|||
true
|
||||
}
|
||||
});
|
||||
} else {
|
||||
adapter = instance.request_adapter(&adapter_options).await.ok();
|
||||
}
|
||||
|
||||
let adapter = match adapter {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue