Commit Graph

1131 Commits

Author SHA1 Message Date
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
Tobim6
922e364f50 Staged mirror uploads: device address table readers noted at every bind
gpl noted them in ssbo_info, which the bind skip and the kept descriptors leave out once they have warmed up: the
submissions were taken as reading no guest memory again, and the grass and moss flickered again after a minute of play
(every submit wait of a 2100-frame run ended without the GPU). gpa_reader looks once per pipeline for a table binding
and notes the submission at each bind_resources and mo_desc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:21 +01:00
Tobim6
f23f413202 Staged mirror uploads: a submission that reads through the device address table waits for the GPU
The table names pools without a mirror, guest memory the GPU reads as it runs, and nothing marked such a submission
live: with NX2NAVI_MIRROR_STAGE the submit wait ended once the replay had submitted, and the game wrote the next frame's
foliage instances while the GPU still drew from them (small grass and moss flickering and sliding as the camera turned).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:20 +01:00
Tobim6
ccd7fb14c2 mirror_hot: only pools the CPU does not write go back to system memory
A pool read in place gives the GPU the game's bytes as they are when it reads them. The demoted pools were ones the
CPU refills every frame, which the game rewrote for the next frame while the replay and the GPU still drew the last:
small grass and moss flickered and slid over the ground, and with 0.8.0's mesh fallback every mesh flashed. Pools with
more than 64 KiB of CPU writes a frame (written pages and flushes) now stay mirrored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:18 +01:00
Tobim6
39db2ae2a1 Video memory: every VMA allocation by the heaps' live budgets, with room kept for FidelityFX
The heap limits were fixed at device creation, and only texture images looked at the budget. FidelityFX allocates
outside VMA (FSR 3.1 contexts, frame generation): 882 MiB of it with 4644 MiB of VMA's filled the 5526 MiB budget of
heap 0 while heap 2 had 1757 MiB free, and an upload submit failed with VK_ERROR_OUT_OF_DEVICE_MEMORY. vmaCreateImage,
vmaCreateBuffer and vmaAllocateMemory now go through vk_vma_budget.c, which leaves out a device-local heap whose
driver-reported use is within NX2NAVI_VRAM_RESERVE_MB (default 512) of its budget; a Lama patches row sets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:16 +01:00
Tobim6
81cdd67086 Frame generation: the HUD-less picture also where the upscaler's output is smaller than the presented picture
In handheld mode the scene is 75% of the picture (1440x810 in 1920x1080) and the game's last passes scale it up with
the HUD. hudless_record took the upscaler's output only at the presented picture's size: no HUD-less picture, and no
frame generated (5 of 3600 on an RX 580). The crop is now scaled to the smaller picture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:15 +01:00
Tobim6
046c2f6812 Frame generation: its counters every 600 frames, whether the frame generates or not
The line was logged only from a generating frame (the second, then every 3600th): a run whose frames never generated
said nothing about why.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:13 +01:00
Tobim6
293731d083 Frame generation: present and acquire queues from another family where the graphics family has one queue
AMD's Windows driver gives the graphics family a single queue. vk_device.c then made no frame generation queues, and
vk_fg_create_swapchain returned without a log line: AMD FSR 3.1 frame generation set in the menu did nothing on an
RX 580. The present queue (which nothing else may submit to) and the image acquire queue now come from a family that
can present, compute families first, with their families passed to AMD's swapchain; the log names them, or says that
there are none, and the menu offers FSR 3.1 frame generation only where they exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:12 +01:00
Tobim6
4027229930 Mesh emulation: its compute pipelines are built outside the lock, and looked up without one
A draw of an emulated mesh pipeline looked its entry up under the lock the build held across the driver's compile of
both stages: on a first run every such draw waited for whatever entry was being built, 2.5 s of the replay thread in
Kokiri Forest on an RX 580. Entries are now published complete at the head of one of 256 buckets and read without a lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:10 +01:00
Tobim6
15744c688a Texture pool refresh: the slots a refresh left are kept in a list, and the next refresh of the submission looks up those and the changed slots instead of walking the whole table again.
While an area loads, every refresh left slots, and with any left the next one walked the table: about 67,000 slot reads
and 1.65 ms of the replay per submission in Kokiri Forest on an RX 580, six submissions a frame (profile 2026-11-11:
pool_fill and the slot lookups under the first pool draws, mesh_emu_draw's among them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:09 +01:00
Tobim6
aa1045d411 GPU passes: result points, where in the waited-for submissions the results the game's wait needs are done on the GPU, and how much earlier the wait could end.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:07 +01:00
Tobim6
306de50589 NX2NAVI_FOLIAGE (full, reduced, off): reduced skips the indirect mesh draws with a task stage (small grass and moss), off every indirect mesh draw (all foliage); a Lama patches row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:05 +01:00
Tobim6
4718997313 NX2NAVI_SUBMIT_FINISH_KINDS: a settings row (default 31) and a Lama patches row, all result kinds or all but events.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:04 +01:00
Tobim6
ff1c1ed87a Mesh emulation: the stages of a pass's emulated draws recorded by stage, with one barrier between stages for all of them.
Each draw's indices are now a range of its own and its task records too, reserved by an allocation shader (one
invocation, mesh_emu_alloc_spirv) for the run of draw records queued: before the task stages the task records and the
index ranges of draws without a task stage, after them the index ranges of the others (mesh workgroups with output,
which the task stage now counts in the record, times OutputPrimitives x vertices per primitive). The mesh stage takes
its indices from the draw's range with an atomic in its record; vertex slots stay the arena's, as the indices name
them. So no draw's stages need another's, and the queue (MEQ) records the fills as the draws come, then at the
pre-pass command buffer's end (vk_sync.c pre_end -> vk_exec_mesh_flush): allocation, every task stage, allocation,
every mesh stage, a barrier between each. One by one each draw took three barriers and copied the arena's counters
after the draw before it: an RX 580 spent 5.5 ms of a frame's GPU time on 69 draws' stages in Kokiri Forest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:02 +01:00
Tobim6
f35e8d1eb2 Recorder thread on for AMD GPUs without mesh shaders (GCN, RDNA 1): the reported device losses were all on RDNA 2-4; an RX 580 ran clean with NX2NAVI_REC_CHECK.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:23:00 +01:00
Tobim6
7041b2fb6a NX2NAVI_SVC_WAITS: read only when set; unset, cfg_bool ended the game (the key has no settings row).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:59 +01:00
Tobim6
0b4fdac38d Defaults from the RX 580 runs: asynchronous replay, mesh emulation, mirror_hot 25, freeze_idle 1200, native zstd, game code at -O2; freeze and zstd and replay rows in the Lama patches tab.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:57 +01:00
Tobim6
8e5d555fbd NX2NAVI_SVC_WAITS: the guest main thread's time per kernel service and guest call chain, every 10 s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:56 +01:00
Tobim6
0383c392e8 Thaws give back the runs their freeze recorded, and page calls take turns with the write-watch queries (vm_lock): a thaw waited about 16 ms per page call behind the queries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:54 +01:00
Tobim6
e6ca9bc129 Texture write-watch checks: a query widens to up to 8 regions on each side inside the texture's pool (NX2NAVI_SNAP_WIDEN).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:53 +01:00
Tobim6
06be129b66 Submit wait: NX2NAVI_SUBMIT_FINISH_KINDS is read as a number.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:51 +01:00
Tobim6
651073e4db Submit wait: result kinds per submission, which ones the wait counts (NX2NAVI_SUBMIT_FINISH_KINDS) and which the waited submission had.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:50 +01:00
Tobim6
d25c3a59d7 Submit wait: also until the newest submission up to it that hands the CPU results at its completion (events, counter reports, write-backs).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:48 +01:00
Tobim6
ad288e3bc1 Staged mirror uploads: the replay copies guest bytes for the VRAM mirrors while it records, and the first-submission wait ends once the replay has submitted; 8 texture pool sets.
On 0.9.1 this is the release's own mirror capture (NX2NAVI_MIRROR_CAPTURE_KB) turned on: with
NX2NAVI_MIRROR_STAGE=1 (the default) the pages the CPU wrote are copied out of guest memory, up to 64 MiB a
part, when the part is handed to the queue. A submission whose prologue copied everything that way reads no
guest memory late, so the game's wait after a frame's first submission ends once the replay has submitted it
(vk_sync_recorded_wait). One with a range left to the GPU-time copy (a pool with a write-back in flight or a
twin) or a draw that reads a pool without a mirror is noted (vk_mem_note_live), and its wait is the GPU's.
Also 8 texture pool sets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:47 +01:00
Tobim6
7d54ee73c7 Waits for GPU work outside the replay (NX2NAVI_TRACE=perf): how much of each is the replay still recording and how much the GPU.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:45 +01:00
Tobim6
1dda8bc23c Lazy write-back: the armed list gets its own short lock; the replay's per-draw check no longer waits for freezes and thaws on other threads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:43 +01:00
Tobim6
6de2be9ed5 GPU timeline (NX2NAVI_TRACE=perf): every 60 frames, what the GPU's idle time was spent waiting for.
The perf line's "idle with it queued" was the gap before each replay part handed over before the previous one ended:
13-17 ms a frame on an RX 580 in Kokiri Forest on 0.7.1, unexplained. Uploads and presents were not timed, a held
submission (submit batching) counted as handed over while it still waited in vk_sync, and with cuts and pre-pass
command buffers a submission closed more than the four timestamp pairs ts_unsent had room for: the rest went to the
completion queue without a submit time and out of the GPU's order. Now every timed piece of GPU work (replay parts,
mirror prologues, pre-pass command buffers, upload batches, presents) is noted with when it was handed to vk_sync, when
it really went to the queue and its GPU start and end, and every 60 frames two lines split the idle time: starved
(nothing in the queue, and how much of that a held submission waited in the batching) or with work in the queue, by
the kind of piece that started after the gap, with the average delay from hand-over to start on an idle GPU per kind.
ts_unsent has room for every command buffer of a submission, and the pairs are read in queue order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:42 +01:00
Tobim6
78429f4933 Held submissions keep every command buffer they carry: the hold buffer had room for two.
queue_submit copies a held submission's command buffer infos into H.cbi[i], two entries each, the mirror prologue
and the part. Since the mesh emulation's pre-pass command buffers and cuts (vk_sync_pre, vk_sync_cut) a submission
carries up to three plus the cut parts, and the copy ran into the next held submission's entries and past the array:
the next held submission's copy then overwrote them, so a submission could go to the queue without its own last
command buffers and with another's twice. The buffer now has room for SUB_CBS (CHAIN_MAX + 3), and a larger count
stops the run with a message instead of overrunning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:40 +01:00
Tobim6
f6199a4616 Upload batches: their GPU time in the log (NX2NAVI_TRACE=perf), with how many go to the queue per frame.
The replay's GPU time covers only its own parts. Upload batches are submissions of their own, the ASTC decoder's
dispatches in them, so their time showed only as GPU idle "with it queued (untimed work or waits)": 10-16 ms a frame on
an RX 580 in Kokiri Forest on 0.7.1 while the game streamed in about 7 textures a frame, against 0.6-1.2 ms where it
streamed none. Each batch now writes a timestamp at its start and end, read when it retires; every 60 frames a perf line
gives the batches per frame and their GPU time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:39 +01:00
Tobim6
38a3824b8f Mesh emulation: cut the part at a pass's first emulated draw instead of splitting it, so the texture pool set stays.
A split hands the part to the queue and seals its texture pool set; the next part takes another set of the ring and
refreshes its entries first. The splits for the mesh stages made 5 parts a submission and 6 set switches a frame at
2.3 ms of replay each (Kokiri Forest on 0.7.1, an RX 580: replay 32-38 ms a frame, the replay thread blocked on fences
26-35% of the time, 79 waits for a set the GPU still used). A cut (vk_sync_cut) ends the command buffer without
submitting it: the part and its pre-pass command buffer wait in a chain and go to the queue, in order, with the next
part that does, so the set is the same one throughout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:37 +01:00
Tobim6
55ab90c66e Mesh emulation: the stages of a pass's emulated draws run before the pass, in a command buffer of their own.
Each emulated mesh draw ended the pass, ran its stages between four barriers and began the pass again: a pass of 20
emulated draws became 20 passes, and on an RX 580 6 to 7 ms of a frame's 30 ms of GPU time went to the gaps between
passes (gpu_passes in Kokiri Forest: 8.7-10 ms per frame outside the game's passes and dispatches, 6.3-7.7 ms of it in
273-306 gaps with barriers only; 71 emulated draws a frame, 36 of them indirect). Now the first emulated draw of a pass
ends the part there (vk_exec_split_now), so the pass begins a new part, and the stages of every emulated draw of that
pass, the indirect ones' ring entries included, go into the part's pre-pass command buffer (vk_sync_pre), which the
queue runs after the mirror prologue and before the part; the pass is not split again. NX2NAVI_MESH_EMU_BATCH=0 (Lama
patches: Mesh emulation before the pass) brings the split back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:35 +01:00
Tobim6
93e68d57f1 Pool marks: a fragment shader stores its marks where it ends, not between a sample's coordinates and the sample.
On AMD's driver for Polaris (RX 580, 23.10) a store between a pool texture's access chain and its sample left the
quad's helper lanes out of the code in between: derivatives at a triangle's edge were garbage and edge pixels came out
dark, the dotted lines along the paths' triangles since 0.7.0 (frame dump f1714: the colour pass covers every pixel,
the depth test is not what drops them). Each access now notes its slot in a Private variable; before each return of
the entry function and before a kill, terminate or demote every noted slot is marked, an unset one going to a spare
slot past the pool. Accesses in loops or outside the entry function note theirs in a ring of 8, marked in a loop at
the way out. Checked with spirv-val on the 45 marked shaders of the dump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:34 +01:00
Tobim6
01d81811a1 NX2NAVI_LOG_TEX_NEW: log the textures made from a frame on, with what destroyed the same key before
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:32 +01:00
Tobim6
9259149527 Settings menu: a Lama patches tab with the settings of the RX 580 patches
Released textures kept, top texture levels left out, hot pools in system memory, the heap limit, the upload batch
limit, the kept ASTC buffer, mesh emulation and its arena and task records (greyed where the GPU has mesh shaders),
the overwritten-texture fix, the vector index fix, -O2 game code, pass times and the frame dump key. Each key gets a
row in the settings table; make_game.py reads guest_opt from nx2navi.ini when the environment does not set it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:31 +01:00
Tobim6
f18639e055 Mesh emulation: payloads that are not a multiple of the workgroup size.
Since 0.6.0 a task payload is 32 bytes longer than the program header's size (b6b76b7): Ocarina's foliage task payload
is 776 words, which 32 threads do not divide. The emulation refused those programs ("payload not a multiple of the
workgroup size"), their pipelines failed, and the task draws (grass on the moss, the door) went undrawn again. The
copies of the payload into and out of the task record take a last, partial round, where threads past the payload idle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:29 +01:00
Tobim6
68c259c7b3 make_game.py: the build log says when the lifted code is built at -O2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:27 +01:00
Tobim6
a2656f8501 Mesh emulation: task records hold payloads of up to 776 words.
Since 0.6.0 the translator sizes a task payload 32 bytes past the program header's size, for the header before the
program's data (b6b76b7): Ocarina's foliage task, 3072 bytes, now declares 3104. A record held 768 payload words, so
the emulation refused those programs ("payload too large") and the foliage went undrawn. Records are 780 words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:26 +01:00
Tobim6
bb654470b2 Crash report: the log names what the crashing thread was building, and a library link names its case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:24 +01:00
Tobim6
7118dd426d Mesh emulation barriers carry MEMORY_READ/WRITE: the task stage's mesh dispatch was read as zeros on AMD Polaris.
The emulation's barriers named only synchronization2's SHADER_STORAGE_READ/WRITE bits (above bit 31). With AMD's
driver for the RX 580 (23.10.01) the indirect dispatch of the mesh stage, which reads the {groups, task workgroups, 1}
the task stage had just written, launched no workgroup: mesh.txt showed 0 mesh groups started for every draw with a
task stage while its record held 32 x 12 x 1, and Kokiri's moss foliage and Link's door were missing. The masks now
also carry MEMORY_WRITE and MEMORY_READ, as the replay's general barrier does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:22 +01:00
Tobim6
888f4ca17a Mesh emulation: the arena counts mesh workgroups started, past the task-record check and at the output copy.
Draws with a task stage drew nothing on an RX 580 although their task records ask for mesh groups (mesh.txt), and the
same converted stages produce vertices on lavapipe. Header words 4-7 now count, per submission, the emulated mesh
workgroups that started, those whose task record covers them, those that reached the output copy and the primitives
those declared; mesh.txt prints them after each draw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:21 +01:00
Tobim6
bd69291262 Task and mesh stages get their own c0 bank.
c0_info keeps the last bank per stage and reuses it when the inputs (storage and uniform bindings, base instance) are
equal, but task and mesh shared the compute entry and the inputs do not name the stage, while the storage table sits at
0x670 for the task stage and at 0x770 for the mesh stage. When a program's task and mesh stages bind the same storage
buffers, the second stage got the first one's bank and read zero storage addresses. In a Kokiri Forest frame every
draw with a task stage (moss foliage, Link's house door) launched mesh groups that made no vertices, while mesh draws
without a task stage drew.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:19 +01:00
Tobim6
4ed51cf7ff Overwritten textures: swizzle siblings follow the image that gets its own memory; other descriptors keep pool memory.
The game renders through one descriptor and samples through another that differs only in swizzle, and both read the
same pool memory. When one of them got memory of its own (read after an overwrite), the other kept reading the pool
bytes, which the first no longer updated. Now the image and its swizzle siblings become one image in memory of its own:
entry_of hands that image out for any swizzle of its key. If a live descriptor of another format or geometry reads the
same storage, the image stays in pool memory as before. The perf line counts both outcomes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:18 +01:00
Tobim6
703e9fecd9 Textures read after another image drew over their pool memory get memory of their own.
The game overlaps transient render targets in its memory pools, and the replay binds their images into that memory.
An image of another format or size drawn over an image's memory leaves the GPU's tiled, compressed texels of the
other image there. Ocarina's volumetric fog reads its 360x202 RGBA32F fog-volume texture at the start of a frame,
before drawing it again, and the 1440x810 R11G11B10F bloom target had been drawn over that memory at the end of the
previous frame: the fog lighting took those texels as volume distances and types (values from 1e-12 to 3e33 in a
frame dump where the texture holds 9 to 50000), and drew teal splotches in Kokiri Forest's fog on AMD and NVIDIA.

Each pool-bound image the GPU writes marks the pool-bound images of another layout that overlap it; one read while
marked is dropped and comes back with memory of its own from then on, so it keeps what it last drew (the read that
found it gets an empty image once). NX2NAVI_TEX_CLOBBER=0 keeps such images in pool memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:16 +01:00
Tobim6
3b90353c5b Optional (NX2NAVI_VEC_INDEX_FIX): uniform vector components at computed indices loaded whole and selected.
AMD's Windows drivers can read the wrong component through an access chain into a uniform block vector whose
component index is computed (the translator's c[n][i >> 2][i & 3] for an LDC with a register offset), the bug Ryujinx
works around with HasVectorIndexingBug. With NX2NAVI_VEC_INDEX_FIX=1 (or auto: AMD's own drivers) each shader is
patched in memory as it loads: the chain without its last index loads the whole vector, CompositeExtract takes each
component and OpSelect picks the indexed one. Off by default: it did not change the volumetric fog's teal blotches on an
RX 580, whose per-volume extinction reads its colour this way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:22:15 +01:00
Tobim6
6169d82385 NX2NAVI_DUMP_KEY takes a key name; Pause by default.
F10 is the performance overlay's key, so a press dumped a frame and changed the overlay. dump_key = 1 or pause now
means the Pause key; scrolllock, insert, home, end, pageup, pagedown, f2-f7, f9 and f12 can be chosen instead.

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

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