YaaZ / VulkanMemoryAllocator-Hpp

C++ bindings for VulkanMemoryAllocator
Creative Commons Zero v1.0 Universal
57 stars 31 forks source link

VulkanMemoryAllocator-Hpp 3.1.0

Supports Vulkan 1.3

This is a former fork of https://github.com/malte-v/VulkanMemoryAllocator-Hpp which is now maintained independently as discussed in this PR.

These bindings are generated by custom generator conforming to the structure of Vulkan-Headers.

Warning: The bindings are not thoroughly tested yet. If you encounter any errors, please open an issue.

Usage

Don't forget to add Vulkan-Headers and VulkanMemoryAllocator/include to the search path, compatible versions are specified in submodules, other versions are not guaranteed to compile.

// In *one* source file:
#define VMA_IMPLEMENTATION

// If you don't like the `vma::` prefix:
#define VMA_HPP_NAMESPACE <prefix>

#include "vk_mem_alloc.hpp"

VulkanMemoryAllocator-Hpp provides official find_package support. However, it requires the user to provide the include directories containing:

There are multiple ways to achieve this and VulkanMemoryAllocator-Hpp is compatible with all of them.

find_package(Vulkan) # https://cmake.org/cmake/help/latest/module/FindVulkan.html, CMake 3.21+
find_package(VulkanMemoryAllocator CONFIG REQUIRED)
find_package(VulkanMemoryAllocator-Hpp CONFIG REQUIRED)
target_link_libraries(main PRIVATE Vulkan::Vulkan GPUOpen::VulkanMemoryAllocator VulkanMemoryAllocator-Hpp::VulkanMemoryAllocator-Hpp)

or

find_package(Vulkan) # CMake 3.21+
find_package(VulkanMemoryAllocator CONFIG REQUIRED)
find_package(VulkanMemoryAllocator-Hpp CONFIG REQUIRED)
target_link_libraries(main PRIVATE Vulkan::Headers GPUOpen::VulkanMemoryAllocator VulkanMemoryAllocator-Hpp::VulkanMemoryAllocator-Hpp)

or

find_package(VulkanHeaders CONFIG) # From the vulkan-headers port
find_package(VulkanMemoryAllocator CONFIG REQUIRED)
find_package(VulkanMemoryAllocator-Hpp CONFIG REQUIRED)
target_link_libraries(main PRIVATE Vulkan::Headers GPUOpen::VulkanMemoryAllocator VulkanMemoryAllocator-Hpp::VulkanMemoryAllocator-Hpp)

or, using this repository within a parent project

add_subdirectory(external/VulkanMemoryAllocator-Hpp/Vulkan-Headers)
add_subdirectory(external/VulkanMemoryAllocator-Hpp/VulkanMemoryAllocator)
add_subdirectory(external/VulkanMemoryAllocator-Hpp)
target_link_libraries(main PRIVATE Vulkan::Headers GPUOpen::VulkanMemoryAllocator VulkanMemoryAllocator-Hpp::VulkanMemoryAllocator-Hpp)