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: boolGate new native memory against owned cached/refreshed budgets; reuse needs no new budget.
dedicated_memory: boolForce 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: boolReuse existing pool storage only; never grow or fall back to separate native storage.
can_alias: boolReserve conservatively for alias resources and omit resource-specific dedication.
priority: MemoryPriorityNon-default priority requires captured enabled EXT_memory_priority.
min_allocation_alignment: u64Additional 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: HostAccessAutomatic host intent also prefers already mapped compatible blocks. Explicit usage retains mapping intent; absence of automatic intent prefers unmapped blocks.
allow_transfer_instead: boolPermit automatic selection of non-host-visible memory; caller supplies staging.
avoided_flags: MemoryPropertyFlagsProperties penalized during memory-type selection; never a hard exclusion.
required_flags: MemoryPropertyFlags§preferred_flags: MemoryPropertyFlags§memory_type_bits: u32Intersected with queried native requirements; zero admits no memory types.
strategy: PlacementStrategyTLSF block search is forward except MinTime, which searches in reverse. Other strategies group host-visible blocks by mapping preference first.
upper_address: boolAllocate downward in a single-block linear custom pool. Other routes reject it.
policy: AllocationPolicy§persistent_map: boolRetain a mapping until explicit allocation release. Requires host-visible storage.
Implementations§
Source§impl<'pool> AllocationCreateInfo<'pool>
impl<'pool> AllocationCreateInfo<'pool>
Sourcepub fn set_within_budget(self, value: bool) -> Self
pub fn set_within_budget(self, value: bool) -> Self
Set within_budget and return the updated record.
Sourcepub fn set_dedicated_memory(self, value: bool) -> Self
pub fn set_dedicated_memory(self, value: bool) -> Self
Set dedicated_memory and return the updated record.
Sourcepub fn set_memory_allocate_next(
self,
value: Option<AllocationChain<'pool>>,
) -> Self
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());Sourcepub fn set_never_allocate(self, value: bool) -> Self
pub fn set_never_allocate(self, value: bool) -> Self
Set never_allocate and return the updated record.
Sourcepub fn set_can_alias(self, value: bool) -> Self
pub fn set_can_alias(self, value: bool) -> Self
Set can_alias and return the updated record.
Sourcepub fn set_priority(self, value: MemoryPriority) -> Self
pub fn set_priority(self, value: MemoryPriority) -> Self
Set priority and return the updated record.
Sourcepub fn set_min_allocation_alignment(self, value: u64) -> Self
pub fn set_min_allocation_alignment(self, value: u64) -> Self
Set min_allocation_alignment and return the updated record.
Sourcepub fn set_pool(self, value: Option<&'pool Pool>) -> Self
pub fn set_pool(self, value: Option<&'pool Pool>) -> Self
Set pool and return the updated record.
Sourcepub fn set_usage(self, value: MemoryUsage) -> Self
pub fn set_usage(self, value: MemoryUsage) -> Self
Set usage and return the updated record.
Sourcepub fn set_host_access(self, value: HostAccess) -> Self
pub fn set_host_access(self, value: HostAccess) -> Self
Set host_access and return the updated record.
Sourcepub fn set_allow_transfer_instead(self, value: bool) -> Self
pub fn set_allow_transfer_instead(self, value: bool) -> Self
Set allow_transfer_instead and return the updated record.
Sourcepub fn set_avoided_flags(self, value: MemoryPropertyFlags) -> Self
pub fn set_avoided_flags(self, value: MemoryPropertyFlags) -> Self
Set avoided_flags and return the updated record.
Sourcepub fn set_required_flags(self, value: MemoryPropertyFlags) -> Self
pub fn set_required_flags(self, value: MemoryPropertyFlags) -> Self
Set required_flags and return the updated record.
Sourcepub fn set_preferred_flags(self, value: MemoryPropertyFlags) -> Self
pub fn set_preferred_flags(self, value: MemoryPropertyFlags) -> Self
Set preferred_flags and return the updated record.
Sourcepub fn set_memory_type_bits(self, value: u32) -> Self
pub fn set_memory_type_bits(self, value: u32) -> Self
Set memory_type_bits and return the updated record.
Sourcepub fn set_strategy(self, value: PlacementStrategy) -> Self
pub fn set_strategy(self, value: PlacementStrategy) -> Self
Set strategy and return the updated record.
Sourcepub fn set_upper_address(self, value: bool) -> Self
pub fn set_upper_address(self, value: bool) -> Self
Set upper_address and return the updated record.
Sourcepub fn set_policy(self, value: AllocationPolicy) -> Self
pub fn set_policy(self, value: AllocationPolicy) -> Self
Set policy and return the updated record.
Sourcepub fn set_persistent_map(self, value: bool) -> Self
pub fn set_persistent_map(self, value: bool) -> Self
Set persistent_map and return the updated record.