disk cache: add callback functionality
v2: add disk_cache_has_key, disk_cache_put_key support
using blob cache (Nicolai, Jordan)
v3: rename set_cb as put_cb to match existing naming (Timothy)
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
@@ -50,6 +50,14 @@ typedef uint8_t cache_key[CACHE_KEY_SIZE];
|
||||
#define CACHE_ITEM_TYPE_UNKNOWN 0x0
|
||||
#define CACHE_ITEM_TYPE_GLSL 0x1
|
||||
|
||||
typedef void
|
||||
(*disk_cache_put_cb) (const void *key, signed long keySize,
|
||||
const void *value, signed long valueSize);
|
||||
|
||||
typedef signed long
|
||||
(*disk_cache_get_cb) (const void *key, signed long keySize,
|
||||
void *value, signed long valueSize);
|
||||
|
||||
struct cache_item_metadata {
|
||||
/**
|
||||
* The cache item type. This could be used to identify a GLSL cache item,
|
||||
@@ -207,6 +215,10 @@ void
|
||||
disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size,
|
||||
cache_key key);
|
||||
|
||||
void
|
||||
disk_cache_set_callbacks(struct disk_cache *cache, disk_cache_put_cb put,
|
||||
disk_cache_get_cb get);
|
||||
|
||||
#else
|
||||
|
||||
static inline struct disk_cache *
|
||||
@@ -260,6 +272,13 @@ disk_cache_compute_key(struct disk_cache *cache, const void *data, size_t size,
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void
|
||||
disk_cache_set_callbacks(struct disk_cache *cache, disk_cache_put_cb put,
|
||||
disk_cache_get_cb get)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* ENABLE_SHADER_CACHE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user