outrageous resize hack
This commit is contained in:
parent
1c86219dbe
commit
00dce54aea
@ -14,6 +14,9 @@ WorkerDescription{
|
|||||||
*/
|
*/
|
||||||
//up to three frames in flight, dropping new frame requests when all three are busy, and dropping output frames when one renders out of order
|
//up to three frames in flight, dropping new frame requests when all three are busy, and dropping output frames when one renders out of order
|
||||||
|
|
||||||
|
fn print(message:&str){
|
||||||
|
web_sys::console::log_1(&message.into());
|
||||||
|
}
|
||||||
pub fn new<'a>(
|
pub fn new<'a>(
|
||||||
mut graphics:crate::graphics::GraphicsState,
|
mut graphics:crate::graphics::GraphicsState,
|
||||||
mut config:wgpu::SurfaceConfiguration,
|
mut config:wgpu::SurfaceConfiguration,
|
||||||
@ -33,10 +36,18 @@ pub fn new<'a>(
|
|||||||
}
|
}
|
||||||
Instruction::Render(frame_state)=>{
|
Instruction::Render(frame_state)=>{
|
||||||
if let Some((size,user_settings))=resize.take(){
|
if let Some((size,user_settings))=resize.take(){
|
||||||
println!("Resizing to {:?}",size);
|
print(format!("Resizing to {:?}",size).as_str());
|
||||||
//let t0=std::time::Instant::now();
|
//let t0=std::time::Instant::now();
|
||||||
config.width=size.width.clamp(1,2560/2);
|
match size{
|
||||||
config.height=size.height.clamp(1,1440/2);
|
winit::dpi::PhysicalSize{width:2560,height:1440}=>{
|
||||||
|
config.width=size.width.clamp(1,2560);
|
||||||
|
config.height=size.height.clamp(1,1440);
|
||||||
|
},
|
||||||
|
_=>{
|
||||||
|
config.width=size.width.clamp(1,1280);
|
||||||
|
config.height=size.height.clamp(1,720);
|
||||||
|
}
|
||||||
|
}
|
||||||
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());
|
||||||
|
Loading…
Reference in New Issue
Block a user