/// Given the render target images and format, create an image view suitable
/// for rendering on. (one level, no mipmapping, color bit access).
Given the render target images and format, create an image view suitable
for rendering on. (one level, no mipmapping, color bit access).
Given the render target images and format create an image view suitable for rendering on . ( one level no mipmapping color bit access ) .
fn create_render_target_image_views(
    logical_device: &Arc<Device>, targets: Vec<vk::Image>, format: vk::Format,
  ) -> SarektResult<Vec<ImageAndView>> {
    let mut views = Vec::with_capacity(targets.len());
    for &image in targets.iter() {
      // Not swizzling rgba around.
      let component_mapping = vk::ComponentMapping::default();
      let image_subresource_range = vk::ImageSubresourceRange::builder()
        .aspect_mask(vk::ImageAspectFlags::COLOR) // We're writing color to this view
        .base_mip_level(0) // access to all mipmap levels
        .level_count(1) // Only one level, no mipmapping
        .base_array_layer(0) // access to all layers
        .layer_count(1) // Only one layer. (not sterescopic)
        .build();
      let ci = vk::ImageViewCreateInfo::builder()
        .image(image)
        .view_type(vk::ImageViewType::TYPE_2D)
        .format(format)
        .components(component_mapping)
        .subresource_range(image_subresource_range);
      let view = unsafe { logical_device.create_image_view(&ci, None)? };
      unsafe { views.push(ImageAndView::new(image, view)) };
    }
    Ok(views)
  }
fn create_render_target_image_views ( logical_device : & Arc < Device > , targets : Vec < vk :: Image > , format : vk :: Format , ) -> SarektResult < Vec < ImageAndView > > { let mut views = Vec :: with_capacity ( targets . len ( ) ) ; for & image in targets . iter ( ) { // Not swizzling rgba around. let component_mapping = vk :: ComponentMapping :: default ( ) ; let image_subresource_range = vk :: ImageSubresourceRange :: builder ( ) . aspect_mask ( vk :: ImageAspectFlags :: COLOR ) // We're writing color to this view . base_mip_level ( 0 ) // access to all mipmap levels . level_count ( 1 ) // Only one level, no mipmapping . base_array_layer ( 0 ) // access to all layers . layer_count ( 1 ) // Only one layer. (not sterescopic) . build ( ) ; let ci = vk :: ImageViewCreateInfo :: builder ( ) . image ( image ) . view_type ( vk :: ImageViewType :: TYPE_2D ) . format ( format ) . components ( component_mapping ) . subresource_range ( image_subresource_range ) ; let view = unsafe { logical_device . create_image_view ( & ci , None ) ? } ; unsafe { views . push ( ImageAndView :: new ( image , view ) ) } ; } Ok ( views ) }
Given the render target images and format, create an image view suitable
for rendering on.
Given the render target images and format create an image view suitable for rendering on .
logical_device
&Arc<Device>
targets
Vec<vk::Image>
format
vk::Format