From: Timothy Arceri <timothy.arc...@collabora.com> This enables the cache on vertex and fragment shaders only.
[jordan.l.jus...@intel.com: reword subject] [jordan.l.jus...@intel.com: *_cached_program => brw_disk_cache_*_program] Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com> --- src/mesa/drivers/dri/i965/brw_state_upload.c | 2 ++ src/mesa/drivers/dri/i965/brw_vs.c | 21 ++++++++++++++------- src/mesa/drivers/dri/i965/brw_wm.c | 24 +++++++++++++++--------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 1ae45ba2ac..140146970b 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -434,6 +434,8 @@ brw_upload_programs(struct brw_context *brw, brw_upload_clip_prog(brw); brw_upload_sf_prog(brw); } + + brw_disk_cache_write_program(brw); } else if (pipeline == BRW_COMPUTE_PIPELINE) { brw_upload_cs_prog(brw); } diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 055ea9d742..7190fc4a65 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -364,13 +364,20 @@ brw_upload_vs_prog(struct brw_context *brw) brw_vs_populate_key(brw, &key); - if (!brw_search_cache(&brw->cache, BRW_CACHE_VS_PROG, - &key, sizeof(key), - &brw->vs.base.prog_offset, &brw->vs.base.prog_data)) { - bool success = brw_codegen_vs_prog(brw, vp, &key); - (void) success; - assert(success); - } + if (brw_search_cache(&brw->cache, BRW_CACHE_VS_PROG, + &key, sizeof(key), + &brw->vs.base.prog_offset, &brw->vs.base.prog_data)) + return; + + if (brw_disk_cache_upload_program(brw, MESA_SHADER_VERTEX)) + return; + + vp = (struct brw_program *) brw->vertex_program; + vp->id = key.program_string_id; + + bool success = brw_codegen_vs_prog(brw, vp, &key); + (void) success; + assert(success); } bool diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 40b23fc0e6..5ff24f6dd4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -600,15 +600,21 @@ brw_upload_wm_prog(struct brw_context *brw) brw_wm_populate_key(brw, &key); - if (!brw_search_cache(&brw->cache, BRW_CACHE_FS_PROG, - &key, sizeof(key), - &brw->wm.base.prog_offset, - &brw->wm.base.prog_data)) { - bool success = brw_codegen_wm_prog(brw, fp, &key, - &brw->vue_map_geom_out); - (void) success; - assert(success); - } + if (brw_search_cache(&brw->cache, BRW_CACHE_FS_PROG, + &key, sizeof(key), + &brw->wm.base.prog_offset, + &brw->wm.base.prog_data)) + return; + + if (brw_disk_cache_upload_program(brw, MESA_SHADER_FRAGMENT)) + return; + + fp = (struct brw_program *) brw->fragment_program; + fp->id = key.program_string_id; + + bool success = brw_codegen_wm_prog(brw, fp, &key, &brw->vue_map_geom_out); + (void) success; + assert(success); } bool -- 2.14.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev