diff --git a/docs/html/allocation_annotation.html b/docs/html/allocation_annotation.html
index 05094ab..232c2db 100644
--- a/docs/html/allocation_annotation.html
+++ b/docs/html/allocation_annotation.html
@@ -84,9 +84,9 @@ Allocation user data
VkBuffer buffer;
vmaCreateBuffer(allocator, &bufferInfo, &allocCreateInfo, &buffer, &allocation,
nullptr);
-Definition: vk_mem_alloc.h:1100
-void * pUserData
Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...
Definition: vk_mem_alloc.h:1139
-VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1108
+Definition: vk_mem_alloc.h:1098
+void * pUserData
Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...
Definition: vk_mem_alloc.h:1137
+VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1106
Represents single memory allocation.
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:458
VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
@@ -94,8 +94,8 @@ Allocation user data
MyBufferMetadata* pMetadata = (MyBufferMetadata*)allocInfo.
pUserData;
-
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:1248
-
void * pUserData
Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...
Definition: vk_mem_alloc.h:1297
+
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:1247
+
void * pUserData
Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...
Definition: vk_mem_alloc.h:1296
void vmaGetAllocationInfo(VmaAllocator allocator, VmaAllocation allocation, VmaAllocationInfo *pAllocationInfo)
Returns current information about specified allocation and atomically marks it as used in current fra...
It can also be changed using function vmaSetAllocationUserData().
Values of (non-zero) allocations' pUserData
are printed in JSON report created by vmaBuildStatsString(), in hexadecimal form.
@@ -116,9 +116,9 @@ Allocation names
VkImage image;
vmaCreateImage(allocator, &imageInfo, &allocCreateInfo, &image, &allocation,
nullptr);
-VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:1102
+VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:1100
VkResult vmaCreateImage(VmaAllocator allocator, const VkImageCreateInfo *pImageCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkImage *pImage, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
Function similar to vmaCreateBuffer().
-@ VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT
Definition: vk_mem_alloc.h:562
+@ VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT
Definition: vk_mem_alloc.h:560
The value of pUserData
pointer of the allocation will be different than the one you passed when setting allocation's name - pointing to a buffer managed internally that holds copy of the string.
diff --git a/docs/html/choosing_memory_type.html b/docs/html/choosing_memory_type.html
index c52e967..5115ad4 100644
--- a/docs/html/choosing_memory_type.html
+++ b/docs/html/choosing_memory_type.html
@@ -93,8 +93,8 @@ Usage
VkBuffer buffer;
vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation,
nullptr);
-
Definition: vk_mem_alloc.h:1100
-
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1108
+
Definition: vk_mem_alloc.h:1098
+
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1106
Represents single memory allocation.
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:458
VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
@@ -109,10 +109,10 @@ Required and preferred flags
VkBuffer buffer;
vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation,
nullptr);
-
VkMemoryPropertyFlags preferredFlags
Flags that preferably should be set in a memory type chosen for an allocation.
Definition: vk_mem_alloc.h:1118
-
VkMemoryPropertyFlags requiredFlags
Flags that must be set in a Memory Type chosen for an allocation.
Definition: vk_mem_alloc.h:1113
-
VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:1102
-
@ VMA_ALLOCATION_CREATE_MAPPED_BIT
Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.
Definition: vk_mem_alloc.h:536
+
VkMemoryPropertyFlags preferredFlags
Flags that preferably should be set in a memory type chosen for an allocation.
Definition: vk_mem_alloc.h:1116
+
VkMemoryPropertyFlags requiredFlags
Flags that must be set in a Memory Type chosen for an allocation.
Definition: vk_mem_alloc.h:1111
+
VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:1100
+
@ VMA_ALLOCATION_CREATE_MAPPED_BIT
Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.
Definition: vk_mem_alloc.h:534
A memory type is chosen that has all the required flags and as many preferred flags set as possible.
If you use VmaAllocationCreateInfo::usage, it is just internally converted to a set of required and preferred flags.
@@ -127,7 +127,7 @@ Explicit memory types
VkBuffer buffer;
vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation,
nullptr);
-uint32_t memoryTypeBits
Bitmask containing one bit set for every memory type acceptable for this allocation.
Definition: vk_mem_alloc.h:1126
+uint32_t memoryTypeBits
Bitmask containing one bit set for every memory type acceptable for this allocation.
Definition: vk_mem_alloc.h:1124
Custom memory pools
If you allocate from custom memory pool, all the ways of specifying memory requirements described above are not applicable and the aforementioned members of VmaAllocationCreateInfo structure are ignored. Memory type is selected explicitly when creating the pool and then used to make all the allocations from that pool. For further details, see Custom memory pools.
diff --git a/docs/html/custom_memory_pools.html b/docs/html/custom_memory_pools.html
index be622a7..22b602d 100644
--- a/docs/html/custom_memory_pools.html
+++ b/docs/html/custom_memory_pools.html
@@ -106,13 +106,13 @@ $(function() {
vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
-Definition: vk_mem_alloc.h:1100
-VmaPool pool
Pool that this allocation should be created in.
Definition: vk_mem_alloc.h:1132
+Definition: vk_mem_alloc.h:1098
+VmaPool pool
Pool that this allocation should be created in.
Definition: vk_mem_alloc.h:1130
Represents single memory allocation.
-Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:1248
-Describes parameter of created VmaPool.
Definition: vk_mem_alloc.h:1151
-uint32_t memoryTypeIndex
Vulkan memory type index to allocate this pool from.
Definition: vk_mem_alloc.h:1154
-size_t maxBlockCount
Maximum number of blocks that can be allocated in this pool. Optional.
Definition: vk_mem_alloc.h:1179
+Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:1247
+Describes parameter of created VmaPool.
Definition: vk_mem_alloc.h:1149
+uint32_t memoryTypeIndex
Vulkan memory type index to allocate this pool from.
Definition: vk_mem_alloc.h:1152
+size_t maxBlockCount
Maximum number of blocks that can be allocated in this pool. Optional.
Definition: vk_mem_alloc.h:1178
Represents custom memory pool.
VkResult vmaCreatePool(VmaAllocator allocator, const VmaPoolCreateInfo *pCreateInfo, VmaPool *pPool)
Allocates Vulkan device memory and creates VmaPool object.
VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
@@ -121,7 +121,8 @@ $(function() {
void vmaDestroyBuffer(VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation)
Destroys Vulkan buffer and frees allocated memory.
void vmaDestroyPool(VmaAllocator allocator, VmaPool pool)
Destroys VmaPool object and frees Vulkan device memory.
-
+
New versions of this library support creating dedicated allocations in custom pools. It is supported only when VmaPoolCreateInfo::blockSize = 0. To use this feature, set VmaAllocationCreateInfo::pool to the pointer to your custom pool and VmaAllocationCreateInfo::flags to VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
+
Choosing memory type index
When creating a pool, you must explicitly specify memory type index. To find the one suitable for your buffers or images, you can use helper functions vmaFindMemoryTypeIndexForBufferInfo(), vmaFindMemoryTypeIndexForImageInfo(). You need to provide structures with example parameters of buffers or images that you are going to create in that pool.
VkBufferCreateInfo exampleBufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
@@ -137,7 +138,7 @@ Choosing memory type index
-
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1108
+
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1106
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:458
VkResult vmaFindMemoryTypeIndexForBufferInfo(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, uint32_t *pMemoryTypeIndex)
Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.
When creating buffers/images allocated in that pool, provide following parameters:
diff --git a/docs/html/defragmentation.html b/docs/html/defragmentation.html
index c6448d9..e87e1f6 100644
--- a/docs/html/defragmentation.html
+++ b/docs/html/defragmentation.html
@@ -129,15 +129,15 @@ Defragmenting CPU memory
}
}
-Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:1248
+Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:1247
Represents main object of this library initialized.
Represents Opaque object that represents started defragmentation process.
-Parameters for defragmentation.
Definition: vk_mem_alloc.h:1305
-uint32_t allocationCount
Number of allocations in pAllocations array.
Definition: vk_mem_alloc.h:1311
-VkBool32 * pAllocationsChanged
Optional, output. Pointer to array that will be filled with information whether the allocation at cer...
Definition: vk_mem_alloc.h:1326
-uint32_t maxCpuAllocationsToMove
Maximum number of allocations that can be moved to a different place using transfers on CPU side,...
Definition: vk_mem_alloc.h:1355
-const VmaAllocation * pAllocations
Pointer to array of allocations that can be defragmented.
Definition: vk_mem_alloc.h:1320
-VkDeviceSize maxCpuBytesToMove
Maximum total numbers of bytes that can be copied while moving allocations to different places using ...
Definition: vk_mem_alloc.h:1350
+Parameters for defragmentation.
Definition: vk_mem_alloc.h:1304
+uint32_t allocationCount
Number of allocations in pAllocations array.
Definition: vk_mem_alloc.h:1310
+VkBool32 * pAllocationsChanged
Optional, output. Pointer to array that will be filled with information whether the allocation at cer...
Definition: vk_mem_alloc.h:1325
+uint32_t maxCpuAllocationsToMove
Maximum number of allocations that can be moved to a different place using transfers on CPU side,...
Definition: vk_mem_alloc.h:1354
+const VmaAllocation * pAllocations
Pointer to array of allocations that can be defragmented.
Definition: vk_mem_alloc.h:1319
+VkDeviceSize maxCpuBytesToMove
Maximum total numbers of bytes that can be copied while moving allocations to different places using ...
Definition: vk_mem_alloc.h:1349
VkResult vmaDefragmentationBegin(VmaAllocator allocator, const VmaDefragmentationInfo2 *pInfo, VmaDefragmentationStats *pStats, VmaDefragmentationContext *pContext)
Begins defragmentation process.
VkResult vmaBindBufferMemory(VmaAllocator allocator, VmaAllocation allocation, VkBuffer buffer)
Binds buffer to allocation.
void vmaGetAllocationInfo(VmaAllocator allocator, VmaAllocation allocation, VmaAllocationInfo *pAllocationInfo)
Returns current information about specified allocation and atomically marks it as used in current fra...
@@ -203,9 +203,9 @@ Defragmenting GPU memory
}
}
-uint32_t maxGpuAllocationsToMove
Maximum number of allocations that can be moved to a different place using transfers on GPU side,...
Definition: vk_mem_alloc.h:1365
-VkDeviceSize maxGpuBytesToMove
Maximum total numbers of bytes that can be copied while moving allocations to different places using ...
Definition: vk_mem_alloc.h:1360
-VkCommandBuffer commandBuffer
Optional. Command buffer where GPU copy commands will be posted.
Definition: vk_mem_alloc.h:1374
+uint32_t maxGpuAllocationsToMove
Maximum number of allocations that can be moved to a different place using transfers on GPU side,...
Definition: vk_mem_alloc.h:1364
+VkDeviceSize maxGpuBytesToMove
Maximum total numbers of bytes that can be copied while moving allocations to different places using ...
Definition: vk_mem_alloc.h:1359
+VkCommandBuffer commandBuffer
Optional. Command buffer where GPU copy commands will be posted.
Definition: vk_mem_alloc.h:1373
You can combine these two methods by specifying non-zero maxGpu*
as well as maxCpu*
parameters. The library automatically chooses best method to defragment each memory pool.
You may try not to block your entire program to wait until defragmentation finishes, but do it in the background, as long as you carefully fullfill requirements described in function vmaDefragmentationBegin().
diff --git a/docs/html/lost_allocations.html b/docs/html/lost_allocations.html
index b33aa82..38c75e9 100644
--- a/docs/html/lost_allocations.html
+++ b/docs/html/lost_allocations.html
@@ -117,16 +117,16 @@ $(function() {
vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &m_Buf, &m_Alloc,
nullptr);
}
-Definition: vk_mem_alloc.h:1100
-VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1108
-VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:1102
+Definition: vk_mem_alloc.h:1098
+VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1106
+VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:1100
Represents single memory allocation.
void vmaDestroyBuffer(VmaAllocator allocator, VkBuffer buffer, VmaAllocation allocation)
Destroys Vulkan buffer and frees allocated memory.
VkBool32 vmaTouchAllocation(VmaAllocator allocator, VmaAllocation allocation)
Returns VK_TRUE if allocation is not lost and atomically marks it as used in current frame.
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:458
VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
-@ VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT
Definition: vk_mem_alloc.h:549
-@ VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT
Definition: vk_mem_alloc.h:556
+@ VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT
Definition: vk_mem_alloc.h:547
+@ VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT
Definition: vk_mem_alloc.h:554
When using lost allocations, you may see some Vulkan validation layer warnings about overlapping regions of memory bound to different kinds of buffers and images. This is still valid as long as you implement proper handling of lost allocations (like in the example above) and don't use them.
You can create an allocation that is already in lost state from the beginning using function vmaCreateLostAllocation(). It may be useful if you need a "dummy" allocation that is not null.
You can call function vmaMakePoolAllocationsLost() to set all eligible allocations in a specified custom pool to lost state. Allocations that have been "touched" in current frame or VmaPoolCreateInfo::frameInUseCount frames back cannot become lost.
diff --git a/docs/html/memory_mapping.html b/docs/html/memory_mapping.html
index 833f24f..b11328a 100644
--- a/docs/html/memory_mapping.html
+++ b/docs/html/memory_mapping.html
@@ -116,14 +116,14 @@ Persistently mapped memory
memcpy(allocInfo.
pMappedData, &constantBufferData,
sizeof(constantBufferData));
-Definition: vk_mem_alloc.h:1100
-VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1108
-VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:1102
-Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:1248
-void * pMappedData
Pointer to the beginning of this allocation as mapped data.
Definition: vk_mem_alloc.h:1292
+Definition: vk_mem_alloc.h:1098
+VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1106
+VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:1100
+Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:1247
+void * pMappedData
Pointer to the beginning of this allocation as mapped data.
Definition: vk_mem_alloc.h:1291
@ VMA_MEMORY_USAGE_CPU_ONLY
Definition: vk_mem_alloc.h:468
VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
-@ VMA_ALLOCATION_CREATE_MAPPED_BIT
Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.
Definition: vk_mem_alloc.h:536
+@ VMA_ALLOCATION_CREATE_MAPPED_BIT
Set this flag to use a memory that will be persistently mapped and retrieve pointer to it.
Definition: vk_mem_alloc.h:534
There are some exceptions though, when you should consider mapping memory only for a short period of time:
- When operating system is Windows 7 or 8.x (Windows 10 is not affected because it uses WDDM2), device is discrete AMD GPU, and memory type is the special 256 MiB pool of
DEVICE_LOCAL + HOST_VISIBLE
memory (selected when you use VMA_MEMORY_USAGE_CPU_TO_GPU), then whenever a memory block allocated from this memory type stays mapped for the time of any call to vkQueueSubmit()
or vkQueuePresentKHR()
, this block is migrated by WDDM to system RAM, which degrades performance. It doesn't matter if that particular memory block is actually used by the command buffer being submitted.
@@ -166,7 +166,7 @@ Finding out if memory is mappable
}
-VkMemoryPropertyFlags preferredFlags
Flags that preferably should be set in a memory type chosen for an allocation.
Definition: vk_mem_alloc.h:1118
+VkMemoryPropertyFlags preferredFlags
Flags that preferably should be set in a memory type chosen for an allocation.
Definition: vk_mem_alloc.h:1116
void vmaGetAllocationMemoryProperties(VmaAllocator allocator, VmaAllocation allocation, VkMemoryPropertyFlags *pFlags)
Given an allocation, returns Property Flags of its memory type.
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:458
You can even use VMA_ALLOCATION_CREATE_MAPPED_BIT flag while creating allocations that are not necessarily HOST_VISIBLE
(e.g. using VMA_MEMORY_USAGE_GPU_ONLY). If the allocation ends up in memory type that is HOST_VISIBLE
, it will be persistently mapped and you can use it directly. If not, the flag is just ignored. Example:
diff --git a/docs/html/quick_start.html b/docs/html/quick_start.html
index c317bf6..21a5414 100644
--- a/docs/html/quick_start.html
+++ b/docs/html/quick_start.html
@@ -104,11 +104,11 @@ Initialization
-Description of a Allocator to be created.
Definition: vk_mem_alloc.h:916
-VkPhysicalDevice physicalDevice
Vulkan physical device.
Definition: vk_mem_alloc.h:921
-VkInstance instance
Handle to Vulkan instance object.
Definition: vk_mem_alloc.h:990
-VkDevice device
Vulkan device.
Definition: vk_mem_alloc.h:924
-uint32_t vulkanApiVersion
Optional. The highest version of Vulkan that the application is designed to use.
Definition: vk_mem_alloc.h:999
+Description of a Allocator to be created.
Definition: vk_mem_alloc.h:914
+VkPhysicalDevice physicalDevice
Vulkan physical device.
Definition: vk_mem_alloc.h:919
+VkInstance instance
Handle to Vulkan instance object.
Definition: vk_mem_alloc.h:988
+VkDevice device
Vulkan device.
Definition: vk_mem_alloc.h:922
+uint32_t vulkanApiVersion
Optional. The highest version of Vulkan that the application is designed to use.
Definition: vk_mem_alloc.h:997
Represents main object of this library initialized.
VkResult vmaCreateAllocator(const VmaAllocatorCreateInfo *pCreateInfo, VmaAllocator *pAllocator)
Creates Allocator object.
Only members physicalDevice
, device
, instance
are required. However, you should inform the library which Vulkan version do you use by setting VmaAllocatorCreateInfo::vulkanApiVersion and which extensions did you enable by setting VmaAllocatorCreateInfo::flags (like VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT for VK_KHR_buffer_device_address). Otherwise, VMA would use only features of Vulkan 1.0 core with no extensions.
@@ -130,8 +130,8 @@ Resource allocation
VkBuffer buffer;
vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation,
nullptr);
-Definition: vk_mem_alloc.h:1100
-VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1108
+Definition: vk_mem_alloc.h:1098
+VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1106
Represents single memory allocation.
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:458
VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
diff --git a/docs/html/resource_aliasing.html b/docs/html/resource_aliasing.html
index a11de3b..c8f3459 100644
--- a/docs/html/resource_aliasing.html
+++ b/docs/html/resource_aliasing.html
@@ -137,8 +137,8 @@ $(function() {
vkDestroyImage(allocator, img2, nullptr);
vkDestroyImage(allocator, img1, nullptr);
-Definition: vk_mem_alloc.h:1100
-VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1108
+Definition: vk_mem_alloc.h:1098
+VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:1106
Represents single memory allocation.
VkResult vmaBindImageMemory(VmaAllocator allocator, VmaAllocation allocation, VkImage image)
Binds image to allocation.
void vmaFreeMemory(VmaAllocator allocator, const VmaAllocation allocation)
Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(),...
diff --git a/docs/html/struct_vma_pool_create_info.html b/docs/html/struct_vma_pool_create_info.html
index 8f1a25f..eba902e 100644
--- a/docs/html/struct_vma_pool_create_info.html
+++ b/docs/html/struct_vma_pool_create_info.html
@@ -121,7 +121,7 @@ Public Attributes
Size of a single VkDeviceMemory
block to be allocated as part of this pool, in bytes. Optional.
Specify nonzero to set explicit, constant size of memory blocks used by this pool.
-Leave 0 to use default and let the library manage block sizes automatically. Sizes of particular blocks may vary.
+Leave 0 to use default and let the library manage block sizes automatically. Sizes of particular blocks may vary. In this case, the pool will also support dedicated allocations.
diff --git a/docs/html/virtual_allocator.html b/docs/html/virtual_allocator.html
index 5dc46ce..27b5541 100644
--- a/docs/html/virtual_allocator.html
+++ b/docs/html/virtual_allocator.html
@@ -83,8 +83,8 @@ Creating virtual block
-Parameters of created VmaVirtualBlock object to be passed to vmaCreateVirtualBlock().
Definition: vk_mem_alloc.h:1427
-VkDeviceSize size
Total size of the virtual block.
Definition: vk_mem_alloc.h:1433
+Parameters of created VmaVirtualBlock object to be passed to vmaCreateVirtualBlock().
Definition: vk_mem_alloc.h:1426
+VkDeviceSize size
Total size of the virtual block.
Definition: vk_mem_alloc.h:1432
Handle to a virtual block object that allows to use core allocation algorithm without allocating any ...
VkResult vmaCreateVirtualBlock(const VmaVirtualBlockCreateInfo *pCreateInfo, VmaVirtualBlock *pVirtualBlock)
Creates new VmaVirtualBlock object.
@@ -109,8 +109,8 @@ Making virtual allocations
{
}
-Parameters of created virtual allocation to be passed to vmaVirtualAllocate().
Definition: vk_mem_alloc.h:1448
-VkDeviceSize size
Size of the allocation.
Definition: vk_mem_alloc.h:1453
+Parameters of created virtual allocation to be passed to vmaVirtualAllocate().
Definition: vk_mem_alloc.h:1447
+VkDeviceSize size
Size of the allocation.
Definition: vk_mem_alloc.h:1452
VkResult vmaVirtualAllocate(VmaVirtualBlock virtualBlock, const VmaVirtualAllocationCreateInfo *pCreateInfo, VkDeviceSize *pOffset)
Allocates new virtual allocation inside given VmaVirtualBlock.
Deallocation
@@ -137,8 +137,8 @@ Allocation parameters
delete (CustomAllocData*)allocInfo.
pUserData;
-Parameters of an existing virtual allocation, returned by vmaGetVirtualAllocationInfo().
Definition: vk_mem_alloc.h:1471
-void * pUserData
Custom pointer associated with the allocation.
Definition: vk_mem_alloc.h:1481
+Parameters of an existing virtual allocation, returned by vmaGetVirtualAllocationInfo().
Definition: vk_mem_alloc.h:1470
+void * pUserData
Custom pointer associated with the allocation.
Definition: vk_mem_alloc.h:1480
void vmaGetVirtualAllocationInfo(VmaVirtualBlock virtualBlock, VkDeviceSize offset, VmaVirtualAllocationInfo *pVirtualAllocInfo)
Returns information about a specific virtual allocation within a virtual block, like its size and pUs...
Alignment and units
@@ -149,7 +149,7 @@ Alignment and units
VkDeviceSize allocOffset;
-VkDeviceSize alignment
Required alignment of the allocation. Optional.
Definition: vk_mem_alloc.h:1458
+VkDeviceSize alignment
Required alignment of the allocation. Optional.
Definition: vk_mem_alloc.h:1457
Alignments of different allocations made from one block may vary. However, if all alignments and sizes are always multiply of some size e.g. 4 B or sizeof(MyDataStruct)
, you can express all sizes, alignments, and offsets in multiples of that size instead of individual bytes. It might be more convenient, but you need to make sure to use this new unit consistently in all the places:
- VmaVirtualBlockCreateInfo::size
@@ -163,9 +163,9 @@ Statistics
printf("My virtual block has %llu bytes used by %u virtual allocations\n",
-Calculated statistics of memory usage in entire allocator.
Definition: vk_mem_alloc.h:1036
-uint32_t allocationCount
Number of VmaAllocation allocation objects allocated.
Definition: vk_mem_alloc.h:1040
-VkDeviceSize usedBytes
Total number of bytes occupied by all allocations.
Definition: vk_mem_alloc.h:1044
+Calculated statistics of memory usage in entire allocator.
Definition: vk_mem_alloc.h:1034
+uint32_t allocationCount
Number of VmaAllocation allocation objects allocated.
Definition: vk_mem_alloc.h:1038
+VkDeviceSize usedBytes
Total number of bytes occupied by all allocations.
Definition: vk_mem_alloc.h:1042
void vmaCalculateVirtualBlockStats(VmaVirtualBlock virtualBlock, VmaStatInfo *pStatInfo)
Calculates and returns statistics about virtual allocations and memory usage in given VmaVirtualBlock...
You can also request a full list of allocations and free regions as a string in JSON format by calling vmaBuildVirtualBlockStatsString(). Returned string must be later freed using vmaFreeVirtualBlockStatsString(). The format of this string differs from the one returned by the main Vulkan allocator, but it is similar.
diff --git a/docs/html/vk__mem__alloc_8h.html b/docs/html/vk__mem__alloc_8h.html
index ee73e9c..745937a 100644
--- a/docs/html/vk__mem__alloc_8h.html
+++ b/docs/html/vk__mem__alloc_8h.html
@@ -1247,8 +1247,7 @@ Functions
Flags to be passed as VmaAllocationCreateInfo::flags.
Enumerator |
---|
VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT | Set this flag if the allocation should have its own memory block.
-Use it for special, big resources, like fullscreen images used as attachments.
-You should not use this flag if VmaAllocationCreateInfo::pool is not null.
+Use it for special, big resources, like fullscreen images used as attachments.
|
VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT | Set this flag to only try to allocate from existing VkDeviceMemory blocks and never create new such block.
If new allocation cannot be placed in any of the existing blocks, allocation fails with VK_ERROR_OUT_OF_DEVICE_MEMORY error.
diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h
index 0e3bbb3..4443f2f 100644
--- a/include/vk_mem_alloc.h
+++ b/include/vk_mem_alloc.h
@@ -506,8 +506,6 @@ typedef enum VmaAllocationCreateFlagBits
/** \brief Set this flag if the allocation should have its own memory block.
Use it for special, big resources, like fullscreen images used as attachments.
-
- You should not use this flag if VmaAllocationCreateInfo::pool is not null.
*/
VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT = 0x00000001,
@@ -1162,6 +1160,7 @@ typedef struct VmaPoolCreateInfo
Leave 0 to use default and let the library manage block sizes automatically.
Sizes of particular blocks may vary.
+ In this case, the pool will also support dedicated allocations.
*/
VkDeviceSize blockSize;
/** \brief Minimum number of blocks to be always allocated in this pool, even if they stay empty.
@@ -19487,6 +19486,11 @@ vmaDestroyBuffer(allocator, buf, alloc);
vmaDestroyPool(allocator, pool);
\endcode
+New versions of this library support creating dedicated allocations in custom pools.
+It is supported only when VmaPoolCreateInfo::blockSize = 0.
+To use this feature, set VmaAllocationCreateInfo::pool to the pointer to your custom pool and
+VmaAllocationCreateInfo::flags to #VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT.
+
\section custom_memory_pools_MemTypeIndex Choosing memory type index
When creating a pool, you must explicitly specify memory type index.
|