mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Warn if using a software rasterizer (#8101)
* Related to https://github.com/emilk/egui/issues/8093
This commit is contained in:
@@ -138,29 +138,12 @@ async fn request_adapter(
|
||||
}
|
||||
})?;
|
||||
|
||||
if cfg!(target_arch = "wasm32") {
|
||||
log::debug!(
|
||||
"Picked wgpu adapter: {}",
|
||||
adapter_info_summary(&adapter.get_info())
|
||||
if 1 < available_adapters.len() {
|
||||
log::info!(
|
||||
"There are {} available wgpu adapters: {}",
|
||||
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)
|
||||
@@ -236,6 +219,8 @@ impl RenderState {
|
||||
}) => (adapter, device, queue),
|
||||
};
|
||||
|
||||
log_adapter_info(&adapter.get_info());
|
||||
|
||||
let surface_formats = {
|
||||
profiling::scope!("get_capabilities");
|
||||
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
|
||||
pub fn adapter_info_summary(info: &wgpu::AdapterInfo) -> String {
|
||||
let wgpu::AdapterInfo {
|
||||
|
||||
Reference in New Issue
Block a user