diff options
author | Jordan Justen <[email protected]> | 2018-02-28 21:43:22 -0800 |
---|---|---|
committer | Jordan Justen <[email protected]> | 2018-07-09 23:02:33 -0700 |
commit | eb5b4b0fd1b1e8c63a2fcc33b3a31e7a003a1b6c (patch) | |
tree | 795d706772d51be93fc3cf31b6e4d9e1e09e1f12 /src/mesa | |
parent | 48ce7745dcfec33205d6e45906684c112cc24103 (diff) |
i965: Add flag_state param to brw_search_cache
This allows brw_search_cache to be used to find programs without
causing extra state to be emitted in the case where the program isn't
being made active. (For example, to find the program to save out with
the ARB_get_program_binary interface.)
Signed-off-by: Jordan Justen <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_blorp.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_clip.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_cs.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_ff_gs.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_program_cache.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_sf.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_state.h | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tcs.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tes.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 7 |
12 files changed, 35 insertions, 45 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index 5f99e51bc28..4b0b15cf4f6 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -48,8 +48,8 @@ brw_blorp_lookup_shader(struct blorp_context *blorp, uint32_t *kernel_out, void *prog_data_out) { struct brw_context *brw = blorp->driver_ctx; - return brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG, - key, key_size, kernel_out, prog_data_out); + return brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG, key, key_size, + kernel_out, prog_data_out, true); } static bool diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c index 3a7c4829ed7..49c41d8c2e4 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.c +++ b/src/mesa/drivers/dri/i965/brw_clip.c @@ -203,9 +203,8 @@ brw_upload_clip_prog(struct brw_context *brw) } } - if (!brw_search_cache(&brw->cache, BRW_CACHE_CLIP_PROG, - &key, sizeof(key), - &brw->clip.prog_offset, &brw->clip.prog_data)) { + if (!brw_search_cache(&brw->cache, BRW_CACHE_CLIP_PROG, &key, sizeof(key), + &brw->clip.prog_offset, &brw->clip.prog_data, true)) { compile_clip_prog( brw, &key ); } } diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c index 614eb64bca9..498c80d46a5 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.c +++ b/src/mesa/drivers/dri/i965/brw_cs.c @@ -168,10 +168,9 @@ 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)) + if (brw_search_cache(&brw->cache, BRW_CACHE_CS_PROG, &key, sizeof(key), + &brw->cs.base.prog_offset, &brw->cs.base.prog_data, + true)) return; if (brw_disk_cache_upload_program(brw, MESA_SHADER_COMPUTE)) diff --git a/src/mesa/drivers/dri/i965/brw_ff_gs.c b/src/mesa/drivers/dri/i965/brw_ff_gs.c index 174418a4748..b2c4ee12f4d 100644 --- a/src/mesa/drivers/dri/i965/brw_ff_gs.c +++ b/src/mesa/drivers/dri/i965/brw_ff_gs.c @@ -251,9 +251,9 @@ brw_upload_ff_gs_prog(struct brw_context *brw) } if (brw->ff_gs.prog_active) { - if (!brw_search_cache(&brw->cache, BRW_CACHE_FF_GS_PROG, - &key, sizeof(key), - &brw->ff_gs.prog_offset, &brw->ff_gs.prog_data)) { + if (!brw_search_cache(&brw->cache, BRW_CACHE_FF_GS_PROG, &key, + sizeof(key), &brw->ff_gs.prog_offset, + &brw->ff_gs.prog_data, true)) { brw_codegen_ff_gs_prog(brw, &key); } } diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 9d4dc942d34..9acb0337e20 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -192,10 +192,9 @@ 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)) + if (brw_search_cache(&brw->cache, BRW_CACHE_GS_PROG, &key, sizeof(key), + &stage_state->prog_offset, &brw->gs.base.prog_data, + true)) return; if (brw_disk_cache_upload_program(brw, MESA_SHADER_GEOMETRY)) diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c index 54865f8b1b9..600b0611c8b 100644 --- a/src/mesa/drivers/dri/i965/brw_program_cache.c +++ b/src/mesa/drivers/dri/i965/brw_program_cache.c @@ -194,12 +194,10 @@ rehash(struct brw_cache *cache) * Returns the buffer object matching cache_id and key, or NULL. */ bool -brw_search_cache(struct brw_cache *cache, - enum brw_cache_id cache_id, - const void *key, GLuint key_size, - uint32_t *inout_offset, void *inout_prog_data) +brw_search_cache(struct brw_cache *cache, enum brw_cache_id cache_id, + const void *key, GLuint key_size, uint32_t *inout_offset, + void *inout_prog_data, bool flag_state) { - struct brw_context *brw = cache->brw; struct brw_cache_item *item; struct brw_cache_item lookup; GLuint hash; @@ -219,7 +217,8 @@ brw_search_cache(struct brw_cache *cache, if (item->offset != *inout_offset || prog_data != *((void **) inout_prog_data)) { - brw->ctx.NewDriverState |= (1 << cache_id); + if (likely(flag_state)) + cache->brw->ctx.NewDriverState |= (1 << cache_id); *inout_offset = item->offset; *((void **) inout_prog_data) = prog_data; } diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 37ce999dc07..73bc663f29f 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -164,9 +164,8 @@ brw_upload_sf_prog(struct brw_context *brw) key.frontface_ccw = brw->polygon_front_bit == render_to_fbo; } - if (!brw_search_cache(&brw->cache, BRW_CACHE_SF_PROG, - &key, sizeof(key), - &brw->sf.prog_offset, &brw->sf.prog_data)) { + if (!brw_search_cache(&brw->cache, BRW_CACHE_SF_PROG, &key, sizeof(key), + &brw->sf.prog_offset, &brw->sf.prog_data, true)) { compile_sf_prog( brw, &key ); } } diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 445f5e0b510..f6acf81b899 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -163,11 +163,9 @@ void brw_upload_cache(struct brw_cache *cache, GLuint aux_sz, uint32_t *out_offset, void *out_aux); -bool brw_search_cache(struct brw_cache *cache, - enum brw_cache_id cache_id, - const void *key, - GLuint key_size, - uint32_t *inout_offset, void *inout_aux); +bool brw_search_cache(struct brw_cache *cache, enum brw_cache_id cache_id, + const void *key, GLuint key_size, uint32_t *inout_offset, + void *inout_aux, bool flag_state); const void *brw_find_previous_compile(struct brw_cache *cache, enum brw_cache_id cache_id, diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c index eaea00e9e48..3b4642033fe 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs.c +++ b/src/mesa/drivers/dri/i965/brw_tcs.c @@ -337,10 +337,9 @@ brw_upload_tcs_prog(struct brw_context *brw) brw_tcs_populate_key(brw, &key); - if (brw_search_cache(&brw->cache, BRW_CACHE_TCS_PROG, - &key, sizeof(key), - &stage_state->prog_offset, - &brw->tcs.base.prog_data)) + if (brw_search_cache(&brw->cache, BRW_CACHE_TCS_PROG, &key, sizeof(key), + &stage_state->prog_offset, &brw->tcs.base.prog_data, + true)) return; if (brw_disk_cache_upload_program(brw, MESA_SHADER_TESS_CTRL)) diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c index 2811dbd649a..6f37dfabbf8 100644 --- a/src/mesa/drivers/dri/i965/brw_tes.c +++ b/src/mesa/drivers/dri/i965/brw_tes.c @@ -195,10 +195,9 @@ brw_upload_tes_prog(struct brw_context *brw) brw_tes_populate_key(brw, &key); - if (brw_search_cache(&brw->cache, BRW_CACHE_TES_PROG, - &key, sizeof(key), - &stage_state->prog_offset, - &brw->tes.base.prog_data)) + if (brw_search_cache(&brw->cache, BRW_CACHE_TES_PROG, &key, sizeof(key), + &stage_state->prog_offset, &brw->tes.base.prog_data, + true)) return; if (brw_disk_cache_upload_program(brw, MESA_SHADER_TESS_EVAL)) diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 21e75664ae9..f518649e751 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -341,9 +341,9 @@ 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)) + if (brw_search_cache(&brw->cache, BRW_CACHE_VS_PROG, &key, sizeof(key), + &brw->vs.base.prog_offset, &brw->vs.base.prog_data, + true)) return; if (brw_disk_cache_upload_program(brw, MESA_SHADER_VERTEX)) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index a8cf07ce7e2..c65ca166286 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -590,10 +590,9 @@ 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)) + if (brw_search_cache(&brw->cache, BRW_CACHE_FS_PROG, &key, sizeof(key), + &brw->wm.base.prog_offset, &brw->wm.base.prog_data, + true)) return; if (brw_disk_cache_upload_program(brw, MESA_SHADER_FRAGMENT)) |