Main brought the fixes of eleven pull requests (the texture pool set sealed when an early replay part is submitted, every location reflected in interface arrays, RGB9E5 texels recognised for integer storage views, the upscaler a frame started with kept, GPU pass timestamps without vendor breadcrumbs, the Linux build, window and NGX fixes), render targets released when drawn over at another address, the vertex layout kept in the pipeline on newer AMD drivers, and the upscaler choice read once per evaluation.
Four hunks conflicted and take both sides: pool_sync returns for a sealed set before the per-frame creation budget's clock (vk_exec_draw.c); make_module keeps the test line's early_ok argument and main's module hash (vk_pipeline.c); a texture taken back counts as sampled again and records how long it was away, and the texture line logs the disuse counters and the overwritten render targets (vk_texture.c).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Per-pass GPU timestamps put the write-back of GPU-written storage buffers at 3.6 to 5.3 ms of GPU time a frame in play, against 1.8 to 2.5 ms for all of the game's own passes and dispatches: about 67 MiB a frame goes from the mirrors back into guest memory, from the same eleven pools all session, in case the CPU or a host path reads it. Nothing said whether anything does.
With wb_probe = 1 the 2 MiB regions that lie wholly inside a range just written back are made inaccessible. The first read or write of such a region faults; the handler gives the region back the protection it had (read-only when frozen, else read-write), notes the address, the instruction and the thread, and the access runs again. The bytes are in guest memory all along, so nothing changes for the game. A log block every perf window gives the regions armed, the probes a read or a write ended, and the first accesses by instruction. Every thaw ends the probe of its region first, which covers file reads into guest memory and mapping changes; a file write from guest memory thaws its buffer while the probe is on; a probed region is not frozen anew.
The platform layer gets a hook for every read or write access fault beside the write-fault hook; it is installed only with the setting. --probe-gfx-abi checks that nothing is armed without it and, run with NX2NAVI_WB_PROBE=1, that reads and writes end a probe and run again, that a frozen region thaws after it and that mem_thaw ends and holds.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
vk_dlaa_frame runs with the game's present and vk_dlaa_pass with the replay, which can be another thread. evaluate read
the choice three times; when the menu's change from FSR 3.1 to a DLSS mode landed between two of the reads, the rest of
the function took DLSS's path with NGX never brought up.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A profile of a play session showed the game's own zstd decoder, lifted from ARM64, taking 16 to 19% of all running CPU time on the loading threads: the patch set that sends decodes to the host's libzstd had sites for 1.4.3 only. recomp/patches-v111.txt now has the three calls of ZSTD_decompressMultiFrame (main+0xeb380) of this build, checked against its main by the generator; a lift with them changes three chunks. ov_zstd.c takes the guest function's address by game version.
The sites have not been through a check run on this build, and 1.4.3 has a caller that relies on the game decoder's own result, so on 1.1.1 the host function passes every call on to the game's decoder unless zstd_native = 1 is set or zstd_check = 1 runs both and logs what differs. The loading threads' stream feed (main+0xf5c80), which decodes most of the data, is not replaced yet.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A replay part handed to the queue early kept reading the bindless pool set while later parts of the same submission wrote new entries into it. That updates descriptors a pending command buffer reads, and on RADV a texture whose memory was mapped after the part was submitted is absent from its page tables. This caused a gfxhub read fault in the 128x128 pass of the first world frame in Kokiri Forest.
Seal the set when a part goes, take another ring set at the next sync that has entries to write, and keep recording the same part while every other set belongs to the submission. Document the descriptor lifetime contract in maxwell.md 4.9.
Fixes#257.
SDL_SyncWindow returns before the compositor moves the fullscreen window to the chosen output, so the check right after it logged the output the window opened on, though the game then ran on the chosen monitor. On Wayland the report now waits until SDL sees the window on the chosen monitor, which it learns from a display, scale or mode change (Hyprland 0.56 sends only the latter two).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Linux the window ignored NX2NAVI_MONITOR (the log said it had no effect) and --list-monitors only printed that monitor selection is Win32-only. The SDL window now picks a monitor with the same rules as the Win32 one: auto (the system places it), primary, a 1-based index in listing order, or part of the monitor's name, ignoring case, the first match in list order winning. The monitors are SDL's displays; --list-monitors prints their index, name (the make and model, with the connector on Wayland and X11), pixel size and position, primary flag and display scale, then what NX2NAVI_MONITOR would pick, and the log says the same when the window opens.
The window is created centred on the chosen monitor and centred again at its final size, and that position also names the display the fullscreen setting covers, which is how a Wayland window, which a client cannot move, opens fullscreen on the chosen output. On Wayland a windowed window opens where the compositor puts it; the log says so once. With a chosen monitor, the size widescreen.c reads for fullscreen before the window exists is that monitor's.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
On 1.1.1 the SDK's nn::oe::InitializeApplet calls SetFocusHandlingMode itself, before DT_INIT, so the first call reached the boot checkpoint from sdk+0x598840 and --boot and --seconds stopped with a FATAL before the game started. Only a call from main is the checkpoint now. 1.1.1 also gets its own return addresses (nnMain's SetFocusHandlingMode at main+0x1202d44, the first nvnBootstrapLoader at main+0x346bf8c, read from x30 in the two host functions during a normal start) and its init_array counts, so a 1.1.1 run is no longer checked against the 1.2.1 values.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vk_dlaa_frame decides at each present whether DLAA runs, with FSR 3.1 when NX2NAVI_TAA is fsr3 and NGX is not up. evaluate read NX2NAVI_TAA again. Choosing a DLSS mode in the menu sets it to dlss, which only takes effect after a restart when the run started with FSR 3.1; when that happened between the two reads, evaluate took DLSS's path and called N.alloc_params, which is null without NGX (issue #325). The choice is now kept from vk_dlaa_frame (fsr_frame), and evaluate returns when neither upscaler can run, until the next present turns DLAA off.
Generation is switched off for every menu, cutscene and frame without depth and motion, and on again after it. Off freed the generator's resources and on allocated them again inside the present, which holds the queue lock for its whole flip, so the submitting thread waited there: four of five slow frames profiled in a session with frame generation on had the log line "frame generation on" right before them and nothing else blocked. nx2navi_dlssg.dll now sets Streamline's retain flag, so off only suspends; whether frame generation runs is fixed for the run, and Streamline frees the resources at shutdown. The DLL has to be rebuilt (tools/build_dlssg.py).
The wait for the queue lock in vk_sync.c queue_submit is counted as a present wait, so a frame held up by a slow present no longer shows in the slow-frame line with every blocked time at zero.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 94a0da9f7694cfe4d65777f9efe8eff837ba2bc8)
From the replay review of a profiled session:
- vk_rec.c: the producer set the wake event for every packet until the recorder had cleared its sleeping flag, a system call per packet on the submit thread for as long as the recorder took to wake; it now takes the flag back itself and sets the event once. A sleep that ended with nothing new was followed by another 4096-pause spin, every 2 ms for as long as the game was idle or paused; the recorder now sleeps again at once. head, tail and the producer's words are on cache lines of their own, and the producer reads tail only when the ring looks full by the value it last saw.
- vk_exec_draw.c c0_info: a vertex or fragment bank depends on the storage slots and the base instance alone, so those are compared directly instead of clearing, filling and comparing a 1.8 KiB record on every draw.
- vk_exec_draw.c bind_vertex_buffers: a draw that changes no vertex stream returns before the 17 streams are rebuilt and compared.
- vk_exec_draw.c bind_resources: the texture lock is taken at the first texture descriptor that has to be resolved, not for every texture binding whose descriptors are all kept.
- vk_usnap.c vk_usnap_find: the region the last lookup hit is tried before the binary search.
None of this changes what is recorded.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 8eac567e2a9a353f894f3c66e3fc20fd2c0d295d)
Found by profiling a play session and reading the kernel and the command recording:
- nvn_api_cmd.c: a released recording copy had its pins uncounted (a walk over every op) and was freed while copy_lock was held exclusively; the main-loop thread waited for that lock 2.8% of its time. The copies are now chained under the lock and freed after it. The walks over a recording's records test a mask of the five op kinds that name pins before calling op_pins.
- kernel.c: SleepThread(0) took the kernel lock and computed the caller's inherited priority, a scan over every blocked thread, also when no thread waited for a core, which is nearly always. It now yields at once then. A wait without a timeout no longer reads the clock.
- nvn_api_obj.c sleep_until: the wait for a paced frame's slot slept coarsely and left the last 1 to 2 ms to a yield loop; the high-resolution wait now takes all but its own margin.
- input.c: the keyboard scan (a system call per key) is reused for reads within a millisecond.
- nvn_api_core.c: the read-lock observer's commit-point address is 1.2.1's and is now only compared there.
- kernel_probe.c: the probe expected three virtual cores and wait type 3 to be refused; the kernel has six cores and implements the 64-bit wait. It now checks both as they are, counts a core number past the cores as a clash without unbalancing core 0, and --probe-kernel passes again.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit a3dbd63878d7d6de096ceb4c25988192b4bce738)
The translator's mesh shaders are SPIR-V 1.4, and the marks took only 1.3, so the first mesh shader that indexed the
pool turned eviction by disuse off for the whole run. From 1.4 on an entry point lists every global variable it uses,
so each entry point now gets the marks variable too. Over the 44,255 shaders of a test install's cache, 4,728 are
marked, none is refused, and every marked one passes spirv-val for Vulkan 1.3; 11 of them are 1.4 mesh shaders. The
log names up to eight refused modules by stage, SPIR-V version, size, hash and reason.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit af50808a1cb56f450f99938c9d420e1f5deb333b)
A session with per-pass GPU timestamps showed the game's own render passes and compute dispatches at 1.6 to 2.3 ms of GPU time a frame while the perf line's GPU time was 7.7 to 13.5 ms: most of the frame's GPU time is in commands the replay records between the marks, and nothing said which.
The timed frames now also get a timestamp at the start and the end of each part of a submission, and every stretch between two marks (or a mark and the part's edge) is a gap. The replay names the kind of commands it records in a gap: buffer and texture copies, fills and clears, the temporal upscaler, write-back merges and copies, depth twin copies, the texture pool marks, the mesh draw counts and block-compressed target copies, each with a size where it has one. The report adds the gaps' time per frame summed by the kinds noted in them (a gap nobody noted holds barriers and state only), the parts' own time for comparison with the perf line, and each kind's count and size per frame. Nothing runs outside the timed frames.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
AMD's driver for RDNA 3 and newer compiles a pipeline that has dynamic vertex input again at every boot: neither pipeline-cache.bin nor the driver's own disk cache gives it back. On an RX 7900 XT (26.10.1) a player's key file of 3,979 records used the whole 20 s boot budget at every boot. Dynamic vertex input is now off by default on that driver (vk_caps.amd_llpc); with the vertex layout in the pipeline the third boot of that file built 4,273 pipelines in 0.9 s, all from the file. NX2NAVI_VK_DYN_VERTEX=1 turns it back on. The RDNA 1 and 2 driver branch is not measured and keeps it.
The background builder of large compute shaders now compiles into a pipeline cache of its own and merges it into the main one when the build is done. A create into the main cache holds the cache's lock for its whole length and the cache is only saved while nobody holds it, so a build of minutes kept pipeline-cache.bin from being written at all: on the same card one compute shader of 4,874,502 SPIR-V words was still compiling 590 s after the boot, and nothing built in that session reached the file.
NX2NAVI_PIPE_FEEDBACK=2 also logs every graphics pipeline build with hashes of its modules and its fixed state, which is how the recompiles were found.
Co-Authored-By: Claude <noreply@anthropic.com>
Ocarina lays its per-frame render targets out anew every frame in one GPU-only pool. When an early target changes its size, every target after it moves, and each move made a new entry with an image of its own while the old entry stayed live for as long as a pool descriptor named it. After 6,000 frames of walking through Kakariko Village 1,043 such entries held 6.1 GiB of device memory against 233 MiB in the targets still drawn. On a driver that charges device memory to the system commit this kept the commit low, and the idle textures of the area were evicted and uploaded again while walking.
A GPU write in the GPU-only window now marks the entries at other addresses whose storage it runs over as overwritten and releases them. Their images go to the next texture made with the same parameters, or away after 600 presents. On the same walk the process's private memory ends at 23.2 GB instead of 29.3 GB and device memory in use at 8.5 GiB.
A released render target whose content exists only in its image is no longer dropped after 120 presents under commit pressure: the game went on sampling such targets and took them back empty, which drew the scene black for one frame every two to three seconds. Such an entry now waits 1,800 presents, or eight times the longest it stayed released before the game took it back, and none goes while lookups still reach it.
Co-Authored-By: Claude <noreply@anthropic.com>
VMA's blocks on large heaps are 64 MiB instead of 256 (vma_block_mb): one session held 2.1 GiB free inside the
device blocks beside 8.2 GiB of allocations after a few area changes, and the driver counts a block whole until it
empties. The headroom thread keeps its spare block only for the device-local types textures and mirrors grow in; the
spare blocks it made for the host types and the PCIe BAR type at boot stayed empty for the whole run. The ASTC
decoder's scratch is 32 MiB, so it stays inside a block, and an area load that makes one per upload batch holds half
as much at once. A DLSS feature no frame used for 3600 evaluations is freed with its work images, and a model change
now frees all five sizes.
The perf log gets a "vram by use" line (textures, released textures, mirrors, physical pools, ASTC scratch, headroom
spare, free space inside the blocks, memory outside VMA and DLSS's own share), the free ranges per memory type, the
addresses whose duplicate texture entries hold the most, and a line when memory outside VMA moves by 256 MiB.
astc_bc_probe in nx2navi.ini turns on the ASTC opacity probe.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 99cfc2fa14ae208b7b23e057ff9b87986cd6a5e0)
The pool refresh runs before every draw that binds the pools, so its count budget of 16 creations held per draw, not
per submission. An area load in the 0.6.1.12 test made 4,925 entries (1.7 GB of uploads) in one 430 ms frame, and
2,018 in a 195 ms one. While slots were left over, every draw walked the whole table and looked each of them up again,
about 100 ms of the 430 ms frame in key hashing alone.
Once a frame's refreshes have taken pool_create_ms (default 6 ms; 0: no limit), they create nothing more until the next
frame, and skip the slots left earlier in the frame. The first refresh of each frame keeps its count budget. The slots
left keep their stand-in for a few frames during a large load.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This brings in the test branch up to the shader reads, not the texture eviction by disuse still in progress there:
- black frames: a released or taken-back texture keeps its content, and a new texture over a live one of another size gets the region both cover;
- the menu font atlas uploaded through the runtime's checked upload batch;
- the game held to 240 frames a second, which stops the quick menu's crash;
- the FSR 3.1 contexts evicted instead of turning FSR off after a few render scales;
- AMD frame generation kept off while NVIDIA's holds the device;
- less device memory held that only costs the system's commit;
- shaders read from the disk cache off the render thread past a small budget;
- the exit code 70 text;
- pull requests #260, #261, #270 and #271.
The tool lists in make_kit.py and make_launcher.py and the setting names in cfg.c take both sides: romfs_check.py and pack_shader_cache.py, FOG_CULL, SCENE_SHARE and GPA_TWIN_MAX_KB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The texture pool refresh looks up every registered slot, so the textures of every area the game keeps loaded never
counted as idle and their memory only grew. Marked shaders now store into a buffer with one word per pool slot. Every
four submissions that recorded work, the replay copies it out and clears it, and the texture side notes when each
texture was last sampled. Under VRAM pressure or low commit, once idle textures are gone, live textures that come back
intact and were not sampled for 1800 presents go too. Their keys are held, so the pool refresh keeps the stand-in until
a shader samples that slot again, and the next refresh makes the texture again.
Fragment shaders that neither discard nor write depth, sample mask, stencil reference or memory keep early depth tests
(EarlyFragmentTests), so the marks do not take away early depth rejection. Alpha to coverage leaves the dynamic state
while marks are on, so each pipeline knows whether early tests are safe. Disuse eviction waits until every module that
indexes the pool was marked and two reads arrived. NX2NAVI_TEX_DISUSE=0 (tex_disuse = 0) turns it off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1a4c896150a748f9275c3024e96af3055db94af4)
vk_pipeline.c spirv_pool_mark gives each module that indexes the texture pool a storage buffer at set 2, binding
VK_POOL_MARK_BINDING, and a store of 1 into the slot after every access chain into a pool texture array; modules that
cannot be marked are counted in vk_pool_marks_missed. NX2NAVI_SPV_MARK_TEST=<list> runs the rewrite over files for
spirv-val under --selftest. Still to do: the marks buffer and its read-back (vk_exec_draw.c), the pool lookup context,
the holds and the eviction by disuse (vk_texture.c).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 7ae86070f166d935a9949e95dae7a95e2cf3272b)
A profiled traversal session had 9 of its 16 worst hitches (100 to 500 ms) inside the render thread's shader lookup,
reading <key>.res.json and <key>.spv of shaders met for the first time: opening a loose file costs about 3 ms the first
time on Windows. get_async_one now reads in place while those reads stay within 1/8 of the wall time (2 ms at once);
past that three loader threads read them and the draws wait as for a translation. The perf line counts both.
The launcher's updates carry the shaders over and never packed the cache, which held 44,000 loose translations in the
test install. An update now packs it once it holds 1,000 loose ones, and the pack tool reads the loose files on 16
threads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A file its loader cannot use is opened again and again until the game does without it, and what needs it stays out of the world. The log now names such a file after 24 opens in a row, which tells a player's report of missing geometry apart from a rendering bug. It is one count and one timestamp per file, touched only when a file is opened.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The driver charges device memory to the system's commit. A 32 GB PC lost the device at an area load with the
system at 61 of 65.5 GB committed, the game at 28 GB: 12.35 GB of VRAM in use, of it up to 1.3 GB in released
textures kept for reuse, 0.5 to 1.8 GB free inside VMA's blocks, and a spare 256 MiB block per memory type.
- Released textures keep a thirty-second of the installed memory (512 MiB to 2 GiB) instead of a sixteenth (1 to 4
GiB); only those released STALE_FRAMES presents ago go, so the transient ones the game takes back stay.
- The headroom thread keeps no spare block while the system's commit is low (vk_texture_commit_low), as it already
keeps none under VRAM pressure.
- A texture image of 32 MiB or more gets memory of its own (DEDICATED_MIN), so freeing it gives the memory back at
once instead of leaving a hole in a shared block that the driver counts in full until the block empties.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 0.6.1.9 test still had one black flash, two presents long with FSR 3.1 and its frame generation: a new texture
made over a live one that holds no GPU content started empty (perf counters: one "left uninitialised" at that frame).
A released entry at the same address, kept since 0.6.1 for its descriptor to take back, was never asked for its
content, though on the console the memory still holds what it drew. start_at now takes the newest released entry with
GPU content and a compatible image as the source when no live texture there holds GPU content. Depth buffers that
start empty over another target's memory at every area load are no longer logged, so the 24 lines go to the others,
and the perf line counts copies from released textures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The one-game-per-profile lock was taken at the first storage use, after the boot prewarm. A second copy started
while the game ran (a second Play, a shortcut) spent 14 to 30 s translating and building on every core and committed
about 10.9 GB before it ended with "another copy of the game is running", enough to bring a 48 GB machine to its
commit limit and stall the copy being played. rt_boot now takes the lock first; storage_init takes it again, which
plat_lock_file answers from the handle it already holds. A restart from the settings menu is unaffected: main waits
for the previous process to exit before rt_boot.
Ocarina steps its game by the clock, and the frame limiter let "unlimited" run free and took numbers up to 1000
(frame_rate.c LIMIT_FREE_MAX_HZ), on the belief that the game has no lower limit to its step. It has one: on the quick
menu, where a frame costs the GPU almost nothing, the game ran at 640 to 700 fps and after about two seconds read
address 0 in its own draw code (main+0x175b2a0), twice in a row with the same call stack, while 92 to 255 fps ran on.
The game now runs at most 240 frames a second, "unlimited", "display" and numbers included; with frame generation the
cap counts the game's own frames, so the generated ones still go above it on screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ImGui_ImplVulkan_CreateFontsTexture checked no result: with the video memory full, the atlas a window size change
makes again got no memory, its copy still went out, and the GPU wrote to address 0 (issue #165, device lost after
Alt+Tab). It also submitted and waited on the game's queue itself, and when ImGui_ImplVulkan_NewFrame ran it (whenever
the back end held no atlas) that took no queue lock, beside the game's own submissions; the crashes in AMD's driver
inside the menu's drawing (issue #230) fit that. ui/menu_art.cpp menu_font_upload now uploads the atlas as the menu's
art is uploaded: VMA picks the memory (device-local, else what is left), the copy goes in the runtime's upload batch
under the queue lock, every step is checked, and the previous atlas is freed only once the new one is on the GPU and
the queue is idle. The menu no longer calls ImGui_ImplVulkan_NewFrame, whose only work was that upload. The back end's
VkResults are checked and logged (menu_vk_check), a texture whose descriptor set was not allocated is not drawn with,
and the descriptor pool holds 32 sets, room for two atlases while one replaces the other.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ocarina gives its scene picture (r11g11b10f, 5120x2160 here) a second descriptor at the same address that nothing
draws into (rgb9e5, read raw by the post pass). About once a second the picture's entry is released and taken back
there, and since 0.6.1 a taken-back entry restarted empty unless a live texture at the address could give it its
content (vk_texture.c start_at): the second descriptor never can, so the scene went black for a frame (issue #253;
the log's empty starts showed it at frames 4523, 4643 and on, each with "the live texture holds no GPU content").
A taken-back entry now keeps its own content unless a texture at its address holds GPU content written since its
release, as the memory would on the console. The perf line counts them ("taken back with their own content").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ocarina moves render targets whose size follows an effect on screen, so a descriptor made over a live target's memory
is often a few texels larger or smaller than the target. On the console both read the same bytes; here the new image
started empty when its shape differed (vk_texture.c alias_compatible), and the scene read it for a frame. From 0.6.1 on,
where a superseded entry is taken back at such an address, the scene went almost black for one frame about once a
second while the camera turned (issue #253; flight recorder thumbnails: a dark frame every ~121 presents, each with a
new texture left uninitialised over a live one). Uncompressed colour images of one block size now take the region
both cover (alias_copy), the rest of a larger new image cleared as before; block-compressed ones still need the same
shape. An alias that still starts empty is logged with its reason, 24 at most.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A shader's store or atomic through the table goes to a pool's VRAM mirror and again to its guest copy, which on a
discrete GPU crosses PCIe. On PCIe 3.0 (RTX 4090, Kokiri Forest, DLSS Quality) turning the twins off took the GPU from
16 to 13.1 ms a frame; the writes that went wrong without them were foliage counts and records in pools of 20 and
44 KiB. gpa_twin_max_kb = n gives a twin only to mirrors of pools up to n KiB. A larger mirror's record names the mirror
twice, so its second write goes to the table's scratch page, its buffer fills stay in VRAM (vk_mem_guest_twin), and it
is never evicted, since guest memory lacks what the shaders wrote into it. The mirror report counts the mirrors made
without a twin. Default 0: every mirror has one, as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without DLSS or FSR 3.1 the game's dynamic resolution took the scene down to a third of the picture under load, and a plain scale showed every step of that. NX2NAVI_SCENE_SHARE sets the share, and 0 leaves the game's dynamic resolution on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fog's first compute pass skips froxels behind a coarse depth table from the previous frame and writes them as empty, so the columns a near object had just left came out with no fog, and the fog's history smeared that into a trail, worst at the screen edges. The comparison is now never true, so those froxels are computed. The shader is found by its shape, so this holds across translator updates. NX2NAVI_FOG_CULL=1 keeps the game's skip.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without DLSS or FSR 3.1 the game's dynamic resolution took the scene down to a third of the picture under load, and a plain scale showed every step of that. NX2NAVI_SCENE_SHARE sets the share, and 0 leaves the game's dynamic resolution on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fog's first compute pass skips froxels behind a coarse depth table from the previous frame and writes them as empty, so the columns a near object had just left came out with no fog, and the fog's history smeared that into a trail, worst at the screen edges. The comparison is now never true, so those froxels are computed. The shader is found by its shape, so this holds across translator updates. NX2NAVI_FOG_CULL=1 keeps the game's skip.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With frame generation set to NVIDIA DLSS at the start, the device is made through Streamline's proxies. Switching the menu to AMD FSR 3.1 then made AMD's frame generation swapchain on that device at once, and NVIDIA's driver crashed with an access violation. vk_fg_wanted now stays false while Streamline's proxies are in use, so the switch takes effect at the next start, as the menu's Frame generation row already says.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each render and output size gets its own FSR 3.1 context, and there were six, never freed. Stepping through the render scales in the menu, plus the game's second scenes, used them up; the seventh size found no context, and FSR 3.1 went off for the rest of the run, leaving the game's own upscaler stand-in to show the picture. When all six are taken, the least recently used one not used in the last few calls is now destroyed once the GPU is idle, as DLSS's sizes already are.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since the pacer divides the limit by frame generation's factor, the default limit of 60 held the game to 30, 20 or 15 rendered frames a second at 2x, 3x or 4x on any monitor, 15 at DLSS 4x on a 165 Hz one. While AMD's or NVIDIA's frame generation swapchain is in use and neither fps_limit nor the older fps60 = 0 is set, the limit is now the monitor's rate, as with fps_limit = display: 4x on 165 Hz draws about 41 and shows 165. A limit the player set is kept, and the menu's Frame rate limit row shows the display choice while this applies.
The mouse camera divided its input by the limit's frame ratio, which counts generated frames, so frame generation turned it faster by its factor; it now uses the rate the game draws at (frame_step_game_hz).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Intel's driver crashed in vkGetPipelineCacheData when the
autosave copied the cache while the replay thread and the library workers were building
pipelines into it. Builds now hold a shared lock while they build. The save only copies
when it can take that lock exclusively with no build running, so it never makes a build
wait. The autosave tries again on its next tick; the save at exit waits up to 5 s.
framegen_multiplier (2, 3 or 4, live) sets how many frames the display gets per rendered frame while NVIDIA DLSS frame generation runs, and a DLSS multiplier row under Frame generation in the Screen tab sets it. nx2navi_dlssg.dll now passes that count to Streamline and reports the GPU's limit (numFramesToGenerateMax) through a new optional export, nx2sl_frames_max; with an older DLL the game keeps to 2x. A value above the limit is clamped to it with a log line, and the menu lists only what the GPU and driver allow, with a note saying why the rest are missing. The Frame generation row now says "in use: off" and why when DLSS frame generation was set but does not run.
The pacer divides the frame limit by the multiplier in effect, as it already halved it for FSR 3.1, so the display gets the limit and VSync at the display's rate drops no generated frames; RivaTuner Statistics Server stays out while DLSS frame generation runs, since it counts generated frames. With DLSS 2x a limit of 60 now shows 60 on screen instead of 120.
nx2navi_dlssg.dll has to be rebuilt (tools/build_dlssg.py) for 3x and 4x.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scene upscaler's stand-in took the RGB9E5 texture at the picture's address, but that is a separate image nothing renders into, so it showed stale or uninitialised memory, which flashed red. The stand-in now finds the image at that address that was written as raw RGB9E5 words this frame, looked up live because a remembered image may be gone by then, and shows that one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The commit census of NX2NAVI_TRACE=perf with NX2NAVI_MEM_CENSUS=1 reported the process's committed memory by kind,
which lumps every guest region together. memory.c mem_guest_census now walks each reserved region (aslr, stack, heap,
alias, kernel, host functions) beside it and reports the bytes committed in each, so a process that has grown to thirty
gigabytes (issues #203, #215, #240) says which region to look at. Like the census, it runs only when mem_census asks
for it, since the walk holds the address-space lock the game's threads take at every page fault.
On the Kokiri route the answer was the aslr region at 28 to 31 GB, the heap at 7.5 GB and the alias window at 2.7 GB
while the physical-memory pool itself stayed near its limit, which is what the device-loss crash follows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The game's shaders rely on IEEE NaN and infinity results: unordered comparisons compile to x > c || isnan(x), a
zero-length normalisation gives an infinity that a later test catches, integer masks travel through float selects,
and the translator's own NaN guards are isnan tests. Our SPIR-V never declared SignedZeroInfNanPreserve, which lets a
driver assume floats are never NaN or infinite. NVIDIA's driver keeps the IEEE results anyway; AMD's compilers do not
(issue #156: a NaN-bit select read as a signed integer gave 2^32; #41 and #110: black and white blocks on Navi and on
Link next to her). The player report: AMD GPUs draw Navi's sparkles but not her orb, whose light sits at her own
centre.
vk_pipeline.c spirv_nan_preserve now adds the capability, SPV_KHR_float_controls and the mode for 32-bit floats (16
and 64 where the module declares them and the driver can) to every game shader module. NX2NAVI_VK_NAN_PRESERVE: unset
on every driver except NVIDIA's own, 1 everywhere, 0 off. --selftest checks the rewrite; the rewritten modules of 600
translated game shaders pass spirv-val for Vulkan 1.3. Not yet seen on an AMD GPU.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EnumProfiles walks RTSS's Profiles\*.cfg with _findfirst and _findnext and keeps the find handle in 32 bits. The handle
points into the process heap, which lies above 4 GB here because the guest address space takes the low part (memory.c
mem_init), so _findnext gets a cut pointer and faults in ntdll: the crash report then ends the game with code 71 before
the title screen (issue #231). rtss_limit.c profile_exists now looks for Profiles\<name>.cfg in RTSS's folder, which is
what EnumProfiles reports. NX2NAVI_RTSS_ENUM=1 calls EnumProfiles again, to test an RTSS that keeps the whole handle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>