Commit Graph

286 Commits

Author SHA1 Message Date
chrg6
71eb5fbe26 Make an area's textures at once after a load instead of over the first seconds, which showed the ground and walls black.
The texture pool creates 16 entries a refresh and stops after 6 ms a frame, so that textures streaming in do not make
long frames. An area load leaves thousands of slots at once (4,936 loading the test save), and at that rate they came
in over the frames after the load screen: the scene's first frames showed a quarter of the picture as black stand-ins,
for 22 presented frames on a free machine and for about three seconds with the CPU busy.

While a refresh leaves pool_load_backlog slots or more (512; 0 never), the pool is loading: the count limit is off, a
frame's refreshes may take pool_load_ms (50), and frame_hold leaves out the presents of frames drawn meanwhile (up to
2 s), so the picture before the load stays until fewer than 64 slots are left. Measured with the flight recorder's
thumbnails of every present: the 4,847 textures are made in one frame of 345 ms, 30 frames before the scene fades in,
and the black share of the picture goes from the fade straight to its final value. The streaming limits are as before
below the backlog.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 06:55:13 -05:00
chrg6
91a8da9eb3 Keep the previous picture on screen over the first frames after a DLSS or FSR 3.1 mode change, which came out dark or black.
Picking a mode in the settings menu changes the scene's size. The game makes its scene targets again at that size and
they start empty, and the first frames drawn into them are wrong: the first frame of the new size is lit without what
the frame before it left (a dark scene), and two frames later the scene can be black with the interface intact (seen
going to Ultra Performance and to DLAA). Captured over six scripted mode changes with every present saved: bad frames 3
and 5 presents after the change, the same with the lazy write-back on or off and with the frame hold off.

