Patch initializes program cache on context creation, caches linked programs and skips linking if program is found from the cache.
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com> --- src/mesa/main/context.c | 4 ++++ src/mesa/program/ir_to_mesa.cpp | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 8eb426d..6119572 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -131,6 +131,7 @@ #include "vtxfmt.h" #include "program/program.h" #include "program/prog_print.h" +#include "program/prog_diskcache.h" #include "math/m_matrix.h" #include "main/dispatch.h" /* for _gloffset_COUNT */ @@ -993,6 +994,7 @@ _mesa_initialize_dispatch_tables(struct gl_context *ctx) _mesa_initialize_save_table(ctx); } + /** * Initialize a struct gl_context struct (rendering context). * @@ -1136,6 +1138,8 @@ _mesa_initialize_context(struct gl_context *ctx, ctx->FirstTimeCurrent = GL_TRUE; + mesa_program_diskcache_init(ctx); + return GL_TRUE; fail: diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index b3fab72..01165a4 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -55,6 +55,7 @@ extern "C" { #include "program/program.h" #include "program/prog_parameter.h" #include "program/sampler.h" +#include "program/prog_diskcache.h" } static int swizzle_for_size(int size); @@ -3084,6 +3085,10 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) } } + /* Search program disk cache if active. */ + if (ctx->BinaryCacheActive && mesa_program_diskcache_find(prog) == 0) + return; + if (prog->LinkStatus) { link_shaders(ctx, prog); } @@ -3092,6 +3097,8 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) if (!ctx->Driver.LinkShader(ctx, prog)) { prog->LinkStatus = GL_FALSE; } else { + if (ctx->BinaryCacheActive) + mesa_program_diskcache_cache(prog); prog->_Linked = GL_TRUE; } } -- 1.8.3.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev