Cleanup DataFormat

This commit is contained in:
Georg Hagen
2025-01-11 01:21:08 +01:00
parent 0eda1964e3
commit 6a3c31346f
2 changed files with 9 additions and 9 deletions

View File

@@ -225,7 +225,7 @@ namespace OpenVulkano
return { UNDEFINED };
}
uint32_t DataFormat::GetBytesPerPixel()
uint32_t DataFormat::GetBytesPerPixel() const
{
auto size = FORMAT_SIZE_MAP.find(m_format);
if (size == FORMAT_SIZE_MAP.end() || size->second == 0) [[unlikely]]
@@ -236,7 +236,7 @@ namespace OpenVulkano
return size->second;
}
bool DataFormat::IsBlockCompressed()
bool DataFormat::IsBlockCompressed() const
{
for (auto format: magic_enum::enum_values<DataFormat::Format>())
{
@@ -249,7 +249,7 @@ namespace OpenVulkano
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())
{

View File

@@ -336,7 +336,7 @@ namespace OpenVulkano
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;
@@ -351,12 +351,12 @@ namespace OpenVulkano
(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;
}
[[nodiscard]] constexpr bool operator !=(Format rhs)
[[nodiscard]] constexpr bool operator !=(Format rhs) const
{
return m_format != rhs;
}
@@ -377,11 +377,11 @@ namespace OpenVulkano
#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);