Lluvia
ImageView.h
Go to the documentation of this file.
1 
8 #ifndef LLUVIA_CORE_IMAGE_IMAGE_VIEW_H_
9 #define LLUVIA_CORE_IMAGE_IMAGE_VIEW_H_
10 
11 #include "lluvia/core/Object.h"
16 
17 #include <memory>
18 
20 
21 namespace ll {
22 
23 namespace vulkan {
24  class Device;
25 } // namespace vulkan
26 
27 class ComputeNode;
28 class Image;
29 class Memory;
30 class Session;
31 
149 class ImageView : public Object {
150 
151 public:
152  ImageView() = delete;
153  ImageView(const ImageView&) = delete;
154  ImageView(ImageView&&) = delete;
155 
157 
158  ImageView& operator=(const ImageView&) = delete;
160 
161  ll::ObjectType getType() const noexcept override;
162 
168  const std::shared_ptr<ll::Image>& getImage() const noexcept;
169 
175  const std::shared_ptr<ll::Memory>& getMemory() const noexcept;
176 
183 
195  uint64_t getSize() const noexcept;
196 
210  uint64_t getMinimumSize() const noexcept;
211 
217  const ll::ImageDescriptor& getImageDescriptor() const noexcept;
218 
227  ll::ImageUsageFlags getUsageFlags() const noexcept;
228 
236  uint32_t getUsageFlagsUnsafe() const noexcept;
237 
248  ll::ImageLayout getLayout() const noexcept;
249 
255  ll::ImageTiling getTiling() const noexcept;
256 
262  ll::ChannelType getChannelType() const noexcept;
263 
269  uint64_t getChannelTypeSize() const noexcept;
270 
278  template <typename T = ll::ChannelCount>
279  T getChannelCount() const noexcept
280  {
281  return this->m_image->getChannelCount<T>();
282  }
283 
289  uint32_t getWidth() const noexcept;
290 
296  uint32_t getHeight() const noexcept;
297 
303  uint32_t getDepth() const noexcept;
304 
316  ll::vec3ui getShape() const noexcept;
317 
323  const ll::ImageViewDescriptor& getDescriptor() const noexcept;
324 
334  void changeImageLayout(const ll::ImageLayout newLayout);
335 
344  void clear();
345 
356  void copyTo(ll::ImageView& dst);
357 
358 private:
359  ImageView(const std::shared_ptr<ll::vulkan::Device>& device,
360  const std::shared_ptr<ll::Image>& image,
361  const ll::ImageViewDescriptor& descriptor);
362 
363  ll::ImageViewDescriptor m_descriptor;
364 
365  vk::ImageView m_vkImageView;
366  vk::Sampler m_vkSampler;
367 
368  std::shared_ptr<ll::vulkan::Device> m_device;
369  std::shared_ptr<ll::Image> m_image;
370 
371  friend class Image;
372  friend class ComputeNode;
373 };
374 
375 } // namespace ll
376 
377 #endif /* LLUVIA_CORE_IMAGE_IMAGE_VIEW_H_ */
ImageDescriptor class and related enumerations.
ImageViewDescriptor class and related enumerations and methods.
Image class.
Structures and methods for storing memory allocation information.
Object class and related enums.
Class representing compute nodes.
Definition: ComputeNode.h:38
Stores all relevant information for creating ll::Image objects.
Definition: ImageDescriptor.h:189
Descriptor for ll::ImageView objects.
Definition: ImageViewDescriptor.h:41
Represents portions of a ll::Image to be sent as parameter to a GLSL shader.
Definition: ImageView.h:149
ll::ImageTiling getTiling() const noexcept
Gets the vulkan image tiling.
void changeImageLayout(const ll::ImageLayout newLayout)
Immediately changes the layout of the underlying ll::Image object.
uint64_t getSize() const noexcept
Gets the memory allocation size in bytes.
uint32_t getDepth() const noexcept
Gets the image view depth in pixels.
T getChannelCount() const noexcept
Gets the channel count.
Definition: ImageView.h:279
const std::shared_ptr< ll::Image > & getImage() const noexcept
Gets the parent ll::Image this object was created from.
ImageView()=delete
uint32_t getHeight() const noexcept
Gets the image view height in pixels.
void copyTo(ll::ImageView &dst)
Immediately copies the content of this image view into the destination.
uint64_t getChannelTypeSize() const noexcept
Gets the channel type size.
ll::vec3ui getShape() const noexcept
Gets the shape of the image view.
ImageView(const ImageView &)=delete
const std::shared_ptr< ll::Memory > & getMemory() const noexcept
Gets the memory the underlying ll::Image was allocated from.
ll::ChannelType getChannelType() const noexcept
Gets the channel type.
ImageView & operator=(ImageView &&)=delete
uint64_t getMinimumSize() const noexcept
Gets the minimum number of bytes to store the image contiguously in memory.
ll::MemoryAllocationInfo getAllocationInfo() const noexcept
Gets the allocation information of the underlying ll::Image object.
ImageView(ImageView &&)=delete
const ll::ImageViewDescriptor & getDescriptor() const noexcept
Gets the image view descriptor.
uint32_t getWidth() const noexcept
Gets the image view width in pixels.
ImageView & operator=(const ImageView &)=delete
ll::ObjectType getType() const noexcept override
Gets the object type.
const ll::ImageDescriptor & getImageDescriptor() const noexcept
Gets the image descriptor.
ll::ImageUsageFlags getUsageFlags() const noexcept
Gets the Vulkan image usage flags.
ll::ImageLayout getLayout() const noexcept
Gets the Vulkan image layout.
uint32_t getUsageFlagsUnsafe() const noexcept
Gets the usage flags casted to an integer type.
void clear()
Immediately clears the image pixels to zero.
Objects to manage images.
Definition: Image.h:74
Class to manage allocation of objects into a specific type of memory.
Definition: Memory.h:92
Base class for all types that can be used in computer shaders.
Definition: Object.h:94
Definition: Buffer.h:28
ImageLayout
Definition: ImageLayout.h:16
ObjectType
Object types.
Definition: Object.h:29
ChannelType
Supported image channel types.
Definition: ImageDescriptor.h:33
ImageTiling
Definition: ImageTiling.h:16
ChannelCount
Supported image channel count.
Definition: ImageDescriptor.h:53
Structure to hold the allocation information of objects in memory.
Definition: MemoryAllocationInfo.h:19