gui: wgpu fallback renderer for desktop (#31)

Reviewed-on: https://code.gri.mw/GUI/grim/pulls/31
This commit is contained in:
ardocrat
2026-01-19 21:21:13 +01:00
parent ec81ba2cee
commit 0713ba0213
3 changed files with 22 additions and 3 deletions
Generated
+2
View File
@@ -2485,6 +2485,7 @@ dependencies = [
"objc2-foundation 0.2.2",
"parking_lot 0.12.5",
"percent-encoding",
"pollster",
"profiling",
"raw-window-handle",
"static_assertions",
@@ -2492,6 +2493,7 @@ dependencies = [
"wasm-bindgen-futures",
"web-sys",
"web-time",
"wgpu",
"windows-sys 0.61.2",
"winit",
]
+1 -1
View File
@@ -154,7 +154,7 @@ nokhwa-mac = { git = "https://code.gri.mw/ardocrat/nokhwa", rev = "612c861ef153c
[target.'cfg(not(target_os = "android"))'.dependencies]
env_logger = "0.11.3"
winit = { version = "0.30.12" }
eframe = { version = "0.33.2", default-features = false, features = ["glow", "wayland"] }
eframe = { version = "0.33.2", default-features = false, features = ["glow", "wgpu", "wayland"] }
arboard = "3.2.0"
rfd = "0.15.0"
interprocess = { version = "2.2.1", features = ["tokio"] }
+19 -2
View File
@@ -134,7 +134,7 @@ fn start_desktop_gui(platform: grim::gui::platform::Desktop) {
.with_transparent(true)
.with_decorations(is_mac || is_win);
let options = eframe::NativeOptions {
let mut options = eframe::NativeOptions {
renderer: eframe::Renderer::Glow,
viewport,
..Default::default()
@@ -142,7 +142,24 @@ fn start_desktop_gui(platform: grim::gui::platform::Desktop) {
// Start GUI.
let app = grim::gui::App::new(platform.clone());
grim::start(options.clone(), grim::app_creator(app)).unwrap();
match grim::start(options.clone(), grim::app_creator(app)) {
Ok(_) => {}
Err(e) => {
if is_win {
panic!("{}", e);
}
// Start with another renderer on error.
options.renderer = eframe::Renderer::Wgpu;
let app = grim::gui::App::new(platform);
match grim::start(options, grim::app_creator(app)) {
Ok(_) => {}
Err(e) => {
panic!("{}", e);
}
}
}
}
}
/// Check if application is already running to pass data.