mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2025-05-14 16:58:34 +00:00
Improved VmaBlockMetadata_Buddy when used as a virtual allocator, to support allocation sizes down to 1
This commit is contained in:
parent
fc23b9da1f
commit
455823fcbf
1 changed files with 3 additions and 3 deletions
|
@ -5538,8 +5538,7 @@ public:
|
||||||
virtual void SetAllocationUserData(VkDeviceSize offset, void* userData);
|
virtual void SetAllocationUserData(VkDeviceSize offset, void* userData);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const VkDeviceSize MIN_NODE_SIZE = 32;
|
static const size_t MAX_LEVELS = 48;
|
||||||
static const size_t MAX_LEVELS = 30;
|
|
||||||
|
|
||||||
static VkDeviceSize AlignAllocationSize(VkDeviceSize size) { return VmaNextPow2(size); }
|
static VkDeviceSize AlignAllocationSize(VkDeviceSize size) { return VmaNextPow2(size); }
|
||||||
|
|
||||||
|
@ -10687,9 +10686,10 @@ void VmaBlockMetadata_Buddy::Init(VkDeviceSize size)
|
||||||
m_SumFreeSize = m_UsableSize;
|
m_SumFreeSize = m_UsableSize;
|
||||||
|
|
||||||
// Calculate m_LevelCount.
|
// Calculate m_LevelCount.
|
||||||
|
const VkDeviceSize minNodeSize = IsVirtual() ? 1 : 16;
|
||||||
m_LevelCount = 1;
|
m_LevelCount = 1;
|
||||||
while(m_LevelCount < MAX_LEVELS &&
|
while(m_LevelCount < MAX_LEVELS &&
|
||||||
LevelToNodeSize(m_LevelCount) >= MIN_NODE_SIZE)
|
LevelToNodeSize(m_LevelCount) >= minNodeSize)
|
||||||
{
|
{
|
||||||
++m_LevelCount;
|
++m_LevelCount;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue