Mesa (main): glsl: fix setting compiled_source_sha1 without a shader cache

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Dec 11 20:39:57 UTC 2021


Module: Mesa
Branch: main
Commit: e2a18833372c1d060635dd9d73956fc22b7b674e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e2a18833372c1d060635dd9d73956fc22b7b674e

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Nov 26 11:41:51 2021 -0500

glsl: fix setting compiled_source_sha1 without a shader cache

We need to set it even if Cache == NULL.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13966>

---

 src/compiler/glsl/glsl_parser_extras.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index fbeea362abd..2495fbb7cf3 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -2316,9 +2316,10 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
    delete state->symbols;
    ralloc_free(state);
 
-   if (ctx->Cache && shader->CompileStatus == COMPILE_SUCCESS) {
+   if (shader->CompileStatus == COMPILE_SUCCESS)
       memcpy(shader->compiled_source_sha1, source_sha1, SHA1_DIGEST_LENGTH);
 
+   if (ctx->Cache && shader->CompileStatus == COMPILE_SUCCESS) {
       char sha1_buf[41];
       disk_cache_put_key(ctx->Cache, shader->disk_cache_sha1);
       if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {



More information about the mesa-commit mailing list