vk_dlaa.c notes a scene of another size within 60 presents of a settings change, and vk_backend.c frame_hold then
leaves out 6 presents from that frame on, once per change and beside the allowance for frames with skipped draws. This
hold also runs with DLSS Frame Generation on (the other one does not): a present left out is a longer gap between two
rendered frames to it, and a dark frame it is given comes out as several generated ones. frame_hold_ms = 0 turns both
off. Checked on a dev build with frame generation at 4x: the hold starts at the first frame of the new size at all six
changes and covers every bad frame of the capture, with no new Streamline error.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 06:05:29 -05:00
chrg6
b6beb72c8d Merge release 0.7.0 into the test line: version 0.7.0 and its notes, and GitHub main d1bebd3 (the previous picture kept on screen for a frame that lacks draws, the game's own VRAM in the overlay).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 05:38:34 -05:00
chrg6
9ecfdf1543 Merge GitHub main into the 0.7.0 release line: frames that lack draws are held back, and the overlay shows the game's own video memory.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 05:37:45 -05:00
chrg6
e473dd8826 Arm a lazily written range only when its mirror holds every CPU write to it, so a fetch no longer copies older mirror bytes over what the CPU wrote.
A fetch copies the mirror over the whole range, not the merge of the bytes the GPU changed that a write-back does. The
completion thread arms a range after its write-back reached guest memory; a CPU write into those pages in between, not
yet carried up by a sync of the mirror, was then overwritten by the mirror's older bytes at the first fetch. In play
that was single frames with another frame's constants: the night lighting missing from the whole scene in Hyrule
Field every 0.1 to 0.4 s, and a black scene in Kakariko, gone with wb_lazy = 0. Now the pages are made inaccessible
first and the back end then checks the CPU-write page generations against the mirror's last sync and the write-watch
bits nobody has read yet; when either shows a write the mirror lacks, the pages are given back and the range arms at a
later write-back. The lazy line counts the arms refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 05:37:14 -05:00
chrg6
69e7c59bcd Merge the cache memory branch: a large compute shader is built ahead only when a run has dispatched it, and the boot releases the shaders of pipelines it does not keep.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 05:24:58 -05:00
chrg6
bd9b48ff04 Keep a fault from releasing a lazily written range unseen while a part is handed over, merge what a part skipped and must write back after all, and leave the lazy write-back off on Linux unless set.
A review found a gap: a part checked what it had skipped at its end, and a fault between that check and the part's
hand-over to the queue fetched without the part's writes while nothing wrote them back afterwards. The replay now
opens a window from the check to the hand-over, per part, and a fault on an armed page waits for it to close (at most
20 ms; the replay thread's own faults and thaws do not wait and are counted). What a part skipped for a range that is
no longer armed goes back through the usual snapshot and merge, taken in that part's prologue, and not as a plain
copy, which would have put the mirror's words over what the CPU had just written there. A part split off earlier
makes the same check before its prologue. wb_lazy_touch is a test that reads armed ranges on purpose.

Dev build, Hyrule Field: 71.1 fps as before; standing, a fight, pause and unpause, and the touch test made 146 to 338
faults each, none inside a window, no fault of its own.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 05:23:43 -05:00
chrg6
314aea08b3 Let the background builder of large compute shaders always keep its pipeline again.
Only a shader a run dispatched reaches that builder now, so its pipeline stays, entered before its cache is merged, as before the usage record existed. The branch that destroyed an unkept pipeline before the merge could no longer be reached; had it been, a dispatch in that window would have found the pipeline in no table and in no cache and compiled it again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 04:58:09 -05:00
chrg6
0f334310ec Write the first-dispatch statistics after the pipeline lock is released, and make the record of dispatched compute shaders safe to write from two threads.
Found by a review of the compute prebuild change:
- cf_log formatted and wrote its log line while holding the pipeline lock shared, on the autosave thread, which runs below normal priority; every dispatch needs that lock. It now copies the numbers and writes after the unlock.
- The record could be written by the autosave thread and by a save at exit at the same time, so the older copy could land on the newer file; and a failed write cleared the changed mark, so nothing tried again. One writer at a time now, the copy is allocated outside the lock a dispatch takes, and a failed write leaves the record marked.
- compute_keep read anything that was neither "all" nor a number as 0, which keeps nothing; it now reads as the default.
- The statistics called a pipeline "read from the pipeline cache file" when the driver said the pipeline cache held it, which is also true of what the same run built into the cache earlier. The lines now say the pipeline cache held it. The probe's skip line names the settings that also lead to it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 04:56:26 -05:00
chrg6
f9f0505ed1 Build a large compute shader ahead only when a run has dispatched it, and release the shaders of pipelines the boot does not keep.
The 2 GiB of device memory a filled cache cost was not the thousands of compute pipelines but twenty of them: the compute shaders of 0.9 to 2.0 million SPIR-V words, the game's tensor-core upscaler programs, which nothing dispatches. A pipeline of one holds about 100 MiB of device memory from the moment it exists, and the driver keeps that memory when the pipeline is destroyed, so keeping only the recently dispatched pipelines did not help: the boot pass still created the twenty from pipeline-cache.bin at every start. Measured with --probe-prewarm on a copy of an installed copy's caches (RTX 5090, NVIDIA 621.01): the pass over all 4,066 compute shaders took the device memory from 386 to 2,398 MiB and the process's commit up by 2.5 GB; the same pass before the twenty were in the cache left the device memory at 386 MiB, and all 4,046 other pipelines kept at once cost 2 MiB.

A compute shader over NX2NAVI_LIB_PREBUILD_BIG is now built ahead, from the caches or by the background builder, only when the usage record says a run dispatched it. None of the twenty is among the 138 shaders eleven runs dispatched. Should the game dispatch one for the first time, that dispatch compiles it once and later boots build it ahead.

The boot also reads the shader of a pipeline it does not keep as a copy and releases it after the build, instead of leaving 3,900 shaders loaded (240 MB of commit); a first dispatch then reads its shader from the disk, 0.04 to 0.10 ms in the probe.

With both, the same pass on the same caches leaves the device memory at 386 MiB and raises the commit by 47 MB; 256 first dispatches after it took 0.13 ms on average, 1.8 ms at most, all read from the cache file. With compute_keep = all, which builds everything as before, the pass ends at 2,528 MiB. Not yet run in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 04:53:00 -05:00
epicmeme546
d1bebd34cd Keep the previous picture on screen instead of showing a frame that lacks draws, and show the game's own VRAM in the overlay.
A draw whose shader or pipeline is still building is left out of its frame, and the frame was shown without it: a black or unlit picture with the interface intact when it was a lighting pass, a light going out, or ground missing for a frame. In a player's session a full-screen draw was skipped after its 50 ms and the frame came out black as a boulder hit.

The frame's present is now left out when draws were skipped (vk_backend.c frame_hold, NX2NAVI_FRAME_HOLD_MS, 120 by default, 0 off). The game runs on, so nothing waits. The hold comes from an allowance that fills again at an eighth of the clock's rate, so a long build or a run of them shows its frames as before and does not freeze the picture; a full-screen draw that would be skipped with the allowance spent waits on instead, 500 ms at most. Not with DLSS Frame Generation.

On a first walk through a village with no pipeline recorded, 21 of the 23 frames with skipped draws were held back; in the Lost Woods, 7 of 8.

The performance overlay: the VRAM line is the card's dedicated memory in use, which counts every program on it: a player read 14.5 GB as the game's while the game held 7.3 GB. The line's third cell now gives what this process holds on the device-local heaps (the driver's budget figure), in place of the GPU clock, which stays where the driver gives no budget.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 04:39:19 -05:00
chrg6
17c13e49ff Copy what shaders write into the game's memory back only when the CPU touches it, which takes Hyrule Field from 51 to 71 fps.
Standing in Hyrule Field the GPU spent 13 ms a frame, of which 2.4 ms were the game's passes and 7 to 9 ms the copy
of 66 MiB of shader-written buffers back into guest memory at the end of every submission, in case the CPU reads
them. The write-back probe found no CPU access to them in 40 s. Now a range goes back once and its pages are made
inaccessible; while they stay so, later writes stay in the mirror. The first CPU access faults, the bytes are fetched
with a GPU copy of their own after everything submitted so far, the pages are given back, and the range is written
back every submission again for a while (1 s, doubling to 32 s while it keeps being touched). Thaws before kernel
reads and writes and before mapping changes release armed ranges the same way, and so does a mirror that goes away.

Dev build, same spot, 80 s each: 51.5 to 71.0 fps median, 1% low 43.5 to 56.3, GPU time 13.1 to 7.5 ms a frame,
fence waits 9.8 to 4.4 ms. In that run the game faulted on armed pages 226 times and 124 fetches took 51 ms in all;
a walk into a fight made 283 faults and 186 fetches, and a test that touches eight armed ranges every 60 frames
(wb_lazy_touch) 480 faults and 364 fetches, none with a fault of its own. wb_lazy = 0 is the old behaviour.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 04:36:46 -05:00
chrg6
1b9016896a Say where the boot's list of compute shaders comes from: mostly the shader preparation, not play.
An installed copy's warm list has 42,344 variants, 42,142 of them from shader-prepared.bin, and its 4,066 compute shaders are what the boot kept pipelines for. The comments and the settings text said the list grew with the play history; a copy with prepared shaders held the 2.3 GiB from its first boot. Comments, docs and the ini text only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit ea984fe05b995c5dad1e0f49c5f44de9ee8f19b2)
2026-11-10 03:34:03 -05:00
chrg6
1567ff8df4 Compile the boot's compute pipelines below normal priority, and raise the thread when a dispatch waits for its shader.
After an update or a driver update every recorded compute pipeline is compiled again in the background: about 140 ms each on an RTX 5090's driver, so minutes of two threads for a long play history. Those compiles ran at normal priority, because a dispatch of a shader being compiled waits for that build and an idle-priority compile under load had held such a frame for seconds. On a CPU with few cores that put two more threads in equal competition with the game's own.

The compile now runs below normal priority, and the dispatch that comes to wait for it raises the thread to normal, as it already does for the background builder of large compute shaders. Not measured in play.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit e2b38ffb22690b1656d22fbc504d000554877e0d)
2026-11-10 03:34:03 -05:00
chrg6
61a13c62b9 Keep only the compute pipelines of recently dispatched shaders from the boot, and build the others into the pipeline cache without keeping them.
The boot prebuild built the pipeline of every compute shader play ever recorded and kept all of them for the process. A pipeline that exists holds driver memory whether or not anything dispatches it: with a history of 4,066 compute shaders they held 2.3 GiB of device memory, and its share of the process's commit, from the title screen on (RTX 5090, NVIDIA 621.01), while a boot into the first village dispatched 95 of them.

