/// Creates a buffer with TRANSFER_DST and appropriate image type flags
/// flipped.
Creates a buffer with TRANSFER_DST and appropriate image type flags
flipped.
Creates a buffer with TRANSFER_DST and appropriate image type flags flipped .
fn create_gpu_image(
    &self, dimens: (u32, u32), format: vk::Format, usage: vk::ImageUsageFlags,
    queue_family_index: u32, mip_levels: u32, num_msaa_samples: NumSamples,
  ) -> SarektResult<(vk::Image, vk_mem::Allocation, vk_mem::AllocationInfo)> {
    let image_ci = vk::ImageCreateInfo::builder()
      .image_type(vk::ImageType::TYPE_2D)
      .usage(usage)
      .extent(vk::Extent3D {
        width: dimens.0,
        height: dimens.1,
        depth: 1,
      })
      .mip_levels(mip_levels)
      .array_layers(1) // Not an array.
      .format(format)
      .tiling(vk::ImageTiling::OPTIMAL) // Texels are laid out in hardware optimal format, not necessarily linearly.
      .initial_layout(vk::ImageLayout::UNDEFINED)
      .queue_family_indices(&[queue_family_index])
      .sharing_mode(vk::SharingMode::EXCLUSIVE) // Only used by the one queue family.
      .samples(num_msaa_samples.into()) // Not multisampling, this isn't for an attachment.
      .build();
    let alloc_ci = vk_mem::AllocationCreateInfo {
      usage: vk_mem::MemoryUsage::GpuOnly,
      ..vk_mem::AllocationCreateInfo::default()
    };
    Ok(self.allocator.create_image(&image_ci, &alloc_ci)?)
  }
fn create_gpu_image ( & self , dimens : ( u32 , u32 ) , format : vk :: Format , usage : vk :: ImageUsageFlags , queue_family_index : u32 , mip_levels : u32 , num_msaa_samples : NumSamples , ) -> SarektResult < ( vk :: Image , vk_mem :: Allocation , vk_mem :: AllocationInfo ) > { let image_ci = vk :: ImageCreateInfo :: builder ( ) . image_type ( vk :: ImageType :: TYPE_2D ) . usage ( usage ) . extent ( vk :: Extent3D { width : dimens . 0 , height : dimens . 1 , depth : 1 , } ) . mip_levels ( mip_levels ) . array_layers ( 1 ) // Not an array. . format ( format ) . tiling ( vk :: ImageTiling :: OPTIMAL ) // Texels are laid out in hardware optimal format, not necessarily linearly. . initial_layout ( vk :: ImageLayout :: UNDEFINED ) . queue_family_indices ( & [ queue_family_index ] ) . sharing_mode ( vk :: SharingMode :: EXCLUSIVE ) // Only used by the one queue family. . samples ( num_msaa_samples . into ( ) ) // Not multisampling, this isn't for an attachment. . build ( ) ; let alloc_ci = vk_mem :: AllocationCreateInfo { usage : vk_mem :: MemoryUsage :: GpuOnly , .. vk_mem :: AllocationCreateInfo :: default ( ) } ; Ok ( self . allocator . create_image ( & image_ci , & alloc_ci ) ? ) }
Creates a buffer with TRANSFER_DST and appropriate image type flags
flipped.
Creates a buffer with TRANSFER_DST and appropriate image type flags flipped .
&self
dimens
(u32, u32)
format
vk::Format
usage
vk::ImageUsageFlags
queue_family_index
u32
mip_levels
u32
num_msaa_samples
NumSamples