Intel's frozen driver for UHD 630 and Ice Lake (Vulkan 1.3.215 and older) leaves the picture black with
VK_EXT_vertex_input_dynamic_state (LAS Recomp 61fe44ff, its issues #8 and #357); the GTX 1050 Ti laptop has a
UHD 630. TOTK_VK_DYN_VERTEX=0/1 forces it. The fallback path, checked on the RX 9070 with validation: field picture
as with it, no new validation messages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Within a row, consecutive GOB columns are one block apart and a GOB row's four 16-byte segments sit at fixed
offsets, so the address is computed once per row. Non-ASTC texture upload time in the monsters2 load frames falls
by 28-38% (90 to 65 ms at the world load). probe-vkmem compares it with its reference swizzle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Render-thread chains could not show which guest thread held a virtual core during a stall; with every thread's
chains over a short frame range the running samples name it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The replay resolves every vertex stream and buffer binding of each draw; four entries thrashed over the pools a
frame touches, and each miss took the pool lock and searched the index. vk_mem_resolve falls from 5.3-6.1% to
1.6% of the RX 9070 render thread, field replay from 9.2 to 8.9 ms. TOTK_RESOLVE_CHECK=1 compares every hit with
the locked lookup.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
About 65% of field draws repeat the previous draw's program, state and texture handles; shader_for falls from
10.8% to 6.4% of the RX 9070 render thread and field replay from 9.7 to 9.2 ms. answers_for looks up only the
slots whose handle changed. TOTK_SHADER_MEMO=check verifies both against full lookups; TOTK_BIND_STATS counts
repeats per draw.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mirror and the texture checks queried about 930 MiB of write-watched memory per frame (0.96 ms on the RX 9070
machine, about 3 ms on an 8th-gen i7), at about 1 us per MiB, and 770 MiB of it lay in 2 MiB regions nothing had
written for two seconds. In mirror mode a region left unwritten for TOTK_FREEZE_IDLE submissions (300; 0 turns it off)
and lying wholly in imported pools is now made read-only (memory.c mem_freeze), and the snapshot and change queries
skip it. The first write faults and a vectored handler thaws the region before the write retries; file reads into
guest memory, which the kernel would refuse on a read-only page, thaw their buffer first and log a refusal, as do pool
init and finalize, and commits, decommits and protection changes thaw under the same lock. A region stays thawed for
5 s after a file read. Field: 66 queries over 380 MiB, 0.56 ms per frame; 0.38 ms of it are the queries that find
writes. The perf line `mem: write-watch` gives queries, bytes, time, frozen MiB, freezes and thaws. The gfx-abi probe
covers freeze, thaw by a write and the hold after mem_thaw. TOTK_MEMORY, TOTK_MIRROR_GAP and TOTK_FREEZE_IDLE are known
settings now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
At the start of every submit the dirty census queries write watch over the imported pools the replay bound as vertex,
index, uniform, storage or indirect buffers, stamps the shared page generations and logs eager, lazy and first-use
bytes per frame and per submit by pool class as mem: dirty every 60 frames, with FlushMappedRange calls and bytes and
the live and cumulative mirror size. The device class line (uma or discrete, heaps and memory types) is logged once at
device selection and the pool census also at frame 600. perf_summary.py summarises the new lines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GetModuleFileNameA, fopen, CreateFileA and getenv returned and took ANSI code page bytes while platform/win32.c,
fs_host.c and romfs.c convert paths as UTF-8, so an install folder under a Cyrillic user name lost its RomFS, profile,
RomFS patches and caches. runtime/totk.rc is compiled with the runtime objects (windres, or llvm-windres with
--toolchain), so it is also a member of libtotkrt.a. build_game.py writes build.ninja and modules.c as UTF-8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each submission part writes a timestamp pair under TOTK_TRACE=perf; the completion thread reads it and sums the busy
time without double-counting overlap. A second 60-frame perf line carries GPU ms per frame, fence waits of the render
thread and of other threads, VRAM usage and budget (VK_EXT_memory_budget, else the allocator's own blocks against the
heap size), working set and private bytes, and bound: gpu, cpu or pace. Devices without timestamp bits or a timestamp
period log one line and show gpu n/a.
vk_mem_resolve now reports the pool class of a span. The replay counts bytes bound or copied per class and use, and
vk_mem_census logs the live pools by kind and flags with that traffic at frame 1800 (every 1800 frames with perf).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The zero binding used four-component formats, so shader inputs the game left unset read w = 0. TOTK's foliage
shaders scale wind sway by 1 - colour.w; the Brightbloom stem and leaves have no vertex colour and swayed fully,
while the bulb (which has one) stayed put and floated beside the cup. One-component R32 formats expand to
(0, 0, 0, 1), matching deko3d's IsFixed 1x32 float for unused attributes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
The pacer gave each frame its display time but the present thread queued vkQueuePresentKHR as soon as the game
handed the frame over, so every present shifted with the frame's replay time: at 60.0 fps mean, 17-18 ms intervals
alternated with 15-16 ms ones. The present thread now submits the blit at once (vk_present_blit, so
vk_present_drain and queue order are unchanged) and holds the host present until the pacer's slot
(vk_present_flip). Acquire keeps waiting until the image's slot plus one period, which is now the time the next
frame really goes out.
TOTK_TRACE=present logs one line per present: host interval, the game's present-call interval, wait and lateness.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>