aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2018-03-10 01:59:47 -0800
committerJordan Justen <[email protected]>2018-03-19 09:57:09 -0700
commitb5baaee0d6b06a2c021d1b2673a056ada733a2a9 (patch)
tree43c8a94a2aaf33bcb8d30da4d6687e6a6c471418
parent9b473f9e3cc6820a6d1441e046be5ece22e03d17 (diff)
glsl/serialize: Save shader program metadata sha1
When the shader cache is used, this can be generated. In fact, the shader cache uses this sha1 to lookup the serialized GL shader program. If a GL shader program is restored with ProgramBinary, the shaders are not available, and therefore the correct sha1 cannot be generated. If this is restored, then we can use the shader cache to restore the binary programs to the program that was loaded with ProgramBinary. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
-rw-r--r--src/compiler/glsl/serialize.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/glsl/serialize.cpp b/src/compiler/glsl/serialize.cpp
index 9d2033bddfa..1fdbaa990f4 100644
--- a/src/compiler/glsl/serialize.cpp
+++ b/src/compiler/glsl/serialize.cpp
@@ -1163,6 +1163,8 @@ extern "C" void
serialize_glsl_program(struct blob *blob, struct gl_context *ctx,
struct gl_shader_program *prog)
{
+ blob_write_bytes(blob, prog->data->sha1, sizeof(prog->data->sha1));
+
write_uniforms(blob, prog);
write_hash_tables(blob, prog);
@@ -1219,6 +1221,8 @@ deserialize_glsl_program(struct blob_reader *blob, struct gl_context *ctx,
assert(prog->data->UniformStorage == NULL);
+ blob_copy_bytes(blob, prog->data->sha1, sizeof(prog->data->sha1));
+
read_uniforms(blob, prog);
read_hash_tables(blob, prog);