|
3 | 3 | <head> |
4 | 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
5 | 5 | <meta http-equiv="X-UA-Compatible" content="IE=11"/> |
6 | | -<meta name="generator" content="Doxygen 1.14.0"/> |
| 6 | +<meta name="generator" content="Doxygen 1.16.1"/> |
7 | 7 | <meta name="viewport" content="width=device-width, initial-scale=1"/> |
8 | 8 | <title>Vulkan Memory Allocator: Choosing memory type</title> |
9 | 9 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
|
31 | 31 | </table> |
32 | 32 | </div> |
33 | 33 | <!-- end header part --> |
34 | | -<!-- Generated by Doxygen 1.14.0 --> |
| 34 | +<!-- Generated by Doxygen 1.16.1 --> |
35 | 35 | <script type="text/javascript"> |
36 | 36 | var searchBox = new SearchBox("searchBox", "search/",'.html'); |
37 | 37 | </script> |
@@ -123,9 +123,9 @@ <h1 class="doxsection"><a class="anchor" id="choosing_memory_type_usage"></a> |
123 | 123 | <div class="line"><a class="code hl_function" href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(allocator, &stagingBufferInfo, &stagingAllocInfo, &stagingBuffer, &stagingAllocation, <span class="keyword">nullptr</span>);</div> |
124 | 124 | <div class="ttc" id="agroup__group__alloc_html_ggad9889c10c798b040d59c92f257cae597a9be224df3bfc1cfa06203aed689a30c5"><div class="ttname"><a href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a9be224df3bfc1cfa06203aed689a30c5">VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT</a></div><div class="ttdeci">@ VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:662</div></div> |
125 | 125 | <div class="ttc" id="astruct_vma_allocation_create_info_html_add09658ac14fe290ace25470ddd6d41b"><div class="ttname"><a href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">VmaAllocationCreateInfo::flags</a></div><div class="ttdeci">VmaAllocationCreateFlags flags</div><div class="ttdoc">Use VmaAllocationCreateFlagBits enum.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1296</div></div> |
126 | | -</div><!-- fragment --><p>For more examples of creating different kinds of resources, see chapter <a class="el" href="usage_patterns.html">Recommended usage patterns</a>. See also: <a class="el" href="memory_mapping.html">Memory mapping</a>.</p> |
| 126 | +</div><!-- fragment --><p>For more examples of creating different kinds of resources, see chapter <a class="el" href="usage_patterns.html" title="Recommended usage patterns">Recommended usage patterns</a>. See also: <a class="el" href="memory_mapping.html" title="Memory mapping">Memory mapping</a>.</p> |
127 | 127 | <p>Usage values <span class="tt">VMA_MEMORY_USAGE_AUTO*</span> are legal to use only when the library knows about the resource being created by having <span class="tt">VkBufferCreateInfo</span> / <span class="tt">VkImageCreateInfo</span> passed, so they work with functions like: <a class="el" href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51" title="Creates a new VkBuffer, allocates and binds memory for it.">vmaCreateBuffer()</a>, <a class="el" href="group__group__alloc.html#ga02a94f25679275851a53e82eacbcfc73" title="Function similar to vmaCreateBuffer() but for images.">vmaCreateImage()</a>, <a class="el" href="group__group__alloc.html#gae790ab9ffaf7667fb8f62523e6897888" title="Helps to find memoryTypeIndex, given VkBufferCreateInfo and VmaAllocationCreateInfo.">vmaFindMemoryTypeIndexForBufferInfo()</a> etc. If you allocate raw memory using function <a class="el" href="group__group__alloc.html#gabf28077dbf82d0908b8acbe8ee8dd9b8" title="General purpose memory allocation.">vmaAllocateMemory()</a>, you have to use other means of selecting memory type, as described below.</p> |
128 | | -<dl class="section note"><dt>Note</dt><dd>Old usage values (<span class="tt">VMA_MEMORY_USAGE_GPU_ONLY</span>, <span class="tt">VMA_MEMORY_USAGE_CPU_ONLY</span>, <span class="tt">VMA_MEMORY_USAGE_CPU_TO_GPU</span>, <span class="tt">VMA_MEMORY_USAGE_GPU_TO_CPU</span>, <span class="tt">VMA_MEMORY_USAGE_CPU_COPY</span>) are still available and work same way as in previous versions of the library for backward compatibility, but they are deprecated.</dd></dl> |
| 128 | +<dl class="section note"><dt>Note</dt><dd>Old usage values (<span class="tt"><a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a></span>, <span class="tt"><a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5">VMA_MEMORY_USAGE_CPU_ONLY</a></span>, <span class="tt"><a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67">VMA_MEMORY_USAGE_CPU_TO_GPU</a></span>, <span class="tt"><a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27">VMA_MEMORY_USAGE_GPU_TO_CPU</a></span>, <span class="tt"><a class="el" href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500">VMA_MEMORY_USAGE_CPU_COPY</a></span>) are still available and work same way as in previous versions of the library for backward compatibility, but they are deprecated.</dd></dl> |
129 | 129 | <h1 class="doxsection"><a class="anchor" id="choosing_memory_type_required_preferred_flags"></a> |
130 | 130 | Required and preferred flags</h1> |
131 | 131 | <p>You can specify more detailed requirements by filling members <a class="el" href="struct_vma_allocation_create_info.html#a9166390303ff42d783305bc31c2b6b90" title="Flags that must be set in a Memory Type chosen for an allocation.">VmaAllocationCreateInfo::requiredFlags</a> and <a class="el" href="struct_vma_allocation_create_info.html#a7fe8d81a1ad10b2a2faacacee5b15d6d" title="Flags that preferably should be set in a memory type chosen for an allocation.">VmaAllocationCreateInfo::preferredFlags</a> with a combination of bits from enum <span class="tt">VkMemoryPropertyFlags</span>. For example, if you want to create a buffer that will be persistently mapped on host (so it must be <span class="tt">HOST_VISIBLE</span>) and preferably will also be <span class="tt">HOST_COHERENT</span> and <span class="tt">HOST_CACHED</span>, use following code:</p> |
@@ -165,20 +165,20 @@ <h1 class="doxsection"><a class="anchor" id="choosing_memory_type_explicit_memor |
165 | 165 | <div class="line"><span class="comment">// ...</span></div> |
166 | 166 | </div><!-- fragment --><h1 class="doxsection"><a class="anchor" id="choosing_memory_type_custom_memory_pools"></a> |
167 | 167 | Custom memory pools</h1> |
168 | | -<p>If you allocate from custom memory pool, all the ways of specifying memory requirements described above are not applicable and the aforementioned members of <a class="el" href="struct_vma_allocation_create_info.html" title="Parameters of new VmaAllocation.">VmaAllocationCreateInfo</a> structure are ignored. Memory type is selected explicitly when creating the pool and then used to make all the allocations from that pool. For further details, see <a class="el" href="custom_memory_pools.html">Custom memory pools</a>.</p> |
| 168 | +<p>If you allocate from custom memory pool, all the ways of specifying memory requirements described above are not applicable and the aforementioned members of <a class="el" href="struct_vma_allocation_create_info.html" title="Parameters of new VmaAllocation.">VmaAllocationCreateInfo</a> structure are ignored. Memory type is selected explicitly when creating the pool and then used to make all the allocations from that pool. For further details, see <a class="el" href="custom_memory_pools.html" title="Custom memory pools">Custom memory pools</a>.</p> |
169 | 169 | <h1 class="doxsection"><a class="anchor" id="choosing_memory_type_dedicated_allocations"></a> |
170 | 170 | Dedicated allocations</h1> |
171 | 171 | <p>Memory for allocations is reserved out of larger block of <span class="tt">VkDeviceMemory</span> allocated from Vulkan internally. That is the main feature of this whole library. You can still request a separate memory block to be created for an allocation, just like you would do in a trivial solution without using any allocator. In that case, a buffer or image is always bound to that memory at offset 0. This is called a "dedicated allocation". You can explicitly request it by using flag <a class="el" href="group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f" title="Set this flag if the allocation should have its own memory block.">VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT</a>. The library can also internally decide to use dedicated allocation in some cases, e.g.:</p> |
172 | 172 | <ul> |
173 | 173 | <li>When the size of the allocation is large.</li> |
174 | | -<li>When <a class="el" href="vk_khr_dedicated_allocation.html">VK_KHR_dedicated_allocation</a> extension is enabled and it reports that dedicated allocation is required or recommended for the resource.</li> |
| 174 | +<li>When <a class="el" href="vk_khr_dedicated_allocation.html" title="VK_KHR_dedicated_allocation">VK_KHR_dedicated_allocation</a> extension is enabled and it reports that dedicated allocation is required or recommended for the resource.</li> |
175 | 175 | <li>When allocation of next big memory block fails due to not enough device memory, but allocation with the exact requested size succeeds. </li> |
176 | 176 | </ul> |
177 | 177 | </div></div><!-- contents --> |
178 | 178 | </div><!-- PageDoc --> |
179 | 179 | <!-- start footer part --> |
180 | 180 | <hr class="footer"/><address class="footer"><small> |
181 | | -Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0 |
| 181 | +Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.16.1 |
182 | 182 | </small></address> |
183 | 183 | </div><!-- doc-content --> |
184 | 184 | </body> |
|
0 commit comments