<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Oct 19, 2017 at 3:25 PM, Timothy Arceri <span dir="ltr"><<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Maybe add to docs?<br><div class="HOEnZb"><div class="h5"></div></div></blockquote><div><br></div><div>I'm not sure how I feel about that.  I'm scared to death of options like this becoming something some random user on the internet decides they should use because it keeps the pre-populated shader cache they downloaded work.  To be honest, I'd probably feel more comfortable about it being hidden behind an "if (0) {" so that you can't get to it without hacking up the driver.  I think I'm ok with it as-is though.</div><div><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
On 19/10/17 16:32, Jordan Justen wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The MESA_GLSL_CACHE_TIMESTAMP environment variable can be set to<br>
override the driver timestamp. Usually the driver will specify a hash<br>
of their driver build so the cache items become invalid with each<br>
driver build.<br>
<br>
We don't guarantee a stable serialized shader cache format, so<br>
changing the timestamp for each build is required for safety.<br>
<br>
Nevertheless, during debug, making small changes to the driver may be<br>
known to be safe. The driver developer can use this variable to keep<br>
the timestamp consistent. When debugging issues on an application for<br>
which the shader cache greatly lowers the startup time, this can save<br>
the developer significant time.<br>
<br>
Signed-off-by: Jordan Justen <<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.com</a>><br>
---<br>
  src/util/disk_cache.c | 12 ++++++++++++<br>
  1 file changed, 12 insertions(+)<br>
<br>
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c<br>
index fde6e2e097..54f48a8ba5 100644<br>
--- a/src/util/disk_cache.c<br>
+++ b/src/util/disk_cache.c<br>
@@ -208,6 +208,18 @@ disk_cache_create(const char *gpu_name, const char *timestamp,<br>
     if (env_var_as_boolean("MESA_GLSL<wbr>_CACHE_DISABLE", false))<br>
        goto fail;<br>
  +#ifdef DEBUG<br>
+   /* For debug builds, MESA_GLSL_CACHE_TIMESTAMP can be set to override the<br>
+    * driver specified timestamp. This will allow small changes to be made to<br>
+    * the driver without invalidating the cache. Given that this is normally<br>
+    * unsafe, it is only allowed for debug builds.<br>
+    */<br>
+   const char *timestamp_override = getenv("MESA_GLSL_CACHE_TIMEST<wbr>AMP");<br>
+   if (timestamp_override) {<br>
+      timestamp = timestamp_override;<br>
+   }<br>
+#endif<br>
+<br>
     /* Determine path for cache based on the first defined name as follows:<br>
      *<br>
      *   $MESA_GLSL_CACHE_DIR<br>
<br>
</blockquote></div></div><div class="HOEnZb"><div class="h5">
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div></div>