WinitViewport supports multiple acquisitions
This commit is contained in:
parent
048afe7e3e
commit
77e4b4dc4b
|
@ -90,11 +90,14 @@ impl WinitViewport {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn acquire(&mut self) -> Result<(), wgpu::SurfaceError> {
|
pub fn acquire(&mut self) -> Result<(), wgpu::SurfaceError> {
|
||||||
let surface_texture = self.surface.get_current_texture()?;
|
if self.output_view.is_none() {
|
||||||
self.output_view = Some(surface_texture
|
let surface_texture = self.surface.get_current_texture()?;
|
||||||
.texture
|
self.output_view = Some(surface_texture
|
||||||
.create_view(&wgpu::TextureViewDescriptor::default()));
|
.texture
|
||||||
self.surface_texture = Some(surface_texture);
|
.create_view(&wgpu::TextureViewDescriptor::default()));
|
||||||
|
self.surface_texture = Some(surface_texture);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +117,7 @@ impl WinitViewport {
|
||||||
pub fn present(&mut self) {
|
pub fn present(&mut self) {
|
||||||
if let Some(surface_texture) = self.surface_texture.take() {
|
if let Some(surface_texture) = self.surface_texture.take() {
|
||||||
surface_texture.present();
|
surface_texture.present();
|
||||||
|
self.output_view.take();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue