summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-09-14 09:53:21 +0200
committerGitHub <noreply@github.com>2019-09-14 09:53:21 +0200
commitdaae327e864e169e6795d1ac313a87b32360c21e (patch)
treed5c5c1fe02c83277de883c77b7c342b7f1370648
parentMerge pull request #2858 from ReinUsesLisp/vk-device (diff)
parentvideo_core/surface: Add function to detect sRGB surfaces (diff)
downloadyuzu-daae327e864e169e6795d1ac313a87b32360c21e.tar
yuzu-daae327e864e169e6795d1ac313a87b32360c21e.tar.gz
yuzu-daae327e864e169e6795d1ac313a87b32360c21e.tar.bz2
yuzu-daae327e864e169e6795d1ac313a87b32360c21e.tar.lz
yuzu-daae327e864e169e6795d1ac313a87b32360c21e.tar.xz
yuzu-daae327e864e169e6795d1ac313a87b32360c21e.tar.zst
yuzu-daae327e864e169e6795d1ac313a87b32360c21e.zip
-rw-r--r--src/video_core/surface.cpp20
-rw-r--r--src/video_core/surface.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp
index 4ceb219be..53d0142cb 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)};
}
diff --git a/src/video_core/surface.h b/src/video_core/surface.h
index 83f31c12c..19268b7cd 100644
--- a/src/video_core/surface.h
+++ b/src/video_core/surface.h
@@ -547,6 +547,8 @@ SurfaceType GetFormatType(PixelFormat pixel_format);
bool IsPixelFormatASTC(PixelFormat format);
+bool IsPixelFormatSRGB(PixelFormat format);
+
std::pair<u32, u32> GetASTCBlockSize(PixelFormat format);
/// Returns true if the specified PixelFormat is a BCn format, e.g. DXT or DXN