[Mesa-dev] [PATCH 4/7] glsl: Add environment variable to disable shader cache

Carl Worth cworth at cworth.org
Wed Feb 4 13:52:58 PST 2015


This patch adds support for a new variable, MESA_GLSL_CACHE_DISABLE.
If this variable is set, then all use of the shader cache will be
disabled at run time.
---
 docs/envvars.html | 1 +
 src/glsl/cache.c  | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/docs/envvars.html b/docs/envvars.html
index 31d14a4..65db3a9 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -94,6 +94,7 @@ This is only valid for versions >= 3.0.
 glGetString(GL_SHADING_LANGUAGE_VERSION). Valid values are integers, such as
 "130".  Mesa will not really implement all the features of the given language version
 if it's higher than what's normally reported. (for developers only)
+<li>MESA_GLSL_CACHE_DISABLE - if set, disables the GLSL shader cache
 <li>MESA_GLSL - <a href="shading.html#envvars">shading language compiler options</a>
 </ul>
 
diff --git a/src/glsl/cache.c b/src/glsl/cache.c
index fd087db..da71868 100644
--- a/src/glsl/cache.c
+++ b/src/glsl/cache.c
@@ -51,6 +51,10 @@ cache_create(void)
    int fd;
    struct passwd pwd, *result;
 
+   /* At user request, disable shader cache entirely. */
+   if (getenv("MESA_GLSL_CACHE_DISABLE"))
+      return NULL;
+
    getpwuid_r(getuid(), &pwd, buffer, sizeof buffer, &result);
    if (result == NULL)
       return NULL;
-- 
2.1.4



More information about the mesa-dev mailing list