emilk/egui

requirement for users to select wgpu features is undocumented & resulting errors hard to interpret

Open

#4,885 opened on Jul 28, 2024

View on GitHub
 (8 comments) (1 reaction) (0 assignees)Rust (2,037 forks)batch import
bugdocs and examplesegui-wgpuhelp wanted

Repository metrics

Stars
 (29,051 stars)
PR merge metrics
 (Avg merge 17d 17h) (41 merged PRs in 30d)

Description

Describe the bug DirectX12 doesn't work with eframe and errors with error:

[2024-07-28T19:05:15Z ERROR eframe::native::run] Exiting because of error: WGPU error: Failed to create surface for any enabled backend: {} during event Resumed
Error: Wgpu(CreateSurfaceError(CreateSurfaceError { inner: Hal(FailedToCreateSurfaceForAnyBackend({})) }))
error: process didn't exit successfully: `target\debug\dx12eframe.exe` (exit code: 1)

Here is minimal example:

Cargo.toml

[package]
name = "dx12eframe"
version = "0.1.0"
edition = "2021"

[dependencies]
eframe = { version = "0.28.0", features = ["wgpu"] }
env_logger = "0.11.5"

main.rs

use eframe::egui;

fn main() -> Result<(), eframe::Error> {
    env_logger::init();

    let native_options = eframe::NativeOptions {
        renderer: eframe::Renderer::Wgpu,
        wgpu_options: eframe::egui_wgpu::WgpuConfiguration {
            supported_backends: eframe::wgpu::Backends::DX12,
            ..Default::default()
        },
        ..Default::default()
    };

    eframe::run_simple_native("Hello world", native_options, move |ctx, _frame| {
        egui::CentralPanel::default().show(ctx, |ui| {
            ui.heading("Hello world");
        });
    })
}

It's only happening for me while using DX12 (GL and Vulkan works fine). But when I use only wgpu with winit (exactly code from here) it works, so I guess it must be a bug in egui/eframe (that's why I post issue here).

Desktop:

  • OS: Windows 11 Pro 23H2
  • Version: eframe 28 & 28.1 (I can't check older versions, because I have some compilation errors on versions <28)
  • Adapter info using wgpu: { name: "NVIDIA GeForce RTX 2070 SUPER", vendor: 4318, device: 7812, device_type: DiscreteGpu, driver: "31.0.15.4617", driver_info: "", backend: Dx12, }

If there's anything else you need me to provide or check then just say :)

Contributor guide