summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/shader_cache.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-08-23 16:33:00 +1000
committerTimothy Arceri <[email protected]>2017-08-25 13:20:29 +1000
commitea2515d780a40599036ff50b572d309e69635d20 (patch)
tree59e522c374888ab726219ac72bfb5b81537fcd0b /src/compiler/glsl/shader_cache.cpp
parent07018d49dc95b0a9cf7b22c33af2286c36583e82 (diff)
glsl: pass shader source keys to the disk cache
We don't actually write them to disk here. That will happen in the following commit. Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/compiler/glsl/shader_cache.cpp')
-rw-r--r--src/compiler/glsl/shader_cache.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index aa6c067d041..3af14be9a1d 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1406,23 +1406,37 @@ shader_cache_write_program_metadata(struct gl_context *ctx,
write_program_resource_list(metadata, prog);
+ struct cache_item_metadata cache_item_metadata;
+ cache_item_metadata.type = CACHE_ITEM_TYPE_GLSL;
+ cache_item_metadata.keys =
+ (cache_key *) malloc(prog->NumShaders * sizeof(cache_key));
+ cache_item_metadata.num_keys = prog->NumShaders;
+
+ if (!cache_item_metadata.keys)
+ goto fail;
+
char sha1_buf[41];
for (unsigned i = 0; i < prog->NumShaders; i++) {
disk_cache_put_key(cache, prog->Shaders[i]->sha1);
+ memcpy(cache_item_metadata.keys[i], prog->Shaders[i]->sha1,
+ sizeof(cache_key));
if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
_mesa_sha1_format(sha1_buf, prog->Shaders[i]->sha1);
fprintf(stderr, "marking shader: %s\n", sha1_buf);
}
}
- disk_cache_put(cache, prog->data->sha1, metadata->data, metadata->size);
-
- blob_destroy(metadata);
+ disk_cache_put(cache, prog->data->sha1, metadata->data, metadata->size,
+ &cache_item_metadata);
if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
_mesa_sha1_format(sha1_buf, prog->data->sha1);
fprintf(stderr, "putting program metadata in cache: %s\n", sha1_buf);
}
+
+fail:
+ free(cache_item_metadata.keys);
+ blob_destroy(metadata);
}
bool