mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 17:29:57 -04:00
Give Mesa's shader cache beside the game a limit of 8 GB instead of its default 1 GB.
On Linux with RADV (and the Steam Deck) the game points MESA_SHADER_CACHE_DIR at mesa-cache beside the exe, a folder nothing else writes, but left Mesa's limit of 1 GB. The stage libraries the library warm builds in play are kept only in the driver's cache, and a preparation of every shader variant is larger than that limit, so what did not fit was compiled again in play. The limit is now 8 GB in that folder unless MESA_SHADER_CACHE_MAX_SIZE is set, as NVIDIA's cache beside the game already has. Checked: all runtime files compile. Not run on Linux. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -70,14 +70,19 @@ static int instance_ext_present(const char *name) {
|
||||
// Mesa's drivers (RADV on Linux and the Steam Deck) keep a shader cache of their own beside our pipeline cache, by
|
||||
// default in ~/.cache and up to 1 GB: about 35 MB in a minute of the title screen. A Deck's /home is small and the game
|
||||
// usually sits on the SD card, so unless MESA_SHADER_CACHE_DIR names a folder, it goes to mesa-cache beside the exe.
|
||||
// That folder is ours alone, so its limit is raised to MESA_CACHE_SIZE unless MESA_SHADER_CACHE_MAX_SIZE is set: the
|
||||
// stage libraries the library warm builds in play live only in the driver's cache (vk_pipeline.c, "the play cache"),
|
||||
// and a preparation of every shader variant does not fit in 1 GB, so the rest would be compiled again in play.
|
||||
#define MESA_CACHE_SIZE "8G"
|
||||
static void mesa_cache_beside_exe(void) {
|
||||
char dir[PLAT_PATH_MAX * 2];
|
||||
char dir[PLAT_PATH_MAX * 2], size[32];
|
||||
if (plat_getenv("MESA_SHADER_CACHE_DIR", dir, sizeof dir)) return;
|
||||
int len = plat_exe_path(dir, sizeof dir - 16);
|
||||
char *cut = len ? plat_last_sep(dir) : NULL;
|
||||
if (!cut) return;
|
||||
strcpy(cut + 1, "mesa-cache");
|
||||
plat_setenv("MESA_SHADER_CACHE_DIR", dir);
|
||||
if (!plat_getenv("MESA_SHADER_CACHE_MAX_SIZE", size, sizeof size)) plat_setenv("MESA_SHADER_CACHE_MAX_SIZE", MESA_CACHE_SIZE);
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
Reference in New Issue
Block a user