diff --git a/docs/html/annotated.html b/docs/html/annotated.html index f898f5a..ed46442 100644 --- a/docs/html/annotated.html +++ b/docs/html/annotated.html @@ -65,10 +65,10 @@ $(function() {
Here are the classes, structs, unions and interfaces with brief descriptions:
- + - - + + diff --git a/docs/html/configuration.html b/docs/html/configuration.html new file mode 100644 index 0000000..5b471d9 --- /dev/null +++ b/docs/html/configuration.html @@ -0,0 +1,94 @@ + + + + + + + +Vulkan Memory Allocator: Configuration + + + + + + + + + +
+
+
 CVmaAllocationCreateInfo
 CVmaAllocationInfoParameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo()
 CVmaAllocationInfoParameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo()
 CVmaAllocatorCreateInfoDescription of a Allocator to be created
 CVmaDefragmentationInfoOptional configuration parameters to be passed to function vmaDefragment()
 CVmaDefragmentationStatsStatistics returned by function vmaDefragment()
 CVmaDefragmentationInfoOptional configuration parameters to be passed to function vmaDefragment()
 CVmaDefragmentationStatsStatistics returned by function vmaDefragment()
 CVmaDeviceMemoryCallbacksSet of callbacks that the library will call for vkAllocateMemory and vkFreeMemory
 CVmaPoolCreateInfoDescribes parameter of created VmaPool
 CVmaPoolStatsDescribes parameter of existing VmaPool
+ + + + + +
+
Vulkan Memory Allocator +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + + +
+
+
Configuration
+
+
+

Please check "CONFIGURATION SECTION" in the code to find macros that you can define before each include of this file or change directly in this file to provide your own implementation of basic facilities like assert, min() and max() functions, mutex etc. C++ STL is used by default, but changing these allows you to get rid of any STL usage if you want, as many game developers tend to do.

+

+Pointers to Vulkan functions

+

The library uses Vulkan functions straight from the vulkan.h header by default. If you want to provide your own pointers to these functions, e.g. fetched using vkGetInstanceProcAddr() and vkGetDeviceProcAddr():

+
    +
  1. Define VMA_STATIC_VULKAN_FUNCTIONS 0.
  2. +
  3. Provide valid pointers through VmaAllocatorCreateInfo::pVulkanFunctions.
  4. +
+

+Custom host memory allocator

+

If you use custom allocator for CPU memory rather than default operator new and delete from C++, you can make this library using your allocator as well by filling optional member VmaAllocatorCreateInfo::pAllocationCallbacks. These functions will be passed to Vulkan, as well as used by the library itself to make any CPU-side allocations.

+

+Device memory allocation callbacks

+

The library makes calls to vkAllocateMemory() and vkFreeMemory() internally. You can setup callbacks to be informed about these calls, e.g. for the purpose of gathering some statistics. To do it, fill optional member VmaAllocatorCreateInfo::pDeviceMemoryCallbacks.

+

+Device heap memory limit

+

If you want to test how your program behaves with limited amount of Vulkan device memory available without switching your graphics card to one that really has smaller VRAM, you can use a feature of this library intended for this purpose. To do it, fill optional member VmaAllocatorCreateInfo::pHeapSizeLimit.

+
+ + + + diff --git a/docs/html/custom_memory_pools.html b/docs/html/custom_memory_pools.html new file mode 100644 index 0000000..ffaac60 --- /dev/null +++ b/docs/html/custom_memory_pools.html @@ -0,0 +1,113 @@ + + + + + + + +Vulkan Memory Allocator: Custom memory pools + + + + + + + + + +
+
+ + + + + + +
+
Vulkan Memory Allocator +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
Custom memory pools
+
+
+

The library automatically creates and manages default memory pool for each memory type available on the device. A pool contains a number of VkDeviceMemory blocks. You can create custom pool and allocate memory out of it. It can be useful if you want to:

+ +

To use custom memory pools:

+
    +
  1. Fill VmaPoolCreateInfo structure.
  2. +
  3. Call vmaCreatePool() to obtain VmaPool handle.
  4. +
  5. When making an allocation, set VmaAllocationCreateInfo::pool to this handle. You don't need to specify any other parameters of this structure, like usage.
  6. +
+

Example:

+
.// Create a pool that could have at most 2 blocks, 128 MB each.
+VmaPoolCreateInfo poolCreateInfo = {};
+poolCreateInfo.memoryTypeIndex = ...
+poolCreateInfo.blockSize = 128ull * 1024 * 1024;
+poolCreateInfo.maxBlockCount = 2;
+
+VmaPool pool;
+vmaCreatePool(allocator, &poolCreateInfo, &pool);
+
+.// Allocate a buffer out of it.
+VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
+bufCreateInfo.size = 1024;
+bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
+
+VmaAllocationCreateInfo allocCreateInfo = {};
+allocCreateInfo.pool = pool;
+
+VkBuffer buf;
+VmaAllocation alloc;
+VmaAllocationInfo allocInfo;
+vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
+

You have to free all allocations made from this pool before destroying it.

+
vmaDestroyBuffer(allocator, buf, alloc);
+vmaDestroyPool(allocator, pool);
+ + + + diff --git a/docs/html/defragmentation.html b/docs/html/defragmentation.html new file mode 100644 index 0000000..6df573c --- /dev/null +++ b/docs/html/defragmentation.html @@ -0,0 +1,80 @@ + + + + + + + +Vulkan Memory Allocator: Defragmentation + + + + + + + + + +
+
+ + + + + + +
+
Vulkan Memory Allocator +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
Defragmentation
+
+
+

Interleaved allocations and deallocations of many objects of varying size can cause fragmentation, which can lead to a situation where the library is unable to find a continuous range of free memory for a new allocation despite there is enough free space, just scattered across many small free ranges between existing allocations.

+

To mitigate this problem, you can use vmaDefragment(). Given set of allocations, this function can move them to compact used memory, ensure more continuous free space and possibly also free some VkDeviceMemory. It can work only on allocations made from memory type that is HOST_VISIBLE. Allocations are modified to point to the new VkDeviceMemory and offset. Data in this memory is also memmove-ed to the new place. However, if you have images or buffers bound to these allocations (and you certainly do), you need to destroy, recreate, and bind them to the new place in memory.

+

For further details and example code, see documentation of function vmaDefragment().

+
+ + + + diff --git a/docs/html/functions.html b/docs/html/functions.html index d7cef82..bb64a0b 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -112,7 +112,7 @@ $(function() {

- f -