When making tweaks to the driver that should not affect the code generation, the INTEL_SHADER_CACHE_TIMESTAMP can be set to override the shader disk cache to use a consistent timestamp.
This will allow the shader cache entries to remain valid across driver builds, but it should be used with caution. Signed-off-by: Jordan Justen <[email protected]> --- src/mesa/drivers/dri/i965/brw_disk_cache.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_disk_cache.c b/src/mesa/drivers/dri/i965/brw_disk_cache.c index ef5380126a..bda40fad7a 100644 --- a/src/mesa/drivers/dri/i965/brw_disk_cache.c +++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c @@ -670,7 +670,15 @@ brw_disk_cache_init(struct brw_context *brw) if (renderer == NULL) return; - const struct build_id_note *note = build_id_find_nhdr("i965_dri.so"); + /* The INTEL_SHADER_CACHE_TIMESTAMP variable is for debug purposes. It can + * be used to override the timestamp to a consistent value, which will + * allow the cache entries to be reused when making small changes to the + * driver that should not affect the program generation. + */ + const char *env_timestamp = getenv("INTEL_SHADER_CACHE_TIMESTAMP"); + + const struct build_id_note *note = + env_timestamp == NULL ? build_id_find_nhdr("i965_dri.so") : NULL; int id_size = note ? build_id_length(note) : 0; char *timestamp; if (id_size > 0) { @@ -685,7 +693,7 @@ brw_disk_cache_init(struct brw_context *brw) for (i = 0; i < id_size; i++) snprintf(×tamp[2 * i], 3, "%02x", data[i]); } else { - timestamp = strdup("now"); + timestamp = strdup(env_timestamp ? env_timestamp : "now"); } if (timestamp == NULL) { free(renderer); -- 2.14.0 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
