Skip to content

Commit bf0dacb

Browse files
[Impeller] match Skia's old VMA default block size. (flutter/engine#56368)
The unspecified default is 256 MiB which is ... big. 4Mb value is the default that Skia used to use, and results in less memory usage at least in local testing. benchmarks will determine if this has a positive or negative impact on performance. flutter#157497
1 parent 97d6176 commit bf0dacb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

engine/src/flutter/impeller/renderer/backend/vulkan/allocator_vk.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ static PoolVMA CreateBufferPool(VmaAllocator allocator) {
8484
VmaPoolCreateInfo pool_create_info = {};
8585
pool_create_info.memoryTypeIndex = memTypeIndex;
8686
pool_create_info.flags = VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT;
87+
pool_create_info.minBlockCount = 1;
8788

8889
VmaPool pool = {};
8990
result = vk::Result{::vmaCreatePool(allocator, &pool_create_info, &pool)};
@@ -144,6 +145,8 @@ AllocatorVK::AllocatorVK(std::weak_ptr<Context> context,
144145
allocator_info.physicalDevice = physical_device;
145146
allocator_info.device = device_holder->GetDevice();
146147
allocator_info.instance = instance;
148+
// 4 MB, matching the default used by Skia Vulkan.
149+
allocator_info.preferredLargeHeapBlockSize = 4 * 1024 * 1024;
147150
allocator_info.pVulkanFunctions = &proc_table;
148151

149152
VmaAllocator allocator = {};

0 commit comments

Comments
 (0)