The boot now keeps the pipelines of the 512 compute shaders dispatched most recently (compute-used.bin next to pipeline-keys.bin records which run last dispatched each; the setting is compute_keep, with "all" for the earlier behaviour). Every other one is still built at boot, so that the pipeline cache holds it after an update or a driver update, but destroyed at once, and created from the cache at its first dispatch. A dispatch that comes while such a build runs gets that build's pipeline.

Each boot stage now logs the device memory and the process commit it leaves ("mem: boot stage"), and the log says what the first dispatches cost. nx2navi.exe --probe-prewarm runs these stages without the game from the caches next to the executable and times first dispatches of pipelines the boot did not keep: 256 of them took 0.19 ms on average and 3 ms at most, all read from the pipeline cache file, and 372 pipelines built and destroyed at boot left the device memory where it was.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 16a796d623686bca5304eaf1b29981247453a413)
2026-11-10 03:34:03 -05:00
chrg6
9a22bea0f0 Merge the shader headers branch: the runtime keeps its shaders as source and builds the SPIR-V headers when the game is built.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 03:33:21 -05:00
chrg6
fa29f3fea5 Merge the second PR intake pass: anisotropic filtering in the Screen tab, the X3D die choice, the NVIDIA shader cache limit, the NGX core search and other fixes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 03:32:46 -05:00
chrg6
417fbcf5ff Merge the memory report branch: the device address table gives empty blocks back, and textures give way before VRAM mirrors are refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 03:32:30 -05:00
chrg6
2a9efee4c5 Merge GitHub main into the test line: the launcher's customisation, the settings and sound changes, and the warm stage-library cache.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 03:32:30 -05:00
chrg6
18be7383f8 End the Windows process without the libraries' detach calls, so a fault in NVIDIA's NGX detach no longer turns a clean exit into a FATAL.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 03:30:31 -05:00
chrg6
0b4fd482e9 Record what the scripted runs showed about the DLSS release rule, and that the model may matter and not the size.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 03:30:31 -05:00
chrg6
d726a4fcde Release the DLSS features with a larger input before a smaller one is made, so a DLSS mode picked in the menu no longer stripes the pause screen.
The rule that releases the kept features acted only after a feature had been freed. Picking ultra performance in play
made a feature of a third size while the gameplay and pause features stayed, with nothing freed, and the next pause was
striped as before. What the two cases share is a feature made while one with a larger input is alive; one made while a
smaller one is alive has never shown it. Both halves now apply unless dlss_idle_free is 2, and 0 only stops idle
features from being freed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 03:30:31 -05:00
chrg6
25ca858215 Read dlss_idle_free as a number, so its value 2 is reachable, and put its description above the function's own.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 03:30:31 -05:00
chrg6
74d3412736 Release the DLSS features that stayed before one is made after a release, so the pause screen no longer comes out striped.
A pause of 3,600 frames frees the gameplay feature; the unpause makes it again, and the pause screen's feature, which
had stayed, drew alternating bands of rows black or noise at every later pause. A scripted pause, unpause, pause was
striped in each of the 8 runs in which the gameplay feature had been freed and in none of the 12 in which it had not;
setting the kept feature's sizes at each evaluation, tried first, changed nothing. Features made one after the other
with no release in between are fine, so that is now the only way one is made. dlss_idle_free = 0 keeps every feature
instead, 2 is the old behaviour.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 03:30:31 -05:00
chrg6
8e91c95d13 Record what the scripted runs showed about the DLSS release rule, and that the model may matter and not the size.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit bf734de7dcbe20a1a582b82e0b00492af26b3580)
2026-11-10 03:27:31 -05:00
chrg6
1e767363a7 Release the DLSS features with a larger input before a smaller one is made, so a DLSS mode picked in the menu no longer stripes the pause screen.
The rule of 16acd83 acted only after a feature had been freed. Picking ultra performance in play made a feature of a
third size while the gameplay and pause features stayed, with nothing freed, and the next pause was striped as before.
What the two cases share is a feature made while one with a larger input is alive; one made while a smaller one is
alive has never shown it. Both halves now apply unless dlss_idle_free is 2, and 0 only stops idle features from being
freed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 53a2e7818c3bede9f916e8a102dea038142af0c3)
2026-11-10 03:16:22 -05:00
chrg6
b40c4e2a9a End the Windows process without the libraries' detach calls, so a fault in NVIDIA's NGX detach no longer turns a clean exit into a FATAL.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 5e708dcc999ca040ff34bad5a0e92f5a683c33b9)
2026-11-10 03:16:22 -05:00
chrg6
6cd80546f2 Read dlss_idle_free as a number, so its value 2 is reachable, and put its description above the function's own.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit d20d9f593088ed1674a2249beb855762d2b1cbad)
2026-11-10 03:12:29 -05:00
chrg6
1cf947fe4b Release the DLSS features that stayed before one is made after a release, so the pause screen no longer comes out striped.
A pause of 3,600 frames frees the gameplay feature; the unpause makes it again, and the pause screen's feature, which
had stayed, drew alternating bands of rows black or noise at every later pause. A scripted pause, unpause, pause on
0.6.1.22 and 0.6.1.23 was striped in each of the 8 runs in which the gameplay feature had been freed and in none of the
12 in which it had not; setting the kept feature's sizes at each evaluation (the commit reverted before this one)
changed nothing. Features made one after the other with no release in between are fine, so that is now the only way
one is made. dlss_idle_free = 0 keeps every feature instead, 2 is the old behaviour.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 16acd83397d0b59904fd4c0bd96cea8285bc0a6f)
2026-11-10 03:00:33 -05:00
chrg6
25bf3f539d Revert "Give DLSS the sizes of the feature it evaluates at every evaluation, not those of the feature made last."
This reverts commit aa3c34e163c700b4e426eb094e080c157eaac8bf.

