If the shader cache is enabled, after linking the program, we serialize the program to nir. This will be saved out by the glsl shader cache support.
Later, if the same program is found in the cache, we can use the nir for a fallback in the unlikely case that the gen binary program is not found in the cache. Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com> --- src/mesa/drivers/dri/i965/brw_link.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index 1a28e63fca..2d10325e4a 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -27,6 +27,7 @@ #include "compiler/glsl/ir.h" #include "compiler/glsl/ir_optimization.h" #include "compiler/glsl/program.h" +#include "compiler/nir/nir_serialize.h" #include "program/program.h" #include "main/mtypes.h" #include "main/shaderapi.h" @@ -323,6 +324,15 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) NIR_PASS_V(prog->nir, nir_lower_samplers, shProg); NIR_PASS_V(prog->nir, nir_lower_atomics, shProg); + if (brw->ctx.Cache) { + struct blob writer; + blob_init(&writer); + nir_serialize(&writer, prog->nir); + // TODO: ralloc and copy. what mem ctx? + prog->serialized_nir = writer.data; + prog->serialized_nir_size = writer.size; + } + infos[stage] = &prog->nir->info; update_xfb_info(prog->sh.LinkedTransformFeedback, infos[stage]); -- 2.15.0.rc0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev