glsl: Switch to disable-by-default for the GLSL shader cache

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).

Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Carl Worth
2015-03-16 11:46:20 -07:00
committed by Timothy Arceri
parent 0ecd426490
commit 0f60c6616e
2 changed files with 12 additions and 0 deletions

View File

@@ -388,6 +388,11 @@ main(void)
#ifdef ENABLE_SHADER_CACHE #ifdef ENABLE_SHADER_CACHE
int err; 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_disk_cache_create(); test_disk_cache_create();
test_put_and_get(); test_put_and_get();

View File

@@ -151,6 +151,13 @@ disk_cache_create(void)
if (getenv("MESA_GLSL_CACHE_DISABLE")) if (getenv("MESA_GLSL_CACHE_DISABLE"))
goto fail; goto fail;
/* As a temporary measure, (while the shader cache is under
* development, and known to not be fully functional), 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: /* Determine path for cache based on the first defined name as follows:
* *
* $MESA_GLSL_CACHE_DIR * $MESA_GLSL_CACHE_DIR