Lluvia
ll::ImageDescriptor Class Reference

Stores all relevant information for creating ll::Image objects. More...

#include <ImageDescriptor.h>

Public Member Functions

 ImageDescriptor ()=default
 
 ImageDescriptor (const ImageDescriptor &descriptor)=default
 
 ImageDescriptor (ImageDescriptor &&descriptor)=default
 
 ImageDescriptor (const uint32_t depth, const uint32_t height, const uint32_t width, const ll::ChannelCount channelCount, const ll::ChannelType channelType)
 Constructs the object. More...
 
 ImageDescriptor (const uint32_t depth, const uint32_t height, const uint32_t width, const ll::ChannelCount channelCount, const ll::ChannelType channelType, const ll::ImageUsageFlags usageFlags, const ll::ImageTiling tiling)
 Constructs the object. More...
 
 ~ImageDescriptor ()=default
 
ImageDescriptoroperator= (const ImageDescriptor &descriptor)=default
 
ImageDescriptoroperator= (ImageDescriptor &&descriptor)=default
 
ImageDescriptorsetChannelType (const ll::ChannelType type) noexcept
 Sets the channel type. More...
 
ImageDescriptorsetChannelCount (const ll::ChannelCount count) noexcept
 Sets the channel count. More...
 
ImageDescriptorsetWidth (const uint32_t width) noexcept
 Sets the width. More...
 
ImageDescriptorsetHeight (const uint32_t height) noexcept
 Sets the height. More...
 
ImageDescriptorsetDepth (const uint32_t depth) noexcept
 Sets the depth. More...
 
ImageDescriptorsetShape (const ll::vec3ui &shape) noexcept
 Sets the image shape. More...
 
ImageDescriptorsetUsageFlags (const ll::ImageUsageFlags flags) noexcept
 Sets the usage flags. More...
 
ImageDescriptorsetUsageFlagsUnsafe (const uint32_t flags) noexcept
 Sets the usage flags from an integer type. More...
 
ImageDescriptorsetTiling (const ll::ImageTiling tTiling) noexcept
 Sets the vulkan image tiling. More...
 
ll::ChannelType getChannelType () const noexcept
 Gets the channel type. More...
 
template<typename T = ll::ChannelCount>
getChannelCount () const noexcept
 Gets the channel count. More...
 
uint32_t getWidth () const noexcept
 Gets the image width in pixels. More...
 
uint32_t getHeight () const noexcept
 Gets the image height in pixels. More...
 
uint32_t getDepth () const noexcept
 Gets the image depth in pixels. More...
 
uint64_t getSize () const noexcept
 Gets the size in bytes required to store the image. More...
 
ll::vec3ui getShape () const noexcept
 Gets the shape of the image. More...
 
vk::ImageType getImageType () const noexcept
 Gets the Vulkan image type. More...
 
vk::Format getFormat () const noexcept
 Gets the corresponding Vulkan image format. More...
 
ll::ImageUsageFlags getUsageFlags () const noexcept
 Gets the Vulkan image usage flags. More...
 
ll::ImageTiling getTiling () const noexcept
 Gets the vulkan image tiling. More...
 
uint32_t getUsageFlagsUnsafe () const noexcept
 Gets the usage flags casted to an integer type. More...
 

Detailed Description

Stores all relevant information for creating ll::Image objects.

The following code creates a descriptor for an 4-channel image with 640x480 pixel resolution and 8-bit unsigned int channel type.

auto desc = ll::ImageDescriptor{}
.setWidth(640)
.setHeight(480)
Stores all relevant information for creating ll::Image objects.
Definition: ImageDescriptor.h:189
ImageDescriptor & setHeight(const uint32_t height) noexcept
Sets the height.
ImageDescriptor & setWidth(const uint32_t width) noexcept
Sets the width.
ImageDescriptor & setChannelType(const ll::ChannelType type) noexcept
Sets the channel type.
ImageDescriptor & setChannelCount(const ll::ChannelCount count) noexcept
Sets the channel count.

Constructor & Destructor Documentation

◆ ImageDescriptor() [1/5]

ll::ImageDescriptor::ImageDescriptor ( )
default

◆ ImageDescriptor() [2/5]

ll::ImageDescriptor::ImageDescriptor ( const ImageDescriptor descriptor)
default

◆ ImageDescriptor() [3/5]

ll::ImageDescriptor::ImageDescriptor ( ImageDescriptor &&  descriptor)
default

◆ ImageDescriptor() [4/5]

ll::ImageDescriptor::ImageDescriptor ( const uint32_t  depth,
const uint32_t  height,
const uint32_t  width,
const ll::ChannelCount  channelCount,
const ll::ChannelType  channelType 
)

Constructs the object.

Parameters
[in]depthThe depth. It must be greater than zero.
[in]heightThe height. It must be greater than zero.
[in]widthThe width. It must be greater than zero.
[in]channelCountThe channel count. It must be between 1 and 4.
[in]channelTypeThe channel type.

◆ ImageDescriptor() [5/5]

ll::ImageDescriptor::ImageDescriptor ( const uint32_t  depth,
const uint32_t  height,
const uint32_t  width,
const ll::ChannelCount  channelCount,
const ll::ChannelType  channelType,
const ll::ImageUsageFlags  usageFlags,
const ll::ImageTiling  tiling 
)

Constructs the object.

Parameters
[in]depthThe depth. It must be greater than zero.
[in]heightThe height. It must be greater than zero.
[in]widthThe width. It must be greater than zero.
[in]channelCountThe channel count. It must be between 1 and 4.
[in]channelTypeThe channel type.
[in]usageFlagsThe usage flags. See https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkImageUsageFlagBits.
[in]tilingThe image tiling. See https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkImageTiling.

