mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-18 12:08:38 +00:00
Merge main into task/preempt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
dd4b28b400
6 files changed
+198
-53
No files matched your search
+20
-4
@@ -34,7 +34,8 @@ other `totk.exe` or `ninja.exe` runs. The log's first and last lines record the
|
||||
frame 600. `mem: class` (once at start) says whether the GPU counts as uma or discrete and lists its heaps and types.
|
||||
- With `perf`, `mem: dirty` every 60 frames: what a VRAM mirror of the buffer-bound pools would upload (pages the CPU
|
||||
wrote per frame and per submit, eager and lazy, by pool class), FlushMappedRange calls and bytes, and the mirror
|
||||
size. The census costs about 1.1 ms of CPU per frame on the submitting thread; `perf_summary.py` summarises it.
|
||||
size. The dirty count costs about 1.1 ms of CPU per frame on the submitting thread here (3 ms on an 8th-gen i7);
|
||||
`perf_summary.py` summarises it.
|
||||
- `TOTK_PROFILE=<path> TOTK_PROFILE_FRAMES=lo-hi`: sampling profiler (`runtime/prof_win.c`), read with
|
||||
`tools/prof_report.py <profile> <totk.map>`. With `TOTK_PROFILE_RENDER=1` it samples the render thread only and keeps
|
||||
call chains: the report adds inclusive time per function and the exe callers of the driver and system DLLs.
|
||||
@@ -66,11 +67,26 @@ RenderDoc cannot capture: the driver hides `VK_EXT_external_memory_host`.
|
||||
|
||||
## Other GPUs
|
||||
|
||||
The RX 9070 is the only GPU here; the build also has to run on NVIDIA and older AMD (Vega, wave64 only). New Vulkan code
|
||||
queries the feature, extension, format or limit it uses and keeps a working path or a logged fallback when it is
|
||||
missing (`vk_pipeline.c` provoking vertex and subgroup size pinning are examples). Never hard-code what this GPU
|
||||
The RX 9070 is the only GPU agents can run; the build also has to run on NVIDIA and older AMD (Vega, wave64 only). New
|
||||
Vulkan code queries the feature, extension, format or limit it uses and keeps a working path or a logged fallback when
|
||||
it is missing (`vk_pipeline.c` provoking vertex and subgroup size pinning are examples). Never hard-code what this GPU
|
||||
reports: alignments, subgroup size, depth formats, `maxPushDescriptors`.
|
||||
|
||||
Numbers from this machine do not carry over. Measured on the user's other machines (2026-10-24/25, logs and analysis
|
||||
in `build/mem-plan.md`):
|
||||
|
||||
- GTX 1050 Ti (4 GiB, 214 MiB BAR, no ReBAR; i7 8th-10th gen) and RTX 3090 Ti: GPU time 110-120 ms per frame in the
|
||||
world against 4.3 ms here, because the GPU reads imported host pools over PCIe. The VRAM mirror (cd6f490) brings
|
||||
the 1050 Ti to 10-11 ms; that machine is now CPU-bound at 25-45 fps (replay 25-30 ms per frame, backlog 0b).
|
||||
- The same write-watch scan costs about 3x the CPU time it costs here.
|
||||
- NVIDIA has no ASTC: first texture uploads decode on the CPU, 0.4-0.7 s load frames (backlog 5a.2).
|
||||
- `cannot alias its pool memory` fills its 16-line log limit on NVIDIA and on the RX 9070 alike (1920x1080, 1600x900,
|
||||
800x450 render targets); a suspect for the black patches of backlog 0a (`build/alias-plan.md`).
|
||||
|
||||
A run on another machine goes through the user: copy `build/release/TotK-perf-log.vbs` next to the `totk.exe` you
|
||||
hand over. It starts the game with `TOTK_TRACE=perf` and writes `logs\perf-<date>-<time>.log`. Ask for the log; the
|
||||
user cannot run scripted input there.
|
||||
|
||||
## Checks before handing back
|
||||
|
||||
`totk.exe --probe-kernel`, `--probe-vkexec`, `--probe-nvn-tex` and `--probe-shader` run from the build directory and
|
||||
|
||||
+149
-45
@@ -4,6 +4,83 @@ Priorities: no artifacts and no crashes first, then 60+ fps without dips, then o
|
||||
names its evidence; Maxwell item numbers refer to [research/maxwell.md](research/maxwell.md). Remove an item when it is
|
||||
merged or dropped.
|
||||
|
||||
## Open work (2026-10-25)
|
||||
|
||||
Everything still to do, in one list. Items below this section give older detail. Merged into main on 2026-10-25:
|
||||
shader memo and push skip, page-indexed pool resolve cache, region-only Read/WriteTexels, GOB-wide swizzle, Intel
|
||||
legacy vertex-input fallback, all-thread profile chains (04fb67b); descriptor build skip and update templates
|
||||
(283bc70; field replay 8.87 to 7.99 ms); ASTC decode in a compute shader and native ASTC where sampled (0a0584e;
|
||||
monsters2 worst frame 340 to 139 ms); waiting draws' stage libraries on idle workers and skipping draws into passes
|
||||
with a per-frame target (3753939; cold monsters2 worst 257 to 131 ms). Dropped after measuring: narrower guest-written
|
||||
marks for WriteTexels and box-only image updates (re-uploads after WriteTexels are 0.003-0.05% of frame time;
|
||||
`build/v121-astcgpu/texels-narrow.patch`, `build/v121-texbox/texbox-wip.patch`).
|
||||
|
||||
Measure before building: every item states the number that decides it.
|
||||
|
||||
**Freezes and frame time**
|
||||
|
||||
1. Replay thread (5a.1): `task/replayq`, `build/v121-replayq/HANDOFF.md`. Ported onto current main, probes pass; game
|
||||
checks and async against sync timings unfinished. The laptop is replay-bound (25-30 ms per frame, item 0b).
|
||||
2. Texture uploads in gameplay, now the largest cause of long frames: `task/texasync`,
|
||||
`build/v121-texasync/HANDOFF.md`. Step 1 splits the cost (image and memory creation, CPU deswizzle, staging,
|
||||
copies, locks) before choosing a worker-thread upload, GPU deswizzle, image pooling or a per-frame budget.
|
||||
3. Virtual-core preemption as Horizon does (MacNativeGames 8bf0893 / e4b4601, PR #488: asynchronous preemption of an
|
||||
owner in game code, priority inheritance, the SDK's preemption-disable protocol; Mac worst-1% frame 18.4 to 10.6
|
||||
ms): `task/preempt`, `build/v121-preempt/HANDOFF.md`. Port only if the measured waits behind an owner in game code
|
||||
are significant; our checkpoints at indirect calls may already cover most.
|
||||
4. Start-up re-warm when the driver cache does not match the exe path or device (5a.3): `task/rewarm` (main merged
|
||||
in, 0b3bc73), untested in game. Needed before the laptop package.
|
||||
5. Shared shader list: the newer MacNativeGames lists collapse variants that differ only in texture kind into `"*"`
|
||||
rows, which our runtime cannot match (it translates for the exact kind). `tools/prepare_shaders.py` reads `"*"`
|
||||
as 2D (uncommitted), and `build/shader-lists/union.tsv` unions every list revision since b75be8c. Option: match
|
||||
`"*"` rows at run time as MacNativeGames does (`prepare_shader_seed.py:60-76`).
|
||||
6. Freeze census: a 10-15 minute user session on current main with `TOTK_FLIGHT=1`, `TOTK_TRACE=perf` and
|
||||
`TOTK_INPUT_RECORD`, ranking every frame over 50 ms by cause. Decides items 7-9.
|
||||
7. `TOTK_PIPE_SKIP=fullscreen` as default (cold monsters2: 0 frames over 100 ms, 1% low 33.9 to 41.7 fps; risk: one
|
||||
frame without a full-screen pass the first time its pipeline appears). Decide from item 6.
|
||||
8. ASTC per-frame decode budget (4b): the largest batch, the 169 M texel 8x8 array at boot, scales to about 375 ms of
|
||||
GPU time on a GTX 1050 Ti. Split by mips with `minLod` if laptop runs (`TOTK_ASTC_TIME=1`) show decodes in play.
|
||||
9. ASTC to BC7 re-encode on the GPU for 4 GB cards: the same array is 677 MB as RGBA8 against 42 MB of blocks.
|
||||
10. Spin-wait gates (MacNativeGames a038e6b, from nxnative 066f2af / 6d34984, MIT): loops polling memory hand the
|
||||
core to a queued thread after 50 us. Survey TotK 1.2.1 for such loops first.
|
||||
11. Over the GPU memory budget, wait for running work and drain deferred releases before failing (MacNativeGames
|
||||
4de7b4e); 4 GB cards.
|
||||
12. Later: recording on several threads, descriptor buffers or bindless (touches the translator), CPU/GPU frame
|
||||
overlap as LAS Recomp 13398126d (only with item 1; keeps the phantom-object guard), an x86-64-v2 build for CPUs
|
||||
without AVX2/FMA (SavageWindRecomp ae42014b4).
|
||||
13. Laptop package and test after items 1-5 (GTX 1050 Ti and UHD 630). Untested there: native ASTC on Intel, the
|
||||
Intel `minStorageBufferOffsetAlignment` padding of the ASTC path, the legacy-driver vertex-input fallback.
|
||||
|
||||
**Bugs**
|
||||
|
||||
14. Yunobo fades out and vanishes from the main view about 45 frames after the user presses A (ball fades at
|
||||
1335-1350, gone at 1352; his shadow-map draws stay). Repro: `run_game.py build/v121-yunobo --save
|
||||
user-save-2026-10-24-yunobo1 --script build/recordings/yunobo-cast2.txt --frames 1360`. Ruled out: occlusion
|
||||
counts, CPU readback of GPU targets, missing NVN entry points, GPU-side resources: the game itself stops issuing
|
||||
his main-view draws. Leading hypothesis: game logic fades the model alpha (material c11[33].w) and drops it from
|
||||
the queues on a CPU input (camera-near fade, GfxColFade, CancelDraw distance or an AI fade). Next: find his c11
|
||||
buffer, write-watch c11[33].w to its writer, walk up in Ghidra; cheap check first: fps60 and real-time patches
|
||||
off from present 1316. Debug tools uncommitted in `.worktrees/yunobo` (`build/v121-yunobo/debug-tools.diff`);
|
||||
detail in `build/v121-yunobo/HANDOFF.md`.
|
||||
15. Black patches for a moment on the GTX 1050 Ti (item 0a below, `task/alias`, `build/alias-plan.md`).
|
||||
16. Lantern texture bug (item 6 below): waiting for the user's description or a cropped shot.
|
||||
17. Validation: `cp_t_tcb_20` R32F view sampled with depth compare in `vkCmdDispatch` (correctness item 8), "VkDescriptorSet
|
||||
0x0 does not have a binding for vp_c1" in `vkCmdDrawIndexed` (also in `build/v121/logs/val-base.log`), a fragment
|
||||
write to Location 0 with no colour attachment.
|
||||
18. The correctness queue below.
|
||||
|
||||
**Machine and housekeeping**
|
||||
|
||||
19. Faulty RAM: about 25 bugchecks in three days, also at 4800 without EXPO; each stick alone passed MemTest86 test
|
||||
5. Since 2026-10-25 21:08 one stick (BD100C33) runs in channel A, single-channel, so timings from then on are not
|
||||
comparable with dual-channel ones. Next: one stick in slot B; if clean, the pair is the fault (RMA the kit).
|
||||
After the fix: clean `gen.py` and `build_game.py`, all diff tests and probes. Zero-filled cache files from the
|
||||
2026-10-22 crash are in `build/quarantine-zero-cache-20261025`.
|
||||
20. Waiting for the user's approval to commit: `docs/backlog.md`, `docs/agent-playbook.md`, `totk.ini.example`,
|
||||
`tools/prepare_shaders.py`.
|
||||
21. Clean up merged worktrees and build dirs (bindskip, astcgpu, pipewait, texbox): notes to `build/archive/`.
|
||||
22. Paused branches: `task/menu` (in-game menu, 2 commits), `task/v143` (game version 1.4.3, item 22).
|
||||
|
||||
## Plan (agreed 2026-10-23)
|
||||
|
||||
Work the stages in order. At most three agents at once, at most two of them running the game. Done 2026-10-23 and
|
||||
@@ -12,13 +89,32 @@ removed: validation-layer crash (`build/archive/v121-val`), frame-time summary i
|
||||
and README, settings file `totk.ini` (`runtime/cfg.c`, `--probe-cfg`; a new variable needs a row in `known[]`;
|
||||
`build/archive/v121-ini`), portable folder (`tools/package_build.py`, README build step 7; `build/archive/v121-port`),
|
||||
freezes on new pipelines in fights (cold fight 53.9 to 59.7 fps mean, frames over 50 ms 10 to 0;
|
||||
`TOTK_GPL_DRAW_BUILD=0` turns it off; `build/archive/v121-pfh`).
|
||||
`TOTK_GPL_DRAW_BUILD=0` turns it off; `build/archive/v121-pfh`), agent tasks in git worktrees (`tools/worktree.py`,
|
||||
`private-build` skill), rumble strength and curve (`rumble_strength`, `rumble_curve`, `rumble_triggers`), even
|
||||
present cadence by back-edge pacing (fight intervals outside 16.7 +- 1 ms 24.5% to 2.4%, +3.3 ms latency;
|
||||
`TOTK_TRACE=present`; `build/archive/v121-pace`), PC keyboard and mouse layout with the mouse camera (`input_map.c`,
|
||||
`mouse_sens`; `build/archive/v121-kbm`; the game's button actions and the D-pad order 1-4 still to check in game).
|
||||
|
||||
**Stage 1: before the tester weekend**
|
||||
|
||||
0a. Black screen patches for a moment, seen by the user on the GTX 1050 Ti in the field (2026-10-25). Not the VRAM
|
||||
mirror: a verify run that caught the glitch compared 4.45 million mirror pages with 0 mismatches. Leading
|
||||
hypothesis: a new texture descriptor over a GPU-rendered texture fails `alias_compatible` and starts as a
|
||||
zero-cleared own-memory image (`vk_texture.c` `entry_of`, `create_tex`, `init_image`). The run's two largest
|
||||
`left uninitialised` counts (33, 41) fall in its last seconds, where the glitch was. Repro every time: open the
|
||||
Purah Pad with a right stick click (keyboard C). Next: `task/alias`, per-alias
|
||||
diagnostic lines and a `TOTK_TEX_FILL=magenta` knob, then a user run. Details: `build/alias-plan.md`.
|
||||
0b. CPU-bound replay on weaker CPUs: with the mirror the 1050 Ti machine (8th-10th gen i7) renders the GPU part in
|
||||
10-11 ms, but replay takes 25-30 ms per frame (5.2 ms on the RX 9070 machine), so 25-45 fps. The same machine
|
||||
replayed in 7-13 ms at 8 fps in import mode. Mirror bookkeeping explains 2-3 ms. A `sched` run rules out core
|
||||
contention: the render thread spends 79-88% of the wall time on the CPU inside `nvnQueueSubmitCommands`; guest threads
|
||||
never preempt it and the OS takes about 5%. Suspects: NVIDIA driver cost per command, mirror and texture checks inside replay. Next: a
|
||||
render-thread profile from the 1050 Ti (7f2f332 writes it on window close). Details: `build/cpu-plan.md`.
|
||||
1. User play test of the prepared build: F11, menus, movies, rumble and gyro still to check. First report
|
||||
(2026-10-23): flying smooth, short freezes in fights with monsters.
|
||||
5a. Fight hitches, the user's main complaint. In a warm fight (`fight.txt`, frames 1500+) the game runs 58.3 fps mean,
|
||||
5a. Fight hitches and stutters on new content, the user's main complaint. GPU memory mirror merged (cd6f490,
|
||||
`build/mem-plan.md`; 1050 Ti GPU time 110-120 to 10-11 ms). Order now: 2 (ASTC), 3 (re-warm), 1 (replay thread,
|
||||
also a candidate fix for 0b). In a warm fight (`fight.txt`, frames 1500+) the game runs 58.3 fps mean,
|
||||
52.9% of frames over 16.7 ms, 6.3% over 20 ms; frames over 20 ms are 87% replay (19 ms) with no pipeline or
|
||||
shader waits. The user's play added 0 shader translations and 29 full pipelines.
|
||||
1. Uneven frames: replay off the critical path. Translate command buffers at `EndRecording` or on a queued replay
|
||||
@@ -26,10 +122,23 @@ freezes on new pipelines in fights (cold fight 53.9 to 59.7 fps mean, frames ove
|
||||
the new path off by default if the play test leaves any doubt. Code and probes done in `build/v121-rq`
|
||||
(0 validation errors); no valid timings yet (its runs fell in the 21:00 file-cache corruption). Next: rebase on
|
||||
runtime/, measure `fight.txt` warm with `--quiet`.
|
||||
2. Streaming: the slow loading frames are first texture uploads (ASTC, 367 ms at frame 219 of `fight.txt`).
|
||||
Measure where the time goes, then decode on the GPU or ahead of use.
|
||||
2. Hitches when something new appears: first texture uploads decode ASTC on the CPU inside the frame (367 ms at
|
||||
frame 219 of `fight.txt` on the RX 9070; 402-714 ms load frames on the GTX 1050 Ti, `build/mem-plan.md`).
|
||||
Desktop AMD and NVIDIA have no ASTC; Intel Gen9-11 iGPUs do (check that `vk_texture.c` uses it when the
|
||||
device reports `textureCompressionASTC_LDR`). Plan, after the VRAM mirror:
|
||||
1. Measure per load: ASTC bytes, decode time, block-linear deswizzle time (`PERF_ASTC` already times decode).
|
||||
2. Licence check: Granite (Themaister, MIT) is believed to ship an ASTC compute decoder; yuzu's
|
||||
`astc_decoder.comp` is GPL, read only.
|
||||
3. Compute-shader decoder (plain Vulkan 1.1 compute, no extension, so every GPU we run on). Oracle: decode
|
||||
every ASTC texture of the 1.2.1 RomFS with it and with `astc_decode_ldr_mt`, bit-exact match required.
|
||||
4. In `vk_texture.c`: raw blocks go to staging (4-16x less PCIe traffic), a dispatch writes RGBA8 into the
|
||||
image; `TOTK_ASTC=cpu` keeps the CPU path. VRAM use stays as today (decoded RGBA8); GPU re-encode to BC7
|
||||
(yuzu's ASTC recompression) only if 2-4 GB cards run out.
|
||||
3. Driver pipeline cache after a copy or driver update: the AMD driver keys its cache by exe path, so a moved folder
|
||||
stutters until `--prepare-shaders` runs again. `task/rewarm` (1f3cd49, WIP) stamps `shader-prepared.bin` with
|
||||
device, driver and exe path and re-warms at start on a mismatch; builds, probes pass, never run in game. Next
|
||||
steps in `build/v121-rewarm/HANDOFF.md`. Whether NVIDIA caches pipeline libraries the same way: item 8.
|
||||
6. Lantern texture bug: waiting for the user's description or a cropped shot.
|
||||
7a. Keyboard and mouse: the PC layout and mouse camera agreed with the user (details below). Sonnet.
|
||||
|
||||
**Stage 2: tester weekend (2026-10-24/25)**
|
||||
|
||||
@@ -54,7 +163,14 @@ freezes on new pipelines in fights (cold fight 53.9 to 59.7 fps mean, frames ove
|
||||
|
||||
17. Platform layer: no Win32 outside `runtime/platform/` (`tools/check_platform.py`: 1195 uses in 41 files; FAIL in
|
||||
`motion_fusion.c`, `movie_probe.c`, `ov_movie.c`, `swkbd_win.c`, `vk_exec_draw.c`).
|
||||
18. Linux: `runtime/platform/linux.c`, as SavageWindRecomp splits windows, linux and macos files.
|
||||
18. Linux: `runtime/platform/linux.c`, as SavageWindRecomp splits windows, linux and macos files. Write tracking
|
||||
(`host.h` `mem_written_pages`, `mem_freeze`/`mem_thaw`/`mem_frozen`, used by the VRAM mirror and texture checks):
|
||||
freezing maps to `mprotect` + a `SIGSEGV` handler; a kernel write (`read()` into guest memory) returns `EFAULT`
|
||||
instead of faulting, so the same thaw-before-read sites apply. Written pages: `PAGEMAP_SCAN` ioctl with
|
||||
write-protect matching (kernel 6.7+, made for Wine's `GetWriteWatch`); older kernels: write-protect the mirrored
|
||||
and texture-bound pages after each sync and mark them in the fault handler (Ryujinx), uploading pools the game
|
||||
rewrites every frame whole instead of tracking them. Soft-dirty (`/proc/self/clear_refs`) is process-wide and
|
||||
slow, last resort. Under Proton the Windows build already works: Wine emulates both.
|
||||
19. Steam Deck: RADV offers Vulkan 1.3 and `VK_EXT_external_memory_host`; 4 Zen 2 cores, so expect 30-40 fps.
|
||||
20. Launcher (details below).
|
||||
|
||||
@@ -117,48 +233,36 @@ freezes on new pipelines in fights (cold fight 53.9 to 59.7 fps mean, frames ove
|
||||
|
||||
## Details for later items
|
||||
|
||||
- Keyboard and mouse (plan item 7a, agreed 2026-10-23). Today the keyboard map is `input_win.c:34-36` (camera on
|
||||
I J K L, attack on F) and there is no mouse input at all.
|
||||
- Layout:
|
||||
- In-game menu, agreed with the user 2026-10-23. Base: LAS Recomp's menu (MIT, same Vulkan base as ours):
|
||||
`refs/LASRecomp/runtime/nvn/vulkan/imgui_glue.cpp` (Dear ImGui on our device and dynamic rendering),
|
||||
`runtime/ui/menu.mm`, `option_rows.mm`, `controls_ui.mm`; SavageWindRecomp has the same menu. Opens with F1/Esc or
|
||||
Minus+Plus. While it is open, the game gets no input and keeps running (no pause). Every setting is saved to
|
||||
`totk.ini`. Drawn after the blit of the game image into the swapchain image (`gfx_window.c` around line 536).
|
||||
Linux comes later (SDL3 window, item 17): the menu and settings code stays free of Win32; only a thin adapter feeds
|
||||
window and input events to ImGui. Menu text goes through a translation catalog (SavageWindRecomp
|
||||
`runtime/ui/i18n.mm`), English and Russian. Stages, one branch each:
|
||||
1. Frame: ImGui, open and close, input, live settings with `cfg_save`, catalog; pages video (fullscreen and window
|
||||
size, FPS counter, frame limit 30 or 60), controls (rumble strength and curve, gyro on or off), sound (volume),
|
||||
quit.
|
||||
2. The remapping page (`controls_ui.mm`; the bindings of `input_map.c` and
|
||||
[controls.md](controls.md) become the defaults) and mouse sensitivity.
|
||||
|
||||
| Switch | Action in the world | Keys |
|
||||
|---|---|---|
|
||||
| left stick | move | W A S D |
|
||||
| right stick | camera | mouse; arrow keys as a second source |
|
||||
| Y | attack | left mouse button |
|
||||
| ZL | shield, lock on | right mouse button, also Z |
|
||||
| ZR | bow | F, also X |
|
||||
| X | jump | Space |
|
||||
| B | run, cancel | Left Shift |
|
||||
| A | interact, pick up | E |
|
||||
| L | abilities | Q |
|
||||
| R | throw weapon | R |
|
||||
| left stick click | crouch | Left Ctrl |
|
||||
| right stick click | | C |
|
||||
| D-pad | | 1 2 3 4 |
|
||||
| Plus | inventory | Tab |
|
||||
| Minus | map | M |
|
||||
Later pages: AMD FSR 1 or bilinear scaling of the 900p image to the window (LAS Recomp's Windows upscaler); a
|
||||
frame-time graph with the wait breakdown of `TOTK_TRACE=perf` (also on F10); VSync (FIFO) for 60 Hz displays
|
||||
without VRR, if testers report double frames under back-edge pacing; gyro sensitivity.
|
||||
|
||||
Esc stays free for the in-game menu. Z and X duplicate ZL and ZR so menu pages turn with two neighbouring keys;
|
||||
menu tabs (L, R) are Q and R. The mouse wheel stays unbound: L and R are abilities and weapon throw in the world.
|
||||
- Before coding, check in the game what L/R, ZL/ZR, X/Y, the D-pad and the right stick click do in the inventory
|
||||
and in the world, and correct the action column.
|
||||
- Mouse camera: raw mouse deltas per frame become right-stick deflection, with sensitivity
|
||||
(`TOTK_MOUSE_SENS`) and the larger-deflection rule against the gamepad. The cursor is hidden and confined to the
|
||||
client area while the window is focused and released on focus loss and while F11 changes the window. Not true
|
||||
mouselook: the game's stick curve and dead zone still apply.
|
||||
- Update [controls.md](controls.md). Remapping goes into `totk.ini` (plan item 21).
|
||||
Live settings: today each module reads its `cfg_get` string once and keeps the value (`rumble_cfg` in
|
||||
`ov_input.c`). The menu needs `cfg_set` and a version counter that consumers check (cheap; per-frame readers
|
||||
re-read only when it changes), and `cfg_save` that rewrites only the changed lines of `totk.ini`, keeps the user's
|
||||
comments and adds a missing key under its section (LAS Recomp's `settings_save` rewrites the whole file). A key
|
||||
set in the environment shows greyed out in the menu. Settings read only at start (RomFS mods, shader preparation,
|
||||
operation mode) are marked "after restart".
|
||||
|
||||
- In-game menu (Dear ImGui over our Vulkan output, as SavageWindRecomp `runtime/ui/menu.mm`). Opens with F1/Esc or
|
||||
Minus+Plus. While it is open, the game gets no input. Pages:
|
||||
- fullscreen and window size;
|
||||
- performance overlay on F10 (fps, or a frame-time graph with the wait breakdown of `TOTK_TRACE=perf`);
|
||||
- volume;
|
||||
- async shader builds;
|
||||
- quit.
|
||||
|
||||
Settings live in `totk.ini`. Leave room for later pages: upscaler, frame-rate choices, remapping,
|
||||
and the software keyboard moved onto SavageWindRecomp's `osk.mm`.
|
||||
Later: async shader builds, the software keyboard moved onto SavageWindRecomp's `osk.mm`. Rendering above the
|
||||
game's 900p is a separate study (a game-side resolution patch, as Switch mods do, or scaling every render target
|
||||
ourselves); MacNativeGames has neither (render scale fixed at 1).
|
||||
- Gyro: the user's logs show only Xbox One and Series X pads, which have no gyro. With a DualSense or Pro Controller,
|
||||
check Steam Input (it presents pads as a virtual Xbox pad without sensors) and the game's own motion-aiming option.
|
||||
- Launcher (plan item 20): one exe for Windows and Linux, SDL3 and Dear ImGui (SavageWindRecomp
|
||||
`runtime/ui/launcher.mm`, `tools/fetch_zig.sh`).
|
||||
- The player picks the base game (XCI or NSP), the 1.2.1 update and keys. The launcher checks the version,
|
||||
|
||||
@@ -52,6 +52,7 @@ A one-step ordering difference between two engine threads can show as one frame
|
||||
| S4 | rare hang or lost wake | `SignalToAddress` type 2, count <= 0 with waiters: Ryujinx, yuzu and nxnative set `value - 2` | done: `kernel.c:1017` writes `value - 1` and the count > 0 branch writes `nw <= count ? value - 1 : value`, both as mesosphere master `kern_k_address_arbiter.cpp`; 1.2.1 calls type 2 only with count 1, and `value - 2` did not change the phantom rocks (2026-10-23, `build/archive/v121-lock/NOTES.md`) | none |
|
||||
| S5 | the main thread holds a core a worker needs | yield types 0 / -1 / -2 differ on Horizon; TotK's render-graph wait is a poll plus yield | unknown: all three hand the core only to an equal or better waiter (`kernel.c:835-846`) | trace which yield type 1.2.1's frame-end poll uses |
|
||||
| S6 | lost or extra wakes | MacNativeGames `dab728a`: `SignalToAddress` wake-all, `SystemEvent` rebinding, targeted wakes | unknown | read the commit, compare with `kernel.c` |
|
||||
| S7 | stutter: a better thread waits milliseconds for a core whose owner runs game code | MacNativeGames 8bf0893 (PR #488, on by default e4b4601): the waiter signals the owner, which gives the core up when interrupted in top-level game code; priority inheritance through guest mutexes; the SDK's preemption disable (TLR+0x100 / +0x102, SVC 0x36); without the last two their game hung at "Continue". 1.1.2: 58% of long core waits were this class; Mac worst-1% frame 18.4 to 10.6 ms | ported on `task/preempt` (`TOTK_ASYNC_PREEMPT`, SuspendThread and a register-saving stub instead of a signal; `build/v121-preempt/NOTES.md`). `TOTK_CORE_DIAG=1` measured this class at 0.47 / 0.83 / 1.06 ms of thread-time per frame (field / fight / monsters2) with our indirect-call checkpoints, waits to 16+ ms; with the port 0.29 / 0.34 / 0.84 and the waits of 1 ms or more 53 / 41 / 27 to 4 / 10 / 18. 1.2.1's SDK has the disable protocol (sdk f_70051242a8, f_7005124360). A first stub clobbered the flags before saving them (`sub` before `pushfq`) and crashed at boot | see the backlog item for the A/B timings |
|
||||
|
||||
## Open: graphics
|
||||
|
||||
|
||||
+24
-3
@@ -53,6 +53,7 @@ typedef struct Tex {
|
||||
uint64_t gpu_seq; // order of that GPU write among all of them (gpu_writes)
|
||||
uint64_t gpu_fence; // fence of the submission that made that write (0: not recorded in one)
|
||||
uint8_t listed; // in owned[]
|
||||
uint32_t wt_n; // WriteTexels into the storage since the last upload
|
||||
} Tex;
|
||||
|
||||
// A slot keeps what vk_texture_by_id resolved for it, so a draw binding skips the key lookup and the address chain: the
|
||||
@@ -80,6 +81,8 @@ static int nsslots;
|
||||
static nvn_hmap samplers = {.klen = sizeof(samp_par)};
|
||||
static int nreleased;
|
||||
static uint64_t n_uploads, n_reuploads;
|
||||
// Re-uploads since the last perf line (tex_lock): all, and those of textures a WriteTexels wrote since their last upload.
|
||||
static uint64_t ru_n, ru_bytes, ru_ns, ru_wt_n, ru_wt_bytes, ru_wt_ns;
|
||||
// TOTK_TEX_ALIAS (default on; =0: a new image over live storage starts empty): a new descriptor over the storage of a
|
||||
// live image that the GPU wrote gets that image's content (alias_copy). Counts since the last log line.
|
||||
static int tex_alias = -1;
|
||||
@@ -514,7 +517,7 @@ static void upload(Tex *e) {
|
||||
const nvn_texdesc *d = &t->d;
|
||||
int bw, bh, bpb = nvn_fmt_bpb(d->format, &bw, &bh);
|
||||
if (!bpb || !t->mem) return;
|
||||
uint64_t p0 = perf_begin();
|
||||
uint64_t p0 = perf_begin(), u0 = kern_now_ns();
|
||||
int linear = nvn_tex_is_linear(d), is3d = d->target == NVN_TEXTURE_TARGET_3D, one_d = e->pub.type == VK_IMAGE_TYPE_1D;
|
||||
uint32_t levels = linear ? 1 : e->pub.levels, layers = linear ? 1 : e->pub.layers;
|
||||
int astc = e->f.astc_bw != 0, rgb = e->f.expand_rgb;
|
||||
@@ -594,8 +597,21 @@ static void upload(Tex *e) {
|
||||
free(raw_copy);
|
||||
free(ar);
|
||||
free(rg);
|
||||
if (e->uploaded) n_reuploads++, perf_count(PERF_CNT_TEX_REUP);
|
||||
else n_uploads++, perf_count(PERF_CNT_TEX_UP);
|
||||
uint64_t dt = kern_now_ns() - u0;
|
||||
if (e->uploaded) {
|
||||
n_reuploads++, perf_count(PERF_CNT_TEX_REUP);
|
||||
ru_n++, ru_bytes += t->L.size, ru_ns += dt;
|
||||
if (e->wt_n) {
|
||||
ru_wt_n++, ru_wt_bytes += t->L.size, ru_wt_ns += dt;
|
||||
if (rt_trace & RT_TRACE_PERF)
|
||||
rt_log("perf: frame %llu: re-upload after %u WriteTexels: texture %#llx fmt %#x %ux%u, %.1f KiB, %.3f ms",
|
||||
(unsigned long long)__atomic_load_n(&gfx_counters.frames, __ATOMIC_RELAXED), e->wt_n,
|
||||
(unsigned long long)e->pub.addr, d->format, d->width, d->height, t->L.size / 1024.0, dt / 1e6);
|
||||
}
|
||||
} else {
|
||||
n_uploads++, perf_count(PERF_CNT_TEX_UP);
|
||||
}
|
||||
e->wt_n = 0;
|
||||
e->uploaded = 1;
|
||||
e->n_up++;
|
||||
perf_end(PERF_TEX, p0);
|
||||
@@ -972,6 +988,10 @@ void vk_texture_new_submit(void) {
|
||||
(unsigned long long)f * 60, (unsigned long long)n_alias_copied, (unsigned long long)n_alias_upload,
|
||||
(unsigned long long)n_alias_uninit);
|
||||
n_alias_copied = n_alias_upload = n_alias_uninit = 0;
|
||||
rt_log("perf: frame %llu: texture re-uploads %llu (%.1f MiB, %.2f ms), after WriteTexels %llu (%.1f MiB, %.2f ms)",
|
||||
(unsigned long long)f * 60, (unsigned long long)ru_n, ru_bytes / 1048576.0, ru_ns / 1e6,
|
||||
(unsigned long long)ru_wt_n, ru_wt_bytes / 1048576.0, ru_wt_ns / 1e6);
|
||||
ru_n = ru_bytes = ru_ns = ru_wt_n = ru_wt_bytes = ru_wt_ns = 0;
|
||||
uint64_t ck, calls, untr;
|
||||
vk_mem_snap_stats(&ck, &calls, &untr);
|
||||
rt_log("perf: frame %llu: binding storage checks %llu (texture %llu), write-watch snapshot queries %llu, untracked %llu",
|
||||
@@ -1176,6 +1196,7 @@ void vk_write_texels(const tex_t *t, const view_t *v, const NVNcopyRegion *r, co
|
||||
log_limited(&n_bad, "WriteTexels: region outside level %u of texture %#llx", g.level, (unsigned long long)e->pub.addr);
|
||||
vk_guest_written((uintptr_t)t->mem, t->L.size);
|
||||
if (e->pub.gpu_owned) image_texels(e, &g, r, (uint8_t *)src, 1);
|
||||
else if (e->uploaded) e->wt_n++;
|
||||
} else if (e) {
|
||||
image_texels(e, &g, r, (uint8_t *)src, 1);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,8 @@ def answers(deps, stage, control):
|
||||
"""GfxShaderAnswers in gfx_shader.c pack_answers layout (147 bytes) from the list's deps JSON."""
|
||||
tex, img, fmt, attr, fout = bytearray(32), bytearray(32), bytearray(32), bytearray(32), bytearray(8)
|
||||
for slot, t in deps.get('tex', {}).items():
|
||||
tex[int(slot)] = TEX.index(t.removesuffix('_depth'))
|
||||
t = t.removesuffix('_depth')
|
||||
tex[int(slot)] = TEX.index('2d' if t == '*' else t) # "*": any kind, translated as the plain 2D it stands for
|
||||
for slot, o in deps.get('img', {}).items():
|
||||
img[int(slot)] = TEX.index(o['type'])
|
||||
fmt[int(slot)] = FMT.index(o['fmt']) if o.get('fmt') in FMT else 0
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
# rumble_strength = 130
|
||||
# rumble_curve = 0.6
|
||||
# rumble_triggers = 0
|
||||
# Mouse camera sensitivity (0 to 10; 0 = no mouse camera and no cursor capture).
|
||||
# mouse_sens = 1
|
||||
# Remap buttons, one line per Switch button: bind_<A B X Y L R ZL ZR PLUS MINUS LEFT UP RIGHT DOWN LCLICK RCLICK> =
|
||||
# comma separated pad:<name> and key:<name> entries, or none. A line replaces that button's defaults (pad and keyboard);
|
||||
# buttons without a line keep them. Invalid entries are logged and skipped.
|
||||
|
||||
Reference in new issue
Block a user