[Mesa-dev] [PATCH 20/23] st/glsl_to_tgsi: add st_get_program_binary_driver_sha1() helper

Timothy Arceri tarceri at itsqueeze.com
Wed Nov 29 01:24:56 UTC 2017


This will be used by ARB_get_program_binary.
---
 src/mesa/state_tracker/st_shader_cache.c | 6 ++++++
 src/mesa/state_tracker/st_shader_cache.h | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/src/mesa/state_tracker/st_shader_cache.c b/src/mesa/state_tracker/st_shader_cache.c
index 62d62f76117..a971b0d7ee7 100644
--- a/src/mesa/state_tracker/st_shader_cache.c
+++ b/src/mesa/state_tracker/st_shader_cache.c
@@ -23,20 +23,26 @@
 
 #include <stdio.h>
 #include "st_debug.h"
 #include "st_program.h"
 #include "st_shader_cache.h"
 #include "compiler/glsl/program.h"
 #include "pipe/p_shader_tokens.h"
 #include "program/ir_to_mesa.h"
 #include "util/u_memory.h"
 
+void
+st_get_program_binary_driver_sha1(struct gl_context *ctx, uint8_t *sha1)
+{
+   disk_cache_compute_key(ctx->Cache, NULL, 0, sha1);
+}
+
 static void
 write_stream_out_to_cache(struct blob *blob,
                           struct pipe_shader_state *tgsi)
 {
    blob_write_bytes(blob, &tgsi->stream_output,
                     sizeof(tgsi->stream_output));
 }
 
 static void
 write_tgsi_to_cache(struct blob *blob, const struct tgsi_token *tokens,
diff --git a/src/mesa/state_tracker/st_shader_cache.h b/src/mesa/state_tracker/st_shader_cache.h
index 358c6ecef88..488035c7ed5 100644
--- a/src/mesa/state_tracker/st_shader_cache.h
+++ b/src/mesa/state_tracker/st_shader_cache.h
@@ -25,20 +25,23 @@
 #include "compiler/blob.h"
 #include "main/mtypes.h"
 #include "pipe/p_state.h"
 #include "util/disk_cache.h"
 #include "util/mesa-sha1.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+void
+st_get_program_binary_driver_sha1(struct gl_context *ctx, uint8_t *sha1);
+
 void
 st_serialise_tgsi_program(struct gl_context *ctx, struct gl_program *prog);
 
 void
 st_deserialise_tgsi_program(struct gl_context *ctx,
                             struct gl_shader_program *shProg,
                             struct gl_program *prog);
 
 bool
 st_load_tgsi_from_disk_cache(struct gl_context *ctx,
-- 
2.14.3



More information about the mesa-dev mailing list