Midnight Graphics
Create Fast and Simple Graphics in C++
Command.hpp
1 #pragma once
2 
3 #include <Def.hpp>
4 
5 #include "../Image.hpp"
6 
7 namespace mn::Graphics
8 {
9  struct Buffer;
10 }
11 
12 namespace mn::Graphics::Backend
13 {
14  struct CommandBuffer;
15  struct Fence;
16 
17  struct CommandPool
18  {
19  CommandPool();
20  ~CommandPool();
21 
22  CommandPool(const CommandPool&) = delete;
23  CommandPool(CommandPool&&) = default;
24 
25  void reset() const;
26  std::unique_ptr<CommandBuffer> allocateBuffer() const;
27 
28  private:
29  Handle<CommandPool> handle;
30  };
31 
33  {
34  friend struct CommandPool;
35 
36  CommandBuffer(const CommandBuffer&) = delete;
37  CommandBuffer(CommandBuffer&&) = default;
38 
39  void begin(bool one_time = true) const;
40  void end() const;
41  void reset() const;
42 
43  auto getHandle() const { return handle; }
44  void submit(std::shared_ptr<Fence> fence) const;
45  void bufferToImage(std::shared_ptr<Buffer> buffer, const Image::Attachment& image) const;
46 
47  private:
49 
50  Handle<CommandBuffer> handle;
51  };
52 }
Definition: Command.hpp:33
Definition: Command.hpp:18
Definition: Image.hpp:21
Definition: TypedHandle.hpp:9