Commit Graph

677 Commits

Author SHA1 Message Date
chrg6
e6392f381f Turn Link's own motion vectors on by default.
DLSS, FSR 3.1 and frame generation get the real motion of Link and his equipment unless selective_motion = 0 is set. Its two status lines come every minute or two instead of every two seconds, now that every session writes them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 14:38:26 -05:00
chrg6
3123d40017 Offer the low-end GPU mode only on the cards it was written for.
On a card with mesh shaders and 8 GiB of video memory or more the Game tab's switch cannot turn the mode on; it stays usable while the mode is on, to turn it off again. A player with every setting at its highest had it on on a GeForce RTX 5090, where the mode moved the sun shadow map and the scene depth to memory of their own and the ground's shadow became a dark patch with straight edges that turned with the camera.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 14:28:36 -05:00
chrg6
26f3dc47ec Show the low-end GPU mode's settings under its switch in the Game tab, and read them only while the mode is on.
The settings had a tab of their own; they are rows of the Game tab now, listed under the switch once the mode is on after a restart, and the tab is gone. With the mode off every one of them reads as unset, whatever nx2navi.ini or the environment says, so nothing of the mode acts unless a player turned it on; the build reads guest_opt the same way. The notes describe that, and take the white edges in towns and the dropped textures from the known issues to the fixes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 13:59:43 -05:00
chrg6
857d22fe4f Apply texture and sampler registrations between submissions, in the order the game made them.
A registration the game made while a submission was being replayed changed the slot table under that submission,
whose texture pool set is written as the replay goes and read when it runs. Such a registration now waits and takes
effect once the submission has gone to the queue; with the replay on its own thread it goes into the replay queue
ahead of the next item. NX2NAVI_REG_ORDER=0 restores the old behaviour. In a town session the white kerb, stair and
wall-top edges of single frames were gone with it; the log counts the registrations that waited.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 13:58:36 -05:00
chrg6
16b0b46155 Keep a released texture that shaders still sample out of the idle drops.
A finalized slot shows its released entry while that holds the texture, and the pool's check passes released entries by, so no lookup reached such an entry and it counted as idle while every frame sampled it. Past the released entries' size cap or count it was dropped, and the slot showed the stand-in until the game registered it again. An entry sampled within the stale time is not idle now, and the count sweep leaves one that was used.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 13:12:58 -05:00
chrg6
e3cf0710c5 Record a draw's own texture binding that got the stand-in, and a sampled pool slot that is not registered.
In towns, kerb, stair and wall-top edges are drawn untextured for one frame when the game registers a round of streamed textures, and no pool entry of those textures goes to the stand-in in such a frame. A binding written into a draw's own set, and a slot that is unregistered when its marks are read, left no event until now.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 13:08:16 -05:00
chrg6
d2fbaba1c3 Put the low-end GPU mode in the settings menu's Game tab, marked experimental.
The row sets low_end_gpu, read at start, and says what the mode turns on and that it was measured on one card; its text is there in the menu's four languages. The key is decided again once the settings file is read.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 13:06:02 -05:00
chrg6
2324a74602 Turn the settings for older graphics cards on with one key, low_end_gpu = 1, and leave them off without it.
Mesh shaders as compute, the texture that gets memory of its own, staged mirror uploads and the shorter wait for the GPU, widened write-watch queries, the video memory limits and reserve, early upload batches, the asynchronous replay, the hot-pool rule and the recording thread on AMD cards without mesh shaders were measured on a Radeon RX 580 and run on no other card. Each keeps what 0.9.1 did unless the key or its own setting says otherwise; the key gives the defaults the way the device profile does. The notes describe them as that option, hold main's two new entries in one Changed section, and list the white edges in towns as a known issue.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 13:00:13 -05:00
chrg6
052c60dc0d Merge remote-tracking branch 'nx2navi/main' into release-0.9.2 2026-11-12 12:56:51 -05:00
epicmeme546
385734dcc0 Sharpen FSR 3.1 more below a render scale of three quarters: its own sharpening towards the maximum, and a second, lighter RCAS pass over its picture.
FSR 3.1 was soft at Performance and Ultra Performance, most of all in motion. On a village save, while the camera turned at a steady rate (present screenshots every 0.4 s, the mean absolute Laplacian of the scene's luminance): FSR 3.1 Native AA 6.7, FSR 4 Performance 5.9 and Ultra Performance 5.4, FSR 3.1 Performance 4.0 and Ultra Performance 3.3. The library's own input checks found nothing wrong, and its tuning constants (velocity factor, accumulation per frame, shading change scale, behind the test switch NX2NAVI_FFX_KEYS) gave nothing or took detail away. Its own sharpening at 100 instead of the default 80 gave 5.0 and 4.1.

Now the share of extra sharpening grows from none at three quarters of the output's width to all of it at half (vk_dlaa_fsr3_boost). FSR 3.1's own sharpness goes that share of the way to its maximum, and its picture gets a second RCAS pass (shaders/dlaa_sharpen.comp, AMD's FSR 1 header with the linear light taken through c / (1 + max c) and back), before the HUD is drawn. Both follow the sharpness slider; 0 turns them off, and NX2NAVI_FSR3_SHARPEN=0 leaves the second pass out. At RCAS's full strength the pass took Performance to 8.2, past Native AA, with grain on every surface, so it runs 1.5 stops weaker: Performance 5.7, Ultra Performance 4.7, Quality 5.2. 63.4 fps against 65.1 without the pass. The HDR picture is clean. FSR 4 is untouched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:50:43 -05:00
epicmeme546
7581bb887d Let the free camera go anywhere, and make ground avoidance a switch that is off unless asked for.
The camera kept its height (only ZR and ZL changed it) and rose whenever the closest surface in the lower part of the view came within about three metres, so flying up to a character, a rock or a wall sent it upwards. It now moves where it looks and nothing stops it, the ground included.

Ground avoidance is a checkbox in the debug menu's free camera section. With it on, the nine view distances read back from the lower view become points of the scene (from the view's angles and the camera's pitch), and only a column whose lowest surface rises by less than about 30 degrees counts as ground: the camera goes no lower than a metre above it. Steeper things, objects and walls, are left alone. The read-back runs only while the switch is on.

Tested on a village save, 4 m/s forward for 5 s and then ZL for 4 s: with avoidance off the camera ended 17.4 m lower, through the floor; with it on it ended 0.7 m lower and held there. Flown at Link with the first version of the ground test, its height did not change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:50:43 -05:00
chrg6
f2b6f39c5f Give a natively run network program this frame's input picture: the RGB9E5 words the post pass stored in the scene target are copied into the RGB9E5 texture the network samples.
The game's scene upscaler samples the post pass's picture through an RGB9E5 texture at the scene target's address. On the console both are one memory; here they are two images, and the RGB9E5 one kept what it held when it was made. With NX2NAVI_NATIVE_TENSOR=1 the network therefore read an old picture or the target's R11G11B10F words as shared-exponent texels, the source of the infinities and noise it wrote. The stand-in already read the target's image for this reason. A network program's output image without storage use is now logged.

Only dispatches of tensor-core programs take the new path, and those run only with NX2NAVI_NATIVE_TENSOR=1, which stays 0 by default. The file compiles without warnings; no game run has checked the picture.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:39:54 -05:00
FIocker
5e71cee08c Record the depth bias again at each pass, as the viewport and scissor are, so a pass into a scaled shadow map never keeps an unscaled slope term.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 12:39:53 -05:00
FIocker
58efccd883 Scale the slope-scaled depth bias with the shadow map scale, so the larger maps keep the bias the game asked for.
The slope term is a bias per unit of depth slope across one pixel of the target. A shadow map made k times larger on
each side (shadow_scale 2 to 4) has 1/k of the slope across each texel, so the game's factor alone gave k times less
bias on sloped surfaces than at the game's own size, which is what shows as acne. vk_exec_draw.c slope_bias
multiplies the factor by the pass's scale for both the direct draws (record_fixed) and the queued mesh draws; the
constant term counts the depth format's smallest steps and keeps its value. Nothing changes at shadow_scale 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 12:39:53 -05:00
chrg6
81e7da91aa Bring --probe-vkmem's texture cases up to the rules the runtime has now.
The probe ended in FAIL on an unchanged tree, so none of its cases after the texture slots ran. Three of its expectations were older than the rule they test; the runtime does what its comments say in each.

A finalized slot of a CPU-written texture shows its own image while that image still holds the texture (stale_kept). The probe expected such a slot to resolve to nothing after its texture's release although another texture object kept the image current. It now expects the image with tex_stale_kept on and nothing with it off, and a case of its own covers the rule: after the finalize the slot shows the same image, bytes written to the storage afterwards do not reach it and nothing is uploaded; registered again, in a later submission, it holds the storage's bytes of then.

A slot follows another descriptor's live texture at its storage only when that texture has the slot's size (follow_size_ok). The probe put a 32x32 texture under a 64x64 slot and expected the slot to follow it. It now checks both: a 64x64 texture of another format is followed, and under a 32x32 one the slot gets an image of its own descriptor.

The texture detail cases and the case of an ASTC decode without scratch memory returned without a check whenever the image was neither RGBA8 nor BC3, which was meant for a device that samples ASTC itself. Since opaque ASTC textures are made as BC1 that held for every image of those cases: the probe printed their line and checked nothing. They read BC1 images now.

The probe passes with the default settings (188 GPU checks; 164 when it last passed), with tex_stale_kept = 0, tex_same_big = 1, pool_presnap_runs = 0, shadow storage, ASTC images as BC3 and as RGBA8, and texture detail reduced and low.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:33:06 -05:00
chrg6
0533b3028e Keep the asynchronous replay, the hot-pool rule and the -O2 game code off unless a player turns them on.
The three change what every card does: the asynchronous replay can show a dark or flickering frame now and then, the hot-pool rule moves pools into system memory on every discrete card, and -O2 makes each rebuild of the game several times longer. Their rows stay in the settings tab. The USB joystick mapping is described by the device's own name, and the tab's introduction says what its settings are for.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:17:55 -05:00
chrg6
a464ffafbc Merge Tobim6's work for older graphics cards: mesh shaders emulated with compute, video memory kept within the heaps' budgets, staged mirror uploads and the submit wait that goes with them.
Conflicts: the settings key lists take both sides; frame generation keeps the camera-cut handling and logs its counters every 600 frames with the cuts among them; the pass-time mark moves into draw_viewport; mo_desc keeps the pose depth and notes the reader.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:14:58 -05:00
chrg6
88b74fc8f2 Merge branch 'claude/pr-intake-6-43af31' into release-0.9.2 2026-11-12 12:10:44 -05:00
FIocker
ac4af77973 Tell FSR 3.1 frame generation of camera cuts, so a generated frame is never blended from two unrelated pictures.
vk_dlaa_fg_inputs hands out DLSS's new history with the frame's depth and motion, and FSR 4's and NVIDIA's frame
generation pass it on, but vk_fg_frame dropped it: FSR 3.1 takes a cut only in the generation callback, which its
swapchain calls later on its own thread. vk_fg_frame now notes each frame id's cut in a small ring
(runtime/vk_fg_reset.h), and generate sets the callback's reset from it. A frame after one that was not prepared (the
menu open, no inputs) counts as a cut too, and so does an id the ring no longer holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 12:09:37 -05:00
Vasilis Manetas
bfa486c2aa Hand every queue submission to the driver's own submit thread on Linux, so RADV's vkQueueSubmit2 leaves the replaying thread.
Mesa's Vulkan drivers keep timeline semaphores as kernel sync objects, and their queues submit on the calling thread unless a submission waits on a value not submitted yet. The replay hands a part of the frame to the queue each time it splits one off (vk_exec.c maybe_split), so every such vkQueueSubmit2, with the command stream's checks and the kernel's ioctl, ran inside the replay, the thread that limits the frame rate on an RX 6800 XT under RADV.

MESA_VK_ENABLE_SUBMIT_THREAD=1 sends every submission to a thread of the queue's own. vk_device.c mesa_submit_thread sets it before any thread can load the driver, unless the environment sets it already. submit_thread in nx2navi.ini (NX2NAVI_SUBMIT_THREAD) is 1 by default on Linux and 0 on Windows; 0 leaves the driver's own choice. On a Mesa driver the log says which one applies.

Kokiri Forest, 0.9.1, RX 6800 XT, Mesa 26.2.6, 3 pairs of 45 s runs of one build with the setting on and off: the replay took 13.9 ms a frame against 15.0, lower in every pair; frames over 25 ms fell from 910 to 406; the frame rate went from 40.0 to 40.8 fps, within the runs' noise.
2026-11-12 12:09:37 -05:00
chrg6
0985e80466 Leave Link's own motion vectors off until they have been played, and take their settings through nx2navi.ini.
The pose motion vectors for Link and his attached equipment were on by default for game 1.1.1 and had not been run in
the game on this version. selective_motion = 1 turns them on. Its settings are listed among the known ones, so
nx2navi.ini takes them without an unknown key line, and the rotation threshold is read through the settings instead
of from the environment alone. nx2navi.ini.example describes the switch.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:09:37 -05:00
automata.
b29cbbe6a6 Add shared pose motion vectors for Link and attached equipment 2026-11-12 12:09:37 -05:00
DeepDaddyTTV
38afed16d5 Record the draws rejected during preparation in a captured frame.
A draw can be left out before it opens a render pass, and the pass list of a frame capture then showed nothing of it.
passes.txt now ends with the rejected draws of the captured frame by mesh or vertex draw and reason, each with the
first program it met, and says so when there were none. A draw left out by NX2NAVI_SKIP_PROG or NX2NAVI_SKIP_SHADERS
is counted under a reason of its own. The frame to capture and its files are set together under the recorder's lock.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:09:37 -05:00
Leonardo Chappuis
d991c04284 Fix a deadlock between the replay workers in vk_exec_pass_end.
vk_exec_pass_end took tfr_lock and then, in vk_texture_gpu_written, the texture lock. A chunk recorded by another
thread can hold the texture lock in the pool sync and end its pass there (a lookup's alias copy through
vk_exec_inline_begin), and then wait for tfr_lock. The two chunks waited for each other and the other chunks spun in
their turns, so loading after Continue never finished with replay_workers = 3. The targets are now marked written
before tfr_lock is taken, which guards only the target history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 12:09:37 -05:00
chrg6
a654d079e1 Keep a released texture's image while a registered slot still names it.
The game finalizes a texture object while another one it initialized at the same storage with the same parameters stays registered in the pool, and the entry the two share is released all the same. Two frames later its image went to the next texture of its parameters and the entry was dropped; the slot then had nothing to show, because the pool makes no entry for storage the CPU cannot read, and kept its stand-in until the game drew into the texture again. Ocarina's 384x384 shadow maps are such textures: a player's recording has four slots of them sampled as stand-ins in the frame after three of their images had gone to other shadow maps, and a house front without its shadow in that frame. The reuse now passes over a released entry that a slot which is not finalized names; tex_reuse_named = 1 restores the old choice.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:09:37 -05:00
chrg6
b93219c394 Make a slot's new texture at once when the slot is showing another one.
Ocarina streams its textures by detail level: while the player moves it registers about 32 pool slots with their next level every four or five frames. A pool refresh made 16 of them and wrote the stand-in into the set for the rest until its next round; the set is read as it is when its submission goes to the queue, so an object whose slot was among the rest could be drawn grey for a frame. A player's recording shows 1,525 such slots in 600 frames, each with its texture made later in the same frame. A slot whose entry in the set is a texture's view when it is looked up now has its texture made by that lookup, beside the count budget and the frame's creation time, 64 of them a present; pool_shown_first = 0 leaves them to the budget. The flight recorder also notes a slot that still had no picture when its submission ended.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:09:37 -05:00
chrg6
76c040d35b Record a pool slot losing its picture in the flight recorder.
When the pool's entry of a slot goes from a texture's view to the stand-in, events.tsv gets a line with the slot and what its own texture was at that moment: finalized, released, superseded, overwritten, uploaded, its storage readable, held out. The set is written with update-after-bind, so every draw of the submission that samples the slot reads the stand-in from then on; the check at the marks' read-back comes a frame later and finds the slot resolved again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:09:37 -05:00
chrg6
67a2146948 Record what an upload read, slot registrations and sampled stand-ins in the flight recorder.
Three more texture events for a dump's events.tsv: after each upload a hash of 64 probes of the storage and how many of them were all zero, so a second upload a frame later tells new bytes from the same ones and a first upload of unfilled storage shows; a slot registered with a CPU-written texture, with what the slot named before; and a slot a shader sampled that has no image of its own and follows none, so its stand-in was on screen. They are for telling why a texture shows wrong for one frame while the game streams textures in.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:09:37 -05:00
chrg6
57a15e288d Count only the making of textures against a frame's texture creation time.
The limit on what a frame's pool refreshes may spend creating textures was charged with the whole refresh, including its check of every entry the pools hold. In Kakariko that check takes 0.8 ms a submission, six submissions a frame, so most of the 6 ms was gone before a texture was made and the frame's later refreshes made none: 87 refreshes in 600 frames, with 1,090 slots left between them. The game moves about thirty textures to new storage every four or five frames there, and the ones a refresh left were on screen as their grey stand-ins for a frame; a player's recording shows three lamp posts turn grey for one frame that way. The limit now counts the time the lookups spend making entries and uploading them the first time.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:09:36 -05:00
chrg6
bd7d140a54 Draw lines as wide as the game sets them.
The game's line width was dropped at the call and every line drawn 1 pixel wide; the game draws two lines a frame at 4.5 pixels into a 144x144 mask. The width is now recorded with the draw state and set as dynamic state for draws of the line topology class, held to the device's range. Only pipelines of that class list the new dynamic state, so the others keep their entries in the pipeline caches and the driver's. line_width = 0 draws every line 1 pixel wide as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 12:09:36 -05:00
FIocker
f0d0fae13b Tell FSR 3.1 frame generation of camera cuts, so a generated frame is never blended from two unrelated pictures.
vk_dlaa_fg_inputs hands out DLSS's new history with the frame's depth and motion, and FSR 4's and NVIDIA's frame
generation pass it on, but vk_fg_frame dropped it: FSR 3.1 takes a cut only in the generation callback, which its
swapchain calls later on its own thread. vk_fg_frame now notes each frame id's cut in a small ring
(runtime/vk_fg_reset.h), and generate sets the callback's reset from it. A frame after one that was not prepared (the
menu open, no inputs) counts as a cut too, and so does an id the ring no longer holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 12:07:19 -05:00
Vasilis Manetas
5fee8d7ab2 Hand every queue submission to the driver's own submit thread on Linux, so RADV's vkQueueSubmit2 leaves the replaying thread.
Mesa's Vulkan drivers keep timeline semaphores as kernel sync objects, and their queues submit on the calling thread unless a submission waits on a value not submitted yet. The replay hands a part of the frame to the queue each time it splits one off (vk_exec.c maybe_split), so every such vkQueueSubmit2, with the command stream's checks and the kernel's ioctl, ran inside the replay, the thread that limits the frame rate on an RX 6800 XT under RADV.

MESA_VK_ENABLE_SUBMIT_THREAD=1 sends every submission to a thread of the queue's own. vk_device.c mesa_submit_thread sets it before any thread can load the driver, unless the environment sets it already. submit_thread in nx2navi.ini (NX2NAVI_SUBMIT_THREAD) is 1 by default on Linux and 0 on Windows; 0 leaves the driver's own choice. On a Mesa driver the log says which one applies.

Kokiri Forest, 0.9.1, RX 6800 XT, Mesa 26.2.6, 3 pairs of 45 s runs of one build with the setting on and off: the replay took 13.9 ms a frame against 15.0, lower in every pair; frames over 25 ms fell from 910 to 406; the frame rate went from 40.0 to 40.8 fps, within the runs' noise.
2026-11-12 12:07:19 -05:00
chrg6
f45273bfe5 Say in the flight recorder's blank-slot events what the slot resolves to, and whether any shader reads the pool as a volume.
Ten slots a frame are noted as having no picture when their submission ends: the 128x72 and 64x36 volumes the game registers under new slot numbers in every frame. The events now tell a slot whose entry cannot be viewed in any kind a shader reads from one whose lookup found nothing.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 11:28:22 -05:00
chrg6
b1e8c1427b Merge branch 'claude/pr-intake-6-43af31' into ra-all-test 2026-11-12 11:23:54 -05:00
chrg6
5f10a0012b Merge remote-tracking branch 'nx2navi/main' into ra-all-test 2026-11-12 11:23:49 -05:00
epicmeme546
322d7c0933 Run DLSS or FSR where the game's own upscaler runs, and fill a jittered pass's edge rows as soon as it ends.
With the HUD hidden the screen showed the scene at its render size instead of the upscaler's picture. The upscaler ran at the pass after the game's own upscaler, taken for the pass the HUD is drawn into. Without a HUD the game draws no such pass: the next one is the frame's last, which encodes the stand-in's scaled scene into the 8-bit output. The upscaler's picture went into that target and the last draw drew over it. A player's save with the HUD off showed blocks of render pixels, a picture jumping by a render pixel between frames, and the undrawn edge row in white, at every FSR mode and at Native AA; every test save until now had the HUD on. vk_dlaa_upscaler now runs the upscaler right after the stand-in of the game's upscaler wrote its output image, and puts the picture there (NX2NAVI_DLAA_AT_UPSCALER=0: as before).

