Lugdunum  0.1.0
BufferPool.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <list>
4 #include <map>
5 #include <set>
6 
9 
10 namespace lug {
11 namespace Graphics {
12 namespace Vulkan {
13 
14 class Renderer;
15 
16 namespace Render {
17 namespace BufferPool {
18 
19 template <size_t subBufferPerChunk, size_t subBufferSize>
21 public:
22  BufferPool(Renderer& renderer, std::set<uint32_t> queueFamilyIndices);
23 
24  BufferPool(const BufferPool&) = delete;
25  BufferPool(BufferPool&&) = delete;
26 
27  BufferPool& operator=(const BufferPool&) = delete;
28  BufferPool& operator=(BufferPool&&) = delete;
29 
30  ~BufferPool() = default;
31 
32  std::tuple<bool, const SubBuffer*> allocate(size_t hash, bool dirty);
33  void free(const SubBuffer* buffer);
34 
35 private:
36  SubBuffer* allocateNewBuffer();
37 
38 protected:
40  std::set<uint32_t> _queueFamilyIndices;
41 
42  std::list<Chunk<subBufferPerChunk, subBufferSize>> _chunks;
43  std::map<size_t, SubBuffer*> _subBuffersInUse;
44 };
45 
47 
48 } // BufferPool
49 } // Render
50 } // Vulkan
51 } // Graphics
52 } // lug
std::list< Chunk< subBufferPerChunk, subBufferSize > > _chunks
Definition: BufferPool.hpp:42
#define LUG_GRAPHICS_API
Definition: Export.hpp:11
std::map< size_t, SubBuffer * > _subBuffersInUse
Definition: BufferPool.hpp:43