aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-11-23 15:56:25 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-11-24 18:07:59 +0100
commit3b2dacbf3da0c9725a5408b0b956ef15cde3f947 (patch)
tree7d46dd24cfc6e121c95ca36725f8866441c8be71 /src/quick/items
parent7a5c59f21fc68e3020c2acf0cd50146ef6a61005 (diff)
Empty the ShaderEffect content cache on releaseResources
Just use a function because the private and impl classes for QQuickShaderEffect do not have their own headers. Change-Id: If5070aeb8c2b07b9b7e2cf3e16071ee2af2e368b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/qquickshadereffect.cpp5
-rw-r--r--src/quick/items/qquickwindow.cpp7
2 files changed, 12 insertions, 0 deletions
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index b4d9f9f69d..5365ab071e 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -1158,6 +1158,11 @@ static inline QVariant getValueFromProperty(QObject *item, const QMetaObject *it
using QQuickShaderInfoCache = QHash<QUrl, QSGGuiThreadShaderEffectManager::ShaderInfo>;
Q_GLOBAL_STATIC(QQuickShaderInfoCache, shaderInfoCache)
+void qtquick_shadereffect_purge_gui_thread_shader_cache()
+{
+ shaderInfoCache()->clear();
+}
+
bool QQuickShaderEffectImpl::updateShader(Shader shaderType, const QUrl &fileUrl)
{
QSGGuiThreadShaderEffectManager *mgr = shaderEffectManager();
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 698ac341a4..37525d99d8 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1681,6 +1681,10 @@ QQuickWindow::~QQuickWindow()
QQuickPixmap::purgeCache();
}
+#if QT_CONFIG(quick_shadereffect)
+void qtquick_shadereffect_purge_gui_thread_shader_cache();
+#endif
+
/*!
This function tries to release redundant resources currently held by the QML scene.
@@ -1707,6 +1711,9 @@ void QQuickWindow::releaseResources()
if (d->windowManager)
d->windowManager->releaseResources(this);
QQuickPixmap::purgeCache();
+#if QT_CONFIG(quick_shadereffect)
+ qtquick_shadereffect_purge_gui_thread_shader_cache();
+#endif
}