mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-24 15:50:37 +02:00
util/disk_cache: use a new cache dir for the single file cache feature
This allows us to guarantee the different cache implementations will not interfere with each other and should make it more clear that the max cache size limits are applied separately for each cache implementation. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7725>
This commit is contained in:
parent
c1e4810221
commit
f88c13f26d
2 changed files with 8 additions and 3 deletions
|
|
@ -43,6 +43,7 @@ extern "C" {
|
|||
#define CACHE_KEY_SIZE 20
|
||||
|
||||
#define CACHE_DIR_NAME "mesa_shader_cache"
|
||||
#define CACHE_DIR_NAME_SF "mesa_shader_cache_sf"
|
||||
|
||||
typedef uint8_t cache_key[CACHE_KEY_SIZE];
|
||||
|
||||
|
|
|
|||
|
|
@ -843,12 +843,16 @@ disk_cache_write_item_to_disk(struct disk_cache_put_job *dc_job,
|
|||
char *
|
||||
disk_cache_generate_cache_dir(void *mem_ctx)
|
||||
{
|
||||
char *cache_dir_name = CACHE_DIR_NAME;
|
||||
if (env_var_as_boolean("MESA_DISK_CACHE_SINGLE_FILE", false))
|
||||
cache_dir_name = CACHE_DIR_NAME_SF;
|
||||
|
||||
char *path = getenv("MESA_GLSL_CACHE_DIR");
|
||||
if (path) {
|
||||
if (mkdir_if_needed(path) == -1)
|
||||
return NULL;
|
||||
|
||||
path = concatenate_and_mkdir(mem_ctx, path, CACHE_DIR_NAME);
|
||||
path = concatenate_and_mkdir(mem_ctx, path, cache_dir_name);
|
||||
if (!path)
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -860,7 +864,7 @@ disk_cache_generate_cache_dir(void *mem_ctx)
|
|||
if (mkdir_if_needed(xdg_cache_home) == -1)
|
||||
return NULL;
|
||||
|
||||
path = concatenate_and_mkdir(mem_ctx, xdg_cache_home, CACHE_DIR_NAME);
|
||||
path = concatenate_and_mkdir(mem_ctx, xdg_cache_home, cache_dir_name);
|
||||
if (!path)
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -896,7 +900,7 @@ disk_cache_generate_cache_dir(void *mem_ctx)
|
|||
if (!path)
|
||||
return NULL;
|
||||
|
||||
path = concatenate_and_mkdir(mem_ctx, path, CACHE_DIR_NAME);
|
||||
path = concatenate_and_mkdir(mem_ctx, path, cache_dir_name);
|
||||
if (!path)
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue