diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 31de7d22758..5a92cd716f1 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -2153,11 +2153,11 @@ can_skip_compile(struct gl_context *ctx, struct gl_shader *shader, if (ctx->Cache) { char buf[41]; disk_cache_compute_key(ctx->Cache, source, strlen(source), - shader->sha1); - if (disk_cache_has_key(ctx->Cache, shader->sha1)) { + shader->disk_cache_sha1); + if (disk_cache_has_key(ctx->Cache, shader->disk_cache_sha1)) { /* We've seen this shader before and know it compiles */ if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { - _mesa_sha1_format(buf, shader->sha1); + _mesa_sha1_format(buf, shader->disk_cache_sha1); fprintf(stderr, "deferring compile of shader: %s\n", buf); } shader->CompileStatus = COMPILE_SKIPPED; @@ -2295,9 +2295,9 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, if (ctx->Cache && shader->CompileStatus == COMPILE_SUCCESS) { char sha1_buf[41]; - disk_cache_put_key(ctx->Cache, shader->sha1); + disk_cache_put_key(ctx->Cache, shader->disk_cache_sha1); if (ctx->_Shader->Flags & GLSL_CACHE_INFO) { - _mesa_sha1_format(sha1_buf, shader->sha1); + _mesa_sha1_format(sha1_buf, shader->disk_cache_sha1); fprintf(stderr, "marking shader: %s\n", sha1_buf); } } diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp index 120712d2201..6819602aab7 100644 --- a/src/compiler/glsl/shader_cache.cpp +++ b/src/compiler/glsl/shader_cache.cpp @@ -124,7 +124,7 @@ shader_cache_write_program_metadata(struct gl_context *ctx, goto fail; for (unsigned i = 0; i < prog->NumShaders; i++) { - memcpy(cache_item_metadata.keys[i], prog->Shaders[i]->sha1, + memcpy(cache_item_metadata.keys[i], prog->Shaders[i]->disk_cache_sha1, sizeof(cache_key)); } @@ -204,7 +204,7 @@ shader_cache_read_program_metadata(struct gl_context *ctx, for (unsigned i = 0; i < prog->NumShaders; i++) { struct gl_shader *sh = prog->Shaders[i]; - _mesa_sha1_format(sha1buf, sh->sha1); + _mesa_sha1_format(sha1buf, sh->disk_cache_sha1); ralloc_asprintf_append(&buf, "%s: %s\n", _mesa_shader_stage_to_abbrev(sh->Stage), sha1buf); } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 203f365465f..e9d0fc37a62 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -52,6 +52,7 @@ #include "util/u_idalloc.h" #include "util/simple_mtx.h" #include "util/u_dynarray.h" +#include "util/mesa-sha1.h" #include "vbo/vbo.h" @@ -2676,14 +2677,15 @@ struct gl_shader GLuint Name; /**< AKA the handle */ GLint RefCount; /**< Reference count */ GLchar *Label; /**< GL_KHR_debug */ - unsigned char sha1[20]; /**< SHA1 hash of pre-processed source */ GLboolean DeletePending; bool IsES; /**< True if this shader uses GLSL ES */ enum gl_compile_status CompileStatus; - const GLchar *Source; /**< Source code string */ + /** SHA1 of the pre-processed source used by the disk cache. */ + uint8_t disk_cache_sha1[SHA1_DIGEST_LENGTH]; + const GLchar *Source; /**< Source code string */ const GLchar *FallbackSource; /**< Fallback string used by on-disk cache*/ GLchar *InfoLog; diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 7d43c95aa9b..52cde5d1962 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -60,7 +60,6 @@ #include "program/prog_parameter.h" #include "util/ralloc.h" #include "util/hash_table.h" -#include "util/mesa-sha1.h" #include "util/crc32.h" #include "util/os_file.h" #include "util/simple_list.h"