Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/gpu/hal/vulkan/memory"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
hal |
std/gpu/hal |
memory.dodo |
mem |
core/mem |
memory.dodo |
ptr |
core/ptr |
memory.dodo |
vk |
std/gpu/vulkan |
memory.dodo |
KIND_BUFFER
Constant · Source
pub const KIND_BUFFER: u32 = 0
KIND_IMAGE
Constant · Source
pub const KIND_IMAGE: u32 = 1
KIND_UPLOAD
Constant · Source
pub const KIND_UPLOAD: u32 = 2
KIND_READBACK
Constant · Source
pub const KIND_READBACK: u32 = 3
Allocation
Struct · Source
One allocation:
sizebytes ofmemoryfromoffset, mapped atmappedwhen the CPU can see it (0 otherwise). Free it with Allocator.free(id).
pub struct Allocation {
pub memory: u64
pub offset: u64
pub mapped: usize
pub id: u64
// The memory type's VkMemoryPropertyFlags.
pub flags: u32
}
Allocator
Struct · Source
pub struct Allocator {
// Private implementation fields omitted.
}
Allocator.new
Function · Source
pub fn new(properties: &vk.PhysicalDeviceMemoryProperties, non_coherent_atom_size: u64) -> Allocator!hal.Error
Allocator.allocate
Function · Source
Memory for a resource with
requirements, of KIND_*. Host-visible memory comes back mapped.
pub fn allocate(&self, fns: &vk.DeviceFns, device: vk.Device, requirements: &vk.MemoryRequirements, kind: u32) -> Allocation!hal.Error
Allocator.free
Function · Source
Return an allocation’s memory.
pub fn free(&self, fns: &vk.DeviceFns, device: vk.Device, id: u64)
Allocator.invalidate
Function · Source
Make the GPU’s writes to
sizebytes of allocationidfromoffsetvisible to the CPU, for memory that is not coherent.
pub fn invalidate(&self, fns: &vk.DeviceFns, device: vk.Device, id: u64, offset: u64, size: u64)
Allocator.destroy
Function · Source
Return every block to the driver; the allocator must not be used afterwards.
pub fn destroy(&mut self, fns: &vk.DeviceFns, device: vk.Device)