Commit Graph
932 Commits
Author SHA1 Message Date
Valiantsin DzerakhandClaude Opus 5.5 c8b88f7428 Demote a discard only where a derivative follows it, and read demote from the ini (#164, #1365)
spirv_demote turned every OpKill inside a selection into OpDemoteToHelperInvocation on AMD's Windows driver. A
demoted fragment runs the rest of the shader, so every alpha-tested draw (grass, foliage, hair) paid for its
discarded pixels. The cloud fringe of #164 came from OpImageQueryLod after the discard. Now a discard is demoted only
when an OpImageQueryLod, an explicit derivative or a function call follows it in its function; the rest keep the
plain discard, as before 0.4.1. On the field save 1 of 128 shaders with a discard is demoted, and the picture keeps
the fix.

demote has a row in the settings table and a description in totk.ini.example, so demote = 0 or 1 in the ini no
longer logs an unknown key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 08:56:03 +03:00
Valiantsin DzerakhandClaude Opus 5.5 011b80c948 Merge pull request #1408: the IPC probe's request helper clears its reply when the kernel call fails (ICUMADETHIS)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 08:34:47 +03:00
Valiantsin DzerakhandClaude Opus 5.5 a073e6d3c6 Merge pull request #1407: the custom cursor's sampler writes zero colour where it returns zero coverage (ICUMADETHIS)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 08:34:47 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b5b9cc2be8 null_attach reads its switch once at device creation and gives a pass one dummy that covers it, freed with the device (#1343)
With the switch off, the draw path now pays one load of vk_caps.null_attach per gkey_fill and per empty slot in
target_wmask instead of a call into vk_exec.c, and vk_exec_pass_begin one flag test per pass. The switch is read in
vk_caps_init, before the pipeline prewarm makes the first key.

With it on, only empty slots below the pass's last target get a dummy, which is where the pipelines'
colorAttachmentCount ends (vk_pipeline.c target_count); a pass without colour targets keeps none, so a depth-only or
attachment-free pass never gets a 16384-wide image. All empty slots of a pass share one view, and an image serves
every pass it covers with its sample count: 1.4.3 at 1600x896 makes one image of 1.75 MiB instead of three. The
images are destroyed in destroy_all before the allocator goes, and the log line gives each one's size.

The settings row no longer states that empty slots caused #1343: the dumps do not show it. totk.ini.example gets
the player entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:02:38 +03:00
Valiantsin Dzerakh 83e4037f9c Merge commit 'f278e91a' into task/pr1412
# Conflicts:
#	runtime/cfg.c
2026-11-23 19:02:11 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1dad1ef60b Merge pull request #1385: restbl_cache = 1 serves the mods' merged resource size table from the last start when totk.exe, the RomFS image and every mod file are the same (about 0.9 s off a start with The Second Quest); off by default (itaskaev2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:51:57 +03:00
Valiantsin DzerakhandClaude Opus 5.5 3b97936ed3 The kept resource size table is off by default, and its key covers the running totk.exe, the RomFS image and every overlay
restbl_cache now defaults to 0. Its key adds the path and identity of the running exe (a dev or source build that
changes the merge code keeps the VERSION string, so the port version alone served the old table), the RomFS image's
identity, the number of shipped tables and the overlays of the port's own folders, which the old filter left out.
The table's SHA-256 is taken from the bytes the build wrote instead of a read back from disk. A miss logs why the
table is built again. totk.ini.example and docs/settings.md describe the setting, its default and what the key does
not see (a rewrite that keeps size and write time).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:51:01 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8db7f2889f The new menu languages get the Low Latency Auto choice and the description of the Anti-Lag 2 merge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:39:22 +03:00
Valiantsin Dzerakh 2149915fa6 Merge branch 'dev' into task/pr1384 2026-11-23 18:38:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c465183dcc The new menu languages follow the FSR 4 and FSR sharpness catalog ids, and the Vietnamese setup text has the FSR download entries
The eight new menu tables still used UI_MENU_FSR3_SHARPNESS and lacked the four FSR 4 upscaler strings, which dev renamed or added, so the PR did not compile on dev. installer/text/vi.json lacked the six fsr step, phase, warning and checkbox ids. CONTRIBUTING.md lists all twelve menu languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:38:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 05d46f3538 Merge pull request #1385 head: serve the mods' merged resource size table from the last start (itaskaev2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:37:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 e15aae0606 Anti-Lag 2 runs only with reflex = auto, so on and boost keep their old Reflex-only meaning
A player who had reflex = on on an AMD GPU got nothing from it before #1416 and would have got Anti-Lag after an
update without asking for it. on and boost now enable NVIDIA Reflex alone and log the same line as before when it is
missing; auto picks Reflex or Anti-Lag. The Anti-Lag entry point loads with atomics, since the game thread and the
present thread both make the first call, and the TOTK_TRACE=perf latency line keeps its old text unless Anti-Lag is
on. The menu description, docs/settings.md and totk.ini.example say which value turns on what.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:34:39 +03:00
Valiantsin Dzerakh 719cff3a4c Merge commit 'refs/pull/1384/head' of https://github.com/valentderah/totk-pc-recomp into task/pr1384 2026-11-23 18:25:26 +03:00
Valiantsin Dzerakh 8619d1bb3f Merge pull request #1416 head: AMD Anti-Lag 2 in the low latency setting (ripps818)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	runtime/vk_device.c
2026-11-23 18:24:19 +03:00
Valiantsin DzerakhandClaude Opus 5.5 fe8573916e Merge pull request #1368: FSR 3.1 and frame generation skip protected and AMD device-coherent memory types, which gave full-screen noise on RADV; the pick on Windows AMD is unchanged (gurrgur)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:43:36 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f1ec56b592 Merge pull request #1245: AMD FSR 4 upscales the 3D scene on Windows through AMD's signed FSR SDK 2.4 libraries (scene_upscaler = fsr4, off by default), and the setup can download them (codexx-dev) (#1409)
FSR 4 is a fourth engine of the scene upscaler beside DLSS and FSR 3.1 and takes their frame point, jitter, per-object
motion vectors, mip bias, fsr_sharpness, FXAA skip and dynamic resolution hold. The PR's dlaa_backend setting, its
FSR 3 through the DLL and its separate Upscalers row are left out: dev builds FSR 3.1 from the SDK 1.1.4 sources.
Checked on an RX 9070: FSR 4.1.2 at quality, 1280x720 -> 1920x1080, picture clean; without the DLLs the upscaler stays
off with a log line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:39:08 +03:00
Valiantsin DzerakhandClaude Opus 5.5 e3befaebcc Merge pull request #1368: FSR 3.1 and frame generation skip protected and AMD device-coherent memory types (gurrgur)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:29:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9978eb2948 Merge pull request #1371: GPUs without VK_EXT_external_memory_host run on shadow storage instead of being skipped; GPUs with it see no change (ShannoonRuaaa)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:27:33 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d9ecad571d The architecture notes and the vk_pool_init comment say that CPU-visible pools get shadow storage where VK_EXT_external_memory_host is missing, and RenderDoc no longer stops device creation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:27:06 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9469ad0675 Merge pull request #1371: a GPU without VK_EXT_external_memory_host runs on shadow storage (ShannoonRuaaa)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:21:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f9585d984b Merge pull request #1382: on Intel with Mesa ANV a by-region barrier before draws whose vertex shader reads a storage buffer stops the white and dark smoke and sky flashes; off by default, anv_vs_barrier = 1 turns it on (mattheuspaivadini) (#927)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:17:49 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d98996b6e2 Turn the ANV vertex-shader storage barrier off by default on every GPU; players opt in with anv_vs_barrier = 1 (#927)
The barrier costs about 5% of the frame rate on an Iris Xe and was only tested there. TOTK_ANV_VS_BARRIER and anv_vs_barrier still force it on with 1 and off with 0. docs/settings.md says what it fixes, what it costs and that only Intel GPUs with Mesa ANV on Linux are affected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:17:26 +03:00
Valiantsin DzerakhandClaude Opus 5.5 be98dbc336 Merge pull request #1245: AMD FSR 4 as a fourth scene upscaler, scene_upscaler = fsr4 (codexx-dev)
The PR's FSR 4 path (runtime/vk_ffx.c over AMD's FSR SDK 2.4 signed libraries, ffx_api_min.h, the cooperative
matrix and float8 device extensions in vk_device.c), its setup step that downloads amd_fidelityfx_loader_vk.dll and
amd_fidelityfx_upscaler_vk.dll, its notices and the FXAA copy shader hash 0x9d065204aac9766b now serve dev's own
scene upscaler as UPSCALER_FSR4. FSR 4 goes through vk_dlaa.c fsr_evaluate beside FSR 3.1: the same frame point,
jitter, motion vectors with the per-object pass, camera from vk_fg_camera, mip bias, fsr_sharpness, FXAA skip and
dynamic resolution hold.

