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@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4355>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2020-04-01 10:47:14 +02:00
parent d259768e62
commit 8306c533fe
2 changed files with 7 additions and 2 deletions
@@ -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;
@@ -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,