From 121c9c525869198030d67481a7bc8b0c57bdbbcb Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 9 Jan 2025 05:36:49 -0800 Subject: [PATCH] resize immediately --- strafe-client/src/graphics_worker.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/strafe-client/src/graphics_worker.rs b/strafe-client/src/graphics_worker.rs index 67c89be..dba4203 100644 --- a/strafe-client/src/graphics_worker.rs +++ b/strafe-client/src/graphics_worker.rs @@ -21,7 +21,6 @@ pub fn new<'a>( device:wgpu::Device, queue:wgpu::Queue, )->crate::compat_worker::INWorker<'a,Instruction>{ - let mut resize=None; crate::compat_worker::INWorker::new(move |ins:Instruction|{ match ins{ Instruction::ChangeMap(map)=>{ @@ -29,18 +28,15 @@ pub fn new<'a>( graphics.generate_models(&device,&queue,&map); }, Instruction::Resize(size,user_settings)=>{ - resize=Some((size,user_settings)); + println!("Resizing to {:?}",size); + let t0=std::time::Instant::now(); + config.width=size.width.max(1); + config.height=size.height.max(1); + surface.configure(&device,&config); + graphics.resize(&device,&config,&user_settings); + println!("Resize took {:?}",t0.elapsed()); } Instruction::Render(frame_state)=>{ - if let Some((size,user_settings))=resize.take(){ - println!("Resizing to {:?}",size); - let t0=std::time::Instant::now(); - config.width=size.width.max(1); - config.height=size.height.max(1); - surface.configure(&device,&config); - graphics.resize(&device,&config,&user_settings); - println!("Resize took {:?}",t0.elapsed()); - } //this has to go deeper somehow let frame=match surface.get_current_texture(){ Ok(frame)=>frame,