[Mesa-dev] [PATCH 2/3] glsl: disable cache if MESA_EXTENSION_OVERRIDE is set

Nicolai Hähnle nhaehnle at gmail.com
Wed Apr 5 09:58:38 UTC 2017


On 05.04.2017 05:56, Timothy Arceri wrote:
> In the following patch we will stop pre-processing shaders before
> hashing them, so we just disable the cache if MESA_EXTENSION_OVERRIDE
> is set.

Why can't you add the value of MESA_EXTENSION_OVERRIDE to the hash of 
shaders?

Cheers,
Nicolai

>
> Tested-by: Grazvydas Ignotas <notasas at gmail.com>
> ---
>  src/util/disk_cache.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> index d9de8ef..dc883a3 100644
> --- a/src/util/disk_cache.c
> +++ b/src/util/disk_cache.c
> @@ -167,20 +167,29 @@ disk_cache_create(const char *gpu_name, const char *timestamp)
>  {
>     void *local;
>     struct disk_cache *cache = NULL;
>     char *path, *max_size_str;
>     uint64_t max_size;
>     int fd = -1;
>     struct stat sb;
>     struct statvfs vfs = { 0 };
>     size_t size;
>
> +   /* We no longer pre-process shaders before hashing them so disable the
> +    * cache if extensions are overridden.
> +    *
> +    * Note: Versions are part of the linked programs hash so we don't need
> +    * to worry about those here.
> +    */
> +   if (getenv("MESA_EXTENSION_OVERRIDE"))
> +      return NULL;
> +
>     /* If running as a users other than the real user disable cache */
>     if (geteuid() != getuid())
>        return NULL;
>
>     /* A ralloc context for transient data during this invocation. */
>     local = ralloc_context(NULL);
>     if (local == NULL)
>        goto fail;
>
>     /* At user request, disable shader cache entirely. */
>


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list