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)
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)
When a device came or went, SDL's gamepad update first found every device again, 100 ms and more, on the game's
polling thread with the input lock held: a controller disconnecting gave five frames of 120 to 240 ms in a row, with
the game's other pollers queued on the lock. The pad thread now makes SDL's initialisation and every update. A poll
asks for an update and waits at most 2 ms for it; an ordinary one is done in microseconds and the poll reads fresh
state as before, and during a device search the poll goes on with the state it read last. Rumble, the motion samples
and the menu's stick reading skip a beat then instead of waiting.
--probe-input checks it on a virtual gamepad, with an update made to take 300 ms.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Every frame the render thread waited about 5 ms for the GPU after the frame's first submission, with the game
CPU-bound in every area. The wait is there so that the GPU has run that submission's passes before the game
rewrites what they read. But the submission also ends with the write-backs of what its shaders wrote, 60 MiB merged
into guest memory in 3 to 4 ms of GPU time, and the wait covered those too.
The write-backs now go into a part of their own. The part before them signals a second timeline, the executed
timeline, and the first-submission wait waits on that; the write-back part signals the timeline as before, so every
fence the game asks for still covers them, in the same queue order. wb_split = 0 keeps one part and the old wait.
Not measured in the game yet.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A slot lookup's callers stamp what they keep with the generation read before the lookup. A lookup that takes a
released entry back for a slot registered since the release left such a stamp naming the released state, with the
entry as its result. When the game released the entry again the bucket came back to that state and got its
generation back, the stamp matched, and the slot was handed the released entry although it is stale by then: a
re-upload from storage the game may be unmapping. The state such a lookup leaves now loses its remembered
generation, so it gets a new one next time and the stamp never matches again. Found in review.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The first version put a bucket's generation back only when a take-back undid the release just before it. A town run
with it showed half the take-backs going back and the fullest bucket (1,315 slots) still bumped 7,736 times per
3,600 submissions: the game keeps those textures released and takes them back for a moment, so every release was a
new generation and the pool refresh still refilled 5,220 slots per submission.
A bucket's state is now named by its epoch (changes other than a release or a take-back) and the XOR of the uids of
its released entries. A release or a take-back that brings the bucket to a state it was in before gets that state's
generation, whichever way round, and in any order of several entries; a new state gets a new one, never one used.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Above 60 fps players fell off moving platforms. The physics system takes its solver step count for a frame as
trunc(frames per update * 4 + 0.001): 4 at 60 fps and 8 at 30, the rates the game ships with, but 3 from 61 to 80
fps, 2 to 120, 1 to 240 (144 solver steps a second at 144 fps against 240 at 60), and 0 in a frame shorter than a
quarter of a 60 Hz frame. The solver skips its whole solve and sub-integration loop at 0, so such a frame resolves no
contact or friction and moves no rigid body. At a 240 fps limit, which "unlimited" paces at too, that was the frame
after every late one: the pacer keeps its phase, so the next display interval is shorter than the period.
The new patch set osolver rounds the count up, ceil(frames per update * 4 - 0.25): 4 and 8 as before, never fewer
steps a second than at 60 fps, at least 1. physics_steps = 0 gives the game's own count.
The step itself was the mean of the last five display intervals and changed with every frame: intervals of 5 and 30
ms in turn gave steps of 15 and 20 ms in turn, and one 60 ms frame at 200 fps took the step from 5 to 16 ms for five
frames. The game never saw a changing step on the console. The step is now the mean of the last 12 intervals without
the longest and the shortest, is the pacer's period when within 3% of it (at a 60 fps limit exactly one frame, every
frame), and repays the time the game was not given at up to a tenth of the step, so game time still follows the
clock. It is at least 1/480 s. step_steady = 0 gives the mean of five again. With trace = perf the fps lines show the
shortest and longest step and the time owed.
tests/frame_step_check.py drives frame_rate.c with made-up display times and the rest of the runtime stubbed.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Textures went dark for about a second all over the game. Under memory pressure a texture goes when it was released
120 presents ago or not sampled for 1,800, numbers set at 60 presents a second: without a limit the game presents
85 to 240, so that was half a second and 7 to 20 s. The thresholds now scale with the presents per second.
A pause screen, a menu or a fade draws next to nothing through the texture pool, and every texture of the scene
behind it counted as unsampled: eviction by disuse now waits until two mark reads in a row show the scene drawn.
A texture whose stand-in a shader sampled is on screen as that stand-in: it is made at the next refresh even when
the frame's creation time is spent, 32 of them a present, instead of waiting for a frame with time over.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
In a large town the game releases and takes back about 40,000 textures per 3,600 submissions. Each was a bump of
its address bucket, the fullest buckets (1,300 slots over one address) were bumped most, and the texture pool
refresh refilled about 6,000 slots per submission: it used up its 6 ms of a frame in about half the frames there,
which made the game CPU-bound (the GPU idle 10 ms a frame) and delayed new textures.
A take-back of the entry that was released, with no other change at its address since, now puts the bucket's
generation back to its value from before the release, so everything resolved then is current again. A bump takes
the generation after the highest the bucket ever had, so the value in between is never given to another state.
tex_gen_undo = 0 bumps as before. The pool line counts the take-backs that went back.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- The mesh stage's storage table starts 0x90 bytes before the end of the 2 KiB constant bank, and all sixteen slots
were written: 0x6C bytes past a stack buffer on every mesh draw. It holds the nine slots that fit.
- The prebuilt runtime is compiled without AVX, so its preemption stub saved only XMM0-15 while the lifted code of
an AVX2 processor keeps data in the upper YMM halves, which the stub's callees may clear. Both bodies are built
now and the one for the processor is chosen at the start.
- After an FSR 3.1 frame generation error the window's swapchain was still AMD's object but went to the plain Vulkan
calls. Swapchain calls follow whose swapchain it is, and a failure takes it down as a switch in the menu does.
- A movie is paced at its own 60 fps under a lower limit too: at 40 fps it ended 25 s behind its sound.
- A lost device left the wait for an upload spinning for good; it ends the run with the device's report.
- The compute pipeline key had four bytes of padding that were hashed and compared, so a prebuilt pipeline could be
missed and built again.
- A thread's TLS pointer was published before the TLS was allocated, so the slot was always 0.
- A fatal exit puts RivaTuner Statistics Server's profile back, and an ini saved as UTF-16 is read.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
pool_refill notes a slot it could not fill (pool_defer), and once the frame's creation time is spent it skips slots
noted in that frame. A fill did not clear the note. So a slot left and then filled in the same frame was skipped later
in that frame with the filled texture's view still in the set, also after that texture was destroyed: a released
texture dropped past the size limit, or one evicted. A shader sampling the slot would then read freed memory. A left
slot holds the stand-ins (its lookup resolved to nothing), so with the note cleared on a fill, a skipped slot can only
hold those.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8d04e17a954e640a9ff06baedc3e7614dc978798)
Once the frame's creation time is spent, pool_refill skips a slot it left earlier in the frame, and pool_sync_entries
may return before the walk. Such a slot keeps its old view in the current set with nothing in the change log, so the
takes after it do not carry the change into the other sets. vk_pool_takes counted those takes all the same, and at
about six submissions a frame, more than VK_POOL_SETS of them could pass within one frame while a retired texture's slot
was skipped every time. retire_sweep would then free the image while every set still named it. A take now counts only
when its sync left no slot behind (PL.retry clear): after it, every slot change made before it is in that set and in
the log, and the takes after it bring it into the others. A sealed second take inside one submission still goes
uncounted, which only delays the free.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5cd431f792e00ca3b9a03657cd4aab64fc38dae7)
The loading threads feed each chunk they read to the game's stream decoder, which is where most of the
decompression time goes. That call now reaches a host stream that writes straight into the game's output
buffer and keeps the game's state fields and results. A stream is taken from its first chunk or left to
the game; zstd_check = 1 runs both and compares the outputs. --probe-zstd checks the host streams on
frames it makes itself.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Main brought the fixes of eleven pull requests (the texture pool set sealed when an early replay part is submitted, every location reflected in interface arrays, RGB9E5 texels recognised for integer storage views, the upscaler a frame started with kept, GPU pass timestamps without vendor breadcrumbs, the Linux build, window and NGX fixes), render targets released when drawn over at another address, the vertex layout kept in the pipeline on newer AMD drivers, and the upscaler choice read once per evaluation.
Four hunks conflicted and take both sides: pool_sync returns for a sealed set before the per-frame creation budget's clock (vk_exec_draw.c); make_module keeps the test line's early_ok argument and main's module hash (vk_pipeline.c); a texture taken back counts as sampled again and records how long it was away, and the texture line logs the disuse counters and the overwritten render targets (vk_texture.c).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
0.6.1.14 faulted the GPU (a read of an invalid address in a pass) about 30 seconds after its last disuse evictions, and
no path by which an evicted image is still read was found in the code. An evicted texture is now first retired: the
pool refresh gives its slots the stand-in while the image stays whole. It is destroyed only once the texture pool has
taken every set of its ring since and the GPU has finished the submissions recorded until then, so no pool set can
still be bound with its view. A mark on one of its slots or any lookup outside the pool refresh takes it back as it is,
and the perf line counts those, which shows whether the marks miss a real use. tex_disuse = 2 retires and never frees,
so the next fault can be put on the freeing or on the marks and stand-ins.
The registration shortcut also read a slot's cached entry without checking that the resolution was current, so it could
read the record of a destroyed texture; it now checks the slot's generation first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 4c5b2ae2e030ab00a910d8f071c030e610fd78e1)
Per-pass GPU timestamps put the write-back of GPU-written storage buffers at 3.6 to 5.3 ms of GPU time a frame in play, against 1.8 to 2.5 ms for all of the game's own passes and dispatches: about 67 MiB a frame goes from the mirrors back into guest memory, from the same eleven pools all session, in case the CPU or a host path reads it. Nothing said whether anything does.
With wb_probe = 1 the 2 MiB regions that lie wholly inside a range just written back are made inaccessible. The first read or write of such a region faults; the handler gives the region back the protection it had (read-only when frozen, else read-write), notes the address, the instruction and the thread, and the access runs again. The bytes are in guest memory all along, so nothing changes for the game. A log block every perf window gives the regions armed, the probes a read or a write ended, and the first accesses by instruction. Every thaw ends the probe of its region first, which covers file reads into guest memory and mapping changes; a file write from guest memory thaws its buffer while the probe is on; a probed region is not frozen anew.
The platform layer gets a hook for every read or write access fault beside the write-fault hook; it is installed only with the setting. --probe-gfx-abi checks that nothing is armed without it and, run with NX2NAVI_WB_PROBE=1, that reads and writes end a probe and run again, that a frozen region thaws after it and that mem_thaw ends and holds.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
vk_dlaa_frame runs with the game's present and vk_dlaa_pass with the replay, which can be another thread. evaluate read
the choice three times; when the menu's change from FSR 3.1 to a DLSS mode landed between two of the reads, the rest of
the function took DLSS's path with NGX never brought up.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A profile of a play session showed the game's own zstd decoder, lifted from ARM64, taking 16 to 19% of all running CPU time on the loading threads: the patch set that sends decodes to the host's libzstd had sites for 1.4.3 only. recomp/patches-v111.txt now has the three calls of ZSTD_decompressMultiFrame (main+0xeb380) of this build, checked against its main by the generator; a lift with them changes three chunks. ov_zstd.c takes the guest function's address by game version.
The sites have not been through a check run on this build, and 1.4.3 has a caller that relies on the game decoder's own result, so on 1.1.1 the host function passes every call on to the game's decoder unless zstd_native = 1 is set or zstd_check = 1 runs both and logs what differs. The loading threads' stream feed (main+0xf5c80), which decodes most of the data, is not replaced yet.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A replay part handed to the queue early kept reading the bindless pool set while later parts of the same submission wrote new entries into it. That updates descriptors a pending command buffer reads, and on RADV a texture whose memory was mapped after the part was submitted is absent from its page tables. This caused a gfxhub read fault in the 128x128 pass of the first world frame in Kokiri Forest.
Seal the set when a part goes, take another ring set at the next sync that has entries to write, and keep recording the same part while every other set belongs to the submission. Document the descriptor lifetime contract in maxwell.md 4.9.
Fixes#257.
SDL_SyncWindow returns before the compositor moves the fullscreen window to the chosen output, so the check right after it logged the output the window opened on, though the game then ran on the chosen monitor. On Wayland the report now waits until SDL sees the window on the chosen monitor, which it learns from a display, scale or mode change (Hyprland 0.56 sends only the latter two).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Linux the window ignored NX2NAVI_MONITOR (the log said it had no effect) and --list-monitors only printed that monitor selection is Win32-only. The SDL window now picks a monitor with the same rules as the Win32 one: auto (the system places it), primary, a 1-based index in listing order, or part of the monitor's name, ignoring case, the first match in list order winning. The monitors are SDL's displays; --list-monitors prints their index, name (the make and model, with the connector on Wayland and X11), pixel size and position, primary flag and display scale, then what NX2NAVI_MONITOR would pick, and the log says the same when the window opens.
The window is created centred on the chosen monitor and centred again at its final size, and that position also names the display the fullscreen setting covers, which is how a Wayland window, which a client cannot move, opens fullscreen on the chosen output. On Wayland a windowed window opens where the compositor puts it; the log says so once. With a chosen monitor, the size widescreen.c reads for fullscreen before the window exists is that monitor's.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
On 1.1.1 the SDK's nn::oe::InitializeApplet calls SetFocusHandlingMode itself, before DT_INIT, so the first call reached the boot checkpoint from sdk+0x598840 and --boot and --seconds stopped with a FATAL before the game started. Only a call from main is the checkpoint now. 1.1.1 also gets its own return addresses (nnMain's SetFocusHandlingMode at main+0x1202d44, the first nvnBootstrapLoader at main+0x346bf8c, read from x30 in the two host functions during a normal start) and its init_array counts, so a 1.1.1 run is no longer checked against the 1.2.1 values.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vk_dlaa_frame decides at each present whether DLAA runs, with FSR 3.1 when NX2NAVI_TAA is fsr3 and NGX is not up. evaluate read NX2NAVI_TAA again. Choosing a DLSS mode in the menu sets it to dlss, which only takes effect after a restart when the run started with FSR 3.1; when that happened between the two reads, evaluate took DLSS's path and called N.alloc_params, which is null without NGX (issue #325). The choice is now kept from vk_dlaa_frame (fsr_frame), and evaluate returns when neither upscaler can run, until the next present turns DLAA off.
Generation is switched off for every menu, cutscene and frame without depth and motion, and on again after it. Off freed the generator's resources and on allocated them again inside the present, which holds the queue lock for its whole flip, so the submitting thread waited there: four of five slow frames profiled in a session with frame generation on had the log line "frame generation on" right before them and nothing else blocked. nx2navi_dlssg.dll now sets Streamline's retain flag, so off only suspends; whether frame generation runs is fixed for the run, and Streamline frees the resources at shutdown. The DLL has to be rebuilt (tools/build_dlssg.py).
The wait for the queue lock in vk_sync.c queue_submit is counted as a present wait, so a frame held up by a slow present no longer shows in the slow-frame line with every blocked time at zero.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 94a0da9f7694cfe4d65777f9efe8eff837ba2bc8)
From the replay review of a profiled session:
- vk_rec.c: the producer set the wake event for every packet until the recorder had cleared its sleeping flag, a system call per packet on the submit thread for as long as the recorder took to wake; it now takes the flag back itself and sets the event once. A sleep that ended with nothing new was followed by another 4096-pause spin, every 2 ms for as long as the game was idle or paused; the recorder now sleeps again at once. head, tail and the producer's words are on cache lines of their own, and the producer reads tail only when the ring looks full by the value it last saw.
- vk_exec_draw.c c0_info: a vertex or fragment bank depends on the storage slots and the base instance alone, so those are compared directly instead of clearing, filling and comparing a 1.8 KiB record on every draw.
- vk_exec_draw.c bind_vertex_buffers: a draw that changes no vertex stream returns before the 17 streams are rebuilt and compared.
- vk_exec_draw.c bind_resources: the texture lock is taken at the first texture descriptor that has to be resolved, not for every texture binding whose descriptors are all kept.
- vk_usnap.c vk_usnap_find: the region the last lookup hit is tried before the binary search.
None of this changes what is recorded.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 8eac567e2a9a353f894f3c66e3fc20fd2c0d295d)
Found by profiling a play session and reading the kernel and the command recording:
- nvn_api_cmd.c: a released recording copy had its pins uncounted (a walk over every op) and was freed while copy_lock was held exclusively; the main-loop thread waited for that lock 2.8% of its time. The copies are now chained under the lock and freed after it. The walks over a recording's records test a mask of the five op kinds that name pins before calling op_pins.
- kernel.c: SleepThread(0) took the kernel lock and computed the caller's inherited priority, a scan over every blocked thread, also when no thread waited for a core, which is nearly always. It now yields at once then. A wait without a timeout no longer reads the clock.
- nvn_api_obj.c sleep_until: the wait for a paced frame's slot slept coarsely and left the last 1 to 2 ms to a yield loop; the high-resolution wait now takes all but its own margin.
- input.c: the keyboard scan (a system call per key) is reused for reads within a millisecond.
- nvn_api_core.c: the read-lock observer's commit-point address is 1.2.1's and is now only compared there.
- kernel_probe.c: the probe expected three virtual cores and wait type 3 to be refused; the kernel has six cores and implements the 64-bit wait. It now checks both as they are, counts a core number past the cores as a clash without unbalancing core 0, and --probe-kernel passes again.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit a3dbd63878d7d6de096ceb4c25988192b4bce738)
The translator's mesh shaders are SPIR-V 1.4, and the marks took only 1.3, so the first mesh shader that indexed the
pool turned eviction by disuse off for the whole run. From 1.4 on an entry point lists every global variable it uses,
so each entry point now gets the marks variable too. Over the 44,255 shaders of a test install's cache, 4,728 are
marked, none is refused, and every marked one passes spirv-val for Vulkan 1.3; 11 of them are 1.4 mesh shaders. The
log names up to eight refused modules by stage, SPIR-V version, size, hash and reason.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit af50808a1cb56f450f99938c9d420e1f5deb333b)
A session with per-pass GPU timestamps showed the game's own render passes and compute dispatches at 1.6 to 2.3 ms of GPU time a frame while the perf line's GPU time was 7.7 to 13.5 ms: most of the frame's GPU time is in commands the replay records between the marks, and nothing said which.
The timed frames now also get a timestamp at the start and the end of each part of a submission, and every stretch between two marks (or a mark and the part's edge) is a gap. The replay names the kind of commands it records in a gap: buffer and texture copies, fills and clears, the temporal upscaler, write-back merges and copies, depth twin copies, the texture pool marks, the mesh draw counts and block-compressed target copies, each with a size where it has one. The report adds the gaps' time per frame summed by the kinds noted in them (a gap nobody noted holds barriers and state only), the parts' own time for comparison with the perf line, and each kind's count and size per frame. Nothing runs outside the timed frames.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
AMD's driver for RDNA 3 and newer compiles a pipeline that has dynamic vertex input again at every boot: neither pipeline-cache.bin nor the driver's own disk cache gives it back. On an RX 7900 XT (26.10.1) a player's key file of 3,979 records used the whole 20 s boot budget at every boot. Dynamic vertex input is now off by default on that driver (vk_caps.amd_llpc); with the vertex layout in the pipeline the third boot of that file built 4,273 pipelines in 0.9 s, all from the file. NX2NAVI_VK_DYN_VERTEX=1 turns it back on. The RDNA 1 and 2 driver branch is not measured and keeps it.
The background builder of large compute shaders now compiles into a pipeline cache of its own and merges it into the main one when the build is done. A create into the main cache holds the cache's lock for its whole length and the cache is only saved while nobody holds it, so a build of minutes kept pipeline-cache.bin from being written at all: on the same card one compute shader of 4,874,502 SPIR-V words was still compiling 590 s after the boot, and nothing built in that session reached the file.
NX2NAVI_PIPE_FEEDBACK=2 also logs every graphics pipeline build with hashes of its modules and its fixed state, which is how the recompiles were found.
Co-Authored-By: Claude <noreply@anthropic.com>
Ocarina lays its per-frame render targets out anew every frame in one GPU-only pool. When an early target changes its size, every target after it moves, and each move made a new entry with an image of its own while the old entry stayed live for as long as a pool descriptor named it. After 6,000 frames of walking through Kakariko Village 1,043 such entries held 6.1 GiB of device memory against 233 MiB in the targets still drawn. On a driver that charges device memory to the system commit this kept the commit low, and the idle textures of the area were evicted and uploaded again while walking.
A GPU write in the GPU-only window now marks the entries at other addresses whose storage it runs over as overwritten and releases them. Their images go to the next texture made with the same parameters, or away after 600 presents. On the same walk the process's private memory ends at 23.2 GB instead of 29.3 GB and device memory in use at 8.5 GiB.
A released render target whose content exists only in its image is no longer dropped after 120 presents under commit pressure: the game went on sampling such targets and took them back empty, which drew the scene black for one frame every two to three seconds. Such an entry now waits 1,800 presents, or eight times the longest it stayed released before the game took it back, and none goes while lookups still reach it.
Co-Authored-By: Claude <noreply@anthropic.com>
VMA's blocks on large heaps are 64 MiB instead of 256 (vma_block_mb): one session held 2.1 GiB free inside the
device blocks beside 8.2 GiB of allocations after a few area changes, and the driver counts a block whole until it
empties. The headroom thread keeps its spare block only for the device-local types textures and mirrors grow in; the
spare blocks it made for the host types and the PCIe BAR type at boot stayed empty for the whole run. The ASTC
decoder's scratch is 32 MiB, so it stays inside a block, and an area load that makes one per upload batch holds half
as much at once. A DLSS feature no frame used for 3600 evaluations is freed with its work images, and a model change
now frees all five sizes.
The perf log gets a "vram by use" line (textures, released textures, mirrors, physical pools, ASTC scratch, headroom
spare, free space inside the blocks, memory outside VMA and DLSS's own share), the free ranges per memory type, the
addresses whose duplicate texture entries hold the most, and a line when memory outside VMA moves by 256 MiB.
astc_bc_probe in nx2navi.ini turns on the ASTC opacity probe.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 99cfc2fa14ae208b7b23e057ff9b87986cd6a5e0)
The pool refresh runs before every draw that binds the pools, so its count budget of 16 creations held per draw, not
per submission. An area load in the 0.6.1.12 test made 4,925 entries (1.7 GB of uploads) in one 430 ms frame, and
2,018 in a 195 ms one. While slots were left over, every draw walked the whole table and looked each of them up again,
about 100 ms of the 430 ms frame in key hashing alone.
Once a frame's refreshes have taken pool_create_ms (default 6 ms; 0: no limit), they create nothing more until the next
frame, and skip the slots left earlier in the frame. The first refresh of each frame keeps its count budget. The slots
left keep their stand-in for a few frames during a large load.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This brings in the test branch up to the shader reads, not the texture eviction by disuse still in progress there:
- black frames: a released or taken-back texture keeps its content, and a new texture over a live one of another size gets the region both cover;
- the menu font atlas uploaded through the runtime's checked upload batch;
- the game held to 240 frames a second, which stops the quick menu's crash;
- the FSR 3.1 contexts evicted instead of turning FSR off after a few render scales;
- AMD frame generation kept off while NVIDIA's holds the device;
- less device memory held that only costs the system's commit;
- shaders read from the disk cache off the render thread past a small budget;
- the exit code 70 text;
- pull requests #260, #261, #270 and #271.
The tool lists in make_kit.py and make_launcher.py and the setting names in cfg.c take both sides: romfs_check.py and pack_shader_cache.py, FOG_CULL, SCENE_SHARE and GPA_TWIN_MAX_KB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The texture pool refresh looks up every registered slot, so the textures of every area the game keeps loaded never
counted as idle and their memory only grew. Marked shaders now store into a buffer with one word per pool slot. Every
four submissions that recorded work, the replay copies it out and clears it, and the texture side notes when each
texture was last sampled. Under VRAM pressure or low commit, once idle textures are gone, live textures that come back
intact and were not sampled for 1800 presents go too. Their keys are held, so the pool refresh keeps the stand-in until
a shader samples that slot again, and the next refresh makes the texture again.
Fragment shaders that neither discard nor write depth, sample mask, stencil reference or memory keep early depth tests
(EarlyFragmentTests), so the marks do not take away early depth rejection. Alpha to coverage leaves the dynamic state
while marks are on, so each pipeline knows whether early tests are safe. Disuse eviction waits until every module that
indexes the pool was marked and two reads arrived. NX2NAVI_TEX_DISUSE=0 (tex_disuse = 0) turns it off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1a4c896150a748f9275c3024e96af3055db94af4)
vk_pipeline.c spirv_pool_mark gives each module that indexes the texture pool a storage buffer at set 2, binding
VK_POOL_MARK_BINDING, and a store of 1 into the slot after every access chain into a pool texture array; modules that
cannot be marked are counted in vk_pool_marks_missed. NX2NAVI_SPV_MARK_TEST=<list> runs the rewrite over files for
spirv-val under --selftest. Still to do: the marks buffer and its read-back (vk_exec_draw.c), the pool lookup context,
the holds and the eviction by disuse (vk_texture.c).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 7ae86070f166d935a9949e95dae7a95e2cf3272b)
A profiled traversal session had 9 of its 16 worst hitches (100 to 500 ms) inside the render thread's shader lookup,
reading <key>.res.json and <key>.spv of shaders met for the first time: opening a loose file costs about 3 ms the first
time on Windows. get_async_one now reads in place while those reads stay within 1/8 of the wall time (2 ms at once);
past that three loader threads read them and the draws wait as for a translation. The perf line counts both.
The launcher's updates carry the shaders over and never packed the cache, which held 44,000 loose translations in the
test install. An update now packs it once it holds 1,000 loose ones, and the pack tool reads the loose files on 16
threads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A file its loader cannot use is opened again and again until the game does without it, and what needs it stays out of the world. The log now names such a file after 24 opens in a row, which tells a player's report of missing geometry apart from a rendering bug. It is one count and one timestamp per file, touched only when a file is opened.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>