mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-22 15:04:34 +00:00
Fix in VmaBlockMetadata_Linear::CreateAllocationRequest for too large allocations
Fixes #396 - thanks @dm-tesla
This commit is contained in:
parent
9b7687761a
commit
f1ab507d00
@ -7808,6 +7808,10 @@ bool VmaBlockMetadata_Linear::CreateAllocationRequest(
|
|||||||
VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);
|
VMA_ASSERT(allocType != VMA_SUBALLOCATION_TYPE_FREE);
|
||||||
VMA_ASSERT(pAllocationRequest != VMA_NULL);
|
VMA_ASSERT(pAllocationRequest != VMA_NULL);
|
||||||
VMA_HEAVY_ASSERT(Validate());
|
VMA_HEAVY_ASSERT(Validate());
|
||||||
|
|
||||||
|
if(allocSize > GetSize())
|
||||||
|
return false;
|
||||||
|
|
||||||
pAllocationRequest->size = allocSize;
|
pAllocationRequest->size = allocSize;
|
||||||
return upperAddress ?
|
return upperAddress ?
|
||||||
CreateAllocationRequest_UpperAddress(
|
CreateAllocationRequest_UpperAddress(
|
||||||
|
@ -3425,6 +3425,14 @@ static void TestVirtualBlocksAlgorithms()
|
|||||||
};
|
};
|
||||||
std::vector<AllocData> allocations;
|
std::vector<AllocData> allocations;
|
||||||
|
|
||||||
|
// Test too large allocation
|
||||||
|
{
|
||||||
|
VmaVirtualAllocationCreateInfo allocCreateInfo = {};
|
||||||
|
allocCreateInfo.size = blockCreateInfo.size * 2;
|
||||||
|
VmaVirtualAllocation alloc;
|
||||||
|
TEST(vmaVirtualAllocate(block, &allocCreateInfo, &alloc, nullptr) < 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Make some allocations
|
// Make some allocations
|
||||||
for(size_t i = 0; i < 20; ++i)
|
for(size_t i = 0; i < 20; ++i)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user