summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2017-10-13 13:00:23 -0700
committerJordan Justen <jordan.l.justen@intel.com>2017-10-21 21:02:11 -0700
commit6f3e70fe756400032eb19841d74b27df614c1a50 (patch)
tree791cf54291b16f6ccf3532905326c1f6b6d8e4f8
parentcdc1756d595709e8649f0546907ce8760a0b318a (diff)
main: Add driver cache blob fields to gl_program
These fields can be used to optionally save off a driver blob with the program metadata. For example, serialized nir, or tgsi. v3: * Rename serialized_nir* to driver_cache_blob*. (Tim) * Free memory. (Jason) Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
-rw-r--r--src/mesa/main/mtypes.h4
-rw-r--r--src/mesa/program/program.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 2802a0e360..b7a46aed53 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2079,6 +2079,10 @@ struct gl_program
struct nir_shader *nir;
+ /* Saved and restored with metadata. Freed with ralloc. */
+ void *driver_cache_blob;
+ size_t driver_cache_blob_size;
+
bool is_arb_asm; /** Is this an ARB assembly-style program */
/** Is this program written to on disk shader cache */
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 0defa012ae..faf5b7fa28 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -279,6 +279,10 @@ _mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
ralloc_free(prog->sh.BindlessImages);
}
+ if (prog->driver_cache_blob) {
+ ralloc_free(prog->driver_cache_blob);
+ }
+
ralloc_free(prog);
}