mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-29 09:54:35 +00:00
Fixed documentation about OpenGL interop
Added information about dedicated allocations now supported in custom pools.
This commit is contained in:
parent
0109967554
commit
fbb465c2bc
@ -74,13 +74,13 @@ $(function() {
|
|||||||
Exporting memory</h1>
|
Exporting memory</h1>
|
||||||
<p >If you want to attach <code>VkExportMemoryAllocateInfoKHR</code> structure to <code>pNext</code> chain of memory allocations made by the library:</p>
|
<p >If you want to attach <code>VkExportMemoryAllocateInfoKHR</code> structure to <code>pNext</code> chain of memory allocations made by the library:</p>
|
||||||
<p >It is recommended to create <a class="el" href="custom_memory_pools.html">Custom memory pools</a> for such allocations. Define and fill in your <code>VkExportMemoryAllocateInfoKHR</code> structure and attach it to <a class="el" href="struct_vma_pool_create_info.html#af0f8c58f51a2a7a0a389dc79565044d7" title="Additional pNext chain to be attached to VkMemoryAllocateInfo used for every allocation made by this ...">VmaPoolCreateInfo::pMemoryAllocateNext</a> while creating the custom pool. Please note that the structure must remain alive and unchanged for the whole lifetime of the <a class="el" href="struct_vma_pool.html" title="Represents custom memory pool.">VmaPool</a>, not only while creating it, as no copy of the structure is made, but its original pointer is used for each allocation instead.</p>
|
<p >It is recommended to create <a class="el" href="custom_memory_pools.html">Custom memory pools</a> for such allocations. Define and fill in your <code>VkExportMemoryAllocateInfoKHR</code> structure and attach it to <a class="el" href="struct_vma_pool_create_info.html#af0f8c58f51a2a7a0a389dc79565044d7" title="Additional pNext chain to be attached to VkMemoryAllocateInfo used for every allocation made by this ...">VmaPoolCreateInfo::pMemoryAllocateNext</a> while creating the custom pool. Please note that the structure must remain alive and unchanged for the whole lifetime of the <a class="el" href="struct_vma_pool.html" title="Represents custom memory pool.">VmaPool</a>, not only while creating it, as no copy of the structure is made, but its original pointer is used for each allocation instead.</p>
|
||||||
<p >If you want to export all memory allocated by the library from certain memory types, also dedicated allocations or other allocations made from default pools, an alternative solution is to fill in <a class="el" href="struct_vma_allocator_create_info.html#ae8f0db05e5cb4c43d7713bf4a49a736b" title="Either null or a pointer to an array of external memory handle types for each Vulkan memory type.">VmaAllocatorCreateInfo::pTypeExternalMemoryHandleTypes</a>. It should point to an array with <code>VkExternalMemoryHandleTypeFlagsKHR</code> to be automatically passed by the library through <code>VkExportMemoryAllocateInfoKHR</code> on each allocation made from a specific memory type. This is currently the only method to use if you need exported dedicated allocations, as they cannot be created out of custom pools. This will change in future versions of the library though.</p>
|
<p >If you want to export all memory allocated by the library from certain memory types, also dedicated allocations or other allocations made from default pools, an alternative solution is to fill in <a class="el" href="struct_vma_allocator_create_info.html#ae8f0db05e5cb4c43d7713bf4a49a736b" title="Either null or a pointer to an array of external memory handle types for each Vulkan memory type.">VmaAllocatorCreateInfo::pTypeExternalMemoryHandleTypes</a>. It should point to an array with <code>VkExternalMemoryHandleTypeFlagsKHR</code> to be automatically passed by the library through <code>VkExportMemoryAllocateInfoKHR</code> on each allocation made from a specific memory type. Please note that new versions of the library also support dedicated allocations created in custom pools.</p>
|
||||||
<p >You should not mix these two methods in a way that allows to apply both to the same memory type. Otherwise, <code>VkExportMemoryAllocateInfoKHR</code> structure would be attached twice to the <code>pNext</code> chain of <code>VkMemoryAllocateInfo</code>.</p>
|
<p >You should not mix these two methods in a way that allows to apply both to the same memory type. Otherwise, <code>VkExportMemoryAllocateInfoKHR</code> structure would be attached twice to the <code>pNext</code> chain of <code>VkMemoryAllocateInfo</code>.</p>
|
||||||
<h1><a class="anchor" id="opengl_interop_custom_alignment"></a>
|
<h1><a class="anchor" id="opengl_interop_custom_alignment"></a>
|
||||||
Custom alignment</h1>
|
Custom alignment</h1>
|
||||||
<p >Buffers or images exported to a different API like OpenGL may require a different alignment, higher than the one used by the library automatically, queried from functions like <code>vkGetBufferMemoryRequirements</code>. To impose such alignment:</p>
|
<p >Buffers or images exported to a different API like OpenGL may require a different alignment, higher than the one used by the library automatically, queried from functions like <code>vkGetBufferMemoryRequirements</code>. To impose such alignment:</p>
|
||||||
<p >It is recommended to create <a class="el" href="custom_memory_pools.html">Custom memory pools</a> for such allocations. Set <a class="el" href="struct_vma_pool_create_info.html#ade3eca546f0c6ab4e8fbf20eb6d854cb" title="Additional minimum alignment to be used for all allocations created from this pool....">VmaPoolCreateInfo::minAllocationAlignment</a> member to the minimum alignment required for each allocation to be made out of this pool. The alignment actually used will be the maximum of this member and the alignment returned for the specific buffer or image from a function like <code>vkGetBufferMemoryRequirements</code>, which is called by VMA automatically.</p>
|
<p >It is recommended to create <a class="el" href="custom_memory_pools.html">Custom memory pools</a> for such allocations. Set <a class="el" href="struct_vma_pool_create_info.html#ade3eca546f0c6ab4e8fbf20eb6d854cb" title="Additional minimum alignment to be used for all allocations created from this pool....">VmaPoolCreateInfo::minAllocationAlignment</a> member to the minimum alignment required for each allocation to be made out of this pool. The alignment actually used will be the maximum of this member and the alignment returned for the specific buffer or image from a function like <code>vkGetBufferMemoryRequirements</code>, which is called by VMA automatically.</p>
|
||||||
<p >If you want to create a buffer with a specific minimum alignment out of default pools, use special function <a class="el" href="vk__mem__alloc_8h.html#aa06a690013a0d01e60894ac378083834" title="Creates a buffer with additional minimum alignment.">vmaCreateBufferWithAlignment()</a>, which takes additional parameter <code>minAlignment</code>. This is currently the only method to use if you need exported dedicated allocations, as they cannot be created out of custom pools. This will change in future versions of the library though.</p>
|
<p >If you want to create a buffer with a specific minimum alignment out of default pools, use special function <a class="el" href="vk__mem__alloc_8h.html#aa06a690013a0d01e60894ac378083834" title="Creates a buffer with additional minimum alignment.">vmaCreateBufferWithAlignment()</a>, which takes additional parameter <code>minAlignment</code>.</p>
|
||||||
<p >Note the problem of alignment affects only resources placed inside bigger <code>VkDeviceMemory</code> blocks and not dedicated allocations, as these, by definition, always have alignment = 0 because the resource is bound to the beginning of its dedicated block. Contrary to Direct3D 12, Vulkan doesn't have a concept of alignment of the entire memory block passed on its allocation. </p>
|
<p >Note the problem of alignment affects only resources placed inside bigger <code>VkDeviceMemory</code> blocks and not dedicated allocations, as these, by definition, always have alignment = 0 because the resource is bound to the beginning of its dedicated block. Contrary to Direct3D 12, Vulkan doesn't have a concept of alignment of the entire memory block passed on its allocation. </p>
|
||||||
</div></div><!-- contents -->
|
</div></div><!-- contents -->
|
||||||
</div><!-- PageDoc -->
|
</div><!-- PageDoc -->
|
||||||
|
@ -20439,8 +20439,7 @@ also dedicated allocations or other allocations made from default pools,
|
|||||||
an alternative solution is to fill in VmaAllocatorCreateInfo::pTypeExternalMemoryHandleTypes.
|
an alternative solution is to fill in VmaAllocatorCreateInfo::pTypeExternalMemoryHandleTypes.
|
||||||
It should point to an array with `VkExternalMemoryHandleTypeFlagsKHR` to be automatically passed by the library
|
It should point to an array with `VkExternalMemoryHandleTypeFlagsKHR` to be automatically passed by the library
|
||||||
through `VkExportMemoryAllocateInfoKHR` on each allocation made from a specific memory type.
|
through `VkExportMemoryAllocateInfoKHR` on each allocation made from a specific memory type.
|
||||||
This is currently the only method to use if you need exported dedicated allocations, as they cannot be created out of custom pools.
|
Please note that new versions of the library also support dedicated allocations created in custom pools.
|
||||||
This will change in future versions of the library though.
|
|
||||||
|
|
||||||
You should not mix these two methods in a way that allows to apply both to the same memory type.
|
You should not mix these two methods in a way that allows to apply both to the same memory type.
|
||||||
Otherwise, `VkExportMemoryAllocateInfoKHR` structure would be attached twice to the `pNext` chain of `VkMemoryAllocateInfo`.
|
Otherwise, `VkExportMemoryAllocateInfoKHR` structure would be attached twice to the `pNext` chain of `VkMemoryAllocateInfo`.
|
||||||
@ -20460,8 +20459,6 @@ from a function like `vkGetBufferMemoryRequirements`, which is called by VMA aut
|
|||||||
|
|
||||||
If you want to create a buffer with a specific minimum alignment out of default pools,
|
If you want to create a buffer with a specific minimum alignment out of default pools,
|
||||||
use special function vmaCreateBufferWithAlignment(), which takes additional parameter `minAlignment`.
|
use special function vmaCreateBufferWithAlignment(), which takes additional parameter `minAlignment`.
|
||||||
This is currently the only method to use if you need exported dedicated allocations, as they cannot be created out of custom pools.
|
|
||||||
This will change in future versions of the library though.
|
|
||||||
|
|
||||||
Note the problem of alignment affects only resources placed inside bigger `VkDeviceMemory` blocks and not dedicated
|
Note the problem of alignment affects only resources placed inside bigger `VkDeviceMemory` blocks and not dedicated
|
||||||
allocations, as these, by definition, always have alignment = 0 because the resource is bound to the beginning of its dedicated block.
|
allocations, as these, by definition, always have alignment = 0 because the resource is bound to the beginning of its dedicated block.
|
||||||
|
Loading…
Reference in New Issue
Block a user