<p>Vulkan Memory Allocator comes in form of a "stb-style" single header file. You don't need to build it as a separate library project. You can add this file directly to your project and submit it to code repository next to your other source files.</p>
<p>"Single header" doesn't mean that everything is contained in C/C++ declarations, like it tends to be in case of inline functions or C++ templates. It means that implementation is bundled with interface in a single file and needs to be extracted using preprocessor macro. If you don't do it properly, you will get linker errors.</p>
<p>Note on language: This library is written in C++, but has C-compatible interface. Thus you can include and use <aclass="el"href="vk__mem__alloc_8h.html">vk_mem_alloc.h</a> in C or C++ code, but full implementation with <code>VMA_IMPLEMENTATION</code> macro must be compiled as C++, NOT as C.</p>
<p>Please note that this library includes header <code><vulkan/vulkan.h></code>, which in turn includes <code><windows.h></code> on Windows. If you need some specific macros defined before including these headers (like <code>WIN32_LEAN_AND_MEAN</code> or <code>WINVER</code> for Windows, <code>VK_USE_PLATFORM_WIN32_KHR</code> for Vulkan), you must define them before every <code>#include</code> of this library.</p>
<p>You may need to configure the way you import Vulkan functions.</p>
<ul>
<li>By default, VMA assumes you you link statically with Vulkan API. If this is not the case, <code>#define VMA_STATIC_VULKAN_FUNCTIONS 0</code> before <code>#include</code> of the VMA implementation and use another way.</li>
<li>You can <code>#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1</code> and make sure <code>vkGetInstanceProcAddr</code> and <code>vkGetDeviceProcAddr</code> globals are defined. All the remaining Vulkan functions will be fetched automatically.</li>
<li>Finally, you can provide your own pointers to all Vulkan functions needed by VMA using structure member <aclass="el"href="struct_vma_allocator_create_info.html#a3dc197be3227da7338b1643f70db36bd"title="Pointers to Vulkan functions. Can be null.">VmaAllocatorCreateInfo::pVulkanFunctions</a>, if you fetched them in some custom way e.g. using some loader like <ahref="https://github.com/zeux/volk">Volk</a>.</li>
<li>Fill <aclass="el"href="struct_vma_allocator_create_info.html"title="Description of a Allocator to be created.">VmaAllocatorCreateInfo</a> structure and create <aclass="el"href="struct_vma_allocator.html"title="Represents main object of this library initialized.">VmaAllocator</a> object by calling <aclass="el"href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb"title="Creates Allocator object.">vmaCreateAllocator()</a>.</li>
<divclass="ttc"id="astruct_vma_allocator_create_info_html"><divclass="ttname"><ahref="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a></div><divclass="ttdoc">Description of a Allocator to be created.</div><divclass="ttdef"><b>Definition:</b> vk_mem_alloc.h:509</div></div>
<divclass="ttc"id="astruct_vma_allocator_create_info_html_ae0ffc55139b54520a6bb704b29ffc285"><divclass="ttname"><ahref="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285">VmaAllocatorCreateInfo::vulkanApiVersion</a></div><divclass="ttdeci">uint32_t vulkanApiVersion</div><divclass="ttdoc">Optional. The highest version of Vulkan that the application is designed to use.</div><divclass="ttdef"><b>Definition:</b> vk_mem_alloc.h:592</div></div>
<divclass="ttc"id="astruct_vma_allocator_html"><divclass="ttname"><ahref="struct_vma_allocator.html">VmaAllocator</a></div><divclass="ttdoc">Represents main object of this library initialized.</div></div>
</div><!-- fragment --><p>Only members <code>physicalDevice</code>, <code>device</code>, <code>instance</code> are required. However, you should inform the library which Vulkan version do you use by setting <aclass="el"href="struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285"title="Optional. The highest version of Vulkan that the application is designed to use.">VmaAllocatorCreateInfo::vulkanApiVersion</a> and which extensions did you enable by setting <aclass="el"href="struct_vma_allocator_create_info.html#a392ea2ecbaff93f91a7c49f735ad4346"title="Flags for created allocator. Use VmaAllocatorCreateFlagBits enum.">VmaAllocatorCreateInfo::flags</a> (like <aclass="el"href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089">VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT</a> for VK_KHR_buffer_device_address). Otherwise, VMA would use only features of Vulkan 1.0 core with no extensions.</p>
<li>Call <aclass="el"href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer()</a> / <aclass="el"href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73"title="Function similar to vmaCreateBuffer().">vmaCreateImage()</a> to get <code>VkBuffer</code>/<code>VkImage</code> with memory already allocated and bound to it.</li>
<divclass="ttc"id="astruct_vma_allocation_html"><divclass="ttname"><ahref="struct_vma_allocation.html">VmaAllocation</a></div><divclass="ttdoc">Represents single memory allocation.</div></div>