mesa: Always call ProgramBinarySerializeDriverBlob
authorJordan Justen <jordan.l.justen@intel.com>
Thu, 19 Apr 2018 22:39:40 +0000 (15:39 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Tue, 10 Jul 2018 06:02:32 +0000 (23:02 -0700)
The driver may prefer to have a different blob for
ARB_get_program_binary compared to the version saved out for the disk
shader cache.

Since they both use the driver_cache_blob field, we need to always
give the driver the opportunity to fill in the driver_cache_blob when
saving the program binary.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/main/program_binary.c

index af94b79f82d7d50d859c29857089df8534efcda1..427a79dc94dfde8bb230135b8d21d23c54a2d96a 100644 (file)
@@ -171,24 +171,22 @@ static void
 write_program_payload(struct gl_context *ctx, struct blob *blob,
                       struct gl_shader_program *sh_prog)
 {
-   bool serialize[MESA_SHADER_STAGES];
    for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
       struct gl_linked_shader *shader = sh_prog->_LinkedShaders[stage];
-      serialize[stage] = shader && shader->Program->driver_cache_blob == NULL;
-      if (serialize[stage])
+      if (shader)
          ctx->Driver.ProgramBinarySerializeDriverBlob(ctx, shader->Program);
    }
 
    serialize_glsl_program(blob, ctx, sh_prog);
 
    for (unsigned stage = 0; stage < MESA_SHADER_STAGES; stage++) {
-      if (!serialize[stage])
-         continue;
-
-      struct gl_program *prog = sh_prog->_LinkedShaders[stage]->Program;
-      ralloc_free(prog->driver_cache_blob);
-      prog->driver_cache_blob = NULL;
-      prog->driver_cache_blob_size = 0;
+      struct gl_linked_shader *shader = sh_prog->_LinkedShaders[stage];
+      if (shader) {
+         struct gl_program *prog = sh_prog->_LinkedShaders[stage]->Program;
+         ralloc_free(prog->driver_cache_blob);
+         prog->driver_cache_blob = NULL;
+         prog->driver_cache_blob_size = 0;
+      }
    }
 }