Commit Graph

578 Commits

Author SHA1 Message Date
Tobim6
6169d82385 NX2NAVI_DUMP_KEY takes a key name; Pause by default.
F10 is the performance overlay's key, so a press dumped a frame and changed the overlay. dump_key = 1 or pause now
means the Pause key; scrolllock, insert, home, end, pageup, pagedown, f2-f7, f9 and f12 can be chosen instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:13 +01:00
Tobim6
131ee6f275 NX2NAVI_DUMP_KEY: F10 dumps the next frame.
A frame dump needed its frame number in advance (NX2NAVI_DUMP) or a depth target address (NX2NAVI_DUMP_AFTER); with
dump_key = 1 each press of F10 in the game window dumps the next frame to <dump dir>/f<frame>, as often as wanted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:11 +01:00
Tobim6
2b11e32250 NX2NAVI_PASS_TIMES: write the timestamps straight into the command buffer, not through the recorder.
vk_pass_mark_cmd runs on the recorder thread for a pass mark packet; through vk.h's macro its vkCmdWriteTimestamp
became a packet of its own, put into the ring by the recorder thread while the replay thread was writing it. The ring
broke ("FATAL: vk_rec: unknown packet") on NVIDIA GPUs, where the recorder is on by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:10 +01:00
Tobim6
1768d5f607 Mesh emulation: the vertex shader declares the fragment shader's inputs one for one.
The generated vertex shader wrote one vector per location. A fragment shader that packs two inputs into one location
(Component decorations: a vec2 at component 0 and another at component 2) then had nothing matching its second input,
whose value is undefined: wrong colours on the emulated foliage. The vertex shader now declares an output for every
input variable of the fragment shader, with its Location, Component, type and Flat, filled from those components of
the mesh stage's vector at that location (zero where the mesh stage writes none).

