Skip to main content

Module virtual_block

Module virtual_block 

Source
Expand description

Host-only region placement over an integer byte range.

No Vulkan memory, buffers, mapping, synchronization or implicit retirement is provided. Consumers own the validity/completion of any resource using these offsets. Tokens are explicit: dropping one does not release its region.

use vk::memory::{PlacementStrategy, VirtualBlock};
let mut block = VirtualBlock::new(4096)?;
let mut region = block.allocate(64, 16, PlacementStrategy::Default)?;
assert_eq!(block.allocation_info(&region)?.offset, 0);
block.free(&mut region)?;

Structs§

VirtualAllocation
Generation-checked identity in exactly one virtual block; no implicit free.
VirtualAllocationInfo
Placement snapshot; valid only while the matching allocation remains live.
VirtualBlock
Virtual TLSF allocator; owns host metadata and no native objects.
VirtualBlockStats
Host metadata statistics. Alignment holes remain free, not reserved to a token.

Enums§

PlacementStrategy
VMA virtual-TLSF search order; these policies are not latency guarantees.

Functions§

allocate
Allocate a nonzero region with a nonzero power-of-two alignment.
allocation_info
Reject foreign, freed or stale tokens before reading placement metadata.
clear
Clear all regions, invalidating every prior generation; never submits or waits.
free
Free a checked live region and invalidate its token; no native effects.
statistics
Calculate allocation bytes, free bytes, free-region count and largest span.