From 255f4bb2903dc96d24507a3eaae31bb77cb0ee6c Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Wed, 12 Jun 2024 16:13:27 +0200 Subject: [PATCH] llvmpipe: Only evict cache entries if a fence is available Makes sure that no chaders are running when accessing sample_functions. Fixes: 7ebf7f4 ("llvmpipe: Compile sample functioins on demand") Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/drivers/llvmpipe/lp_texture_handle.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_texture_handle.c b/src/gallium/drivers/llvmpipe/lp_texture_handle.c index 9e57dc9cdfd..fac2a2be94e 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture_handle.c +++ b/src/gallium/drivers/llvmpipe/lp_texture_handle.c @@ -1021,13 +1021,14 @@ llvmpipe_clear_sample_functions_cache(struct llvmpipe_context *ctx, struct pipe_ simple_mtx_unlock(&matrix->lock); - if (fence) + if (fence) { ctx->pipe.screen->fence_finish(ctx->pipe.screen, NULL, *fence, OS_TIMEOUT_INFINITE); - /* All work is finished, it's safe to move cache entries into the table. */ - hash_table_foreach_remove(matrix->cache, entry) { - struct sample_function_cache_key *key = (void *)entry->key; - key->texture_functions->sample_functions[key->sampler_index][key->sample_key] = entry->data; - free(key); + /* All work is finished, it's safe to move cache entries into the table. */ + hash_table_foreach_remove(matrix->cache, entry) { + struct sample_function_cache_key *key = (void *)entry->key; + key->texture_functions->sample_functions[key->sampler_index][key->sample_key] = entry->data; + free(key); + } } }