aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorGrazvydas Ignotas <[email protected]>2017-03-16 01:09:27 +0200
committerTimothy Arceri <[email protected]>2017-03-21 11:15:52 +1100
commit529a767041c880f90c4465cb34a89430459c7fce (patch)
treeb19c1fcbc36ffe1314155559c7fa52226c8c6e2d /src/mesa
parent021c87fa24afe849e51dd0249ec8e7b59e097062 (diff)
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 <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_shader_cache.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c
index 43831947b23..061b27221b3 100644
--- a/src/mesa/state_tracker/st_shader_cache.c
+++ b/src/mesa/state_tracker/st_shader_cache.c
@@ -183,7 +183,7 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
struct st_vertex_program *stvp = (struct st_vertex_program *) glprog;
stage_sha1[i] = stvp->sha1;
ralloc_strcat(&buf, " vs");
- _mesa_sha1_compute(buf, strlen(buf), stage_sha1[i]);
+ disk_cache_compute_key(ctx->Cache, buf, strlen(buf), stage_sha1[i]);
break;
}
case MESA_SHADER_TESS_CTRL: {
@@ -191,7 +191,7 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
(struct st_tessctrl_program *) glprog;
stage_sha1[i] = stcp->sha1;
ralloc_strcat(&buf, " tcs");
- _mesa_sha1_compute(buf, strlen(buf), stage_sha1[i]);
+ disk_cache_compute_key(ctx->Cache, buf, strlen(buf), stage_sha1[i]);
break;
}
case MESA_SHADER_TESS_EVAL: {
@@ -199,7 +199,7 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
(struct st_tesseval_program *) glprog;
stage_sha1[i] = step->sha1;
ralloc_strcat(&buf, " tes");
- _mesa_sha1_compute(buf, strlen(buf), stage_sha1[i]);
+ disk_cache_compute_key(ctx->Cache, buf, strlen(buf), stage_sha1[i]);
break;
}
case MESA_SHADER_GEOMETRY: {
@@ -207,7 +207,7 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
(struct st_geometry_program *) glprog;
stage_sha1[i] = stgp->sha1;
ralloc_strcat(&buf, " gs");
- _mesa_sha1_compute(buf, strlen(buf), stage_sha1[i]);
+ disk_cache_compute_key(ctx->Cache, buf, strlen(buf), stage_sha1[i]);
break;
}
case MESA_SHADER_FRAGMENT: {
@@ -215,7 +215,7 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
(struct st_fragment_program *) glprog;
stage_sha1[i] = stfp->sha1;
ralloc_strcat(&buf, " fs");
- _mesa_sha1_compute(buf, strlen(buf), stage_sha1[i]);
+ disk_cache_compute_key(ctx->Cache, buf, strlen(buf), stage_sha1[i]);
break;
}
case MESA_SHADER_COMPUTE: {
@@ -223,7 +223,7 @@ st_load_tgsi_from_disk_cache(struct gl_context *ctx,
(struct st_compute_program *) glprog;
stage_sha1[i] = stcp->sha1;
ralloc_strcat(&buf, " cs");
- _mesa_sha1_compute(buf, strlen(buf), stage_sha1[i]);
+ disk_cache_compute_key(ctx->Cache, buf, strlen(buf), stage_sha1[i]);
break;
}
default: