From 5dda77f0848542bf33aa42890469516e6c2d6bd3 Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Sat, 8 Jul 2023 05:10:54 +0800 Subject: [PATCH 1/3] Ignore the exception values generated by the winit resize event --- examples/common/src/framework.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/common/src/framework.rs b/examples/common/src/framework.rs index af8a3b963b..aa1a741834 100644 --- a/examples/common/src/framework.rs +++ b/examples/common/src/framework.rs @@ -307,11 +307,20 @@ 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); + 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 { From 6cd3d6bbc4d92cfd2ddafdc59fd126f1256f829c Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Sat, 8 Jul 2023 05:45:24 +0800 Subject: [PATCH 2/3] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0ceb66e24..b3405fcad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,6 +104,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) From 336d3851913f74004ee18e27e1228854c1e3290b Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Sat, 8 Jul 2023 07:09:14 +0800 Subject: [PATCH 3/3] Add a link to the winit-related issue --- examples/common/src/framework.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/common/src/framework.rs b/examples/common/src/framework.rs index aa1a741834..482d970563 100644 --- a/examples/common/src/framework.rs +++ b/examples/common/src/framework.rs @@ -307,6 +307,8 @@ fn start( }, .. } => { + // 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!(