[Mesa-dev] [PATCH 01/19] mesa: Add disk shader cache driver blob callback
Jordan Justen
jordan.l.justen at intel.com
Mon May 14 16:52:02 UTC 2018
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
src/compiler/glsl/shader_cache.cpp | 8 ++++++++
src/mesa/main/dd.h | 15 +++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 042f3a60f5b..31d0aa62966 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -102,6 +102,14 @@ shader_cache_write_program_metadata(struct gl_context *ctx,
struct blob metadata;
blob_init(&metadata);
+ if (ctx->Driver.ShaderCacheSerializeDriverBlob) {
+ for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+ struct gl_linked_shader *sh = prog->_LinkedShaders[i];
+ if (sh)
+ ctx->Driver.ShaderCacheSerializeDriverBlob(ctx, sh->Program);
+ }
+ }
+
serialize_glsl_program(&metadata, ctx, prog);
struct cache_item_metadata cache_item_metadata;
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 9f9606ac6b5..7a1e6823ac5 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1274,6 +1274,21 @@ struct dd_function_table {
struct gl_semaphore_object *semObj,
int fd);
/*@}*/
+
+ /**
+ * \name Disk shader cache functions
+ */
+ /*@{*/
+ /**
+ * Called to initialize gl_program::driver_cache_blob (and size) with a
+ * ralloc allocated buffer.
+ *
+ * This buffer will be saved and restored as part of the gl_program
+ * serialization and deserialization.
+ */
+ void (*ShaderCacheSerializeDriverBlob)(struct gl_context *ctx,
+ struct gl_program *prog);
+ /*@}*/
};
--
2.16.2
More information about the mesa-dev
mailing list