From 3eb0b9852b89bee436e45152e5196559285a990c Mon Sep 17 00:00:00 2001 From: Jean-Philip Desjardins Date: Mon, 19 Feb 2024 14:10:20 -0500 Subject: [PATCH] Fix Qt6 build with Vulkan on Linux. --- Source/ui_qt/GSH_VulkanQt.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/ui_qt/GSH_VulkanQt.cpp b/Source/ui_qt/GSH_VulkanQt.cpp index d59270fe7..cb28ad150 100644 --- a/Source/ui_qt/GSH_VulkanQt.cpp +++ b/Source/ui_qt/GSH_VulkanQt.cpp @@ -2,14 +2,17 @@ #include "vulkan/StructDefs.h" #include "vulkan/Loader.h" #include +#include #ifdef __APPLE__ #include #endif #ifdef __linux__ +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include #endif +#endif CGSH_VulkanQt::CGSH_VulkanQt(QWindow* renderWindow) : m_renderWindow(renderWindow) @@ -42,7 +45,11 @@ void CGSH_VulkanQt::InitializeImpl() #ifdef __linux__ auto surfaceCreateInfo = Framework::Vulkan::XcbSurfaceCreateInfoKHR(); surfaceCreateInfo.window = static_cast(m_renderWindow->winId()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + surfaceCreateInfo.connection = qGuiApp->nativeInterface()->connection(); +#else surfaceCreateInfo.connection = QX11Info::connection(); +#endif auto result = m_instance.vkCreateXcbSurfaceKHR(m_instance, &surfaceCreateInfo, nullptr, &m_context->surface); CHECKVULKANERROR(result); #endif