[Mesa-dev] [PATCH 88/88] i965: handle 32bit and 64bit version of shader cache objects
Timothy Arceri
timothy.arceri at collabora.com
Sat Sep 24 05:26:09 UTC 2016
Pointers will have different lengths so we simple create a different
sha1 for each platform.
---
src/mesa/drivers/dri/i965/brw_shader_cache.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_shader_cache.c b/src/mesa/drivers/dri/i965/brw_shader_cache.c
index 9d1c8d0..1769227 100644
--- a/src/mesa/drivers/dri/i965/brw_shader_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_shader_cache.c
@@ -29,6 +29,7 @@
#include <compiler/glsl/cache.h>
#include <compiler/glsl/blob.h>
#include <compiler/glsl/program.h>
+#include <compiler/glsl/shader_cache.h>
#include <compiler/nir_types.h>
#include <program/ir_to_mesa.h>
#include <program/program.h>
@@ -40,6 +41,15 @@
#include "brw_context.h"
static void
+format_program_sha1(struct gl_shader_program *prog, char *manifest,
+ size_t manifest_size, int *offset)
+{
+ char sha1_buf[41];
+ *offset += snprintf(manifest, manifest_size, CACHED_PROGRAM" %s\n",
+ _mesa_sha1_format(sha1_buf, prog->sha1));
+}
+
+static void
gen_vs_sha1(struct brw_context *brw, struct gl_shader_program *prog,
struct brw_vs_prog_key *vs_key, unsigned char *vs_sha1)
{
@@ -48,8 +58,7 @@ gen_vs_sha1(struct brw_context *brw, struct gl_shader_program *prog,
char manifest[256];
int offset = 0;
- offset += snprintf(manifest, sizeof(manifest), "program: %s\n",
- _mesa_sha1_format(sha1_buf, prog->sha1));
+ format_program_sha1(prog, manifest, sizeof(manifest), &offset);
vs_key->program_string_id = 0;
_mesa_sha1_compute(vs_key, sizeof *vs_key, sha1);
@@ -68,8 +77,7 @@ gen_tcs_sha1(struct brw_context *brw, struct gl_shader_program *prog,
char manifest[256];
int offset = 0;
- offset += snprintf(manifest, sizeof(manifest), "program: %s\n",
- _mesa_sha1_format(sha1_buf, prog->sha1));
+ format_program_sha1(prog, manifest, sizeof(manifest), &offset);
brw_tcs_populate_key(brw, tcs_key);
tcs_key->program_string_id = 0;
@@ -89,8 +97,7 @@ gen_tes_sha1(struct brw_context *brw, struct gl_shader_program *prog,
char manifest[256];
int offset = 0;
- offset += snprintf(manifest, sizeof(manifest), "program: %s\n",
- _mesa_sha1_format(sha1_buf, prog->sha1));
+ format_program_sha1(prog, manifest, sizeof(manifest), &offset);
brw_tes_populate_key(brw, tes_key);
tes_key->program_string_id = 0;
@@ -110,8 +117,7 @@ gen_gs_sha1(struct brw_context *brw, struct gl_shader_program *prog,
char manifest[256];
int offset = 0;
- offset += snprintf(manifest, sizeof(manifest), "program: %s\n",
- _mesa_sha1_format(sha1_buf, prog->sha1));
+ format_program_sha1(prog, manifest, sizeof(manifest), &offset);
brw_gs_populate_key(brw, gs_key);
gs_key->program_string_id = 0;
@@ -133,8 +139,7 @@ gen_wm_sha1(struct brw_context *brw, struct gl_shader_program *prog,
int offset = 0;
struct gl_program *vs = (struct gl_program *) brw->vertex_program;
- offset += snprintf(manifest, sizeof(manifest), "program: %s\n",
- _mesa_sha1_format(sha1_buf, prog->sha1));
+ format_program_sha1(prog, manifest, sizeof(manifest), &offset);
GLbitfield64 current_valid = brw->vue_map_geom_out.slots_valid;
GLbitfield64 outputs_written =
--
2.7.4
More information about the mesa-dev
mailing list