Commit Graph
23 Commits
Author SHA1 Message Date
Valiantsin DzerakhandClaude Opus 5.5 166e5a7b7d Drop released textures oldest first, one per release past 2048, instead of all of them once the count passed 4096: that sweep destroyed thousands of images in one frame, 333-422 ms frames every 40-50 s on a GTX 1050 Ti, and the textures still in use came back as new images and uploads
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 15:14:11 +03:00
Valiantsin DzerakhandClaude Opus 5.5 97d3762ba1 Strip milestone and task labels from code comments and drop the dead gfx_stubs.c
Comments named the agent task (T1-T7, M2-M5, Task 2.x) that once owned each file or block, and pointed at local
notes the repository does not carry (backlog items, milestone plans, research notes). They now say what the code
does. gfx_stubs.c held weak stand-ins for functions that every build has defined for a long time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 13:12:50 +03:00
Valiantsin DzerakhandClaude Opus 5.5 6d216840dd Merge the device-local memory census: a mem: vram line every 600 frames with TOTK_TRACE=perf, and backlog item 20 with the released texture entries as the grower and machine B at its budget
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 08:14:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9758b8365e Log what holds device-local memory every 600 frames with TOTK_TRACE=perf: VMA blocks and allocations, texture entries live and released with the bytes of their own memory, VRAM mirrors and pending releases
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 07:39:08 +03:00
Valiantsin DzerakhandClaude Opus 5.5 bcbbcb0b1a Keep texture lookups per slot instead of per global texture generation, and vertex buffer spans while their ranges repeat
TotK finalizes and initializes transient textures every frame: the global tex_gen and slots_gen moved about every 16
draws in the monsters fight, so every cache keyed on them (the slot cache in vk_texture_by_id_locked, the texture types
of answers_for, the texture descriptor memo) lived for a few draws. A slot resolves through the entries at its own
storage address only, so each address hash now has its own generation and each slot a token
(vk_texture_slot_token: registration serial and address generation, lock-free). The memos check the global generation
first and the slot's token only when it moved.

The descriptor memo no longer drops an entry at each submission (the first binding still makes the storage check; a
re-upload writes the same image) or pass (the feedback layout is set on each hit from the kept image), and is twice
the size. feedback_scan keeps each handle's sampled subresource across passes instead of looking up every fragment
texture after every texture bind. bind_vertex_buffers keeps each stream's resolved span while its range and
vk_mem_gen stay the same.

