From e92f98942362f167514cca3b59846a3eb45fb50c Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Wed, 7 Jul 2021 14:52:10 +0200 Subject: [PATCH] Added VmaAllocatorCreateInfo::pTypeExternalMemoryHandleTypes --- Doxyfile | 3 +- docs/html/allocation_annotation.html | 16 +- docs/html/choosing_memory_type.html | 16 +- docs/html/custom_memory_pools.html | 16 +- docs/html/defragmentation.html | 20 +- docs/html/functions.html | 3 + docs/html/functions_vars.html | 3 + docs/html/lost_allocations.html | 12 +- docs/html/memory_mapping.html | 20 +- docs/html/quick_start.html | 16 +- docs/html/resource_aliasing.html | 6 +- docs/html/search/all_10.js | 16 +- docs/html/search/all_11.js | 310 +- docs/html/search/all_b.js | 5 +- docs/html/search/all_c.js | 2 +- docs/html/search/all_d.js | 8 +- docs/html/search/all_e.js | 6 +- docs/html/search/all_f.js | 2 +- docs/html/search/classes_0.js | 42 +- docs/html/search/defines_0.js | 16 +- docs/html/search/enums_0.js | 12 +- docs/html/search/enumvalues_0.js | 84 +- docs/html/search/files_0.js | 2 +- docs/html/search/functions_0.js | 102 +- docs/html/search/pages_0.js | 2 +- docs/html/search/pages_1.js | 6 +- docs/html/search/pages_2.js | 6 +- docs/html/search/pages_3.js | 2 +- docs/html/search/pages_4.js | 2 +- docs/html/search/pages_5.js | 2 +- docs/html/search/pages_6.js | 2 +- docs/html/search/pages_7.js | 2 +- docs/html/search/pages_8.js | 6 +- docs/html/search/pages_9.js | 4 +- docs/html/search/pages_a.js | 6 +- docs/html/search/typedefs_0.js | 4 +- docs/html/search/typedefs_1.js | 56 +- docs/html/search/variables_0.js | 14 +- docs/html/search/variables_1.js | 12 +- docs/html/search/variables_2.js | 2 +- docs/html/search/variables_3.js | 6 +- docs/html/search/variables_4.js | 4 +- docs/html/search/variables_5.js | 2 +- docs/html/search/variables_6.js | 30 +- docs/html/search/variables_7.js | 2 +- docs/html/search/variables_8.js | 43 +- docs/html/search/variables_9.js | 2 +- docs/html/search/variables_a.js | 2 +- docs/html/search/variables_b.js | 2 +- docs/html/search/variables_c.js | 16 +- docs/html/search/variables_d.js | 36 +- ...uct_vma_allocator_create_info-members.html | 5 +- .../struct_vma_allocator_create_info.html | 21 + docs/html/vk__mem__alloc_8h_source.html | 31846 ++++++++-------- docs/html/vk_khr_dedicated_allocation.html | 2 +- include/vk_mem_alloc.h | 60 + 56 files changed, 16542 insertions(+), 16403 deletions(-) diff --git a/Doxyfile b/Doxyfile index 0d50ff3..1cf0a07 100644 --- a/Doxyfile +++ b/Doxyfile @@ -2259,7 +2259,8 @@ PREDEFINED = VMA_CALL_PRE= \ VMA_NULLABLE= \ VMA_LEN_IF_NOT_NULL(len)= \ VMA_NOT_NULL_NON_DISPATCHABLE= \ - VMA_NULLABLE_NON_DISPATCHABLE= + VMA_NULLABLE_NON_DISPATCHABLE= \ + VMA_EXTERNAL_MEMORY=1 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/docs/html/allocation_annotation.html b/docs/html/allocation_annotation.html index ca4a557..6e16aa6 100644 --- a/docs/html/allocation_annotation.html +++ b/docs/html/allocation_annotation.html @@ -84,18 +84,18 @@ Allocation user data
VkBuffer buffer;
VmaAllocation allocation;
vmaCreateBuffer(allocator, &bufferInfo, &allocCreateInfo, &buffer, &allocation, nullptr);
-
Definition: vk_mem_alloc.h:2879
-
void * pUserData
Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...
Definition: vk_mem_alloc.h:2918
-
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:2887
+
Definition: vk_mem_alloc.h:2900
+
void * pUserData
Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...
Definition: vk_mem_alloc.h:2939
+
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:2908
Represents single memory allocation.
-
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:2721
+
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:2742
VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)

