diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-06-07 14:25:04 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-06-07 14:42:58 +0200 |
commit | 526744ba6536175f9a19ffdf6ff1ee068f9522a4 (patch) | |
tree | 77d0a55fea826ad33c1eee57b5c3bb8a48b92a15 /src/gui/rhi/qrhivulkan.cpp | |
parent | dc341ea284bf533967a1e70d60df92184cc112ea (diff) |
rhi: vulkan: Fix swapchain format check
Fix the treatment of the sRGB flag. That is independent from the value
of format(), and should be checked regardless of wanting a HDR swapchain
or not. On Android for instance Display P3 with RGBA8 or RGBA8_SRGB is
one of the formats offered. While we do not support this right now,
it is an example of a "HDR" format that still uses a color buffer
format where a dedicated sRGB format is available and must be
chosen according to the specified swapchain flags.
Pick-to: 6.6
Change-Id: I2d97689fa5af7c08486702ae690f2230d06db469
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 197b077990..a78b459dd6 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -7543,11 +7543,9 @@ bool QVkSwapChain::ensureSurface() const bool srgbRequested = m_flags.testFlag(sRGB); for (int i = 0; i < int(formatCount); ++i) { if (formats[i].format != VK_FORMAT_UNDEFINED) { - bool ok = false; - if (m_format == SDR) - ok = srgbRequested == isSrgbFormat(formats[i].format); - else - ok = hdrFormatMatchesVkSurfaceFormat(m_format, formats[i]); + bool ok = srgbRequested == isSrgbFormat(formats[i].format); + if (m_format != SDR) + ok &= hdrFormatMatchesVkSurfaceFormat(m_format, formats[i]); if (ok) { colorFormat = formats[i].format; colorSpace = formats[i].colorSpace; |