MCPcopy Create free account
hub / github.com/comaps/comaps / EndDeallocationSession

Method EndDeallocationSession

libs/drape/vulkan/vulkan_memory_manager.cpp:280–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280void VulkanMemoryManager::EndDeallocationSession()
281{
282 if (!m_isInDeallocationSession)
283 return;
284
285 m_isInDeallocationSession = false;
286
287 for (size_t i = 0; i < kResourcesCount; ++i)
288 {
289 if (((m_deallocationSessionMask >> i) & 1) == 0)
290 continue;
291
292 auto & fm = m_freeBlocks[i];
293
294 static std::vector<uint64_t> hashesToDelete;
295 for (auto & p : m_memory[i])
296 {
297 auto & m = p.second;
298 m.erase(std::remove_if(m.begin(), m.end(),
299 [this, &fm, i](drape_ptr<MemoryBlock> & b)
300 {
301 if (b->m_allocationCounter != 0)
302 return false;
303
304 if (m_sizes[i] > kDesiredSizeInBytes[i])
305 {
306 CHECK_LESS_OR_EQUAL(b->m_blockSize, m_sizes[i], ());
307 m_sizes[i] -= b->m_blockSize;
308 DecrementTotalAllocationsCount();
309 vkFreeMemory(m_device, b->m_memory, nullptr);
310 }
311 else
312 {
313 auto block = std::move(b);
314 block->m_freeOffset = 0;
315 fm.push_back(std::move(block));
316 }
317 return true;
318 }),
319 m.end());
320
321 if (m.empty())
322 hashesToDelete.push_back(p.first);
323 }
324
325 for (auto hash : hashesToDelete)
326 m_memory[i].erase(hash);
327 hashesToDelete.clear();
328
329 std::sort(fm.begin(), fm.end(), LessBlockSize());
330 }
331}
332
333void VulkanMemoryManager::IncrementTotalAllocationsCount()
334{

Callers 1

CollectObjectsImplMethod · 0.80

Calls 7

LessBlockSizeClass · 0.85
eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected