Lluvia
CommandBuffer.h
Go to the documentation of this file.
1 
8 #ifndef LLUVIA_CORE_COMMAND_BUFFER_H_
9 #define LLUVIA_CORE_COMMAND_BUFFER_H_
10 
11 #include <memory>
12 
15 
16 namespace ll {
17 
18 namespace vulkan {
19  class Device;
20  class CommandPool;
21 } // namespace vulkan
22 
23 class Buffer;
24 class ComputeNode;
25 class ContainerNode;
26 class Duration;
27 class Image;
28 class ImageView;
29 class Session;
30 
64 
65 public:
66  CommandBuffer() = delete;
67  CommandBuffer(const CommandBuffer& cmdBuffer) = delete;
68  CommandBuffer(CommandBuffer&& cmdBuffer) = delete;
69 
70  CommandBuffer(const std::shared_ptr<ll::vulkan::Device>& device);
71 
73 
74  CommandBuffer& operator=(const CommandBuffer& cmdBuffer) = delete;
75  CommandBuffer& operator=(CommandBuffer&& cmdBuffer) = delete;
76 
77  const vk::CommandBuffer& getVkCommandBuffer() const noexcept;
78 
85  void begin();
86 
93  void end();
94 
100  void run(const ll::ComputeNode& node);
101 
107  void run(const ll::ContainerNode& node);
108 
119  void copyBuffer(const ll::Buffer& src, const ll::Buffer& dst);
120 
129  void copyBufferToImage(const ll::Buffer& src, const ll::Image& dst);
130 
139  void copyImageToBuffer(const ll::Image& src, const ll::Buffer& dst);
140 
147  void copyImageToImage(const ll::Image& src, const ll::Image& dst);
148 
162  void changeImageLayout(ll::Image& image, const ll::ImageLayout newLayout);
163 
177  void changeImageLayout(ll::ImageView& imageView, const ll::ImageLayout newLayout);
178 
185 
189  void clearImage(ll::Image& image);
190 
194  void clearImage(ll::ImageView& imageVide);
195 
201  void durationStart(ll::Duration& duration);
202 
208  void durationEnd(ll::Duration& duration);
209 
210 private:
211  vk::CommandBuffer m_commandBuffer;
212 
213  std::shared_ptr<ll::vulkan::Device> m_device;
214 };
215 
216 } // namespace ll
217 
218 #endif // LLUVIA_CORE_COMMAND_BUFFER_H_
ImageLayout enum.
Objects to manage raw portions of allocated memory.
Definition: Buffer.h:57
Class for command buffer.
Definition: CommandBuffer.h:63
void copyBufferToImage(const ll::Buffer &src, const ll::Image &dst)
Copies the content of src buffer into dst image.
void run(const ll::ComputeNode &node)
Records running a ll::ComputeNode.
CommandBuffer(const std::shared_ptr< ll::vulkan::Device > &device)
void copyBuffer(const ll::Buffer &src, const ll::Buffer &dst)
Copies src buffer into dst.
CommandBuffer(const CommandBuffer &cmdBuffer)=delete
CommandBuffer(CommandBuffer &&cmdBuffer)=delete
const vk::CommandBuffer & getVkCommandBuffer() const noexcept
void changeImageLayout(ll::Image &image, const ll::ImageLayout newLayout)
Change image layout.
void copyImageToBuffer(const ll::Image &src, const ll::Buffer &dst)
Copies the content of src image into dst buffer.
CommandBuffer & operator=(CommandBuffer &&cmdBuffer)=delete
void durationEnd(ll::Duration &duration)
Stops recording the elapsed time between two points.
void copyImageToImage(const ll::Image &src, const ll::Image &dst)
Copies the content of src image into dst image.
void end()
ends recording.
CommandBuffer()=delete
void durationStart(ll::Duration &duration)
Starts recording the elapsed time between two points.
CommandBuffer & operator=(const CommandBuffer &cmdBuffer)=delete
void begin()
begins recording.
void memoryBarrier()
Adds a memory barrier.
void clearImage(ll::Image &image)
Clears the pixels of an image to zero.
Class representing compute nodes.
Definition: ComputeNode.h:38
Definition: ContainerNode.h:24
Definition: Duration.h:22
Represents portions of a ll::Image to be sent as parameter to a GLSL shader.
Definition: ImageView.h:149
Objects to manage images.
Definition: Image.h:74
Class that contains all the state required to run compute operations on a compute device.
Definition: Session.h:51
Definition: Device.h:29
Definition: Buffer.h:28
ImageLayout
Definition: ImageLayout.h:16