[Mesa-dev] [PATCH 73/88] i965: add tess sha1 generation functions
Timothy Arceri
timothy.arceri at collabora.com
Sat Sep 24 05:25:54 UTC 2016
---
src/mesa/drivers/dri/i965/brw_shader_cache.c | 48 ++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_shader_cache.c b/src/mesa/drivers/dri/i965/brw_shader_cache.c
index f95dc57..097e079 100644
--- a/src/mesa/drivers/dri/i965/brw_shader_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_shader_cache.c
@@ -60,6 +60,48 @@ gen_vs_sha1(struct brw_context *brw, struct gl_shader_program *prog,
}
static void
+gen_tcs_sha1(struct brw_context *brw, struct gl_shader_program *prog,
+ struct brw_tcs_prog_key *tcs_key, unsigned char *tcs_sha1)
+{
+ char sha1_buf[41];
+ unsigned char sha1[20];
+ char manifest[256];
+ int offset = 0;
+
+ offset += snprintf(manifest, sizeof(manifest), "program: %s\n",
+ _mesa_sha1_format(sha1_buf, prog->sha1));
+
+ brw_tcs_populate_key(brw, tcs_key);
+ tcs_key->program_string_id = 0;
+ _mesa_sha1_compute(tcs_key, sizeof *tcs_key, sha1);
+ offset += snprintf(manifest + offset, sizeof(manifest) - offset,
+ "tcs_key: %s\n", _mesa_sha1_format(sha1_buf, sha1));
+
+ _mesa_sha1_compute(manifest, strlen(manifest), tcs_sha1);
+}
+
+static void
+gen_tes_sha1(struct brw_context *brw, struct gl_shader_program *prog,
+ struct brw_tes_prog_key *tes_key, unsigned char *tes_sha1)
+{
+ char sha1_buf[41];
+ unsigned char sha1[20];
+ char manifest[256];
+ int offset = 0;
+
+ offset += snprintf(manifest, sizeof(manifest), "program: %s\n",
+ _mesa_sha1_format(sha1_buf, prog->sha1));
+
+ brw_tes_populate_key(brw, tes_key);
+ tes_key->program_string_id = 0;
+ _mesa_sha1_compute(tes_key, sizeof *tes_key, sha1);
+ offset += snprintf(manifest + offset, sizeof(manifest) - offset,
+ "tes_key: %s\n", _mesa_sha1_format(sha1_buf, sha1));
+
+ _mesa_sha1_compute(manifest, strlen(manifest), tes_sha1);
+}
+
+static void
gen_gs_sha1(struct brw_context *brw, struct gl_shader_program *prog,
struct brw_gs_prog_key *gs_key, unsigned char *gs_sha1)
{
@@ -515,6 +557,12 @@ upload_cached_program(struct brw_context *brw, gl_shader_stage stage)
case MESA_SHADER_VERTEX:
gen_vs_sha1(brw, prog, &vs_key, binary_sha1);
break;
+ case MESA_SHADER_TESS_CTRL:
+ gen_tcs_sha1(brw, prog, &tcs_key, binary_sha1);
+ break;
+ case MESA_SHADER_TESS_EVAL:
+ gen_tes_sha1(brw, prog, &tes_key, binary_sha1);
+ break;
case MESA_SHADER_GEOMETRY:
gen_gs_sha1(brw, prog, &gs_key, binary_sha1);
break;
--
2.7.4
More information about the mesa-dev
mailing list