Dropped from the PR: the dlaa_backend setting, FSR 3 through the DLL and the separate Upscalers row. vk_ffx.c pins
FSR 4 only; a device the libraries offer no FSR 4 for runs with the upscaler off and the menu says so. It keeps one
context per output size with dynamic resolution, like vk_fsr3.cpp, waits on the SDK's ring depth and is released
before the device goes. The menu's scene upscaler row gets "AMD FSR 4" (Windows; marked when the libraries or the
GPU are missing). The setup's FSR box and its strings are in all eleven installer catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:13:20 +03:00
Valiantsin DzerakhandClaude Opus 5.5 3fe8d7a1d9 Mod plugins that hook the middle of game functions, swap pointers in the game's data, use the SD card or switch their hooks during play build in, and may call what the game itself calls; Zonai Fieldworks starts (#1388)
Zonai Fieldworks was refused at several steps; each is now handled:
1. The start-up asked GetInfo 6, 7, 16 and 17 and SetHeapSize; runtime/plugin_init.c serves them.
2. Its start-up calls main where the lift has no function start. The tool names those addresses (--entries-out) and
   the installer lifts again with them as `entry` lines, up to four rounds (installer/steps.py PLUGIN_ENTRY_ROUNDS).
3. Branch hooks into the middle of game functions (far-jump veneers) and pointer swaps in main's data are accepted
   hook kinds; the veneer targets seed the plugin's lift, and an Orig trampoline counts as a seed.
