diff options
author | Timothy Arceri <[email protected]> | 2016-11-29 12:24:54 +1100 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2017-10-31 23:36:54 -0700 |
commit | 5a4afd822fa3c6f8879d1228d1ec08da90aacf35 (patch) | |
tree | 0a0bc55b6daf96c80ba4385fa90ce9d5aa889e8f /src/mesa | |
parent | 2589e7ddafb63583498f5f7138914d2a2e634960 (diff) |
i965: add shader cache support for geometry shaders
v2:
* Use MAYBE_UNUSED. (Matt)
[[email protected]: *_cached_program => brw_disk_cache_*_program]
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_disk_cache.c | 21 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs.c | 22 |
2 files changed, 35 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_disk_cache.c b/src/mesa/drivers/dri/i965/brw_disk_cache.c index 54da1abab63..f35d41e79d1 100644 --- a/src/mesa/drivers/dri/i965/brw_disk_cache.c +++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c @@ -30,6 +30,7 @@ #include "util/mesa-sha1.h" #include "brw_context.h" +#include "brw_gs.h" #include "brw_state.h" #include "brw_vs.h" #include "brw_wm.h" @@ -119,6 +120,10 @@ read_and_upload(struct brw_context *brw, struct disk_cache *cache, */ prog_key.vs.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; @@ -177,6 +182,11 @@ read_and_upload(struct brw_context *brw, struct disk_cache *cache, cache_id = BRW_CACHE_VS_PROG; stage_state = &brw->vs.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; @@ -277,6 +287,17 @@ brw_disk_cache_write_program(struct brw_context *brw) MESA_SHADER_VERTEX); } + prog = brw->ctx._Shader->CurrentProgram[MESA_SHADER_GEOMETRY]; + if (prog && !prog->program_written_to_cache) { + struct brw_gs_prog_key gs_key; + brw_gs_populate_key(brw, &gs_key); + gs_key.program_string_id = 0; + + write_program_data(brw, prog, &gs_key, brw->gs.base.prog_data, + brw->gs.base.prog_offset, cache, + MESA_SHADER_GEOMETRY); + } + prog = brw->ctx._Shader->CurrentProgram[MESA_SHADER_FRAGMENT]; if (prog && !prog->program_written_to_cache) { struct brw_wm_prog_key wm_key; diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 19eab2f5332..f74ee178f25 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -192,14 +192,20 @@ brw_upload_gs_prog(struct brw_context *brw) brw_gs_populate_key(brw, &key); - if (!brw_search_cache(&brw->cache, BRW_CACHE_GS_PROG, - &key, sizeof(key), - &stage_state->prog_offset, - &brw->gs.base.prog_data)) { - bool success = brw_codegen_gs_prog(brw, gp, &key); - assert(success); - (void)success; - } + if (brw_search_cache(&brw->cache, BRW_CACHE_GS_PROG, + &key, sizeof(key), + &stage_state->prog_offset, + &brw->gs.base.prog_data)) + return; + + if (brw_disk_cache_upload_program(brw, MESA_SHADER_GEOMETRY)) + return; + + gp = (struct brw_program *) brw->programs[MESA_SHADER_GEOMETRY]; + gp->id = key.program_string_id; + + MAYBE_UNUSED bool success = brw_codegen_gs_prog(brw, gp, &key); + assert(success); } bool |