From the local fixes package (fix 11), measured in Kokiri Forest at 4K on an RTX 4090 over PCIe 3.0: 40.5 to 62.6 fps
native and 45.6 to 74.9 fps with DLSS Quality, the mirror copies from 6.5 to 0.3 ms of GPU time a frame.
- Pages a VRAM mirror wrote back into guest memory are not copied up into it again: the mirror sync reads page stamps
of their own that a mirror's write-back leaves alone (vk_gpu_written_back, decided at record time by
vk_mem_mirrored). This replaces the lookup table NX2NAVI_WB_NO_REUP had, keeps its name, and is now on by default.
- The game's flushes of mirrored memory are not copied where the write watch covers the region, as every page the game
wrote there is stamped already (47-57 MiB a frame); NX2NAVI_FLUSH_UPLOAD=1 copies them as before.
- Written storage ranges up to NX2NAVI_WB_MERGE_MAX (now 32 MiB) are merged in 4 MiB pieces, so a range is no longer
bound to what one dispatch covers; the snapshot pool keeps its budget-scaled size with 128 slots.
- A submission's first part goes to the GPU at the first pass boundary while the GPU is idle (split_idle), long passes
are split too (split_in_pass), and the part's time limit reads the clock less often.
- A render target that needs an image of its own takes the image of a released one with the same parameters, released
two or more frames before (tex_reuse); memory requirements are kept per parameter set; a released entry another
descriptor's entry replaced at its address is kept and taken back.
- The memory check reads a page's write-watch bit and stamp under the lock that keeps them together.
- The launcher reads the gamepad only while its own window is in front, and does not start a second copy of the game.
- make_game.py says why a Python package did not load, not only that it is missing.
The fix's per-pass GPU timing is left out: NX2NAVI_GPU_PASSES does the same in main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NX2NAVI_DUMP_FILE=<path>: every 8th present looks for that file; when it is there, the present deletes it and dumps the
next frame to dump/f<present>, or that many frames in a row when the file holds a number up to 8, so a script takes
dumps when it likes. Dumps list up to 1024 pipeline and texture sets per pass (was 48) and copy every layer of a
sampled 2D array texture. From the local fixes package (fix 8); its mesh draw and movie dump parts are in main
already, in the form main has.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The driver charges device memory to the commit, and idle live textures went only above NX2NAVI_TEX_VRAM_PRESSURE of
the device's budget: on a 16-32 GB card the textures of every area visited stayed until the commit ran out, in 27-37 GB
processes that then failed an allocation or lost the device (#177, #203, #215). While commit_is_low holds and the
released entries are down to their low-commit size, evict_idle now runs too, 256 MiB at a time
(NX2NAVI_TEX_COMMIT_EVICT=0 turns it off).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The commit census of the perf trace walked the address space on the presenting thread outside mem_census, which
brought back the hitch mem_census was added to remove; it now runs only with mem_census = 1. DLSS's output pass at
the mode's share fell back to no pass at all when the scene was not at that share (the first presents, a dynamic
resolution step): after such a frame the first pass wider than the scene is taken again for 120 frames. The launcher's
nx2navi.ini editor no longer rewrites a file it cannot read, keeps the byte order mark and bytes that are not UTF-8,
reads an empty line as the game does, and leaves no temporary file behind. The build kit carries the two modules
build_game.py imports on Linux, the Linux steps list the right packages and Python, and stale comments and notes are
corrected (Discord on by default, two prebuild threads, Enhanced HDR gone).
DLSS Frame Generation needs nx2navi_dlssg.dll, NVIDIA Streamline's runtime and nvngx_dlssg.dll beside the game, which
no release carried, so the menu offered it and the game turned it off. tools/make_launcher.py --dlssg and --streamline
put them with their licences and a notice in the release's bin/dlssg/, and tools/make_game.py place_dlssg copies the
whole set beside the game. THIRD_PARTY_NOTICES.md has the row; the notes and README say RTX 40 and 50.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runtime/nx2navi.ico (the game window's title bar, taskbar button and Alt+Tab icon) is now the launcher's Navi, written
from launcher/ui/art.py navi_ico at the same ten sizes, in place of the Triforce. ocarina.exe is a console program
and the launcher has none, so Windows opened a console window titled with the exe's path beside the game;
winsys.start_game now passes CREATE_NO_WINDOW.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It talks only to a Discord client running on the same PC and does nothing without one; discord_rpc = 0, the Game tab
of the settings menu or the launcher's Discord Status row turns it off. The launcher's row reads an empty or missing
value as on, as the game does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The presence is off by default and its only switch was a row of the settings menu's Menu tab, which the Ocarina menu
left out, so it could be turned on only by editing nx2navi.ini. The row is in the Game tab now, and the launcher's
Settings has a Discord Status row that writes discord_rpc to the game's nx2navi.ini (launcher/gameini.py, which
reads the file as runtime/cfg.c does and changes only the line it sets). The connection itself works: the installed
game's --probe-discord connects and sets the status.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With trace = perf, every 600 frames heap_log started a thread that walks the whole address space with VirtualQuery
(plat_mem_census) for the "mem: process" line. The walk takes 100-240 ms, and though it runs on its own thread it
holds the process's address-space lock, which the game's threads take at every page fault and VirtualAlloc: the
present after each walk arrived 65-120 ms late, a hitch every ten seconds in every run with the trace on, and the
runs people attach to issues carried it. The walk now runs only with mem_census = 1 (NX2NAVI_MEM_CENSUS); the rest of
the memory lines stay.
Kokiri Forest, trace = perf: before, "slow frame" lines at 601, 1201, 1801, 2401 and 3002 of 65-120 ms with nothing
of it in the pipeline, texture or fence columns; after, none at those frames.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The target history is now four-way set-associative and counts a target as recent when one of the last four frames
rendered it, so the scene passes, probe layers and alternating effect mips no longer read as never rendered and wait
for their pipelines one at a time when a new area is entered. NX2NAVI_ONESHOT_BUDGET=1 makes one-shot draws share a
wait budget per presented frame (100 ms for large passes, 300 ms for small ones) instead of waiting up to
ONESHOT_WAIT_MS each; it is off by default until play shows no target left empty that way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runtime/input_ds3_win.c finds a DualShock 3 through hid.dll and setupapi (loaded at run time), sends it the command
that makes it report, sets its first player light and decodes its reports (runtime/input_ds3.c, tested by
tests/ds3_check) into the pad state, with rumble through its light motor. input.c follows whichever pad was pressed
last when an SDL pad is connected too. ds3 = 1 in nx2navi.ini turns it on: it starts a scan for the controller every
three seconds and opens it read-write, so it stays off unless a player asks for it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every 3600 frames and whenever private commit grew by 1 GiB since the last census: guest, other private, mapped and image
memory, and the largest private allocations outside the guest's range.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtayeqEG2x5woYzWuEQBGV
The input-stream overrides open the default recording device whenever the game asks. The setting keeps the earlier
refusal available, the stream-purge crash fix holds either way, the device name and log lines no longer say Windows on
every platform, and the error result is named.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The faster cache writes leave the .spv, .res.json and .use files unflushed and rely on the checks every read makes. The
setting puts the earlier flushed, written-through writes back for a drive or setup where a torn file shows up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each translation flushed its .spv and .res.json to the disk, wrote its .use mask with a flushed, written-through
rename and renamed its outputs written through: about six waits for the drive per shader. An NVMe drive does about
1,100 flushed files a second, a SATA SSD or a hard drive far fewer, so the translators sat mostly idle. Every read
already checks these files (spirv_complete, reflection_valid, the .use magic and size) and a torn one is translated
again, so they are now written whole but not flushed (plat_file_write_cached, plat_file_replace without durable).
The .in files stay flushed: they hold the guest's code and only their header and size are checked.
4,683 shaders of the install's preparation on a Ryzen 7 7700X and a Samsung 990 PRO: translation 36.4 and 37.2 s
before, 18.4 and 18.9 s after; every .spv, .res.json, .use and .in file and shader-prepared.bin are the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vk_gpu_written's stamps, which the texture cache needs, made mirror_sync copy the same pages back up into the mirror
the write-back had read them from: outdoors about 57 of the 60 MiB copied up a frame, about 5 ms of GPU time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtayeqEG2x5woYzWuEQBGV
The 16 MiB merges keep up to 256 MiB of idle snapshot chunks for the submissions in flight. Those chunks prefer device
memory and nothing evicts them, so on a 6 or 8 GiB card they took room the mirror and texture eviction defends. Large
cards keep the full 256 MiB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ranges just above the old 4 MiB limit were copied back over PCIe at the end of every submission. A larger snapshot pool
keeps the extra merges from allocating on the replay thread. NX2NAVI_WB_MERGE_MAX sets the limit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtayeqEG2x5woYzWuEQBGV
At Ultra Performance (an 854x480 scene) the Ocarina frame shape took the first single-target pass wider than the scene
as the output pass: a 960x540 post pass comes before the picture's, so DLSS upscaled to 960x540 and that was stretched
to the output. The output pass must now be at least the scene over the mode's share (widescreen.c dlss_share, exposed
as wide_dlss_share), which skips it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The movie decoder thread decoded each AV1 picture and then debanded and converted it before decoding the next. The
deband alone took 28 ms per 1080p frame on one thread and 20 to 27 ms spread over six stripes while the game ran, so the
movie advanced at 31 to 46 frames a second while its separate sound stream played at full speed.
The deband skips the bounds tests away from the plane's edges and picks the centre or the mean without a branch: the
same output, 16 ms on one thread. In the usual case (8-bit, debanded, the game converts the frame) each stripe debands
the decoder's own planes and writes its NV12 rows in one pass, so a frame takes one round of threads instead of two and
no single-threaded copy. A convert thread now does that work while the decoder thread decodes the next picture. The
pacing report adds the time each step takes.
The debanding now runs in stripes straight from the decoder's planes, and the conversion to the picture runs on a
thread of its own with a two-deep queue, so decoding, debanding and converting no longer run one after another.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
plat_frame_capture was a stub on Linux, so the font rasterizer's first setjmp ended the run (setjmp: no host frame). It now walks the stack with libgcc's _Unwind_Backtrace and fills a PlatJmp of its own (glibc's jmp_buf mangles rsp, rbp and rip, so it cannot be filled by hand); plat_jmp_save and plat_jmp_go are small SysV assembly routines like the Win32 ones.
plat_fiber_entry called the fiber function with rsp 8 bytes off the 16-byte alignment the SysV ABI requires, so the first aligned SSE store on a fiber (movaps in ov_poll) faulted as an access violation at address 0. It now aligns rsp before the call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sixteen builders on a 32-thread CPU spent about eight cores spinning on NVIDIA's driver lock and never finished the list
in a session; the ini text also said a quarter of the CPUs while the code took half.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtayeqEG2x5woYzWuEQBGV
The draw path called getenv("NX2NAVI_SKIP_PROG") for each of ~2,000 draws a frame, and getenv walks the whole environment block: in a replay-thread profile it was a sixth of the samples. That switch, the polygon offset log and the ASTC alpha probe now read the environment once. The replay's cost per draw went from 3.7-5.0 us to 1.2-2.8 us in play, and the mean frame rate by minute from 60-131 fps to 103-243 fps (different places in each run, so the figures are approximate).
cfg_get and cfg_value keep each thread's answers per name until the settings version changes (cfg_set, cfg_reset, cfg_load, and cfg_setenv, which the code that sets NX2NAVI_ variables in the process's own environment now uses); NX2NAVI_CFG_MEMO=0 asks every time.
The texture pool creates at most pool_create_budget (NX2NAVI_POOL_CREATE_BUDGET, default 16, was a fixed 64) new texture entries per refresh. The refresh holds the texture lock throughout, and streaming new textures in made 20-40 ms frames; at 16 the lock was held 5 ms per slow frame instead of 24 in a dense area, and the frames over 25 ms in a heavy minute fell from 111-188 to 89, with no pop-in seen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lock_time (NX2NAVI_LOCK_TIME) makes the replay threads time each lock they have to wait for, kept per asking site (platform.h plat_lock_timing, plat_mutex_lock_at and plat_rmutex_lock_at carry the site), and the frame-time summary lists the sites with the most wait, the recorder's full-ring and drain waits, and the texture lock's holds over 1 ms with the code that took it. replay_time now also keeps each frame's replay ops: a frame over 25 ms charged to the replay says how many draws, binds and transfers it replayed, their time, its slowest op, and how much of the replay's wall time the thread was on the CPU. NX2NAVI_PROFILE_REPLAY=1 samples only the replay thread without call chains, and the profiler now follows the thread that replays instead of the one that started the back end.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
texup_log_ms logs a "texup:" line for each frame whose texture work on the render or replay thread
reaches that many milliseconds. The line splits the time into texture creation, staging, storage
copies, ASTC recording, scratch buffers and new device memory, to show where an area load's hitch goes.
astc_scratch_keep keeps the ASTC decoder's scratch buffer across upload batches instead of making a
new 64 MiB buffer for each batch. astc_arena stages GPU-decoded ASTC blocks in the staging arena
instead of a buffer per texture. Both aim at the allocation churn seen during area loads and stay off
until a play test measures them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NX2NAVI_AUDIO_STATS=1 logs output underruns, late passes of the audio render thread, waits for the renderer lock,
late audio updates from the game and voices that ran out of queued sound, each with the game frame, to find where
a crackle comes from. NX2NAVI_AUDIO_GAME_PRIO raises the thread that sends RequestUpdate while its update is read
(1) or also keeps it above normal (2). Both are off by default, so the audio path behaves as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NVIDIA 621.01 reuses a pipeline-cache.bin entry only in the executable that wrote it, so every renamed or updated exe
compiled all of its pipelines again (23 s boots, 17 % read from a 470 MB file). With NX2NAVI_PIPE_BINARIES=1, where the
driver has VK_KHR_pipeline_binary, every pipeline, stage library and compute pipeline is looked up by its driver
pipeline key in pipeline-binaries.bin and made from the stored binaries; anything not stored is compiled once with its
data captured and appended. Each binary is stored once under its own key: nearly every graphics pipeline carries the
same 2 MiB binary, which made a first version of the file 7 GB. pipeline-cache.bin is not used while this is on. The
knob is off by default while it is being tested; NX2NAVI_PIPE_BINARIES_MAX_MB caps the file.
NX2NAVI_ONESHOT_WAIT_MS sets how long a draw into a target the previous frame did not render waits for a pipeline built
for the first time before it is skipped; the default keeps the old 30 s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Button prompts row gains Keyboard and mouse (prompts = pc). tools/pad_prompts.py --style pc writes
romfs-patches-pc: every button glyph shows the first key its bindings give it (Ocarina's defaults, with the bind_
lines of the install's nx2navi.ini over them), the mouse buttons as a mouse, the d-pad and the left stick as their
keys laid out as on the keyboard (1 to 4, W A S D), and the camera as the mouse moving. The action prompt shows the
key's label, the ocarina's notes the light keys. A key the art has no picture of is written on a blank key. The pad
styles draw the same bytes as before.
The prompts description says so in each menu language, and the Chinese one no longer splits words across its lines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A create with oldSwapchain retires it even when it fails. The old one, its views and its semaphores now go at once, on
the frame generation paths too, the next present makes a swapchain from nothing, and the failure line is throttled.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the replay on the submitting thread (the default), vk_texture_release and entry_of destroy textures on the game's
loader threads, where vk_exec_recording_fence is 0: the deferral took the last submitted value, so the image could go
while another thread's submission, or the recorder behind it, still named it. Such deferrals now wait for issued + 1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The game's ACES tonemap shader gets a GLSL function linked into its SPIR-V where it clamps each channel: the game's SDR result upgraded to the HDR range by luminance and mapped to the display with the RenoDRT curve, exposure, highlights, shadows, contrast, saturation, highlight saturation, blowout, flare and hue correction. The settings reach it as four vec4 the support buffer gains at 1440. The present encode is a port of the swap chain pass: gamma correction, gamut compression, the peak clamp and PQ. Without an HDR10 swapchain the shader gives the game's own SDR picture; native HDR is unchanged.
The menu offers Off, RenoDX and Native, with gamma correction, the tone mapper and its grading rows. The shader build compiles sources marked "keep functions" without optimisation so their functions survive for the splice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Upscaling row no longer carries "DLSS on or off: after restart". It shows "after restart" only while the upscaler picked cannot start in this run. Frame generation says so only for a change to or from NVIDIA's, since AMD's applies at once, and the HDR row no longer says it twice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Large compute shaders that no cache holds are built on one background thread after the boot prebuild, smallest first, so their first dispatch no longer compiles them on the replay thread. NX2NAVI_BIG_BUILD_MAX_MB stops that builder once the process has grown by that much: on a 31 GB machine one of these shaders took the process up by 12.8 GB and the game stuttered while Windows paged. The builder takes the queue under its lock and copies each entry out before compiling it, so a shader queued meanwhile cannot free the arrays under it. The same change reports what pipeline-cache.bin gives back, and starts over when the file grows past NX2NAVI_PIPELINE_CACHE_MAX_MB.
A tensor-core program is now tested before its shader is asked for, in both dispatch paths. It runs the stand-in while NX2NAVI_NATIVE_TENSOR is off, and translating it anyway recorded four AI-upscaler shaders of 0.87 to 4.4 million SPIR-V words that this game never dispatches natively. Process memory went from 29.3 GB to 24 GB and the multi-gigabyte builds during play are gone.
The frame-time summary says which part a slow frame went to, and with NX2NAVI_REPLAY_TIME how the replay splits between draws, binds and transfers; NX2NAVI_SVC_SLOW_MS logs the kernel services that block, with the thread they blocked on. prof_report.py reads the map this build writes and adds the image base to a runtime Rip, so a profile resolves to function names instead of question marks.
build_xlate.py applies the patches with GIT_CEILING_DIRECTORIES set to the build folder's parent. Inside a checkout git read 0021-prmt-byte-permute.patch's paths from the repository's top, skipped every file of it and still exited 0, so PRMT was missing from locally built translators and every byte permute was a no-op. A Skipped patch line now fails the build. The note in AmpereLowering.cs that said the translator emits nothing for PRMT is corrected.
Performance: draws reuse the bindings that did not change and record only the dynamic states that differ from what
the command buffer holds; small uploads come from a staging arena; finished submissions are held briefly and handed to
the queue in batches; the recorder thread can keep a CPU core of its own; ASTC block-linear textures are deswizzled on
the GPU; dynamic resolution steps the upscaler mode to hold a frame-time target. Each has a setting in nx2navi.ini
(bind_reuse, dyn_delta, stg_arena, submit_batch, recorder_core, recorder_prio, astc_gpu_deswizzle, dyn_res) and the
staging cache now frees what it holds at shutdown.
Capture: NX2NAVI_DUMP=key saves the frame after each press of Insert, with mesh draws listed by task, mesh and fragment
shader, depth test and face culling, and mesh_prims.txt giving each mesh draw's primitive, clipping and fragment counts.
All of it is off unless NX2NAVI_DUMP is set.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>