pub fn create(
        device: Arc<Device>,
        usage: vk::BufferUsageFlags,
        properties: vk::MemoryPropertyFlags,
        size: u64,
    ) -> Result<Self> {
        let create_info = vk::BufferCreateInfo {
            size,
            usage,
            sharing_mode: vk::SharingMode::EXCLUSIVE,
            ..Default::default()
        };

        let raw =
            unsafe { device.logical_device.create_buffer(&create_info, None)? };

        let buffer_memory_requirements = unsafe {
            device.logical_device.get_buffer_memory_requirements(raw)
        };

        let allocation = unsafe {
            device.allocate_memory(buffer_memory_requirements, properties)?
        };

        unsafe {
            device.logical_device.bind_buffer_memory(
                raw,
                allocation.memory,
                allocation.offset,
            )?;
        }

        Ok(Self {
            raw,
            allocation,
            usage,
            properties,
            device,
        })
    }
/// Create a new buffer with the specified size.
Create a new buffer with the specified size.
Create a new buffer with the specified size .
pub fn create(
        device: Arc<Device>,
        usage: vk::BufferUsageFlags,
        properties: vk::MemoryPropertyFlags,
        size: u64,
    ) -> Result<Self> {
        let create_info = vk::BufferCreateInfo {
            size,
            usage,
            sharing_mode: vk::SharingMode::EXCLUSIVE,
            ..Default::default()
        };
        let raw =
            unsafe { device.logical_device.create_buffer(&create_info, None)? };
        let buffer_memory_requirements = unsafe {
            device.logical_device.get_buffer_memory_requirements(raw)
        };
        let allocation = unsafe {
            device.allocate_memory(buffer_memory_requirements, properties)?
        };
        unsafe {
            device.logical_device.bind_buffer_memory(
                raw,
                allocation.memory,
                allocation.offset,
            )?;
        }
        Ok(Self {
            raw,
            allocation,
            usage,
            properties,
            device,
        })
    }
pub fn create ( device : Arc < Device > , usage : vk :: BufferUsageFlags , properties : vk :: MemoryPropertyFlags , size : u64 , ) -> Result < Self > { let create_info = vk :: BufferCreateInfo { size , usage , sharing_mode : vk :: SharingMode :: EXCLUSIVE , .. Default :: default ( ) } ; let raw = unsafe { device . logical_device . create_buffer ( & create_info , None ) ? } ; let buffer_memory_requirements = unsafe { device . logical_device . get_buffer_memory_requirements ( raw ) } ; let allocation = unsafe { device . allocate_memory ( buffer_memory_requirements , properties ) ? } ; unsafe { device . logical_device . bind_buffer_memory ( raw , allocation . memory , allocation . offset , ) ? ; } Ok ( Self { raw , allocation , usage , properties , device , } ) }
Create a new buffer with the specified size.
Create a new buffer with the specified size .
device
Arc<Device>
usage
vk::BufferUsageFlags
properties
vk::MemoryPropertyFlags
size
u64