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

Timothy Arceri tarceri at itsqueeze.com
Mon Mar 27 10:48:59 UTC 2017


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



More information about the mesa-dev mailing list