Skip to content
/ vkma Public

C++ bindings for GPUOpen's VulkanMemoryAllocator generated using a Vulkan-Hpp fork.

License

Notifications You must be signed in to change notification settings

Cvelth/vkma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 

Repository files navigation

VKMA: Vulkan Memory Allocator C++ Bindings

This header file is generated (generator) using a vulkan-hpp fork, that's why the interface is so similar.

The binding header does not include original c header, so to use it, you still have to make sure that vk_mem_alloc.h is accessible (#include "vk_mem_alloc.h" is a valid line of code). An optimal way is to add its location to the include path of your preferred build system. You can get the header from the original repository.

If you find any bugs or problems, I'd appreciate an issue either here or in the generator repository.

Example

Original VulkanMemoryAllocator (from here)

VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
bufferInfo.size = 65536;
bufferInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;

VmaAllocationCreateInfo allocInfo = {};
allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;

VkBuffer buffer;
VmaAllocation allocation;
vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);

vkma

vkma::BufferCreateInfo buffer_info = {
  .size = 65536,
  .usage = vk::BufferUsageFlagBits::eVertexBuffer | vk::BufferUsageFlagBits::eTransferDst,
};
vkma::AllocationCreateInfo allocation_info = {
  .usage = vkma::MemoryUsage::eGpuOnly
};
auto vkma_buffer = allocator.createUnique(buffer_info, allocation_info);
auto vk_buffer = vkma_buffer->get();
auto allocation = vkma_buffer->getAllocation();

See also

About

C++ bindings for GPUOpen's VulkanMemoryAllocator generated using a Vulkan-Hpp fork.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages