i965: Use ShaderCacheSerializeDriverBlob driver function
authorJordan Justen <jordan.l.justen@intel.com>
Mon, 9 Apr 2018 06:16:19 +0000 (23:16 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Tue, 10 Jul 2018 06:02:32 +0000 (23:02 -0700)
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 <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_link.cpp
src/mesa/drivers/dri/i965/brw_program.c

index e755de6241a69f9c9339a98e241b479c3759533a..2db22f1c08240a74d20a20d40c513f20df7256ed 100644 (file)
@@ -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
index 1071056f14968c4f1d90fc94a30d53aff2fceb10..ae4f63e33af104fc01a156e9f108d62934d02ec9 100644 (file)
@@ -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;
 
index e5c7579cf68ca95d16689c464d32e03f07568cf0..915c42bd522a11e9da49d40bf7fee503bbe5c09f 100644 (file)
@@ -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);