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>
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>
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>
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>
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>
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>
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>
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>