Commit Graph

156 Commits

Author SHA1 Message Date
chrg6
f00f464e9f Turn Discord Rich Presence on by default.
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>
2026-11-09 08:51:57 -05:00
chrg6
7fc21407c3 Bring back the switch for Discord Rich Presence, in the game's Game tab and in the launcher's Settings.
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>
2026-11-09 08:51:07 -05:00
itaskaev2
553067ea0b Walk the process's address space for the memory census only when mem_census asks for it.
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>
2026-11-09 08:25:33 -05:00
itaskaev2
03e6dac0be Read a target's render history without collisions and over four frames, and offer a per-frame budget for one-shot pipeline waits.
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>
2026-11-09 08:25:21 -05:00
FemOrWhat
844940c6fb Add DualShock 3 support on Windows, read straight from the controller when no driver presents it, off by default.
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>
2026-11-09 08:21:07 -05:00
chrg6
2d94ede66a Put the commit census and the per-pool traffic log after the comments they had split from their functions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:20:32 -05:00
Tyler
567cbada21 Log the mirrored pools that move the most bytes every 600 frames with NX2NAVI_TRACE=perf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtayeqEG2x5woYzWuEQBGV
2026-11-09 08:20:15 -05:00
Tyler
2270664be2 Total each allocation once in the commit census, add a size breakdown, and write the profile on a crash
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HtayeqEG2x5woYzWuEQBGV
2026-11-09 08:20:01 -05:00
Tyler
3e10da4d5c Log where the process's committed memory lies with NX2NAVI_TRACE=perf
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
2026-11-09 08:20:01 -05:00
chrg6
acdf1711b9 Let microphone = 0 refuse the game's input streams, and give the microphone code a neutral device name.
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>
2026-11-09 08:19:55 -05:00
Gonzalo Castro
45a8cc3d8b Capture the default microphone for Ocarina input streams 2026-11-09 08:19:19 -05:00
chrg6
837926d8e1 Let shader_cache_flush = 1 flush the shader cache files to the disk again.
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>
2026-11-09 08:19:13 -05:00
xyzzyy
a4ee74b74e Stop flushing the shader cache files every read checks, so shader preparation translates twice as fast.
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>
2026-11-09 08:18:54 -05:00
Claude
6c971b790e Leave GPU-written pages of mirrored pools out of the next upload (NX2NAVI_WB_NO_REUP=1)
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
2026-11-09 08:18:41 -05:00
chrg6
ea1ad37183 Load shcore.dll once for the monitors' DPI instead of on every call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:18:19 -05:00
Thiago Cabral
d0c8588e3f Open the game window on a chosen monitor: the monitor setting and --monitor pick it by index, primary, or part of its device or monitor name, and --list-monitors prints the monitors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:18:08 -05:00
Thiago Cabral
bb0ac8caeb Play the sound on a chosen output device: the audio_device setting and --audio-device pick it by index or part of its name, --list-audio-devices prints the devices, and a chosen device that goes away hands the output to the default one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:17:35 -05:00
chrg6
afb31a56f5 Keep the write-back snapshot pool to 1/64 of the VRAM budget, between 64 and 256 MiB.
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>
2026-11-09 08:17:34 -05:00
Tyler
8215fb666c Merge storage write-backs of up to 16 MiB instead of copying them back whole
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
2026-11-09 08:17:11 -05:00
spider
7d35eada1d Upscale to the picture's size at Ultra Performance, not to the first pass wider than the scene.
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>
2026-11-09 08:16:53 -05:00
AdrianHernandezz
5663664807 Decode movies at their 60 fps, so they no longer play in slow motion.
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>
2026-11-09 08:16:38 -05:00
spider
e9edd6a9d8 Fix two Linux crashes before Ocarina reaches gameplay
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>
2026-11-09 08:16:25 -05:00
Thiago Cabral
3a65d31b27 Open the game straight in fullscreen when the fullscreen setting is on: the window turns fullscreen on its monitor before it is first shown, and the first activation retries it only if that failed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:16:25 -05:00
Tyler
032f59bb44 Build the boot library prebuild on two threads by default instead of half the CPUs
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
2026-11-09 08:16:25 -05:00
tangerineturtle1
589c9e8654 Stop the replay from searching the environment on every draw, remember setting lookups, and spread texture streaming over more frames.
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>
2026-11-09 08:09:26 -05:00
tangerineturtle1
480a197994 Add replay diagnostics that found this session's frame-time dips, all off by default.
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>
2026-11-09 08:09:26 -05:00
tangerineturtle1
a154bafad2 Add a per-frame texture work log line and two ASTC upload changes, all off by default.
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>
2026-11-09 08:09:26 -05:00
tangerineturtle1
762bd3f934 Add audio underrun and late-update counters, and a knob for the priority of the game's audio thread.
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>
2026-11-09 08:09:26 -05:00
chrg6
fe3cca739b Keep compiled pipelines as pipeline binaries under the runtime's own keys, and let the one-shot draw wait be set.
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>
2026-11-09 08:09:26 -05:00
chrg6
9e56d5a316 Add keyboard and mouse button prompts, drawn from the art's keys.
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>
2026-11-09 08:09:26 -05:00
chrg6
93a38b5d12 Check the selftest's physical memory limit against the title's own pool size.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:09:26 -05:00
chrg6
ad7b3ccf51 Keep the recorded shader programs and answers when only reading them failed, and record nothing to such a file that run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:09:26 -05:00
chrg6
574295ff95 End the shader translators with the game, through a job that kills them when it closes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:09:26 -05:00
chrg6
c45d252c3d Read an exefs.status line only to its own end.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:09:25 -05:00
chrg6
b9479507ed Stop walking a mod's folders at 32 levels, where each level cost a stack frame of about 18 KB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:09:25 -05:00
chrg6
443c4873fe Keep the cheat VM's main-module check from wrapping for addresses near the top of memory.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:09:25 -05:00
chrg6
9b4f461e6f Add a mod's BYML key offsets in size_t, so an offset near 4 GiB no longer passes the bounds check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:09:25 -05:00
chrg6
02a4b024a6 Follow a desktop resolution, layout or HDR change in fullscreen, and make the swapchain again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:09:25 -05:00
chrg6
6eb715dac8 Let the present thread finish before the held work is walked at a present, which it may be replaying and freeing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 08:09:25 -05:00
chrg6
d13ec37ced Drop the old swapchain when a new one cannot be made, instead of acquiring from the retired one every frame.
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>
2026-11-09 08:09:25 -05:00
chrg6
12b93f81ed Keep textures released on the game's loader threads until the submission being recorded has run.
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>
2026-11-09 08:09:25 -05:00
tangerineturtle1
9e574f84ec Replace the enhanced HDR with a port of RenoDX's tone mapper.
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>
2026-11-09 06:06:33 -05:00
epicmeme546
778c55777d Say a restart is needed only when one is, and drop the line under Preparing shaders.
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>
2026-11-09 04:29:01 -05:00
chrg6
b0d420db3d Land the shader and pipeline stutter pass, and the fixes it needed.
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.
2026-11-09 03:34:46 -05:00
chrg6
1f7e9c975b Speed up the replay and fix what the perf pass found, and add a frame capture key for chasing rendering faults.
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>
2026-11-09 03:34:46 -05:00
chrg6
86de3320a0 Evict idle mirrors only when that makes the room, and ask the textures for room once per refusal.
In a test run with the budget taken as 16 GiB, 113 pools refused for the budget asked again 1,795 times in 6,000 frames, every 16 submissions, though nothing could make room: the world's textures were all in use. Now the idle mirrors go only when together they free what the new mirror needs, and a refused pool asks the textures for room and comes back soon once; after that it asks again every 600 submissions until it gets its mirror.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 03:34:46 -05:00
chrg6
073ddc0c95 Stop the evictions from emptying VRAM, and give VRAM mirrors priority over textures.
A test run with the budget taken as 16 GiB showed two faults. The evictions measured the driver's heap use, which keeps counting a VMA block whole while one allocation lives in it, so freeing textures and mirrors in the middle of blocks did not move it: they went on until 5700 of 7232 textures and 395 of 410 mirrors were gone (9.2 GiB free inside blocks). And mirrors evicted under pressure during a menu were refused again when the world came back, so the draws read the pools over PCIe at 4 fps. The evictions now count the free space inside VMA's blocks as room (vk_mem_vram_live), mirrors are no longer evicted to make room for textures, and a mirror that does not fit after the idle mirrors made room asks idle textures for the rest (vk_texture_want_room) and is asked again 16 submissions later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 03:34:46 -05:00
chrg6
fa8f8dc84d Count a texture's idle time in texture pool walks, not in submissions.
The pool refresh looks every registered slot up only in submissions that draw through the texture pool. Counted in submissions, a pause screen or a fade that draws nothing through the pool made every texture of the world idle within seconds (the census showed all 3456 decoded textures idle during one such stretch), and under VRAM pressure the eviction would have dropped them all, to be uploaded again when the world came back. The clock now moves only for a submission whose slot checks reached half of the registered pool slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 03:34:46 -05:00
chrg6
817737adae Evict idle VRAM mirrors to make room, and ask again for mirrors the budget refused.
A pool whose mirror did not fit the VRAM budget stayed imported for good, however hot, while mirrors nothing had used for minutes kept their memory. Now a new mirror that does not fit takes the room of mirrors no submission synced for 120 submissions, least recently synced first; a pool refused for the budget asks again after 600 submissions; and above the texture pressure threshold (90% of the budget) mirrors idle for 600 submissions go every 8 submissions so the textures get the room. A victim has nothing in the submission being recorded and its GPU writes are already back in guest memory; its device address table pages move back to the imported buffer (vk_gpa_remap_plain) and the mirror is destroyed once the submission is done. It is mirrored again from a whole copy at its next buffer use. NX2NAVI_MIRROR_EVICT=0 turns it off.

