Another fix in TestLinearAllocator

Closes #239
This commit is contained in:
Adam Sawicki 2022-02-18 11:46:15 +01:00
parent 3fd264ae1d
commit d00699f26d

View File

@ -3572,7 +3572,7 @@ static void TestLinearAllocator()
constexpr size_t maxBufCount = 100; constexpr size_t maxBufCount = 100;
std::vector<BufferInfo> bufInfo; std::vector<BufferInfo> bufInfo;
constexpr VkDeviceSize bufSizeMin = 32; constexpr VkDeviceSize bufSizeMin = 64;
constexpr VkDeviceSize bufSizeMax = 1024; constexpr VkDeviceSize bufSizeMax = 1024;
VmaAllocationInfo allocInfo; VmaAllocationInfo allocInfo;
VkDeviceSize prevOffset = 0; VkDeviceSize prevOffset = 0;
@ -3584,7 +3584,7 @@ static void TestLinearAllocator()
VkDeviceSize bufSumSize = 0; VkDeviceSize bufSumSize = 0;
for(size_t i = 0; i < maxBufCount; ++i) for(size_t i = 0; i < maxBufCount; ++i)
{ {
bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 32); bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 64);
BufferInfo newBufInfo; BufferInfo newBufInfo;
res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo, res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo,
&newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo); &newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo);
@ -3617,7 +3617,7 @@ static void TestLinearAllocator()
// Allocate number of buffers of varying size that surely fit into this block. // Allocate number of buffers of varying size that surely fit into this block.
for(size_t i = 0; i < maxBufCount; ++i) for(size_t i = 0; i < maxBufCount; ++i)
{ {
bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 32); bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 64);
BufferInfo newBufInfo; BufferInfo newBufInfo;
res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo, res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo,
&newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo); &newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo);
@ -3638,7 +3638,7 @@ static void TestLinearAllocator()
// Create some more // Create some more
for(size_t i = 0; i < maxBufCount / 5; ++i) for(size_t i = 0; i < maxBufCount / 5; ++i)
{ {
bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 32); bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 64);
BufferInfo newBufInfo; BufferInfo newBufInfo;
res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo, res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo,
&newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo); &newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo);
@ -3733,7 +3733,7 @@ static void TestLinearAllocator()
allocCreateInfo.flags |= VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT; allocCreateInfo.flags |= VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT;
else else
allocCreateInfo.flags &= ~VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT; allocCreateInfo.flags &= ~VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT;
bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 32); bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 64);
BufferInfo newBufInfo; BufferInfo newBufInfo;
res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo, res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo,
&newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo); &newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo);
@ -3768,7 +3768,7 @@ static void TestLinearAllocator()
allocCreateInfo.flags |= VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT; allocCreateInfo.flags |= VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT;
else else
allocCreateInfo.flags &= ~VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT; allocCreateInfo.flags &= ~VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT;
bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 32); bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 64);
BufferInfo newBufInfo; BufferInfo newBufInfo;
res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo, res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo,
&newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo); &newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo);
@ -3795,7 +3795,7 @@ static void TestLinearAllocator()
allocCreateInfo.flags |= VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT; allocCreateInfo.flags |= VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT;
else else
allocCreateInfo.flags &= ~VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT; allocCreateInfo.flags &= ~VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT;
bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 32); bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin), 64);
BufferInfo newBufInfo; BufferInfo newBufInfo;
res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo, res = vmaCreateBuffer(g_hAllocator, &bufCreateInfo, &allocCreateInfo,
&newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo); &newBufInfo.Buffer, &newBufInfo.Allocation, &allocInfo);