From 37148871fddd00a4146a64670a1ee5745f1d18f9 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 11 Sep 2024 22:33:24 +0200 Subject: [PATCH] [examples] Do not request redraw on resize This is no longer necessary, since Winit can now properly issue redraw events on resize. --- examples/src/framework.rs | 2 -- examples/src/hello_triangle/mod.rs | 2 -- examples/src/hello_windows/mod.rs | 2 -- examples/src/uniform_values/mod.rs | 2 -- 4 files changed, 8 deletions(-) diff --git a/examples/src/framework.rs b/examples/src/framework.rs index ff86cc23570..c4d4cf4a9ff 100644 --- a/examples/src/framework.rs +++ b/examples/src/framework.rs @@ -422,8 +422,6 @@ async fn start(title: &str) { &context.device, &context.queue, ); - - window_loop.window.request_redraw(); } WindowEvent::KeyboardInput { event: diff --git a/examples/src/hello_triangle/mod.rs b/examples/src/hello_triangle/mod.rs index 7c82d49cf07..2d32aa7b004 100644 --- a/examples/src/hello_triangle/mod.rs +++ b/examples/src/hello_triangle/mod.rs @@ -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 diff --git a/examples/src/hello_windows/mod.rs b/examples/src/hello_windows/mod.rs index b568f35d38c..349d0d5f259 100644 --- a/examples/src/hello_windows/mod.rs +++ b/examples/src/hello_windows/mod.rs @@ -100,8 +100,6 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Arc, 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 => { diff --git a/examples/src/uniform_values/mod.rs b/examples/src/uniform_values/mod.rs index 1ef58de09a2..1e671056b00 100644 --- a/examples/src/uniform_values/mod.rs +++ b/examples/src/uniform_values/mod.rs @@ -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(); } } @@ -285,7 +284,6 @@ async fn run(event_loop: EventLoop<()>, window: Arc) { 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();