util/disk_cache: use a helper to compute cache keys

This will allow to hash additional data into the cache keys or even
change the hashing algorithm easily, should we decide to do so.

v2: don't try to compute key (and crash) if cache is disabled

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
Grazvydas Ignotas
2017-03-16 01:09:27 +02:00
committed by Timothy Arceri
parent 021c87fa24
commit 529a767041
7 changed files with 51 additions and 25 deletions

View File

@@ -1331,7 +1331,7 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
ralloc_asprintf_append(&buf, "%s: %s\n",
_mesa_shader_stage_to_abbrev(sh->Stage), sha1buf);
}
_mesa_sha1_compute(buf, strlen(buf), prog->data->sha1);
disk_cache_compute_key(cache, buf, strlen(buf), prog->data->sha1);
ralloc_free(buf);
size_t size;