diff --git a/src/util/disk_cache_os.c b/src/util/disk_cache_os.c index cb3f466083b..d9a75cd7fc6 100644 --- a/src/util/disk_cache_os.c +++ b/src/util/disk_cache_os.c @@ -879,6 +879,7 @@ disk_cache_write_item_to_disk(struct disk_cache_put_job *dc_job, * * $MESA_SHADER_CACHE_DIR * $XDG_CACHE_HOME/mesa_shader_cache + * $HOME/.cache/mesa_shader_cache * /.cache/mesa_shader_cache */ char * @@ -924,6 +925,20 @@ disk_cache_generate_cache_dir(void *mem_ctx, const char *gpu_name, } } + if (!path) { + char *home = getenv("HOME"); + + if (home) { + path = concatenate_and_mkdir(mem_ctx, home, ".cache"); + if (!path) + return NULL; + + path = concatenate_and_mkdir(mem_ctx, path, cache_dir_name); + if (!path) + return NULL; + } + } + if (!path) { char *buf; size_t buf_size;