(cherry picked from commit d6b2b9e8fff9cfe458fc6fefcb36a10cf9271f10)
2026-11-10 03:00:33 -05:00
chrg6
448be7f6ef Give DLSS the sizes of the feature it evaluates at every evaluation, not those of the feature made last.
The NGX parameter object is one for every scene size, and the sizes and the mode were set in it only when a feature
was made. Once the gameplay feature had been freed unused during a pause of 3,600 frames and made again at the unpause,
the pause screen's feature ran with the gameplay feature's smaller input size at the next pause: every other band of
rows of the picture came out black or noise for as long as the game stayed paused. Reproduced with a scripted pause,
unpause, pause on 0.6.1.22: striped in every run in which the feature had been freed, clean in every run in which it
had not, whatever the texture, write-back, HDR and frame generation settings.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit aa3c34e163c700b4e426eb094e080c157eaac8bf)
2026-11-10 02:42:35 -05:00
chrg6
7bc7f63a7d Let textures give way before VRAM mirrors are refused, and under commit pressure whatever the released list holds.
Three faults a tester's 39 minute session showed (a 24 GB card, 32 GB of memory, a 64 GB commit limit), each still in the code:

A pool gets no VRAM mirror past seven eighths of the budget, and textures only gave way above 90%, so at 88% mirrors of 0.4 MiB were refused and the game ran at 11 to 20 fps while the textures of areas left long before stayed. The default of tex_vram_pressure is now 80. A refused mirror's request for room also stands until the use is down to where the mirror fits, for up to 64 checks, instead of buying the 64 textures of the one check that read it.

