1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 12:50:04 -04:00

Make egui_wgpu::winit::Painter::set_window async (#2434)

* Make `egui_wgpu::winit::Painter::set_window` async

* Fix changelog link
This commit is contained in:
Emil Ernerfeldt
2022-12-12 15:37:55 +01:00
committed by GitHub
parent 7a658e3ddb
commit 6c4fc50fdf
6 changed files with 17 additions and 14 deletions

View File

@@ -64,7 +64,7 @@ __screenshot = ["dep:image"]
## Use [`wgpu`](https://docs.rs/wgpu) for painting (via [`egui-wgpu`](https://github.com/emilk/egui/tree/master/crates/egui-wgpu)).
## This overrides the `glow` feature.
wgpu = ["dep:wgpu", "dep:egui-wgpu"]
wgpu = ["dep:wgpu", "dep:egui-wgpu", "dep:pollster"]
[dependencies]
@@ -100,6 +100,7 @@ directories-next = { version = "2", optional = true }
egui-wgpu = { version = "0.20.0", path = "../egui-wgpu", optional = true, features = [
"winit",
] } # if wgpu is used, use it with winit
pollster = { version = "0.2", optional = true } # needed for wgpu
# we can expose these to user so that they can select which backends they want to enable to avoid compiling useless deps.
# this can be done at the same time we expose x11/wayland features of winit crate.

View File

@@ -950,7 +950,7 @@ mod wgpu_integration {
self.window = Some(window);
if let Some(running) = &mut self.running {
unsafe {
running.painter.set_window(self.window.as_ref())?;
pollster::block_on(running.painter.set_window(self.window.as_ref()))?;
}
}
Ok(())
@@ -962,7 +962,7 @@ mod wgpu_integration {
self.window = None;
if let Some(running) = &mut self.running {
unsafe {
running.painter.set_window(None)?;
pollster::block_on(running.painter.set_window(None))?;
}
}
Ok(())
@@ -981,7 +981,7 @@ mod wgpu_integration {
self.native_options.multisampling.max(1) as _,
self.native_options.depth_buffer,
);
painter.set_window(Some(&window))?;
pollster::block_on(painter.set_window(Some(&window)))?;
painter
};