(cherry picked from commit c38eb31889314ebfb164ff9dffad5796eba46ed4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:08 +01:00
Tobim6
8b78e64539 Mesh emulation: point meshes too, and a warning for draws from a nonzero workgroup.
The 8 point-list mesh programs of Ocarina 1.1.1 (32 points, position and point size) were left unemulated. Their
indices are single uints and the point size goes to an extra vertex slot, which the generated vertex shader writes to
PointSize; the draw asks for a point list (the pipeline key's topology class follows the draw's primitive for mesh
draws), chosen from the mesh stage's OutputPoints. A mesh draw from a nonzero first workgroup is drawn from 0 as
before, now with a warning in the emulated path too. All 1016 programs convert and pass spirv-val.

(cherry picked from commit 8900aeaffa3264e4cc655ffd487cb2d2f3e3dd17)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:07 +01:00
Tobim6
1534dc570a Mesh emulation: size the task records from the arena, and log what each submission asked for.
The task records were a fixed 4096 per submission (3 KiB each): a dense patch of grass that launches more task
workgroups in one submission lost the rest silently. Their count is now a push constant (NX2NAVI_MESH_EMU_TASKS,
default 16384) and the arena defaults to 256 MiB. The header counts what the stages asked for past the capacities too;
before the counters start over they go to a readback ring, and the perf line reports the most one submission used of
the vertex slots, indices and task records, and the mesh workgroups that did not fit. The first draws the emulation
skips are logged with the reason.

(cherry picked from commit 81cfd91bf468f13e4debf287d080f96637a4c382)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:05 +01:00
Tobim6
aec5b5a840 Emulate mesh shaders with compute on GPUs without VK_EXT_mesh_shader (NX2NAVI_MESH_EMULATION, off by default).
Without the extension every mesh draw was skipped ("mesh draws need VK_EXT_mesh_shader: skipped"): on an RX 580 the
game's grass and foliage were missing. The translator already builds each task and mesh program as compute code that
MeshSpirv.cs wraps into TaskEXT / MeshEXT modules; runtime/mesh_emu_spirv.c turns those modules into GLCompute ones:
outputs and payload move to workgroup memory, SetMeshOutputsEXT's counts are kept, and the entry function's end
reserves vertex slots and indices in an arena with atomics and copies the vertices and triangles out (task: the payload
and the mesh group count go to a task record, and the mesh dispatch to the draw record). A generated vertex shader
reads the vertices back for the game's fragment shader. Checked with spirv-val (Vulkan 1.3) on the 1016 task and mesh
programs of Ocarina of Time 1.1.1: 1008 convert and validate; the 8 point-list meshes stay unemulated.

vk_pipeline.c gives an emulated mesh pipeline a layout whose task and mesh bindings are visible to compute, with push
constants and a compute-side descriptor template, builds the generated vertex shader's graphics pipeline and the two
compute pipelines; vk_exec_draw.c prepares each mesh draw as before, then outside the pass zeroes the arena counters
(first emulated draw of a submission), fills a draw record, pushes the same descriptors to the compute bind point,
dispatches the task and mesh stages (direct, or from the indirect ring entry) and draws DrawIndexedIndirect from the
record. mesh_emulation = 1 turns it on; mesh_emu_mb sizes the arena (160 MiB).

(cherry picked from commit efc43b177694d8f8ce5700fcf28d80e889a45589)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:03 +01:00
Tobim6
f3a9d2967f Profiler: name the exe's addresses from its own symbol table, and sample the replay thread alone.
A NX2NAVI_PROFILE profile needed the link map to name its Rips, and the launcher's builds keep none. A MinGW link keeps
the COFF symbol table in the exe, so prof_sampler_write now reads it (runtime/prof_syms.c, plain file reads) and appends
`sym <address> <function>+<offset>` for every exe address in the Rip and chain lists. NX2NAVI_PROFILE_REPLAY=1 samples
only the replay thread: with NX2NAVI_REPLAY_ASYNC=1 the render thread spends 98% of a 37 ms frame waiting, and the
replay thread (22 ms a frame recording Vulkan commands) is the one to look at.

(cherry picked from commit 9d3126ca780d7f0f0b91468d42b8ee70572747c8)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:00 +01:00
Tobim6
4ba78a7b31 Add NX2NAVI_MIRROR_HOT: pools copied through their VRAM mirror every frame go back to system memory.
On an RX 580 with the scene at 854x480 the render passes take 11 ms of a 32 ms frame. The rest is the mirrors: 66 MiB
of CPU-written pages up and 76 MiB of compute-shader writes back each frame, mostly through six 6-16 MiB pools the game
refills every frame, with the GPU idle 7.8 ms a frame while those copies wait. With mirror_hot = N a mirrored pool whose
uploads, write-backs and merges average N percent of its size (and at least 1 MiB) a frame over 120 frames leaves the
mirror at the start of a submission: it comes off the mirrored list, the device address table points at the imported
buffer again, and the mirror buffer is freed after the next submission. Default 0, off.

(cherry picked from commit 82e5dcb682375fa48bbaffa1d61f825272544e36)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:21:56 +01:00
Tobim6
1bfe90e3e2 Pass times: log the largest viewport each kind of pass draws with.
A dynamic resolution that keeps its targets at the largest size and draws the scene into part of them shows up as a
viewport smaller than the pass; one that resizes its targets shows up in the pass size. NX2NAVI_SCENE_SCALE=33 left
the handheld scene pass at 1440x810, so this tells which of the two the game does there.

(cherry picked from commit af7abe36b0b15c5a63b354d2870543987d1f4b1a)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:21:54 +01:00
Tobim6
496c163d86 Map the "Nyx Joy-Con" USB HID joystick as a gamepad, and log joysticks SDL cannot use.
A Switch can present its Joy-Con over USB from its boot menu's tools as a plain HID joystick, "Nyx Joy-Con" (VID
0x11EC, PID 0xA7E1): X, Y, Z, Rz for the sticks, a hat for the D-pad and twelve buttons. SDL has no gamepad mapping for
it, so it was a joystick only and input.c, which opens gamepads, did not see it ("input: no gamepad"). scan_pads now
gives every known joystick without a mapping one built from its own GUID (buttons 1-4 B, A, Y, X as south, east, west,
north, then L, R, ZL, ZR, Minus, Plus and the stick clicks), and logs any other unmapped joystick once with its name,
ids and GUID.

