Warn if `DYLD_LIBRARY_PATH` is set and we find no wgpu adapter (#7572)
Co-authored-by: Andreas Reich <andreas@rerun.io>
This commit is contained in:
parent
4fb4072ce8
commit
18ea9ff0bd
|
|
@ -92,7 +92,7 @@ async fn request_adapter(
|
||||||
instance: &wgpu::Instance,
|
instance: &wgpu::Instance,
|
||||||
power_preference: wgpu::PowerPreference,
|
power_preference: wgpu::PowerPreference,
|
||||||
compatible_surface: Option<&wgpu::Surface<'_>>,
|
compatible_surface: Option<&wgpu::Surface<'_>>,
|
||||||
_available_adapters: &[wgpu::Adapter],
|
available_adapters: &[wgpu::Adapter],
|
||||||
) -> Result<wgpu::Adapter, WgpuError> {
|
) -> Result<wgpu::Adapter, WgpuError> {
|
||||||
profiling::function_scope!();
|
profiling::function_scope!();
|
||||||
|
|
||||||
|
|
@ -108,45 +108,57 @@ async fn request_adapter(
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.inspect_err(|_err| {
|
.inspect_err(|_err| {
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
if cfg!(target_arch = "wasm32") {
|
||||||
if _available_adapters.is_empty() {
|
// Nothing to add here
|
||||||
log::info!("No wgpu adapters found");
|
} else if available_adapters.is_empty() {
|
||||||
} else if _available_adapters.len() == 1 {
|
if std::env::var("DYLD_LIBRARY_PATH").is_ok() {
|
||||||
|
// DYLD_LIBRARY_PATH can sometimes lead to loading dylibs that cause
|
||||||
|
// us to find zero adapters. Very strange.
|
||||||
|
// I don't want to debug this again.
|
||||||
|
// See https://github.com/rerun-io/rerun/issues/11351 for more
|
||||||
|
log::warn!(
|
||||||
|
"No wgpu adapter found. This could be because DYLD_LIBRARY_PATH causes dylibs to be loaded that interfere with Metal device creation. Try restarting with DYLD_LIBRARY_PATH=''"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
log::info!("No wgpu adapter found");
|
||||||
|
}
|
||||||
|
} else if available_adapters.len() == 1 {
|
||||||
log::info!(
|
log::info!(
|
||||||
"The only available wgpu adapter was not suitable: {}",
|
"The only available wgpu adapter was not suitable: {}",
|
||||||
adapter_info_summary(&_available_adapters[0].get_info())
|
adapter_info_summary(&available_adapters[0].get_info())
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
log::info!(
|
log::info!(
|
||||||
"No suitable wgpu adapter found out of the {} available ones: {}",
|
"No suitable wgpu adapter found out of the {} available ones: {}",
|
||||||
_available_adapters.len(),
|
available_adapters.len(),
|
||||||
describe_adapters(_available_adapters)
|
describe_adapters(available_adapters)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
if cfg!(target_arch = "wasm32") {
|
||||||
log::debug!(
|
|
||||||
"Picked wgpu adapter: {}",
|
|
||||||
adapter_info_summary(&adapter.get_info())
|
|
||||||
);
|
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
if _available_adapters.len() == 1 {
|
|
||||||
log::debug!(
|
|
||||||
"Picked the only available wgpu adapter: {}",
|
|
||||||
adapter_info_summary(&adapter.get_info())
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
log::info!(
|
|
||||||
"There were {} available wgpu adapters: {}",
|
|
||||||
_available_adapters.len(),
|
|
||||||
describe_adapters(_available_adapters)
|
|
||||||
);
|
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"Picked wgpu adapter: {}",
|
"Picked wgpu adapter: {}",
|
||||||
adapter_info_summary(&adapter.get_info())
|
adapter_info_summary(&adapter.get_info())
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
// native:
|
||||||
|
if available_adapters.len() == 1 {
|
||||||
|
log::debug!(
|
||||||
|
"Picked the only available wgpu adapter: {}",
|
||||||
|
adapter_info_summary(&adapter.get_info())
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
log::info!(
|
||||||
|
"There were {} available wgpu adapters: {}",
|
||||||
|
available_adapters.len(),
|
||||||
|
describe_adapters(available_adapters)
|
||||||
|
);
|
||||||
|
log::debug!(
|
||||||
|
"Picked wgpu adapter: {}",
|
||||||
|
adapter_info_summary(&adapter.get_info())
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(adapter)
|
Ok(adapter)
|
||||||
|
|
@ -255,7 +267,6 @@ impl RenderState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
fn describe_adapters(adapters: &[wgpu::Adapter]) -> String {
|
fn describe_adapters(adapters: &[wgpu::Adapter]) -> String {
|
||||||
if adapters.is_empty() {
|
if adapters.is_empty() {
|
||||||
"(none)".to_owned()
|
"(none)".to_owned()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue