Add HDR to Metal
This commit is contained in:
parent
f3d1cda672
commit
153d0201a8
|
@ -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
|
||||
}
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AppKit/NSScreen.h>
|
||||
#include <Metal/Metal.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "VideoCommon/AbstractShader.h"
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue