summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristoffer Skau <[email protected]>2023-02-27 13:33:32 +0100
committerQt Cherry-pick Bot <[email protected]>2023-02-28 19:02:53 +0000
commit84f5dcf4ec7f06a04eb4a4c1c73993e7e21ee27f (patch)
tree80157a78617bc2f3615928c0d7d8302425fd3498
parentfde53406e1b4ff7fa93e09e0bb138fa62e1c5aa3 (diff)
Increase cache size for QOpenGLTextureCache
Currently images that does not fit in the cache will be destroyed, which is unfortunate. 256 MB cache is too small for todays standards, so increasing it to 1 GB. Also adding an environment variable so that it is changeable if required. Fixes: QTBUG-111498 Change-Id: I70c65cad6219a59102b16abc50f098aa0b017314 Reviewed-by: Eirik Aavitsland <[email protected]> (cherry picked from commit 55568b8c626576726c6c9138c8044ea52bc3a355) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
-rw-r--r--src/opengl/qopengltexturecache.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/opengl/qopengltexturecache.cpp b/src/opengl/qopengltexturecache.cpp
index 107380ff08c..88bd280f7a3 100644
--- a/src/opengl/qopengltexturecache.cpp
+++ b/src/opengl/qopengltexturecache.cpp
@@ -61,9 +61,19 @@ void QOpenGLTextureCacheWrapper::cleanupTexturesForPixmapData(QPlatformPixmap *p
cleanupTexturesForCacheKey(pmd->cacheKey());
}
+static quint64 cacheSize()
+{
+ bool ok = false;
+ const int envCacheSize = qEnvironmentVariableIntValue("QT_OPENGL_TEXTURE_CACHE_SIZE", &ok);
+ if (ok)
+ return envCacheSize;
+
+ return 1024 * 1024; // 1024 MB cache default
+}
+
QOpenGLTextureCache::QOpenGLTextureCache(QOpenGLContext *ctx)
: QOpenGLSharedResource(ctx->shareGroup())
- , m_cache(256 * 1024) // 256 MB cache
+ , m_cache(cacheSize())
{
}