Client: Guard our surface from being destroyed whilst rendering from Vulkan

Change-Id: Ibac173b769186b49251bad9b94c71b9ccea26a7e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
David Edmundson 2023-03-31 10:15:08 +01:00 committed by David Edmundson
parent 5043973b14
commit 4cfd0da3d9
2 changed files with 23 additions and 0 deletions

View File

@ -101,6 +101,26 @@ void QWaylandVulkanInstance::presentAboutToBeQueued(QWindow *window)
w->handleUpdate();
}
void QWaylandVulkanInstance::beginFrame(QWindow *window)
{
auto *w = static_cast<QWaylandWindow *>(window->handle());
if (!w) {
qWarning() << "Attempted to call beginFrame() without a valid platform window";
return;
}
w->beginFrame();
}
void QWaylandVulkanInstance::endFrame(QWindow *window)
{
auto *w = static_cast<QWaylandWindow *>(window->handle());
if (!w) {
qWarning() << "Attempted to call endFrame() without a valid platform window";
return;
}
w->endFrame();
}
} // namespace QtWaylandClient
QT_END_NAMESPACE

View File

@ -42,6 +42,9 @@ public:
VkSurfaceKHR createSurface(QWaylandWindow *window);
void beginFrame(QWindow *window) override;
void endFrame(QWindow *window) override;
private:
QVulkanInstance *m_instance = nullptr;
PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR m_getPhysDevPresSupport = nullptr;