diff options
| author | Sam Belliveau <sam.belliveau@gmail.com> | 2024-03-10 03:25:33 -0400 |
|---|---|---|
| committer | Sam Belliveau <sam.belliveau@gmail.com> | 2024-03-10 03:25:33 -0400 |
| commit | 153d0201a80cb5eec84239396a1d66efc04833fd (patch) | |
| tree | 4b7bb5d00d6c5003db9dfcd52565d9a41e34845e /Source/Core/VideoBackends | |
| parent | f3d1cda67206d3049a2fd518d597df394b2489be (diff) | |
Add HDR to Metal
Diffstat (limited to 'Source/Core/VideoBackends')
| -rw-r--r-- | Source/Core/VideoBackends/Metal/MTLMain.mm | 15 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/Metal/MTLUtil.h | 2 | ||||
| -rw-r--r-- | Source/Core/VideoBackends/Metal/MTLUtil.mm | 2 |
3 files changed, 19 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/Metal/MTLMain.mm b/Source/Core/VideoBackends/Metal/MTLMain.mm index cddb8f1c7c..56c9b3c68f 100644 --- a/Source/Core/VideoBackends/Metal/MTLMain.mm +++ b/Source/Core/VideoBackends/Metal/MTLMain.mm @@ -164,8 +164,23 @@ void Metal::VideoBackend::PrepareWindow(WindowSystemInfo& wsi) return; NSView* view = static_cast<NSView*>(wsi.render_surface); CAMetalLayer* layer = [CAMetalLayer layer]; + + Util::PopulateBackendInfo(&g_Config); + + if (g_Config.backend_info.bSupportsHDROutput && g_Config.bHDR) + { + [layer setWantsExtendedDynamicRangeContent:YES]; + [layer setPixelFormat:MTLPixelFormatRGBA16Float]; + + const CFStringRef name = kCGColorSpaceExtendedLinearSRGB; + CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(name); + [layer setColorspace:colorspace]; + CGColorSpaceRelease(colorspace); + } + [view setWantsLayer:YES]; [view setLayer:layer]; + wsi.render_surface = layer; #endif } diff --git a/Source/Core/VideoBackends/Metal/MTLUtil.h b/Source/Core/VideoBackends/Metal/MTLUtil.h index 28fb57cb0b..a5663b5e35 100644 --- a/Source/Core/VideoBackends/Metal/MTLUtil.h +++ b/Source/Core/VideoBackends/Metal/MTLUtil.h @@ -3,7 +3,9 @@ #pragma once +#include <AppKit/NSScreen.h> #include <Metal/Metal.h> + #include <vector> #include "VideoCommon/AbstractShader.h" diff --git a/Source/Core/VideoBackends/Metal/MTLUtil.mm b/Source/Core/VideoBackends/Metal/MTLUtil.mm index c7a5c82e34..6ebe745ee6 100644 --- a/Source/Core/VideoBackends/Metal/MTLUtil.mm +++ b/Source/Core/VideoBackends/Metal/MTLUtil.mm @@ -77,6 +77,8 @@ void Metal::Util::PopulateBackendInfo(VideoConfig* config) config->backend_info.bSupportsPartialMultisampleResolve = false; config->backend_info.bSupportsDynamicVertexLoader = true; config->backend_info.bSupportsVSLinePointExpand = true; + config->backend_info.bSupportsHDROutput = + 1.0 < [[NSScreen deepestScreen] maximumPotentialExtendedDynamicRangeColorComponentValue]; } void Metal::Util::PopulateBackendInfoAdapters(VideoConfig* config, |
