graphics: fix fullscreen
This commit is contained in:
@@ -39,23 +39,18 @@ impl<'window> Surface<'window>{
|
||||
}
|
||||
#[must_use]
|
||||
pub fn new_frame(&self,device:&wgpu::Device)->Result<Frame,FrameError>{
|
||||
let frame=match self.surface.get_current_texture(){
|
||||
wgpu::CurrentSurfaceTexture::Success(surface_texture)=>surface_texture,
|
||||
wgpu::CurrentSurfaceTexture::Suboptimal(surface_texture)=>{
|
||||
self.surface.configure(device,&self.config);
|
||||
surface_texture
|
||||
},
|
||||
wgpu::CurrentSurfaceTexture::Outdated=>{
|
||||
self.surface.configure(device,&self.config);
|
||||
match self.surface.get_current_texture(){
|
||||
wgpu::CurrentSurfaceTexture::Success(surface_texture)=>surface_texture,
|
||||
_=>panic!("Failed to acquire next surface texture!"),
|
||||
}
|
||||
}
|
||||
wgpu::CurrentSurfaceTexture::Timeout
|
||||
|wgpu::CurrentSurfaceTexture::Occluded=>return Err(FrameError::Skip),
|
||||
wgpu::CurrentSurfaceTexture::Lost=>return Err(FrameError::DeviceLost),
|
||||
wgpu::CurrentSurfaceTexture::Validation=>unreachable!(),
|
||||
let frame=loop{
|
||||
match self.surface.get_current_texture(){
|
||||
wgpu::CurrentSurfaceTexture::Success(surface_texture)=>break surface_texture,
|
||||
// Suboptimal -> surface_texture must be dropped and surface reconfigured
|
||||
wgpu::CurrentSurfaceTexture::Suboptimal(_)
|
||||
|wgpu::CurrentSurfaceTexture::Outdated=>{},
|
||||
wgpu::CurrentSurfaceTexture::Timeout
|
||||
|wgpu::CurrentSurfaceTexture::Occluded=>return Err(FrameError::Skip),
|
||||
wgpu::CurrentSurfaceTexture::Lost=>return Err(FrameError::DeviceLost),
|
||||
wgpu::CurrentSurfaceTexture::Validation=>unreachable!(),
|
||||
};
|
||||
self.surface.configure(device,&self.config);
|
||||
};
|
||||
let view=frame.texture.create_view(&wgpu::TextureViewDescriptor{
|
||||
format:Some(self.config.view_formats[0]),
|
||||
|
||||
Reference in New Issue
Block a user