While the commit was low, live textures went only once the released entries were down to 256 MiB. Where the game releases and takes back 200 to 300 textures a frame the released entries held 1.4 to 2.0 GiB, none stale, so nothing went at all. Live textures now go as soon as the released entries have no full step of stale ones left; the entries the game takes back stay, as before.

The commit counted as low only by the system's figure, which depends on the page file: 59 GB in use of 64, with this process at 42 GB. tex_proc_commit_mb adds a bound on the process's own commit (default the installed memory, at least 24576 MB; 0 turns it off), with a line in the log when it starts and stops holding.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 02:25:14 -05:00
chrg6
f321697aba Give the device address table's empty blocks back, so pool addresses that climb no longer run it out.
The game's allocator hands out pool addresses that climb through the 64 GiB alias region, and a block of the table, once given to a 16 MiB range, stayed with it for good: after 16 GiB of ranges ever mapped the table logged "out of L2 blocks", and every pool created from then on stayed out of it, so shaders read zeros through pointers into it (foliage, instance and light data) until the game was started again. A block whose last page is unmapped now leaves its range at once and serves another once the GPU is past the submissions that could still read the old entry, as a record does; a range mapped again while its block waits takes that block back. A range that finds no block no longer ends the mapping of the ranges after it, and the log line says how many blocks are in use and waiting.