(cherry picked from commit ed4c68c3e8460e247bab3ad4f3f02e2672868ddf)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:21:52 +01:00
Tobim6
28d8d47eb3 Add NX2NAVI_FLUSH_SKIP_CLEAN: flushed ranges upload only the pages the CPU wrote.
On 0.6.1 the mirror sync already leaves flush ranges of write-watched pools uncopied (0101a87), which covers what this
did; the key stays known and does nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:21:50 +01:00
Tobim6
3b345c5190 Add NX2NAVI_PASS_TIMES: GPU time per render pass and dispatch in the log.
No vendor profiler covers an RX 580 (RGP supports RDNA only) and RenderDoc cannot capture this program, so nothing
showed where 38 ms of GPU time per frame went. With NX2NAVI_PASS_TIMES=1 every pass mark also writes a timestamp at
its two points into a query slot pair of its ring slot. The replay thread takes in the marks whose submission has
finished, resets their slots on the host (hostQueryReset) and sums their time per kind of pass (size, attachment
formats, first fragment or compute shader); every 600 frames the log lists the 15 with the most GPU time per frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:21:49 +01:00
Tobim6
28d7cdbc51 Limit VMA's use of each device-local heap to its budget where the GPU has another one.
An RX 580 (8 GiB, AMD 23.10) shows its memory as a 6 GiB device-local heap and a 2 GiB device-local, host-visible
one, and Windows granted the game 5.1 GiB of the first. A save load put 5.6 GiB of textures, VRAM mirrors and pools
into the first heap while the second held 69 MiB, and the next submit failed with VK_ERROR_OUT_OF_DEVICE_MEMORY;
budget flags on the texture allocations alone did not change that. VMA now gets heap limits (pHeapSizeLimit) when
the device has two or more device-local heaps: each heap's budget at device creation less a tenth (at least 256 MiB)
for memory VMA does not see. Every allocation past a limit goes to the next memory type that allows it.
NX2NAVI_VRAM_HEAP_LIMIT: auto, 0 (off) or MiB for the largest heap. A physical pool that finds no video memory left
takes any memory type it may live in instead of failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:21:47 +01:00
Tobim6
3de5577512 Allocate texture images within the heaps' budgets, moving on to the next heap with room.
An RX 580 (8 GiB, AMD 23.10) shows its memory as a 6 GiB device-local heap and a 2 GiB device-local, host-visible
one. Asked for device-local memory without a budget, VMA chose the first heap every time: a save load put 5.6 GiB
there against a budget of 5.1 GiB while the second heap held 69 MiB, and the next submit failed with
VK_ERROR_OUT_OF_DEVICE_MEMORY. create_tex now allocates with VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT: device-local
memory of any heap first, then any memory type the image allows, and only then past the budget as before. The log
names images placed outside the first device-local heap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:21:45 +01:00
Tobim6
96f82791c8 Submit a large upload batch early, and log every heap after an out-of-memory submit.
A save load made thousands of textures between two replay submissions, and all of them went into one upload batch:
about 1.5 GB of raw ASTC blocks plus the decoder's work in a single submission, which AMD's 23.10 driver on an RX 580
refused with VK_ERROR_OUT_OF_DEVICE_MEMORY ("vk: upload submit failed (-2)"). The outermost vk_upload_end now submits
the open batch once its staging holds NX2NAVI_UPLOAD_BATCH_MB (256 by default; 0 = no limit). The batch still precedes
the replay submission that uses its textures, and its staging goes as it retires.

