[Mesa-dev] [PATCH 48/65] glsl: track mesa version shader cache items were created with
Timothy Arceri
timothy.arceri at collabora.com
Fri Apr 29 13:33:47 UTC 2016
Also remove cache item and fallback to full recompile if current Mesa
version differs.
---
src/compiler/glsl/shader_cache.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index d3eec83..52301b7 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1033,6 +1033,8 @@ shader_cache_write_program_metadata(struct gl_context *ctx,
metadata = blob_create(NULL);
+ blob_write_string(metadata, ctx->VersionString);
+
write_uniforms(metadata, prog);
write_hash_tables(metadata, prog);
@@ -1134,6 +1136,16 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
blob_reader_init(&metadata, buffer, size);
+ char *version_string = blob_read_string(&metadata);
+ if (strcmp(ctx->VersionString, version_string) != 0) {
+ /* The cached version of the program was created with a different
+ * version of Mesa so remove it and fallback to full recompile.
+ */
+ cache_remove(cache, prog->sha1);
+ compile_shaders(ctx, prog);
+ return false;
+ }
+
assert(prog->UniformStorage == NULL);
read_uniforms(&metadata, prog);
--
2.5.5
More information about the mesa-dev
mailing list