Lugdunum  0.1.0
SubBuffer.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 #include <cstdlib>
5 
7 
8 namespace lug {
9 namespace Graphics {
10 namespace Vulkan {
11 
12 namespace API {
13 class Buffer;
14 } // API
15 
16 namespace Render {
17 namespace BufferPool {
18 
19 template <size_t subBufferPerChunk, size_t subBufferSize>
20 class BufferPool;
21 
22 template <size_t subBufferPerChunk, size_t subBufferSize>
23 class Chunk;
24 
26  template <size_t subBufferPerChunk, size_t subBufferSize>
27  friend class BufferPool;
28 
29  template <size_t subBufferPerChunk, size_t subBufferSize>
30  friend class Chunk;
31 
32 public:
33  SubBuffer() = default;
34  SubBuffer(const API::Buffer* buffer, uint32_t offset, uint32_t size);
35 
36  SubBuffer(const SubBuffer&) = delete;
37  SubBuffer(SubBuffer&&) = default;
38 
39  SubBuffer& operator=(const SubBuffer&) = delete;
40  SubBuffer& operator=(SubBuffer&&) = default;
41 
42  ~SubBuffer() = default;
43 
44  const API::Buffer* getBuffer() const;
45  uint32_t getOffset() const;
46  uint32_t getSize() const;
47 
48  size_t getHash() const;
49  void setHash(size_t hash);
50 
51 private:
52  const API::Buffer* _buffer{nullptr};
53  uint32_t _offset{0};
54  uint32_t _size{0};
55 
56  size_t _hash{0};
57  uint32_t _referenceCount{0};
58 };
59 
61 
62 } // BufferPool
63 } // Render
64 } // Vulkan
65 } // Graphics
66 } // lug
#define LUG_GRAPHICS_API
Definition: Export.hpp:11