diff options
| author | 2019-09-13 00:17:26 -0300 | |
|---|---|---|
| committer | 2019-09-13 00:27:04 -0300 | |
| commit | 99e23bd0fdb705903f83e7cd5bb4222a2ce5c542 (patch) | |
| tree | c87bb539ac697b54dfe78e8aa2dda8aa3171b4fb /src | |
| parent | Merge pull request #2823 from ReinUsesLisp/shr-clamp (diff) | |
| download | yuzu-99e23bd0fdb705903f83e7cd5bb4222a2ce5c542.tar.gz yuzu-99e23bd0fdb705903f83e7cd5bb4222a2ce5c542.tar.xz yuzu-99e23bd0fdb705903f83e7cd5bb4222a2ce5c542.zip | |
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')
| -rw-r--r-- | src/video_core/surface.cpp | 20 | ||||
| -rw-r--r-- | src/video_core/surface.h | 2 |
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) { | |||
| 513 | } | 513 | } |
| 514 | } | 514 | } |
| 515 | 515 | ||
| 516 | bool IsPixelFormatSRGB(PixelFormat format) { | ||
| 517 | switch (format) { | ||
| 518 | case PixelFormat::RGBA8_SRGB: | ||
| 519 | case PixelFormat::BGRA8_SRGB: | ||
| 520 | case PixelFormat::DXT1_SRGB: | ||
| 521 | case PixelFormat::DXT23_SRGB: | ||
| 522 | case PixelFormat::DXT45_SRGB: | ||
| 523 | case PixelFormat::BC7U_SRGB: | ||
| 524 | case PixelFormat::ASTC_2D_4X4_SRGB: | ||
| 525 | case PixelFormat::ASTC_2D_8X8_SRGB: | ||
| 526 | case PixelFormat::ASTC_2D_8X5_SRGB: | ||
| 527 | case PixelFormat::ASTC_2D_5X4_SRGB: | ||
| 528 | case PixelFormat::ASTC_2D_5X5_SRGB: | ||
| 529 | case PixelFormat::ASTC_2D_10X8_SRGB: | ||
| 530 | return true; | ||
| 531 | default: | ||
| 532 | return false; | ||
| 533 | } | ||
| 534 | } | ||
| 535 | |||
| 516 | std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) { | 536 | std::pair<u32, u32> GetASTCBlockSize(PixelFormat format) { |
| 517 | return {GetDefaultBlockWidth(format), GetDefaultBlockHeight(format)}; | 537 | return {GetDefaultBlockWidth(format), GetDefaultBlockHeight(format)}; |
| 518 | } | 538 | } |
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); | |||
| 547 | 547 | ||
| 548 | bool IsPixelFormatASTC(PixelFormat format); | 548 | bool IsPixelFormatASTC(PixelFormat format); |
| 549 | 549 | ||
| 550 | bool IsPixelFormatSRGB(PixelFormat format); | ||
| 551 | |||
| 550 | std::pair<u32, u32> GetASTCBlockSize(PixelFormat format); | 552 | std::pair<u32, u32> GetASTCBlockSize(PixelFormat format); |
| 551 | 553 | ||
| 552 | /// Returns true if the specified PixelFormat is a BCn format, e.g. DXT or DXN | 554 | /// Returns true if the specified PixelFormat is a BCn format, e.g. DXT or DXN |