fix: present suboptimal frames
This commit is contained in:
parent
0094b347d4
commit
dfcd989947
1 changed files with 7 additions and 2 deletions
|
|
@ -368,13 +368,14 @@ pub fn present(
|
||||||
) -> Result<(), compositor::SurfaceError> {
|
) -> Result<(), compositor::SurfaceError> {
|
||||||
match surface.get_current_texture() {
|
match surface.get_current_texture() {
|
||||||
Ok(frame) => {
|
Ok(frame) => {
|
||||||
if frame.suboptimal
|
if frame.texture.width() != viewport.physical_width()
|
||||||
|| frame.texture.width() != viewport.physical_width()
|
|
||||||
|| frame.texture.height() != viewport.physical_height()
|
|| frame.texture.height() != viewport.physical_height()
|
||||||
{
|
{
|
||||||
return Err(compositor::SurfaceError::Outdated);
|
return Err(compositor::SurfaceError::Outdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let suboptimal = frame.suboptimal;
|
||||||
|
|
||||||
let view = &frame
|
let view = &frame
|
||||||
.texture
|
.texture
|
||||||
.create_view(&wgpu::TextureViewDescriptor::default());
|
.create_view(&wgpu::TextureViewDescriptor::default());
|
||||||
|
|
@ -390,6 +391,10 @@ pub fn present(
|
||||||
on_pre_present();
|
on_pre_present();
|
||||||
frame.present();
|
frame.present();
|
||||||
|
|
||||||
|
if suboptimal {
|
||||||
|
return Err(compositor::SurfaceError::Outdated);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Err(error) => match error {
|
Err(error) => match error {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue