engine_render: Resize swapchain
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 9m7s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 9m7s
This commit is contained in:
parent
dbe415d262
commit
d232706f68
1 changed files with 8 additions and 10 deletions
|
@ -136,9 +136,15 @@ fn window_size_dependent_setup(images: &[Arc<Image>]) -> Vec<Arc<ImageView>> {
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn need_update_window_surface(window_surface: Res<WindowSurface>) -> bool {
|
fn need_update_window_surface(
|
||||||
|
window_surface: Res<WindowSurface>,
|
||||||
|
window_handle: Res<WindowWrapper>,
|
||||||
|
) -> bool {
|
||||||
match &window_surface.surface {
|
match &window_surface.surface {
|
||||||
Some(surface) => surface.recreate_swapchain,
|
Some(surface) => {
|
||||||
|
let window_size: [f32; 2] = window_handle.0.inner_size().into();
|
||||||
|
surface.recreate_swapchain || surface.viewport.extent != window_size
|
||||||
|
}
|
||||||
None => false,
|
None => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,16 +153,8 @@ fn update_window_surface(
|
||||||
mut window_surface: ResMut<WindowSurface>,
|
mut window_surface: ResMut<WindowSurface>,
|
||||||
window_handle: Res<WindowWrapper>,
|
window_handle: Res<WindowWrapper>,
|
||||||
) {
|
) {
|
||||||
if window_surface.surface.is_none() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let window_surface = window_surface.surface.as_mut().unwrap();
|
let window_surface = window_surface.surface.as_mut().unwrap();
|
||||||
|
|
||||||
if !window_surface.recreate_swapchain {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let window_size = window_handle.0.inner_size();
|
let window_size = window_handle.0.inner_size();
|
||||||
let (new_swapchain, new_images) = window_surface
|
let (new_swapchain, new_images) = window_surface
|
||||||
.swapchain
|
.swapchain
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue