Signed-off-by: Tapani Pälli <tapani.pa...@intel.com> --- src/compiler/glsl/glsl_parser_extras.cpp | 26 ++++++++++++++------------ src/util/disk_cache.c | 5 +++-- 2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 59821732b9..6003ddb277 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -2038,22 +2038,24 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, shader->FallbackSource : shader->Source; if (!force_recompile) { - if (ctx->Cache) { - char buf[41]; + /* Compute sha1 if using disk cache or ANDROID blob cache. */ + if (ctx->Cache || ctx->blobCacheSet) { disk_cache_compute_key(ctx->Cache, source, strlen(source), shader->sha1); - if (disk_cache_has_key(ctx->Cache, shader->sha1)) { - /* We've seen this shader before and know it compiles */ - if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { - _mesa_sha1_format(buf, shader->sha1); - fprintf(stderr, "deferring compile of shader: %s\n", buf); - } - shader->CompileStatus = compile_skipped; + } - free((void *)shader->FallbackSource); - shader->FallbackSource = NULL; - return; + if (ctx->Cache && disk_cache_has_key(ctx->Cache, shader->sha1)) { + /* We've seen this shader before and know it compiles */ + if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { + char buf[41]; + _mesa_sha1_format(buf, shader->sha1); + fprintf(stderr, "deferring compile of shader: %s\n", buf); } + shader->CompileStatus = compile_skipped; + + free((void *)shader->FallbackSource); + shader->FallbackSource = NULL; + return; } } else { /* We should only ever end up here if a re-compile has been forced by a diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index 7ebfa8c045..d8e92d66fe 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -1203,8 +1203,9 @@ disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size, struct mesa_sha1 ctx; _mesa_sha1_init(&ctx); - _mesa_sha1_update(&ctx, cache->driver_keys_blob, - cache->driver_keys_blob_size); + if (cache) + _mesa_sha1_update(&ctx, cache->driver_keys_blob, + cache->driver_keys_blob_size); _mesa_sha1_update(&ctx, data, size); _mesa_sha1_final(&ctx, key); } -- 2.14.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev