mesa: add gl_linked_shader::linked_source_sha1

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>
This commit is contained in:
Marek Olšák
2021-11-18 09:15:27 -05:00
committed by Marge Bot
parent 4364449677
commit 67f01e02d9
2 changed files with 21 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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 */
/**