/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ #include "DataFormat.hpp" #include namespace openVulkanoCpp { std::string_view DataFormat::GetName() const { return magic_enum::enum_name(m_format); } DataFormat DataFormat::GetFromName(std::string_view name) { auto result = magic_enum::enum_cast(name); if (result.has_value()) return { result.value() }; return { UNDEFINED }; } bool DataFormat::IsSRGB() const { return m_format == R8_SRGB || m_format == R8G8_SRGB || m_format == R8G8B8_SRGB || m_format == B8G8R8_SRGB || m_format == B8G8R8A8_SRGB || m_format == R8G8B8A8_SRGB || m_format == A8B8G8R8_SRGB_PACK32 || m_format == BC1_RGB_SRGB_BLOCK || m_format == BC1_RGBA_SRGB_BLOCK || m_format == BC2_SRGB_BLOCK || m_format == BC3_SRGB_BLOCK || m_format == BC7_SRGB_BLOCK || m_format == ETC2_R8G8B8_SRGB_BLOCK || m_format == ETC2_R8G8B8A1_SRGB_BLOCK || m_format == ETC2_R8G8B8A8_SRGB_BLOCK || (m_format >= ASTC_4x4_SRGB_BLOCK && m_format <= ASTC_12x12_SRGB_BLOCK && !(m_format & 1)) || (m_format >= PVRTC1_2BPP_SRGB_BLOCK_IMG && m_format <= PVRTC2_4BPP_SRGB_BLOCK_IMG); } }