vk::mem · Functions · C1
15 public declarations with native signatures and source-owned contracts.
Fnvk::mem::check_corruption
Contract
Check enabled coherent pooled guard tails without waiting for GPU work.
Errors
Returns unsupported debug configuration, identity/map or corruption diagnostics. A corrupt region remains allocated; no memory/resource is destroyed on failure.
Safety
Complete and synchronize every selected region’s GPU/host writes before checking.
Fnvk::mem::check_pool_corruption
Contract
Check coherent guard tails belonging to one checked custom pool.
Safety
Same completion/coherent-access requirements as check_corruption.
Fnvk::mem::close
Contract
Checked shutdown after all regions and their blocks have been explicitly released.
Fnvk::mem::copy_from_allocation
Contract
Invalidate and copy allocation bytes to initialized writable host storage.
Errors
Checked identity/range/map/cache errors; invalidation failure performs no host copy.
Safety
Complete device writes and synchronize all host/GPU accesses. Source bytes must be initialized; destination exclusivity and native image layout remain caller obligations.
Fnvk::mem::copy_to_allocation
Contract
Copy host bytes to an allocation, flush them and release only this helper’s map hold.
Existing explicit/persistent maps remain held. Zero bytes still validate identity and bounds. Does not submit transfers, wait or infer GPU completion.
Errors
Reports checked identity/range/map/cache errors; a cache failure still releases this map hold.
Safety
Caller synchronizes all accesses and provides initialized readable source storage. Destination native bytes must be writable; no live Rust reference may be invalidated by this write. Resource layout (especially images) remains caller-owned.
Fnvk::mem::create_aliasing_buffer
Contract
Create an ordinary alias buffer at a checked allocation-local offset.
Backing storage must have can_alias; no new memory or allocation token is
created. Aliases are caller-owned: destroy every alias before freeing storage.
Original resource association and binding state remain unchanged.
Errors
Rejects non-aliasable/foreign/stale storage, invalid requirements/offset/type, required native dedication, unavailable PFNs or native creation/binding failure.
Safety
Follow Vulkan aliasing, barrier, native resource/feature and callback rules.
Do not access overlapping aliases concurrently. Retain all native lifetimes.
Use allocation_callbacks() for matching explicit native alias destruction.
Fnvk::mem::create_aliasing_image
Contract
Create a caller-owned ordinary alias image without allocating new native memory.
Errors
Same identity/requirements/binding errors as create_aliasing_buffer;
requires explicit ALIAS_BIT image creation semantics.
Safety
Native image alias/layout/barrier and enabled-feature valid usage apply. Destroy all aliases with matching callbacks before releasing backing storage.
Fnvk::mem::create_buffer
Contract
Transactionally create, query, allocate and bind an ordinary buffer.
Core 1.1 or enabled KHR dedication uses requirements2 with a dedicated requirements output chain and dedicates this separate allocation to the buffer, even when dedication is only preferred or unnecessary. Core 1.0 without dedication uses legacy requirements. Exact PFN spellings are retained.
Safety
Info/limits/queue-family data and ordinary buffer usage must satisfy Vulkan valid usage. Arbitrary chains and sparse/external memory are excluded. Protected memory requires captured enabled feature metadata. Device-address usage requires captured enabled core/KHR feature metadata.
Fnvk::mem::create_buffer_with_options
Contract
Create, allocate, optionally map and bind an ordinary buffer transactionally.
Only recoverable native allocation OOM retries another compatible memory type. Required/preferred dedication and regions larger than the explicit block use separate storage. Empty blocks are released immediately, without caching.
Errors
Returns checked policy/identity/limit errors or the preserved native failure.
Safety
Info and queue-family pointers must satisfy native valid usage. Complete uses before release. Sparse and capture/replay resources are excluded. Ordinary external create/allocation profiles are admitted with caller-validated native compatibility. Protected resources and BDA require captured enabled metadata.
Fnvk::mem::create_dedicated_buffer
Contract
Create, separately allocate and bind a buffer, optionally importing/exporting memory.
Errors
Same transaction/rollback errors as create_buffer_with_options and chain conflicts.
Safety
All resource and allocation chain payloads, external compatibility, callback and completion requirements must hold. Successful import handle transfer survives later setup failure; resource/native storage rollback does not undo it.
Fnvk::mem::create_dedicated_image
Contract
Create, separately allocate and bind an ordinary non-disjoint image with an optional chain.
Errors
Same transaction/rollback errors as create_image_with_options and chain conflicts.
Safety
Same native/external valid usage and successful-import transfer contract as
create_dedicated_buffer, applied to the image and its queried requirements.
Fnvk::mem::create_image
Contract
Create an ordinary image with separate storage and explicit memory properties.
Safety
Caller establishes all native image, create-chain and synchronization valid usage.
Fnvk::mem::create_image_with_options
Contract
Create, query, allocate, optionally map and bind a non-disjoint image transactionally.
Donor: pinned VMA CreateImage, GetImageMemoryRequirements, AllocateDedicatedMemory.
Adaptation: checked neighbor metadata separates incompatible buffer/image pages
while compatible resources share native blocks. Unknown granularity stays conservative.
Video-profile and image-format-list chains are forwarded unchanged after admission.
Sparse, disjoint, external and unknown allocation chains are excluded.
Aliases require explicit can_alias storage; protected images require enabled metadata.
Safety
Meet image/format/feature and pointer-chain valid usage. A mapped optimal image is not a linear pixel array. Callers use native subresource layouts for host access to linear images.
Fnvk::mem::create_pool
Contract
Create a fixed-memory-type TLSF pool transactionally.
A zero maximum follows VMA’s unlimited convention. Minimum blocks stay allocated until explicit pool destruction. Above the minimum, one empty block can be retained to avoid repeated native allocation/free churn. Zero block size selects VMA’s heap-based preferred size, bounded growth and pool-owned dedicated fallback. Minimum blocks use the full preferred size.
Errors
Returns checked invalid-policy/type/state/limit errors or the original native failure. A failed minimum-block acquisition rolls back only this new pool.
Safety
Context/physical metadata must be valid; enforce any unqueried native limits.
Fnvk::mem::create_pool_with_chain
Contract
Create a pool retaining a borrowed native allocation chain for every block. Import chains are rejected: a single imported payload cannot back repeated growth.
Errors
Same policy/native errors as create_pool, plus conflicting or import chains.
Safety
The complete chain and nested storage remain valid and immutable until this pool is destroyed. The borrow lasts for the allocator’s device lifetime. Every future block allocation must meet the chain’s native valid usage.