Monsters fight on the RX 9070: replay 12.0 -> 10.8 ms per frame; field 8.1 -> 7.4 ms. TOTK_TEX_MEMO=check and
TOTK_SHADER_MEMO=check runs found no difference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 00:55:17 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1836d5c5d0 Keep texture image views for the image's lifetime instead of creating them again in every command buffer
Views made per command buffer were created anew every frame: vkCreateImageView under get_view took about 8% of the fight
replay on the 7900X. They now live in one table keyed as before, used under the texture lock, and destroy_tex hands an
image's views to the deferred release with the image (vk_exec_image_gone). The buffer range limits ubo_info and
ssbo_info read on every binding are read once. Fight replay 14.0 to 12.5 ms per frame (15.7 before the branch), field
9.5 to 9.2 ms; a fight run under the validation layer shows only the known cp_t_tcb_20 message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 22:42:47 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c4108c49a8 Map NVN's 16-bit packed formats with their components counted from the least significant bit, as NVN does for RGB10A2: RGB565 is B5G6R5, RGB5A1 is A1B5G5R5, and the old table, which took LAS Recomp's order, read the Depths terrain's normal and blend maps scrambled and stretched the ground textures along one axis
A1B5G5R5 needs VK_KHR_maintenance5, so RGB5A1 stands in as A1R5G5B5 with R and B swapped by the view swizzle (TexVkFormat.chan); RGBA4 and RGB565 fall back the same way to mandatory formats on devices that lack A4B4G4R4 or B5G6R5. RGB5 and BGR5 now sample alpha as 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 16:48:05 +03:00
Valiantsin DzerakhandClaude Opus 5.5 6029719713 Read depth textures sampled without a compare as one texel, and round the reference of D16 array shadow compares to 16 bits, as MacNativeGames 6283599 does: the game binds linear samplers to depth it reads as data, and the Switch compares D16 against a reference at the texture's precision
The point form of a sampler slot is built once (vk_sampler_point_by_id_locked). Translator patch 0009 rounds the 2DArrayShadow reference in Ryujinx's SPIR-V backend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 16:25:56 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b0805112ed Merge main into task/menu: the docs and comment cleanup, with the Dear ImGui set-up of menu.cpp kept in the LAS Recomp notices row
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 10:16:23 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8b514f6ead Keep every default in the settings table: cfg_value, cfg_int, cfg_double and cfg_bool read it, and the consumers of table keys drop their own defaults
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 09:32:30 +03:00
Valiantsin DzerakhandClaude Opus 5.5 111f748c51 Remove citations of local build/ notes from code comments and correct the TOTK_REPLAY_ASYNC default in vk_backend.c
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 09:23:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 792cc378f5 Merge branch 'main' into task/replayq
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:20:17 +03:00
Valiantsin DzerakhandClaude Opus 5.5 bc6294cf46 Wait for the newest recorded writer of the stale textures in a guest read instead of draining the replay queue
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 07:48:33 +03:00
Valiantsin DzerakhandClaude Opus 5.5 469c2be1e7 Wait for the texture's newest writer instead of draining the replay queue in ReadTexels, with TOTK_REPLAY_CHECK comparing against a full drain
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:27:49 +03:00
Valiantsin DzerakhandClaude Opus 5.5 bbcc50ae47 Count texture re-uploads and the share that follows WriteTexels in the perf lines
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:20:48 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b34ca6ea4a Merge ASTC decode in a compute shader with native ASTC upload where the device samples it, behind TOTK_ASTC
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:36:43 +03:00
Valiantsin DzerakhandClaude Opus 5.5 291267e65d Decode ASTC a block per lane group through shared memory, in scratch chunks of at most 32 MiB of texels, and time the dispatches with TOTK_ASTC_TIME
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:28:00 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d36034b1ec Skip building a graphics draw's descriptor sets when its inputs equal the previous draw's in the command buffer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:42:54 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9a859dfb2c Decode ASTC textures with a compute shader in the upload batch, or upload them natively where the device samples ASTC, behind TOTK_ASTC
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:42:51 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f178be9eb2 Copy only the region of a ReadTexels or WriteTexels call instead of swizzling the whole texture level
A guest WriteTexels of a small region deswizzled and reswizzled the whole level while its thread held a virtual core
and the texture lock: 80 ms preemption delays and 50-160 ms frames in the monsters2 replay (frames 765-790,
1225-1235), with the render thread waiting on the texture lock. nvn_texels_box copies the box alone; probe-vkmem
compares it with the whole-level path on random boxes of five block sizes, mip levels, array layers and 3D slices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 14:12:43 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1fe552ae0a Mirror buffer-bound pools in device-local memory on discrete GPUs
Imported pools put vertices, indices, constants and storage buffers in system memory, so discrete GPUs read them over
PCIe on every draw. A pool now gets a device-local mirror on its first use as a vertex, index, uniform, storage or
indirect buffer; bindings, buffer copies, fills and uniform updates use it at the same offsets. The first access of a
submission syncs the pages written since (write-watch snapshots shared with the texture checks, plus
nvnMemoryPoolFlushMappedRange ranges) in a prologue command buffer before the part; what the GPU writes into a mirror
goes back to guest memory at the end of the submission. TOTK_MEMORY=import|mirror|verify overrides the device class;
verify compares sampled mirror pages with guest memory at the fence. The vkexec probe gains a mirror part.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 00:45:56 +03:00
Valiantsin DzerakhandClaude Opus 5.5 0beafeb066 Write GPU-rendered textures back when the CPU invalidates a pool range or waits for a fence
nvn_pool_invalidate was a weak no-op, so nvnMemoryPoolInvalidateMappedRange never wrote anything back. TotK
invalidates its 260x260 R16 grass maps and 1x1 targets before reading them; they now go through guest_read.

The grass system also renders a 128x128 RGBA8 cut map into a CPU-cached pool every frame and reads it with no
invalidate. Without its texels the CPU saw no cut: swings left the grass standing, with no blades and no insects.
After nvnSyncWait or nvnQueueFinish, dirty mirrored targets up to 64 KiB rendered in a submission up to the waited
fence go back to storage (cpu_synced, vk_texture_write_back_small), unless the CPU rewrote it since.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 10:41:54 +03:00
Valiantsin DzerakhandClaude Opus 5.5 19c9b648d1 Add the recompiler, Windows runtime, tools and docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 22:27:54 +03:00