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(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 #include + #include #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,