From fac8ef44d2cfa6a6b48c5736ced24029d1f032ab Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Tue, 23 Nov 2021 13:35:19 +0100 Subject: [PATCH] Added convenience function vmaGetAllocationMemoryProperties Regenerated documentation. --- docs/html/defragmentation.html | 18 +++---- docs/html/globals.html | 1 + docs/html/globals_func.html | 1 + docs/html/memory_mapping.html | 10 ++-- docs/html/search/all_11.js | 91 ++++++++++++++++---------------- docs/html/search/functions_0.js | 43 +++++++-------- docs/html/virtual_allocator.html | 14 ++--- docs/html/vk__mem__alloc_8h.html | 40 ++++++++++++++ include/vk_mem_alloc.h | 30 +++++++++-- 9 files changed, 155 insertions(+), 93 deletions(-) diff --git a/docs/html/defragmentation.html b/docs/html/defragmentation.html index 8b1536a..57500c2 100644 --- a/docs/html/defragmentation.html +++ b/docs/html/defragmentation.html @@ -132,12 +132,12 @@ Defragmenting CPU memory
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:1357
Represents main object of this library initialized.
Represents Opaque object that represents started defragmentation process.
-
Parameters for defragmentation.
Definition: vk_mem_alloc.h:1763
-
uint32_t allocationCount
Number of allocations in pAllocations array.
Definition: vk_mem_alloc.h:1769
-
VkBool32 * pAllocationsChanged
Optional, output. Pointer to array that will be filled with information whether the allocation at cer...
Definition: vk_mem_alloc.h:1784
-
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:1813
-
const VmaAllocation * pAllocations
Pointer to array of allocations that can be defragmented.
Definition: vk_mem_alloc.h:1778
-
VkDeviceSize maxCpuBytesToMove
Maximum total numbers of bytes that can be copied while moving allocations to different places using ...
Definition: vk_mem_alloc.h:1808
+
Parameters for defragmentation.
Definition: vk_mem_alloc.h:1774
+
uint32_t allocationCount
Number of allocations in pAllocations array.
Definition: vk_mem_alloc.h:1780
+
VkBool32 * pAllocationsChanged
Optional, output. Pointer to array that will be filled with information whether the allocation at cer...
Definition: vk_mem_alloc.h:1795
+
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:1824
+
const VmaAllocation * pAllocations
Pointer to array of allocations that can be defragmented.
Definition: vk_mem_alloc.h:1789
+
VkDeviceSize maxCpuBytesToMove
Maximum total numbers of bytes that can be copied while moving allocations to different places using ...
Definition: vk_mem_alloc.h:1819
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
vmaBindBufferMemory(allocator, allocations[i], buffers[i]);
}
}
-
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:1823
-
VkDeviceSize maxGpuBytesToMove
Maximum total numbers of bytes that can be copied while moving allocations to different places using ...
Definition: vk_mem_alloc.h:1818
-
VkCommandBuffer commandBuffer
Optional. Command buffer where GPU copy commands will be posted.
Definition: vk_mem_alloc.h:1832
+
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:1834
+
VkDeviceSize maxGpuBytesToMove
Maximum total numbers of bytes that can be copied while moving allocations to different places using ...
Definition: vk_mem_alloc.h:1829
+
VkCommandBuffer commandBuffer
Optional. Command buffer where GPU copy commands will be posted.
Definition: vk_mem_alloc.h:1843

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/globals.html b/docs/html/globals.html index 60fdf4a..a0ae507 100644 --- a/docs/html/globals.html +++ b/docs/html/globals.html @@ -189,6 +189,7 @@ $(function() {
  • vmaFreeStatsString() : vk_mem_alloc.h
  • vmaFreeVirtualBlockStatsString() : vk_mem_alloc.h
  • vmaGetAllocationInfo() : vk_mem_alloc.h
  • +
  • vmaGetAllocationMemoryProperties() : vk_mem_alloc.h
  • vmaGetAllocatorInfo() : vk_mem_alloc.h
  • vmaGetBudget() : vk_mem_alloc.h
  • vmaGetMemoryProperties() : vk_mem_alloc.h
  • diff --git a/docs/html/globals_func.html b/docs/html/globals_func.html index 1e3cc30..10a9099 100644 --- a/docs/html/globals_func.html +++ b/docs/html/globals_func.html @@ -108,6 +108,7 @@ $(function() {
  • vmaFreeStatsString() : vk_mem_alloc.h
  • vmaFreeVirtualBlockStatsString() : vk_mem_alloc.h
  • vmaGetAllocationInfo() : vk_mem_alloc.h
  • +
  • vmaGetAllocationMemoryProperties() : vk_mem_alloc.h
  • vmaGetAllocatorInfo() : vk_mem_alloc.h
  • vmaGetBudget() : vk_mem_alloc.h
  • vmaGetMemoryProperties() : vk_mem_alloc.h
  • diff --git a/docs/html/memory_mapping.html b/docs/html/memory_mapping.html index 979ead2..2a02ff8 100644 --- a/docs/html/memory_mapping.html +++ b/docs/html/memory_mapping.html @@ -138,7 +138,7 @@ Cache flush and invalidate

    Finding out if memory is mappable

    It may happen that your allocation ends up in memory that is HOST_VISIBLE (available for mapping) despite it wasn't explicitly requested. For example, application may work on integrated graphics with unified memory (like Intel) or allocation from video memory might have failed, so the library chose system memory as fallback.

    -

    You can detect this case and map such allocation to access its memory on CPU directly, instead of launching a transfer operation. In order to do that: inspect allocInfo.memoryType, call vmaGetMemoryTypeProperties(), and look for VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT flag in properties of that memory type.

    +

    You can detect this case and map such allocation to access its memory on CPU directly, instead of launching a transfer operation. In order to do that: call vmaGetAllocationMemoryProperties() and look for VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT flag.

    VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
    bufCreateInfo.size = sizeof(ConstantBuffer);
    bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
    @@ -149,11 +149,10 @@ Finding out if memory is mappable
    VkBuffer buf;
    - -
    vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo);
    +
    vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, nullptr);
    VkMemoryPropertyFlags memFlags;
    -
    vmaGetMemoryTypeProperties(allocator, allocInfo.memoryType, &memFlags);
    +
    vmaGetAllocationMemoryProperties(allocator, alloc, &memFlags);
    if((memFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)
    {
    // Allocation ended up in mappable memory. You can map it and access it directly.
    @@ -168,8 +167,7 @@ Finding out if memory is mappable
    // You need to create CPU-side buffer in VMA_MEMORY_USAGE_CPU_ONLY and make a transfer.
    }
    VkMemoryPropertyFlags preferredFlags
    Flags that preferably should be set in a memory type chosen for an allocation.
    Definition: vk_mem_alloc.h:1010
    -
    uint32_t memoryType
    Memory type index that this allocation was allocated from.
    Definition: vk_mem_alloc.h:1362
    -
    void vmaGetMemoryTypeProperties(VmaAllocator allocator, uint32_t memoryTypeIndex, VkMemoryPropertyFlags *pFlags)
    Given Memory Type Index, returns Property Flags of this memory type.
    +
    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:834

    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:

    VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
    diff --git a/docs/html/search/all_11.js b/docs/html/search/all_11.js index 8469cc6..6607c33 100644 --- a/docs/html/search/all_11.js +++ b/docs/html/search/all_11.js @@ -127,8 +127,8 @@ var searchData= ['vmadefragmentationflags_124',['VmaDefragmentationFlags',['../vk__mem__alloc_8h.html#a88a77cef37e5d3c4fc9eb328885d048d',1,'vk_mem_alloc.h']]], ['vmadefragmentationinfo_125',['VmaDefragmentationInfo',['../struct_vma_defragmentation_info.html',1,'VmaDefragmentationInfo'],['../vk__mem__alloc_8h.html#a2bf47f96bf92bed2a49461bd9af3acfa',1,'VmaDefragmentationInfo(): vk_mem_alloc.h']]], ['vmadefragmentationinfo2_126',['VmaDefragmentationInfo2',['../struct_vma_defragmentation_info2.html',1,'VmaDefragmentationInfo2'],['../vk__mem__alloc_8h.html#ad6daeffaa670ce6d11a203a6224c9937',1,'VmaDefragmentationInfo2(): vk_mem_alloc.h']]], - ['vmadefragmentationpassinfo_127',['VmaDefragmentationPassInfo',['../vk__mem__alloc_8h.html#a72aebd522242d56abea67b4f47f6549e',1,'VmaDefragmentationPassInfo(): vk_mem_alloc.h'],['../struct_vma_defragmentation_pass_info.html',1,'VmaDefragmentationPassInfo']]], - ['vmadefragmentationpassmoveinfo_128',['VmaDefragmentationPassMoveInfo',['../struct_vma_defragmentation_pass_move_info.html',1,'VmaDefragmentationPassMoveInfo'],['../vk__mem__alloc_8h.html#ad6799e8e2b1527abfc84d33bc44aeaf5',1,'VmaDefragmentationPassMoveInfo(): vk_mem_alloc.h']]], + ['vmadefragmentationpassinfo_127',['VmaDefragmentationPassInfo',['../struct_vma_defragmentation_pass_info.html',1,'VmaDefragmentationPassInfo'],['../vk__mem__alloc_8h.html#a72aebd522242d56abea67b4f47f6549e',1,'VmaDefragmentationPassInfo(): vk_mem_alloc.h']]], + ['vmadefragmentationpassmoveinfo_128',['VmaDefragmentationPassMoveInfo',['../vk__mem__alloc_8h.html#ad6799e8e2b1527abfc84d33bc44aeaf5',1,'VmaDefragmentationPassMoveInfo(): vk_mem_alloc.h'],['../struct_vma_defragmentation_pass_move_info.html',1,'VmaDefragmentationPassMoveInfo']]], ['vmadefragmentationstats_129',['VmaDefragmentationStats',['../struct_vma_defragmentation_stats.html',1,'VmaDefragmentationStats'],['../vk__mem__alloc_8h.html#ad94034192259c2e34a4d1c5e27810403',1,'VmaDefragmentationStats(): vk_mem_alloc.h']]], ['vmadestroyallocator_130',['vmaDestroyAllocator',['../vk__mem__alloc_8h.html#aa8d164061c88f22fb1fd3c8f3534bc1d',1,'vk_mem_alloc.h']]], ['vmadestroybuffer_131',['vmaDestroyBuffer',['../vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77',1,'vk_mem_alloc.h']]], @@ -147,47 +147,48 @@ var searchData= ['vmafreestatsstring_144',['vmaFreeStatsString',['../vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288',1,'vk_mem_alloc.h']]], ['vmafreevirtualblockstatsstring_145',['vmaFreeVirtualBlockStatsString',['../vk__mem__alloc_8h.html#a47fb8d8aa69df4a7c23a9719b4080623',1,'vk_mem_alloc.h']]], ['vmagetallocationinfo_146',['vmaGetAllocationInfo',['../vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b',1,'vk_mem_alloc.h']]], - ['vmagetallocatorinfo_147',['vmaGetAllocatorInfo',['../vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7',1,'vk_mem_alloc.h']]], - ['vmagetbudget_148',['vmaGetBudget',['../vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba',1,'vk_mem_alloc.h']]], - ['vmagetmemoryproperties_149',['vmaGetMemoryProperties',['../vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19',1,'vk_mem_alloc.h']]], - ['vmagetmemorytypeproperties_150',['vmaGetMemoryTypeProperties',['../vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca',1,'vk_mem_alloc.h']]], - ['vmagetphysicaldeviceproperties_151',['vmaGetPhysicalDeviceProperties',['../vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0',1,'vk_mem_alloc.h']]], - ['vmagetpoolname_152',['vmaGetPoolName',['../vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030',1,'vk_mem_alloc.h']]], - ['vmagetpoolstats_153',['vmaGetPoolStats',['../vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153',1,'vk_mem_alloc.h']]], - ['vmagetvirtualallocationinfo_154',['vmaGetVirtualAllocationInfo',['../vk__mem__alloc_8h.html#ab5fcb961ffea69023e7e0ea100bdad8e',1,'vk_mem_alloc.h']]], - ['vmainvalidateallocation_155',['vmaInvalidateAllocation',['../vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae',1,'vk_mem_alloc.h']]], - ['vmainvalidateallocations_156',['vmaInvalidateAllocations',['../vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5',1,'vk_mem_alloc.h']]], - ['vmaisvirtualblockempty_157',['vmaIsVirtualBlockEmpty',['../vk__mem__alloc_8h.html#acd53b5b1d23f8fcbad692ccfdc1811f1',1,'vk_mem_alloc.h']]], - ['vmamakepoolallocationslost_158',['vmaMakePoolAllocationsLost',['../vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024',1,'vk_mem_alloc.h']]], - ['vmamapmemory_159',['vmaMapMemory',['../vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069',1,'vk_mem_alloc.h']]], - ['vmamemoryusage_160',['VmaMemoryUsage',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc',1,'VmaMemoryUsage(): vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a806e8499dde802e59eb72a1dc811c35f',1,'VmaMemoryUsage(): vk_mem_alloc.h']]], - ['vmapool_161',['VmaPool',['../struct_vma_pool.html',1,'']]], - ['vmapoolcreateflagbits_162',['VmaPoolCreateFlagBits',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7',1,'VmaPoolCreateFlagBits(): vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a4d4f2efc2509157a9e4ecd4fd7942303',1,'VmaPoolCreateFlagBits(): vk_mem_alloc.h']]], - ['vmapoolcreateflags_163',['VmaPoolCreateFlags',['../vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a',1,'vk_mem_alloc.h']]], - ['vmapoolcreateinfo_164',['VmaPoolCreateInfo',['../struct_vma_pool_create_info.html',1,'VmaPoolCreateInfo'],['../vk__mem__alloc_8h.html#a1017aa83489c0eee8d2163d2bf253f67',1,'VmaPoolCreateInfo(): vk_mem_alloc.h']]], - ['vmapoolstats_165',['VmaPoolStats',['../struct_vma_pool_stats.html',1,'VmaPoolStats'],['../vk__mem__alloc_8h.html#a4759a2d9f99c19ba7627553c847132f1',1,'VmaPoolStats(): vk_mem_alloc.h']]], - ['vmarecordflagbits_166',['VmaRecordFlagBits',['../vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2',1,'VmaRecordFlagBits(): vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#acd24d5eb58abff7e1f43cb32a1ba1413',1,'VmaRecordFlagBits(): vk_mem_alloc.h']]], - ['vmarecordflags_167',['VmaRecordFlags',['../vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828',1,'vk_mem_alloc.h']]], - ['vmarecordsettings_168',['VmaRecordSettings',['../vk__mem__alloc_8h.html#a16e21c877101493fce582664cd8754fc',1,'VmaRecordSettings(): vk_mem_alloc.h'],['../struct_vma_record_settings.html',1,'VmaRecordSettings']]], - ['vmasetallocationuserdata_169',['vmaSetAllocationUserData',['../vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f',1,'vk_mem_alloc.h']]], - ['vmasetcurrentframeindex_170',['vmaSetCurrentFrameIndex',['../vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]], - ['vmasetpoolname_171',['vmaSetPoolName',['../vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58',1,'vk_mem_alloc.h']]], - ['vmasetvirtualallocationuserdata_172',['vmaSetVirtualAllocationUserData',['../vk__mem__alloc_8h.html#a4b96f835d38686df937e097a0c7db5e9',1,'vk_mem_alloc.h']]], - ['vmastatinfo_173',['VmaStatInfo',['../struct_vma_stat_info.html',1,'VmaStatInfo'],['../vk__mem__alloc_8h.html#aec5b57e29c97b5d69c6d5654d60df878',1,'VmaStatInfo(): vk_mem_alloc.h']]], - ['vmastats_174',['VmaStats',['../struct_vma_stats.html',1,'VmaStats'],['../vk__mem__alloc_8h.html#a21813b2efdf3836767a9058cd8a94034',1,'VmaStats(): vk_mem_alloc.h']]], - ['vmatouchallocation_175',['vmaTouchAllocation',['../vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a',1,'vk_mem_alloc.h']]], - ['vmaunmapmemory_176',['vmaUnmapMemory',['../vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]], - ['vmavirtualallocate_177',['vmaVirtualAllocate',['../vk__mem__alloc_8h.html#a1c15925e6745dacee0cfc877fffecec2',1,'vk_mem_alloc.h']]], - ['vmavirtualallocationcreateflagbits_178',['VmaVirtualAllocationCreateFlagBits',['../vk__mem__alloc_8h.html#a2e9c64d405b14156fea7e10c4ad06cb6',1,'VmaVirtualAllocationCreateFlagBits(): vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a936815e64946a6b6d812d08d10184c23',1,'VmaVirtualAllocationCreateFlagBits(): vk_mem_alloc.h']]], - ['vmavirtualallocationcreateflags_179',['VmaVirtualAllocationCreateFlags',['../vk__mem__alloc_8h.html#ae96ffc099bf898257fb19e9410ed08a7',1,'vk_mem_alloc.h']]], - ['vmavirtualallocationcreateinfo_180',['VmaVirtualAllocationCreateInfo',['../vk__mem__alloc_8h.html#ac3c90d80bedc6847a41b82d0e2158c9e',1,'VmaVirtualAllocationCreateInfo(): vk_mem_alloc.h'],['../struct_vma_virtual_allocation_create_info.html',1,'VmaVirtualAllocationCreateInfo']]], - ['vmavirtualallocationinfo_181',['VmaVirtualAllocationInfo',['../struct_vma_virtual_allocation_info.html',1,'VmaVirtualAllocationInfo'],['../vk__mem__alloc_8h.html#a75bc33ff7cf18c98e101f570dc2a5ebc',1,'VmaVirtualAllocationInfo(): vk_mem_alloc.h']]], - ['vmavirtualblock_182',['VmaVirtualBlock',['../struct_vma_virtual_block.html',1,'']]], - ['vmavirtualblockcreateflagbits_183',['VmaVirtualBlockCreateFlagBits',['../vk__mem__alloc_8h.html#a88bcf8c1cd3bb1610ff7343811c65bca',1,'VmaVirtualBlockCreateFlagBits(): vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a0860ba1c0a67178fae4aecb63a78573e',1,'VmaVirtualBlockCreateFlagBits(): vk_mem_alloc.h']]], - ['vmavirtualblockcreateflags_184',['VmaVirtualBlockCreateFlags',['../vk__mem__alloc_8h.html#a4e49c2f0ab7f6b4868833e5bac78d91e',1,'vk_mem_alloc.h']]], - ['vmavirtualblockcreateinfo_185',['VmaVirtualBlockCreateInfo',['../struct_vma_virtual_block_create_info.html',1,'VmaVirtualBlockCreateInfo'],['../vk__mem__alloc_8h.html#a4753d42d40217a3a652a3cdf253ad773',1,'VmaVirtualBlockCreateInfo(): vk_mem_alloc.h']]], - ['vmavirtualfree_186',['vmaVirtualFree',['../vk__mem__alloc_8h.html#a13f01c44b3c1a06e695f1f5d24b80639',1,'vk_mem_alloc.h']]], - ['vmavulkanfunctions_187',['VmaVulkanFunctions',['../vk__mem__alloc_8h.html#abb0a8e3b5040d847571cca6c7f9a8074',1,'VmaVulkanFunctions(): vk_mem_alloc.h'],['../struct_vma_vulkan_functions.html',1,'VmaVulkanFunctions']]], - ['vulkan_20memory_20allocator_188',['Vulkan Memory Allocator',['../index.html',1,'']]], - ['vulkanapiversion_189',['vulkanApiVersion',['../struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285',1,'VmaAllocatorCreateInfo']]] + ['vmagetallocationmemoryproperties_147',['vmaGetAllocationMemoryProperties',['../vk__mem__alloc_8h.html#a571e87dd38e552249b56b1b0b982fad1',1,'vk_mem_alloc.h']]], + ['vmagetallocatorinfo_148',['vmaGetAllocatorInfo',['../vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7',1,'vk_mem_alloc.h']]], + ['vmagetbudget_149',['vmaGetBudget',['../vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba',1,'vk_mem_alloc.h']]], + ['vmagetmemoryproperties_150',['vmaGetMemoryProperties',['../vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19',1,'vk_mem_alloc.h']]], + ['vmagetmemorytypeproperties_151',['vmaGetMemoryTypeProperties',['../vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca',1,'vk_mem_alloc.h']]], + ['vmagetphysicaldeviceproperties_152',['vmaGetPhysicalDeviceProperties',['../vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0',1,'vk_mem_alloc.h']]], + ['vmagetpoolname_153',['vmaGetPoolName',['../vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030',1,'vk_mem_alloc.h']]], + ['vmagetpoolstats_154',['vmaGetPoolStats',['../vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153',1,'vk_mem_alloc.h']]], + ['vmagetvirtualallocationinfo_155',['vmaGetVirtualAllocationInfo',['../vk__mem__alloc_8h.html#ab5fcb961ffea69023e7e0ea100bdad8e',1,'vk_mem_alloc.h']]], + ['vmainvalidateallocation_156',['vmaInvalidateAllocation',['../vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae',1,'vk_mem_alloc.h']]], + ['vmainvalidateallocations_157',['vmaInvalidateAllocations',['../vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5',1,'vk_mem_alloc.h']]], + ['vmaisvirtualblockempty_158',['vmaIsVirtualBlockEmpty',['../vk__mem__alloc_8h.html#acd53b5b1d23f8fcbad692ccfdc1811f1',1,'vk_mem_alloc.h']]], + ['vmamakepoolallocationslost_159',['vmaMakePoolAllocationsLost',['../vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024',1,'vk_mem_alloc.h']]], + ['vmamapmemory_160',['vmaMapMemory',['../vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069',1,'vk_mem_alloc.h']]], + ['vmamemoryusage_161',['VmaMemoryUsage',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc',1,'VmaMemoryUsage(): vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a806e8499dde802e59eb72a1dc811c35f',1,'VmaMemoryUsage(): vk_mem_alloc.h']]], + ['vmapool_162',['VmaPool',['../struct_vma_pool.html',1,'']]], + ['vmapoolcreateflagbits_163',['VmaPoolCreateFlagBits',['../vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7',1,'VmaPoolCreateFlagBits(): vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a4d4f2efc2509157a9e4ecd4fd7942303',1,'VmaPoolCreateFlagBits(): vk_mem_alloc.h']]], + ['vmapoolcreateflags_164',['VmaPoolCreateFlags',['../vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a',1,'vk_mem_alloc.h']]], + ['vmapoolcreateinfo_165',['VmaPoolCreateInfo',['../struct_vma_pool_create_info.html',1,'VmaPoolCreateInfo'],['../vk__mem__alloc_8h.html#a1017aa83489c0eee8d2163d2bf253f67',1,'VmaPoolCreateInfo(): vk_mem_alloc.h']]], + ['vmapoolstats_166',['VmaPoolStats',['../struct_vma_pool_stats.html',1,'VmaPoolStats'],['../vk__mem__alloc_8h.html#a4759a2d9f99c19ba7627553c847132f1',1,'VmaPoolStats(): vk_mem_alloc.h']]], + ['vmarecordflagbits_167',['VmaRecordFlagBits',['../vk__mem__alloc_8h.html#a4dd2c44642312a147a4e93373a6e64d2',1,'VmaRecordFlagBits(): vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#acd24d5eb58abff7e1f43cb32a1ba1413',1,'VmaRecordFlagBits(): vk_mem_alloc.h']]], + ['vmarecordflags_168',['VmaRecordFlags',['../vk__mem__alloc_8h.html#af3929a1a4547c592fc0b0e55ef452828',1,'vk_mem_alloc.h']]], + ['vmarecordsettings_169',['VmaRecordSettings',['../vk__mem__alloc_8h.html#a16e21c877101493fce582664cd8754fc',1,'VmaRecordSettings(): vk_mem_alloc.h'],['../struct_vma_record_settings.html',1,'VmaRecordSettings']]], + ['vmasetallocationuserdata_170',['vmaSetAllocationUserData',['../vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f',1,'vk_mem_alloc.h']]], + ['vmasetcurrentframeindex_171',['vmaSetCurrentFrameIndex',['../vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]], + ['vmasetpoolname_172',['vmaSetPoolName',['../vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58',1,'vk_mem_alloc.h']]], + ['vmasetvirtualallocationuserdata_173',['vmaSetVirtualAllocationUserData',['../vk__mem__alloc_8h.html#a4b96f835d38686df937e097a0c7db5e9',1,'vk_mem_alloc.h']]], + ['vmastatinfo_174',['VmaStatInfo',['../struct_vma_stat_info.html',1,'VmaStatInfo'],['../vk__mem__alloc_8h.html#aec5b57e29c97b5d69c6d5654d60df878',1,'VmaStatInfo(): vk_mem_alloc.h']]], + ['vmastats_175',['VmaStats',['../struct_vma_stats.html',1,'VmaStats'],['../vk__mem__alloc_8h.html#a21813b2efdf3836767a9058cd8a94034',1,'VmaStats(): vk_mem_alloc.h']]], + ['vmatouchallocation_176',['vmaTouchAllocation',['../vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a',1,'vk_mem_alloc.h']]], + ['vmaunmapmemory_177',['vmaUnmapMemory',['../vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]], + ['vmavirtualallocate_178',['vmaVirtualAllocate',['../vk__mem__alloc_8h.html#a1c15925e6745dacee0cfc877fffecec2',1,'vk_mem_alloc.h']]], + ['vmavirtualallocationcreateflagbits_179',['VmaVirtualAllocationCreateFlagBits',['../vk__mem__alloc_8h.html#a2e9c64d405b14156fea7e10c4ad06cb6',1,'VmaVirtualAllocationCreateFlagBits(): vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a936815e64946a6b6d812d08d10184c23',1,'VmaVirtualAllocationCreateFlagBits(): vk_mem_alloc.h']]], + ['vmavirtualallocationcreateflags_180',['VmaVirtualAllocationCreateFlags',['../vk__mem__alloc_8h.html#ae96ffc099bf898257fb19e9410ed08a7',1,'vk_mem_alloc.h']]], + ['vmavirtualallocationcreateinfo_181',['VmaVirtualAllocationCreateInfo',['../vk__mem__alloc_8h.html#ac3c90d80bedc6847a41b82d0e2158c9e',1,'VmaVirtualAllocationCreateInfo(): vk_mem_alloc.h'],['../struct_vma_virtual_allocation_create_info.html',1,'VmaVirtualAllocationCreateInfo']]], + ['vmavirtualallocationinfo_182',['VmaVirtualAllocationInfo',['../struct_vma_virtual_allocation_info.html',1,'VmaVirtualAllocationInfo'],['../vk__mem__alloc_8h.html#a75bc33ff7cf18c98e101f570dc2a5ebc',1,'VmaVirtualAllocationInfo(): vk_mem_alloc.h']]], + ['vmavirtualblock_183',['VmaVirtualBlock',['../struct_vma_virtual_block.html',1,'']]], + ['vmavirtualblockcreateflagbits_184',['VmaVirtualBlockCreateFlagBits',['../vk__mem__alloc_8h.html#a88bcf8c1cd3bb1610ff7343811c65bca',1,'VmaVirtualBlockCreateFlagBits(): vk_mem_alloc.h'],['../vk__mem__alloc_8h.html#a0860ba1c0a67178fae4aecb63a78573e',1,'VmaVirtualBlockCreateFlagBits(): vk_mem_alloc.h']]], + ['vmavirtualblockcreateflags_185',['VmaVirtualBlockCreateFlags',['../vk__mem__alloc_8h.html#a4e49c2f0ab7f6b4868833e5bac78d91e',1,'vk_mem_alloc.h']]], + ['vmavirtualblockcreateinfo_186',['VmaVirtualBlockCreateInfo',['../struct_vma_virtual_block_create_info.html',1,'VmaVirtualBlockCreateInfo'],['../vk__mem__alloc_8h.html#a4753d42d40217a3a652a3cdf253ad773',1,'VmaVirtualBlockCreateInfo(): vk_mem_alloc.h']]], + ['vmavirtualfree_187',['vmaVirtualFree',['../vk__mem__alloc_8h.html#a13f01c44b3c1a06e695f1f5d24b80639',1,'vk_mem_alloc.h']]], + ['vmavulkanfunctions_188',['VmaVulkanFunctions',['../vk__mem__alloc_8h.html#abb0a8e3b5040d847571cca6c7f9a8074',1,'VmaVulkanFunctions(): vk_mem_alloc.h'],['../struct_vma_vulkan_functions.html',1,'VmaVulkanFunctions']]], + ['vulkan_20memory_20allocator_189',['Vulkan Memory Allocator',['../index.html',1,'']]], + ['vulkanapiversion_190',['vulkanApiVersion',['../struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285',1,'VmaAllocatorCreateInfo']]] ]; diff --git a/docs/html/search/functions_0.js b/docs/html/search/functions_0.js index 0a1eb31..061a01c 100644 --- a/docs/html/search/functions_0.js +++ b/docs/html/search/functions_0.js @@ -43,25 +43,26 @@ var searchData= ['vmafreestatsstring_40',['vmaFreeStatsString',['../vk__mem__alloc_8h.html#a3104eb30d8122c84dd8541063f145288',1,'vk_mem_alloc.h']]], ['vmafreevirtualblockstatsstring_41',['vmaFreeVirtualBlockStatsString',['../vk__mem__alloc_8h.html#a47fb8d8aa69df4a7c23a9719b4080623',1,'vk_mem_alloc.h']]], ['vmagetallocationinfo_42',['vmaGetAllocationInfo',['../vk__mem__alloc_8h.html#a86dd08aba8633bfa4ad0df2e76481d8b',1,'vk_mem_alloc.h']]], - ['vmagetallocatorinfo_43',['vmaGetAllocatorInfo',['../vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7',1,'vk_mem_alloc.h']]], - ['vmagetbudget_44',['vmaGetBudget',['../vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba',1,'vk_mem_alloc.h']]], - ['vmagetmemoryproperties_45',['vmaGetMemoryProperties',['../vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19',1,'vk_mem_alloc.h']]], - ['vmagetmemorytypeproperties_46',['vmaGetMemoryTypeProperties',['../vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca',1,'vk_mem_alloc.h']]], - ['vmagetphysicaldeviceproperties_47',['vmaGetPhysicalDeviceProperties',['../vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0',1,'vk_mem_alloc.h']]], - ['vmagetpoolname_48',['vmaGetPoolName',['../vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030',1,'vk_mem_alloc.h']]], - ['vmagetpoolstats_49',['vmaGetPoolStats',['../vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153',1,'vk_mem_alloc.h']]], - ['vmagetvirtualallocationinfo_50',['vmaGetVirtualAllocationInfo',['../vk__mem__alloc_8h.html#ab5fcb961ffea69023e7e0ea100bdad8e',1,'vk_mem_alloc.h']]], - ['vmainvalidateallocation_51',['vmaInvalidateAllocation',['../vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae',1,'vk_mem_alloc.h']]], - ['vmainvalidateallocations_52',['vmaInvalidateAllocations',['../vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5',1,'vk_mem_alloc.h']]], - ['vmaisvirtualblockempty_53',['vmaIsVirtualBlockEmpty',['../vk__mem__alloc_8h.html#acd53b5b1d23f8fcbad692ccfdc1811f1',1,'vk_mem_alloc.h']]], - ['vmamakepoolallocationslost_54',['vmaMakePoolAllocationsLost',['../vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024',1,'vk_mem_alloc.h']]], - ['vmamapmemory_55',['vmaMapMemory',['../vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069',1,'vk_mem_alloc.h']]], - ['vmasetallocationuserdata_56',['vmaSetAllocationUserData',['../vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f',1,'vk_mem_alloc.h']]], - ['vmasetcurrentframeindex_57',['vmaSetCurrentFrameIndex',['../vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]], - ['vmasetpoolname_58',['vmaSetPoolName',['../vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58',1,'vk_mem_alloc.h']]], - ['vmasetvirtualallocationuserdata_59',['vmaSetVirtualAllocationUserData',['../vk__mem__alloc_8h.html#a4b96f835d38686df937e097a0c7db5e9',1,'vk_mem_alloc.h']]], - ['vmatouchallocation_60',['vmaTouchAllocation',['../vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a',1,'vk_mem_alloc.h']]], - ['vmaunmapmemory_61',['vmaUnmapMemory',['../vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]], - ['vmavirtualallocate_62',['vmaVirtualAllocate',['../vk__mem__alloc_8h.html#a1c15925e6745dacee0cfc877fffecec2',1,'vk_mem_alloc.h']]], - ['vmavirtualfree_63',['vmaVirtualFree',['../vk__mem__alloc_8h.html#a13f01c44b3c1a06e695f1f5d24b80639',1,'vk_mem_alloc.h']]] + ['vmagetallocationmemoryproperties_43',['vmaGetAllocationMemoryProperties',['../vk__mem__alloc_8h.html#a571e87dd38e552249b56b1b0b982fad1',1,'vk_mem_alloc.h']]], + ['vmagetallocatorinfo_44',['vmaGetAllocatorInfo',['../vk__mem__alloc_8h.html#afa02231a791b37255720d566a52683e7',1,'vk_mem_alloc.h']]], + ['vmagetbudget_45',['vmaGetBudget',['../vk__mem__alloc_8h.html#aec0ed24ebea2d0099eed5f801daaefba',1,'vk_mem_alloc.h']]], + ['vmagetmemoryproperties_46',['vmaGetMemoryProperties',['../vk__mem__alloc_8h.html#ab88db292a17974f911182543fda52d19',1,'vk_mem_alloc.h']]], + ['vmagetmemorytypeproperties_47',['vmaGetMemoryTypeProperties',['../vk__mem__alloc_8h.html#a8701444752eb5de4464adb5a2b514bca',1,'vk_mem_alloc.h']]], + ['vmagetphysicaldeviceproperties_48',['vmaGetPhysicalDeviceProperties',['../vk__mem__alloc_8h.html#aecabf7b6e91ea87d0316fa0a9e014fe0',1,'vk_mem_alloc.h']]], + ['vmagetpoolname_49',['vmaGetPoolName',['../vk__mem__alloc_8h.html#af09b4e4eafdbee812e8d73ddf960f030',1,'vk_mem_alloc.h']]], + ['vmagetpoolstats_50',['vmaGetPoolStats',['../vk__mem__alloc_8h.html#ae8bf76997b234ef68aad922616df4153',1,'vk_mem_alloc.h']]], + ['vmagetvirtualallocationinfo_51',['vmaGetVirtualAllocationInfo',['../vk__mem__alloc_8h.html#ab5fcb961ffea69023e7e0ea100bdad8e',1,'vk_mem_alloc.h']]], + ['vmainvalidateallocation_52',['vmaInvalidateAllocation',['../vk__mem__alloc_8h.html#aaa8412919139ef413a4215ac6a290fae',1,'vk_mem_alloc.h']]], + ['vmainvalidateallocations_53',['vmaInvalidateAllocations',['../vk__mem__alloc_8h.html#ab25b558d75f7378ec944a1522fdcc3c5',1,'vk_mem_alloc.h']]], + ['vmaisvirtualblockempty_54',['vmaIsVirtualBlockEmpty',['../vk__mem__alloc_8h.html#acd53b5b1d23f8fcbad692ccfdc1811f1',1,'vk_mem_alloc.h']]], + ['vmamakepoolallocationslost_55',['vmaMakePoolAllocationsLost',['../vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024',1,'vk_mem_alloc.h']]], + ['vmamapmemory_56',['vmaMapMemory',['../vk__mem__alloc_8h.html#ad5bd1243512d099706de88168992f069',1,'vk_mem_alloc.h']]], + ['vmasetallocationuserdata_57',['vmaSetAllocationUserData',['../vk__mem__alloc_8h.html#af9147d31ffc11d62fc187bde283ed14f',1,'vk_mem_alloc.h']]], + ['vmasetcurrentframeindex_58',['vmaSetCurrentFrameIndex',['../vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]], + ['vmasetpoolname_59',['vmaSetPoolName',['../vk__mem__alloc_8h.html#adbae3a0b4ab078024462fc85c37f3b58',1,'vk_mem_alloc.h']]], + ['vmasetvirtualallocationuserdata_60',['vmaSetVirtualAllocationUserData',['../vk__mem__alloc_8h.html#a4b96f835d38686df937e097a0c7db5e9',1,'vk_mem_alloc.h']]], + ['vmatouchallocation_61',['vmaTouchAllocation',['../vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a',1,'vk_mem_alloc.h']]], + ['vmaunmapmemory_62',['vmaUnmapMemory',['../vk__mem__alloc_8h.html#a9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]], + ['vmavirtualallocate_63',['vmaVirtualAllocate',['../vk__mem__alloc_8h.html#a1c15925e6745dacee0cfc877fffecec2',1,'vk_mem_alloc.h']]], + ['vmavirtualfree_64',['vmaVirtualFree',['../vk__mem__alloc_8h.html#a13f01c44b3c1a06e695f1f5d24b80639',1,'vk_mem_alloc.h']]] ]; diff --git a/docs/html/virtual_allocator.html b/docs/html/virtual_allocator.html index 4dd43da..0e82f04 100644 --- a/docs/html/virtual_allocator.html +++ b/docs/html/virtual_allocator.html @@ -83,8 +83,8 @@ Creating virtual block
    VkResult res = vmaCreateVirtualBlock(&blockCreateInfo, &block);
    -
    Parameters of created VmaVirtualBlock object to be passed to vmaCreateVirtualBlock().
    Definition: vk_mem_alloc.h:2191
    -
    VkDeviceSize size
    Total size of the virtual block.
    Definition: vk_mem_alloc.h:2197
    +
    Parameters of created VmaVirtualBlock object to be passed to vmaCreateVirtualBlock().
    Definition: vk_mem_alloc.h:2202
    +
    VkDeviceSize size
    Total size of the virtual block.
    Definition: vk_mem_alloc.h:2208
    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

    {
    // Allocation failed - no space for it could be found. Handle this error!
    }
    -
    Parameters of created virtual allocation to be passed to vmaVirtualAllocate().
    Definition: vk_mem_alloc.h:2239
    -
    VkDeviceSize size
    Size of the allocation.
    Definition: vk_mem_alloc.h:2244
    +
    Parameters of created virtual allocation to be passed to vmaVirtualAllocate().
    Definition: vk_mem_alloc.h:2250
    +
    VkDeviceSize size
    Size of the allocation.
    Definition: vk_mem_alloc.h:2255
    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;
    vmaVirtualFree(block, allocOffset);
    -
    Parameters of an existing virtual allocation, returned by vmaGetVirtualAllocationInfo().
    Definition: vk_mem_alloc.h:2262
    -
    void * pUserData
    Custom pointer associated with the allocation.
    Definition: vk_mem_alloc.h:2272
    +
    Parameters of an existing virtual allocation, returned by vmaGetVirtualAllocationInfo().
    Definition: vk_mem_alloc.h:2273
    +
    void * pUserData
    Custom pointer associated with the allocation.
    Definition: vk_mem_alloc.h:2283
    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;
    res = vmaVirtualAllocate(block, &allocCreateInfo, &allocOffset);
    -
    VkDeviceSize alignment
    Required alignment of the allocation. Optional.
    Definition: vk_mem_alloc.h:2249
    +
    VkDeviceSize alignment
    Required alignment of the allocation. Optional.
    Definition: vk_mem_alloc.h:2260

    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:

    + + + +

    ◆ vmaGetAllocationMemoryProperties()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    void vmaGetAllocationMemoryProperties (VmaAllocator allocator,
    VmaAllocation allocation,
    VkMemoryPropertyFlags * pFlags 
    )
    +
    + +

    Given an allocation, returns Property Flags of its memory type.

    +

    This is just a convenience function. Same information can be obtained using vmaGetAllocationInfo() + vmaGetMemoryProperties().

    +
    diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h index 2967c58..818e204 100644 --- a/include/vk_mem_alloc.h +++ b/include/vk_mem_alloc.h @@ -1571,6 +1571,17 @@ VMA_CALL_PRE void VMA_CALL_POST vmaCreateLostAllocation( VmaAllocator VMA_NOT_NULL allocator, VmaAllocation VMA_NULLABLE * VMA_NOT_NULL pAllocation); +/** +\brief Given an allocation, returns Property Flags of its memory type. + +This is just a convenience function. Same information can be obtained using +vmaGetAllocationInfo() + vmaGetMemoryProperties(). +*/ +VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocationMemoryProperties( + VmaAllocator VMA_NOT_NULL allocator, + VmaAllocation VMA_NOT_NULL allocation, + VkMemoryPropertyFlags* VMA_NOT_NULL pFlags); + /** \brief Maps memory represented by given allocation and returns pointer to it. Maps memory represented by given allocation to make it accessible to CPU code. @@ -17665,6 +17676,16 @@ VMA_CALL_PRE void VMA_CALL_POST vmaCreateLostAllocation( #endif } +VMA_CALL_PRE void VMA_CALL_POST vmaGetAllocationMemoryProperties( + VmaAllocator VMA_NOT_NULL allocator, + VmaAllocation VMA_NOT_NULL allocation, + VkMemoryPropertyFlags* VMA_NOT_NULL pFlags) +{ + VMA_ASSERT(allocator && allocation && pFlags); + const uint32_t memTypeIndex = allocation->GetMemoryTypeIndex(); + *pFlags = allocator->m_MemProps.memoryTypes[memTypeIndex].propertyFlags; +} + VMA_CALL_PRE VkResult VMA_CALL_POST vmaMapMemory( VmaAllocator allocator, VmaAllocation allocation, @@ -18893,8 +18914,8 @@ allocation from video memory might have failed, so the library chose system memo You can detect this case and map such allocation to access its memory on CPU directly, instead of launching a transfer operation. -In order to do that: inspect `allocInfo.memoryType`, call vmaGetMemoryTypeProperties(), -and look for `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` flag in properties of that memory type. +In order to do that: call vmaGetAllocationMemoryProperties() +and look for `VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT` flag. \code VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO }; @@ -18907,11 +18928,10 @@ allocCreateInfo.preferredFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; VkBuffer buf; VmaAllocation alloc; -VmaAllocationInfo allocInfo; -vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, &allocInfo); +vmaCreateBuffer(allocator, &bufCreateInfo, &allocCreateInfo, &buf, &alloc, nullptr); VkMemoryPropertyFlags memFlags; -vmaGetMemoryTypeProperties(allocator, allocInfo.memoryType, &memFlags); +vmaGetAllocationMemoryProperties(allocator, alloc, &memFlags); if((memFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0) { // Allocation ended up in mappable memory. You can map it and access it directly.