<divclass="fragment"><divclass="line"><spanclass="preprocessor">#define VMA_IMPLEMENTATION</span></div><divclass="line"><spanclass="preprocessor">#include "vk_mem_alloc.h"</span></div></div><!-- fragment --><p>At program startup:</p>
<li>Initialize Vulkan to have <code>VkPhysicalDevice</code> and <code>VkDevice</code> object.</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 <code>VmaAllocator</code> object by calling <aclass="el"href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb"title="Creates Allocator object. ">vmaCreateAllocator()</a>.</li>
<divclass="fragment"><divclass="line"><aclass="code"href="struct_vma_allocator_create_info.html">VmaAllocatorCreateInfo</a> allocatorInfo = {};</div><divclass="line">allocatorInfo.<aclass="code"href="struct_vma_allocator_create_info.html#a08230f04ae6ccf8a78150a9e829a7156">physicalDevice</a> = physicalDevice;</div><divclass="line">allocatorInfo.<aclass="code"href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500">device</a> = device;</div><divclass="line"></div><divclass="line">VmaAllocator allocator;</div><divclass="line"><aclass="code"href="vk__mem__alloc_8h.html#a200692051ddb34240248234f5f4c17bb">vmaCreateAllocator</a>(&allocatorInfo, &allocator);</div></div><!-- fragment --><p>When you want to create a buffer or image:</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>