Finality Engine
Loading...
Searching...
No Matches
VKDeletionQueue.h
Go to the documentation of this file.
1
6#pragma once
7#include <functional>
8#include <vector>
9
10namespace FINALITY
11{
14 {
15 public:
16 VKDeletionQueue() = default;
17 void Push(std::function<void()>&& cleanupFunc)
18 {
19 m_Deletions.push_back(std::move(cleanupFunc));
20 }
21
22 void Flush()
23 {
24 while (!m_Deletions.empty())
25 {
26 auto pending = std::move(m_Deletions);
27 m_Deletions.clear();
28 for (auto it = pending.rbegin(); it != pending.rend(); ++it) (*it)();
29 }
30 }
31
32 private:
33 std::vector<std::function<void()>> m_Deletions;
34 };
35}
void Push(std::function< void()> &&cleanupFunc)