diff options
| author | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-02-17 15:50:05 +0100 |
|---|---|---|
| committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2023-02-21 12:14:00 +0100 |
| commit | 851d84a63cef74b5c803f9bd2611051567c6dd01 (patch) | |
| tree | e36de0189970796084329d8652cfb93a3828b78d /src | |
| parent | 87208d5fb56036c53b465e10845ee4279247f4b3 (diff) | |
rhi: Prevent pipeline cache warning appearing again and again
As found by various users; one typical way to get these harmless
but annoying warnings reappearing again and again on every startup
is to run QML applications that only work with materials where the
shaders are conditioned so that the QRhi backend has no actual
"pipeline cache" data collected, meaning there is no data to write
out at the end, while at the same time have an existing cache file
generated from an older Qt or different graphics driver.
Pick-to: 6.5
Change-Id: Ie4deebc3ff60580a5435d55dd1869303f910bcb6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src')
| -rw-r--r-- | src/quick/scenegraph/qsgrhisupport.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index d78b0027bc..0fd28b3770 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -1045,8 +1045,18 @@ void QSGRhiSupport::finalizePipelineCache(QRhi *rhi, const QQuickGraphicsConfigu // If empty, do nothing. This is exactly what will happen if the rhi was // created without QRhi::EnablePipelineCacheDataSave set. - if (buf.isEmpty()) + if (buf.isEmpty()) { + if (isAutomatic) { + // Attempt to remove the file. If it does not exist or this fails, + // that's fine. The goal is just to prevent warnings from + // setPipelineCacheData in future runs, e.g. if the Qt or driver + // version does not match _and_ we do not generate any data at run + // time, then not writing the file out also means the warning would + // appear again and again on every run. Prevent that. + QDir().remove(pipelineCacheSave); + } return; + } QLockFile lock(pipelineCacheLockFileName(pipelineCacheSave)); if (!lock.lock()) { |
