From 05bb4b48495c316bbe3dd4a52456850782029e78 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Mon, 5 Mar 2018 21:18:27 -0800 Subject: [PATCH] i965: Use brw_prog_key_set_id in disk cache load/store code Signed-off-by: Jordan Justen Reviewed-by: Timothy Arceri --- src/mesa/drivers/dri/i965/brw_disk_cache.c | 24 ++++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_disk_cache.c b/src/mesa/drivers/dri/i965/brw_disk_cache.c index 82a9c121c63..c478753d4ad 100644 --- a/src/mesa/drivers/dri/i965/brw_disk_cache.c +++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c @@ -94,36 +94,32 @@ read_and_upload(struct brw_context *brw, struct disk_cache *cache, switch (stage) { case MESA_SHADER_VERTEX: brw_vs_populate_key(brw, &prog_key.vs); - /* We don't care what instance of the program it is for the disk cache - * hash lookup, so set the id to 0 for the sha1 hashing. - * program_string_id will be set below. - */ - prog_key.vs.program_string_id = 0; break; case MESA_SHADER_TESS_CTRL: brw_tcs_populate_key(brw, &prog_key.tcs); - prog_key.tcs.program_string_id = 0; break; case MESA_SHADER_TESS_EVAL: brw_tes_populate_key(brw, &prog_key.tes); - prog_key.tes.program_string_id = 0; break; case MESA_SHADER_GEOMETRY: brw_gs_populate_key(brw, &prog_key.gs); - prog_key.gs.program_string_id = 0; break; case MESA_SHADER_FRAGMENT: brw_wm_populate_key(brw, &prog_key.wm); - prog_key.wm.program_string_id = 0; break; case MESA_SHADER_COMPUTE: brw_cs_populate_key(brw, &prog_key.cs); - prog_key.cs.program_string_id = 0; break; default: unreachable("Unsupported stage!"); } + /* We don't care what instance of the program it is for the disk cache hash + * lookup, so set the id to 0 for the sha1 hashing. program_string_id will + * be set below. + */ + brw_prog_key_set_id(&prog_key, stage, 0); + gen_shader_sha1(brw, prog, stage, &prog_key, binary_sha1); size_t buffer_size; @@ -171,32 +167,26 @@ read_and_upload(struct brw_context *brw, struct disk_cache *cache, switch (stage) { case MESA_SHADER_VERTEX: - prog_key.vs.program_string_id = brw_program(prog)->id; cache_id = BRW_CACHE_VS_PROG; stage_state = &brw->vs.base; break; case MESA_SHADER_TESS_CTRL: - prog_key.tcs.program_string_id = brw_program(prog)->id; cache_id = BRW_CACHE_TCS_PROG; stage_state = &brw->tcs.base; break; case MESA_SHADER_TESS_EVAL: - prog_key.tes.program_string_id = brw_program(prog)->id; cache_id = BRW_CACHE_TES_PROG; stage_state = &brw->tes.base; break; case MESA_SHADER_GEOMETRY: - prog_key.gs.program_string_id = brw_program(prog)->id; cache_id = BRW_CACHE_GS_PROG; stage_state = &brw->gs.base; break; case MESA_SHADER_FRAGMENT: - prog_key.wm.program_string_id = brw_program(prog)->id; cache_id = BRW_CACHE_FS_PROG; stage_state = &brw->wm.base; break; case MESA_SHADER_COMPUTE: - prog_key.cs.program_string_id = brw_program(prog)->id; cache_id = BRW_CACHE_CS_PROG; stage_state = &brw->cs.base; break; @@ -204,6 +194,8 @@ read_and_upload(struct brw_context *brw, struct disk_cache *cache, unreachable("Unsupported stage!"); } + brw_prog_key_set_id(&prog_key, stage, brw_program(prog)->id); + brw_alloc_stage_scratch(brw, stage_state, prog_data->total_scratch); if (unlikely(debug_enabled_for_stage(stage))) { -- 2.30.2