Commit Graph

273 Commits

Author SHA1 Message Date
chrg6
87f51f94a9 Read shaders from the disk cache off the render thread past a small budget, and pack the cache on carried updates.
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>
2026-11-09 14:34:45 -05:00
chrg6
fbb6783664 Hold less device memory that only costs the system's commit: a smaller released-texture cache, no spare blocks while commit is low, large images in memory of their own.
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>
2026-11-09 14:00:12 -05:00
Michael Schienbein
7a15c063ca Mark the pre-commit hook and tools/fetch_refs.sh executable, so they run on Linux.
Every file was committed with mode 100644. Git on Linux and macOS ignores a hook without the executable bit ("The '.githooks/pre-commit' hook was ignored because it's not set as executable"), so the content check that CONTRIBUTING.md turns on with core.hooksPath never ran before a commit there. tools/fetch_refs.sh, which AGENTS.md runs as a command, stopped with "Permission denied". Windows does not look at the bit, so nothing changes there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 13:49:52 -05:00
Michael Schienbein
b6a5cc302c Key the shaders step by the translator the build actually uses.
The shaders step key hashed only the kit's bin/nx2navi_xlate.id, but the build takes the translator from the kit's bin/ or, in a source checkout, from build/xlate/ (xlate_source). From a source checkout, main() worked out the shaders key right after the compile step and stopped with a FileNotFoundError on bin/nx2navi_xlate.id before any shader was prepared.

