Skip to main content

AllocationCreateInfo

Struct AllocationCreateInfo 

Source
pub struct AllocationCreateInfo<'pool> {
Show 19 fields pub within_budget: bool, pub dedicated_memory: bool, pub memory_allocate_next: Option<AllocationChain<'pool>>, pub never_allocate: bool, pub can_alias: bool, pub priority: MemoryPriority, pub min_allocation_alignment: u64, pub pool: Option<&'pool Pool>, pub usage: MemoryUsage, pub host_access: HostAccess, pub allow_transfer_instead: bool, pub avoided_flags: MemoryPropertyFlags, pub required_flags: MemoryPropertyFlags, pub preferred_flags: MemoryPropertyFlags, pub memory_type_bits: u32, pub strategy: PlacementStrategy, pub upper_address: bool, pub policy: AllocationPolicy, pub persistent_map: bool,
}
Expand description

Managed-resource policy, including optional borrowed native allocation storage; this Rust record is not part of the Vulkan ABI.

Fields§

§within_budget: bool

Gate new native memory against owned cached/refreshed budgets; reuse needs no new budget.

§dedicated_memory: bool

Force separate native storage, including in automatic custom pools.

§memory_allocate_next: Option<AllocationChain<'pool>>

Borrowed native allocation chain. Implies separate storage; never combined with a pool chain. Imports are attempted once and never initialized/poisoned.

§never_allocate: bool

Reuse existing pool storage only; never grow or fall back to separate native storage.

§can_alias: bool

Reserve conservatively for alias resources and omit resource-specific dedication.

§priority: MemoryPriority

Non-default priority requires captured enabled EXT_memory_priority.

§min_allocation_alignment: u64

Additional offset alignment; zero means only native/pool/atom constraints. Otherwise a power of two, combined with every mandatory alignment.

§pool: Option<&'pool Pool>

Fixed-type custom pool. Overrides policy; native type compatibility and required properties remain mandatory. No fallback outside this pool.

Pool policy storage cannot outlive or be used after destroying its pool:

ⓘ
let options = vk::mem::AllocationCreateInfo::new().set_pool(Some(pool));
allocator.destroy_pool(pool).unwrap();
assert!(!options.pool.unwrap().is_destroyed());
§usage: MemoryUsage§host_access: HostAccess

Automatic host intent also prefers already mapped compatible blocks. Explicit usage retains mapping intent; absence of automatic intent prefers unmapped blocks.

§allow_transfer_instead: bool

Permit automatic selection of non-host-visible memory; caller supplies staging.

§avoided_flags: MemoryPropertyFlags

Properties penalized during memory-type selection; never a hard exclusion.

§required_flags: MemoryPropertyFlags§preferred_flags: MemoryPropertyFlags§memory_type_bits: u32

Intersected with queried native requirements; zero admits no memory types.

§strategy: PlacementStrategy

TLSF block search is forward except MinTime, which searches in reverse. Other strategies group host-visible blocks by mapping preference first.

§upper_address: bool

Allocate downward in a single-block linear custom pool. Other routes reject it.

§policy: AllocationPolicy§persistent_map: bool

Retain a mapping until explicit allocation release. Requires host-visible storage.

Implementations§

Source§

impl<'pool> AllocationCreateInfo<'pool>

Source

pub fn new() -> Self

Construct the record with its default state.

Source

pub fn set_within_budget(self, value: bool) -> Self

Set within_budget and return the updated record.

Source

pub fn set_dedicated_memory(self, value: bool) -> Self

Set dedicated_memory and return the updated record.

Source

pub fn set_memory_allocate_next( self, value: Option<AllocationChain<'pool>>, ) -> Self

Set memory_allocate_next and return the updated record.

The descriptor retains its chain storage borrow:

ⓘ
let options;
{
    let record = vk::ExportMemoryAllocateInfo::new();
    // SAFETY: this correctly tagged record has no linked or nested storage.
    let chain = unsafe { vk::mem::AllocationChain::new_from_record(&record) }.unwrap();
    options = vk::mem::AllocationCreateInfo::new()
        .set_memory_allocate_next(Some(chain))
        .set_dedicated_memory(true);
}
assert!(options.memory_allocate_next.is_some());
Source

pub fn set_never_allocate(self, value: bool) -> Self

Set never_allocate and return the updated record.

Source

pub fn set_can_alias(self, value: bool) -> Self

Set can_alias and return the updated record.

Source

pub fn set_priority(self, value: MemoryPriority) -> Self

Set priority and return the updated record.

Source

pub fn set_min_allocation_alignment(self, value: u64) -> Self

Set min_allocation_alignment and return the updated record.

Source

pub fn set_pool(self, value: Option<&'pool Pool>) -> Self

Set pool and return the updated record.

Source

pub fn set_usage(self, value: MemoryUsage) -> Self

Set usage and return the updated record.

Source

pub fn set_host_access(self, value: HostAccess) -> Self

Set host_access and return the updated record.

Source

pub fn set_allow_transfer_instead(self, value: bool) -> Self

Set allow_transfer_instead and return the updated record.

Source

pub fn set_avoided_flags(self, value: MemoryPropertyFlags) -> Self

Set avoided_flags and return the updated record.

Source

pub fn set_required_flags(self, value: MemoryPropertyFlags) -> Self

Set required_flags and return the updated record.

Source

pub fn set_preferred_flags(self, value: MemoryPropertyFlags) -> Self

Set preferred_flags and return the updated record.

Source

pub fn set_memory_type_bits(self, value: u32) -> Self

Set memory_type_bits and return the updated record.

Source

pub fn set_strategy(self, value: PlacementStrategy) -> Self

Set strategy and return the updated record.

Source

pub fn set_upper_address(self, value: bool) -> Self

Set upper_address and return the updated record.

Source

pub fn set_policy(self, value: AllocationPolicy) -> Self

Set policy and return the updated record.

Source

pub fn set_persistent_map(self, value: bool) -> Self

Set persistent_map and return the updated record.

Trait Implementations§

Source§

impl<'pool> Clone for AllocationCreateInfo<'pool>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'pool> Copy for AllocationCreateInfo<'pool>

Source§

impl<'pool> Debug for AllocationCreateInfo<'pool>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AllocationCreateInfo<'_>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'pool> !Send for AllocationCreateInfo<'pool>

§

impl<'pool> !Sync for AllocationCreateInfo<'pool>

§

impl<'pool> Forget for AllocationCreateInfo<'pool>

§

impl<'pool> Freeze for AllocationCreateInfo<'pool>

§

impl<'pool> Move for AllocationCreateInfo<'pool>

§

impl<'pool> RefUnwindSafe for AllocationCreateInfo<'pool>

§

impl<'pool> Unpin for AllocationCreateInfo<'pool>

§

impl<'pool> UnsafeUnpin for AllocationCreateInfo<'pool>

§

impl<'pool> UnwindSafe for AllocationCreateInfo<'pool>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.