Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn if using software rasterizer (lavapipe or llvmpipe) #3134

Merged
merged 4 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 48 additions & 0 deletions crates/re_viewer/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,60 @@ pub fn run_native_app(app_creator: AppCreator) -> eframe::Result<()> {
window_title,
native_options,
Box::new(move |cc| {
check_graphics_driver(cc.wgpu_render_state.as_ref());
let re_ui = crate::customize_eframe(cc);
app_creator(cc, re_ui)
}),
)
}

fn check_graphics_driver(wgpu_render_state: Option<&egui_wgpu::RenderState>) {
let wgpu_render_state = wgpu_render_state.expect("Expected wgpu to be enabled");
let info = wgpu_render_state.adapter.get_info();

let human_readable_summary = {
let wgpu::AdapterInfo {
name,
vendor: _, // skip integer id
device: _, // skip integer id
device_type,
driver,
driver_info,
backend,
} = &info;

format!(
"wgpu adapter name: {name:?}, \
device_type: {device_type:?}, \
backend: {backend:?}, \
driver: {driver:?}, \
driver_info: {driver_info:?}"
)
};

let is_known_software_rasterizer = {
// See https://github.com/rerun-io/rerun/issues/3089
const KNOWN_SOFTWARE_RASTERIZERS: &[&str] = &[
"lavapipe", // Vulkan software rasterizer
"llvmpipe", // OpenGL software rasterizer
];

// I'm not sure where the incriminating string will appear, so check all fields at once:
let info_string = format!("{info:?}").to_lowercase();

KNOWN_SOFTWARE_RASTERIZERS
.iter()
.any(|&software_rasterizer| info_string.contains(software_rasterizer))
};

if is_known_software_rasterizer {
re_log::warn!("Software rasterizer detected - expect poor performance and crashes. See: https://www.rerun.io/docs/getting-started/troubleshooting#graphics-issues");
re_log::info!("{human_readable_summary}");
} else {
re_log::debug!("{human_readable_summary}");
}
}

pub fn eframe_options() -> eframe::NativeOptions {
eframe::NativeOptions {
// Controls where on disk the app state is persisted.
Expand Down
3 changes: 3 additions & 0 deletions docs/content/getting-started/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ rerun reset
```

## Graphics issues
<--! This section is linked to from `crates/re_viewer/src/native.rs` -->

[Wgpu](https://github.com/gfx-rs/wgpu) (the graphics API we use) maintains a list of
[known driver issues](https://github.com/gfx-rs/wgpu/wiki/Known-Driver-Issues) and workarounds for them.
Expand All @@ -41,6 +42,8 @@ The following environment variables overwrite the config we choose for wgpu:
Naturally, support depends on your OS. Default is `vulkan` everywhere except on Mac where we use `metal`.
* `WGPU_POWER_PREF`: Overwrites the power setting used for choosing a graphics adapter, must be `high` or `low`. (Default is `high`)

For instance, you can try `WGPU_BACKEND=gl rerun`.

We recommend setting these only if you're asked to try them or know what you're doing,
since we don't support all of these settings equally well.

Expand Down