When a submit fails for lack of memory, vk_mem_oom_report logs each heap's use and budget as the driver counts them,
VMA's blocks and allocations there, the open and in-flight upload batches, the VRAM mirrors and pending releases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:21:43 +01:00
Tobim6
8106fdaafd Keep the movie converter's helper threads instead of starting ten new ones per picture.
run_stripes started NSTRIPES - 1 threads for each of its two phases, about 300 new threads a second while a movie
played. Every DLL in the process sets itself up for each new thread; on an RX 580 with AMD's 23.10 driver the process
commit grew by about 300 MB a second during the title movie until Windows ran out of commit (45.7 GB, FATAL "movie:
out of memory for a 1920x1080 frame"). The helpers now start once and wait for each batch; one caller at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:21:42 +01:00
chrg6
ef3466ce4f Merge main into the 0.9.1 release: the launcher's Mods screen, the anti-aliasing choices beside FSR and DLSS, and the scene's last row and column filled before an upscaler reads it.
The 0.9.1 notes keep the release branch's text and take main's sections: New, the edge line under Fixed, and Changed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 09:00:37 -05:00
chrg6
baad032500 Keep the fast link's waits at 3 ms a pipeline and 6 ms a frame.
The 8 ms and 16 ms tried in their place left fewer draws out in a scripted walk, but in play a frame that takes 10 to 14 ms longer felt worse to the player than one that is left out, in two sessions on the same install. The wait stays counted once for each pipeline, and a frame that has left a draw out already still waits for nothing more.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 08:49:26 -05:00
chrg6
8a61fcacaf Stop waiting for fast links in a frame that has already left a draw out.
Such a frame is held back or shown without that draw whatever its other pipelines do, and with hundreds of pipelines new at once every frame of an area's load spent its whole 16 ms budget on waits that could not complete it: 49 frames over 25 ms in a walk with no pipeline recorded, against 17 with the earlier 3 ms waits. With the rule the same walk has 15, the picture stands still 15 times instead of 50, and 1 frame is shown incomplete instead of 22.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 08:35:47 -05:00
chrg6
9f7c8ae810 Wait 8 ms once for a pipeline met for the first time, and carry the compute variants in the pipeline list.
A draw that met a new pipeline waited 3 ms for its fast link, in every frame, which is just under what the link takes with the stage libraries in the driver's cache: in a first-visit session on a new install 66 of 87 such draws gave up at the end of the wait and their frame was held back. The wait is now 8 ms for each pipeline, counted from its first miss and shared by all its draws, and 16 ms for a frame, so a pipeline the driver has to compile costs one frame the wait and the frames after it nothing.

The pipeline list tool also takes the compute variants a game folder dispatched, which no pipeline record names and which were translated in the middle of play, and reads a list made before as one of its inputs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 08:25:42 -05:00
epicmeme546
2d09c220bf Fill the scene's last column or row from the one next to it after a jitter to the left or up, before DLSS or FSR reads the scene.
With FSR 4 or FSR 3.1 a light line flickered along the bottom and right edges of the picture. The jitter moves the scene's viewport by under half a pixel, which keeps every pixel centre inside it. Yet on an RX 7900 XT, a viewport moved up left the last row undrawn in every scene pass, and one moved left the last column. A frame dump showed the depth's last row at its clear value and the light target's last row holding the fog's colour, which the upscaler blended into the edge. NX2NAVI_DLAA_EDGE_FILL=0 turns the fill off for testing.

Hyrule Field, 3416x1440, present screenshots: the outermost rows averaged 40 against 20 just inside without the fill, and within 1 of the inside with it. The same held with FSR 4.1 Native AA and Quality, FSR 3.1, SMAA and HDR. Jitter off, and no upscaler, gave no line either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 08:23:25 -05:00
epicmeme546
1c654ba0c1 Let the Anti-aliasing row's Game SMAA, Off, FXAA and SMAA run together with FSR 4, FSR 3.1 or DLSS, and show the anti-aliasing in the performance overlay.
Choosing one of them while a temporal upscaler was set turned the upscaler off, and the picture fell back to bilinear scaling. vk_aa.c no longer keeps the game's SMAA while DLSS or FSR runs. The chosen pass replaces the game's composition as without them: in the native modes after the upscaler, and in the scaling modes before it. In the menu, a choice leaves the upscaler and frame generation alone, and the row notes that the upscaler's TAA runs too. Picking DLSS or FSR under Upscaling keeps the Anti-aliasing choice. The TAA entry, listed while no temporal mode is set, now sets FSR 4 Native AA where FSR 4 runs instead of forcing FSR 3.1. The overlay gets an Anti-aliasing line under Upscaling, for example "TAA + SMAA (Ultra)".

Checked on an RX 7900 XT in Hyrule Field with FSR 4.1 Native AA and Quality, and with FSR 3.1. The log has "the game's SMAA replaced by" smaa, off and fxaa while FSR 4.1.2 upscales, and the pictures are right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 08:23:25 -05:00
chrg6
d31c3a1036 Make the water corrections in the runtime, on by default, instead of loading replacement modules from a folder.
The coordinate pair and the absorption guard needed modules made on each PC by tools/projective_recipe.py and a folder named in NX2NAVI_SPV_OVERRIDE, so no player had them. runtime/spirv_water.c makes the recipe's edits on the translation in memory, in the recipe's order: on the NVIDIA profile its three modules are byte for byte the recipe's (RTX 5090, game 1.1.1). vk_pipeline.c keeps the edited modules in a small table, made at first use, and builds a pair from them only when both of its stages were made; a module of another shape is built as it is, with a log line. NX2NAVI_WATER_PROJECTIVE=0 turns the corrections off. tests/water_projective_check.py compares the runtime's edits with the recipe's on made-up modules.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 07:55:57 -05:00
chrg6
56e142169c Merge main into the 0.9.1 release: the launcher's animations stopped behind another window, the uniform snapshot's copy split over the replay workers, and the replay workers' default of three with its measurements.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 07:29:41 -05:00
Sebastian Choperena
ee46a19ede Raise the limit of released textures by the card's video memory budget, from 2048 to 8192 entries (NX2NAVI_TEX_RELEASED_MAX). 2026-11-12 07:13:16 -05:00
TheShinySylveon
0cb2e6f00a Reserve no core for the recording thread by default
On an i9-14900KF (8 performance and 16 efficiency cores, 32 logical processors), with the replay on its own thread,
the core NX2NAVI_RECORDER_CORE=auto reserved (logical processors 14 and 15) left the woken replay thread unscheduled
for about 200 ms roughly once a second while the game stood in Kakariko. During each stall its queue held 40 to 50
items, its lock was free, the wakes had been sent and it used no CPU time, while a game thread waited on a fence of the
work in that queue: 27 frames a minute had a 150 ms or longer frame. With NX2NAVI_RECORDER_CORE=0 the same minute had
none. The default is now 0; auto and 1 still reserve the core, and the log says when none is reserved.
2026-11-12 07:12:41 -05:00
bct8925
6e87c921a1 Start a new DLSS history on a camera cut, and give frame generation the same new start.
vk_dlaa_fg_inputs handed frame generation a reset of 0 every frame, so it was never told of a new history: across an
area load, another scene size or another target it generated frames between two unrelated pictures. It now gets the
reset DLSS ran with on the same frame.

DLSS itself started a new history only for a lost camera, another scene size or another target, not when the camera
jumped. cam_cut takes a move over 5 m, or a turn over 10 degrees together with a move over 0.5 m, per 60 Hz frame
(scaled by the time since the last camera) for a cut, from camera traces of play in the Fire Temple: a median of
0.05 m and 0.08 degrees a frame, area loads of 5 to 180 m in one frame. NX2NAVI_DLAA_CUT=0 turns it off, and each cut
is logged, up to 24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 07:12:16 -05:00
bct8925
20a1410023 Take a pass for DLSS's output only when it has the scene's shape.
Ocarina redraws its 2000x2000 area map into an RGBA8 target of its own on a room change and on the pause menu: one
colour target, no depth, larger than the scene both ways, which was all the output pass had to be. DLSS then wrote
the game's picture into the map (the log's "DLSS feature created at 1280x720 -> 2000x2000"), and the minimap showed
that picture behind its room shapes, a close-up of Navi or of Link from the moment of the room change, until the pause
menu drew the map again. A pass whose width over height is more than 3% from the scene's is not the output; the
first eight are logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 07:12:02 -05:00
bct8925
ca75294126 Let a texture slot follow another texture at its storage only when the two are the same size.
When a slot's own entry was released, slot_resolve took any live entry at the same address, and Ocarina's per-frame
render targets share storage. The half-size ambient occlusion term (640x360 at a 1280x720 scene) followed the bloom
pass's 480x270 target there every frame: the blur that writes the term kept its top-left 480x270, the upsample stretched
that over the screen, and every contact shadow sat 1.33 times further from the top-left corner than its object (doubled
shadows below and right of Link, shadows of terrain out of view). During a hit effect the same slots followed its
1130x86 strip instead, the term read zero over most of the screen, and the right 44% of the scene went black.

