summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2018-04-08 23:16:19 -0700
committerJordan Justen <[email protected]>2018-07-09 23:02:32 -0700
commit6497be42b7260b2279e41dcb05fcd6fc6551a061 (patch)
tree40bd2254ded9f25dd16d1108b474d0c6811f6c39 /src/mesa/drivers
parent450f00e39d40df2d1e82dae9de4c1679b26e0f9d (diff)
i965: Use ShaderCacheSerializeDriverBlob driver function
This function is called just before the gl_program::driver_cache_blob is saved out as part of the gl_program serialization. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_link.cpp11
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c3
3 files changed, 7 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index e755de6241a..2db22f1c082 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -343,6 +343,10 @@ brw_init_driver_functions(struct brw_context *brw,
functions->ProgramBinarySerializeDriverBlob = brw_program_serialize_nir;
functions->ProgramBinaryDeserializeDriverBlob =
brw_deserialize_program_binary;
+
+ if (brw->screen->disk_cache) {
+ functions->ShaderCacheSerializeDriverBlob = brw_program_serialize_nir;
+ }
}
static void
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 1071056f149..ae4f63e33af 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -359,17 +359,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
}
}
- if (brw->ctx.Cache) {
- for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
- struct gl_linked_shader *shader = shProg->_LinkedShaders[stage];
- if (!shader)
- continue;
-
- struct gl_program *prog = shader->Program;
- brw_program_serialize_nir(ctx, prog);
- }
- }
-
if (brw->precompile && !brw_shader_precompile(ctx, shProg))
return false;
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index e5c7579cf68..915c42bd522 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -843,6 +843,9 @@ brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo,
void
brw_program_serialize_nir(struct gl_context *ctx, struct gl_program *prog)
{
+ if (prog->driver_cache_blob)
+ return;
+
struct blob writer;
blob_init(&writer);
nir_serialize(&writer, prog->nir);