@@ -2716,18 +2716,20 @@ void TestDefragmentationIncrementalComplex()
2716
2716
std::vector<AllocInfo> additionalAllocations;
2717
2717
additionalAllocations.reserve (maxAdditionalAllocations);
2718
2718
2719
- #define MakeAdditionalAllocation () \
2720
- if (additionalAllocations.size () < maxAdditionalAllocations) \
2721
- { \
2722
- bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate () % (bufSizeMax - bufSizeMin), 16 ); \
2723
- bufCreateInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT; \
2724
- \
2725
- AllocInfo alloc; \
2726
- alloc.CreateBuffer (bufCreateInfo, allocCreateInfo); \
2727
- \
2728
- additionalAllocations.push_back (alloc); \
2729
- vmaSetAllocationUserData (g_hAllocator, alloc.m_Allocation , &additionalAllocations.back ()); \
2730
- }
2719
+ const auto makeAdditionalAllocation = [&]()
2720
+ {
2721
+ if (additionalAllocations.size () < maxAdditionalAllocations)
2722
+ {
2723
+ bufCreateInfo.size = align_up<VkDeviceSize>(bufSizeMin + rand.Generate () % (bufSizeMax - bufSizeMin), 16 );
2724
+ bufCreateInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
2725
+
2726
+ AllocInfo alloc;
2727
+ alloc.CreateBuffer (bufCreateInfo, allocCreateInfo);
2728
+
2729
+ additionalAllocations.push_back (alloc);
2730
+ vmaSetAllocationUserData (g_hAllocator, alloc.m_Allocation , &additionalAllocations.back ());
2731
+ }
2732
+ };
2731
2733
2732
2734
// Defragment using GPU only.
2733
2735
{
@@ -2738,12 +2740,12 @@ void TestDefragmentationIncrementalComplex()
2738
2740
VkResult res = vmaBeginDefragmentation (g_hAllocator, &defragInfo, &ctx);
2739
2741
TEST (res == VK_SUCCESS);
2740
2742
2741
- MakeAdditionalAllocation ();
2743
+ makeAdditionalAllocation ();
2742
2744
2743
2745
VmaDefragmentationPassMoveInfo pass = {};
2744
2746
while ((res = vmaBeginDefragmentationPass (g_hAllocator, ctx, &pass)) == VK_INCOMPLETE)
2745
2747
{
2746
- MakeAdditionalAllocation ();
2748
+ makeAdditionalAllocation ();
2747
2749
2748
2750
// Ignore data outside of test
2749
2751
for (uint32_t i = 0 ; i < pass.moveCount ; ++i)
@@ -2761,7 +2763,7 @@ void TestDefragmentationIncrementalComplex()
2761
2763
ProcessDefragmentationPass (pass);
2762
2764
EndSingleTimeCommands ();
2763
2765
2764
- MakeAdditionalAllocation ();
2766
+ makeAdditionalAllocation ();
2765
2767
2766
2768
// Destroy old buffers/images and replace them with new handles.
2767
2769
for (size_t i = 0 ; i < pass.moveCount ; ++i)
@@ -2796,7 +2798,7 @@ void TestDefragmentationIncrementalComplex()
2796
2798
break ;
2797
2799
TEST (res == VK_INCOMPLETE);
2798
2800
2799
- MakeAdditionalAllocation ();
2801
+ makeAdditionalAllocation ();
2800
2802
}
2801
2803
2802
2804
TEST (res == VK_SUCCESS);
0 commit comments