summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_tcs.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-11-11 13:31:06 -0800
committerKenneth Graunke <[email protected]>2017-01-17 21:47:10 -0800
commitf9edc550b2bb76f77e33b6cb122a91f266bc5958 (patch)
treed837ff13224d56aa2b9be0a510c82d5a61cecb92 /src/mesa/drivers/dri/i965/brw_tcs.c
parente7d4008ebfe561ee0aa3df6cdcfd39a8842ed659 (diff)
i965: Make a helper for finding an existing shader variant.
We had five copies of the same "walk the cache and look for an existing shader variant for this program" code. Now we have one helper function that returns the key. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_tcs.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 78ad257e3b9..bbba7496fa6 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -120,27 +120,15 @@ static void
brw_tcs_debug_recompile(struct brw_context *brw, struct gl_program *prog,
const struct brw_tcs_prog_key *key)
{
- struct brw_cache_item *c = NULL;
- const struct brw_tcs_prog_key *old_key = NULL;
- bool found = false;
-
perf_debug("Recompiling tessellation control shader for program %d\n",
prog->Id);
- for (unsigned int i = 0; i < brw->cache.size; i++) {
- for (c = brw->cache.items[i]; c; c = c->next) {
- if (c->cache_id == BRW_CACHE_TCS_PROG) {
- old_key = c->key;
-
- if (old_key->program_string_id == key->program_string_id)
- break;
- }
- }
- if (c)
- break;
- }
+ bool found = false;
+ const struct brw_tcs_prog_key *old_key =
+ brw_find_previous_compile(&brw->cache, BRW_CACHE_TCS_PROG,
+ key->program_string_id);
- if (!c) {
+ if (!old_key) {
perf_debug(" Didn't find previous compile in the shader cache for "
"debug\n");
return;