The pointer may be later retrieved as VmaAllocationInfo::pUserData:

vmaGetAllocationInfo(allocator, allocation, &allocInfo);
MyBufferMetadata* pMetadata = (MyBufferMetadata*)allocInfo.pUserData;
-
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:3246
-
void * pUserData
Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...
Definition: vk_mem_alloc.h:3295
+
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:3267
+
void * pUserData
Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...
Definition: vk_mem_alloc.h:3316
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;
VmaAllocation allocation;
vmaCreateImage(allocator, &imageInfo, &allocCreateInfo, &image, &allocation, nullptr);
-
VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:2881
+
VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:2902
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:2824
+
@ VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT
Definition: vk_mem_alloc.h:2845

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.

vmaGetAllocationInfo(allocator, allocation, &allocInfo);
diff --git a/docs/html/choosing_memory_type.html b/docs/html/choosing_memory_type.html index db95c57..8cd2fae 100644 --- a/docs/html/choosing_memory_type.html +++ b/docs/html/choosing_memory_type.html @@ -93,10 +93,10 @@ Usage
VkBuffer buffer;
VmaAllocation allocation;
vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
-
Definition: vk_mem_alloc.h:2879
-
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:2887
+
Definition: vk_mem_alloc.h:2900
+
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:2908
Represents single memory allocation.
-
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:2721
+
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:2742
VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)

Required and preferred flags

@@ -109,10 +109,10 @@ Required and preferred flags
VkBuffer buffer;
VmaAllocation allocation;
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:2897
-
VkMemoryPropertyFlags requiredFlags
Flags that must be set in a Memory Type chosen for an allocation.
Definition: vk_mem_alloc.h:2892
-
VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:2881
-
@ 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:2798
+
VkMemoryPropertyFlags preferredFlags
Flags that preferably should be set in a memory type chosen for an allocation.
Definition: vk_mem_alloc.h:2918
+
VkMemoryPropertyFlags requiredFlags
Flags that must be set in a Memory Type chosen for an allocation.
Definition: vk_mem_alloc.h:2913
+
VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:2902
+
@ 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:2819

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;
VmaAllocation allocation;
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:2905
+
uint32_t memoryTypeBits
Bitmask containing one bit set for every memory type acceptable for this allocation.
Definition: vk_mem_alloc.h:2926

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 ef50582..4e2c7f6 100644 --- a/docs/html/custom_memory_pools.html +++ b/docs/html/custom_memory_pools.html @@ -105,13 +105,13 @@ $(function() {
VmaAllocation alloc;
VmaAllocationInfo allocInfo;
vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
-
Definition: vk_mem_alloc.h:2879
-
VmaPool pool
Pool that this allocation should be created in.
Definition: vk_mem_alloc.h:2911
+
Definition: vk_mem_alloc.h:2900
+
VmaPool pool
Pool that this allocation should be created in.
Definition: vk_mem_alloc.h:2932
Represents single memory allocation.
-
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:3246
-
Describes parameter of created VmaPool.
Definition: vk_mem_alloc.h:3047
-
uint32_t memoryTypeIndex
Vulkan memory type index to allocate this pool from.
Definition: vk_mem_alloc.h:3050
-
size_t maxBlockCount
Maximum number of blocks that can be allocated in this pool. Optional.
Definition: vk_mem_alloc.h:3075
+
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:3267
+
Describes parameter of created VmaPool.
Definition: vk_mem_alloc.h:3068
+
uint32_t memoryTypeIndex
Vulkan memory type index to allocate this pool from.
Definition: vk_mem_alloc.h:3071
+
size_t maxBlockCount
Maximum number of blocks that can be allocated in this pool. Optional.
Definition: vk_mem_alloc.h:3096
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)
@@ -136,8 +136,8 @@ Choosing memory type index
VmaPoolCreateInfo poolCreateInfo = {};
poolCreateInfo.memoryTypeIndex = memTypeIndex;
// ...
-
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:2887
-
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:2721
+
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:2908
+
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:2742
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: