16 Commits
Author SHA1 Message Date
Wellington Dias 1d51343ac1 Build and run the runtime natively on Linux.
Shared runtime code now goes through runtime/platform/platform.h, implemented by platform/win32.c and a new
platform/linux.c: futex locks, a userfaultfd and PAGEMAP_SCAN write watch, signal-based async preemption, our own
fiber switch, and a SIGSEGV handler for the thaw and crash hooks. The window, input, menu and software keyboard get
SDL3 back ends beside the Win32 ones, with the swapchain (gfx_present.c) and input merging (input.c) shared. SHA-256
replaces BCrypt, ELF builds get their own override sections, and the build tools gain Linux branches.

On Linux the selftest and the gfx-abi, astc, nvn and window probes pass. probe-vkmem still fails: imported guest
memory cannot be write-watched on Linux, which the shadow buffers in vk_memory.c will address.
2026-10-29 16:56:56 -03:00
Valiantsin DzerakhandClaude Opus 5.5 ce150130df Make code comments say what they mean instead of pointing at things a reader cannot follow
Comments cited codes from local notes (port-lessons P1, backlog), task labels (T6c1-T6c3, M4), bare upstream commit
hashes and issue numbers, a file that no longer exists (nvn_api.c, now nvn_api_*.c), a generated file (main_0103.c)
and line numbers into upstream files that refs/ has moved past, so they pointed at unrelated code. Those now name the
file, function or project and say what the cited code does. Attribution of copied code keeps its pinned commits.

Corrected facts: TOTK_REPLAY_ASYNC defaults to 0, and the shader cache, pipeline cache and pipeline keys live next to
totk.exe, not in build/v121.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 12:58:01 +03:00
Valiantsin DzerakhandClaude Opus 5.5 4e764cd39a Take world-clock windows in TOTK_PROFILE_FRAMES and TOTK_CRIT: w<lo>-<hi> is seconds of game time since the save loaded, so a profile or critical-path session covers the same play at any frame rate instead of a present range that lands elsewhere on a slow machine
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 08:56:50 +03:00
Valiantsin DzerakhandClaude Opus 5.5 72253abcc0 Run and measure by game time instead of presents: totk.exe --seconds S ends a run once the world clock passed S seconds (run_game.py --seconds, regress.py routes in world seconds), TOTK_AB blocks are seconds of world clock, the perf line carries the world clock, and TOTK_SHOTS=w<lo>-<hi>:<step> takes shots by it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 16:51:36 +03:00
Valiantsin DzerakhandClaude Opus 5.5 48dfe0cfdf Measure a change within one launch: TOTK_AB=<presents> alternates A and B blocks (A B B A), a switch set to ab is on in the B blocks, and tools/ab_summary.py compares the perf windows of each side; TOTK_ONE_PER_CORE=1 keeps one logical processor per physical core (off: no gain on a 7900X)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 16:41:46 +03:00
Valiantsin DzerakhandClaude Opus 5.5 adc4d7aa9c Dump every thread's call chains of a slow present (TOTK_PROFILE_SLOW=<ms>), and never copy a stack whose Rsp sits in its guard page
The sampler keeps the last half second of every thread's chains in a ring and writes the samples of a present interval over the threshold to <TOTK_PROFILE>.f<frame>, per thread and time (tstack), with the samples that took over 2 ms to stop their thread (tstall: the thread was in a long kernel call). A thread that ran no cycle since its last sample repeats its chain without being suspended. A thread stopped between its sub rsp and the stack probe has Rsp in the guard page; copying from there raised STATUS_GUARD_PAGE_VIOLATION and ended a run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 11:40:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 bd9851f4f2 Trace the guest main thread's waits by object and by the thread whose signal ended them (TOTK_TRACE=sched), and sample the main thread alone with call chains (TOTK_PROFILE_MAIN=1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 09:23:35 +03:00
Valiantsin DzerakhandClaude Opus 5.5 05ea4f0e56 Add the performance overlay's sampling (perfmon.c), system info for bug reports (sysinfo.c), their Windows calls, GPU timestamps on demand, and option row helpers: buttons, group headings, greyed-out rows, focus by key
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 20:55:08 +03:00
Valiantsin DzerakhandClaude Opus 5.5 84abfaaf2c Merge the replay of NVN submissions on a queued thread, with reads waiting for the newest writer instead of a drain, behind TOTK_REPLAY_ASYNC
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 08:22:35 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d52cdfc6ee Add TOTK_CORE_DIAG: classify every virtual core wait by what the owner was doing, and answer SVC 0x36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:23:48 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1c1b3cf073 Log the replay queue's run totals at game exit and accept replay_async in totk.ini
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:27:11 +03:00
Valiantsin DzerakhandClaude Opus 5.5 14af7e7347 Replay NVN submissions on a queued replay thread behind TOTK_REPLAY_ASYNC, with drains for calls that read or free GPU state
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:24:39 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8a41e3a7ef Keep call chains of every thread in the sampling profile with TOTK_PROFILE_CHAINS=1
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>
2026-10-25 14:12:43 +03:00
Valiantsin DzerakhandClaude Opus 5.5 2790f7d0e2 Keep render-thread call chains in the sampling profile and report inclusive time and driver callers from them
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 12:40:49 +03:00
Valiantsin DzerakhandClaude Opus 5.5 94d5367040 Log GPU time per frame, VRAM, process RAM and a bound verdict in the perf line, and a pool census
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>
2026-10-24 19:17:24 +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