diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-09-13 00:17:26 -0300 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-09-13 00:27:04 -0300 |
commit | 99e23bd0fdb705903f83e7cd5bb4222a2ce5c542 (patch) | |
tree | c87bb539ac697b54dfe78e8aa2dda8aa3171b4fb /src/video_core/surface.cpp | |
parent | 34b2c60f95c964354f00546385684fc9c8726d76 (diff) |
video_core/surface: Add function to detect sRGB surfaces
This is required for proper conversion to RGBA8_UNORM or RGBA8_SRGB
surfaces when a backend can target both native and converted ASTC.
Diffstat (limited to 'src/video_core/surface.cpp')
-rw-r--r-- | src/video_core/surface.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index 4ceb219be4..53d0142cb1 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp @@ -513,6 +513,26 @@ bool IsPixelFormatASTC(PixelFormat format) { } } +bool IsPixelFormatSRGB(PixelFormat format) { + switch (format) { + case PixelFormat::RGBA8_SRGB: + case PixelFormat::BGRA8_SRGB: + case PixelFormat::DXT1_SRGB: + case PixelFormat::DXT23_SRGB: + case PixelFormat::DXT45_SRGB: + case PixelFormat::BC7U_SRGB: + case PixelFormat::ASTC_2D_4X4_SRGB: + case PixelFormat::ASTC_2D_8X8_SRGB: + case PixelFormat::ASTC_2D_8X5_SRGB: + case PixelFormat::ASTC_2D_5X4_SRGB: + case PixelFormat::ASTC_2D_5X5_SRGB: + case PixelFormat::ASTC_2D_10X8_SRGB: + return true; + default: + return false; + } +} + std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) { return {GetDefaultBlockWidth(format), GetDefaultBlockHeight(format)}; } |