diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index fa44fa887bc..7ec74df0829 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2654,6 +2654,24 @@ link_intrastage_shaders(void *mem_ctx, if (ctx->Const.LowerCsDerivedVariables) lower_cs_derived(linked); + /* Set the linked source SHA1. */ + if (num_shaders == 1) { + memcpy(linked->linked_source_sha1, shader_list[0]->compiled_source_sha1, + SHA1_DIGEST_LENGTH); + } else { + struct mesa_sha1 sha1_ctx; + _mesa_sha1_init(&sha1_ctx); + + for (unsigned i = 0; i < num_shaders; i++) { + if (shader_list[i] == NULL) + continue; + + _mesa_sha1_update(&sha1_ctx, shader_list[i]->compiled_source_sha1, + SHA1_DIGEST_LENGTH); + } + _mesa_sha1_final(&sha1_ctx, linked->linked_source_sha1); + } + return linked; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 20719c757b2..6de28f39112 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2610,6 +2610,9 @@ struct gl_linked_shader { gl_shader_stage Stage; + /** All gl_shader::compiled_source_sha1 combined. */ + uint8_t linked_source_sha1[SHA1_DIGEST_LENGTH]; + struct gl_program *Program; /**< Post-compile assembly code */ /**