rhi: Don't check m_format in QRhiSwapChain::hdrInfo()

The HDR info is independent of the current format anyways.
Removing the format check allows code to use hdrInfo() as
a signal for whether to set a HDR format, instead of having
to set the format, then query hdrInfo(), and then setting
SDR again if needed.

Change-Id: I99b57335003d06af227f2a7078560c2a483b049b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 5ea0256b07495977a1f2740f6b2d99984cf927dc)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-06-09 14:38:39 +02:00
parent 67f18f282a
commit ec58e20d7e
4 changed files with 3 additions and 18 deletions

View File

@ -4915,7 +4915,7 @@ bool QD3D11SwapChain::isFormatSupported(Format f)
QRhiSwapChainHdrInfo QD3D11SwapChain::hdrInfo()
{
QRhiSwapChainHdrInfo info = QRhiSwapChain::hdrInfo();
if (m_format != QRhiSwapChain::SDR && m_window) {
if (m_window) {
QRHI_RES_RHI(QRhiD3D11);
DXGI_OUTPUT_DESC1 hdrOutputDesc;
if (outputDesc1ForWindow(m_window, rhiD->activeAdapter, &hdrOutputDesc)) {

View File

@ -5801,7 +5801,7 @@ bool QD3D12SwapChain::isFormatSupported(Format f)
QRhiSwapChainHdrInfo QD3D12SwapChain::hdrInfo()
{
QRhiSwapChainHdrInfo info = QRhiSwapChain::hdrInfo();
if (m_format != QRhiSwapChain::SDR && m_window) {
if (m_window) {
QRHI_RES_RHI(QRhiD3D12);
DXGI_OUTPUT_DESC1 hdrOutputDesc;
if (outputDesc1ForWindow(m_window, rhiD->activeAdapter, &hdrOutputDesc)) {

View File

@ -6107,7 +6107,7 @@ bool QMetalSwapChain::isFormatSupported(Format f)
{
if (f == HDRExtendedSrgbLinear) {
if (@available(macOS 10.11, iOS 16.0, *))
return hdrInfoForScreen().limits.colorComponentValue.maxPotentialColorComponentValue > 1.0f;
return hdrInfo().limits.colorComponentValue.maxPotentialColorComponentValue > 1.0f;
else
return false;
}
@ -6328,18 +6328,6 @@ bool QMetalSwapChain::createOrResize()
}
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;
info.limitsType = QRhiSwapChainHdrInfo::ColorComponentValue;

View File

@ -318,9 +318,6 @@ struct QMetalSwapChain : public QRhiSwapChain
QMetalCommandBuffer cbWrapper;
QMetalRenderBuffer *ds = nullptr;
QMetalSwapChainData *d = nullptr;
private:
QRhiSwapChainHdrInfo hdrInfoForScreen();
};
struct QRhiMetalData;