The edge fill moves to the end of each pass that took the jitter (vk_dlaa_pass_end), for the pass's colour targets and depth, in one copy of eight regions per image. Filled only before the upscaler, the undrawn row had already been read by the water, the bloom and the anti-aliasing pass.

On a copy of the player's save (HUD off), FSR 4 Ultra Performance, world slowed to 1/20, present screenshots 0.25 s apart: the picture moves 0.00 to 0.02 px between shots (old placement: a jump of one render pixel in 5 of 20), the change on edges is 1.9 against 16.9, and no shot has the white row (half had it, with HDR on). Native AA, Performance with HDR, and FSR 3.1 are steady and clean as well; the save with the HUD on is unchanged. A run through a stream: 0 of 106 shots with a bright bottom edge (20 of 102). Frame rate 58.3 fps against 58.6.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 11:14:16 -05:00
chrg6
a310940003 Merge branch 'claude/gfx-layer-perf-test' into ra-perf-test 2026-11-12 11:01:54 -05:00
chrg6
277f01375a Keep an overwritten texture that is still used.
A texture another target was drawn over is marked overwritten, dropped 600 presents later, and offered to the image reuse first. Neither asked whether anything still reads it. In a player's recording the entry of a second descriptor at the scene target's address was dropped that way and made again in the same frame from a released entry there, whose bits are the scene in another format: one frame nearly black with its colours exchanged, brightness 17 against 102 around it. An overwritten entry a draw, a read or the pool's marks used within those 600 presents now stays, and the image reuse passes over any released entry used within the last 16; tex_overwritten_used = 0 drops them as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 11:01:44 -05:00
chrg6
dee111f6be Bring --probe-vkmem's texture cases up to the rules the runtime has now.
The probe ended in FAIL on an unchanged tree, so none of its cases after the texture slots ran. Three of its expectations were older than the rule they test; the runtime does what its comments say in each.

A finalized slot of a CPU-written texture shows its own image while that image still holds the texture (stale_kept). The probe expected such a slot to resolve to nothing after its texture's release although another texture object kept the image current. It now expects the image with tex_stale_kept on and nothing with it off, and a case of its own covers the rule: after the finalize the slot shows the same image, bytes written to the storage afterwards do not reach it and nothing is uploaded; registered again, in a later submission, it holds the storage's bytes of then.

A slot follows another descriptor's live texture at its storage only when that texture has the slot's size (follow_size_ok). The probe put a 32x32 texture under a 64x64 slot and expected the slot to follow it. It now checks both: a 64x64 texture of another format is followed, and under a 32x32 one the slot gets an image of its own descriptor.

The texture detail cases and the case of an ASTC decode without scratch memory returned without a check whenever the image was neither RGBA8 nor BC3, which was meant for a device that samples ASTC itself. Since opaque ASTC textures are made as BC1 that held for every image of those cases: the probe printed their line and checked nothing. They read BC1 images now.

The probe passes with the default settings (188 GPU checks; 164 when it last passed), with tex_stale_kept = 0, tex_same_big = 1, pool_presnap_runs = 0, shadow storage, ASTC images as BC3 and as RGBA8, and texture detail reduced and low.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 10:49:54 -05:00
chrg6
a389f2450f Add a switch that compares textures over 64 KiB by content before uploading them again, and hash eight chains at once.
While the player runs through a town the game moves about 32 textures to new storage every four or five frames, back to back in one block, and a frame after their first upload every page of the block shows a write again. A texture up to 64 KiB keeps a hash of its storage and is uploaded again only when its bytes changed: of those, 0 to 4 in a hundred are (9 of 440 in one recording of 600 frames). A larger one has no hash and 75 to 94 in a hundred are uploaded again, whatever the size and format: 3,034 second uploads in those 600 frames beside 4,233 first ones, the ASTC ones decoded and encoded on the GPU a second time. The frames of the second uploads take 0.9 to 2.5 ms longer than frames without uploads, and the frames after them wait 0.3 to 1.3 ms longer for the GPU (six recordings of one player).

