From 8876d922e6bd16e08fe6560ca0782fc9e093644c Mon Sep 17 00:00:00 2001 From: Fichtelcoder Date: Sun, 20 Mar 2022 12:37:47 +0100 Subject: [PATCH 1/3] Fix resizing behaviour of hello-triangle example. On macos the window is not updated until requested explicitly. --- wgpu/examples/hello-triangle/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/wgpu/examples/hello-triangle/main.rs b/wgpu/examples/hello-triangle/main.rs index 885ca20127..d4d283142b 100644 --- a/wgpu/examples/hello-triangle/main.rs +++ b/wgpu/examples/hello-triangle/main.rs @@ -93,6 +93,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) { config.width = size.width; config.height = size.height; surface.configure(&device, &config); + window.request_redraw(); } Event::RedrawRequested(_) => { let frame = surface From c01062074885adf286161d5b340d01431c4cbc39 Mon Sep 17 00:00:00 2001 From: Fichtelcoder Date: Sun, 20 Mar 2022 16:25:04 +0100 Subject: [PATCH 2/3] Adress comment from review --- wgpu/examples/hello-triangle/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/wgpu/examples/hello-triangle/main.rs b/wgpu/examples/hello-triangle/main.rs index d4d283142b..fe6f0c2132 100644 --- a/wgpu/examples/hello-triangle/main.rs +++ b/wgpu/examples/hello-triangle/main.rs @@ -93,6 +93,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) { config.width = size.width; config.height = size.height; surface.configure(&device, &config); + // On macos the window needs to be redrawn manually after resizing window.request_redraw(); } Event::RedrawRequested(_) => { From 481b9b659308a46d64cfb0f717fefae9c34e4aa3 Mon Sep 17 00:00:00 2001 From: Fichtelcoder Date: Sun, 20 Mar 2022 16:39:25 +0100 Subject: [PATCH 3/3] Fix window resize on macos for hello-windows example --- wgpu/examples/hello-windows/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wgpu/examples/hello-windows/main.rs b/wgpu/examples/hello-windows/main.rs index d25c6d12a6..ca725f44b3 100644 --- a/wgpu/examples/hello-windows/main.rs +++ b/wgpu/examples/hello-windows/main.rs @@ -108,6 +108,8 @@ async fn run(event_loop: EventLoop<()>, viewports: Vec<(Window, wgpu::Color)>) { // Recreate the swap chain with the new size if let Some(viewport) = viewports.get_mut(&window_id) { viewport.resize(&device, size); + // On macos the window needs to be redrawn manually after resizing + viewport.desc.window.request_redraw(); } } Event::RedrawRequested(window_id) => {