Block-compressed formats keep the old rule, as a GPU encoder renders their blocks through a smaller view of the same
storage. The first eight refusals are logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 07:11:46 -05:00
Leyukaka
0d564a21c0 Clear the stand-in images: sampled ones to mid grey, storage ones to zero.
The 1x1 images bound where a slot has no texture were only moved to GENERAL, so their content was undefined. A material that read its roughness map through one could see roughness near 0, and on Kakariko's distant cliffs at night the specular term reached 3392 in single pixels of the scene target, which bloom and the temporal upscaler spread into bright white spots. Sampled stand-ins now read as opaque mid grey (a middling roughness, a flat two-channel normal), storage stand-ins as zero.
2026-11-12 07:11:46 -05:00
epicmeme546
432b4e4b1c Turn the replay workers on by default: three of them record a frame's large draw groups beside the submitting thread.
On an RX 7900 XT with a Ryzen 7 5800X3D, Hyrule Field standing went from 41.2 to 50.4 fps in one batch, and the
pictures matched those with the workers off there and in Kokiri Forest, Kakariko, Goron City, a graveyard house and
Gerudo Valley. replay_workers = 0 in nx2navi.ini turns them off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 07:10:27 -05:00
epicmeme546
7eee4817f9 Split the uniform snapshot's copy over the replay workers at the start of a submission.
The workers have no chunk to record while the snapshot copies the uniform ranges a submission binds (about 700
regions, 0.7 MiB in Hyrule Field), so the replay thread now hands them slices of it through vk_exec_par, a loop the
workers take between groups. Without workers the copy runs on the replay thread as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 07:10:15 -05:00
chrg6
a13af7a8c2 Replace a water pair's vertex module before the vertex output union's additions, keep pairs with dual-source blending original, and log each replacement.
The paired modules were looked up by the hash of the module as built, so a vertex module that had outputs added for its union (which differs from one install to the next) or a fragment module changed for dual-source blending ended the run. The vertex replacement now stands for the translation itself and takes the added outputs as any module does; a pair with dual-source factors is built from its original modules in both stages.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 06:37:04 -05:00
ChurchOfIlias
37e8e6dbda Guard water absorption distance alongside paired coordinates
Add the exact-material nonnegative distance guard and the recorded NVIDIA translation profiles. Keep generated shaders and the private native patcher out of the repository. Document reported cross-vendor testing and the unresolved origin of invalid absorption distance.
2026-11-12 06:34:27 -05:00
ChurchOfIlias
d0d0112c3a Add an opt-in paired projective coordinate correction for water
Carry clip coordinates through perspective interpolation for the identified water shader pair. Keep generated modules private and document the observed results and remaining portability limits.
2026-11-12 06:34:27 -05:00
chrg6
2f39b27fb6 Record the draw replay on three replay workers by default, and start the draft notes after 0.9.0.
replay_workers = 0 records everything on the submitting thread, as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 06:20:05 -05:00
chrg6
6ccd1e224d Build the shared pipeline list before play on every start, and build every listed pipeline at install.
A new install met every pipeline in play: in Hyrule Field one 600-frame stretch of a first visit had 1,769 draws wait 461 ms in all for pipelines, the longest frame 88 ms. The boot now reads seed-pipeline-keys.bin, the release's list, as recorded pipelines after the install's own (keys_open_seed, NX2NAVI_PIPE_SEED, default 1): their pairs go into the vertex output unions and the prewarm builds them as it builds the install's. The preparation builds every listed pipeline (NX2NAVI_PREPARE_PIPELINES now defaults to all), with the unions of the same list, so the first boot of a new install finds them in the caches. The list's mesh pipelines are left out at the boot on a GPU without mesh shaders, as the preparation leaves them out. Nothing of the list goes into pipeline-keys.bin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 06:19:39 -05:00
chrg6
4956ef8365 Let a finalized slot sample its own texture's image while that still holds the texture, not the stand-in.
The game finalizes texture objects on its own thread ahead of the replay, which still draws the frame the game recorded
before that; on the console the memory still holds the texels those draws read. Kakariko moves about 30 of its
textures to new addresses every four or five frames, and each move finalized the old descriptors. The replay's draws
of the frame before then met finalized CPU-written slots, and the stale rule gave them the stand-in even when their
own entry was still there with its content. The village's haze dropped out of a frame a few times a minute, and the
haze sprites that met a stand-in left hard-edged clear patches. A play session in Kakariko logged up to 4,805 stand-in
lookups in 60 frames, 1,826 in the 60 frames around one haze dropout, and 612 in the 60 frames after a run of
patched frames.

