diff options
| author | Paul Olav Tvete <paul.tvete@qt.io> | 2023-02-02 11:00:13 +0100 |
|---|---|---|
| committer | Paul Olav Tvete <paul.tvete@qt.io> | 2023-02-07 18:23:13 +0000 |
| commit | 37f2c169a5ea2a16432651c261e16aaa8b07b7cc (patch) | |
| tree | c224b2cb5ece4b0656b57f2619e1b41116dc8f5a /tools/qml/main.cpp | |
| parent | 11bc79d7c6e52dfb85e951e383f11395aecea337 (diff) | |
qml tool: Disable shader caching by default
When shaders are generated dynamically, such as with QtQuick3D, cached
shaders may get out of date if the QML file is changed.
Change-Id: I2c5484765e30da5c13fd175a9fcbad2473d55e62
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tools/qml/main.cpp')
| -rw-r--r-- | tools/qml/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index ae5596e000..f09f3a5ff8 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -79,6 +79,7 @@ static const QString customConfFileName(QStringLiteral("configuration.qml")); static bool verboseMode = false; static bool quietMode = false; static bool glShareContexts = true; +static bool disableShaderCache = true; static void loadConf(const QString &override, bool quiet) // Terminates app on failure { @@ -324,6 +325,8 @@ static void getAppFlags(int argc, char **argv) QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); } else if (!strcmp(argv[i], "-disable-context-sharing") || !strcmp(argv[i], "--disable-context-sharing")) { glShareContexts = false; + } else if (!strcmp(argv[i], "-enable-shader-cache") || !strcmp(argv[i], "--enable-shader-cache")) { + disableShaderCache = false; } } #else @@ -364,6 +367,8 @@ int main(int argc, char *argv[]) if (glShareContexts) QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); + if (disableShaderCache) + QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache); std::unique_ptr<QCoreApplication> app; switch (applicationType) { @@ -448,6 +453,9 @@ int main(int argc, char *argv[]) QCommandLineOption glContextSharing(QStringLiteral("disable-context-sharing"), QCoreApplication::translate("main", "Disable the use of a shared GL context for QtQuick Windows")); parser.addOption(glContextSharing); // Just for the help text... we've already handled this argument above + QCommandLineOption shaderCaching(QStringLiteral("enable-shader-cache"), + QCoreApplication::translate("main", "Enable persistent caching of generated shaders")); + parser.addOption(shaderCaching); // Just for the help text... we've already handled this argument above #endif // QT_GUI_LIB // Debugging and verbosity options QCommandLineOption quietOption(QStringLiteral("quiet"), |
