Skip to content

Commit

Permalink
[examples] Do not request redraw on resize
Browse files Browse the repository at this point in the history
This is no longer necessary, since Winit can now properly issue redraw
events on resize.
  • Loading branch information
madsmtm committed Sep 11, 2024
1 parent 9a5e646 commit 3714887
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 8 deletions.
2 changes: 0 additions & 2 deletions examples/src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,6 @@ async fn start<E: Example>(title: &str) {
&context.device,
&context.queue,
);

window_loop.window.request_redraw();
}
WindowEvent::KeyboardInput {
event:
Expand Down
2 changes: 0 additions & 2 deletions examples/src/hello_triangle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
config.width = new_size.width.max(1);
config.height = new_size.height.max(1);
surface.configure(&device, &config);
// On macos the window needs to be redrawn manually after resizing
window.request_redraw();
}
WindowEvent::RedrawRequested => {
let frame = surface
Expand Down
2 changes: 0 additions & 2 deletions examples/src/hello_windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Arc<Window>, wgpu::Color
// Recreate the swap chain with the new size
if let Some(viewport) = viewports.get_mut(&window_id) {
viewport.resize(&device, new_size);
// On macos the window needs to be redrawn manually after resizing
viewport.desc.window.request_redraw();
}
}
WindowEvent::RedrawRequested => {
Expand Down
2 changes: 0 additions & 2 deletions examples/src/uniform_values/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ impl WgpuContext {
self.surface_config.width = new_size.width;
self.surface_config.height = new_size.height;
self.surface.configure(&self.device, &self.surface_config);
self.window.request_redraw();
}
}

Expand Down Expand Up @@ -285,7 +284,6 @@ async fn run(event_loop: EventLoop<()>, window: Arc<Window>) {
WindowEvent::Resized(new_size) => {
let wgpu_context_mut = wgpu_context.as_mut().unwrap();
wgpu_context_mut.resize(new_size);
wgpu_context_mut.window.request_redraw();
}
WindowEvent::RedrawRequested => {
let wgpu_context_ref = wgpu_context.as_ref().unwrap();
Expand Down

0 comments on commit 3714887

Please sign in to comment.