tests\gpa_check.py builds vk_gpa.c against stand-ins for the allocator, the device and the completion queue and reads the table as a shader does. On the table as it was, its climbing pools read zeros.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 02:25:14 -05:00
chrg6
0cebadcfac Leave the shader preparation modes on every processor the process was given.
The large-cache die's placement is for the game's own threads. --prepare-shaders and --warm-shaders translate and build
on as many processors as they find, so on a two-die processor the placement would have halved them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 02:02:11 -05:00
ordinarybob
662a6e88ee Run the game on the die with the larger L3 cache on processors whose dies differ (AMD's two-die X3D processors).
Windows places a game on the V-Cache die only when it recognizes the exe as a game, and it does not know this one, so the threads were spread over both dies by frequency preference. cache_die = 1 (the default) narrows the process to the logical processors that share the largest L3; it never widens the set the process was given, and does nothing where every L3 has the same size. The recorder's reserved core is then chosen inside that set.

Co-Authored-By: Claude Fable 5.2 <[EMAIL]>
2026-11-10 02:01:35 -05:00
Michael Schienbein
c9942578e1 Keep NVIDIA's shader disk cache beside the exe with a limit that holds the prepared set.
NVIDIA's Linux driver compiles into a disk cache in ~/.cache/nvidia, shared with every program, and a process adds at most
1 GiB to it (__GL_SHADER_DISK_CACHE_SIZE); a start that finds more than that in several files deletes the later ones.
nx2navi.exe --prepare-shaders builds the 42,142 variants of game 1.1.1 in one process, about 1.5 GB: on the default limit it
stored about 30,700 of them, and the first start after the preparation compiled the rest (and the pipelines built from
them) again.

Unless the environment sets them, the game now points __GL_SHADER_DISK_CACHE_PATH at nvidia-cache beside the exe (made
here, the driver only makes GLCache inside it) and __GL_SHADER_DISK_CACHE_SIZE at 8 GiB before its first Vulkan call, as it
does for Mesa's cache. The docs name both.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 01:56:31 -05:00
Michael Schienbein
03cb703e8f Apply anisotropic filtering while the game runs, and add it to the Screen tab.
NX2NAVI_ANISO was read once, when the first sampler was made (vk_texture.c sampler_features), and make_sampler raised the level of the surface textures' samplers as it created them. Samplers are looked up by the game's parameters and live until shutdown, so a new level could only reach them after a restart, and the setting had no row in the menu.

The decision which samplers get the level moves from make_sampler into aniso_raised, and sampler_for puts the raised level into the sampler key, as it does with the DLSS texture bias. vk_sampler_aniso_live reads the setting again after a settings change, at each present beside vk_dlaa_frame's bias; on a new level it clears the slots' samplers and bumps the sampler generation, as vk_sampler_dlss_bias does, so the slots and the descriptor caches take samplers of the new level from the next draw. The old level's samplers stay until shutdown like every sampler. The setting is marked live in cfg.c, and the Screen tab gets a Texture filtering row (Game, 2x, 4x, 8x, 16x) with the description the catalog already had.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 01:56:30 -05:00
ordinarybob
834d9e2d20 Take a submission's write-watch snapshots ahead for the pools the submission at its place in the last frame synced.
The pre-snap of a submission took the pools the submission before it had synced. In Ocarina those are another submission's pools: the frame's first and fourth submissions use no pool and queried the pools of the ones before them, and the submissions after them then queried their own pools one at a time at first use. The pools are now remembered by the submission's place in its frame.

NX2NAVI_PRESNAP_PLACE=0 gives the old choice back and =ab switches it in the B blocks.

Co-Authored-By: Claude Fable 5.2 <[EMAIL]>
2026-11-10 01:55:31 -05:00
DeepDaddyTTV
4fc8bde540 Release unused audio voices by their slot. 2026-11-10 01:55:30 -05:00
Michael Schienbein
f19ed09f1c Find the player on game 1.1.1 so the world clock starts there.
The world clock (frame_step_world_us) starts at the first present that finds the player actor away from the origin,
and --seconds, --shot, NX2NAVI_SHOTS=w..., timed "@ms" script lines and recordings all run on it. player_pos read the
1.2.1 scene slot for every build that is not 1.1.0 or 1.4.3, so on 1.1.1 it never found a player: a --seconds run
never ended, no picture was taken and timed lines never fired.

On 1.1.1 player_pos now reads the Player actor from the slot [main+0x4e371d0] + 0x480, checks that its name pointer
(+0x20) reads "Player" and takes the position at +0x31c. The slot is empty on the title screen and holds the actor from
the first present after the save has loaded. The other builds keep their scene walk, whose name compare is shared.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 01:55:29 -05:00
Michael Schienbein
2a8fd84c50 Let the menu test hook put the cursor on a setting's row.
The menu test hook's shot of the Screen tab shows only its first screenful of rows, so rows further down (Upscaling, Frame generation) could not be pictured without input, and a hidden test window takes none. NX2NAVI_MENU_TEST_SET now accepts FOCUS=<key>, which calls opt_focus_key for that setting's row: the cursor goes to it and the page scrolls it into view when it is next drawn. It does not switch tabs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 01:55:29 -05:00
Michael Schienbein
ab34c302d0 Make the texture sharpness bias follow a DLSS mode picked while the game runs.
A DLSS or FSR 3.1 mode picked in the menu changes the scene size at once (widescreen.c wide_present), but the texture LOD bias that goes with it stayed the one of the mode the game started with. vk_dlaa.c dlss_mode asks res_dlss_lod_bias again at every mode change, and res_dlss_lod_bias took the share from R.dlss_k, which decide() sets once at start; res_dlss_mode would move it, but returns first while res_init has not switched the output and scene patch sets on, which is always the case for Ocarina's build. Switching from Performance to Quality kept the bias of -1.00 where -0.58 belongs, and switching to DLAA kept a negative bias with the scene at full size. R.dlss_k is also 0 when the game started with DLAA off or without the DLSS model file beside the executable (the driver's NGX supplies the model then), so FSR 3.1 turned on later, or DLSS on such a machine, had no bias in any mode.

