Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
---
 src/util/disk_cache.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index b71363bcf3..d7891e3b70 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -47,6 +47,7 @@
 #include "util/mesa-sha1.h"
 #include "util/ralloc.h"
 #include "main/errors.h"
+#include "main/macros.h"
 
 #include "disk_cache.h"
 
@@ -213,7 +214,8 @@ disk_cache_create(const char *gpu_name, const char 
*timestamp,
 
    /* Determine path for cache based on the first defined name as follows:
     *
-    *   $MESA_GLSL_CACHE_DIR
+    *   $MESA_GLSL_CACHE_DIR as environment variable
+    *   $MESA_GLSL_CACHE_DIR as compile time option
     *   $XDG_CACHE_HOME/mesa_shader_cache
     *   <pwd.pw_dir>/.cache/mesa_shader_cache
     */
@@ -227,6 +229,15 @@ disk_cache_create(const char *gpu_name, const char 
*timestamp,
          goto fail;
    }
 
+#ifdef MESA_GLSL_CACHE_DIR
+#define STR(x) STRINGIFY(x)
+   path = concatenate_and_mkdir(local, STR(MESA_GLSL_CACHE_DIR),
+                                CACHE_DIR_NAME);
+   if (path == NULL)
+      goto fail;
+#undef STR
+#endif
+
    if (path == NULL) {
       char *xdg_cache_home = getenv("XDG_CACHE_HOME");
 
-- 
2.14.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to