[Mesa-dev] [PATCH 27/65] glsl: compile shaders when program not found in cache

Timothy Arceri timothy.arceri at collabora.com
Fri Apr 29 13:33:26 UTC 2016

We may have seen the individual shaders before and skipped compiling
but they may not have been used together in this combination before.

We could probably only compile the shaders which were skipped here
but we need to be careful because the source may also have been
changed since the last compile so for now we just recompile
 src/compiler/glsl/shader_cache.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 6d979ad..8b8a28c 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -658,9 +658,10 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
    _mesa_sha1_compute(buf, offset, prog->sha1);
    buffer = (uint8_t *) cache_get(cache, prog->sha1, &size);
    if (buffer == NULL) {
-      /* FIXME: Fall back and link shaders here, if necessary, compile any
-       * shaders we didn't compile earlier.
+      /* Cached program not found. Fall back to linking shaders but first
+       * compile any shaders we didn't compile earlier.
+      compile_shaders(ctx, prog);
       return false;

More information about the mesa-dev mailing list