graphics_worker: tweaks (rust master)

This commit is contained in:
Quaternions 2024-08-20 14:10:55 -07:00
parent 93b04f4f1f
commit 2eff5dda9e

View File

@ -34,17 +34,15 @@ pub fn new<'a>(
resize=Some((size,user_settings)); resize=Some((size,user_settings));
} }
Instruction::Render(physics_output,predicted_time,mouse_pos)=>{ Instruction::Render(physics_output,predicted_time,mouse_pos)=>{
if let Some((size,user_settings))=&resize{ if let Some((size,user_settings))=resize.take(){
println!("Resizing to {:?}",size); println!("Resizing to {:?}",size);
let t0=std::time::Instant::now(); let t0=std::time::Instant::now();
config.width=size.width.max(1); config.width=size.width.max(1);
config.height=size.height.max(1); config.height=size.height.max(1);
surface.configure(&device,&config); surface.configure(&device,&config);
graphics.resize(&device,&config,user_settings); graphics.resize(&device,&config,&user_settings);
println!("Resize took {:?}",t0.elapsed()); println!("Resize took {:?}",t0.elapsed());
} }
//clear every time w/e
resize=None;
//this has to go deeper somehow //this has to go deeper somehow
let frame=match surface.get_current_texture(){ let frame=match surface.get_current_texture(){
Ok(frame)=>frame, Ok(frame)=>frame,