Expand description
Renderer setup: backend selection and device-loss reporting.
On Windows the app asks for Vulkan rather than letting wgpu pick: the DX12
device is removed whenever a Remote Desktop session reconnects or the display
configuration changes, and egui-wgpu turns that into an unrecoverable panic
(see [device_lost_explanation]). Every other OS gets wgpu’s primary
backends. WGPU_BACKEND overrides the choice everywhere, so
WGPU_BACKEND=dx12 is the escape hatch on Windows when Vulkan misbehaves
(for example, a Vulkan overlay layer that crashes the app).
The device asks for wgpu’s default limits only as far as the adapter has them: some adapters fall short of the defaults (the iOS simulator’s Metal one), and asking for more than the adapter has fails the device’s creation, and with it the window.
On Android a debug build leaves out wgpu’s debug labels ([instance_flags]): the
emulator’s Vulkan driver crashes the app when wgpu names its objects.
Functions§
- install_
panic_ hook - Install a panic hook that translates egui-wgpu’s staging-buffer panic.
- on_
render_ state - Report which adapter was chosen and arm the device-loss callback.
- wgpu_
options - Renderer configuration for
eframe::NativeOptions.