mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 14:39:58 -04:00
Set NVIDIA's shader disk cache on Linux only with NVIDIA's driver, in a folder that could be made and written, before any thread of the game starts.
The first part of this pull request (the cache beside the exe with an 8 GiB limit) was already in. This is the rest: nothing is set without NVIDIA's kernel driver, neither variable is set when the folder cannot be made or written (the driver caches nothing in such a folder), the log says which folder and limit hold, and a game run sets the drivers' cache variables in main before any of its threads can load a Vulkan driver (vk_device.c vk_driver_cache_env); the other modes still set them in create_instance. On Windows that only moves the MESA_SHADER_CACHE_DIR setenv earlier. Pull request #369 by mooki000, taken as it is. The Linux part is not compiled or run here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -235,7 +235,10 @@ NVIDIA's Linux driver compiles into a disk cache of its own. A process adds at m
|
||||
folder, `~/.cache/nvidia`, is shared with every program. `--prepare-shaders` of game 1.1.1 builds 42,142 variants, about
|
||||
1.5 GB: on the default limit about 30,700 of them were stored and the rest compiled again at their first draw in play.
|
||||
`runtime/vk_device.c` therefore points `__GL_SHADER_DISK_CACHE_PATH` at `nvidia-cache` beside `ocarina` and the size at
|
||||
8 GiB before the first Vulkan call, each unless the environment sets it, as it does `MESA_SHADER_CACHE_DIR` for RADV. The
|
||||
8 GiB, each unless the environment sets it, as it does `MESA_SHADER_CACHE_DIR` for RADV, and only while NVIDIA's kernel
|
||||
driver is loaded (`/proc/driver/nvidia/version`). The driver does not make that folder and caches nothing in a folder it
|
||||
cannot write, so the game makes it, and when it cannot make or write it sets neither variable. A game run sets them in
|
||||
`main` before any of its threads starts, since a thread can load the Vulkan driver before the instance is made. The
|
||||
folder can be deleted; `ocarina --warm-shaders` fills it again.
|
||||
|
||||
Memory: on Windows the GPU imports guest memory and `GetWriteWatch` tracks the CPU's writes to it. On Linux,
|
||||
|
||||
Reference in New Issue
Block a user