aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-07-26 16:37:32 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-02 15:17:47 +0000
commit4188b2fd8fe01a9066f91901b3be23a154e2f344 (patch)
tree81a57e1260f30ed959608f2f890d8834cbc639ea
parent5c2b68f66e1cf597a9a66df5305a5cc8781e7085 (diff)
Sync shadereffect materialType cleanup between renderloops
Follow 05ec3315e2ae723cd32b1b49260f0d09ee1fa423 from 5.15. The windows render loop is gone in Qt 6, and there can only be one type of material type cache (no legacy OpenGL path). The same issue is present, however: the basic and threaded render loops behave differently when it comes to calling cleanupMaterialTypeCache(). Make the behavior identical and follow a uniform order (1. tear down the scene graph 2. then drop cached QSGMaterialTypes) Task-number: QTBUG-94844 Change-Id: I61f4962fe8ae1a359a22fbe72e40eb2525d81e03 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit aedb4853a509d63a599779fa5115083f84fad389) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp9
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp7
2 files changed, 8 insertions, 8 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index 077814b1f4..2ee8040448 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -357,10 +357,6 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
rhi->makeThreadLocalNativeContextCurrent();
}
-#if QT_CONFIG(quick_shadereffect)
- QSGRhiShaderEffectNode::cleanupMaterialTypeCache();
-#endif
-
if (d->swapchain) {
if (window->handle()) {
// We get here when exiting via QCoreApplication::quit() instead of
@@ -373,6 +369,11 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window)
}
d->cleanupNodesOnShutdown();
+
+#if QT_CONFIG(quick_shadereffect)
+ QSGRhiShaderEffectNode::cleanupMaterialTypeCache();
+#endif
+
if (m_windows.size() == 0) {
rc->invalidate();
d->rhi = nullptr;
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 8a0202ede9..3a49002c12 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -525,13 +525,12 @@ void QSGRenderThread::invalidateGraphics(QQuickWindow *window, bool inDestructor
QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window);
-#if QT_CONFIG(quick_shadereffect)
- QSGRhiShaderEffectNode::cleanupMaterialTypeCache();
-#endif
-
// The canvas nodes must be cleaned up regardless if we are in the destructor..
if (wipeSG) {
dd->cleanupNodesOnShutdown();
+#if QT_CONFIG(quick_shadereffect)
+ QSGRhiShaderEffectNode::cleanupMaterialTypeCache();
+#endif
} else {
qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- persistent SG, avoiding cleanup");
return;