2 unstable releases

0.2.0 Sep 8, 2024
0.1.0 Sep 5, 2024

#291 in Memory management

Apache-2.0

7MB
123K SLoC

Rust 108K SLoC // 0.0% comments C++ 10K SLoC // 0.1% comments Python 3K SLoC // 0.3% comments JavaScript 2K SLoC // 0.1% comments GLSL 46 SLoC // 0.6% comments C 10 SLoC // 0.6% comments AsciiDoc 6 SLoC // 0.2% comments Batch 4 SLoC

Contains (DOS exe, 410KB) VmaSample_Release_vs2022.exe

vulkanalia-vma

An integration of Vulkan Memory Allocator with vulkanalia.

Released under the Apache License 2.0.

Heavily inspired by the vk-mem crate.


lib.rs:

An integration of Vulkan Memory Allocator with vulkanalia.

Example

use vulkanalia::prelude::v1_0::*;
use vulkanalia_vma::{self as vma, Alloc};

fn example(instance: &Instance, device: &Device, physical_device: vk::PhysicalDevice) {
    // Create an allocator.
    let allocator_options = vma::AllocatorOptions::new(instance, device, physical_device);
    let allocator = unsafe { vma::Allocator::new(&allocator_options) }.unwrap();

    // Allocate a buffer using the allocator.
    let buffer_create_info = vk::BufferCreateInfo::builder()
        .size(65_536)
        .usage(vk::BufferUsageFlags::VERTEX_BUFFER)
        .sharing_mode(vk::SharingMode::CONCURRENT);
    let allocation_options = vma::AllocationOptions::default();
    let (buffer, allocation) = unsafe { allocator.create_buffer(buffer_create_info, &allocation_options) }.unwrap();

    // Deallocate the buffer using the allocator.
    unsafe { allocator.destroy_buffer(buffer, allocation) };
}

Dependencies