From 3c2ece3338ccc1ccdd34b51d960706ef938e2ce9 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Fri, 29 Jan 2021 03:23:11 +0100 Subject: [PATCH] Add IsSRGB check to DataFormat enum --- openVulkanoCpp/Scene/DataFormat.cpp | 11 +++++++++++ openVulkanoCpp/Scene/DataFormat.hpp | 2 ++ 2 files changed, 13 insertions(+) diff --git a/openVulkanoCpp/Scene/DataFormat.cpp b/openVulkanoCpp/Scene/DataFormat.cpp index 9a39da5..78f68f3 100644 --- a/openVulkanoCpp/Scene/DataFormat.cpp +++ b/openVulkanoCpp/Scene/DataFormat.cpp @@ -20,4 +20,15 @@ namespace openVulkanoCpp 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); + } } \ No newline at end of file diff --git a/openVulkanoCpp/Scene/DataFormat.hpp b/openVulkanoCpp/Scene/DataFormat.hpp index 79c991e..355d676 100644 --- a/openVulkanoCpp/Scene/DataFormat.hpp +++ b/openVulkanoCpp/Scene/DataFormat.hpp @@ -335,6 +335,8 @@ namespace openVulkanoCpp [[nodiscard]] std::string_view GetName() const; + [[nodiscard]] bool IsSRGB() const; + [[nodiscard]] bool operator ==(Format rhs) { return m_format == rhs;