From d089b9488bbb3feef85abed193263f260f573d5c Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Thu, 20 Jul 2023 05:07:48 +0800 Subject: [PATCH] Ignore the exception values generated by the winit resize event (#3916) --- CHANGELOG.md | 1 + examples/common/src/framework.rs | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9f1797b4..5a234aa30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,7 @@ Bottom level categories: #### General - Publish examples to wgpu.rs on updates to trunk branch instead of gecko. By @paul-hansen in [#3750](https://github.com/gfx-rs/wgpu/pull/3750) +- Ignore the exception values generated by the winit resize event. By @jinleili in [#3916](https://github.com/gfx-rs/wgpu/pull/3916) ## v0.16.2 (2023-07-09) diff --git a/examples/common/src/framework.rs b/examples/common/src/framework.rs index af8a3b963..482d97056 100644 --- a/examples/common/src/framework.rs +++ b/examples/common/src/framework.rs @@ -307,11 +307,22 @@ fn start( }, .. } => { - log::info!("Resizing to {:?}", size); - config.width = size.width.max(1); - config.height = size.height.max(1); - example.resize(&config, &device, &queue); - surface.configure(&device, &config); + // Once winit is fixed, the detection conditions here can be removed. + // https://github.com/rust-windowing/winit/issues/2876 + let max_dimension = adapter.limits().max_texture_dimension_2d; + if size.width > max_dimension || size.height > max_dimension { + log::warn!( + "The resizing size {:?} exceeds the limit of {}.", + size, + max_dimension + ); + } else { + log::info!("Resizing to {:?}", size); + config.width = size.width.max(1); + config.height = size.height.max(1); + example.resize(&config, &device, &queue); + surface.configure(&device, &config); + } } event::Event::WindowEvent { event, .. } => match event { WindowEvent::KeyboardInput {