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::mem::{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 or linear allocator; owns host metadata and no native objects.
VirtualBlockDetails
Explicit virtual placement diagnostics; physical holes may not be immediately reusable by linear placement.
VirtualBlockStats
Host metadata statistics. Alignment holes remain free, not reserved to a token. Linear free spans can include holes that placement cannot immediately reuse.

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.
allocate_upper
Allocate downward from the upper end of a linear block.
allocation_info
Reject foreign, freed or stale tokens before reading placement metadata.
clear
Clear all regions, invalidating every prior generation; never submits or waits.
detailed_statistics
Walk virtual placements/free spans for explicit extent statistics.
free
Free a checked live region and invalidate its token; no native effects.
is_empty
Observe whether every virtual allocation has been explicitly released or cleared.
set_user_data
Set checked per-region opaque metadata without native effects or ownership transfer.
statistics
Calculate allocation bytes, free bytes, free-region count and largest span.
write_statistics_json
Write explicit virtual metadata as ordered vk.memory.virtual.v1 JSON.