summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhivulkan.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r--src/gui/rhi/qrhivulkan.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index b946f8777b6..c5167a6e7de 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -8824,6 +8824,18 @@ bool QVkSwapChain::ensureSurface()
if (ok) {
colorFormat = formats[i].format;
colorSpace = formats[i].colorSpace;
+#if QT_CONFIG(wayland)
+ // On Wayland, only one color management surface can be created at a time without
+ // triggering a protocol error, and we create one ourselves in some situations.
+ // To avoid this problem, use VK_COLOR_SPACE_PASS_THROUGH_EXT when supported,
+ // so that the driver doesn't create a color management surface as well.
+ const bool hasPassThrough = std::any_of(formats.begin(), formats.end(), [this](const VkSurfaceFormatKHR &fmt) {
+ return fmt.format == colorFormat && fmt.colorSpace == VK_COLOR_SPACE_PASS_THROUGH_EXT;
+ });
+ if (hasPassThrough) {
+ colorSpace = VK_COLOR_SPACE_PASS_THROUGH_EXT;
+ }
+#endif
break;
}
}