The key now hashes the identity file beside the translator xlate_source finds, so a source checkout is keyed by build/xlate/nx2navi_xlate.id and a kit's key is unchanged. A build without a translator stops with the existing message that names tools/build_xlate.py. The prompts test kit gets a translator stand-in beside its identity file, and a new test covers a kit that has the translator only under build/xlate/.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 13:49:43 -05:00
chrg6
6910723aed Let a released texture give its content to a new one at its address, and log only the empty starts that can show.
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>
2026-11-09 13:27:45 -05:00
Sebastian Choperena
6589476872 Pack the shader cache after the launcher prepares the shaders, as the installer did.
The launcher builds through tools/make_game.py, whose shaders step never ran tools/pack_shader_cache.py, so a
launcher install keeps about 175,000 loose files (4.9 GB) in shader-cache/. The game looks them up one by one at
every start and reads the use masks of 42,000 of them for 20 s after it. make_game.py now packs the cache after the
preparation; a failure is reported and the build goes on, since the game still reads loose files. The kit and the
launcher ship the tool.
2026-11-09 13:15:47 -05:00
Sebastian Choperena
59069502f3 Stop a second copy of the game before the shader prewarm, not after it.
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.
2026-11-09 13:15:47 -05:00
chrg6
9bba578e58 Hold the game to 240 frames a second when the limit is unlimited or higher, which stops the quick menu's crash.
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>
2026-11-09 13:15:37 -05:00
chrg6
9c10827018 Upload the menu's font atlas through the runtime's upload batch, checked, instead of Dear ImGui's own upload.
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>
2026-11-09 13:10:47 -05:00
chrg6
7a60f4e2a0 Let a texture taken back at its address keep its content when nothing has written there since, which stops the black frames.
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>
2026-11-09 13:05:35 -05:00
chrg6
b48371ee82 Give a new texture over a live one of another size the region both cover, which stops the black frame about once a second.
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>
2026-11-09 12:59:48 -05:00
chrg6
a720ca879c Let NX2NAVI_GPA_TWIN_MAX_KB keep the device address table's second writes to small pools, to measure what the twins cost.
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>
2026-11-09 12:45:26 -05:00
chrg6
c29d1b8dbd Name exit code 70 for what it mostly is: a fatal error the game wrote to its log, often memory that ran out.
The launcher told players that code 70 meant the game could not start itself again. The game exits with 70 after any
FATAL line of its own (runtime/dispatch.c rt_fatal), most often an allocation that failed when the memory ran out;
a failed re-run of itself (plat_reexec) is the rare case. A 0.6.1 player on a 16 GB laptop got the old text three
times, which pointed away from the log line that says what happened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:45:14 -05:00
epicmeme546
fb3764c599 Hold the scene at 75% of the picture when no temporal upscaler is running.
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>
2026-11-09 12:45:14 -05:00
epicmeme546
5cb85adb45 Stop the fog leaving dark trails behind nearby objects.
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>
2026-11-09 12:45:14 -05:00
chrg6
813f256dbc Keep AMD frame generation off while NVIDIA's frame generation holds the device, so switching between them no longer crashes.
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>
2026-11-09 12:31:28 -05:00
chrg6
a5763d14af Keep FSR 3.1 running when the render scale changes more than a few times.
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>
2026-11-09 12:20:05 -05:00
chrg6
cb234fade1 With frame generation and no frame limit chosen, limit to the display's refresh rate.
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>
2026-11-09 12:18:17 -05:00
chrg6
5fb384b906 Add DLSS multi frame generation, the Intel pipeline cache crash and the pinned Streamline runtime to the 0.6.1 notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:18:17 -05:00
itaskaev2
7341eec727 Download the pinned Streamline runtime for DLSS Frame Generation, and let the build kit carry it too.
make_launcher.py --dlssg needed --streamline, a Streamline SDK folder unpacked by hand, and make_kit.py could not
carry DLSS Frame Generation at all, so a game built from the kit always left it off. tools/streamline_pin.py now pins
the Streamline 2.14.16 SDK release (its archive's size and SHA-256, and the SHA-256 of each file the game loads):
without --streamline the scripts download the archive once, check it, keep only sl.interposer.dll, sl.common.dll,
sl.dlss_g.dll, sl.pcl.dll, sl.reflex.dll, nvngx_dlssg.dll and the two licence texts, each checked, and delete the
archive. A folder given with --streamline must hold the pinned files.

The bin/dlssg/ assembly moves from make_launcher.py into streamline_pin.place, so the release and the kit write the
same set and the same dlssg-NOTICE.txt: a kit made with --dlssg and the 0.6.0 release's nx2navi_dlssg.dll has a
bin/dlssg/ identical to the 0.6.0 release's, byte for byte. make_kit.py takes --dlssg [--streamline] like the
launcher. nx2navi_dlssg.dll itself still comes from tools/build_dlssg.py.

tests/launcher_test.py test_streamline_pin covers the extraction, the cache, refused archives and folders, and the
notice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 12:18:17 -05:00
twisted89
417d1a3740 Keep the pipeline cache save from copying the cache while pipelines are built into it.
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.
2026-11-09 12:18:17 -05:00
chrg6
c745a9ef2f Offer DLSS multi frame generation at 2x, 3x and 4x.
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>
2026-11-09 12:18:17 -05:00
epicmeme546
26eb249026 Stop the red flashing by showing the picture the game's post pass really writes.
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>
2026-11-09 11:58:47 -05:00
chrg6
78ee0ddb1e Say in the 0.6.1 notes that an update from 0.5.0 keeps its compiled game too, and that the device-lost fix covers low memory.
Checked with the 0.6.0 launcher's own update path against a local copy of the 0.6.1 release: 552 of the game's 562 objects
were taken over, 10 compiled, the prepared shaders kept with the translator that made them named, done 0.2 minutes after
the download.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.6.1
2026-11-09 11:44:39 -05:00
chrg6
8a4cb72b61 Set the version to 0.6.1 and write its release notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 11:28:41 -05:00
itaskaev2
b4a876200b Link the game's manifest and icon as a .res written in Python when lld links, so no build path goes through windres.
windres (binutils) opens its files and starts its preprocessor through the system's ANSI code page. A build or user
folder whose name holds a character outside that code page (Victor with an accent on a Cyrillic Windows, a Japanese
user name, a folder named with a full-width colon) failed the Compile step with "Invalid argument" or "Cannot create
temporary file". make_game.py now writes runtime/nx2navi.rc's two resources as a .res file itself (resource_file) and
hands it to lld, which builds the resource section from it and opens paths as Unicode. The resources come out as
windres made them: the manifest as 24/1, the icon's images as RT_ICON 1..7 and their group as RT_GROUP_ICON 1, US
English. Without lld the windres path stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:45:50 +01:00
chrg6
137e03feae Say which guest region holds the memory when the process grows.
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>
2026-11-09 07:52:06 -05:00
chrg6
66927b8f94 Ask every driver but NVIDIA's to keep NaN and infinity in the game's shaders, which should bring Navi's orb back on AMD GPUs.
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>
2026-11-09 11:17:08 -05:00
chrg6
91acff672c Stop calling RTSS's EnumProfiles, which crashed the game at start where RivaTuner Statistics Server runs.
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>
2026-11-09 11:22:38 -05:00
chrg6
7db0c5c75b Keep the crash report's exception filter in place, and write the game's exit code into its log from the launcher.
The last-chance exception filter is set at the start, before the GPU driver and the other DLLs load. A DLL that sets
its own filter later takes its place, and a fault in that DLL then ends the game with no FATAL line in the log. Two
0.6.0 logs from an RX 7800 XT end that way on the title screen. Once a second the filter is now put back and the
module that replaced it is logged (NX2NAVI_CRASH_FILTER_GUARD, default 1). When the game ends with a nonzero code,
the launcher adds that code, in hex with its meaning, to the end of logs\nx2navi.log, so a fail-fast exit that no
handler in the process can see still shows in the log a player sends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 11:22:37 -05:00
chrg6
d9dacb4ae4 Register NX2NAVI_PROFILE_SLOW, so the profiler's slow-frame dumps can be asked for in nx2navi.ini without a warning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:58:32 -05:00
chrg6
0f1847d243 Retry a cut connection when the launcher reads a small file, as downloads already do.
net.get_bytes and get_json, which read the release feed, the package databases and the package index, gave up on the
first network error, so one connection reset (WinError 10054) during Gather Build Tools ended an install (#237). A cut
connection, a timeout or a server error (5xx, 429) is now tried again after 1 and 2 seconds; a refused certificate or
another HTTP error still fails at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:57:10 -05:00
DieMitchell
21eb3de1c2 Fix out-of-bounds texture size query extracts in the SPIR-V translator
The SPIR-V generator emitted OpCompositeExtract with the guest's component index even when it exceeded the image's size vector. A 2D texture's OpImageQuerySizeLod returns a v2int, so a guest request for the third component (depth) produced an extract of index 2, which is invalid SPIR-V. RADV crashed while compiling those variants during shader preparation.

Return the constant 1 for a component past the texture's dimensions, the depth of a 1D/2D/cube texture, and apply the same guard in the GLSL generator. build_xlate.py now expects the added patch.
2026-11-09 10:44:00 -05:00
chrg6
4223e0aa5c Name the translator a shader cache was made with before an update replaces it, so the first update carries too.
A shader cache made before the game carried translations over has no identities.txt, so after the update that brings
the carrying the game could carry nothing, yet the update skipped the shader step whenever shaders had been prepared.
Before a new translator goes beside the game (the compile step, and the shader step a translator-only kit runs alone),
note_cache_translator writes identities.txt naming the translator still there, in the form runtime/gfx_shader.c
reads; a file already there is left alone. The shader step is skipped only when the cache names a translator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:42:36 -05:00
chrg6
10ea0a2eb2 Keep serving the previous translator's shader translations after a translator update, and translate them again in the background.
Every shader cache key names the translator, so a release with a new translator had no cached translation at all:
the launcher re-translated about 42,000 programs before play, and play waited for any program not prepared.

The cache now lists the translator identities it holds translations of in shader-cache/identities.txt, newest first.
A shader the current translator has no translation of uses a previous one's, looked up with that identity mixed with
this machine's host options and read with the usual checks; it keeps that translation for the rest of the session, so
no pipeline is built twice. After the boot prewarm a background pass translates every stored input that has a previous
translator's entry again under the current one, on its own translator child at idle priority that waits while the
game translates. A program the new translator refuses keeps its old translation and is logged. Once the pass has gone
through every such input, the old entries of what it covered are dropped: loose files are deleted, and a pruned copy
of shader-cache.pack replaces the pack at the next start when the pack is still the one it was copied from.
--prepare-shaders still translates everything under the current translator. NX2NAVI_SHADER_CARRY=0 keeps the earlier
behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:42:36 -05:00
chrg6
3ccc33b3e8 Describe in docs/launcher.md how an update now keeps the compiled game and the prepared shaders.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:42:36 -05:00
chrg6
fa1a2250b5 Let Rebuild the Game compile the game's code for this processor's level, and updates keep the compiled level.
make_game.py --rebuild keeps the level the objects were compiled for (lifted_level), so an update compiles only what
changed; --retune compiles for this processor's level. RebuildJob passes it, ContinueUpdateJob does not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:42:36 -05:00
chrg6
cd20bdf09f Download and stage updates in the background, and install them only when the game is not running.
A check that finds a newer release (at start, then hourly while the launcher runs, also hidden during play) stages
it on a background-priority thread: the app into app/<version>, a new Python into app/<version>/python.staged rather
than python.next (which the stub would swap in under the running version), and staged.json written last to mark it
complete. Nothing is switched and nothing restarts. A failed staging is logged and tried again after the next check.

The staged release installs, through the existing switch, restart and ContinueUpdateJob path, when the launcher
starts and right after the game exits, never while a copy of the game runs. Install Updates Automatically (on by
default) can leave it to the Updates row instead. A version the stub rolled back from is not staged or installed by
itself again, prune keeps a staged release, and the Settings rows now fit the window with the new toggle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:42:36 -05:00
chrg6
0223d88520 Turn NX2NAVI_SPLIT_IDLE off by default: it made the foliage flicker.
Tested in the 0.6.1 test build (RTX 5090, Kokiri Forest), switching the frame rate changes off in turn: the foliage
flickered with split_idle on alone and not with it off, with render target image reuse on either way. split_idle sends
a submission's first part to the GPU at the first pass boundary after a draw or dispatch while the GPU is idle,
without the usual draw and time minimums; why parts cut that early make the foliage flicker is not known yet.
The settings file's two stacked descriptions of the split settings, left by the merge, are one again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:42:36 -05:00
chrg6
2ce8451fe9 Keep the compiled game across updates: stable compile keys, objects of earlier versions taken over, shaders carried.
An update recompiled every file of the game's code whenever anything in its keys changed, though the compile was the
same. The compiler's id held the file time of clang.exe, so a tool update that put the same compiler back made every
object stale; it is now the version text and the size. The fast CLANG64 compiler, whose objects are UCRT64's byte for
byte, was part of the key through its id and --sysroot; it no longer is.
So that this change itself costs nothing, an object whose entry has the key an earlier version gave the same compile
is taken over (ObjectCache.adopt) when its sources and headers read as they did: 0.6.0's form, and the form of 0.5.0
and earlier, which held the kit's own folder (app/<version>) in its paths; a header in that folder is read in this kit.
Checked read-only against two real game folders: all 551 lifted objects of a 0.6.0 install and of a 0.3.10 install
match their form and would be taken over.
The objects of 0.5.0 and earlier were compiled for generic x86-64, so an update keeps compiling the lifted code for the
level the objects were compiled for (build-cache/obj/lifted-build.json, lifted_level); --retune, for Rebuild the
Game, compiles it for this processor's level. An update also leaves the shaders prepared before in use and lets the
game translate them again in the background (shader_carry, NX2NAVI_SHADER_CARRY), instead of a full preparation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:42:36 -05:00
epicmeme546
6b5038f6a4 Stop the scene upscaler's stand-in from showing an older picture, which made whatever moved trail.
Without DLSS or FSR 3.1 the stand-in takes the input in the output's format. The current picture also resolves as RGB9E5 at the same address, and when it did it was refused, so the older picture bound beside it was shown instead. An RGB9E5 input now counts as the picture and goes through the same decode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:12:45 -05:00
epicmeme546
26be3f9c3c Keep the launcher hidden through the game's own Restart.
The game's Restart ends the process the launcher started and starts another. The launcher took that for the game ending: it came back over the game and forgot a game was running, so its Play could start a second copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:12:45 -05:00
chrg6
e3bfa3d40a Free a destroyed texture's record only after the GPU is past the submission being recorded, and cache no view of it.
A device lost seen on RTX 4090, 5090 and 5070 Ti cards in 0.5.0 and 0.6.0 (#177, #61, and a 0.6.0 test run): a
"read invalid" at the start of a 128x128 scene capture pass, re-rendered at area loads. destroy_tex purged the views of
the image and deferred the image, then freed its record at once, on whichever thread released the texture. The replay
keeps &e->pub as a render target for the rest of a command buffer (vk_exec.c resolve_target) and DLSS for the frame:
a pass that began again (each indirect mesh draw ends the pass) read the freed record and cached a view of the dead
image, which nothing removed. Vulkan gives a destroyed image's handle to a later image, which then got that view, and
the pass loaded its attachments from freed memory.
- destroy_tex marks the record gone and frees it through the deferred destruction (vk_defer_free, a host kind stamped
  with the submission being recorded, as the image is).
- A gone texture's attachment view is made per command buffer (vk_exec.c view_of) or deferred with it
  (vk_exec_target_view, for DLSS and the contact shadows), never cached.
- A new image drops any view still cached under its handle, and the log counts it ("cached views of a destroyed image").
No rendering changes: the views and images live exactly as long as before, the records slightly longer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:58:26 -05:00
chrg6
0101a87079 Raise the frame rate: fewer copies into the VRAM mirrors, earlier GPU starts, render target images reused.
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>
2026-11-09 09:55:25 -05:00
chrg6
f1779ec9e4 Refresh the translator beside the game before the shader step prepares shaders.
The compile step copies the kit's translator next to the game, but a kit that changes only the translator runs the
shader step alone (its step key holds the translator's identity), which then prepared with the old copy. From the
local fixes package (fix 9); its translator build guard is in main already.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 09:48:29 -05:00
chrg6
9a1abb9a15 Take frame dumps when a file appears, and list more of each pass in them.
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>
2026-11-09 09:47:33 -05:00
chrg6
69d49706fa Evict idle textures when the system's commit runs low, not only under VRAM pressure.
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>
2026-11-09 09:45:47 -05:00
chrg6
d6711ca59b Credit the button prompt art the releases carry in THIRD_PARTY_NOTICES.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.6.0
2026-11-09 09:12:31 -05:00
chrg6
dfc5b90b59 Fix what the 0.6.0 review found, and ship DLSS Frame Generation in the launcher release.
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>
2026-11-09 09:10:36 -05:00
chrg6
250a12272a Bring the README up to 0.6.0: DLSS Frame Generation, button prompts and the PlayStation layout, Discord status, the
monitor, sound and microphone settings, DualShock 3, 1080p, the Linux build, and the current known issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:54:36 -05:00