aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgrenderloop.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-05-08 16:36:51 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-05-11 12:51:12 +0200
commit89bf0af005f0dec1b8c6e3e80759cf5b22931c56 (patch)
treec5e35a4245f79371a422d693b6e52df118dc471b /src/quick/scenegraph/qsgrenderloop.cpp
parent1f2529d869d6e3e62edd3ba7432588d5368c2f07 (diff)
Have the basic render loop notify when the renderpass desc. disappears
Unlike the threaded one, this runs into the well-known issue of referencing the QRhiRenderPassDescriptor from data structures that are tied to the rendercontext. In the 'basic' loop there is one rendercontext that is reused for all windows. With threaded there would be one rendercontext per window, because there each window gets its own render thread, and so the problem cannot arise. Fix up the basic loop accordingly. Change-Id: Iea6713c6167ead7df96ac5f01d7b92d2ec57ce71 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgrenderloop.cpp')
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index a9f7a3a963..aa956fda9e 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -464,6 +464,15 @@ void QSGGuiThreadRenderLoop::handleDeviceLoss()
void QSGGuiThreadRenderLoop::releaseSwapchain(QQuickWindow *window)
{
QQuickWindowPrivate *wd = QQuickWindowPrivate::get(window);
+
+ // Unlike the threaded render loop, this one reuses the same rendercontext
+ // for all QQuickWindows for the entire lifetime of the render loop.
+ // Therefore the renderer, if there is one, needs to be notified about the
+ // destruction of certain resources because they may be referenced from
+ // per-rendercontext data structures.
+ if (wd->renderer)
+ wd->renderer->invalidatePipelineCacheDependency(wd->rpDescForSwapchain);
+
delete wd->rpDescForSwapchain;
wd->rpDescForSwapchain = nullptr;
delete wd->swapchain;