pub fn new<Name>(device: Arc<Device>, name: Name) -> Result<Self>
    where
        Name: Into<String>,
    {
        let owned_name = name.into();
        let (descriptor_set_layout, bindings) = unsafe {
            pipeline2d::descriptor_sets::create_descriptor_set_layout(&device)?
        };
        device.name_vulkan_object(
            format!("{} - DescriptorSetLayout", owned_name.clone()),
            vk::ObjectType::DESCRIPTOR_SET_LAYOUT,
            &descriptor_set_layout,
        )?;

        // create a descriptor pool which exactly matches the number of bindings
        let pool_sizes: Vec<vk::DescriptorPoolSize> = bindings
            .iter()
            .map(|binding| vk::DescriptorPoolSize {
                ty: binding.descriptor_type,
                descriptor_count: binding.descriptor_count,
            })
            .collect();
        let pool_create_info = vk::DescriptorPoolCreateInfo {
            p_pool_sizes: pool_sizes.as_ptr(),
            pool_size_count: pool_sizes.len() as u32,
            max_sets: 1,
            flags: vk::DescriptorPoolCreateFlags::empty(),
            ..Default::default()
        };
        let descriptor_pool = unsafe {
            device
                .logical_device
                .create_descriptor_pool(&pool_create_info, None)?
        };
        device.name_vulkan_object(
            format!("{} - DescriptorPool", owned_name.clone()),
            vk::ObjectType::DESCRIPTOR_POOL,
            &descriptor_pool,
        )?;

        let descriptor_set_layouts = [descriptor_set_layout];
        let descriptor_set_allocate_info = vk::DescriptorSetAllocateInfo {
            descriptor_pool,
            p_set_layouts: descriptor_set_layouts.as_ptr(),
            descriptor_set_count: descriptor_set_layouts.len() as u32,
            ..Default::default()
        };

        let descriptor_set = unsafe {
            device
                .logical_device
                .allocate_descriptor_sets(&descriptor_set_allocate_info)?[0]
        };
        device.name_vulkan_object(
            format!("{} - DescriptorSet", owned_name.clone()),
            vk::ObjectType::DESCRIPTOR_SET,
            &descriptor_set,
        )?;

        Ok(Self {
            descriptor_pool,
            descriptor_set_layout,
            descriptor_set,
            atlas_version: AtlasVersion::new_out_of_date(),
            device,
        })
    }
/// Create a new descriptor for an application frame.
Create a new descriptor for an application frame.
Create a new descriptor for an application frame .
pub fn new<Name>(device: Arc<Device>, name: Name) -> Result<Self>
    where
        Name: Into<String>,
    {
        let owned_name = name.into();
        let (descriptor_set_layout, bindings) = unsafe {
            pipeline2d::descriptor_sets::create_descriptor_set_layout(&device)?
        };
        device.name_vulkan_object(
            format!("{} - DescriptorSetLayout", owned_name.clone()),
            vk::ObjectType::DESCRIPTOR_SET_LAYOUT,
            &descriptor_set_layout,
        )?;
        // create a descriptor pool which exactly matches the number of bindings
        let pool_sizes: Vec<vk::DescriptorPoolSize> = bindings
            .iter()
            .map(|binding| vk::DescriptorPoolSize {
                ty: binding.descriptor_type,
                descriptor_count: binding.descriptor_count,
            })
            .collect();
        let pool_create_info = vk::DescriptorPoolCreateInfo {
            p_pool_sizes: pool_sizes.as_ptr(),
            pool_size_count: pool_sizes.len() as u32,
            max_sets: 1,
            flags: vk::DescriptorPoolCreateFlags::empty(),
            ..Default::default()
        };
        let descriptor_pool = unsafe {
            device
                .logical_device
                .create_descriptor_pool(&pool_create_info, None)?
        };
        device.name_vulkan_object(
            format!("{} - DescriptorPool", owned_name.clone()),
            vk::ObjectType::DESCRIPTOR_POOL,
            &descriptor_pool,
        )?;
        let descriptor_set_layouts = [descriptor_set_layout];
        let descriptor_set_allocate_info = vk::DescriptorSetAllocateInfo {
            descriptor_pool,
            p_set_layouts: descriptor_set_layouts.as_ptr(),
            descriptor_set_count: descriptor_set_layouts.len() as u32,
            ..Default::default()
        };
        let descriptor_set = unsafe {
            device
                .logical_device
                .allocate_descriptor_sets(&descriptor_set_allocate_info)?[0]
        };
        device.name_vulkan_object(
            format!("{} - DescriptorSet", owned_name.clone()),
            vk::ObjectType::DESCRIPTOR_SET,
            &descriptor_set,
        )?;
        Ok(Self {
            descriptor_pool,
            descriptor_set_layout,
            descriptor_set,
            atlas_version: AtlasVersion::new_out_of_date(),
            device,
        })
    }
pub fn new < Name > ( device : Arc < Device > , name : Name ) -> Result < Self > where Name : Into < String > , { let owned_name = name . into ( ) ; let ( descriptor_set_layout , bindings ) = unsafe { pipeline2d :: descriptor_sets :: create_descriptor_set_layout ( & device ) ? } ; device . name_vulkan_object ( format ! ( " " owned_name clone ( ) ) , vk :: ObjectType :: DESCRIPTOR_SET_LAYOUT , & descriptor_set_layout , ) ? ; // create a descriptor pool which exactly matches the number of bindings let pool_sizes : Vec < vk :: DescriptorPoolSize > = bindings . iter ( ) . map ( | binding | vk :: DescriptorPoolSize { ty : binding . descriptor_type , descriptor_count : binding . descriptor_count , } ) . collect ( ) ; let pool_create_info = vk :: DescriptorPoolCreateInfo { p_pool_sizes : pool_sizes . as_ptr ( ) , pool_size_count : pool_sizes . len ( ) as u32 , max_sets : 1 , flags : vk :: DescriptorPoolCreateFlags :: empty ( ) , .. Default :: default ( ) } ; let descriptor_pool = unsafe { device . logical_device . create_descriptor_pool ( & pool_create_info , None ) ? } ; device . name_vulkan_object ( format ! ( " " owned_name clone ( ) ) , vk :: ObjectType :: DESCRIPTOR_POOL , & descriptor_pool , ) ? ; let descriptor_set_layouts = [ descriptor_set_layout ] ; let descriptor_set_allocate_info = vk :: DescriptorSetAllocateInfo { descriptor_pool , p_set_layouts : descriptor_set_layouts . as_ptr ( ) , descriptor_set_count : descriptor_set_layouts . len ( ) as u32 , .. Default :: default ( ) } ; let descriptor_set = unsafe { device . logical_device . allocate_descriptor_sets ( & descriptor_set_allocate_info ) ? [ 0 ] } ; device . name_vulkan_object ( format ! ( " " owned_name clone ( ) ) , vk :: ObjectType :: DESCRIPTOR_SET , & descriptor_set , ) ? ; Ok ( Self { descriptor_pool , descriptor_set_layout , descriptor_set , atlas_version : AtlasVersion :: new_out_of_date ( ) , device , } ) }
Create a new descriptor for an application frame.
Create a new descriptor for an application frame .
device
Arc<Device>
name
Name