Without those patch sets res_dlss_lod_bias now takes the share from widescreen.c's wide_dlss_share, the share the scene is drawn at, which follows the mode and the upscaler in use; builds with the sets keep R.dlss_k, which res_dlss_mode moves where their scene can change. vk_sampler_dlss_bias logs each change of the bias, so a mode change can be followed in the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 01:55:28 -05:00
ordinarybob
62f6a7595b Destroy the objects the GPU is done with outside the command lock.
vk_mem_collect destroyed dead images, views and buffers while it held cmd_lock, and the replay's uploads wait for that lock. Destroying an image and its memory takes up to milliseconds. The collect now moves the objects out under the lock and destroys them after releasing it.

Co-Authored-By: Claude Fable 5.2 <[EMAIL]>
2026-11-10 01:55:27 -05:00
ordinarybob
e1276ee80d Drop a movie frame, or have the game retry a sample, when memory runs out, instead of stopping the game.
Co-Authored-By: Claude Fable 5.2 <[EMAIL]>
2026-11-10 01:55:27 -05:00
ordinarybob
c7d8ea489e Find NVIDIA's NGX core beside the driver's Vulkan driver when the registry's NGXCore key has no FullPath, so DLSS and DLAA start there.
Co-Authored-By: Claude Fable 5.2 <[EMAIL]>
2026-11-10 01:55:26 -05:00
DeepDaddyTTV
53ae6c192e Stop scanning shader instructions after descriptor declarations have been read. 2026-11-10 01:55:26 -05:00
chrg6
d15d4e2fbd Keep the runtime's shaders in the repository as source only, and compile them when the game is built.
The fifteen headers of SPIR-V words under runtime/ are no longer tracked. tools/build_shaders.py builds all of them:
the GLSL with glslc, the SPIR-V assembly with spirv-as, and the two shaders assembled in Python from their scripts.
build_game.py builds the missing and the stale ones before it compiles the runtime, and the build kit, the launcher
release and the AppImage build them before they copy runtime/, so a player's PC still needs no shader compiler.
git ignores the headers and check_content.py refuses a compiled shader in a commit. The headers built this way are
byte for byte the ones removed here. vk_mvobj_fs.h is now mvobj_fs_spv.h, named like the others.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 01:53:41 -05:00
epicmeme546
e10ef60fd5 Keep the driver's cache of stage libraries warm, link a missing pipeline instead of skipping its draw, and count the texture cache's waits in time.
The preparation builds every stage library once so the driver's disk cache holds it and a library a draw needs later takes under a millisecond. Turning dynamic vertex input off for AMD's RDNA 3 and newer driver changed the dynamic states every library lists, which gave each one another entry in the driver's cache, and nothing built them again: an update carried the prepared shaders over without the driver step. On an RX 7900 XT (26.10.1) all 42,142 prepared libraries were cold, 93 ms a vertex and 242 ms a fragment library on average. With no pipeline recorded, a walk through a village skipped 11,180 draws while their pipelines built and made 94 draws wait 5.5 s in all, four of them 1.0 to 2.0 s; a player's session log shows up to 114,834 draws skipped in 600 frames and 181 waits of 251 ms on average. Skipped ground and walls appear and disappear, and a skipped lighting pass is a black frame with the interface intact.

