vk-mem-alloc

Crates.iovk-mem-alloc
lib.rsvk-mem-alloc
version0.2.0
sourcesrc
created_at2022-08-12 02:45:46.72058
updated_at2022-12-25 21:40:34.734769
descriptionA very lightweight wrapper around the Vulkan Memory Allocator
homepagehttps://github.com/projectkml/vk-mem-alloc-rs
repositoryhttps://github.com/projectkml/vk-mem-alloc-rs
max_upload_size
id643711
size47,530
BeastLe9enD (BeastLe9enD)

documentation

https://docs.rs/vk-mem-alloc

README

🌋 vk-mem-alloc-rs

A very lightweight wrapper around the Vulkan Memory Allocator 🦀

crates license vma dependency-status

[dependencies]
vk-mem-alloc = "0.2.0"

Simple Vulkan Memory Allocator example

// Create the allocator
let allocator = vk_mem_alloc::create_allocator(&instance, physical_device, &device, None).unwrap();

let buffer_create_info = vk::BufferCreateInfo {
    size,
    usage: vk::BufferUsageFlags::STORAGE_BUFFER,
    ..Default::default()
};

let allocation_create_info = vk_mem_alloc::AllocationCreateInfo {
    usage: vk_mem_alloc::MemoryUsage::AUTO_PREFER_DEVICE,
    ..Default::default()
};

// Create the buffer
let (buffer, allocation, allocation_info) = vk_mem_alloc::create_buffer(allocator, &buffer_create_info, &allocation_create_info).unwrap();

....

// Destroy the buffer
vk_mem_alloc::destroy_buffer(allocator, buffer, allocation);

// Destroy the allocator
vk_mem_alloc::destroy_allocator(allocator);

Credits

  • AMD for creating the Vulkan Memory Allocator.
  • The Ash community for creating such an awesome rust wrapper around Vulkan.
  • Graham Wihlidal for creating vk-mem, my buildscript is based on its build script.
Commit count: 26

cargo fmt