Cleanup DataFormat
This commit is contained in:
@@ -225,7 +225,7 @@ namespace OpenVulkano
|
|||||||
return { UNDEFINED };
|
return { UNDEFINED };
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t DataFormat::GetBytesPerPixel()
|
uint32_t DataFormat::GetBytesPerPixel() const
|
||||||
{
|
{
|
||||||
auto size = FORMAT_SIZE_MAP.find(m_format);
|
auto size = FORMAT_SIZE_MAP.find(m_format);
|
||||||
if (size == FORMAT_SIZE_MAP.end() || size->second == 0) [[unlikely]]
|
if (size == FORMAT_SIZE_MAP.end() || size->second == 0) [[unlikely]]
|
||||||
@@ -236,7 +236,7 @@ namespace OpenVulkano
|
|||||||
return size->second;
|
return size->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataFormat::IsBlockCompressed()
|
bool DataFormat::IsBlockCompressed() const
|
||||||
{
|
{
|
||||||
for (auto format: magic_enum::enum_values<DataFormat::Format>())
|
for (auto format: magic_enum::enum_values<DataFormat::Format>())
|
||||||
{
|
{
|
||||||
@@ -249,7 +249,7 @@ namespace OpenVulkano
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t DataFormat::CalculatedSize(uint32_t& width, uint32_t& height)
|
size_t DataFormat::CalculatedSize(uint32_t& width, uint32_t& height) const
|
||||||
{
|
{
|
||||||
if (IsBlockCompressed())
|
if (IsBlockCompressed())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -336,7 +336,7 @@ namespace OpenVulkano
|
|||||||
|
|
||||||
constexpr DataFormat() : DataFormat(UNDEFINED) {}
|
constexpr DataFormat() : DataFormat(UNDEFINED) {}
|
||||||
|
|
||||||
constexpr DataFormat(Format format) : m_format(format) {}
|
constexpr DataFormat(const Format format) : m_format(format) {}
|
||||||
|
|
||||||
[[nodiscard]] std::string_view GetName() const;
|
[[nodiscard]] std::string_view GetName() const;
|
||||||
|
|
||||||
@@ -351,12 +351,12 @@ namespace OpenVulkano
|
|||||||
(m_format >= PVRTC1_2BPP_SRGB_BLOCK_IMG && m_format <= PVRTC2_4BPP_SRGB_BLOCK_IMG);
|
(m_format >= PVRTC1_2BPP_SRGB_BLOCK_IMG && m_format <= PVRTC2_4BPP_SRGB_BLOCK_IMG);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] constexpr bool operator ==(Format rhs)
|
[[nodiscard]] constexpr bool operator ==(Format rhs) const
|
||||||
{
|
{
|
||||||
return m_format == rhs;
|
return m_format == rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] constexpr bool operator !=(Format rhs)
|
[[nodiscard]] constexpr bool operator !=(Format rhs) const
|
||||||
{
|
{
|
||||||
return m_format != rhs;
|
return m_format != rhs;
|
||||||
}
|
}
|
||||||
@@ -377,11 +377,11 @@ namespace OpenVulkano
|
|||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t GetBytesPerPixel();
|
uint32_t GetBytesPerPixel() const;
|
||||||
|
|
||||||
bool IsBlockCompressed();
|
bool IsBlockCompressed() const;
|
||||||
|
|
||||||
size_t CalculatedSize(uint32_t& width, uint32_t& height);
|
size_t CalculatedSize(uint32_t& width, uint32_t& height) const;
|
||||||
|
|
||||||
static DataFormat GetFromName(std::string_view name);
|
static DataFormat GetFromName(std::string_view name);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user