aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2020-04-01 10:47:14 +0200
committerPierre-Eric Pelloux-Prayer <[email protected]>2020-04-02 08:31:37 +0200
commit8306c533fe6b220b7ac3b40084266a47640fcf33 (patch)
treece71dbfac6b898f5e93f6a146253bcbe15b88dbd /src/gallium/auxiliary/util
parentd259768e62591b4e5bb49042d6535f0a76164e3f (diff)
gallium/util: let shader live cache users know if a hit occured
This will be used in next commit. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4355>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_live_shader_cache.c6
-rw-r--r--src/gallium/auxiliary/util/u_live_shader_cache.h3
2 files changed, 7 insertions, 2 deletions
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,