29 releases (12 stable)
2.3.0 | Jan 26, 2022 |
---|---|
2.2.0 | Dec 11, 2021 |
2.1.0 | Sep 5, 2021 |
2.0.2 | Jul 28, 2021 |
0.7.2 | Mar 29, 2021 |
#521 in Graphics APIs
Used in asche
58KB
1K
SLoC
vk-alloc
A segregated list memory allocator for Vulkan written in Rust.
Targets Vulkan 1.2+ using erupt.
Features
All features are optional by default.
tracing
Adds logging using tracing.profiling
Adds support for profiling.vk-buffer-device-address
: Enables the usage of "vkGetBufferDeviceAddress". Needs the Vulkan 1.2 "bufferDeviceAddress" device feature enabled.
License
Licensed under MIT or Apache-2.0 or ZLIB.
lib.rs
:
A segregated list memory allocator for Vulkan.
The allocator can pool allocations of a user defined lifetime together to help reducing the fragmentation.
Example:
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)]
enum Lifetime {
Buffer,
Image,
}
impl vk_alloc::Lifetime for Lifetime {}
unsafe {
Allocator::<Lifetime>::new(
&instance,
&physical_device,
&AllocatorDescriptor {
..Default::default()
},
).unwrap();
let allocation = alloc
.allocate(
&logical_device,
&AllocationDescriptor {
location: MemoryLocation::GpuOnly,
requirements: vk::MemoryRequirementsBuilder::new()
.alignment(512)
.size(1024)
.memory_type_bits(u32::MAX)
.build(),
lifetime: Lifetime::Buffer,
is_dedicated: false,
is_optimal: false,
},
)
.unwrap();
}
Dependencies
~7–32MB
~495K SLoC