rhi: Only report HDR as supported if maxPotentialColorComponentValue > 1
Change-Id: I4c951e8c651b2bee41aba8ff69f481a08d6a3561 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 5302fb64af2f3f1eb4351a6f775663b74b8e53da) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
feadcc6869
commit
67f18f282a
@ -6107,7 +6107,7 @@ bool QMetalSwapChain::isFormatSupported(Format f)
|
|||||||
{
|
{
|
||||||
if (f == HDRExtendedSrgbLinear) {
|
if (f == HDRExtendedSrgbLinear) {
|
||||||
if (@available(macOS 10.11, iOS 16.0, *))
|
if (@available(macOS 10.11, iOS 16.0, *))
|
||||||
return true;
|
return hdrInfoForScreen().limits.colorComponentValue.maxPotentialColorComponentValue > 1.0f;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -6328,13 +6328,25 @@ bool QMetalSwapChain::createOrResize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QRhiSwapChainHdrInfo QMetalSwapChain::hdrInfo()
|
QRhiSwapChainHdrInfo QMetalSwapChain::hdrInfo()
|
||||||
|
{
|
||||||
|
if (m_format == SDR) {
|
||||||
|
QRhiSwapChainHdrInfo info;
|
||||||
|
info.limitsType = QRhiSwapChainHdrInfo::ColorComponentValue;
|
||||||
|
info.limits.colorComponentValue.maxColorComponentValue = 1;
|
||||||
|
info.isHardCodedDefaults = true;
|
||||||
|
} else {
|
||||||
|
return hdrInfoForScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QRhiSwapChainHdrInfo QMetalSwapChain::hdrInfoForScreen()
|
||||||
{
|
{
|
||||||
QRhiSwapChainHdrInfo info;
|
QRhiSwapChainHdrInfo info;
|
||||||
info.limitsType = QRhiSwapChainHdrInfo::ColorComponentValue;
|
info.limitsType = QRhiSwapChainHdrInfo::ColorComponentValue;
|
||||||
info.limits.colorComponentValue.maxColorComponentValue = 1;
|
info.limits.colorComponentValue.maxColorComponentValue = 1;
|
||||||
info.isHardCodedDefaults = true;
|
info.isHardCodedDefaults = true;
|
||||||
|
|
||||||
if (m_format != SDR && m_window) {
|
if (m_window) {
|
||||||
// Must use m_window, not window, given this may be called before createOrResize().
|
// Must use m_window, not window, given this may be called before createOrResize().
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
NSView *view = reinterpret_cast<NSView *>(m_window->winId());
|
NSView *view = reinterpret_cast<NSView *>(m_window->winId());
|
||||||
|
@ -318,6 +318,9 @@ struct QMetalSwapChain : public QRhiSwapChain
|
|||||||
QMetalCommandBuffer cbWrapper;
|
QMetalCommandBuffer cbWrapper;
|
||||||
QMetalRenderBuffer *ds = nullptr;
|
QMetalRenderBuffer *ds = nullptr;
|
||||||
QMetalSwapChainData *d = nullptr;
|
QMetalSwapChainData *d = nullptr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QRhiSwapChainHdrInfo hdrInfoForScreen();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QRhiMetalData;
|
struct QRhiMetalData;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user