mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 02:09:57 -04:00
Leave the pools as imports for NVIDIA's own driver on Linux in the game itself.
On Linux every driver got shadow storage (copies of guest memory beside it), which exists for amdgpu, where importing guest memory costs the write protection of its pages. NVIDIA's own driver imports without that cost, so there the copies are only the slower path: in Kokiri Forest on 0.7.1 (RTX 4090) imports ran at 51.9 frames a second and the copies at 27.4. Until now only the AppImage's play.sh knew, by setting NX2NAVI_SHADOW=0 when NVIDIA's kernel driver was present at build time, so a game started any other way got the copies, and a PC with that kernel driver whose game ran on another card got imports where it should not. The game now chooses by the driver of the device it runs on, play.sh no longer sets the variable, and NX2NAVI_SHADOW=1 or 0 still decides. The driver is asked when the device is picked, before the storage is chosen. Windows is unchanged: the device probe here reads "mem: mode mirror" with no shadow storage line, and the shadow line with NX2NAVI_SHADOW=1. The Linux path itself was not run: there is no Linux machine here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -89,8 +89,8 @@ static void mesa_cache_beside_exe(void) {
|
||||
// beside the exe, which nothing else writes, with a limit of NV_CACHE_BYTES. The driver makes GLCache inside that
|
||||
// folder but not the folder, so it is made here; pointed at a folder that is missing or not writable it caches nothing
|
||||
// at all, so when that folder cannot be made or written neither variable is set and the driver keeps its own folder
|
||||
// and limit. Without NVIDIA's kernel driver (no /proc/driver/nvidia/version, the test play.sh makes) the variables do
|
||||
// nothing and the folder would stay empty, so nothing is done.
|
||||
// and limit. Without NVIDIA's kernel driver (no /proc/driver/nvidia/version, the test the AppImage's build makes for
|
||||
// DLSS) the variables do nothing and the folder would stay empty, so nothing is done.
|
||||
#define NV_CACHE_BYTES "8589934592" // 8 GiB
|
||||
static void nvidia_cache_beside_exe(void) {
|
||||
if (plat_fs_kind("/proc/driver/nvidia/version") != PLAT_FS_FILE) return;
|
||||
@@ -274,6 +274,7 @@ retry:
|
||||
}
|
||||
free(qp);
|
||||
rt_log("vk: using gpu %d: %s", best, g_vk.props.deviceName);
|
||||
vk_caps_driver(g_vk.phys); // before vk_mem_class_log, which chooses the pools' storage by driver
|
||||
vk_mem_class_log(&g_vk.props, &g_vk.mem_props);
|
||||
return 1;
|
||||
}
|
||||
@@ -421,7 +422,6 @@ static int create_device(void) {
|
||||
// The driver fills the chain with what it supports; the same chain then enables all of it (robustBufferAccess
|
||||
// stays on: guest shaders index constant buffers freely and out-of-range reads must stay harmless).
|
||||
vkGetPhysicalDeviceFeatures2(g_vk.phys, &c->f2);
|
||||
vk_caps_driver(g_vk.phys);
|
||||
vk_caps_features(&c->f2.features);
|
||||
if (gpl_link) {
|
||||
VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT gp = {
|
||||
|
||||
Reference in New Issue
Block a user