diff options
author | Jordan Justen <[email protected]> | 2017-03-01 16:52:23 -0800 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2017-10-31 23:36:54 -0700 |
commit | 8a019f5601ced415d13f55e3c06ab4cb3b7d5989 (patch) | |
tree | 95897db57f46272287b01a72629818e2e0da3035 /src/mesa/drivers/dri/i965/brw_cs.c | |
parent | 42383faf51c69aa2c456d7dd5abfcb7c04c93709 (diff) |
i965: Add shader cache support for compute
v2:
* Use MAYBE_UNUSED. (Matt)
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_cs.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_cs.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c index 1d34a8a79d1..71d0beaae97 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.c +++ b/src/mesa/drivers/dri/i965/brw_cs.c @@ -130,7 +130,7 @@ brw_codegen_cs_prog(struct brw_context *brw, } -static void +void brw_cs_populate_key(struct brw_context *brw, struct brw_cs_prog_key *key) { struct gl_context *ctx = &brw->ctx; @@ -168,14 +168,20 @@ brw_upload_cs_prog(struct brw_context *brw) brw_cs_populate_key(brw, &key); - if (!brw_search_cache(&brw->cache, BRW_CACHE_CS_PROG, - &key, sizeof(key), - &brw->cs.base.prog_offset, - &brw->cs.base.prog_data)) { - bool success = brw_codegen_cs_prog(brw, cp, &key); - (void) success; - assert(success); - } + if (brw_search_cache(&brw->cache, BRW_CACHE_CS_PROG, + &key, sizeof(key), + &brw->cs.base.prog_offset, + &brw->cs.base.prog_data)) + return; + + if (brw_disk_cache_upload_program(brw, MESA_SHADER_COMPUTE)) + return; + + cp = (struct brw_program *) brw->programs[MESA_SHADER_COMPUTE]; + cp->id = key.program_string_id; + + MAYBE_UNUSED bool success = brw_codegen_cs_prog(brw, cp, &key); + assert(success); } |