mirror of
https://github.com/vulkano-rs/vulkano.git
synced 2024-11-22 06:45:23 +00:00
Remove remaining std::mem::replace usages in examples (#1006)
This commit is contained in:
parent
b0832072fc
commit
257994c7e8
@ -171,8 +171,8 @@ fn main() {
|
||||
Err(err) => panic!("{:?}", err)
|
||||
};
|
||||
|
||||
std::mem::replace(&mut swapchain, new_swapchain);
|
||||
std::mem::replace(&mut images, new_images);
|
||||
swapchain = new_swapchain;
|
||||
images = new_images;
|
||||
|
||||
framebuffers = None;
|
||||
|
||||
@ -186,12 +186,11 @@ fn main() {
|
||||
}
|
||||
|
||||
if framebuffers.is_none() {
|
||||
let new_framebuffers = Some(images.iter().map(|image| {
|
||||
framebuffers = Some(images.iter().map(|image| {
|
||||
Arc::new(vulkano::framebuffer::Framebuffer::start(renderpass.clone())
|
||||
.add(image.clone()).unwrap()
|
||||
.build().unwrap())
|
||||
}).collect::<Vec<_>>());
|
||||
std::mem::replace(&mut framebuffers, new_framebuffers);
|
||||
}
|
||||
|
||||
let (image_num, future) = match vulkano::swapchain::acquire_next_image(swapchain.clone(),
|
||||
|
@ -168,8 +168,7 @@ fn main() {
|
||||
swapchain = new_swapchain;
|
||||
images = new_images;
|
||||
|
||||
let new_depth_buffer = vulkano::image::attachment::AttachmentImage::transient(device.clone(), dimensions, vulkano::format::D16Unorm).unwrap();
|
||||
std::mem::replace(&mut depth_buffer, new_depth_buffer);
|
||||
depth_buffer = vulkano::image::attachment::AttachmentImage::transient(device.clone(), dimensions, vulkano::format::D16Unorm).unwrap();
|
||||
|
||||
framebuffers = None;
|
||||
|
||||
@ -185,13 +184,12 @@ fn main() {
|
||||
}
|
||||
|
||||
if framebuffers.is_none() {
|
||||
let new_framebuffers = Some(images.iter().map(|image| {
|
||||
framebuffers = Some(images.iter().map(|image| {
|
||||
Arc::new(vulkano::framebuffer::Framebuffer::start(renderpass.clone())
|
||||
.add(image.clone()).unwrap()
|
||||
.add(depth_buffer.clone()).unwrap()
|
||||
.build().unwrap())
|
||||
}).collect::<Vec<_>>());
|
||||
std::mem::replace(&mut framebuffers, new_framebuffers);
|
||||
}
|
||||
|
||||
let uniform_buffer_subbuffer = {
|
||||
|
@ -57,7 +57,6 @@ use vulkano::sync::now;
|
||||
use vulkano::sync::GpuFuture;
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::mem;
|
||||
|
||||
fn main() {
|
||||
// The first step of any vulkan program is to create an instance.
|
||||
@ -364,8 +363,8 @@ void main() {
|
||||
Err(err) => panic!("{:?}", err)
|
||||
};
|
||||
|
||||
mem::replace(&mut swapchain, new_swapchain);
|
||||
mem::replace(&mut images, new_images);
|
||||
swapchain = new_swapchain;
|
||||
images = new_images;
|
||||
|
||||
framebuffers = None;
|
||||
|
||||
@ -381,12 +380,11 @@ void main() {
|
||||
// Because framebuffers contains an Arc on the old swapchain, we need to
|
||||
// recreate framebuffers as well.
|
||||
if framebuffers.is_none() {
|
||||
let new_framebuffers = Some(images.iter().map(|image| {
|
||||
framebuffers = Some(images.iter().map(|image| {
|
||||
Arc::new(Framebuffer::start(render_pass.clone())
|
||||
.add(image.clone()).unwrap()
|
||||
.build().unwrap())
|
||||
}).collect::<Vec<_>>());
|
||||
mem::replace(&mut framebuffers, new_framebuffers);
|
||||
}
|
||||
|
||||
// Before we can draw on the output, we have to *acquire* an image from the swapchain. If
|
||||
|
Loading…
Reference in New Issue
Block a user