Skip to content

Commit

Permalink
Update comments reflecting Allocator lifetime guarantees.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neo-Zhixing committed May 3, 2024
1 parent c12f96a commit e967d57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> {
/// 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<Self> {
unsafe extern "system" fn get_instance_proc_addr_stub(
_instance: vk::Instance,
_p_name: *const ::std::os::raw::c_char,
Expand Down

0 comments on commit e967d57

Please sign in to comment.