mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-10 10:41:52 +00:00
Minor refactoring in function VmaBlockMetadata_Generic::CreateAllocationRequest.
This commit is contained in:
parent
5df580a997
commit
5938c0e395
@ -7959,9 +7959,7 @@ bool VmaBlockMetadata_Generic::CreateAllocationRequest(
|
|||||||
{
|
{
|
||||||
// Brute-force algorithm. TODO: Come up with something better.
|
// Brute-force algorithm. TODO: Come up with something better.
|
||||||
|
|
||||||
pAllocationRequest->sumFreeSize = VK_WHOLE_SIZE;
|
bool found = false;
|
||||||
pAllocationRequest->sumItemSize = VK_WHOLE_SIZE;
|
|
||||||
|
|
||||||
VmaAllocationRequest tmpAllocRequest = {};
|
VmaAllocationRequest tmpAllocRequest = {};
|
||||||
tmpAllocRequest.type = VmaAllocationRequestType::Normal;
|
tmpAllocRequest.type = VmaAllocationRequestType::Normal;
|
||||||
for(VmaSuballocationList::iterator suballocIt = m_Suballocations.begin();
|
for(VmaSuballocationList::iterator suballocIt = m_Suballocations.begin();
|
||||||
@ -7985,21 +7983,23 @@ bool VmaBlockMetadata_Generic::CreateAllocationRequest(
|
|||||||
&tmpAllocRequest.sumFreeSize,
|
&tmpAllocRequest.sumFreeSize,
|
||||||
&tmpAllocRequest.sumItemSize))
|
&tmpAllocRequest.sumItemSize))
|
||||||
{
|
{
|
||||||
tmpAllocRequest.item = suballocIt;
|
if(strategy == VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT)
|
||||||
|
|
||||||
if(tmpAllocRequest.CalcCost() < pAllocationRequest->CalcCost() ||
|
|
||||||
strategy == VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT)
|
|
||||||
{
|
{
|
||||||
*pAllocationRequest = tmpAllocRequest;
|
*pAllocationRequest = tmpAllocRequest;
|
||||||
|
pAllocationRequest->item = suballocIt;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!found || tmpAllocRequest.CalcCost() < pAllocationRequest->CalcCost())
|
||||||
|
{
|
||||||
|
*pAllocationRequest = tmpAllocRequest;
|
||||||
|
pAllocationRequest->item = suballocIt;
|
||||||
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pAllocationRequest->sumItemSize != VK_WHOLE_SIZE)
|
return found;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user