Files
komorebi/komorebi-bar
LGUG2Z b57ef03421 feat(bar): try wgpu when glow cannot make an OpenGL context (Windows)
The Windows bar starts with glow exactly as before (the renderer is now named
in NativeOptions: with the glow and wgpu features both compiled eframe's
default is wgpu, so leaving it unnamed would have switched every machine).
Only when glow fails to get a context (eframe::Error::OpenGL, Glutin or
NoGlutinConfigs: "egui_glow requires opengl 2.0+" is the one seen in the
Windows e2e guest) it runs once more with `Renderer::Wgpu`, which draws
through Direct3D 12 and finds the software adapter WARP when there is no
GPU driver. If both fail the error names both ("glow: ...; wgpu: ..."), so
the e2e scenario can report it. The renderer in use is logged at info
("renderer: glow", and "renderer: glow failed (...); trying wgpu").

To make a second attempt possible the application creator moved out of the
`run_native` call into a closure that builds it from clones of the channels
and the configuration (the first creator is never run when its renderer
fails to start); its body is unchanged. eframe reuses its thread-local winit
event loop, so a second `run_native` on the same thread is supported.

BEHAVIOUR (Windows, only where glow fails): the bar now opens with wgpu
instead of exiting. Nothing changes where glow works except one info log
line. The macOS bar and the bar core are untouched.

Verified: Windows clippy --all-targets -D warnings clean (default members);
a unit test that a creation error is not a context failure. NOT verified:
that WARP accepts egui's Direct3D 12 device in the guest, or transparency
under wgpu: needs the win-e2e bar scenario.
2026-11-05 15:03:26 -08:00
..