mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-22 23:04:35 +00:00
Merge branch 'master' into allocation_defragmentation_strategies
This commit is contained in:
commit
1d2d627146
@ -1,4 +1,4 @@
|
||||
# 2.1.0-beta.1 (2018-08-24)
|
||||
# 2.1.0-beta.1 (2018-08-27)
|
||||
|
||||
Major release after many months of development in "development" branch and features branches. Many new features added, some bugs fixed. API stays backward-compatible.
|
||||
|
||||
@ -21,14 +21,17 @@ Major changes:
|
||||
- Changed format of JSON dump returned by `vmaBuildStatsString` (not backward compatible!).
|
||||
- Custom pools and memory blocks now have IDs that don't change after sorting.
|
||||
- Added properties: "CreationFrameIndex", "LastUseFrameIndex", "Usage".
|
||||
- Changed behavior of `vmaGetAllocationInfo` and `vmaTouchAllocation` to update `allocation.lastUseFrameIndex` even if allocation cannot become lost.
|
||||
- Changed VmaDumpVis tool to use these new properties for better coloring.
|
||||
- Changed behavior of `vmaGetAllocationInfo` and `vmaTouchAllocation` to update `allocation.lastUseFrameIndex` even if allocation cannot become lost.
|
||||
|
||||
Minor changes:
|
||||
|
||||
- Changes in custom pools:
|
||||
- Added new structure member `VmaPoolStats::blockCount`.
|
||||
- Changed behavior of `VmaPoolCreateInfo::blockSize` = 0 (default) - it now means that pool may use variable block sizes, just like default pools do.
|
||||
- Improved logic of `vmaFindMemoryTypeIndex` for some cases, especially integrated GPUs.
|
||||
- VulkanSample application: Removed dependency on external library MathFu. Added own vector and matrix structures.
|
||||
- Code changes that improve compatibility with various platforms, including: Visual Studio 2012, 32-bit code, C compilers.
|
||||
- Changes that improve compatibility with various platforms, including: Visual Studio 2012, 32-bit code, C compilers.
|
||||
- Changed usage of "VK_KHR_dedicated_allocation" extension in the code to be optional, driven by macro `VMA_DEDICATED_ALLOCATION`, for compatibility with Android.
|
||||
- Many additions and fixes in documentation, including description of new features, as well as "Validation layer warnings".
|
||||
- Other bugfixes.
|
||||
|
@ -93,6 +93,7 @@ See **[Documentation](https://gpuopen-librariesandsdks.github.io/VulkanMemoryAll
|
||||
|
||||
# Software using this library
|
||||
|
||||
- **[Filament](https://github.com/google/filament)** - physically based rendering engine for Android, Windows, Linux and macOS, from Google. Apache License 2.0.
|
||||
- **[Anvil](https://github.com/GPUOpen-LibrariesAndSDKs/Anvil)** - cross-platform framework for Vulkan. License: MIT.
|
||||
- **[vkDOOM3](https://github.com/DustinHLand/vkDOOM3)** - Vulkan port of GPL DOOM 3 BFG Edition. License: GNU GPL.
|
||||
- **[Lightweight Java Game Library (LWJGL)](https://www.lwjgl.org/)** - includes binding of the library for Java. License: BSD.
|
||||
@ -102,4 +103,5 @@ See **[Documentation](https://gpuopen-librariesandsdks.github.io/VulkanMemoryAll
|
||||
|
||||
- **[Awesome Vulkan](https://github.com/vinjn/awesome-vulkan)** - a curated list of awesome Vulkan libraries, debuggers and resources.
|
||||
- **[PyVMA](https://github.com/realitix/pyvma)** - Python wrapper for this library. Author: Jean-Sébastien B. (@realitix). License: Apache 2.0.
|
||||
- **[vma_sample_sdl](https://github.com/rextimmy/vma_sample_sdl)** - SDL port of the sample app of this library (with the goal of running it on multiple platforms, including MacOS). Author: @rextimmy. License: MIT.
|
||||
- **[vulkan-malloc](https://github.com/dylanede/vulkan-malloc)** - Vulkan memory allocation library for Rust. Based on version 1 of this library. Author: Dylan Ede (@dylanede). License: MIT / Apache 2.0.
|
||||
|
Binary file not shown.
Binary file not shown.
@ -101,19 +101,20 @@ Linear allocation algorithm</h1>
|
||||
<img src="../gfx/Linear_allocator_2_algo_linear.png" alt="Linear allocation algorithm"/>
|
||||
</div>
|
||||
<p>With this one flag, you can create a custom pool that can be used in many ways: free-at-once, stack, double stack, and ring buffer. See below for details.</p>
|
||||
<p>Pools with linear algorithm must have only one memory block - <a class="el" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c" title="Maximum number of blocks that can be allocated in this pool. Optional. ">VmaPoolCreateInfo::maxBlockCount</a> must be 1.</p>
|
||||
<h2><a class="anchor" id="linear_algorithm_free_at_once"></a>
|
||||
Free-at-once</h2>
|
||||
<p>In a pool that uses linear algorithm, you still need to free all the allocations individually, e.g. by using <a class="el" href="vk__mem__alloc_8h.html#a11f0fbc034fa81a4efedd73d61ce7568" title="Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage(). ">vmaFreeMemory()</a> or <a class="el" href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77" title="Destroys Vulkan buffer and frees allocated memory. ">vmaDestroyBuffer()</a>. You can free them in any order. New allocations are always made after last one - free space in the middle is not reused. However, when you release all the allocation and the pool becomes empty, allocation starts from the beginning again. This way you can use linear algorithm to speed up creation of allocations that you are going to release all at once.</p>
|
||||
<div class="image">
|
||||
<img src="../gfx/Linear_allocator_3_free_at_once.png" alt="Free-at-once"/>
|
||||
</div>
|
||||
<p>This mode is also available for pools created with <a class="el" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c" title="Maximum number of blocks that can be allocated in this pool. Optional. ">VmaPoolCreateInfo::maxBlockCount</a> value that allows multiple memory blocks.</p>
|
||||
<h2><a class="anchor" id="linear_algorithm_stack"></a>
|
||||
Stack</h2>
|
||||
<p>When you free an allocation that was created last, its space can be reused. Thanks to this, if you always release allocations in the order opposite to their creation (LIFO - Last In First Out), you can achieve behavior of a stack.</p>
|
||||
<div class="image">
|
||||
<img src="../gfx/Linear_allocator_4_stack.png" alt="Stack"/>
|
||||
</div>
|
||||
<p>This mode is also available for pools created with <a class="el" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c" title="Maximum number of blocks that can be allocated in this pool. Optional. ">VmaPoolCreateInfo::maxBlockCount</a> value that allows multiple memory blocks.</p>
|
||||
<h2><a class="anchor" id="linear_algorithm_double_stack"></a>
|
||||
Double stack</h2>
|
||||
<p>The space reserved by a custom pool with linear algorithm may be used by two stacks:</p>
|
||||
@ -122,10 +123,11 @@ Double stack</h2>
|
||||
<li>Second, "upper" one, growing down from the end towards lower offsets.</li>
|
||||
</ul>
|
||||
<p>To make allocation from upper stack, add flag <a class="el" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df">VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT</a> to <a class="el" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b" title="Use VmaAllocationCreateFlagBits enum. ">VmaAllocationCreateInfo::flags</a>.</p>
|
||||
<p>When the two stacks' ends meet so there is not enough space between them for a new allocation, such allocation fails with usual <code>VK_ERROR_OUT_OF_DEVICE_MEMORY</code> error.</p>
|
||||
<div class="image">
|
||||
<img src="../gfx/Linear_allocator_7_double_stack.png" alt="Double stack"/>
|
||||
</div>
|
||||
<p>Double stack is available only in pools with one memory block - <a class="el" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c" title="Maximum number of blocks that can be allocated in this pool. Optional. ">VmaPoolCreateInfo::maxBlockCount</a> must be 1. Otherwise behavior is undefined.</p>
|
||||
<p>When the two stacks' ends meet so there is not enough space between them for a new allocation, such allocation fails with usual <code>VK_ERROR_OUT_OF_DEVICE_MEMORY</code> error.</p>
|
||||
<h2><a class="anchor" id="linear_algorithm_ring_buffer"></a>
|
||||
Ring buffer</h2>
|
||||
<p>When you free some allocations from the beginning and there is not enough free space for a new one at the end of a pool, allocator's "cursor" wraps around to the beginning and starts allocation there. Thanks to this, if you always release allocations in the same order as you created them (FIFO - First In First Out), you can achieve behavior of a ring buffer / queue.</p>
|
||||
@ -136,7 +138,8 @@ Ring buffer</h2>
|
||||
<div class="image">
|
||||
<img src="../gfx/Linear_allocator_6_ring_buffer_lost.png" alt="Ring buffer with lost allocations"/>
|
||||
</div>
|
||||
</div></div><!-- contents -->
|
||||
<p>Ring buffer is available only in pools with one memory block - <a class="el" href="struct_vma_pool_create_info.html#ae41142f2834fcdc82baa4883c187b75c" title="Maximum number of blocks that can be allocated in this pool. Optional. ">VmaPoolCreateInfo::maxBlockCount</a> must be 1. Otherwise behavior is undefined. </p>
|
||||
</div></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
Generated by  <a href="http://www.doxygen.org/index.html">
|
||||
|
@ -82,7 +82,8 @@ $(function() {
|
||||
|
||||
<h3><a id="index_b"></a>- b -</h3><ul>
|
||||
<li>blockCount
|
||||
: <a class="el" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">VmaStatInfo</a>
|
||||
: <a class="el" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">VmaPoolStats</a>
|
||||
, <a class="el" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">VmaStatInfo</a>
|
||||
</li>
|
||||
<li>blockSize
|
||||
: <a class="el" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676">VmaPoolCreateInfo</a>
|
||||
|
@ -82,7 +82,8 @@ $(function() {
|
||||
|
||||
<h3><a id="index_b"></a>- b -</h3><ul>
|
||||
<li>blockCount
|
||||
: <a class="el" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">VmaStatInfo</a>
|
||||
: <a class="el" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">VmaPoolStats</a>
|
||||
, <a class="el" href="struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4">VmaStatInfo</a>
|
||||
</li>
|
||||
<li>blockSize
|
||||
: <a class="el" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676">VmaPoolCreateInfo</a>
|
||||
|
@ -62,7 +62,7 @@ $(function() {
|
||||
<div class="title">Vulkan Memory Allocator </div> </div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="textblock"><p><b>Version 2.1.0-beta.1</b> (2018-08-24)</p>
|
||||
<div class="textblock"><p><b>Version 2.1.0-beta.1</b> (2018-08-27)</p>
|
||||
<p>Copyright (c) 2017-2018 Advanced Micro Devices, Inc. All rights reserved. <br />
|
||||
License: MIT</p>
|
||||
<p>Documentation of all members: <a class="el" href="vk__mem__alloc_8h.html">vk_mem_alloc.h</a></p>
|
||||
|
@ -77,7 +77,7 @@ $(function() {
|
||||
<p><b>Q: How do you inform the library when new frame starts?</b></p>
|
||||
<p>You need to call function <a class="el" href="vk__mem__alloc_8h.html#ade56bf8dc9f5a5eaddf5f119ed525236" title="Sets index of the current frame. ">vmaSetCurrentFrameIndex()</a>.</p>
|
||||
<p>Example code:</p>
|
||||
<div class="fragment"><div class="line"><span class="keyword">struct </span>MyBuffer</div><div class="line">{</div><div class="line"> VkBuffer m_Buf = <span class="keyword">nullptr</span>;</div><div class="line"> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> m_Alloc = <span class="keyword">nullptr</span>;</div><div class="line"></div><div class="line"> <span class="comment">// Called when the buffer is really needed in the current frame.</span></div><div class="line"> <span class="keywordtype">void</span> EnsureBuffer();</div><div class="line">};</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> MyBuffer::EnsureBuffer()</div><div class="line">{</div><div class="line"> <span class="comment">// Buffer has been created.</span></div><div class="line"> <span class="keywordflow">if</span>(m_Buf != VK_NULL_HANDLE)</div><div class="line"> {</div><div class="line"> <span class="comment">// Check if its allocation is not lost + mark it as used in current frame.</span></div><div class="line"> <span class="keywordflow">if</span>(<a class="code" href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a">vmaTouchAllocation</a>(allocator, m_Alloc))</div><div class="line"> {</div><div class="line"> <span class="comment">// It's all OK - safe to use m_Buf.</span></div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Buffer not yet exists or lost - destroy and recreate it.</span></div><div class="line"></div><div class="line"> <a class="code" href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a>(allocator, m_Buf, m_Alloc);</div><div class="line"></div><div class="line"> VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };</div><div class="line"> bufCreateInfo.size = 1024;</div><div class="line"> bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;</div><div class="line"></div><div class="line"> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> allocCreateInfo = {};</div><div class="line"> allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a> = <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a>;</div><div class="line"> allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> = <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a5f436af6c8fe8540573a6d22627a6fd2">VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT</a> |</div><div class="line"> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a>;</div><div class="line"></div><div class="line"> <a class="code" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(allocator, &bufCreateInfo, &allocCreateInfo, &m_Buf, &m_Alloc, <span class="keyword">nullptr</span>);</div><div class="line">}</div></div><!-- fragment --><p>When using lost allocations, you may see some Vulkan validation layer warnings about overlapping regions of memory bound to different kinds of buffers and images. This is still valid as long as you implement proper handling of lost allocations (like in the example above) and don't use them.</p>
|
||||
<div class="fragment"><div class="line"><span class="keyword">struct </span>MyBuffer</div><div class="line">{</div><div class="line"> VkBuffer m_Buf = <span class="keyword">nullptr</span>;</div><div class="line"> <a class="code" href="struct_vma_allocation.html">VmaAllocation</a> m_Alloc = <span class="keyword">nullptr</span>;</div><div class="line"></div><div class="line"> <span class="comment">// Called when the buffer is really needed in the current frame.</span></div><div class="line"> <span class="keywordtype">void</span> EnsureBuffer();</div><div class="line">};</div><div class="line"></div><div class="line"><span class="keywordtype">void</span> MyBuffer::EnsureBuffer()</div><div class="line">{</div><div class="line"> <span class="comment">// Buffer has been created.</span></div><div class="line"> <span class="keywordflow">if</span>(m_Buf != VK_NULL_HANDLE)</div><div class="line"> {</div><div class="line"> <span class="comment">// Check if its allocation is not lost + mark it as used in current frame.</span></div><div class="line"> <span class="keywordflow">if</span>(<a class="code" href="vk__mem__alloc_8h.html#a43d8ba9673c846f049089a5029d5c73a">vmaTouchAllocation</a>(allocator, m_Alloc))</div><div class="line"> {</div><div class="line"> <span class="comment">// It's all OK - safe to use m_Buf.</span></div><div class="line"> <span class="keywordflow">return</span>;</div><div class="line"> }</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Buffer not yet exists or lost - destroy and recreate it.</span></div><div class="line"></div><div class="line"> <a class="code" href="vk__mem__alloc_8h.html#a0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer</a>(allocator, m_Buf, m_Alloc);</div><div class="line"></div><div class="line"> VkBufferCreateInfo bufCreateInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };</div><div class="line"> bufCreateInfo.size = 1024;</div><div class="line"> bufCreateInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;</div><div class="line"></div><div class="line"> <a class="code" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> allocCreateInfo = {};</div><div class="line"> allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">usage</a> = <a class="code" href="vk__mem__alloc_8h.html#aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7">VMA_MEMORY_USAGE_GPU_ONLY</a>;</div><div class="line"> allocCreateInfo.<a class="code" href="struct_vma_allocation_create_info.html#add09658ac14fe290ace25470ddd6d41b">flags</a> = VMA_ALLOCATION_CREATE_CAN_BECOME_LOST_BIT |</div><div class="line"> <a class="code" href="vk__mem__alloc_8h.html#ad9889c10c798b040d59c92f257cae597a68686d0ce9beb0d4d1b9f2b8b1389a7e">VMA_ALLOCATION_CREATE_CAN_MAKE_OTHER_LOST_BIT</a>;</div><div class="line"></div><div class="line"> <a class="code" href="vk__mem__alloc_8h.html#ac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(allocator, &bufCreateInfo, &allocCreateInfo, &m_Buf, &m_Alloc, <span class="keyword">nullptr</span>);</div><div class="line">}</div></div><!-- fragment --><p>When using lost allocations, you may see some Vulkan validation layer warnings about overlapping regions of memory bound to different kinds of buffers and images. This is still valid as long as you implement proper handling of lost allocations (like in the example above) and don't use them.</p>
|
||||
<p>You can create an allocation that is already in lost state from the beginning using function <a class="el" href="vk__mem__alloc_8h.html#ae5c9657d9e94756269145b01c05d16f1" title="Creates new allocation that is in lost state from the beginning. ">vmaCreateLostAllocation()</a>. It may be useful if you need a "dummy" allocation that is not null.</p>
|
||||
<p>You can call function <a class="el" href="vk__mem__alloc_8h.html#a736bd6cbda886f36c891727e73bd4024" title="Marks all allocations in given pool as lost if they are not used in current frame or VmaPoolCreateInf...">vmaMakePoolAllocationsLost()</a> to set all eligible allocations in a specified custom pool to lost state. Allocations that have been "touched" in current frame or <a class="el" href="struct_vma_pool_create_info.html#a9437e43ffbb644dbbf7fc4e50cfad6aa" title="Maximum number of additional frames that are in use at the same time as current frame. ">VmaPoolCreateInfo::frameInUseCount</a> frames back cannot become lost.</p>
|
||||
<p><b>Q: Can I touch allocation that cannot become lost?</b></p>
|
||||
|
@ -76,6 +76,7 @@ Project setup</h1>
|
||||
<li>In exacly one CPP file define following macro before this include. It enables also internal definitions.</li>
|
||||
</ol>
|
||||
<div class="fragment"><div class="line"><span class="preprocessor">#define VMA_IMPLEMENTATION</span></div><div class="line"><span class="preprocessor">#include "vk_mem_alloc.h"</span></div></div><!-- fragment --><p>It may be a good idea to create dedicated CPP file just for this purpose.</p>
|
||||
<p>Please note that this library includes header <code><vulkan/vulkan.h></code>, which in turn includes <code><windows.h></code> on Windows. If you need some specific macros defined before including these headers (like <code>NOMINMAX</code>, <code>WIN32_LEAN_AND_MEAN</code>, or <code>WINVER</code> for Windows, <code>VK_USE_PLATFORM_WIN32_KHR</code> for Vulkan), you must define them before every <code>#include</code> of this library.</p>
|
||||
<h1><a class="anchor" id="quick_start_initialization"></a>
|
||||
Initialization</h1>
|
||||
<p>At program startup:</p>
|
||||
|
@ -1,6 +1,6 @@
|
||||
var searchData=
|
||||
[
|
||||
['blockcount',['blockCount',['../struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4',1,'VmaStatInfo']]],
|
||||
['blockcount',['blockCount',['../struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4',1,'VmaStatInfo::blockCount()'],['../struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7',1,'VmaPoolStats::blockCount()']]],
|
||||
['blocksize',['blockSize',['../struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676',1,'VmaPoolCreateInfo']]],
|
||||
['bytesfreed',['bytesFreed',['../struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28',1,'VmaDefragmentationStats']]],
|
||||
['bytesmoved',['bytesMoved',['../struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d',1,'VmaDefragmentationStats']]]
|
||||
|
@ -1,6 +1,6 @@
|
||||
var searchData=
|
||||
[
|
||||
['blockcount',['blockCount',['../struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4',1,'VmaStatInfo']]],
|
||||
['blockcount',['blockCount',['../struct_vma_stat_info.html#abc4bb7cd611900778464c56e50c970a4',1,'VmaStatInfo::blockCount()'],['../struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7',1,'VmaPoolStats::blockCount()']]],
|
||||
['blocksize',['blockSize',['../struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676',1,'VmaPoolCreateInfo']]],
|
||||
['bytesfreed',['bytesFreed',['../struct_vma_defragmentation_stats.html#ab0cb9ac0dbc106c77e384ea676422f28',1,'VmaDefragmentationStats']]],
|
||||
['bytesmoved',['bytesMoved',['../struct_vma_defragmentation_stats.html#a36f9d5df2a10ba2a36b16e126d60572d',1,'VmaDefragmentationStats']]]
|
||||
|
@ -80,7 +80,7 @@ Public Attributes</h2></td></tr>
|
||||
<tr class="memdesc:a8405139f63d078340ae74513a59f5446"><td class="mdescLeft"> </td><td class="mdescRight">Use combination of <a class="el" href="vk__mem__alloc_8h.html#a8f93195158e0e2ac80ca352064e71c1f" title="Flags to be passed as VmaPoolCreateInfo::flags. ">VmaPoolCreateFlagBits</a>. <a href="#a8405139f63d078340ae74513a59f5446">More...</a><br /></td></tr>
|
||||
<tr class="separator:a8405139f63d078340ae74513a59f5446"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa4265160536cdb9be821b7686c16c676"><td class="memItemLeft" align="right" valign="top">VkDeviceSize </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_pool_create_info.html#aa4265160536cdb9be821b7686c16c676">blockSize</a></td></tr>
|
||||
<tr class="memdesc:aa4265160536cdb9be821b7686c16c676"><td class="mdescLeft"> </td><td class="mdescRight">Size of a single <code>VkDeviceMemory</code> block to be allocated as part of this pool, in bytes. <a href="#aa4265160536cdb9be821b7686c16c676">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:aa4265160536cdb9be821b7686c16c676"><td class="mdescLeft"> </td><td class="mdescRight">Size of a single <code>VkDeviceMemory</code> block to be allocated as part of this pool, in bytes. Optional. <a href="#aa4265160536cdb9be821b7686c16c676">More...</a><br /></td></tr>
|
||||
<tr class="separator:aa4265160536cdb9be821b7686c16c676"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ad8006fb803185c0a699d30f3e9a865ae"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae">minBlockCount</a></td></tr>
|
||||
<tr class="memdesc:ad8006fb803185c0a699d30f3e9a865ae"><td class="mdescLeft"> </td><td class="mdescRight">Minimum number of blocks to be always allocated in this pool, even if they stay empty. <a href="#ad8006fb803185c0a699d30f3e9a865ae">More...</a><br /></td></tr>
|
||||
@ -107,8 +107,9 @@ Public Attributes</h2></td></tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Size of a single <code>VkDeviceMemory</code> block to be allocated as part of this pool, in bytes. </p>
|
||||
<p>Optional. Leave 0 to use default. </p>
|
||||
<p>Size of a single <code>VkDeviceMemory</code> block to be allocated as part of this pool, in bytes. Optional. </p>
|
||||
<p>Specify nonzero to set explicit, constant size of memory blocks used by this pool.</p>
|
||||
<p>Leave 0 to use default and let the library manage block sizes automatically. Sizes of particular blocks may vary. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -160,7 +161,7 @@ Public Attributes</h2></td></tr>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Maximum number of blocks that can be allocated in this pool. Optional. </p>
|
||||
<p>Set to 0 to use default, which is <code>SIZE_MAX</code>, which means no limit. When <a class="el" href="vk__mem__alloc_8h.html#a9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726" title="Enables alternative, linear allocation algorithm in this pool. ">VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT</a> is used, default is 1.</p>
|
||||
<p>Set to 0 to use default, which is <code>SIZE_MAX</code>, which means no limit.</p>
|
||||
<p>Set to same value as <a class="el" href="struct_vma_pool_create_info.html#ad8006fb803185c0a699d30f3e9a865ae" title="Minimum number of blocks to be always allocated in this pool, even if they stay empty. ">VmaPoolCreateInfo::minBlockCount</a> to have fixed amount of memory allocated throughout whole lifetime of this pool. </p>
|
||||
|
||||
</div>
|
||||
|
@ -66,10 +66,11 @@ $(function() {
|
||||
<p>This is the complete list of members for <a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a>, including all inherited members.</p>
|
||||
<table class="directory">
|
||||
<tr class="even"><td class="entry"><a class="el" href="struct_vma_pool_stats.html#ad1924eb54fffa45e9e0e65670c8fe5eb">allocationCount</a></td><td class="entry"><a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a></td><td class="entry"></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a></td><td class="entry"><a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a></td><td class="entry"><a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a></td><td class="entry"></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a></td><td class="entry"><a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a></td><td class="entry"><a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a></td><td class="entry"></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">blockCount</a></td><td class="entry"><a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="struct_vma_pool_stats.html#a326807b2de2b0931cee4ed9a5f2e420c">size</a></td><td class="entry"><a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a></td><td class="entry"></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a></td><td class="entry"><a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a></td><td class="entry"></td></tr>
|
||||
<tr class="even"><td class="entry"><a class="el" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a></td><td class="entry"><a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a></td><td class="entry"></td></tr>
|
||||
<tr><td class="entry"><a class="el" href="struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8">unusedSize</a></td><td class="entry"><a class="el" href="struct_vma_pool_stats.html">VmaPoolStats</a></td><td class="entry"></td></tr>
|
||||
</table></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
|
@ -86,8 +86,11 @@ Public Attributes</h2></td></tr>
|
||||
<tr class="memdesc:ae4f3546ffa4d1e598b64d8e6134854f4"><td class="mdescLeft"> </td><td class="mdescRight">Number of continuous memory ranges in the pool not used by any <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation. ">VmaAllocation</a>. <a href="#ae4f3546ffa4d1e598b64d8e6134854f4">More...</a><br /></td></tr>
|
||||
<tr class="separator:ae4f3546ffa4d1e598b64d8e6134854f4"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ab4c8f52dd42ab01998f60f0b6acc722b"><td class="memItemLeft" align="right" valign="top">VkDeviceSize </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">unusedRangeSizeMax</a></td></tr>
|
||||
<tr class="memdesc:ab4c8f52dd42ab01998f60f0b6acc722b"><td class="mdescLeft"> </td><td class="mdescRight">Size of the largest continuous free memory region. <a href="#ab4c8f52dd42ab01998f60f0b6acc722b">More...</a><br /></td></tr>
|
||||
<tr class="memdesc:ab4c8f52dd42ab01998f60f0b6acc722b"><td class="mdescLeft"> </td><td class="mdescRight">Size of the largest continuous free memory region available for new allocation. <a href="#ab4c8f52dd42ab01998f60f0b6acc722b">More...</a><br /></td></tr>
|
||||
<tr class="separator:ab4c8f52dd42ab01998f60f0b6acc722b"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa0b5cb45cef6f18571cefb03b9a230e7"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_pool_stats.html#aa0b5cb45cef6f18571cefb03b9a230e7">blockCount</a></td></tr>
|
||||
<tr class="memdesc:aa0b5cb45cef6f18571cefb03b9a230e7"><td class="mdescLeft"> </td><td class="mdescRight">Number of <code>VkDeviceMemory</code> blocks allocated for this pool. <a href="#aa0b5cb45cef6f18571cefb03b9a230e7">More...</a><br /></td></tr>
|
||||
<tr class="separator:aa0b5cb45cef6f18571cefb03b9a230e7"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Describes parameter of existing <a class="el" href="struct_vma_pool.html" title="Represents custom memory pool. ">VmaPool</a>. </p>
|
||||
@ -106,6 +109,22 @@ Public Attributes</h2></td></tr>
|
||||
|
||||
<p>Number of <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation. ">VmaAllocation</a> objects created from this pool that were not destroyed or lost. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="aa0b5cb45cef6f18571cefb03b9a230e7"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa0b5cb45cef6f18571cefb03b9a230e7">◆ </a></span>blockCount</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">size_t VmaPoolStats::blockCount</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Number of <code>VkDeviceMemory</code> blocks allocated for this pool. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="a326807b2de2b0931cee4ed9a5f2e420c"></a>
|
||||
@ -152,7 +171,7 @@ Public Attributes</h2></td></tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Size of the largest continuous free memory region. </p>
|
||||
<p>Size of the largest continuous free memory region available for new allocation. </p>
|
||||
<p>Making a new allocation of that size is not guaranteed to succeed because of possible additional margin required to respect alignment and buffer/image granularity. </p>
|
||||
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
@ -61,6 +61,7 @@ buildoptions { "/MD" }
|
||||
|
||||
|
||||
project "VmaReplay"
|
||||
removeplatforms { "Linux-x64" }
|
||||
kind "ConsoleApp"
|
||||
language "C++"
|
||||
location "../build"
|
||||
|
@ -36,9 +36,18 @@ include all public interface declarations. Example:
|
||||
|
||||
#else // #ifdef _WIN32
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare" // comparison of unsigned expression < 0 is always false
|
||||
#endif
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "vk_mem_alloc.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // #ifdef _WIN32
|
||||
|
||||
#endif
|
||||
|
@ -29,7 +29,7 @@ extern "C" {
|
||||
|
||||
/** \mainpage Vulkan Memory Allocator
|
||||
|
||||
<b>Version 2.1.0-beta.1</b> (2018-08-24)
|
||||
<b>Version 2.1.0-beta.1</b> (2018-08-27)
|
||||
|
||||
Copyright (c) 2017-2018 Advanced Micro Devices, Inc. All rights reserved. \n
|
||||
License: MIT
|
||||
@ -123,6 +123,13 @@ To do it properly:
|
||||
|
||||
It may be a good idea to create dedicated CPP file just for this purpose.
|
||||
|
||||
Please note that this library includes header `<vulkan/vulkan.h>`, which in turn
|
||||
includes `<windows.h>` on Windows. If you need some specific macros defined
|
||||
before including these headers (like `NOMINMAX`, `WIN32_LEAN_AND_MEAN`, or
|
||||
`WINVER` for Windows, `VK_USE_PLATFORM_WIN32_KHR` for Vulkan), you must define
|
||||
them before every `#include` of this library.
|
||||
|
||||
|
||||
\section quick_start_initialization Initialization
|
||||
|
||||
At program startup:
|
||||
@ -3060,9 +3067,13 @@ static void VmaWriteMagicValue(void* pData, VkDeviceSize offset)
|
||||
{
|
||||
uint32_t* pDst = (uint32_t*)((char*)pData + offset);
|
||||
const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);
|
||||
for(size_t i = 0; i < numberCount; ++i, ++pDst)
|
||||
// This condition is to silence clang compiler error: "comparison of unsigned expression < 0 is always false"
|
||||
if(numberCount > 0)
|
||||
{
|
||||
*pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;
|
||||
for(size_t i = 0; i < numberCount; ++i, ++pDst)
|
||||
{
|
||||
*pDst = VMA_CORRUPTION_DETECTION_MAGIC_VALUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3070,11 +3081,15 @@ static bool VmaValidateMagicValue(const void* pData, VkDeviceSize offset)
|
||||
{
|
||||
const uint32_t* pSrc = (const uint32_t*)((const char*)pData + offset);
|
||||
const size_t numberCount = VMA_DEBUG_MARGIN / sizeof(uint32_t);
|
||||
for(size_t i = 0; i < numberCount; ++i, ++pSrc)
|
||||
// This condition is to silence clang compiler error: "comparison of unsigned expression < 0 is always false"
|
||||
if(numberCount > 0)
|
||||
{
|
||||
if(*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)
|
||||
for(size_t i = 0; i < numberCount; ++i, ++pSrc)
|
||||
{
|
||||
return false;
|
||||
if(*pSrc != VMA_CORRUPTION_DETECTION_MAGIC_VALUE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -3513,10 +3528,10 @@ template<typename CmpLess, typename IterT, typename KeyT>
|
||||
IterT VmaVectorFindSorted(const IterT& beg, const IterT& end, const KeyT& value)
|
||||
{
|
||||
CmpLess comparator;
|
||||
typename IterT it = VmaBinaryFindFirstNotLess<CmpLess, IterT, KeyT>(
|
||||
IterT it = VmaBinaryFindFirstNotLess<CmpLess, IterT, KeyT>(
|
||||
beg, end, value, comparator);
|
||||
if(it == end ||
|
||||
!comparator(*it, value) && !comparator(value, *it))
|
||||
(!comparator(*it, value) && !comparator(value, *it)))
|
||||
{
|
||||
return it;
|
||||
}
|
||||
@ -8632,8 +8647,8 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest(
|
||||
}
|
||||
|
||||
// There is enough free space at the end after alignment.
|
||||
if(index1st == suballocations1st.size() && resultOffset + allocSize + VMA_DEBUG_MARGIN < size ||
|
||||
index1st < suballocations1st.size() && resultOffset + allocSize + VMA_DEBUG_MARGIN <= suballocations1st[index1st].offset)
|
||||
if((index1st == suballocations1st.size() && resultOffset + allocSize + VMA_DEBUG_MARGIN < size) ||
|
||||
(index1st < suballocations1st.size() && resultOffset + allocSize + VMA_DEBUG_MARGIN <= suballocations1st[index1st].offset))
|
||||
{
|
||||
// Check next suballocations for BufferImageGranularity conflicts.
|
||||
// If conflict exists, allocation cannot be made here.
|
||||
@ -11634,8 +11649,7 @@ void VmaAllocator_T::FreeMemory(const VmaAllocation allocation)
|
||||
{
|
||||
VMA_ASSERT(allocation);
|
||||
|
||||
if(allocation->CanBecomeLost() == false ||
|
||||
allocation->GetLastUseFrameIndex() != VMA_FRAME_INDEX_LOST)
|
||||
if(TouchAllocation(allocation))
|
||||
{
|
||||
if(VMA_DEBUG_INITIALIZE_ALLOCATIONS)
|
||||
{
|
||||
@ -11854,7 +11868,7 @@ void VmaAllocator_T::GetAllocationInfo(VmaAllocation hAllocation, VmaAllocationI
|
||||
Warning: This is a carefully designed algorithm.
|
||||
Do not modify unless you really know what you're doing :)
|
||||
*/
|
||||
uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();
|
||||
const uint32_t localCurrFrameIndex = m_CurrentFrameIndex.load();
|
||||
uint32_t localLastUseFrameIndex = hAllocation->GetLastUseFrameIndex();
|
||||
for(;;)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user