MacOS: Enable support for EDR rendering #105662
|
@ -92,10 +92,11 @@ GHOST_ContextCGL::GHOST_ContextCGL(bool stereoVisual,
|
||||||
m_metalLayer.allowsNextDrawableTimeout = NO;
|
m_metalLayer.allowsNextDrawableTimeout = NO;
|
||||||
|
|
||||||
if (m_useMetalForRendering) {
|
if (m_useMetalForRendering) {
|
||||||
// Enable EDR support. This is done by:
|
/* Enable EDR support. This is done by:
|
||||||
// 1. Using a floating point render target, so that values ouside 0..1 can be used
|
* 1. Using a floating point render target, so that values ouside 0..1 can be used
|
||||||
// 2. Informing the OS that we are EDR aware, and intend to use values outside 0..1
|
* 2. Informing the OS that we are EDR aware, and intend to use values outside 0..1
|
||||||
// 3. Setting the extended sRGB color space so that the OS knows how to interpret the values
|
* 3. Setting the extended sRGB color space so that the OS knows how to interpret the
|
||||||
|
* values. */
|
||||||
m_metalLayer.wantsExtendedDynamicRangeContent = YES;
|
m_metalLayer.wantsExtendedDynamicRangeContent = YES;
|
||||||
m_metalLayer.pixelFormat = MTLPixelFormatRGBA16Float;
|
m_metalLayer.pixelFormat = MTLPixelFormatRGBA16Float;
|
||||||
const CFStringRef name = kCGColorSpaceExtendedSRGB;
|
const CFStringRef name = kCGColorSpaceExtendedSRGB;
|
||||||
|
@ -607,8 +608,8 @@ void GHOST_ContextCGL::metalInit()
|
||||||
/* Ensure library is released. */
|
/* Ensure library is released. */
|
||||||
[library autorelease];
|
[library autorelease];
|
||||||
|
|
||||||
MTLPixelFormat attachmentFormat = m_useMetalForRendering ?
|
MTLPixelFormat attachmentFormat = m_useMetalForRendering ? METAL_FRAMEBUFFERPIXEL_FORMAT_EDR :
|
||||||
METAL_FRAMEBUFFERPIXEL_FORMAT_EDR : METAL_FRAMEBUFFERPIXEL_FORMAT_SDR;
|
METAL_FRAMEBUFFERPIXEL_FORMAT_SDR;
|
||||||
[desc.colorAttachments objectAtIndexedSubscript:0].pixelFormat = attachmentFormat;
|
[desc.colorAttachments objectAtIndexedSubscript:0].pixelFormat = attachmentFormat;
|
||||||
|
|
||||||
m_metalRenderPipeline = (MTLRenderPipelineState *)[device
|
m_metalRenderPipeline = (MTLRenderPipelineState *)[device
|
||||||
|
|
|
@ -345,10 +345,11 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
|
||||||
[m_metalLayer setDevice:metalDevice];
|
[m_metalLayer setDevice:metalDevice];
|
||||||
|
|
||||||
if (type == GHOST_kDrawingContextTypeMetal) {
|
if (type == GHOST_kDrawingContextTypeMetal) {
|
||||||
// Enable EDR support. This is done by:
|
/* Enable EDR support. This is done by:
|
||||||
// 1. Using a floating point render target, so that values ouside 0..1 can be used
|
* 1. Using a floating point render target, so that values ouside 0..1 can be used
|
||||||
// 2. Informing the OS that we are EDR aware, and intend to use values outside 0..1
|
* 2. Informing the OS that we are EDR aware, and intend to use values outside 0..1
|
||||||
// 3. Setting the extended sRGB color space so that the OS knows how to interpret the values
|
* 3. Setting the extended sRGB color space so that the OS knows how to interpret the
|
||||||
|
* values. */
|
||||||
m_metalLayer.wantsExtendedDynamicRangeContent = YES;
|
m_metalLayer.wantsExtendedDynamicRangeContent = YES;
|
||||||
m_metalLayer.pixelFormat = MTLPixelFormatRGBA16Float;
|
m_metalLayer.pixelFormat = MTLPixelFormatRGBA16Float;
|
||||||
const CFStringRef name = kCGColorSpaceExtendedSRGB;
|
const CFStringRef name = kCGColorSpaceExtendedSRGB;
|
||||||
|
|
Loading…
Reference in New Issue