4. Code the start-up writes into the plugin's own .text (hook pads it switches to during play) is found by comparing
   the image before and after the init, and seeds the lift (init_code). Without it the game stopped with "no function
   at guest pc" when a feature switched on.
5. recomp/gen.py: a branch-out alternative on a flag-writing site leaves with the flags from before the site; an inline
   hook may sit on a blr.
6. nn::fs::MountSdCard mounts <profile>/sdcard (runtime/fs_host.c), and nn::settings language codes are answered
   (runtime/ov_system.c).

The import check now also allows what the game's main imports (--exefs, game_imports): the game runs on those paths,
so the runtime serves them. Left out: nn::ro, the C runtime start, the thread-local allocator hook and the shader
compiler. Break in code the hooks reach is allowed (an abort ends the game with the reason, as on the Switch), and
RenameFile, DeleteDirectoryRecursively, Commit and Unmount join the SD card calls. Checked: Zonai Fieldworks, The Second
Quest, Challenge Mode and Material Columns on 1.4.3, Full Inventory Expansion, Quick Weapon Durability and Magic of the
Kingdom on 1.2.1 accepted; UltraCam's init still crashes its service run. Plain lift unchanged; probes 4/4 on both
versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:35:59 +03:00
ripps818andClaude Sonnet 5.5 84e44f3aed Add AMD Anti-Lag 2 to the low latency setting, with an auto value that picks Reflex or Anti-Lag for the GPU
The reflex setting gains an auto value. With auto, on or boost the device uses NVIDIA Reflex when the driver has VK_NV_low_latency2, otherwise AMD Anti-Lag 2 when it has VK_AMD_anti_lag (Mesa RADV, AMD's Windows driver); with neither it does nothing. Anti-Lag marks the INPUT stage where the window texture is acquired and the PRESENT stage just before vkQueuePresentKHR, with the pacer's frame limit as maxFPS. The default stays off. The menu row is renamed Low Latency in all four languages.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 23:24:48 -06:00
Ruan Shannon f278e91a7c null_attach = 1 gives empty colour slots a dummy attachment instead of a null view (Intel legacy driver crash, #1343)
On an HD 520 with Intel's legacy Windows driver (101.2125, Vulkan 1.3.215) the game faults inside vkCmdBeginRendering
(igvk64.dll+0x5cfab2/+0x5cfab9, frames +0x5c42dd and +0x548235) right after the logo, with the recorder on or off and
with import or mirror memory. The driver reads an attachment entry of the pass that is null. vk_exec_pass_begin leaves
imageView VK_NULL_HANDLE in every colour slot without a target, which Vulkan allows, and the first pass of a boot that
has one is the 1600x896 scene G-buffer pass (slots 2 and 4 empty), the render area of the reported crash.

With TOTK_NULL_ATTACH=1 such a slot gets a view of a dummy R8_UNORM image of the pass's size, layer and sample count
(one per shape, made once, GENERAL, DONT_CARE load and store), and the pipelines name that format for it with the writes
masked off (vk_pipeline.c gkey_fill, target_wmask), so views and pipelines agree. Off by default: nothing changes, and
pipeline keys stay as they were. Untested on the affected driver; Iris Xe (101.7092) plays the same with it on.
2026-11-22 16:49:02 -08:00
mattheuspaivadiniandClaude Sonnet 5.5 5b15fc0df6 Keep fb_dirty across the ANV vertex-storage barrier, so feedback_prepare still learns the feedback targets (#927)
feedback_barrier clears fb_dirty, and feedback_prepare learns which targets go into the feedback layout from m & fb_dirty. A barrier recorded only for a vertex shader's storage read could hide a later attachment read from it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 21:05:13 -03:00
ICUMADETHIS 2ec4b3f04b Clear IPC probe replies after kernel failures 2026-11-22 21:34:13 +00:00
ICUMADETHIS 362fcfb3b7 Initialize transparent custom cursor samples 2026-11-22 21:24:54 +00:00
PC ab9dcc9bcb The in-game menu comes in Vietnamese: a full text_vi row (every menu id, checked against the English printf specifiers), a Tiếng Việt choice on the Menu tab, vi among the values of menu_lang, and the Latin Extended and Vietnamese ranges in the menu font atlas, which Roboto already covers. The text inside the performance overlay and the DLSS model row keep their English names, and the graphics terms follow common Vietnamese usage (họa tiết, bộ đổ bóng, đường ống, lệnh vẽ, tệp)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
(cherry picked from commit 408c1badfcdad3d85bf06ab09505a6d2669a2427)
2026-11-22 18:41:36 +01:00
mattheuspaivadiniandClaude Opus 5.5 4c95df372a On Mesa's ANV, put a by-region barrier before a draw in a pass whose vertex shader reads a storage buffer (#927)
On an Iris Xe with ANV the half-resolution particle pass drew campfire smoke and clouds as white or dark blobs and
turned the sky white for single frames. Such draws read stale data inside the pass unless the sampler cache is
invalidated first; a stall alone or the attachment flush alone does not help. The barrier is feedback_barrier, which
the feedback loops already record inside passes. TOTK_ANV_VS_BARRIER (anv_vs_barrier) turns it off or on elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:45:13 -03:00
itaskaev2andClaude Opus 5.5 37d49d80d2 The in-game menu and the overlay speak German, French, Spanish, Italian, Dutch, Japanese and Korean, every one of the 670 menu texts, picked from the Windows display language or the Menu tab, with every Chinese Windows on the Simplified Chinese menu (the menu part of pull request #497, completed for today's menu)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:11:26 +01:00
itaskaev2andClaude Opus 5.5 f11987e9a7 Serve the mods' merged resource size table from the last start when the mod files are the same
Building the table opens every mod file and unpacks the mods' packs: about 7 s with an HD texture pack and The Second Quest. restbl_cache = 0 builds it at every start. Split from #1331.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:02:47 +01:00
Ruan Shannon f877aae10e A GPU without VK_EXT_external_memory_host runs the game on shadow storage instead of being skipped
The extension was in vk_device.c k_required_ext, so pick_device skipped every GPU without it ("gpu 0 skipped: missing
extension VK_EXT_external_memory_host") and the game exited: Qualcomm Adreno's Windows driver (issue #161), some older
or mobile drivers, and RenderDoc, which hides it. It is now enabled when present (VkCtx.has_external_memory_host); without
it vk_memory.c mirror_mode turns shadow storage on, the path Wine already takes, so import_pool gives every CPU-visible
pool a host-visible copy instead of an import. vk_mem_class_log runs once the device's extensions are known.
TOTK_VK_NO_HOST_IMPORT=1 takes that path on any GPU, for testing it. Docs no longer list the extension as required.

Iris Xe with a test layer that hides the extension: dev skips the GPU and exits (70); this change plays the sky-island
save (40 s, 39.9 fps, shadow storage logged). With the extension present nothing changes.
2026-11-22 05:01:27 -08:00
Valiantsin Dzerakh e721b582d8 Merge pull request #1333 into task/pr1333 2026-11-22 15:37:46 +03:00
gurrgurandClaude Opus 5.5 ba81204847 FSR 3.1 and frame generation no longer allocate their images in protected or AMD device-coherent memory, which turned the whole picture into noise on RADV
The SDK's findMemoryTypeIndex keeps the last matching memory type, and RADV lists protected (TMZ) and DEVICE_COHERENT_AMD / DEVICE_UNCACHED_AMD device-local types after the plain ones. The runtime enables neither feature, so on a Radeon 780M (Mesa 26.3) every FSR pass read garbage. Those types are now skipped. On unified-memory GPUs (Adreno under Turnip), where every device-local type is host-visible, it falls back to a host-visible device-local type instead of failing every texture allocation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:37:42 +01:00
Valiantsin DzerakhandClaude Opus 5.5 0d8801a253 The FidelityFX SDK sources build with libc++ (llvm-mingw, the Windows release toolchain): ffx_compat.h includes <mutex> for the std::lock_guard in ffx_vk.cpp, which ffx_types.h left to libstdc++'s <shared_mutex>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 08:25:30 +03:00
codexx-devandClaude Opus 5.5 6d077a9a16 FSR skips the game's copy of the scene onto itself with the current translator too
Translator patch 0017 (#1299) adds two support buffer fields every translated shader declares, so the copy shader's
hash changed with it, as FXAA_FS's did. FXAA_COPY_FS now also holds 0x9d065204aac9766b, read from a 1.4.3 run with
FSR on. With the old hash only, the copy stayed and the picture was softer: still view on the Great Sky Island,
1920x1080, render_scale 100, mean absolute Laplacian of luma over 101 shots, 8.09 -> 9.61 (14.93 with the upscaler
off).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:47:56 -03:00
codexx-devandClaude Opus 5.5 c71222fecb Merge upstream dev 25a53e5 into fsr4
Conflicts: runtime/cfg.c keeps dev's FREECAM_* names next to the FSR_* ones; runtime/vk_dlaa.c keeps dev's two
FXAA_FS hashes for translator patch 0017 (#1299) and this branch's FXAA_COPY_FS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 17:41:04 -03:00
shinodanpenandClaude fb252ebf6b Scale the thunderstorm's lightning chances by the frame so a storm above 30 fps has the lightning it has at 30 fps (#1287)
In a thunderstorm the world manager's lightning update (1.4.3 main+0x62aac4, 1.2.1 main+0xab849c) runs once per frame
and draws, each update, a random number in [0, 1) for each of three fixed chances: 0.013333 for a distant bolt (the
effect Far_Lightning), 0.01 to pick a near strike and 0.01 for the environment's lightning flag. Its timers follow the
frame step, the draws do not: above 30 fps a storm has more distant bolts and lightning flags the higher the frame
rate. The new set lightning (TOTK_LIGHTNING_FIX, lightning_fix, on by default) multiplies each chance by the time
object's frame ratio (+0x38), at most 1, on 1.2.1 and 1.4.3: above 30 fps the rates per second of 30 fps, and at 30 fps
and below the game's own chances.

Counted on 1.4.3 in the reporter's storm (205 s with the storm on, Link standing still) with a local build that logs
each draw that succeeds, which this change does not contain: distant bolts 22, 52 and 94 to 96 a minute at 30, 60 and
120 fps with lightning_fix = 0, and 26, 27 and 20 to 24 with lightning_fix = 1, each one a Far_Lightning effect; the
lightning flag 19, 34 and 64 to 80 times a minute of the storm's lightning phase with 0, and 12 to 17 with 1. Near
strikes stayed at 14 to 18 per run at every rate with either value: each lightning phase lets its last pick strike in
the phase after it, where nothing is drawn, and that phase ends with a strike of its own.

On 1.2.1, which the logging build does not cover, the distant bolts were counted in screenshots of a storm in Hyrule
Field (one every 0.2 s of game time, a detector of thin bright lines, each counted screenshot checked by eye at 30 fps
and at 120 fps with lightning_fix = 1, a sample of 48 with 0): 19 screenshots with a distant bolt a minute at 30 fps,
about 61 at 120 fps (105 to 107 fps in the storm) with lightning_fix = 0, and 15 with lightning_fix = 1. The same count
on the 1.4.3 runs gives 25 to 26, 65 to 68 and 16 to 20 a minute: at high rates it misses bolts that share a
screenshot.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-21 15:24:43 +00:00
Valiantsin DzerakhandClaude Opus 5.5 d27ba2eb9f Merge task/overlap: sync_ahead = 1 also works without shadow storage on a discrete GPU, as Savage Wind's overlap: the GPU reads the game's memory in place behind guards (staged mirror syncs, word-merged write-backs, CPU deswizzle of rewritten textures, invalidates that wait for their writer, one-off small targets), and TOTK_SYNC_AHEAD=check measures what a late wait would race; off by default. On machine B the frame is 1.0 ms (fort) to 2.3 ms (islands) shorter with the 1% lows within noise (#1129, #1192)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 15:07:57 +03:00
Valiantsin DzerakhandClaude Opus 5.5 54b4e092cd The in-place frame ahead merges every mirror write-back by words, is refused with import memory, and the probe checks its pending-write list
Without shadow storage a plain GPU copy back into a mirrored range lands after the game, told the value is done a
frame early, may have written other words of that range for the next frame; with TOTK_SYNC_AHEAD_WBMERGE (1 by
default) the copies' and updates' write-backs go through the word merge as a shader's do. With memory = import the
GPU reads vertex, index and storage data in place, and a check run on the islands saw the game rewrite about 10 KiB of
them a frame after the wait, so the switch is refused there unless shadow storage is on. --probe-vkmem checks the
pending-write list (newest writer below a bound, pruning, joining when full). The one-off readback rule copied from
Savage Wind gets its THIRD_PARTY_NOTICES.md row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 14:43:45 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b558317a7a TOTK_SYNC_AHEAD=1 works without shadow storage: the frame wait is answered one frame late with the GPU reading the game's memory in place, as Savage Wind does
With shadow off the back end turns on guards, each with its own switch: the mirror syncs copy the synced pages into staging on the CPU at submit and wait for an earlier write-back into the same range first (TOTK_SYNC_AHEAD_MSYNC), a texture the CPU rewrote takes the CPU deswizzle (TOTK_SYNC_AHEAD_DESWZ), an invalidate of a range not read lately waits for the pending GPU write into it, from a bounded list pruned at completion (TOTK_SYNC_AHEAD_READS), and the frame wait waits up to the value of a one-off small target (Savage Wind's 16-frame, 64-entry rule, TOTK_SYNC_AHEAD_ONESHOT) or, off by default, of a samples-passed report (TOTK_SYNC_AHEAD_QUERIES). TOTK_SYNC_AHEAD_CHECK=1 runs the check-mode detector with the late wait itself. The shadow form and the default are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 10:42:03 +03:00
Valiantsin DzerakhandClaude Opus 5.5 df10f20fe4 The sync-ahead check's offender table counts a frame once per pool and class
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 10:19:26 +03:00
Valiantsin DzerakhandClaude Opus 5.5 eec2314584 The sync-ahead check skips repeated notes without the lock and looks up memory state once per range
A binding the replay resolves again in the same submission hits a per-thread table of the last notes, and the byte
compare walks the memory state once per union range instead of once per written page: the check's game-thread cost on
the islands bench went from 5-9 to about 3 ms a frame. The log line gives the notes taken and the time of each step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 09:47:44 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f5fbe9df15 The sync-ahead check counts every frame as if the GPU were behind, and compares bytes as well as written pages
Whether the game writes what the GPU still reads does not depend on this machine's timing, so check mode now takes the
late wait's value at every frame wait (the frames where the GPU really was behind are counted apart). The set's bytes
are copied at the snap: a written page counts its changed bytes too, and the mirror sync copies are narrowed to the
bytes the frame binds from the mirror (class bound), since a page written only outside them races nothing it reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 09:42:18 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1ab3856fdd TOTK_SYNC_AHEAD=check measures what a one-frame-late frame wait without shadow storage would race, with the wait left exact
The replay notes each GPU-timeline access of guest memory with its submission's value (in-place bindings of imported
pools without a mirror, mirror sync copies, GPU deswizzle sources, mirror write-backs); at the frame wait the notes of
the frame the late wait would leave running form its read set, snapped with the write watch and checked again at the
next frame-wait entry. Invalidates and small-target write-backs of GPU results from that frame count as stale
readbacks. One summary line per second and a run summary with the largest offenders by pool (runtime/vk_ahead.c).
--probe-vkmem checks the detector with a synthetic write after the wait; tests/sync_ahead_check.py checks that check
mode keeps the wait exact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 09:19:54 +03:00
kliksoandClaude Opus 5.5 14fa37a318 A switch to turn off the perf trace's dirty census, which slows a traced Steam Deck run by about 3% (#946)
TOTK_PERF_CENSUS=0 (perf_census in totk.ini) keeps TOTK_TRACE=perf and its frame lines but skips the write-watch
queries the census makes at every submit, so a perf trace on Linux measures the frame without them. On an LCD Steam
Deck at Lookout Landing (dev, three interleaved runs each) the census costs about 0.8 ms a frame: 38.0-38.3 fps with
it, 39.1-39.4 fps without, 1% low 30.5-31.5 against 32.1-33.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 19:00:13 +00:00
Valiantsin DzerakhandClaude Opus 5.5 22794ab332 Merge task/fg into task/fsr31: frame generation's per-object motion vectors and its contexts kept across dynamic resolution, on one motion gate with FSR 3.1
vk_objmv_wanted is FSR 3.1's latched upscaler half (DLSS with NGX up, or FSR 3.1 picked at start) or frame generation following the scene with its objects (vk_fg_objects_on), and vk_mvprev_frame turns the tables on for the running upscaler or for frame generation. vk_usnap.c keeps this branch's host regions: a region's host flag says whether this submission wrote its host copy, which covers frame generation going on and off live without fg's separate U.host pointer. The jitter fix in mv_pass stays a single copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 20:15:40 +03:00
Valiantsin DzerakhandClaude Opus 5.5 49e8e92fe9 Merge dev into task/fg: the jitter fix for the per-object motion vectors (#1126) and the setup window work
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 20:12:32 +03:00