Such a slot now resolves to its own entry while that entry was uploaded or drawn by the GPU, and was neither superseded
by another descriptor at its address nor overwritten. The lookup samples the image as it is: it neither takes the
entry back nor reads its storage, so freed storage is still never read (the access violation the stale rule was made
for). NX2NAVI_TEX_STALE_KEPT=0 gives the stand-in again. The perf log's finalize line counts these lookups.

In a replay of a recorded Kakariko walk, most 60-frame windows went from stand-ins to the kept image (up to 328 a
window, stand-ins 0). In play, stand-ins remain in short bursts where the entry was already gone (up to about 2,000 in
60 frames, against the kept image in most windows). The tester still sees flicker that the 640x360 frame recorder
does not catch; that is not settled by this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 05:42:43 -05:00
chrg6
4b87606f32 Keep released textures the game takes back intact for as long as their longest release, not 120 presents.
Once the released entries pass RELEASED_MAX, the sweep dropped an entry that comes back intact as soon as its 120
presents were up. Kakariko releases the ASTC textures of its hazy air and takes them back every few hundred frames, so
about 30 of them went each time, and the frame that needed one again sampled its stand-in while it was made and
uploaded anew. Such an entry now waits out GAP_TIMES the longest it stayed released before a take-back, as an entry
whose content lives only in its image does. NX2NAVI_TEX_KEEP_TAKEN=0 goes back to the old rule, and
NX2NAVI_TEX_RELEASED_MAX (a test) lowers the count from which the sweep starts, so a short run reaches it.

