mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 04:10:06 +00:00
Added VmaPoolStats::unusedRangeSizeMax.
This commit is contained in:
parent
9c64d605f7
commit
5c9047dbaa
@ -29,7 +29,7 @@ This library can help game developers to manage memory allocations and resource
|
||||
1. Functions that help to choose correct and optimal memory type based on intended usage of the memory.
|
||||
- Required or preferred traits of the memory are expressed using higher-level description comparing to Vulkan flags.
|
||||
2. Functions that allocate memory blocks, reserve and return parts of them (`VkDeviceMemory` + offset + size) to the user.
|
||||
- Library keeps track of allocated memory blocks, used and unused ranges inside them, finds best matching unused ranges for new allocations, takes all the rules of alignment into consideration.
|
||||
- Library keeps track of allocated memory blocks, used and unused ranges inside them, finds best matching unused ranges for new allocations, takes all the rules of alignment and buffer/image granularity into consideration.
|
||||
3. Functions that can create an image/buffer, allocate memory for it and bind them together - all in one call.
|
||||
|
||||
Additional features:
|
||||
|
Binary file not shown.
@ -236,6 +236,9 @@ $(function() {
|
||||
<li>UnusedRangeSizeAvg
|
||||
: <a class="el" href="struct_vma_stat_info.html#a88ad9bdc2b3a98964a4d0c338c0c9060">VmaStatInfo</a>
|
||||
</li>
|
||||
<li>unusedRangeSizeMax
|
||||
: <a class="el" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">VmaPoolStats</a>
|
||||
</li>
|
||||
<li>UnusedRangeSizeMax
|
||||
: <a class="el" href="struct_vma_stat_info.html#a10c52c0841f01ca704e8ddb1ea6a635d">VmaStatInfo</a>
|
||||
</li>
|
||||
|
@ -236,6 +236,9 @@ $(function() {
|
||||
<li>UnusedRangeSizeAvg
|
||||
: <a class="el" href="struct_vma_stat_info.html#a88ad9bdc2b3a98964a4d0c338c0c9060">VmaStatInfo</a>
|
||||
</li>
|
||||
<li>unusedRangeSizeMax
|
||||
: <a class="el" href="struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b">VmaPoolStats</a>
|
||||
</li>
|
||||
<li>UnusedRangeSizeMax
|
||||
: <a class="el" href="struct_vma_stat_info.html#a10c52c0841f01ca704e8ddb1ea6a635d">VmaStatInfo</a>
|
||||
</li>
|
||||
|
@ -1,9 +1,9 @@
|
||||
var searchData=
|
||||
[
|
||||
['unusedbytes',['UnusedBytes',['../struct_vma_stat_info.html#a394d2aef4348cb58abf73764804b4f2d',1,'VmaStatInfo']]],
|
||||
['unusedrangecount',['unusedRangeCount',['../struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4',1,'VmaPoolStats::unusedRangeCount()'],['../struct_vma_stat_info.html#a56c4fb4dba646479180b601854cde2a6',1,'VmaStatInfo::UnusedRangeCount()']]],
|
||||
['unusedrangecount',['UnusedRangeCount',['../struct_vma_stat_info.html#a56c4fb4dba646479180b601854cde2a6',1,'VmaStatInfo::UnusedRangeCount()'],['../struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4',1,'VmaPoolStats::unusedRangeCount()']]],
|
||||
['unusedrangesizeavg',['UnusedRangeSizeAvg',['../struct_vma_stat_info.html#a88ad9bdc2b3a98964a4d0c338c0c9060',1,'VmaStatInfo']]],
|
||||
['unusedrangesizemax',['UnusedRangeSizeMax',['../struct_vma_stat_info.html#a10c52c0841f01ca704e8ddb1ea6a635d',1,'VmaStatInfo']]],
|
||||
['unusedrangesizemax',['unusedRangeSizeMax',['../struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b',1,'VmaPoolStats::unusedRangeSizeMax()'],['../struct_vma_stat_info.html#a10c52c0841f01ca704e8ddb1ea6a635d',1,'VmaStatInfo::UnusedRangeSizeMax()']]],
|
||||
['unusedrangesizemin',['UnusedRangeSizeMin',['../struct_vma_stat_info.html#a07c508f42a4d3424bd0c259784a7f2d6',1,'VmaStatInfo']]],
|
||||
['unusedsize',['unusedSize',['../struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8',1,'VmaPoolStats']]],
|
||||
['usage',['usage',['../struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910',1,'VmaAllocationCreateInfo']]],
|
||||
|
@ -1,9 +1,9 @@
|
||||
var searchData=
|
||||
[
|
||||
['unusedbytes',['UnusedBytes',['../struct_vma_stat_info.html#a394d2aef4348cb58abf73764804b4f2d',1,'VmaStatInfo']]],
|
||||
['unusedrangecount',['unusedRangeCount',['../struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4',1,'VmaPoolStats::unusedRangeCount()'],['../struct_vma_stat_info.html#a56c4fb4dba646479180b601854cde2a6',1,'VmaStatInfo::UnusedRangeCount()']]],
|
||||
['unusedrangecount',['UnusedRangeCount',['../struct_vma_stat_info.html#a56c4fb4dba646479180b601854cde2a6',1,'VmaStatInfo::UnusedRangeCount()'],['../struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4',1,'VmaPoolStats::unusedRangeCount()']]],
|
||||
['unusedrangesizeavg',['UnusedRangeSizeAvg',['../struct_vma_stat_info.html#a88ad9bdc2b3a98964a4d0c338c0c9060',1,'VmaStatInfo']]],
|
||||
['unusedrangesizemax',['UnusedRangeSizeMax',['../struct_vma_stat_info.html#a10c52c0841f01ca704e8ddb1ea6a635d',1,'VmaStatInfo']]],
|
||||
['unusedrangesizemax',['unusedRangeSizeMax',['../struct_vma_pool_stats.html#ab4c8f52dd42ab01998f60f0b6acc722b',1,'VmaPoolStats::unusedRangeSizeMax()'],['../struct_vma_stat_info.html#a10c52c0841f01ca704e8ddb1ea6a635d',1,'VmaStatInfo::UnusedRangeSizeMax()']]],
|
||||
['unusedrangesizemin',['UnusedRangeSizeMin',['../struct_vma_stat_info.html#a07c508f42a4d3424bd0c259784a7f2d6',1,'VmaStatInfo']]],
|
||||
['unusedsize',['unusedSize',['../struct_vma_pool_stats.html#ad7c54874724fce7b06aba526202d82a8',1,'VmaPoolStats']]],
|
||||
['usage',['usage',['../struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910',1,'VmaAllocationCreateInfo']]],
|
||||
|
@ -68,7 +68,8 @@ $(function() {
|
||||
<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#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#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>
|
||||
</table></div><!-- contents -->
|
||||
<!-- start footer part -->
|
||||
<hr class="footer"/><address class="footer"><small>
|
||||
|
@ -85,6 +85,9 @@ Public Attributes</h2></td></tr>
|
||||
<tr class="memitem:ae4f3546ffa4d1e598b64d8e6134854f4"><td class="memItemLeft" align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_pool_stats.html#ae4f3546ffa4d1e598b64d8e6134854f4">unusedRangeCount</a></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 <code>VmaAllocation</code>. <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="separator:ab4c8f52dd42ab01998f60f0b6acc722b"><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 VmaPool. </p>
|
||||
@ -135,6 +138,23 @@ Public Attributes</h2></td></tr>
|
||||
|
||||
<p>Number of continuous memory ranges in the pool not used by any <code>VmaAllocation</code>. </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<a id="ab4c8f52dd42ab01998f60f0b6acc722b"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ab4c8f52dd42ab01998f60f0b6acc722b">◆ </a></span>unusedRangeSizeMax</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">VkDeviceSize VmaPoolStats::unusedRangeSizeMax</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>Size of the largest continuous free memory region. </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>
|
||||
</div>
|
||||
<a id="ad7c54874724fce7b06aba526202d82a8"></a>
|
||||
|
File diff suppressed because one or more lines are too long
@ -845,6 +845,13 @@ typedef struct VmaPoolStats {
|
||||
/** \brief Number of continuous memory ranges in the pool not used by any `VmaAllocation`.
|
||||
*/
|
||||
size_t unusedRangeCount;
|
||||
/** \brief Size of the largest continuous free memory region.
|
||||
|
||||
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.
|
||||
*/
|
||||
VkDeviceSize unusedRangeSizeMax;
|
||||
} VmaPoolStats;
|
||||
|
||||
/** \brief Allocates Vulkan device memory and creates `VmaPool` object.
|
||||
@ -3049,6 +3056,8 @@ public:
|
||||
|
||||
// Validates all data structures inside this object. If not valid, returns false.
|
||||
bool Validate() const;
|
||||
|
||||
VkDeviceSize GetUnusedRangeSizeMax() const;
|
||||
|
||||
// Tries to find a place for suballocation with given parameters inside this allocation.
|
||||
// If succeeded, fills pAllocationRequest and returns true.
|
||||
@ -4281,6 +4290,18 @@ bool VmaDeviceMemoryBlock::Validate() const
|
||||
(calculatedFreeCount == m_FreeCount);
|
||||
}
|
||||
|
||||
VkDeviceSize VmaDeviceMemoryBlock::GetUnusedRangeSizeMax() const
|
||||
{
|
||||
if(!m_FreeSuballocationsBySize.empty())
|
||||
{
|
||||
return m_FreeSuballocationsBySize.back()->size;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
How many suitable free suballocations to analyze before choosing best one.
|
||||
- Set to 1 to use First-Fit algorithm - first suitable free suballocation will
|
||||
@ -5176,6 +5197,7 @@ void VmaBlockVector::GetPoolStats(VmaPoolStats* pStats)
|
||||
pStats->unusedSize = 0;
|
||||
pStats->allocationCount = 0;
|
||||
pStats->unusedRangeCount = 0;
|
||||
pStats->unusedRangeSizeMax = 0;
|
||||
|
||||
VmaMutexLock lock(m_Mutex, m_hAllocator->m_UseMutex);
|
||||
|
||||
@ -5191,6 +5213,7 @@ void VmaBlockVector::GetPoolStats(VmaPoolStats* pStats)
|
||||
pStats->unusedSize += pBlock->m_SumFreeSize;
|
||||
pStats->allocationCount += rangeCount - pBlock->m_FreeCount;
|
||||
pStats->unusedRangeCount += pBlock->m_FreeCount;
|
||||
pStats->unusedRangeSizeMax = VMA_MAX(pStats->unusedRangeSizeMax, pBlock->GetUnusedRangeSizeMax());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user