diff --git a/src/definitions.rs b/src/definitions.rs index bf513ca..0f81eb9 100644 --- a/src/definitions.rs +++ b/src/definitions.rs @@ -389,7 +389,13 @@ bitflags! { pub struct AllocatorCreateInfo<'a> { /// Vulkan physical device. It must be valid throughout whole lifetime of created allocator. pub(crate) physical_device: PhysicalDevice, + + /// Vulkan device. + /// It must be valid throughout the whole lifetime of created allocator. pub(crate) device: &'a Device, + + /// Handle to Vulkan instance object. + /// Must be valid throughout the whole lifetime of created allocator. pub(crate) instance: &'a Instance, /// Flags for created allocator. diff --git a/src/lib.rs b/src/lib.rs index f0d296d..0ec32b5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,8 +46,10 @@ unsafe impl Send for Allocation {} unsafe impl Sync for Allocation {} impl Allocator { - /// Constructor a new `Allocator` using the provided options. - pub fn new(create_info: AllocatorCreateInfo) -> VkResult { + /// Construct a new `Allocator` using the provided options. + /// Safety: [`AllocatorCreateInfo::instance`], [`AllocatorCreateInfo::device`] and + /// [`AllocatorCreateInfo::physical_device`] must be valid throughout the lifetime of the allocator. + pub unsafe fn new(create_info: AllocatorCreateInfo) -> VkResult { unsafe extern "system" fn get_instance_proc_addr_stub( _instance: vk::Instance, _p_name: *const ::std::os::raw::c_char,