vk::mem · Functions · B1
7 public declarations with native signatures and source-owned contracts.
Fnvk::mem::begin_defragmentation
Contract
Reserve earlier free storage without creating native resources, growing blocks or copying data.
Pinned, imported/exported, separate, disjoint-plane and linear-pool storage is excluded. Raw, aliasable and mapped storage retains its placement class and counted mapping holds. Every affected alias and pointer is caller-owned. Optional custom-pool identity, native type, priority, alignment and granularity remain fixed. Source metadata and handles remain unchanged during planning.
Errors
Returns identity or host metadata errors; failed planning frees its unbound destinations, preserving source resources and live tokens.
Safety
Source resources must remain live and ordinary on this device. Caller owns GPU completion and must explicitly commit or ignore every proposed move. End old mapped-pointer uses and recreate every alias before committing a move. All resources bound outside this allocator are part of that same obligation. Raw/alias placement retains the recorded alignment, not undisclosed stronger resource alignment; supply the complete constraint at allocation or pin it.
Fnvk::mem::begin_defragmentation_with_break
Contract
Plan a pass with a borrowed cooperative stop predicate, following VMA’s
pfnBreakCallback / CheckCounters contract. Returning true stops scheduling;
already proposed moves still need explicit resolution. Use was_interrupted
to distinguish a stop from an exhausted search. Polls occur between source
candidates, after host snapshot/preflight, and never during consumer copies.
A panic rolls back unpublished destinations before unwinding (with panic=unwind).
The callback is used only during this call and cannot borrow this allocator.
Safety
Same resource, alias, mapped-pointer and completion contract as begin_defragmentation.
Fnvk::mem::bind_buffer_memory
Contract
Bind at the allocation’s actual native offset. Failed binds retain allocation and resource for retry.
Allocations for a resource accept only that target. Raw allocations query size/type/alignment and reject required dedication. Repeated library binding and aliasing are rejected. No pointer lookup or resource destruction occurs.
Errors
Returns identity/state/association, requirement/type/range or native bind errors.
Safety
Buffer must be live, unbound, ordinary and from this device. Meet allocation/ feature/lifetime and external host synchronization valid usage. Native calls performed outside this allocator remain caller-owned state; do not rebind them.
Fnvk::mem::bind_buffer_memory2
Contract
Bind one ordinary buffer with a checked allocation-local offset and borrowed native chain.
Uses exact core 1.1 or enabled KHR bind_memory2. Associated resource allocations require offset zero; raw allocations re-query type/size/alignment. Any supplied per-bind status must report success before bound state is published.
Errors
Reports state/range/capability, malformed chain, per-item status or native errors.
Safety
Buffer must be live, ordinary and unbound on this device. Chain records and outputs must be valid and enabled for this exact native call; caller owns their extents/lifetimes and native error/device-loss recovery. No aliasing is admitted.
Fnvk::mem::bind_image_memory
Contract
Bind a live ordinary image at its allocation’s native offset; failure retains both objects.
Errors
Same checked identity/association/requirement/type/range and native errors as buffer binding.
Safety
Image must be live, unbound, non-disjoint/non-sparse/non-external, non-aliased and from this device. Meet native feature and synchronization valid usage. Never infer linear pixel layout from mapping optimal/unknown image storage.
Fnvk::mem::bind_image_memory2
Contract
Bind an ordinary image or one disjoint plane with an allocation-local offset and native chain. A plane uses unassociated raw storage allocated from caller-queried plane requirements. The allocator re-queries that exact plane before binding and tracks each plane independently; DRM modifier plane aspects remain excluded.
Errors
Same checked state/range/chain, per-item and native errors as bind_buffer_memory2.
Safety
Same native chain/lifetime/completion contract as bind_buffer_memory2; image
semantics must meet native valid usage for the selected plane. Destroy a
disjoint image once, then free all its plane allocations; do not use the
ordinary paired destroy_image helper for a plane allocation.
Fnvk::mem::budget_snapshot
Contract
Local accounting is always distinguished from implementation-reported usage.