8 #ifndef LLUVIA_CORE_IMAGE_IMAGE_DESCRIPTOR_H_
9 #define LLUVIA_CORE_IMAGE_IMAGE_DESCRIPTOR_H_
21 #include <type_traits>
105 template <
typename T = std::
string>
111 template <
typename T = std::
string>
132 template <
typename T>
138 template <
typename T = u
int32_t>
141 static_assert(std::is_integral<T>::value,
"T must be an integral type.");
143 const auto casted =
static_cast<std::underlying_type<ll::ChannelCount>::type
>(c);
145 constexpr
const auto minValue =
static_cast<std::underlying_type<ll::ChannelCount>::type
>(
ll::ChannelCount::C1);
146 constexpr
const auto maxValue =
static_cast<std::underlying_type<ll::ChannelCount>::type
>(
ll::ChannelCount::C4);
149 casted < minValue || casted > maxValue,
151 "Error casting integral value " + std::to_string(c) +
" to ll::ChannelCount. " +
"Expected value must be within range [" + std::to_string(minValue) +
", " + std::to_string(maxValue) +
"].");
206 const uint32_t height,
207 const uint32_t width,
223 const uint32_t height,
224 const uint32_t width,
338 return static_cast<T
>(m_channelCount);
Stores all relevant information for creating ll::Image objects.
Definition: ImageDescriptor.h:189
ll::ImageTiling getTiling() const noexcept
Gets the vulkan image tiling.
ImageDescriptor & setHeight(const uint32_t height) noexcept
Sets the height.
uint32_t getUsageFlagsUnsafe() const noexcept
Gets the usage flags casted to an integer type.
ImageDescriptor & setWidth(const uint32_t width) noexcept
Sets the width.
ImageDescriptor & operator=(ImageDescriptor &&descriptor)=default
vk::ImageType getImageType() const noexcept
Gets the Vulkan image type.
ImageDescriptor & setTiling(const ll::ImageTiling tTiling) noexcept
Sets the vulkan image tiling.
ll::ChannelType getChannelType() const noexcept
Gets the channel type.
ImageDescriptor & operator=(const ImageDescriptor &descriptor)=default
ImageDescriptor(const ImageDescriptor &descriptor)=default
ImageDescriptor & setChannelType(const ll::ChannelType type) noexcept
Sets the channel type.
ImageDescriptor & setUsageFlagsUnsafe(const uint32_t flags) noexcept
Sets the usage flags from an integer type.
uint32_t getHeight() const noexcept
Gets the image height in pixels.
ImageDescriptor(const uint32_t depth, const uint32_t height, const uint32_t width, const ll::ChannelCount channelCount, const ll::ChannelType channelType)
Constructs the object.
ImageDescriptor(ImageDescriptor &&descriptor)=default
uint32_t getDepth() const noexcept
Gets the image depth in pixels.
ImageDescriptor & setDepth(const uint32_t depth) noexcept
Sets the depth.
~ImageDescriptor()=default
uint64_t getSize() const noexcept
Gets the size in bytes required to store the image.
ImageDescriptor & setShape(const ll::vec3ui &shape) noexcept
Sets the image shape.
ImageDescriptor()=default
uint32_t getWidth() const noexcept
Gets the image width in pixels.
ImageDescriptor & setChannelCount(const ll::ChannelCount count) noexcept
Sets the channel count.
ImageDescriptor & setUsageFlags(const ll::ImageUsageFlags flags) noexcept
Sets the usage flags.
ll::vec3ui getShape() const noexcept
Gets the shape of the image.
vk::Format getFormat() const noexcept
Gets the corresponding Vulkan image format.
T getChannelCount() const noexcept
Gets the channel count.
Definition: ImageDescriptor.h:336
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.
ll::ImageUsageFlags getUsageFlags() const noexcept
Gets the Vulkan image usage flags.
error related classes and methods.
constexpr const std::array< std::tuple< const char *, ll::ChannelType >, 11 > ChannelTypeStrings
Channel type string values used for converting ll::ChannelType to std::string and vice-versa.
Definition: ImageDescriptor.h:67
E stringToEnum(T &&stringValue)
Definition: enums.h:172
std::string enumToString(E &&value) noexcept
Definition: enums.h:146
constexpr const std::array< std::tuple< const char *, ll::ChannelCount >, 4 > ChannelCountStrings
Channel type string values used for converting ll::ChannelType to std::string and vice-versa.
Definition: ImageDescriptor.h:89
ChannelType
Supported image channel types.
Definition: ImageDescriptor.h:33
ll::ChannelType stringToChannelType(T &&stringValue)
Converts from a string-like object to ll::ChannelType enum.
Definition: ImageDescriptor.h:133
void throwSystemErrorIf(bool condition, ll::ErrorCode errorCode, T &&msg)
Throws a std::system_error exception if the condition passed is true.
Definition: error.h:153
ImageTiling
Definition: ImageTiling.h:16
vk::Format getVulkanImageFormat(ll::ChannelCount channelCount, ll::ChannelType channelType) noexcept
Gets the vulkan image format for a given channel count and type.
ChannelCount
Supported image channel count.
Definition: ImageDescriptor.h:53
T channelTypeToString(ll::ChannelType &&value) noexcept
Converts from ll::ChannelType enum value to std::string.
Definition: ImageDescriptor.h:106
ll::ChannelCount castChannelCount(T c)
Definition: ImageDescriptor.h:139
uint32_t enum_t
Definition: enums.h:23
uint64_t getChannelTypeSize(ll::ChannelType type)
Gets size in bytes of a given channel type.