diff options
author | Dave Airlie <[email protected]> | 2020-05-13 13:36:55 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2020-06-11 06:05:41 +1000 |
commit | e07e5137b00989c3f2ebd1caee004c6e0cdde25c (patch) | |
tree | 8ea583f618e027080c34fd8793541467683c306e /src/gallium/auxiliary | |
parent | c2864081e1436634988fc647e0c58c6272282544 (diff) |
draw: add disk cache callbacks for draw shaders
This provides a set of hooks from the driver that draw can
use to access the disk cache for the draw shaders.
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5049>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.c | 16 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_context.h | 10 | ||||
-rw-r--r-- | src/gallium/auxiliary/draw/draw_private.h | 10 |
3 files changed, 35 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index b93bc6bf56f..781f8f124b6 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -1336,3 +1336,19 @@ draw_set_tess_state(struct draw_context *draw, for (unsigned i = 0; i < 2; i++) draw->default_inner_tess_level[i] = default_inner_level[i]; } + +void +draw_set_disk_cache_callbacks(struct draw_context *draw, + void *data_cookie, + void (*find_shader)(void *cookie, + struct lp_cached_code *cache, + unsigned char ir_sha1_cache_key[20]), + void (*insert_shader)(void *cookie, + struct lp_cached_code *cache, + unsigned char ir_sha1_cache_key[20])) +{ + draw->disk_cache_find_shader = find_shader; + draw->disk_cache_insert_shader = insert_shader; + draw->disk_cache_cookie = data_cookie; + +} diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 5919c8f2214..4dc542db095 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -366,4 +366,14 @@ draw_get_shader_param_no_llvm(enum pipe_shader_type shader, boolean draw_get_option_use_llvm(void); +struct lp_cached_code; +void +draw_set_disk_cache_callbacks(struct draw_context *draw, + void *data_cookie, + void (*find_shader)(void *cookie, + struct lp_cached_code *cache, + unsigned char ir_sha1_cache_key[20]), + void (*insert_shader)(void *cookie, + struct lp_cached_code *cache, + unsigned char ir_sha1_cache_key[20])); #endif /* DRAW_CONTEXT_H */ diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index a5a1b4e9b22..864d80fecb7 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -71,7 +71,7 @@ struct tgsi_buffer; struct draw_pt_front_end; struct draw_assembler; struct draw_llvm; - +struct lp_cached_code; /** * Represents the mapped vertex buffer. @@ -392,6 +392,14 @@ struct draw_context struct draw_assembler *ia; + void *disk_cache_cookie; + void (*disk_cache_find_shader)(void *cookie, + struct lp_cached_code *cache, + unsigned char ir_sha1_cache_key[20]); + void (*disk_cache_insert_shader)(void *cookie, + struct lp_cached_code *cache, + unsigned char ir_sha1_cache_key[20]); + void *driver_private; }; |