tex_same_big = 1 has textures up to 8 MiB keep the hash too. It is off by default: the bytes are read once more at the first upload and once at the comparison, 15 us each for 300 KiB, which together is about what the second upload takes on the submitting thread (27 us), so what it gains is the GPU's work and whatever else a second upload costs its frame, and that is not measured in play. A texture whose comparisons found other bytes twice in a row takes no hash any more, and an area load takes none.

The hash runs eight chains side by side and folds them, 20 GB/s against 7 for the one chain on a Ryzen 7 9850X3D, which the small textures' comparisons get as well. Each step is still a bijection of its chain and of the word it takes.

The pool log's buckets line counts the hashed uploads and the comparisons when there are any. --probe-vkmem has a case that passes with the switch off and on: the same bytes written again, other bytes, and the same bytes after two rewrites in a row.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 10:49:54 -05:00
chrg6
65dacfa7c7 Ask the write watch once per run of regions in the texture pool's check, and pass released entries by.
At every submission that binds the texture pools the replay checks each listed texture for CPU writes, and takes the write-watch snapshot of the 2 MiB regions that have none yet as the list comes to them: one query a region, since the list is in no address order. Standing still that is 5 to 10 queries and the check takes 0.11 ms. While the player runs through Kakariko or Castle Town the game writes about 32 textures into new storage every four or five frames, a region the CPU wrote is not frozen again for 1,800 submissions, and the check asked for 100 to 500 regions one by one, 2.7 times a frame: 0.5 to 1.5 ms a check, about 3 us a query, in five sessions of one player. The regions are now collected for the whole list first and asked in one query per run of adjacent regions. On this machine 400 queries of 2 MiB take 727 us and one query over the same 800 MiB takes 360 us. The same regions are queried and the same pages stamped, all of them before the list is looked at, as each entry's were before its own look; a run across the edge of a watched reservation is left to the queries by range. pool_presnap_runs = 0 asks region by region as before.

