SPIR-V leaves a register read before any write undefined and Mesa folds undefined values freely. The unconditional patch 0014 guarded against that and was taken out in #701 because the whole picture shook with DLSS on NVIDIA. Patch 0016 brings the zero start back behind a zero_locals job flag, which vk_caps_driver turns on for RADV, ANV and NVK. TOTK_ZERO_LOCALS overrides it, and gfx_shader_set_host mixes it into the translator identity so the variant has its own cache keys.
FXAA_FS gains the flag-on hash of the game's FXAA shader, so vk_dlaa_skip_draw knows it on Mesa too. A game run with TOTK_ZERO_LOCALS=1 on an RX 9070 produced that hash; a TOTK_FXAA=0 run logged no skip with either hash, so the switch itself is not confirmed.
All 29736 stored 1.4.3 inputs translate with the flag off and on, 0 spirv-val failures. FXAA hashes to 5c43ae18948d52cb with the flag off and aad42238801d31d8 with it on. Flag-on output matches the old translator byte for byte on a sample of 312 shaders. Not run on a Mesa driver.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Patch 0014 gave every function-local variable of a translated shader an OpConstantNull initializer. On an RTX 4080
SUPER with game 1.4.3 that made the whole picture move by about 0.9 output pixels a frame whenever DLSS or DLAA runs,
with a still camera (#612). The shake follows the DLAA jitter (TOTK_DLAA_JITTER=0 removes it) and goes away with the
v0.3.7 runtime and a translator built without this one patch. Patches 0012, 0013 and 0015 stay.
docs/maxwell.md 3.12 now says that registers read before any write have no fix for now; a zero start for Mesa only, or
for the shaders that need it, is still open.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- BFE / BFI (patch 0012): a field past bit 31 is cut there, one that starts past it extracts 0 (signed: bit 31
repeated) and inserts nothing, as PTX bfe / bfi. Clamped only where the field is not a constant inside the word.
1.4.3's Depths terrain vertex shaders (42 variants, 134 extracts) compute the position as ((2y + x) * 8) & 0xff,
up to 248; AMD's bitfield instructions take it modulo 32. UltraTears saw the Depths walls and ground missing on
RADV (Steam Deck, RX 570).
- SHF by 0 (patch 0013) gives the unshifted word instead of shifting the other one by 32. Every register SHF of
1.4.3 pairs its word with 0, so 1.4.3 results do not change.
- Function-local variables start at 0 (patch 0014): a register read on a path that never wrote it is no longer an
undefined value Mesa may fold.
All 12,454 1.4.3 shaders translate and pass spirv-val. RX 9070, Depths save: the same picture before and after.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TotK's terrain shaders fill the gradient registers of a texture-with-derivatives instruction per coordinate (du/dx, du/dy, dv/dx, dv/dy), while the translator takes the first two registers as dPdx and the last two as dPdy. The mip level then came from the wrong derivatives and was too sharp on terrain faces turned across the screen, so patches that followed the faces crawled when the camera moved.
After a shader loads, every two-dimensional gradient pair has its inner components swapped by two new composite constructs, so the shader cache is untouched. TOTK_TXD_TRANSPOSE=0 turns it off. The finding is row 2.13 of docs/maxwell.md.
Each frame the engine sizes its shadow cascades to the area they cover (main+0xcebdf4 in 1.2.1): from 960 down to about
400 near the ground, so leaf shadows turn coarse, and every change of size moves the shadow texels, so they jump instead
of sliding. The Switch does the same; the community mods force a fixed size. The shadow patch set loads the size from
patch page +92 just before the engine rounds it (main+0xcec22c in 1.2.1, 0x683604 in 1.4.3), and the menu's Shadow map size
(shadow_res in totk.ini) chooses it: game, 512, 768, 1024 (default), 1536 or 2048, with the texture heap grown above 960. A write
watch on the size field found the one writer; with the setting, every shadow map in both versions is the fixed size.
recomp/patches.py lists the patch page words in use.
AMD and Intel round a gather coordinate that sits between two texels the other way from Maxwell, so shadow-map
filtering picked the neighbouring texel and drew dark dashes along wall and floor edges that moved with the camera
(docs/maxwell.md 2.10; BotW had the same on AMD). vk_caps.c passes the device's subTexelPrecisionBits to the translator
for every non-NVIDIA GPU, the job carries it as gather_bias, and totk_xlate answers QueryHostGatherBiasPrecision with
it, which turns on Ryujinx's own coordinate bias (TexturePass.InsertCoordGatherBias). The answer joins the translator
identity, so those shaders get their own cache keys. TOTK_GATHER_BIAS=0 turns it off.
The bug form asks for the version on the settings menu's title line instead of the window title, which has none,
points to Copy system info and to logs\totk.log. CONTRIBUTING lists the lifter's differential tests and the commit
message style for pull requests. docs/maxwell.md cites nxnative's notes by name, since nxnative rewrote them and the
line numbers pointed nowhere, and pins the MacNativeGames shorthand to the commit its line numbers were read at.
totk.ini.example gains menu_lang and input_record and points to the menu's Advanced tab for the other keys. AGENTS.md
asks comments to cite upstream code by project, file and function. README: Linux and the Steam Deck are the platforms
planned.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/building.md merges the two toolchain docs and the README build steps, and lists the developer checks. The
Maxwell reference moves to docs/maxwell.md. architecture.md loses the milestone table, controls.md describes timed
script lines and input recording, and the tester guide includes shader preparation.
The agent skills, hooks, playbook, backlog and the study notes on upstream projects are the maintainer's local setup:
.claude/, notes/ and CLAUDE.local.md are ignored now, and tools/worktree.py links them into task worktrees. AGENTS.md
keeps the project rules.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>