rhi: Enable HDRExtendedSrgbLinear for iOS

Pick-to: 6.5 6.6
Change-Id: Iaff3c0d18c07cc0cd4ed57a8e6fa7fb07b130a58
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-06-07 13:15:15 +02:00
parent f0049873d2
commit 95d10ae682

View File

@ -6105,9 +6105,12 @@ QSize QMetalSwapChain::surfacePixelSize()
bool QMetalSwapChain::isFormatSupported(Format f)
{
#ifdef Q_OS_MACOS
return f == SDR || f == HDRExtendedSrgbLinear;
#endif
if (f == HDRExtendedSrgbLinear) {
if (@available(macOS 10.11, iOS 16.0, *))
return true;
else
return false;
}
return f == SDR;
}
@ -6189,13 +6192,13 @@ bool QMetalSwapChain::createOrResize()
chooseFormats();
if (d->colorFormat != d->layer.pixelFormat)
d->layer.pixelFormat = d->colorFormat;
#ifdef Q_OS_MACOS
// Can't enable this on iOS until wantsExtendedDynamicRangeContent is available
if (m_format == HDRExtendedSrgbLinear) {
d->layer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);
d->layer.wantsExtendedDynamicRangeContent = YES;
if (@available(macOS 10.11, iOS 16.0, *)) {
d->layer.colorspace = CGColorSpaceCreateWithName(kCGColorSpaceExtendedLinearSRGB);
d->layer.wantsExtendedDynamicRangeContent = YES;
}
}
#endif
if (m_flags.testFlag(UsedAsTransferSource))
d->layer.framebufferOnly = NO;