[Mesa-dev] [PATCH 03/77] glsl: Switch to disable-by-default for the GLSL shader cache

Timothy Arceri timothy.arceri at collabora.com
Mon Oct 3 06:04:22 UTC 2016


From: Carl Worth <cworth at cworth.org>

The shader cache is expected to be developed incrementally over a
fairly long series of commits. For that period of instability, we
require users to opt into the shader cache by setting:

	MESA_GLSL_CACHE_ENABLE=1

In the future, when the shader cache is complete, we can revert this
commit so that the cache will be on by default.

The user can always disable the cache with
MESA_GLSL_CACHE_DISABLE=1. That functionality is not affected by this
commit, (nor will it be affected by the future revert).
---
 src/compiler/glsl/cache.c            | 7 +++++++
 src/compiler/glsl/tests/cache_test.c | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/src/compiler/glsl/cache.c b/src/compiler/glsl/cache.c
index 64a34f0..b700e6e 100644
--- a/src/compiler/glsl/cache.c
+++ b/src/compiler/glsl/cache.c
@@ -151,6 +151,13 @@ cache_create(void)
    if (getenv("MESA_GLSL_CACHE_DISABLE"))
       goto fail;
 
+   /* As a temporary measure, (while the shader cache is under
+    * development, and known to not be fully function), also require
+    * the MESA_GLSL_CACHE_ENABLE variable to be set.
+    */
+   if (! getenv ("MESA_GLSL_CACHE_ENABLE"))
+      goto fail;
+
    /* Determine path for cache based on the first defined name as follows:
     *
     *   $MESA_GLSL_CACHE_DIR
diff --git a/src/compiler/glsl/tests/cache_test.c b/src/compiler/glsl/tests/cache_test.c
index 1b0403c..1c6bf4d 100644
--- a/src/compiler/glsl/tests/cache_test.c
+++ b/src/compiler/glsl/tests/cache_test.c
@@ -403,6 +403,11 @@ main(void)
 {
    int err;
 
+   /* While the shader cache is still experimental, this variable must
+    * be set or the cache does nothing.
+    */
+   setenv("MESA_GLSL_CACHE_ENABLE", "1", 1);
+
    test_cache_create();
 
    test_put_and_get();
-- 
2.7.4



More information about the mesa-dev mailing list