summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2017-10-17 16:38:48 -0700
committerJordan Justen <jordan.l.justen@intel.com>2017-10-18 19:46:42 -0700
commita66cb80e8554745525f3ce379b2b7abfd0aab77e (patch)
treeb6d4c20f24483819ff78fba8133a5d91e69ef3df
parent921fe07a8848eb87f6378ec38324fdc6c1408294 (diff)
disk_cache: Add support for MESA_GLSL_CACHE_TIMESTAMP in debug buildsi965-shader-cache-v2
The MESA_GLSL_CACHE_TIMESTAMP environment variable can be set to override the driver timestamp. Usually the driver will specify a hash of their driver build so the cache items become invalid with each driver build. We don't guarantee a stable serialized shader cache format, so changing the timestamp for each build is required for safety. Nevertheless, during debug, making small changes to the driver may be known to be safe. The driver developer can use this variable to keep the timestamp consistent. When debugging issues on an application for which the shader cache greatly lowers the startup time, this can save the developer significant time. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
-rw-r--r--src/util/disk_cache.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index fde6e2e097..54f48a8ba5 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -208,6 +208,18 @@ disk_cache_create(const char *gpu_name, const char *timestamp,
if (env_var_as_boolean("MESA_GLSL_CACHE_DISABLE", false))
goto fail;
+#ifdef DEBUG
+ /* For debug builds, MESA_GLSL_CACHE_TIMESTAMP can be set to override the
+ * driver specified timestamp. This will allow small changes to be made to
+ * the driver without invalidating the cache. Given that this is normally
+ * unsafe, it is only allowed for debug builds.
+ */
+ const char *timestamp_override = getenv("MESA_GLSL_CACHE_TIMESTAMP");
+ if (timestamp_override) {
+ timestamp = timestamp_override;
+ }
+#endif
+
/* Determine path for cache based on the first defined name as follows:
*
* $MESA_GLSL_CACHE_DIR