rhi: gl: Maintain Qt 5 compat wrt disk cache behavior

Task-number: QTBUG-126608
Change-Id: Id78d6fbdfec6d69bfec2fe9deab82e84f2588b29
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 38279dea558b06cef6c1d345962df3063fd12c5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Laszlo Agocs 2024-11-07 14:00:28 +01:00 committed by Qt Cherry-pick Bot
parent a5022c1917
commit e81a2d03d8

View File

@ -6371,11 +6371,18 @@ bool QGles2GraphicsPipeline::create()
// force replacing existing cache entry (if there is one, then
// something is wrong with it, as there was no hit)
rhiD->trySaveToPipelineCache(program, cacheKey, true);
} else {
// legacy QOpenGLShaderProgram style behavior: the "pipeline cache"
// was not enabled, so instead store to the Qt 5 disk cache
rhiD->trySaveToDiskCache(program, cacheKey);
}
// legacy QOpenGLShaderProgram style behavior: do this always, even
// though it is superfluous with the "pipeline cache" enabled. Continue
// storing to the Qt 5 style individual-file disk cache, because there
// is no guarantee one retrieves the "pipeline cache" blob and writes it
// out. Classic example: if Qt Quick only retrieves and stores the
// combined cache contents when exiting, applications that never exit
// cleanly (because they are killed, Ctrl+C'd, etc.) never store any
// program binaries! Therefore, to maintain Qt 5 behavioral
// compatibility, continue writing out the individual files no matter
// what.
rhiD->trySaveToDiskCache(program, cacheKey);
} else {
Q_ASSERT(cacheResult == QRhiGles2::ProgramCacheHit);
if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave)) {
@ -6491,11 +6498,9 @@ bool QGles2ComputePipeline::create()
// force replacing existing cache entry (if there is one, then
// something is wrong with it, as there was no hit)
rhiD->trySaveToPipelineCache(program, cacheKey, true);
} else {
// legacy QOpenGLShaderProgram style behavior: the "pipeline cache"
// was not enabled, so instead store to the Qt 5 disk cache
rhiD->trySaveToDiskCache(program, cacheKey);
}
// legacy QOpenGLShaderProgram style behavior
rhiD->trySaveToDiskCache(program, cacheKey);
} else {
Q_ASSERT(cacheResult == QRhiGles2::ProgramCacheHit);
if (rhiD->rhiFlags.testFlag(QRhi::EnablePipelineCacheDataSave)) {