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
}
}
- 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 );
}
}
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))
}
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);
}
}
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))
* 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;
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;
}
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 );
}
}
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,
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))
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))
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))
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))