Measured with the budget taken as 16 GiB, same route: off, 691 mirrors (910 MiB) and 133 pools refused for the budget; on, 405 mirrors (799 MiB): 240 idle ones (98 MiB, title-screen and loading pools) evicted, 114 pools refused. That exe still evicted idle mirrors under pressure for the textures, which a later commit removes, and asked refused pools again every 16 submissions (1,795 times), which another commit spaces out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 03:34:46 -05:00
chrg6
63bcb441c0 Evict the least recently used idle textures when video memory runs low.
Above the VRAM pressure threshold (NX2NAVI_TEX_VRAM_PRESSURE, 90% of the budget) only released textures went before, so a scene whose live textures alone passed the budget kept growing into system memory. Once the released ones that come back intact are gone, live textures go too, least recently looked up first: only those whose content their storage still holds (CPU-written, never drawn into) and that no lookup reached for 240 submissions and 120 presents. The texture pool refresh looks every registered slot up each submission, so no live descriptor names them; the next use creates and uploads them again. Up to 64 per check, until the use is 2% under the threshold, and the next check waits for the GPU to pass the submissions that may still name the freed images. NX2NAVI_TEX_EVICT=0 turns it off.

Measured with the budget taken as 16 GiB (NX2NAVI_VRAM_BUDGET_MB=16384), same route, the exe at this commit and the next one: with the eviction off, 17,479 MiB in use in the world, of which 12,321 MiB textures, 37 MiB of them idle; with it on, 43 idle live textures (10 MiB) went in about 6,000 frames. In the world nearly every loaded texture is named by a descriptor, so the eviction frees memory mostly once an area or a menu is left. That run predates the later fixes (the idle clock in pool walks, the free space inside blocks); an earlier run without them emptied VRAM, as the commit that stops the evictions from emptying it says.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 03:34:46 -05:00