diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-22 16:25:16 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-22 19:07:17 +0200 |
commit | 9045b94d1ad7e945475d52bba152fdbdb36debbf (patch) | |
tree | 51adb75bdad3bf3b34d15eb22a3e56dfe17fac4b /src/quick/scenegraph | |
parent | 0a1e4cc7ec7548f6273befff9cdddb0bc7a58961 (diff) |
Defer setting a QVulkanInstance on the window
...to createRhi(). There is no need for the VkInstance before that
point.
Change-Id: I87f4e8154e96409bccd7844f1bf80b957bb54d69
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r-- | src/quick/scenegraph/qsgrhisupport.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index 5029103cff..e8855ab071 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -583,6 +583,15 @@ QRhi *QSGRhiSupport::createRhi(QQuickWindow *window, QOffscreenSurface *offscree #if QT_CONFIG(vulkan) if (backend == QRhi::Vulkan) { QRhiVulkanInitParams rhiParams; + // QQuickWindows must get a QVulkanInstance automatically (it is + // created when the first window is constructed and is destroyed only + // on exit), unless the application decided to set its own. With + // QQuickRenderControl, no QVulkanInstance is created, because it must + // always be under the application's control then (since the default + // instance we could create here would not be configurable by the + // application in any way, and that is often not acceptable). + if (!window->vulkanInstance() && !wd->renderControl) + window->setVulkanInstance(QSGRhiSupport::defaultVulkanInstance()); rhiParams.inst = window->vulkanInstance(); if (!rhiParams.inst) qWarning("No QVulkanInstance set for QQuickWindow, this is wrong."); |