egui icon indicating copy to clipboard operation
egui copied to clipboard

eframe: window flashes white on launch on Windows

Open HideakiAtsuyo opened this issue 3 years ago • 8 comments

eframe = { git = "https://github.com/emilk/egui", branch = "master" }

Describe the bug Wheb the window show it's kinda buggy it's light then dark

To Reproduce A bit modified the example code with name and age

Expected behavior Appear dark

Screenshots See to reproduce for GIF

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser I don't use a browser
  • Version I'm still using the libs directly

Additional context None

HideakiAtsuyo avatar Jul 05 '22 21:07 HideakiAtsuyo

How annoying! On Mac it works well. Is it the same using egui-wgpu as the backend?

Perhaps add a few breakpoints and try to find out what goes wrong!

emilk avatar Jul 21 '22 18:07 emilk

How annoying! On Mac it works well. Is it the same using egui-wgpu as the backend?

Perhaps add a few breakpoints and try to find out what goes wrong!

Hello, it's not very annoying but I was thiking it would be good if it's possible to fix it ! And yeah even with using egui-wgpu I get the same result !

HideakiAtsuyo avatar Jul 23 '22 07:07 HideakiAtsuyo

"Bump"

HideakiAtsuyo avatar Jul 31 '22 21:07 HideakiAtsuyo

@HideakiAtsuyo since this affects your computer and you are a programmer, maybe you can investigate?

emilk avatar Aug 01 '22 09:08 emilk

@HideakiAtsuyo since this affects your computer and you are a programmer, maybe you can investigate?

The only solution that I have for this situation that would not necessarely require to modify the crate is to hide the windows until it's fully loaded

HideakiAtsuyo avatar Aug 01 '22 10:08 HideakiAtsuyo

  • I'm not a maintainer of egui 🤔

HideakiAtsuyo avatar Aug 01 '22 10:08 HideakiAtsuyo

You are not the maintainer, but you can become a contributor.

I have a thousand things to do that has a higher priority, so if you want this to be fixed, you better roll up your sleeves.

emilk avatar Aug 01 '22 10:08 emilk

You are not the maintainer, but you can become a contributor.

I have a thousand things to do that has a higher priority, so if you want this to be fixed, you better roll up your sleeves.

It's not a priority I never said that, I'm using Rust very rarely sadly it was just for 1 project nothing more

HideakiAtsuyo avatar Aug 02 '22 18:08 HideakiAtsuyo

when you create glutin context on windows, it creates white window, which stays white until content gets swapped into it

when you create glutin context on linux, it creates a hidden window (icon in taskbar, but no ability to click into it)

that's the difference, very much reproduceable for me with all glutin examples, for example this one creates a white window for me on windows only:

let el = glutin::event_loop::EventLoop::new();
let wb = glutin::window::WindowBuilder::new()
    .with_title("Hello world!")
    .with_inner_size(glutin::dpi::LogicalSize::new(200.0, 200.0));
let windowed_context = glutin::ContextBuilder::new()
    .build_windowed(wb, &el)
    .unwrap();

I'm not sure what's the right behavior is, but it probably should be reported in that package (didn't find any existing tickets)

rlidwka avatar Sep 17 '22 17:09 rlidwka

when you create glutin context on windows, it creates white window, which stays white until content gets swapped into it

when you create glutin context on linux, it creates a hidden window (icon in taskbar, but no ability to click into it)

that's the difference, very much reproduceable for me with all glutin examples, for example this one creates a white window for me on windows only:

let el = glutin::event_loop::EventLoop::new();
let wb = glutin::window::WindowBuilder::new()
    .with_title("Hello world!")
    .with_inner_size(glutin::dpi::LogicalSize::new(200.0, 200.0));
let windowed_context = glutin::ContextBuilder::new()
    .build_windowed(wb, &el)
    .unwrap();

I'm not sure what's the right behavior is, but it probably should be reported in that package (didn't find any existing tickets)

The best one for lazy people like me would be to hide the windows until it's loaded until the packages receive the necessarily updates to "fix it" on Windows, that would not be the hardest to do I think but still need to add code for stuff that could be managed by the packages

HideakiAtsuyo avatar Sep 17 '22 19:09 HideakiAtsuyo

The window also flashes white while it's being resized with the glow backend

https://user-images.githubusercontent.com/4723091/201222028-30b3777d-603a-4eb4-8f12-d4995f34bc4d.mp4

(sorry for the small size, can't do a larger recording or else it slows down my computer enough to make it not flash white?)

The white on launch happens with both glow and wgpu backends. However, the wgpu backend does not flash white on resize. It also does not render text (??) and has its own horrible resizing artifacts:

https://user-images.githubusercontent.com/4723091/201222261-57793ef1-e706-4849-89f8-4c51174c96ea.mp4

LoganDark avatar Nov 10 '22 22:11 LoganDark

Here is a flame graph of the white flash: (click to make it interactive)

flamegraph

It looks like this is impossible to work around as a user of eframe since the CreationContext gives me no access to the winit window. But that also wouldn't be able to change the window construction options, ideally it should be constructed completely hidden while the glutin context is created. (PR time?)

Anyway... the context creation is slow as hell. I guess my drivers are just dumb, but this happens with both GPUs (dedicated and integrated). Here is iGPU flamegraph:

flamegraph

Notably this one only takes around 520ms to create the context instead of 779ms+ like the Nvidia drivers. But... it's still a noticeable white flash.

LoganDark avatar Nov 10 '22 23:11 LoganDark