- The game checks the driver's cache at every start (vk_pipeline.c lw_start): a sample of the prepared fragment libraries is built, and when their median time says the cache is cold the whole prepared list is built into it again on idle-priority threads while the game runs. shader-warm.txt records a warm in progress, so the next start goes on with one a run ended, and stops the tries on a driver that does not keep the libraries. This also covers a driver update and a cache the driver emptied.
- An update that carries the prepared shaders over runs the game's --warm-shaders (tools/make_game.py warm_driver_cache): 11 s with the libraries there, about 8 minutes with all of them cold on that card.
- A draw whose pipeline is missing waits for its fast link from a budget of 6 ms a presented frame, 3 ms at most each (NX2NAVI_PIPE_LINK_MS), before it is skipped: with warm libraries the link is done within that.
- Full-screen draws wait from their 50 ms budget again instead of being skipped (NX2NAVI_PIPE_SKIP = any is the default; fullscreen stays selectable). With warm libraries the wait is a millisecond.

The same walk afterwards: libraries 0.3 and 0.7 ms on average, 1,605 draws skipped, 1,473 of them in the scene's first 600 frames and 8 to 80 in each 600 after, and 19 waits of 60 ms in all. First visits to four other saves (a mountain pass, the Lost Woods, Kokiri Forest, a river) waited 12 to 84 ms in all except the Lost Woods, where mesh shader pipelines, which have no stage libraries, and vertex libraries that need added outputs still compiled once: 23 waits, 2.1 s in all, the longest 776 ms.

The texture cache counted its waits in presents chosen at 60 a second: at 165 presents a second the 1800 that stood for thirty seconds were 11 s, so a released render target went sooner than meant and a texture out of view for 11 s was retired and showed its stand-in for some frames when it came back. The counts are now taken times the present rate over 60 (presents_for), and a texture is retired after two minutes without a sample instead of thirty seconds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 01:36:29 -05:00
epicmeme546
41eb0e635b Apply the camera's stick sensitivity and the speaker layout during a run.
NX2NAVI_STICK_SENS was served to the game as a multiplied camera pack at start only. A change during the run is now written into the game's memory: the StickSensitivity array as the game holds it, at the factor in effect, is looked for in the guest's heap and every copy is overwritten at the new factor. The game reads the array each time it steps the camera, so the speed follows at once. The copies found are remembered, so a later step of the menu's slider takes no search, and a search runs again a moment after the game opens the pack anew. On Ocarina 1.1.1 the first change of a run found 4 copies in about 2 s on its own thread, and the same stick push for a third of a second turned the camera about 30 degrees at 1, 90 at 3, 10 at 0.3 and 30 again at 1, all in one run.

NX2NAVI_AUDIO_CHANNELS was decided once. A change that gives another channel count now signals the device change events the game holds, as a console does when its output moves: the game asks GetActiveChannelCount again and mixes for the new count, and the mixer makes its SDL stream again with that count at its next render. On Ocarina 1.1.1 the centre input of the device sink went from 0.0006 rms to 0.013 within the 5 s after stereo became 5.1 and back to 0.0006 after stereo was set again, with no underrun. NX2NAVI_TRACE=audio logs the six inputs' levels with its level line.

Both rows lose their "after restart" note. The graphics card, widescreen, the resolution, the game's language, the button prompts and the game's native HDR still take a restart: the game or the Vulkan device reads them once while starting.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 00:21:31 -05:00
chrg6
202fc247d0 Name the gamepad probe probe_gamepad, so it does not clash with ov_probe.c's own static probe_input.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 23:54:29 -05:00