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

Grazvydas Ignotas notasas at gmail.com
Mon Mar 27 09:32:48 UTC 2017


On Mon, Mar 27, 2017 at 6:14 AM, Timothy Arceri <tarceri at itsqueeze.com> 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.

That's because the extension substitution is done by the preprocessor
I assume? It's not really obvious for someone who doesn't know the
code...

GraÅžvydas

> ---
>  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. */
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list