Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/drape
diff options
context:
space:
mode:
authorRoman Kuznetsov <r.kuznetsow@gmail.com>2019-02-18 22:54:28 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2019-03-01 10:45:24 +0300
commit55586aab65ec7d2630ed9a6f251872b1fe77863b (patch)
tree2c28dc7196ccb6937c15911f3ef7fac18d157dc0 /drape
parent3a8ae88a33255d5bbe22ba6d646fcf397cfe4e58 (diff)
[vulkan] Optimized collect object
Diffstat (limited to 'drape')
-rw-r--r--drape/vulkan/vulkan_object_manager.cpp47
1 files changed, 28 insertions, 19 deletions
diff --git a/drape/vulkan/vulkan_object_manager.cpp b/drape/vulkan/vulkan_object_manager.cpp
index f20705e6ad..d43d2bff3f 100644
--- a/drape/vulkan/vulkan_object_manager.cpp
+++ b/drape/vulkan/vulkan_object_manager.cpp
@@ -237,32 +237,41 @@ void VulkanObjectManager::DestroyDescriptorSetGroup(DescriptorSetGroup group)
void VulkanObjectManager::CollectObjects()
{
- std::lock_guard<std::mutex> lock(m_mutex);
- if (!m_queueToDestroy.empty())
+ std::vector<VulkanObject> queueToDestroy;
+ std::vector<DescriptorSetGroup> descriptorsToDestroy;
{
- m_memoryManager.BeginDeallocationSession();
- for (size_t i = 0; i < m_queueToDestroy.size(); ++i)
- {
- if (m_queueToDestroy[i].m_buffer != 0)
- vkDestroyBuffer(m_device, m_queueToDestroy[i].m_buffer, nullptr);
- if (m_queueToDestroy[i].m_imageView != 0)
- vkDestroyImageView(m_device, m_queueToDestroy[i].m_imageView, nullptr);
- if (m_queueToDestroy[i].m_image != 0)
- vkDestroyImage(m_device, m_queueToDestroy[i].m_image, nullptr);
-
- if (m_queueToDestroy[i].m_allocation)
- m_memoryManager.Deallocate(m_queueToDestroy[i].m_allocation);
- }
- m_memoryManager.EndDeallocationSession();
- m_queueToDestroy.clear();
+ std::lock_guard<std::mutex> lock(m_mutex);
+ std::swap(m_queueToDestroy, queueToDestroy);
+ std::swap(m_descriptorsToDestroy, descriptorsToDestroy);
}
- for (auto const & d : m_descriptorsToDestroy)
+ for (auto const & d : descriptorsToDestroy)
{
CHECK_VK_CALL(vkFreeDescriptorSets(m_device, d.m_descriptorPool,
1 /* count */, &d.m_descriptorSet));
}
- m_descriptorsToDestroy.clear();
+
+ if (!queueToDestroy.empty())
+ {
+ for (size_t i = 0; i < queueToDestroy.size(); ++i)
+ {
+ if (queueToDestroy[i].m_buffer != 0)
+ vkDestroyBuffer(m_device, queueToDestroy[i].m_buffer, nullptr);
+ if (queueToDestroy[i].m_imageView != 0)
+ vkDestroyImageView(m_device, queueToDestroy[i].m_imageView, nullptr);
+ if (queueToDestroy[i].m_image != 0)
+ vkDestroyImage(m_device, queueToDestroy[i].m_image, nullptr);
+ }
+
+ std::lock_guard<std::mutex> lock(m_mutex);
+ m_memoryManager.BeginDeallocationSession();
+ for (size_t i = 0; i < queueToDestroy.size(); ++i)
+ {
+ if (queueToDestroy[i].m_allocation)
+ m_memoryManager.Deallocate(queueToDestroy[i].m_allocation);
+ }
+ m_memoryManager.EndDeallocationSession();
+ }
}
uint8_t * VulkanObjectManager::MapUnsafe(VulkanObject object)