Mesa (main): mesa: add gl_linked_shader::linked_source_sha1
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Nov 26 13:07:22 UTC 2021
Module: Mesa
Branch: main
Commit: 67f01e02d9daa3334f14f17899bc7aa068d89459
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=67f01e02d9daa3334f14f17899bc7aa068d89459
Author: Marek Olšák <marek.olsak at amd.com>
Date: Thu Nov 18 09:15:27 2021 -0500
mesa: add gl_linked_shader::linked_source_sha1
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869>
---
src/compiler/glsl/linker.cpp | 18 ++++++++++++++++++
src/mesa/main/mtypes.h | 3 +++
2 files changed, 21 insertions(+)
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 */
/**
More information about the mesa-commit
mailing list