Add caching mechanism to ShaderBuilder
It is a 2 level cache system: runtime and offline
First we now generate a hash key based on unique features of a graph,
the api it targets, the last time the graph file was modified.
We then use that hash key to at runtime check whether we have already
loaded a graph matching the same hash key.
If that's not the case, we switch to using the offline cache and checking
whether a file already exists for that shader or not. If the file exists,
we load it, use the code it contains and add it to the runtime cache.
If the file does not exist, we revert to actually generating the shader
and we save the generated code to both the offline cache and the runtime cache.
By default, the offline cache with try to write into the location reported by
QStandardLocation::writableLocation(QStandardLocation::TempLocation).
Optionally, the environment variable QT3D_WRITABLE_CACHE_PATH can be set with
a path to a writable location.
If QT3D_REBUILD_SHADER_CACHE is not empty, cache will be regenerated.
Alternatively if QT3D_DISABLE_SHADER_CACHE is set, cache will be ignored.
Pick-to: 5.15
Change-Id: Ia348f92ce4cdd5e63ec89e58b7954d1f127f26bb
Reviewed-by: Mike Krus <mike.krus@kdab.com>