The haze still dropped out with this alone: most of those frames came from finalized slots, which the next commit
deals with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 05:42:42 -05:00
chrg6
c05b2570eb Make the version 0.9.0, and leave the long-wait watch off by default.
The watch's thread takes the kernel lock every two seconds to look at every guest thread; a release does not need it running, and wait_watch_s = 10 turns it on again for a hang report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 05:29:44 -05:00
epicmeme546
eb7072f90a Make NX2NAVI_REPLAY_PIPE the number of groups the submitting thread may have out at once, from 1 to 4.
Hyrule Field, standing, 3 workers: with 1, 2 or 4 groups out the frame rate stayed within one frame per second of
the 50 the mode without pipelining makes, over three batches, though the replay is shorter. A frame there is the
replay and then about 6.6 ms of GPU work after it, which the next frame waits for; the design comment in vk_exec.c
now says so. Sending a part's finished command buffers while later groups record was tried and gained nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 04:39:12 -05:00
epicmeme546
ffa599ef33 Let the submitting thread go on past the replay workers' groups, with up to four groups in flight.
With NX2NAVI_REPLAY_PIPE=1 (off by default) the submitting thread hands a group's chunks to the workers, takes chunks
of it itself until none is left to take, and goes on with the ops after the group in a new command buffer after the
chunks' places in the part (vk_sync_append_later), also into the next group's front pass.
Up to four groups are handed out and not in their part yet; their chunks wait in one queue in the order of the stream.
The submitting thread waits for them only where the order needs it: for room, before a part goes to the GPU, before
copies and texture or buffer clears, where DLAA's run or the contact shadows' hook acts, and where a lookup would make
a texture entry or take back a retired one (the op goes again afterwards, as a chunk's does in turn).

What the chunks read stays as the stream had it while the submitting thread runs ahead: uniform snapshot drops count
from their place in the stream, a chunk reads only the inline uniform updates before its group, the HDR present's
source goes by stream position, the texture pool set syncs under the chunks' lock, each group keeps its own render
conditions, occlusion segments and closed query slots, and the queries after a group's last report go into the next
segment made after it. A group's first chunk runs its pass hooks after the group before began its pass; turns wait
for every earlier chunk, of earlier groups too. Locks the chunks take, the submitting thread takes while it is behind.

Draws keep the sampled-texture descriptors they resolved per draw context and reuse them without the texture lock
while their slot is unchanged; the workers waited for that lock at nearly every draw. Texture lookups that change
nothing no longer wait for their turn. The perf line says where the submitting thread waited, what the chunks took,
and which texture lookups waited; NX2NAVI_GPU_TIMELINE also shows the chunks and the waits.

Off by default because it does not pay yet: in Hyrule Field with 3 workers it shortens the replay (11.5 against 12.1
ms a frame) but not the frame (49.2 against 49.6 fps in the same batch). The GPU gets a group's commands only once its
last chunk is recorded, so the main thread's wait for the GPU after the frame's first submission grew by 0.8 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 04:39:12 -05:00
chrg6
2ac56ecc6f Add NX2NAVI_VRAM_BALLAST_MB, video memory taken for the session, to test a smaller card on a large one.
NX2NAVI_VRAM_BUDGET_MB changes only the number the decisions compare with. The ballast takes that much device-local
memory right after the allocator is made, in dedicated buffers of 256 MiB, and holds it until the allocator goes, so the
driver's own behaviour at its limit (slow allocations, memory moved to system RAM, refusals) shows as on an 8 GB card.

Checked on an RTX 5090: 24000 of 24000 MiB taken and held; through eight reloads of Kakariko the use went past the card
(32,218 MiB at the end) and Kakariko fell from 118-151 fps in the first four rounds to 10-24 fps in the last four. Texture
detail was still chosen as full: the choice reads the driver's budget, which the ballast does not lower.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 03:54:21 -05:00
chrg6
7f7416b38b Log the voices the game holds in the audio renderer every 10 s with NX2NAVI_AUDIO_STATS.
The game's sound engine takes a voice per sound from the renderer's voice count, so sounds that are never let go
would show as a count that climbs from area to area until new sounds are refused. The line gives the voices in use,
those playing, the renderer's voice count and the most a census found so far.

Used to check whether the sound engine leaks voices above 60 fps: through eight reloads of Kakariko the most was 30 of
96 at a 60 fps limit and 31 at 144, and every return to the title brought the count back to 12 at both rates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 03:54:21 -05:00
chrg6
bd32077e54 Sample a flat texture that a shader reads as a 3D one through a one-slice 3D copy instead of a stand-in.
Maxwell samples a texture by its own descriptor, so a 2D texture under a 3D sample gives its texel at (u, v). Vulkan
has no 3D view of a 2D image, and get_view found no view for such a binding: the draw sampled a stand-in. Such a
texture (plain colour, one sample, up to 1024 x 1024 texels) now gets a 3D image of one slice with all of its levels,
made in the upload batch and copied again when the texture was uploaded or drawn into since, or another layer is
asked for (vk_texture.c vk_texture_flat3d_locked). NX2NAVI_TEX_FLAT3D=0 gives the stand-in as before.

Seen in Kakariko: two of the game's 4 x 4 RGBA8 textures are sampled as 3D textures, and each got its copy; the runs
through eight reloads at 60 and 144 fps ended without errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 03:54:21 -05:00
chrg6
7dcfb72b70 Keep the time of day at the game's pace under the real-time step, its fraction carried from frame to frame.
The day's update (main+0x3cdf70) adds trunc(2 x frames per update) game seconds a frame. With the set ostep's step,
the display interval in 60 Hz frames, that sum lost its fraction every frame: 1 a frame from 61 to 119 fps, 0 above
120 (the clock stood still), and at 60 fps a step a little under one frame dropped a second now and then. Its convert
now calls the patch page's +0xf60 (runtime/frame_rate.c frame_rate_day_host), which keeps the fraction per counter and
hands out the whole seconds. NX2NAVI_TRACE=perf logs, every 10 s, the seconds given beside those the cut would have
given.

Measured in Kakariko, 10 s windows: at a 60 fps limit 998 game seconds against 881 from the cut alone; at 144 fps
1,201 against 219 to 972 (the steady 1,200 a 10 s window should have).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 03:54:21 -05:00
chrg6
0c343e04a4 Record the game's time step at every present in the flight recorder: the patch page's step, the time manager's and the game's present count.
frames.tsv gains step_frames, game_step_frames and guest_presents. The game writes its step at its own present, a frame or two before the replay presents that frame, so the present count is there to line the two up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 02:54:32 -05:00
chrg6
7f5906c121 Keep the texture events of the recorded frames in the flight recorder and write them with each dump as events.tsv, before the thumbnails.
Each texture made (with how its content started), uploaded, uploaded again, released, taken back or destroyed is one line with its frame, address, format, size, layers and flags, so a one-frame flicker in the thumbnails can be matched to the textures of that frame. events.tsv is written first: the thumbnails take about five seconds, and a game closed meanwhile kept no frames.tsv.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 02:42:22 -05:00
chrg6
fe1c2d8b3b Give the draw context to the code the replay workers' change did not see: the compute bindings log, the movie stand-in's image count and the anti-aliasing pass's pipeline reset, and look a program's compute stage up directly for its guest hash.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 02:17:19 -05:00