-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Allocate buffers out of a pool on the raster thread. #43564
Changes from 1 commit
8590d30
866761f
1a01926
c85a337
3947f81
b8bee47
9d4d44a
4efb6a8
10d29cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,9 +94,8 @@ AllocatorVK::AllocatorVK(std::weak_ptr<Context> context, | |
| return; | ||
| } | ||
| for (auto i = 0u; i < kPoolCount; i++) { | ||
| if (!CreateBufferPool(allocator, &staging_buffer_pools_[i])) { | ||
| return; | ||
| } | ||
| created_buffer_pools_ &= | ||
| CreateBufferPool(allocator, &staging_buffer_pools_[i]); | ||
| } | ||
| allocator_ = allocator; | ||
| supports_memoryless_textures_ = capabilities.SupportsMemorylessTextures(); | ||
|
|
@@ -192,7 +191,9 @@ static constexpr VkMemoryPropertyFlags ToVKTextureMemoryPropertyFlags( | |
| bool supports_memoryless_textures) { | ||
| switch (mode) { | ||
| case StorageMode::kHostVisible: | ||
| return VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; | ||
| return VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | | ||
|
||
| VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | | ||
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; | ||
| case StorageMode::kDevicePrivate: | ||
| return VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; | ||
| case StorageMode::kDeviceTransient: | ||
|
|
@@ -438,7 +439,7 @@ std::shared_ptr<DeviceBuffer> AllocatorVK::OnCreateBuffer( | |
| allocation_info.preferredFlags = | ||
| ToVKBufferMemoryPropertyFlags(desc.storage_mode); | ||
| allocation_info.flags = ToVmaAllocationBufferCreateFlags(desc.storage_mode); | ||
| if (desc.storage_mode == StorageMode::kHostVisible && | ||
| if (created_buffer_pools_ && desc.storage_mode == StorageMode::kHostVisible && | ||
| raster_thread_id_ == std::this_thread::get_id()) { | ||
| allocation_info.pool = staging_buffer_pools_[frame_count_ % kPoolCount]; | ||
| } | ||
|
|
@@ -487,9 +488,8 @@ bool AllocatorVK::CreateBufferPool(VmaAllocator allocator, VmaPool* pool) { | |
| allocation_info.usage = VMA_MEMORY_USAGE_AUTO; | ||
| allocation_info.preferredFlags = | ||
| ToVKBufferMemoryPropertyFlags(StorageMode::kHostVisible); | ||
| // TESTING | ||
| // allocation_info.flags = | ||
| // ToVmaAllocationBufferCreateFlags(StorageMode::kHostVisible); | ||
| allocation_info.flags = | ||
| ToVmaAllocationBufferCreateFlags(StorageMode::kHostVisible); | ||
|
|
||
| uint32_t memTypeIndex; | ||
| auto result = vk::Result{vmaFindMemoryTypeIndexForBufferInfo( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making this optional for now as the host unittests don't seem to be able to create the same buffer pools that real devices do.