From 9e4a44d172335906d147cf0bc6ec7ac70e6c239f Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Sat, 8 Jun 2024 11:26:53 +0200 Subject: [PATCH] llvmpipe: Lock shader access to sample_functions sample_functions can be re-allocated. Fixes: 7ebf7f4 ("llvmpipe: Compile sample functioins on demand") Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/drivers/llvmpipe/lp_texture_handle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_texture_handle.c b/src/gallium/drivers/llvmpipe/lp_texture_handle.c index 714205720c6..8e747f7bf20 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture_handle.c +++ b/src/gallium/drivers/llvmpipe/lp_texture_handle.c @@ -507,14 +507,14 @@ static uint64_t get_sample_function(uint64_t _matrix, uint64_t _texture_functions, uint64_t _sampler_desc, uint32_t sample_key) { struct lp_sampler_matrix *matrix = (void *)(uintptr_t)_matrix; - struct lp_texture_functions *texture_functions = (void *)(uintptr_t)_texture_functions; struct lp_descriptor *sampler_desc = (void *)(uintptr_t)_sampler_desc; - uint32_t sampler_index = sampler_desc->texture.sampler_index; - void *key = &texture_functions->sample_functions[sampler_index][sample_key]; simple_mtx_lock(&matrix->lock); + struct lp_texture_functions *texture_functions = (void *)(uintptr_t)_texture_functions; + void *key = &texture_functions->sample_functions[sampler_index][sample_key]; + void *result; struct hash_entry *entry = _mesa_hash_table_search(matrix->cache, key); if (entry) {