mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Warn if using a software rasterizer (#8101)
* Related to https://github.com/emilk/egui/issues/8093
This commit is contained in:
committed by
lucasmerlin
parent
d7c45729a5
commit
9bad77e68a
@@ -138,29 +138,12 @@ async fn request_adapter(
|
|||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if cfg!(target_arch = "wasm32") {
|
if 1 < available_adapters.len() {
|
||||||
log::debug!(
|
log::info!(
|
||||||
"Picked wgpu adapter: {}",
|
"There are {} available wgpu adapters: {}",
|
||||||
adapter_info_summary(&adapter.get_info())
|
available_adapters.len(),
|
||||||
|
describe_adapters(available_adapters)
|
||||||
);
|
);
|
||||||
} 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)
|
||||||
@@ -236,6 +219,8 @@ impl RenderState {
|
|||||||
}) => (adapter, device, queue),
|
}) => (adapter, device, queue),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
log_adapter_info(&adapter.get_info());
|
||||||
|
|
||||||
let surface_formats = {
|
let surface_formats = {
|
||||||
profiling::scope!("get_capabilities");
|
profiling::scope!("get_capabilities");
|
||||||
compatible_surface.map_or_else(
|
compatible_surface.map_or_else(
|
||||||
@@ -406,6 +391,18 @@ pub fn depth_format_from_bits(depth_buffer: u8, stencil_buffer: u8) -> Option<wg
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
fn log_adapter_info(info: &wgpu::AdapterInfo) {
|
||||||
|
let summary = adapter_info_summary(info);
|
||||||
|
|
||||||
|
let is_test = cfg!(test); // Software rasterizers are expected (and preferred) during testing!
|
||||||
|
|
||||||
|
if info.device_type == wgpu::DeviceType::Cpu && !is_test {
|
||||||
|
log::warn!("Software rasterizer detected - loss of performance expected. {summary}");
|
||||||
|
} else {
|
||||||
|
log::debug!("wgpu adapter: {summary}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A human-readable summary about an adapter
|
/// A human-readable summary about an adapter
|
||||||
pub fn adapter_info_summary(info: &wgpu::AdapterInfo) -> String {
|
pub fn adapter_info_summary(info: &wgpu::AdapterInfo) -> String {
|
||||||
let wgpu::AdapterInfo {
|
let wgpu::AdapterInfo {
|
||||||
|
|||||||
Reference in New Issue
Block a user