A released entry stays in the list until it is destroyed, the check does nothing for it, and the stamp it compares stays as it was at the release, so one whose region took a write later missed the region check at every submission from then on and was fetched only to be passed by: 1,000 to 6,300 entries a check, with up to 8,192 released entries kept. The list now carries the released state, set at the release and cleared at the take-back, and the check passes such an entry by without touching it or asking for its regions.

The pool log's freshness line counts the released entries passed by, and its snapshot queries count the queries either way. --probe-vkmem has a case for the queries by run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 10:49:54 -05:00
chrg6
8946fc0201 Leave Link's own motion vectors off until they have been played, and take their settings through nx2navi.ini.
The pose motion vectors for Link and his attached equipment were on by default for game 1.1.1 and had not been run in
the game on this version. selective_motion = 1 turns them on. Its settings are listed among the known ones, so
nx2navi.ini takes them without an unknown key line, and the rotation threshold is read through the settings instead
of from the environment alone. nx2navi.ini.example describes the switch.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 10:44:12 -05:00
chrg6
0cc247b513 Record the flight recorder's thumbnails at 640x360.
At 320x180 a frame of a 2560x1440 picture kept one texel in eight each way, and a flicker of a small object or of fine shading while the camera stands still did not show in a dump. The ring of 600 thumbnails takes 553 MB of host-visible memory instead of 138 MB while the recorder is on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 10:43:10 -05:00
automata.
b25fba2e55 Add shared pose motion vectors for Link and attached equipment 2026-11-12 10:42:35 -05:00
DeepDaddyTTV
5b7703e08e Record the draws rejected during preparation in a captured frame.
A draw can be left out before it opens a render pass, and the pass list of a frame capture then showed nothing of it.
passes.txt now ends with the rejected draws of the captured frame by mesh or vertex draw and reason, each with the
first program it met, and says so when there were none. A draw left out by NX2NAVI_SKIP_PROG or NX2NAVI_SKIP_SHADERS
is counted under a reason of its own. The frame to capture and its files are set together under the recorder's lock.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 10:40:53 -05:00
chrg6
5ec1008709 Make a newly registered slot's texture at its first lookup too.
The rule for a slot that shows another texture left out the slots that showed nothing when the game registered them: the game takes slots whose texture it finalized some time ago for its next textures and draws with them at once. Past the 16 a refresh makes, such a slot kept its stand-in until the next round. One of them was an effect's texture with a transparent ground, which drawn with the stand-in was a flat grey patch for one frame, at each of two rounds of registrations four frames apart in a player's recording. A slot registered since its last lookup that found a texture now counts with the shown ones, within the same 64 a present.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 10:33:59 -05:00
Leonardo Chappuis
82e093ef93 Fix a deadlock between the replay workers in vk_exec_pass_end.
vk_exec_pass_end took tfr_lock and then, in vk_texture_gpu_written, the texture lock. A chunk recorded by another
thread can hold the texture lock in the pool sync and end its pass there (a lookup's alias copy through
vk_exec_inline_begin), and then wait for tfr_lock. The two chunks waited for each other and the other chunks spun in
their turns, so loading after Continue never finished with replay_workers = 3. The targets are now marked written
before tfr_lock is taken, which guards only the target history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 10:30:14 -05:00
chrg6
a374e778fa Keep a released texture's image while a registered slot still names it.
The game finalizes a texture object while another one it initialized at the same storage with the same parameters stays registered in the pool, and the entry the two share is released all the same. Two frames later its image went to the next texture of its parameters and the entry was dropped; the slot then had nothing to show, because the pool makes no entry for storage the CPU cannot read, and kept its stand-in until the game drew into the texture again. Ocarina's 384x384 shadow maps are such textures: a player's recording has four slots of them sampled as stand-ins in the frame after three of their images had gone to other shadow maps, and a house front without its shadow in that frame. The reuse now passes over a released entry that a slot which is not finalized names; tex_reuse_named = 1 restores the old choice.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 10:25:41 -05:00
Tobim6
83eade69d1 Prewarm: emulated mesh pipelines are built ahead of play
On a GPU without mesh shaders the boot prewarm dropped every recorded mesh pipeline, also with the mesh
emulation, which builds them as a vertex pipeline plus compute stages (pipe_miss: layout_get_emu). Each was
then built at its first draw, 113-830 ms on an RX 580 (22 of the 48 pipelines missed entering Kokiri Forest on
0.9.1), and the draws waiting for it were skipped: frames held back or shown without them. With
NX2NAVI_MESH_EMULATION on they are built by the prewarm like the others.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:24 +01:00
Tobim6
045217bc73 Submit wait: also until the newest earlier submission that reads guest memory itself is done
The wait is for the frame's first submission; with staged mirror uploads it ended at that one's hand-over unless that
one itself read guest memory. The previous frame's submissions that read the grass and moss instances through the
device address table were often still on the GPU, and the game wrote the next frame's instances under them: the flicker
came back with every submit wait ending without the GPU (2220-frame run, RX 580).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:23 +01:00