Theme

alex/volcanic-mem

BRANCH main
main
SNAPSHOT Initial commit
DOWNLOAD
Download file

root / src / lib.rs

//! TLSF-based Vulkan 1.4 memory allocator for devices using `VK_EXT_descriptor_heap`.
//!
//! ```ignore
//! let allocator = unsafe { Allocator::new(&instance, physical_device, &device_cmds, device, &AllocatorConfig::default())? };
//! let mut buffer = allocator.create_buffer(&BufferDesc {
//!     size: 1 << 20,
//!     usage: VkBufferUsageFlags2::STORAGE_BUFFER,
//!     location: MemoryLocation::CpuToGpu,
//! })?;
//! buffer.mapped_slice_mut().unwrap().fill(0);
//! let range = buffer.range(); // feed into VkResourceDescriptorInfoEXT
//! allocator.destroy_buffer(buffer);
//! ```

mod allocator;
mod device;
mod error;
mod resource;
mod tlsf;
mod virtual_block;

pub use allocator::{
    Allocation, AllocationDesc, Allocator, AllocatorConfig, HeapBudget, MemoryLocation,
    ResourceKind, Statistics,
};
pub use error::{Error, Result};
pub use resource::{Buffer, BufferDesc, DescriptorHeap, DescriptorHeapKind, Image};
pub use virtual_block::{VirtualAllocation, VirtualBlock};