fix: present suboptimal frames

This commit is contained in:
Hojjat 2026-05-27 14:50:31 -06:00 committed by Ashley Wulber
parent 0094b347d4
commit dfcd989947

View file

@ -368,13 +368,14 @@ pub fn present(
) -> Result<(), compositor::SurfaceError> {
match surface.get_current_texture() {
Ok(frame) => {
if frame.suboptimal
|| frame.texture.width() != viewport.physical_width()
if frame.texture.width() != viewport.physical_width()
|| frame.texture.height() != viewport.physical_height()
{
return Err(compositor::SurfaceError::Outdated);
}
let suboptimal = frame.suboptimal;
let view = &frame
.texture
.create_view(&wgpu::TextureViewDescriptor::default());
@ -390,6 +391,10 @@ pub fn present(
on_pre_present();
frame.present();
if suboptimal {
return Err(compositor::SurfaceError::Outdated);
}
Ok(())
}
Err(error) => match error {