◆ ~ImageDescriptor()

ll::ImageDescriptor::~ImageDescriptor ( )
default

Member Function Documentation

◆ getChannelCount()

template<typename T = ll::ChannelCount>
T ll::ImageDescriptor::getChannelCount ( ) const
inlinenoexcept

Gets the channel count.

Template Parameters
TType of the return value. Defaults to ll::ChannelCount.
Returns
The channel count.

◆ getChannelType()

ll::ChannelType ll::ImageDescriptor::getChannelType ( ) const
noexcept

Gets the channel type.

Returns
The channel type.

◆ getDepth()

uint32_t ll::ImageDescriptor::getDepth ( ) const
noexcept

Gets the image depth in pixels.

Returns
The image depth in pixels.

◆ getFormat()

vk::Format ll::ImageDescriptor::getFormat ( ) const
noexcept

Gets the corresponding Vulkan image format.

The format is computed using the channel count and the channel type.

See https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#_vkformat_3.

Returns
The format.

◆ getHeight()

uint32_t ll::ImageDescriptor::getHeight ( ) const
noexcept

Gets the image height in pixels.

Returns
The image height in pixels.

◆ getImageType()

vk::ImageType ll::ImageDescriptor::getImageType ( ) const
noexcept

Gets the Vulkan image type.

It is implemented as:

if (getHeight() == 1) return vk::ImageType::e1D;
if (getDepth() == 1) return vk::ImageType::e2D;
return vk::ImageType::e3D;
uint32_t getHeight() const noexcept
Gets the image height in pixels.
uint32_t getDepth() const noexcept
Gets the image depth in pixels.
Returns
The image type.

◆ getShape()

ll::vec3ui ll::ImageDescriptor::getShape ( ) const
noexcept

Gets the shape of the image.

The vec3ui object returned must be interpreted as follows:

x : width
y : height
z : depth
Returns
The shape.

◆ getSize()

uint64_t ll::ImageDescriptor::getSize ( ) const
noexcept

Gets the size in bytes required to store the image.

This value does not include any row padding needed to align one row of data to the required size by the device.

Returns
The size of the image in bytes.

◆ getTiling()

ll::ImageTiling ll::ImageDescriptor::getTiling ( ) const
noexcept

Gets the vulkan image tiling.

Returns
The image tiling.

◆ getUsageFlags()

ll::ImageUsageFlags ll::ImageDescriptor::getUsageFlags ( ) const
noexcept

Gets the Vulkan image usage flags.

See https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkImageUsageFlagBits for more information.

Returns
The usage flags.

◆ getUsageFlagsUnsafe()

uint32_t ll::ImageDescriptor::getUsageFlagsUnsafe ( ) const
noexcept

Gets the usage flags casted to an integer type.

Please do not use this method. It's for internal use only.

Returns
The usage flags unsafe.

◆ getWidth()

uint32_t ll::ImageDescriptor::getWidth ( ) const
noexcept

Gets the image width in pixels.

Returns
The image width in pixels.

◆ operator=() [1/2]

ImageDescriptor& ll::ImageDescriptor::operator= ( const ImageDescriptor descriptor)
default

◆ operator=() [2/2]

ImageDescriptor& ll::ImageDescriptor::operator= ( ImageDescriptor &&  descriptor)
default

◆ setChannelCount()

ImageDescriptor& ll::ImageDescriptor::setChannelCount ( const ll::ChannelCount  count)
noexcept

Sets the channel count.

Parameters
[in]countThe count. It must be between 1 and 4.
Returns
A reference to this object.

◆ setChannelType()

ImageDescriptor& ll::ImageDescriptor::setChannelType ( const ll::ChannelType  type)
noexcept

Sets the channel type.

Parameters
[in]typeThe channel type.
Returns
A reference to this object.

◆ setDepth()

ImageDescriptor& ll::ImageDescriptor::setDepth ( const uint32_t  depth)
noexcept

Sets the depth.

Parameters
[in]depthThe depth. It must be greater than zero.
Returns
A reference to this object.

◆ setHeight()

ImageDescriptor& ll::ImageDescriptor::setHeight ( const uint32_t  height)
noexcept

Sets the height.

Parameters
[in]heightThe height. It must be greater than zero.
Returns
A reference to this object.

◆ setShape()

ImageDescriptor& ll::ImageDescriptor::setShape ( const ll::vec3ui shape)
noexcept

Sets the image shape.

Parameters
[in]shapeThe shape. The components of this vector must be interpreted as:
x : width
y : height
z : depth
Returns
A reference to this object.

◆ setTiling()

ImageDescriptor& ll::ImageDescriptor::setTiling ( const ll::ImageTiling  tTiling)
noexcept

Sets the vulkan image tiling.

Parameters
[in]tTilingThe tiling
Returns
A reference to this object.

◆ setUsageFlags()

ImageDescriptor& ll::ImageDescriptor::setUsageFlags ( const ll::ImageUsageFlags  flags)
noexcept

Sets the usage flags.

Returns
A reference to this object.

◆ setUsageFlagsUnsafe()

ImageDescriptor& ll::ImageDescriptor::setUsageFlagsUnsafe ( const uint32_t  flags)
noexcept

Sets the usage flags from an integer type.

Please do not use this method. It's for internal use only.

Parameters
[in]flagsThe flags
Returns
A reference to this object

◆ setWidth()

ImageDescriptor& ll::ImageDescriptor::setWidth ( const uint32_t  width)
noexcept

Sets the width.

Parameters
[in]widthThe width. It must be greater than zero.
Returns
A reference to this object.

The documentation for this class was generated from the following file: