From dfcd989947a7493b73342732ace786c0af873261 Mon Sep 17 00:00:00 2001 From: Hojjat Date: Wed, 27 May 2026 14:50:31 -0600 Subject: [PATCH] fix: present suboptimal frames --- wgpu/src/window/compositor.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index 4033aea4..f0595f2b 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -368,13 +368,14 @@ pub fn present( ) -> Result<(), compositor::SurfaceError> { match surface.get_current_texture() { Ok(frame) => { - if frame.suboptimal - || frame.texture.width() != viewport.physical_width() + if frame.texture.width() != viewport.physical_width() || frame.texture.height() != viewport.physical_height() { return Err(compositor::SurfaceError::Outdated); } + let suboptimal = frame.suboptimal; + let view = &frame .texture .create_view(&wgpu::TextureViewDescriptor::default()); @@ -390,6 +391,10 @@ pub fn present( on_pre_present(); frame.present(); + if suboptimal { + return Err(compositor::SurfaceError::Outdated); + } + Ok(()) } Err(error) => match error {