pub fn create_framebuffers(
    device: &Device,
    swapchain_image_views: &Vec<vk::ImageView>,
    render_pass: vk::RenderPass,
    extent: vk::Extent2D,
) -> Result<Vec<vk::Framebuffer>> {
    let mut framebuffers = vec![];
    framebuffers.reserve(swapchain_image_views.len());

    for (i, image_view) in swapchain_image_views.iter().enumerate() {
        let attachments = &[*image_view];
        let create_info = vk::FramebufferCreateInfo {
            render_pass,
            p_attachments: attachments.as_ptr(),
            attachment_count: attachments.len() as u32,
            width: extent.width,
            height: extent.height,
            layers: 1,
            ..Default::default()
        };
        let framebuffer = unsafe {
            device
                .logical_device
                .create_framebuffer(&create_info, None)?
        };
        device.name_vulkan_object(
            format!("Framebuffer {}", i),
            vk::ObjectType::FRAMEBUFFER,
            &framebuffer,
        )?;
        framebuffers.push(framebuffer);
    }

    Ok(framebuffers)
}
/// Create one framebuffer for each swapchain image view
///
/// The caller is responsible for destroying the framebuffers when they are
/// done being used.
Create one framebuffer for each swapchain image view
The caller is responsible for destroying the framebuffers when they are
done being used.
Create one framebuffer for each swapchain image view The caller is responsible for destroying the framebuffers when they are done being used .
pub fn create_framebuffers(
    device: &Device,
    swapchain_image_views: &Vec<vk::ImageView>,
    render_pass: vk::RenderPass,
    extent: vk::Extent2D,
) -> Result<Vec<vk::Framebuffer>> {
    let mut framebuffers = vec![];
    framebuffers.reserve(swapchain_image_views.len());
    for (i, image_view) in swapchain_image_views.iter().enumerate() {
        let attachments = &[*image_view];
        let create_info = vk::FramebufferCreateInfo {
            render_pass,
            p_attachments: attachments.as_ptr(),
            attachment_count: attachments.len() as u32,
            width: extent.width,
            height: extent.height,
            layers: 1,
            ..Default::default()
        };
        let framebuffer = unsafe {
            device
                .logical_device
                .create_framebuffer(&create_info, None)?
        };
        device.name_vulkan_object(
            format!("Framebuffer {}", i),
            vk::ObjectType::FRAMEBUFFER,
            &framebuffer,
        )?;
        framebuffers.push(framebuffer);
    }
    Ok(framebuffers)
}
pub fn create_framebuffers ( device : & Device , swapchain_image_views : & Vec < vk :: ImageView > , render_pass : vk :: RenderPass , extent : vk :: Extent2D , ) -> Result < Vec < vk :: Framebuffer > > { let mut framebuffers = vec ! [ ] ; framebuffers . reserve ( swapchain_image_views . len ( ) ) ; for ( i , image_view ) in swapchain_image_views . iter ( ) . enumerate ( ) { let attachments = & [ * image_view ] ; let create_info = vk :: FramebufferCreateInfo { render_pass , p_attachments : attachments . as_ptr ( ) , attachment_count : attachments . len ( ) as u32 , width : extent . width , height : extent . height , layers : 1 , .. Default :: default ( ) } ; let framebuffer = unsafe { device . logical_device . create_framebuffer ( & create_info , None ) ? } ; device . name_vulkan_object ( format ! ( " " i ) , vk :: ObjectType :: FRAMEBUFFER , & framebuffer , ) ? ; framebuffers . push ( framebuffer ) ; } Ok ( framebuffers ) }
Create one framebuffer for each swapchain image view
The caller is responsible for destroying the framebuffers when they are
done being used.
Create one framebuffer for each swapchain image view The caller is responsible for destroying the framebuffers when they are done being used .
device
&Device
swapchain_image_views
&Vec<vk::ImageView>
render_pass
vk::RenderPass
extent
vk::Extent2D