Mesa (master): gallium/util: let shader live cache users know if a hit occured
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 2 06:49:09 UTC 2020
Module: Mesa
Branch: master
Commit: 8306c533fe6b220b7ac3b40084266a47640fcf33
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8306c533fe6b220b7ac3b40084266a47640fcf33
Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date: Wed Apr 1 10:47:14 2020 +0200
gallium/util: let shader live cache users know if a hit occured
This will be used in next commit.
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4355>
---
src/gallium/auxiliary/util/u_live_shader_cache.c | 6 +++++-
src/gallium/auxiliary/util/u_live_shader_cache.h | 3 ++-
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,
More information about the mesa-commit
mailing list