Skip to content

Commit

Permalink
update configuration when the window changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Feb 27, 2024
1 parent bb815fa commit 1b2759a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/bevy_render/src/view/window/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,16 @@ pub fn create_surfaces(
});

if window.size_changed || window.present_mode_changed {
data.configuration.width = window.physical_width;
data.configuration.height = window.physical_height;
data.configuration.present_mode = match window.present_mode {
PresentMode::Fifo => wgpu::PresentMode::Fifo,
PresentMode::FifoRelaxed => wgpu::PresentMode::FifoRelaxed,
PresentMode::Mailbox => wgpu::PresentMode::Mailbox,
PresentMode::Immediate => wgpu::PresentMode::Immediate,
PresentMode::AutoVsync => wgpu::PresentMode::AutoVsync,
PresentMode::AutoNoVsync => wgpu::PresentMode::AutoNoVsync,
};
render_device.configure_surface(&data.surface, &data.configuration);
}
}
Expand Down

0 comments on commit 1b2759a

Please sign in to comment.