From: Pierre-Eric Pelloux-Prayer Date: Wed, 1 Apr 2020 08:47:14 +0000 (+0200) Subject: gallium/util: let shader live cache users know if a hit occured X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8306c533fe6b220b7ac3b40084266a47640fcf33;p=mesa.git gallium/util: let shader live cache users know if a hit occured This will be used in next commit. Reviewed-by: Marek Olšák Part-of: --- diff --git a/src/gallium/auxiliary/util/u_live_shader_cache.c b/src/gallium/auxiliary/util/u_live_shader_cache.c index 9c59b5fd3cf..a32c3748257 100644 --- a/src/gallium/auxiliary/util/u_live_shader_cache.c +++ b/src/gallium/auxiliary/util/u_live_shader_cache.c @@ -71,7 +71,8 @@ util_live_shader_cache_deinit(struct util_live_shader_cache *cache) void * util_live_shader_cache_get(struct pipe_context *ctx, struct util_live_shader_cache *cache, - const struct pipe_shader_state *state) + const struct pipe_shader_state *state, + bool* cache_hit) { struct blob blob = {0}; unsigned ir_size; @@ -124,6 +125,9 @@ util_live_shader_cache_get(struct pipe_context *ctx, } simple_mtx_unlock(&cache->lock); + if (cache_hit) + *cache_hit = (shader != NULL); + /* Return if the shader already exists. */ if (shader) return shader; diff --git a/src/gallium/auxiliary/util/u_live_shader_cache.h b/src/gallium/auxiliary/util/u_live_shader_cache.h index 5d8cfc1bafc..b6e6e32c76e 100644 --- a/src/gallium/auxiliary/util/u_live_shader_cache.h +++ b/src/gallium/auxiliary/util/u_live_shader_cache.h @@ -80,7 +80,8 @@ util_live_shader_cache_deinit(struct util_live_shader_cache *cache); void * util_live_shader_cache_get(struct pipe_context *ctx, struct util_live_shader_cache *cache, - const struct pipe_shader_state *state); + const struct pipe_shader_state *state, + bool* cache_hit); void util_shader_reference(struct pipe_context *ctx,