mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-21 20:00:11 +00:00
Add functions vmaBindBufferMemory2, vmaBindImageMemory2, flag VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT
This change adds usage of VK_KHR_bind_memory2 extension. Also add structure members VmaVulkanFunctions::vkBindBufferMemory2KHR, vkBindImageMemory2KHR.
This commit is contained in:
parent
1f84f62a85
commit
4abe30c1ae
@ -271,7 +271,7 @@ An ordered sequence of values of some type, separated by single space.
|
||||
# Example file
|
||||
|
||||
Vulkan Memory Allocator,Calls recording
|
||||
1,5
|
||||
1,6
|
||||
Config,Begin
|
||||
PhysicalDevice,apiVersion,4198477
|
||||
PhysicalDevice,driverVersion,8388653
|
||||
@ -299,6 +299,7 @@ An ordered sequence of values of some type, separated by single space.
|
||||
PhysicalDeviceMemory,Type,3,heapIndex,1
|
||||
PhysicalDeviceMemory,Type,3,propertyFlags,14
|
||||
Extension,VK_KHR_dedicated_allocation,1
|
||||
Extension,VK_KHR_bind_memory2,1
|
||||
Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,0
|
||||
Macro,VMA_DEBUG_ALIGNMENT,1
|
||||
Macro,VMA_DEBUG_MARGIN,0
|
||||
|
@ -73,7 +73,7 @@ $(function() {
|
||||
<ol type="1">
|
||||
<li>If you just want to find memory type index that meets your requirements, you can use function: <a class="el" href="vk__mem__alloc_8h.html#aef15a94b58fbcb0fe706d5720e84a74a" title="Helps to find memoryTypeIndex, given memoryTypeBits and VmaAllocationCreateInfo.">vmaFindMemoryTypeIndex()</a>, <a class="el" href="vk__mem__alloc_8h.html#ae790ab9ffaf7667fb8f62523e6897888" title="Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.">vmaFindMemoryTypeIndexForBufferInfo()</a>, <a class="el" href="vk__mem__alloc_8h.html#a088da83d8eaf3ce9056d9ea0b981d472" title="Helps to find memoryTypeIndex, given VkImageCreateInfo and VmaAllocationCreateInfo.">vmaFindMemoryTypeIndexForImageInfo()</a>.</li>
|
||||
<li>If you want to allocate a region of device memory without association with any specific image or buffer, you can use function <a class="el" href="vk__mem__alloc_8h.html#abf28077dbf82d0908b8acbe8ee8dd9b8" title="General purpose memory allocation.">vmaAllocateMemory()</a>. Usage of this function is not recommended and usually not needed. <a class="el" href="vk__mem__alloc_8h.html#ad37e82e492b3de38fc3f4cffd9ad0ae1" title="General purpose memory allocation for multiple allocation objects at once.">vmaAllocateMemoryPages()</a> function is also provided for creating multiple allocations at once, which may be useful for sparse binding.</li>
|
||||
<li>If you already have a buffer or an image created, you want to allocate memory for it and then you will bind it yourself, you can use function <a class="el" href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer()</a>, <a class="el" href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb" title="Function similar to vmaAllocateMemoryForBuffer().">vmaAllocateMemoryForImage()</a>. For binding you should use functions: <a class="el" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470" title="Binds buffer to allocation.">vmaBindBufferMemory()</a>, <a class="el" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5" title="Binds image to allocation.">vmaBindImageMemory()</a>.</li>
|
||||
<li>If you already have a buffer or an image created, you want to allocate memory for it and then you will bind it yourself, you can use function <a class="el" href="vk__mem__alloc_8h.html#a7fdf64415b6c3d83c454f28d2c53df7b">vmaAllocateMemoryForBuffer()</a>, <a class="el" href="vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb" title="Function similar to vmaAllocateMemoryForBuffer().">vmaAllocateMemoryForImage()</a>. For binding you should use functions: <a class="el" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470" title="Binds buffer to allocation.">vmaBindBufferMemory()</a>, <a class="el" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5" title="Binds image to allocation.">vmaBindImageMemory()</a> or their extended versions: <a class="el" href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a" title="Binds buffer to allocation with additional parameters.">vmaBindBufferMemory2()</a>, <a class="el" href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc" title="Binds image to allocation with additional parameters.">vmaBindImageMemory2()</a>.</li>
|
||||
<li>If you want to create a buffer or an image, allocate memory for it and bind them together, all in one call, you can use function <a class="el" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer()</a>, <a class="el" href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73" title="Function similar to vmaCreateBuffer().">vmaCreateImage()</a>. This is the easiest and recommended way to use this library.</li>
|
||||
</ol>
|
||||
<p>When using 3. or 4., the library internally queries Vulkan for memory types supported for that buffer or image (function <code>vkGetBufferMemoryRequirements()</code>) and uses only one of these types.</p>
|
||||
|
@ -135,9 +135,15 @@ $(function() {
|
||||
<li>VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>VMA_BIND_MEMORY2
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>VMA_DEDICATED_ALLOCATION
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
@ -225,9 +231,15 @@ $(function() {
|
||||
<li>vmaBindBufferMemory()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaBindBufferMemory2()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaBindImageMemory()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaBindImageMemory2()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaBuildStatsString()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
@ -343,7 +355,7 @@ $(function() {
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cc">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>VmaPoolCreateFlagBits
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7">vk_mem_alloc.h</a>
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a8f93195158e0e2ac80ca352064e71c1f">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>VmaPoolCreateFlags
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a2770e325ea42e087c1b91fdf46d0292a">vk_mem_alloc.h</a>
|
||||
|
@ -65,6 +65,9 @@ $(function() {
|
||||
<li>NOMINMAX
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a9f918755b601cf4bffca775992e6fb90">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>VMA_BIND_MEMORY2
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>VMA_DEDICATED_ALLOCATION
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
|
@ -118,6 +118,9 @@ $(function() {
|
||||
<li>VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
|
@ -79,9 +79,15 @@ $(function() {
|
||||
<li>vmaBindBufferMemory()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaBindBufferMemory2()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaBindImageMemory()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaBindImageMemory2()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
<li>vmaBuildStatsString()
|
||||
: <a class="el" href="vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0">vk_mem_alloc.h</a>
|
||||
</li>
|
||||
|
@ -38,7 +38,9 @@ var searchData=
|
||||
['vma_5fallocation_5fcreate_5fuser_5fdata_5fcopy_5fstring_5fbit',['VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fallocator_5fcreate_5fexternally_5fsynchronized_5fbit',['VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fallocator_5fcreate_5fflag_5fbits_5fmax_5fenum',['VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fallocator_5fcreate_5fkhr_5fbind_5fmemory2_5fbit',['VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fallocator_5fcreate_5fkhr_5fdedicated_5fallocation_5fbit',['VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fbind_5fmemory2',['VMA_BIND_MEMORY2',['../vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fdedicated_5fallocation',['VMA_DEDICATED_ALLOCATION',['../vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fdefragmentation_5fflag_5fbits_5fmax_5fenum',['VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fmemory_5fusage_5fcpu_5fonly',['VMA_MEMORY_USAGE_CPU_ONLY',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5',1,'vk_mem_alloc.h']]],
|
||||
@ -70,7 +72,9 @@ var searchData=
|
||||
['vmaallocatorcreateflags',['VmaAllocatorCreateFlags',['../vk__mem__alloc_8h.html#acfe6863e160722c2c1bbcf7573fddc4d',1,'vk_mem_alloc.h']]],
|
||||
['vmaallocatorcreateinfo',['VmaAllocatorCreateInfo',['../struct_vma_allocator_create_info.html',1,'VmaAllocatorCreateInfo'],['../vk__mem__alloc_8h.html#ae0f6d1d733dded220d28134da46b4283',1,'VmaAllocatorCreateInfo(): vk_mem_alloc.h']]],
|
||||
['vmabindbuffermemory',['vmaBindBufferMemory',['../vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470',1,'vk_mem_alloc.h']]],
|
||||
['vmabindbuffermemory2',['vmaBindBufferMemory2',['../vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a',1,'vk_mem_alloc.h']]],
|
||||
['vmabindimagememory',['vmaBindImageMemory',['../vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5',1,'vk_mem_alloc.h']]],
|
||||
['vmabindimagememory2',['vmaBindImageMemory2',['../vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc',1,'vk_mem_alloc.h']]],
|
||||
['vmabuildstatsstring',['vmaBuildStatsString',['../vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0',1,'vk_mem_alloc.h']]],
|
||||
['vmacalculatestats',['vmaCalculateStats',['../vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3',1,'vk_mem_alloc.h']]],
|
||||
['vmacheckcorruption',['vmaCheckCorruption',['../vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98',1,'vk_mem_alloc.h']]],
|
||||
|
@ -1,5 +1,6 @@
|
||||
var searchData=
|
||||
[
|
||||
['vma_5fbind_5fmemory2',['VMA_BIND_MEMORY2',['../vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fdedicated_5fallocation',['VMA_DEDICATED_ALLOCATION',['../vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4',1,'vk_mem_alloc.h']]],
|
||||
['vma_5frecording_5fenabled',['VMA_RECORDING_ENABLED',['../vk__mem__alloc_8h.html#a1f0c126759fc96ccb6e2d23c101d770c',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fstats_5fstring_5fenabled',['VMA_STATS_STRING_ENABLED',['../vk__mem__alloc_8h.html#ae25f0d55fd91cb166f002b63244800e1',1,'vk_mem_alloc.h']]]
|
||||
|
@ -18,6 +18,7 @@ var searchData=
|
||||
['vma_5fallocation_5fcreate_5fuser_5fdata_5fcopy_5fstring_5fbit',['VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT',['../vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fallocator_5fcreate_5fexternally_5fsynchronized_5fbit',['VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fallocator_5fcreate_5fflag_5fbits_5fmax_5fenum',['VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fallocator_5fcreate_5fkhr_5fbind_5fmemory2_5fbit',['VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fallocator_5fcreate_5fkhr_5fdedicated_5fallocation_5fbit',['VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT',['../vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fdefragmentation_5fflag_5fbits_5fmax_5fenum',['VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM',['../vk__mem__alloc_8h.html#a6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97',1,'vk_mem_alloc.h']]],
|
||||
['vma_5fmemory_5fusage_5fcpu_5fonly',['VMA_MEMORY_USAGE_CPU_ONLY',['../vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5',1,'vk_mem_alloc.h']]],
|
||||
|
@ -5,7 +5,9 @@ var searchData=
|
||||
['vmaallocatememoryforimage',['vmaAllocateMemoryForImage',['../vk__mem__alloc_8h.html#a0faa3f9e5fb233d29d1e00390650febb',1,'vk_mem_alloc.h']]],
|
||||
['vmaallocatememorypages',['vmaAllocateMemoryPages',['../vk__mem__alloc_8h.html#ad37e82e492b3de38fc3f4cffd9ad0ae1',1,'vk_mem_alloc.h']]],
|
||||
['vmabindbuffermemory',['vmaBindBufferMemory',['../vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470',1,'vk_mem_alloc.h']]],
|
||||
['vmabindbuffermemory2',['vmaBindBufferMemory2',['../vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a',1,'vk_mem_alloc.h']]],
|
||||
['vmabindimagememory',['vmaBindImageMemory',['../vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5',1,'vk_mem_alloc.h']]],
|
||||
['vmabindimagememory2',['vmaBindImageMemory2',['../vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc',1,'vk_mem_alloc.h']]],
|
||||
['vmabuildstatsstring',['vmaBuildStatsString',['../vk__mem__alloc_8h.html#aa4fee7eb5253377599ef4fd38c93c2a0',1,'vk_mem_alloc.h']]],
|
||||
['vmacalculatestats',['vmaCalculateStats',['../vk__mem__alloc_8h.html#a333b61c1788cb23559177531e6a93ca3',1,'vk_mem_alloc.h']]],
|
||||
['vmacheckcorruption',['vmaCheckCorruption',['../vk__mem__alloc_8h.html#a49329a7f030dafcf82f7b73334c22e98',1,'vk_mem_alloc.h']]],
|
||||
|
@ -124,6 +124,8 @@ Macros</h2></td></tr>
|
||||
<tr class="separator:a9f918755b601cf4bffca775992e6fb90"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:af7b860e63b96d11e44ae8587ba06bbf4"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4">VMA_DEDICATED_ALLOCATION</a>   0</td></tr>
|
||||
<tr class="separator:af7b860e63b96d11e44ae8587ba06bbf4"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a88bef97f86d70a34a4c0746e09a2680d"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d">VMA_BIND_MEMORY2</a>   0</td></tr>
|
||||
<tr class="separator:a88bef97f86d70a34a4c0746e09a2680d"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ae25f0d55fd91cb166f002b63244800e1"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#ae25f0d55fd91cb166f002b63244800e1">VMA_STATS_STRING_ENABLED</a>   1</td></tr>
|
||||
<tr class="separator:ae25f0d55fd91cb166f002b63244800e1"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
@ -205,6 +207,7 @@ Typedefs</h2></td></tr>
|
||||
Enumerations</h2></td></tr>
|
||||
<tr class="memitem:a4f87c9100d154a65a4ad495f7763cf7c"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">VmaAllocatorCreateFlagBits</a> { <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d">VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT</a> = 0x00000001,
|
||||
<a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878">VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT</a> = 0x00000002,
|
||||
<a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a> = 0x00000004,
|
||||
<a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c">VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM</a> = 0x7FFFFFFF
|
||||
}</td></tr>
|
||||
<tr class="memdesc:a4f87c9100d154a65a4ad495f7763cf7c"><td class="mdescLeft"> </td><td class="mdescRight">Flags for created <a class="el" href="struct_vma_allocator.html" title="Represents main object of this library initialized.">VmaAllocator</a>. <a href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7c">More...</a><br /></td></tr>
|
||||
@ -374,9 +377,15 @@ Functions</h2></td></tr>
|
||||
<tr class="memitem:a6b0929b914b60cf2d45cac4bf3547470"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470">vmaBindBufferMemory</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkBuffer buffer)</td></tr>
|
||||
<tr class="memdesc:a6b0929b914b60cf2d45cac4bf3547470"><td class="mdescLeft"> </td><td class="mdescRight">Binds buffer to allocation. <a href="#a6b0929b914b60cf2d45cac4bf3547470">More...</a><br /></td></tr>
|
||||
<tr class="separator:a6b0929b914b60cf2d45cac4bf3547470"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a927c944f45e0f2941182abb6f608e64a"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a">vmaBindBufferMemory2</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize allocationLocalOffset, VkBuffer buffer, const void *pNext)</td></tr>
|
||||
<tr class="memdesc:a927c944f45e0f2941182abb6f608e64a"><td class="mdescLeft"> </td><td class="mdescRight">Binds buffer to allocation with additional parameters. <a href="#a927c944f45e0f2941182abb6f608e64a">More...</a><br /></td></tr>
|
||||
<tr class="separator:a927c944f45e0f2941182abb6f608e64a"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a3d3ca45799923aa5d138e9e5f9eb2da5"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5">vmaBindImageMemory</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkImage image)</td></tr>
|
||||
<tr class="memdesc:a3d3ca45799923aa5d138e9e5f9eb2da5"><td class="mdescLeft"> </td><td class="mdescRight">Binds image to allocation. <a href="#a3d3ca45799923aa5d138e9e5f9eb2da5">More...</a><br /></td></tr>
|
||||
<tr class="separator:a3d3ca45799923aa5d138e9e5f9eb2da5"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa8251ee81b0045a443e35b8e8aa021bc"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc">vmaBindImageMemory2</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> allocation, VkDeviceSize allocationLocalOffset, VkImage image, const void *pNext)</td></tr>
|
||||
<tr class="memdesc:aa8251ee81b0045a443e35b8e8aa021bc"><td class="mdescLeft"> </td><td class="mdescRight">Binds image to allocation with additional parameters. <a href="#aa8251ee81b0045a443e35b8e8aa021bc">More...</a><br /></td></tr>
|
||||
<tr class="separator:aa8251ee81b0045a443e35b8e8aa021bc"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ac72ee55598617e8eecca384e746bab51"><td class="memItemLeft" align="right" valign="top">VkResult </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, const VkBufferCreateInfo *pBufferCreateInfo, const <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> *pAllocationCreateInfo, VkBuffer *pBuffer, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> *pAllocation, <a class="el" href="struct_vma_allocation_info.html">VmaAllocationInfo</a> *pAllocationInfo)</td></tr>
|
||||
<tr class="separator:ac72ee55598617e8eecca384e746bab51"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:a0d9f4e4ba5bf9aab1f1c746387753d77"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a> (<a class="el" href="struct_vma_allocator.html">VmaAllocator</a> allocator, VkBuffer buffer, <a class="el" href="struct_vma_allocation.html">VmaAllocation</a> allocation)</td></tr>
|
||||
@ -402,6 +411,20 @@ Functions</h2></td></tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a88bef97f86d70a34a4c0746e09a2680d"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a88bef97f86d70a34a4c0746e09a2680d">◆ </a></span>VMA_BIND_MEMORY2</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">#define VMA_BIND_MEMORY2   0</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="af7b860e63b96d11e44ae8587ba06bbf4"></a>
|
||||
@ -947,6 +970,10 @@ Functions</h2></td></tr>
|
||||
<p>vkBindBufferMemory(): Binding memory to buffer 0x2d but vkGetBufferMemoryRequirements() has not been called on that buffer. </p>
|
||||
</blockquote>
|
||||
</td></tr>
|
||||
<tr><td class="fieldname"><a id="a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee"></a>VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT </td><td class="fielddoc"><p>Enables usage of VK_KHR_bind_memory2 extension.</p>
|
||||
<p>You may set this flag only if you found out that this device extension is supported, you enabled it while creating Vulkan device passed as <a class="el" href="struct_vma_allocator_create_info.html#ad924ddd77b04039c88d0c09b0ffcd500" title="Vulkan device.">VmaAllocatorCreateInfo::device</a>, and you want it to be used internally by this library.</p>
|
||||
<p>The extension provides functions <code>vkBindBufferMemory2KHR</code> and <code>vkBindImageMemory2KHR</code>, which allow to pass a chain of <code>pNext</code> structures while binding. This flag is required if you use <code>pNext</code> parameter in <a class="el" href="vk__mem__alloc_8h.html#a927c944f45e0f2941182abb6f608e64a" title="Binds buffer to allocation with additional parameters.">vmaBindBufferMemory2()</a> or <a class="el" href="vk__mem__alloc_8h.html#aa8251ee81b0045a443e35b8e8aa021bc" title="Binds image to allocation with additional parameters.">vmaBindImageMemory2()</a>. </p>
|
||||
</td></tr>
|
||||
<tr><td class="fieldname"><a id="a4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c"></a>VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM </td><td class="fielddoc"></td></tr>
|
||||
</table>
|
||||
|
||||
@ -1333,6 +1360,63 @@ Functions</h2></td></tr>
|
||||
<p>Binds specified buffer to region of memory represented by specified allocation. Gets <code>VkDeviceMemory</code> handle and offset from the allocation. If you want to create a buffer, allocate memory for it and bind them together separately, you should use this function for binding instead of standard <code>vkBindBufferMemory()</code>, because it ensures proper synchronization so that when a <code>VkDeviceMemory</code> object is used by multiple allocations, calls to <code>vkBind*Memory()</code> or <code>vkMapMemory()</code> won't happen from multiple threads simultaneously (which is illegal in Vulkan).</p>
|
||||
<p>It is recommended to use function <a class="el" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer()</a> instead of this one. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a927c944f45e0f2941182abb6f608e64a"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a927c944f45e0f2941182abb6f608e64a">◆ </a></span>vmaBindBufferMemory2()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">VkResult vmaBindBufferMemory2 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_vma_allocator.html">VmaAllocator</a> </td>
|
||||
<td class="paramname"><em>allocator</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="struct_vma_allocation.html">VmaAllocation</a> </td>
|
||||
<td class="paramname"><em>allocation</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">VkDeviceSize </td>
|
||||
<td class="paramname"><em>allocationLocalOffset</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">VkBuffer </td>
|
||||
<td class="paramname"><em>buffer</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const void * </td>
|
||||
<td class="paramname"><em>pNext</em> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>)</td>
|
||||
<td></td><td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Binds buffer to allocation with additional parameters. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">allocationLocalOffset</td><td>Additional offset to be added while binding, relative to the beginnig of the <code>allocation</code>. Normally it should be 0. </td></tr>
|
||||
<tr><td class="paramname">pNext</td><td>A chain of structures to be attached to <code>VkBindBufferMemoryInfoKHR</code> structure used internally. Normally it should be null.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>This function is similar to <a class="el" href="vk__mem__alloc_8h.html#a6b0929b914b60cf2d45cac4bf3547470" title="Binds buffer to allocation.">vmaBindBufferMemory()</a>, but it provides additional parameters.</p>
|
||||
<p>If <code>pNext</code> is not null, <a class="el" href="struct_vma_allocator.html" title="Represents main object of this library initialized.">VmaAllocator</a> object must have been created with <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a> flag. Otherwise the call fails. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a3d3ca45799923aa5d138e9e5f9eb2da5"></a>
|
||||
@ -1371,6 +1455,63 @@ Functions</h2></td></tr>
|
||||
<p>Binds specified image to region of memory represented by specified allocation. Gets <code>VkDeviceMemory</code> handle and offset from the allocation. If you want to create an image, allocate memory for it and bind them together separately, you should use this function for binding instead of standard <code>vkBindImageMemory()</code>, because it ensures proper synchronization so that when a <code>VkDeviceMemory</code> object is used by multiple allocations, calls to <code>vkBind*Memory()</code> or <code>vkMapMemory()</code> won't happen from multiple threads simultaneously (which is illegal in Vulkan).</p>
|
||||
<p>It is recommended to use function <a class="el" href="vk__mem__alloc_8h.html#a02a94f25679275851a53e82eacbcfc73" title="Function similar to vmaCreateBuffer().">vmaCreateImage()</a> instead of this one. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aa8251ee81b0045a443e35b8e8aa021bc"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa8251ee81b0045a443e35b8e8aa021bc">◆ </a></span>vmaBindImageMemory2()</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">VkResult vmaBindImageMemory2 </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype"><a class="el" href="struct_vma_allocator.html">VmaAllocator</a> </td>
|
||||
<td class="paramname"><em>allocator</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype"><a class="el" href="struct_vma_allocation.html">VmaAllocation</a> </td>
|
||||
<td class="paramname"><em>allocation</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">VkDeviceSize </td>
|
||||
<td class="paramname"><em>allocationLocalOffset</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">VkImage </td>
|
||||
<td class="paramname"><em>image</em>, </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const void * </td>
|
||||
<td class="paramname"><em>pNext</em> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>)</td>
|
||||
<td></td><td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Binds image to allocation with additional parameters. </p>
|
||||
<dl class="params"><dt>Parameters</dt><dd>
|
||||
<table class="params">
|
||||
<tr><td class="paramname">allocationLocalOffset</td><td>Additional offset to be added while binding, relative to the beginnig of the <code>allocation</code>. Normally it should be 0. </td></tr>
|
||||
<tr><td class="paramname">pNext</td><td>A chain of structures to be attached to <code>VkBindImageMemoryInfoKHR</code> structure used internally. Normally it should be null.</td></tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>This function is similar to <a class="el" href="vk__mem__alloc_8h.html#a3d3ca45799923aa5d138e9e5f9eb2da5" title="Binds image to allocation.">vmaBindImageMemory()</a>, but it provides additional parameters.</p>
|
||||
<p>If <code>pNext</code> is not null, <a class="el" href="struct_vma_allocator.html" title="Represents main object of this library initialized.">VmaAllocator</a> object must have been created with <a class="el" href="vk__mem__alloc_8h.html#a4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee">VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT</a> flag. Otherwise the call fails. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aa4fee7eb5253377599ef4fd38c93c2a0"></a>
|
||||
|
File diff suppressed because one or more lines are too long
@ -47,6 +47,7 @@ bool g_MemoryAliasingWarningEnabled = true;
|
||||
static bool g_EnableValidationLayer = true;
|
||||
static bool VK_KHR_get_memory_requirements2_enabled = false;
|
||||
static bool VK_KHR_dedicated_allocation_enabled = false;
|
||||
static bool VK_KHR_bind_memory2_enabled = false;
|
||||
bool g_SparseBindingEnabled = false;
|
||||
|
||||
static HINSTANCE g_hAppInstance;
|
||||
@ -1276,6 +1277,11 @@ static void InitializeApplication()
|
||||
enabledDeviceExtensions.push_back(VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME);
|
||||
VK_KHR_dedicated_allocation_enabled = true;
|
||||
}
|
||||
else if(strcmp(properties[i].extensionName, VK_KHR_BIND_MEMORY_2_EXTENSION_NAME) == 0)
|
||||
{
|
||||
enabledDeviceExtensions.push_back(VK_KHR_BIND_MEMORY_2_EXTENSION_NAME);
|
||||
VK_KHR_bind_memory2_enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1312,6 +1318,10 @@ static void InitializeApplication()
|
||||
*/
|
||||
allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT;
|
||||
}
|
||||
if(VK_KHR_bind_memory2_enabled)
|
||||
{
|
||||
allocatorInfo.flags |= VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT;
|
||||
}
|
||||
|
||||
if(USE_CUSTOM_CPU_ALLOCATION_CALLBACKS)
|
||||
{
|
||||
|
@ -207,7 +207,8 @@ You can also combine multiple methods.
|
||||
-# If you already have a buffer or an image created, you want to allocate memory
|
||||
for it and then you will bind it yourself, you can use function
|
||||
vmaAllocateMemoryForBuffer(), vmaAllocateMemoryForImage().
|
||||
For binding you should use functions: vmaBindBufferMemory(), vmaBindImageMemory().
|
||||
For binding you should use functions: vmaBindBufferMemory(), vmaBindImageMemory()
|
||||
or their extended versions: vmaBindBufferMemory2(), vmaBindImageMemory2().
|
||||
-# If you want to create a buffer or an image, allocate memory for it and bind
|
||||
them together, all in one call, you can use function vmaCreateBuffer(),
|
||||
vmaCreateImage(). This is the easiest and recommended way to use this library.
|
||||
@ -1706,6 +1707,14 @@ available through VmaAllocatorCreateInfo::pRecordSettings.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(VMA_BIND_MEMORY2)
|
||||
#if VK_KHR_bind_memory2
|
||||
#define VMA_BIND_MEMORY2 1
|
||||
#else
|
||||
#define VMA_BIND_MEMORY2 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** \struct VmaAllocator
|
||||
\brief Represents main object of this library initialized.
|
||||
|
||||
@ -1767,12 +1776,24 @@ typedef enum VmaAllocatorCreateFlagBits {
|
||||
- VK_KHR_get_memory_requirements2
|
||||
- VK_KHR_dedicated_allocation
|
||||
|
||||
When this flag is set, you can experience following warnings reported by Vulkan
|
||||
validation layer. You can ignore them.
|
||||
When this flag is set, you can experience following warnings reported by Vulkan
|
||||
validation layer. You can ignore them.
|
||||
|
||||
> vkBindBufferMemory(): Binding memory to buffer 0x2d but vkGetBufferMemoryRequirements() has not been called on that buffer.
|
||||
> vkBindBufferMemory(): Binding memory to buffer 0x2d but vkGetBufferMemoryRequirements() has not been called on that buffer.
|
||||
*/
|
||||
VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT = 0x00000002,
|
||||
/**
|
||||
Enables usage of VK_KHR_bind_memory2 extension.
|
||||
|
||||
You may set this flag only if you found out that this device extension is supported,
|
||||
you enabled it while creating Vulkan device passed as VmaAllocatorCreateInfo::device,
|
||||
and you want it to be used internally by this library.
|
||||
|
||||
The extension provides functions `vkBindBufferMemory2KHR` and `vkBindImageMemory2KHR`,
|
||||
which allow to pass a chain of `pNext` structures while binding.
|
||||
This flag is required if you use `pNext` parameter in vmaBindBufferMemory2() or vmaBindImageMemory2().
|
||||
*/
|
||||
VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT = 0x00000004,
|
||||
|
||||
VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||
} VmaAllocatorCreateFlagBits;
|
||||
@ -1804,6 +1825,10 @@ typedef struct VmaVulkanFunctions {
|
||||
PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR;
|
||||
PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR;
|
||||
#endif
|
||||
#if VMA_BIND_MEMORY2
|
||||
PFN_vkBindBufferMemory2KHR vkBindBufferMemory2KHR;
|
||||
PFN_vkBindImageMemory2KHR vkBindImageMemory2KHR;
|
||||
#endif
|
||||
} VmaVulkanFunctions;
|
||||
|
||||
/// Flags to be used in VmaRecordSettings::flags.
|
||||
@ -3040,6 +3065,23 @@ VkResult vmaBindBufferMemory(
|
||||
VmaAllocation allocation,
|
||||
VkBuffer buffer);
|
||||
|
||||
/** \brief Binds buffer to allocation with additional parameters.
|
||||
|
||||
@param allocationLocalOffset Additional offset to be added while binding, relative to the beginnig of the `allocation`. Normally it should be 0.
|
||||
@param pNext A chain of structures to be attached to `VkBindBufferMemoryInfoKHR` structure used internally. Normally it should be null.
|
||||
|
||||
This function is similar to vmaBindBufferMemory(), but it provides additional parameters.
|
||||
|
||||
If `pNext` is not null, #VmaAllocator object must have been created with #VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT flag.
|
||||
Otherwise the call fails.
|
||||
*/
|
||||
VkResult vmaBindBufferMemory2(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkBuffer buffer,
|
||||
const void* pNext);
|
||||
|
||||
/** \brief Binds image to allocation.
|
||||
|
||||
Binds specified image to region of memory represented by specified allocation.
|
||||
@ -3057,6 +3099,23 @@ VkResult vmaBindImageMemory(
|
||||
VmaAllocation allocation,
|
||||
VkImage image);
|
||||
|
||||
/** \brief Binds image to allocation with additional parameters.
|
||||
|
||||
@param allocationLocalOffset Additional offset to be added while binding, relative to the beginnig of the `allocation`. Normally it should be 0.
|
||||
@param pNext A chain of structures to be attached to `VkBindImageMemoryInfoKHR` structure used internally. Normally it should be null.
|
||||
|
||||
This function is similar to vmaBindImageMemory(), but it provides additional parameters.
|
||||
|
||||
If `pNext` is not null, #VmaAllocator object must have been created with #VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT flag.
|
||||
Otherwise the call fails.
|
||||
*/
|
||||
VkResult vmaBindImageMemory2(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkImage image,
|
||||
const void* pNext);
|
||||
|
||||
/**
|
||||
@param[out] pBuffer Buffer that was created.
|
||||
@param[out] pAllocation Allocation that was created.
|
||||
@ -5847,11 +5906,15 @@ public:
|
||||
VkResult BindBufferMemory(
|
||||
const VmaAllocator hAllocator,
|
||||
const VmaAllocation hAllocation,
|
||||
VkBuffer hBuffer);
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkBuffer hBuffer,
|
||||
const void* pNext);
|
||||
VkResult BindImageMemory(
|
||||
const VmaAllocator hAllocator,
|
||||
const VmaAllocation hAllocation,
|
||||
VkImage hImage);
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkImage hImage,
|
||||
const void* pNext);
|
||||
|
||||
private:
|
||||
VmaPool m_hParentPool; // VK_NULL_HANDLE if not belongs to custom pool.
|
||||
@ -6500,7 +6563,8 @@ public:
|
||||
void WriteConfiguration(
|
||||
const VkPhysicalDeviceProperties& devProps,
|
||||
const VkPhysicalDeviceMemoryProperties& memProps,
|
||||
bool dedicatedAllocationExtensionEnabled);
|
||||
bool dedicatedAllocationExtensionEnabled,
|
||||
bool bindMemory2ExtensionEnabled);
|
||||
~VmaRecorder();
|
||||
|
||||
void RecordCreateAllocator(uint32_t frameIndex);
|
||||
@ -6643,6 +6707,7 @@ struct VmaAllocator_T
|
||||
public:
|
||||
bool m_UseMutex;
|
||||
bool m_UseKhrDedicatedAllocation;
|
||||
bool m_UseKhrBindMemory2;
|
||||
VkDevice m_hDevice;
|
||||
bool m_AllocationCallbacksSpecified;
|
||||
VkAllocationCallbacks m_AllocationCallbacks;
|
||||
@ -6778,14 +6843,36 @@ public:
|
||||
|
||||
void CreateLostAllocation(VmaAllocation* pAllocation);
|
||||
|
||||
// Call to Vulkan function vkAllocateMemory with accompanying bookkeeping.
|
||||
VkResult AllocateVulkanMemory(const VkMemoryAllocateInfo* pAllocateInfo, VkDeviceMemory* pMemory);
|
||||
// Call to Vulkan function vkFreeMemory with accompanying bookkeeping.
|
||||
void FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, VkDeviceMemory hMemory);
|
||||
// Call to Vulkan function vkBindBufferMemory or vkBindBufferMemory2KHR.
|
||||
VkResult BindVulkanBuffer(
|
||||
VkDeviceMemory memory,
|
||||
VkDeviceSize memoryOffset,
|
||||
VkBuffer buffer,
|
||||
const void* pNext);
|
||||
// Call to Vulkan function vkBindImageMemory or vkBindImageMemory2KHR.
|
||||
VkResult BindVulkanImage(
|
||||
VkDeviceMemory memory,
|
||||
VkDeviceSize memoryOffset,
|
||||
VkImage image,
|
||||
const void* pNext);
|
||||
|
||||
VkResult Map(VmaAllocation hAllocation, void** ppData);
|
||||
void Unmap(VmaAllocation hAllocation);
|
||||
|
||||
VkResult BindBufferMemory(VmaAllocation hAllocation, VkBuffer hBuffer);
|
||||
VkResult BindImageMemory(VmaAllocation hAllocation, VkImage hImage);
|
||||
VkResult BindBufferMemory(
|
||||
VmaAllocation hAllocation,
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkBuffer hBuffer,
|
||||
const void* pNext);
|
||||
VkResult BindImageMemory(
|
||||
VmaAllocation hAllocation,
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkImage hImage,
|
||||
const void* pNext);
|
||||
|
||||
void FlushOrInvalidateAllocation(
|
||||
VmaAllocation hAllocation,
|
||||
@ -11213,33 +11300,35 @@ VkResult VmaDeviceMemoryBlock::ValidateMagicValueAroundAllocation(VmaAllocator h
|
||||
VkResult VmaDeviceMemoryBlock::BindBufferMemory(
|
||||
const VmaAllocator hAllocator,
|
||||
const VmaAllocation hAllocation,
|
||||
VkBuffer hBuffer)
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkBuffer hBuffer,
|
||||
const void* pNext)
|
||||
{
|
||||
VMA_ASSERT(hAllocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK &&
|
||||
hAllocation->GetBlock() == this);
|
||||
VMA_ASSERT(allocationLocalOffset < hAllocation->GetSize() &&
|
||||
"Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?");
|
||||
const VkDeviceSize memoryOffset = hAllocation->GetOffset() + allocationLocalOffset;
|
||||
// This lock is important so that we don't call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads.
|
||||
VmaMutexLock lock(m_Mutex, hAllocator->m_UseMutex);
|
||||
return hAllocator->GetVulkanFunctions().vkBindBufferMemory(
|
||||
hAllocator->m_hDevice,
|
||||
hBuffer,
|
||||
m_hMemory,
|
||||
hAllocation->GetOffset());
|
||||
return hAllocator->BindVulkanBuffer(m_hMemory, memoryOffset, hBuffer, pNext);
|
||||
}
|
||||
|
||||
VkResult VmaDeviceMemoryBlock::BindImageMemory(
|
||||
const VmaAllocator hAllocator,
|
||||
const VmaAllocation hAllocation,
|
||||
VkImage hImage)
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkImage hImage,
|
||||
const void* pNext)
|
||||
{
|
||||
VMA_ASSERT(hAllocation->GetType() == VmaAllocation_T::ALLOCATION_TYPE_BLOCK &&
|
||||
hAllocation->GetBlock() == this);
|
||||
VMA_ASSERT(allocationLocalOffset < hAllocation->GetSize() &&
|
||||
"Invalid allocationLocalOffset. Did you forget that this offset is relative to the beginning of the allocation, not the whole memory block?");
|
||||
const VkDeviceSize memoryOffset = hAllocation->GetOffset() + allocationLocalOffset;
|
||||
// This lock is important so that we don't call vkBind... and/or vkMap... simultaneously on the same VkDeviceMemory from multiple threads.
|
||||
VmaMutexLock lock(m_Mutex, hAllocator->m_UseMutex);
|
||||
return hAllocator->GetVulkanFunctions().vkBindImageMemory(
|
||||
hAllocator->m_hDevice,
|
||||
hImage,
|
||||
m_hMemory,
|
||||
hAllocation->GetOffset());
|
||||
return hAllocator->BindVulkanImage(m_hMemory, memoryOffset, hImage, pNext);
|
||||
}
|
||||
|
||||
static void InitStatInfo(VmaStatInfo& outInfo)
|
||||
@ -13931,7 +14020,8 @@ VmaRecorder::UserDataString::UserDataString(VmaAllocationCreateFlags allocFlags,
|
||||
void VmaRecorder::WriteConfiguration(
|
||||
const VkPhysicalDeviceProperties& devProps,
|
||||
const VkPhysicalDeviceMemoryProperties& memProps,
|
||||
bool dedicatedAllocationExtensionEnabled)
|
||||
bool dedicatedAllocationExtensionEnabled,
|
||||
bool bindMemory2ExtensionEnabled)
|
||||
{
|
||||
fprintf(m_File, "Config,Begin\n");
|
||||
|
||||
@ -13960,6 +14050,7 @@ void VmaRecorder::WriteConfiguration(
|
||||
}
|
||||
|
||||
fprintf(m_File, "Extension,VK_KHR_dedicated_allocation,%u\n", dedicatedAllocationExtensionEnabled ? 1 : 0);
|
||||
fprintf(m_File, "Extension,VK_KHR_bind_memory2,%u\n", bindMemory2ExtensionEnabled ? 1 : 0);
|
||||
|
||||
fprintf(m_File, "Macro,VMA_DEBUG_ALWAYS_DEDICATED_MEMORY,%u\n", VMA_DEBUG_ALWAYS_DEDICATED_MEMORY ? 1 : 0);
|
||||
fprintf(m_File, "Macro,VMA_DEBUG_ALIGNMENT,%llu\n", (VkDeviceSize)VMA_DEBUG_ALIGNMENT);
|
||||
@ -14031,6 +14122,7 @@ void VmaAllocationObjectAllocator::Free(VmaAllocation hAlloc)
|
||||
VmaAllocator_T::VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo) :
|
||||
m_UseMutex((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT) == 0),
|
||||
m_UseKhrDedicatedAllocation((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT) != 0),
|
||||
m_UseKhrBindMemory2((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT) != 0),
|
||||
m_hDevice(pCreateInfo->device),
|
||||
m_AllocationCallbacksSpecified(pCreateInfo->pAllocationCallbacks != VMA_NULL),
|
||||
m_AllocationCallbacks(pCreateInfo->pAllocationCallbacks ?
|
||||
@ -14060,6 +14152,12 @@ VmaAllocator_T::VmaAllocator_T(const VmaAllocatorCreateInfo* pCreateInfo) :
|
||||
VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT set but required extensions are disabled by preprocessor macros.");
|
||||
}
|
||||
#endif
|
||||
#if !(VMA_BIND_MEMORY2)
|
||||
if((pCreateInfo->flags & VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT) != 0)
|
||||
{
|
||||
VMA_ASSERT(0 && "VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT set but required extension is disabled by preprocessor macros.");
|
||||
}
|
||||
#endif
|
||||
|
||||
memset(&m_DeviceMemoryCallbacks, 0 ,sizeof(m_DeviceMemoryCallbacks));
|
||||
memset(&m_PhysicalDeviceProperties, 0, sizeof(m_PhysicalDeviceProperties));
|
||||
@ -14148,7 +14246,8 @@ VkResult VmaAllocator_T::Init(const VmaAllocatorCreateInfo* pCreateInfo)
|
||||
m_pRecorder->WriteConfiguration(
|
||||
m_PhysicalDeviceProperties,
|
||||
m_MemProps,
|
||||
m_UseKhrDedicatedAllocation);
|
||||
m_UseKhrDedicatedAllocation,
|
||||
m_UseKhrBindMemory2);
|
||||
m_pRecorder->RecordCreateAllocator(GetCurrentFrameIndex());
|
||||
#else
|
||||
VMA_ASSERT(0 && "VmaAllocatorCreateInfo::pRecordSettings used, but not supported due to VMA_RECORDING_ENABLED not defined to 1.");
|
||||
@ -14212,6 +14311,15 @@ void VmaAllocator_T::ImportVulkanFunctions(const VmaVulkanFunctions* pVulkanFunc
|
||||
(PFN_vkGetImageMemoryRequirements2KHR)vkGetDeviceProcAddr(m_hDevice, "vkGetImageMemoryRequirements2KHR");
|
||||
}
|
||||
#endif // #if VMA_DEDICATED_ALLOCATION
|
||||
#if VMA_BIND_MEMORY2
|
||||
if(m_UseKhrBindMemory2)
|
||||
{
|
||||
m_VulkanFunctions.vkBindBufferMemory2KHR =
|
||||
(PFN_vkBindBufferMemory2KHR)vkGetDeviceProcAddr(m_hDevice, "vkBindBufferMemory2KHR");
|
||||
m_VulkanFunctions.vkBindImageMemory2KHR =
|
||||
(PFN_vkBindImageMemory2KHR)vkGetDeviceProcAddr(m_hDevice, "vkBindImageMemory2KHR");
|
||||
}
|
||||
#endif // #if VMA_BIND_MEMORY2
|
||||
#endif // #if VMA_STATIC_VULKAN_FUNCTIONS == 1
|
||||
|
||||
#define VMA_COPY_IF_NOT_NULL(funcName) \
|
||||
@ -14239,6 +14347,10 @@ void VmaAllocator_T::ImportVulkanFunctions(const VmaVulkanFunctions* pVulkanFunc
|
||||
#if VMA_DEDICATED_ALLOCATION
|
||||
VMA_COPY_IF_NOT_NULL(vkGetBufferMemoryRequirements2KHR);
|
||||
VMA_COPY_IF_NOT_NULL(vkGetImageMemoryRequirements2KHR);
|
||||
#endif
|
||||
#if VMA_BIND_MEMORY2
|
||||
VMA_COPY_IF_NOT_NULL(vkBindBufferMemory2KHR);
|
||||
VMA_COPY_IF_NOT_NULL(vkBindImageMemory2KHR);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -14270,6 +14382,13 @@ void VmaAllocator_T::ImportVulkanFunctions(const VmaVulkanFunctions* pVulkanFunc
|
||||
VMA_ASSERT(m_VulkanFunctions.vkGetImageMemoryRequirements2KHR != VMA_NULL);
|
||||
}
|
||||
#endif
|
||||
#if VMA_BIND_MEMORY2
|
||||
if(m_UseKhrBindMemory2)
|
||||
{
|
||||
VMA_ASSERT(m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL);
|
||||
VMA_ASSERT(m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
VkDeviceSize VmaAllocator_T::CalcPreferredBlockSize(uint32_t memTypeIndex)
|
||||
@ -15218,6 +15337,66 @@ void VmaAllocator_T::FreeVulkanMemory(uint32_t memoryType, VkDeviceSize size, Vk
|
||||
}
|
||||
}
|
||||
|
||||
VkResult VmaAllocator_T::BindVulkanBuffer(
|
||||
VkDeviceMemory memory,
|
||||
VkDeviceSize memoryOffset,
|
||||
VkBuffer buffer,
|
||||
const void* pNext)
|
||||
{
|
||||
if(pNext != VMA_NULL)
|
||||
{
|
||||
#if VMA_BIND_MEMORY2
|
||||
if(m_UseKhrBindMemory2 && m_VulkanFunctions.vkBindBufferMemory2KHR != VMA_NULL)
|
||||
{
|
||||
VkBindBufferMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR };
|
||||
bindBufferMemoryInfo.pNext = pNext;
|
||||
bindBufferMemoryInfo.buffer = buffer;
|
||||
bindBufferMemoryInfo.memory = memory;
|
||||
bindBufferMemoryInfo.memoryOffset = memoryOffset;
|
||||
return (*m_VulkanFunctions.vkBindBufferMemory2KHR)(m_hDevice, 1, &bindBufferMemoryInfo);
|
||||
}
|
||||
else
|
||||
#endif // #if VMA_BIND_MEMORY2
|
||||
{
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (*m_VulkanFunctions.vkBindBufferMemory)(m_hDevice, buffer, memory, memoryOffset);
|
||||
}
|
||||
}
|
||||
|
||||
VkResult VmaAllocator_T::BindVulkanImage(
|
||||
VkDeviceMemory memory,
|
||||
VkDeviceSize memoryOffset,
|
||||
VkImage image,
|
||||
const void* pNext)
|
||||
{
|
||||
if(pNext != VMA_NULL)
|
||||
{
|
||||
#if VMA_BIND_MEMORY2
|
||||
if(m_UseKhrBindMemory2 && m_VulkanFunctions.vkBindImageMemory2KHR != VMA_NULL)
|
||||
{
|
||||
VkBindImageMemoryInfoKHR bindBufferMemoryInfo = { VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR };
|
||||
bindBufferMemoryInfo.pNext = pNext;
|
||||
bindBufferMemoryInfo.image = image;
|
||||
bindBufferMemoryInfo.memory = memory;
|
||||
bindBufferMemoryInfo.memoryOffset = memoryOffset;
|
||||
return (*m_VulkanFunctions.vkBindImageMemory2KHR)(m_hDevice, 1, &bindBufferMemoryInfo);
|
||||
}
|
||||
else
|
||||
#endif // #if VMA_BIND_MEMORY2
|
||||
{
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return (*m_VulkanFunctions.vkBindImageMemory)(m_hDevice, image, memory, memoryOffset);
|
||||
}
|
||||
}
|
||||
|
||||
VkResult VmaAllocator_T::Map(VmaAllocation hAllocation, void** ppData)
|
||||
{
|
||||
if(hAllocation->CanBecomeLost())
|
||||
@ -15266,23 +15445,23 @@ void VmaAllocator_T::Unmap(VmaAllocation hAllocation)
|
||||
}
|
||||
}
|
||||
|
||||
VkResult VmaAllocator_T::BindBufferMemory(VmaAllocation hAllocation, VkBuffer hBuffer)
|
||||
VkResult VmaAllocator_T::BindBufferMemory(
|
||||
VmaAllocation hAllocation,
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkBuffer hBuffer,
|
||||
const void* pNext)
|
||||
{
|
||||
VkResult res = VK_SUCCESS;
|
||||
switch(hAllocation->GetType())
|
||||
{
|
||||
case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:
|
||||
res = GetVulkanFunctions().vkBindBufferMemory(
|
||||
m_hDevice,
|
||||
hBuffer,
|
||||
hAllocation->GetMemory(),
|
||||
0); //memoryOffset
|
||||
res = BindVulkanBuffer(hAllocation->GetMemory(), allocationLocalOffset, hBuffer, pNext);
|
||||
break;
|
||||
case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:
|
||||
{
|
||||
VmaDeviceMemoryBlock* pBlock = hAllocation->GetBlock();
|
||||
VmaDeviceMemoryBlock* const pBlock = hAllocation->GetBlock();
|
||||
VMA_ASSERT(pBlock && "Binding buffer to allocation that doesn't belong to any block. Is the allocation lost?");
|
||||
res = pBlock->BindBufferMemory(this, hAllocation, hBuffer);
|
||||
res = pBlock->BindBufferMemory(this, hAllocation, allocationLocalOffset, hBuffer, pNext);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -15291,23 +15470,23 @@ VkResult VmaAllocator_T::BindBufferMemory(VmaAllocation hAllocation, VkBuffer hB
|
||||
return res;
|
||||
}
|
||||
|
||||
VkResult VmaAllocator_T::BindImageMemory(VmaAllocation hAllocation, VkImage hImage)
|
||||
VkResult VmaAllocator_T::BindImageMemory(
|
||||
VmaAllocation hAllocation,
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkImage hImage,
|
||||
const void* pNext)
|
||||
{
|
||||
VkResult res = VK_SUCCESS;
|
||||
switch(hAllocation->GetType())
|
||||
{
|
||||
case VmaAllocation_T::ALLOCATION_TYPE_DEDICATED:
|
||||
res = GetVulkanFunctions().vkBindImageMemory(
|
||||
m_hDevice,
|
||||
hImage,
|
||||
hAllocation->GetMemory(),
|
||||
0); //memoryOffset
|
||||
res = BindVulkanImage(hAllocation->GetMemory(), allocationLocalOffset, hImage, pNext);
|
||||
break;
|
||||
case VmaAllocation_T::ALLOCATION_TYPE_BLOCK:
|
||||
{
|
||||
VmaDeviceMemoryBlock* pBlock = hAllocation->GetBlock();
|
||||
VMA_ASSERT(pBlock && "Binding image to allocation that doesn't belong to any block. Is the allocation lost?");
|
||||
res = pBlock->BindImageMemory(this, hAllocation, hImage);
|
||||
res = pBlock->BindImageMemory(this, hAllocation, allocationLocalOffset, hImage, pNext);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -16560,7 +16739,23 @@ VkResult vmaBindBufferMemory(
|
||||
|
||||
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
||||
|
||||
return allocator->BindBufferMemory(allocation, buffer);
|
||||
return allocator->BindBufferMemory(allocation, 0, buffer, VMA_NULL);
|
||||
}
|
||||
|
||||
VkResult vmaBindBufferMemory2(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkBuffer buffer,
|
||||
const void* pNext)
|
||||
{
|
||||
VMA_ASSERT(allocator && allocation && buffer);
|
||||
|
||||
VMA_DEBUG_LOG("vmaBindBufferMemory2");
|
||||
|
||||
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
||||
|
||||
return allocator->BindBufferMemory(allocation, allocationLocalOffset, buffer, pNext);
|
||||
}
|
||||
|
||||
VkResult vmaBindImageMemory(
|
||||
@ -16574,7 +16769,23 @@ VkResult vmaBindImageMemory(
|
||||
|
||||
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
||||
|
||||
return allocator->BindImageMemory(allocation, image);
|
||||
return allocator->BindImageMemory(allocation, 0, image, VMA_NULL);
|
||||
}
|
||||
|
||||
VkResult vmaBindImageMemory2(
|
||||
VmaAllocator allocator,
|
||||
VmaAllocation allocation,
|
||||
VkDeviceSize allocationLocalOffset,
|
||||
VkImage image,
|
||||
const void* pNext)
|
||||
{
|
||||
VMA_ASSERT(allocator && allocation && image);
|
||||
|
||||
VMA_DEBUG_LOG("vmaBindImageMemory2");
|
||||
|
||||
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
||||
|
||||
return allocator->BindImageMemory(allocation, allocationLocalOffset, image, pNext);
|
||||
}
|
||||
|
||||
VkResult vmaCreateBuffer(
|
||||
@ -16660,7 +16871,7 @@ VkResult vmaCreateBuffer(
|
||||
// 3. Bind buffer with memory.
|
||||
if((pAllocationCreateInfo->flags & VMA_ALLOCATION_CREATE_DONT_BIND_BIT) == 0)
|
||||
{
|
||||
res = allocator->BindBufferMemory(*pAllocation, *pBuffer);
|
||||
res = allocator->BindBufferMemory(*pAllocation, 0, *pBuffer, VMA_NULL);
|
||||
}
|
||||
if(res >= 0)
|
||||
{
|
||||
@ -16800,7 +17011,7 @@ VkResult vmaCreateImage(
|
||||
// 3. Bind image with memory.
|
||||
if((pAllocationCreateInfo->flags & VMA_ALLOCATION_CREATE_DONT_BIND_BIT) == 0)
|
||||
{
|
||||
res = allocator->BindImageMemory(*pAllocation, *pImage);
|
||||
res = allocator->BindImageMemory(*pAllocation, 0, *pImage, VMA_NULL);
|
||||
}
|
||||
if(res >= 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user