Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions crates/bevy_render/src/view/window/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,29 @@ pub fn prepare_windows(

let surface = &surface_data.surface;
match surface.get_current_texture() {
wgpu::CurrentSurfaceTexture::Success(surface_texture)
| wgpu::CurrentSurfaceTexture::Suboptimal(surface_texture) => {
wgpu::CurrentSurfaceTexture::Success(surface_texture) => {
window.set_swapchain_texture(surface_texture);
}
wgpu::CurrentSurfaceTexture::Suboptimal(surface_texture) => {
// Suboptimal: the swapchain still presents but no longer matches the
// surface (compositor scale / output reconfig on desktop Linux is the
// common trigger). wgpu_hal logs a WARN every present until we
// reconfigure, so mirror the Outdated path: drop the frame,
// reconfigure, re-acquire.
drop(surface_texture);
render_device.configure_surface(surface, &surface_data.configuration);
let frame = match surface.get_current_texture() {
wgpu::CurrentSurfaceTexture::Success(surface_texture)
| wgpu::CurrentSurfaceTexture::Suboptimal(surface_texture) => surface_texture,
variant => {
warn!(
"Couldn't get swap chain texture after suboptimal reconfigure. Cause: '{variant:?}'"
);
continue;
}
};
window.set_swapchain_texture(frame);
}
#[cfg(target_os = "linux")]
wgpu::CurrentSurfaceTexture::Timeout if may_erroneously_timeout() => {
bevy_log::trace!(
Expand Down
Loading