mesa: rename gl_shader::sha1 to disk_cache_sha1

there will be more sha1s

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 08:40:29 -05:00
committed by Marge Bot
parent 0bb580754c
commit d473b31fe7
4 changed files with 11 additions and 10 deletions

View File

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

View File

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

View File

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

View File

@@ -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"