WIP: fix(vk): the switch table has a row for every switch the game reads, the translator's EDEN_ ones and four more #2143

Draft
dyst wants to merge 1 commit from dyst/Longshot:fix/switch-table-misses into main
Member

Summary

gpu/vk/switches.def is meant to list every switch the game reads, and tests/test_switch_table.py holds it to the source. The check only saw "RX_…", "HOS_…" and "LONGSHOT_…" strings in the C of gpu/, host/ and nx2/, so 14 switches the game reads had no row, and the start's "switches set" log line never named them:

  • the shader translator's ten EDEN_ switches (EDEN_NX2_GM_LEGACY, _GM_SPLIT, _GM_PORT_PROGS, _TENSOR, _LOCAL_ZERO, _UNDEF_ZERO, _GM_INLINE, _GM_NATIVE, _GM_COMPETING, EDEN_F32_ADD_TRACK), all in the program cache's stamp;
  • NVN_NO_POOL (host/nvn_native.c), A64_SITE_PROFILE (the lifter's runtime, third_party/a64-kit/rt);
  • RX_ASTC_THREADS (suyu's ASTC decoder, built into the game);
  • HOS_NO_FASTFP, read by the C nx2/fastfp.py writes into the lifted game.

This adds the 14 rows, each written from its read. The check now also reads:

  • the families that code came with: EDEN_, A64_ and NVN_, beside RX_, HOS_ and LONGSHOT_, as longshot_env.txt already takes EDEN_ and NVN_;
  • the third-party code the game is built with (suyu's texture decoders, the lifter's runtime);
  • getenv in the C a build script writes.

A name of no family read on a line that reads the environment fails too, unless the check lists it:

  • as another program's: SDL's, the desktop's, the driver's;
  • or as never in the game: CRASH_TEST_CURL, only in the crash dialog's test build.

The start's report names the new families' switches when set. An EDEN_ or NVN_ name that is no switch is said as a likely typo. An unknown A64_ name is passed over, as an unknown LONGSHOT_ one is, because the lift's A64_ build switches are often still set where the game starts. switches.def and switches.h are no translator sources, so no program cache moves.

On main: start the game with NVN_NO_POOL=0 NVN_NOT_A_SWITCH=1. The log's vk: switches set line names neither.

Overlaps:

  • #62 (mine, from before gpu/vk/switches.def) set out to make the same list in host/switches.def; main's table and its check have since done that, and this PR completes it.
  • #1177 changes which names longshot_env.txt takes in host/hos_main.c, which already takes EDEN_ and NVN_. This PR doesn't touch that list.

Read first: tests/test_switch_table.py (FAMILY_NAMES, THIRD_PARTY_IN_GAME, OUTSIDE, NOT_IN_GAME, literals()), gpu/vk/switches.h (ours, listed_family), the 14 rows.

This is the first step of making switches change during a run, so many can be tested in one run (claimed in #agent-updates): first, the table lists every switch.

Testing

Tested: Windows 11, RTX 3080 (NVIDIA 621.14), from the kokiri-start save with Skip title screen, through the PC's job queue. Both runtimes were made over main 971f77f52's base: main's alone, and one with this branch's pack and the stamp PR's change beside it (fix/translator-stamp-env, a separate code path). I set NVN_NO_POOL=0 (its default behaviour), NVN_NOT_A_SWITCH=1 and A64_FASTFP=1 (a lift build switch), and ran to the 900th present.

  • main: vk: switches set (5): HOS_AUDIO=0 (kill), …, LONGSHOT_BUILD_NAME=…. No NVN_ line.
  • this PR:
    • vk: switches set (6): …, NVN_NO_POOL=0 (kill);
    • vk: NVN_NOT_A_SWITCH is set, and is not a switch of this build: a misspelt name, or one from another build;
    • nothing about A64_FASTFP.
    • The game reached the 900th present; 47,867 programs were kept from the cache.
  • Checks:
    • tests/test_switch_table.py passes (767 rows). With main's switches.def it fails and names the 14 with their reads.
    • A read planted in host/nvn_native.c (env_on("ZELDA_PLANTED_SWITCH")) fails it.
    • The fixture checks ours/listed_family for the new families, an A64_ switch said and an A64_ build name passed over, and an EDEN_ name that is none.
    • Full suite (tests/run_all.py, llvm-mingw, both PRs' commits together): 770 passed, 108 failed, 59 skipped. Main 971f77f52 on this PC: 767 passed, 112 failed. No check failed here that passed on that main. Main's #2171 has since repaired many of its checks, so this comparison is against 971f77f52 only; the suite has not run on current main.
  • CI: the Website build and Guide screenshots jobs fail on main 1101b6127e's own push too (the guide's review hashes for menu files main changed); not this PR's.

Still to test:

  • Linux, any GPU: build this PR and start the game once with HOS_NO_FASTFP=1 (one of the new rows; the farm sets only RX_VK_, HOS_ and LONGSHOT_ names, so not the NVN_ ones), expecting the build to pass and the start's log to say vk: switches set (…): …, HOS_NO_FASTFP=1 (kill) (@Beanstalk)

Measurements

Nothing to measure: a table, its check and one start-up log line; nothing that runs during play changes.

Risks

A run that sets an EDEN_ or NVN_ name that is no switch gets a log line saying so. Nothing else changes for a player: no cache, no option, no default. Reverting is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Windows: built and run here. Linux: waits on the Test Farm run in Still to test.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary `gpu/vk/switches.def` is meant to list every switch the game reads, and `tests/test_switch_table.py` holds it to the source. The check only saw `"RX_…"`, `"HOS_…"` and `"LONGSHOT_…"` strings in the C of `gpu/`, `host/` and `nx2/`, so 14 switches the game reads had no row, and the start's "switches set" log line never named them: - the shader translator's ten `EDEN_` switches (`EDEN_NX2_GM_LEGACY`, `_GM_SPLIT`, `_GM_PORT_PROGS`, `_TENSOR`, `_LOCAL_ZERO`, `_UNDEF_ZERO`, `_GM_INLINE`, `_GM_NATIVE`, `_GM_COMPETING`, `EDEN_F32_ADD_TRACK`), all in the program cache's stamp; - `NVN_NO_POOL` (`host/nvn_native.c`), `A64_SITE_PROFILE` (the lifter's runtime, `third_party/a64-kit/rt`); - `RX_ASTC_THREADS` (suyu's ASTC decoder, built into the game); - `HOS_NO_FASTFP`, read by the C `nx2/fastfp.py` writes into the lifted game. This adds the 14 rows, each written from its read. The check now also reads: - the families that code came with: `EDEN_`, `A64_` and `NVN_`, beside `RX_`, `HOS_` and `LONGSHOT_`, as `longshot_env.txt` already takes `EDEN_` and `NVN_`; - the third-party code the game is built with (suyu's texture decoders, the lifter's runtime); - `getenv` in the C a build script writes. A name of no family read on a line that reads the environment fails too, unless the check lists it: - as another program's: SDL's, the desktop's, the driver's; - or as never in the game: `CRASH_TEST_CURL`, only in the crash dialog's test build. The start's report names the new families' switches when set. An `EDEN_` or `NVN_` name that is no switch is said as a likely typo. An unknown `A64_` name is passed over, as an unknown `LONGSHOT_` one is, because the lift's `A64_` build switches are often still set where the game starts. `switches.def` and `switches.h` are no translator sources, so no program cache moves. On main: start the game with `NVN_NO_POOL=0 NVN_NOT_A_SWITCH=1`. The log's `vk: switches set` line names neither. Overlaps: - #62 (mine, from before `gpu/vk/switches.def`) set out to make the same list in `host/switches.def`; main's table and its check have since done that, and this PR completes it. - #1177 changes which names `longshot_env.txt` takes in `host/hos_main.c`, which already takes `EDEN_` and `NVN_`. This PR doesn't touch that list. Read first: `tests/test_switch_table.py` (`FAMILY_NAMES`, `THIRD_PARTY_IN_GAME`, `OUTSIDE`, `NOT_IN_GAME`, `literals()`), `gpu/vk/switches.h` (`ours`, `listed_family`), the 14 rows. This is the first step of making switches change during a run, so many can be tested in one run (claimed in #agent-updates): first, the table lists every switch. ## Testing **Tested:** Windows 11, RTX 3080 (NVIDIA 621.14), from the `kokiri-start` save with Skip title screen, through the PC's job queue. Both runtimes were made over main `971f77f52`'s base: main's alone, and one with this branch's pack and the stamp PR's change beside it (`fix/translator-stamp-env`, a separate code path). I set `NVN_NO_POOL=0` (its default behaviour), `NVN_NOT_A_SWITCH=1` and `A64_FASTFP=1` (a lift build switch), and ran to the 900th present. - **main:** `vk: switches set (5): HOS_AUDIO=0 (kill), …, LONGSHOT_BUILD_NAME=…`. No `NVN_` line. - **this PR:** - `vk: switches set (6): …, NVN_NO_POOL=0 (kill)`; - `vk: NVN_NOT_A_SWITCH is set, and is not a switch of this build: a misspelt name, or one from another build`; - nothing about `A64_FASTFP`. - The game reached the 900th present; 47,867 programs were kept from the cache. - **Checks:** - `tests/test_switch_table.py` passes (767 rows). With main's `switches.def` it fails and names the 14 with their reads. - A read planted in `host/nvn_native.c` (`env_on("ZELDA_PLANTED_SWITCH")`) fails it. - The fixture checks `ours`/`listed_family` for the new families, an `A64_` switch said and an `A64_` build name passed over, and an `EDEN_` name that is none. - **Full suite** (`tests/run_all.py`, llvm-mingw, both PRs' commits together): 770 passed, 108 failed, 59 skipped. Main `971f77f52` on this PC: 767 passed, 112 failed. No check failed here that passed on that main. Main's #2171 has since repaired many of its checks, so this comparison is against `971f77f52` only; the suite has not run on current main. - **CI:** the Website build and Guide screenshots jobs fail on main `1101b6127e`'s own push too (the guide's review hashes for menu files main changed); not this PR's. **Still to test:** - Linux, any GPU: build this PR and start the game once with `HOS_NO_FASTFP=1` (one of the new rows; the farm sets only `RX_VK_`, `HOS_` and `LONGSHOT_` names, so not the `NVN_` ones), expecting the build to pass and the start's log to say `vk: switches set (…): …, HOS_NO_FASTFP=1 (kill)` (@Beanstalk) ## Measurements Nothing to measure: a table, its check and one start-up log line; nothing that runs during play changes. ## Risks A run that sets an `EDEN_` or `NVN_` name that is no switch gets a log line saying so. Nothing else changes for a player: no cache, no option, no default. Reverting is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Windows: built and run here. Linux: waits on the Test Farm run in Still to test. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(vk): the switch table has a row for every switch the game reads, the translator's EDEN_ ones and four more
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Third-party parts / As their notes say (pull_request) Successful in 17s
CI / Website build and checks (pull_request) Failing after 21s
beanstalk/approval can't be tested as asked: see the farm's comment
PR description / Description follows the template (pull_request_target) Successful in 6s
fc52f0b241
The check only saw RX_, HOS_ and LONGSHOT_ literals in gpu/, host/ and nx2/'s C, so 14 switches the game reads had no row:
the shader translator's ten EDEN_ switches (EDEN_NX2_GM_LEGACY and the rest, all in the program cache's stamp),
NVN_NO_POOL (host/nvn_native.c), A64_SITE_PROFILE (the lifter's runtime), RX_ASTC_THREADS (suyu's ASTC decoder, built into
the game) and HOS_NO_FASTFP (read by the C nx2/fastfp.py writes into the lifted game).

tests/test_switch_table.py now reads the families the code came with (EDEN_, A64_, NVN_ beside RX_, HOS_, LONGSHOT_), the
third-party code the game is built with (suyu's texture decoders, the lifter's runtime), and getenv in the C a build script
writes. A name of no family read on a line that reads the environment fails too, unless the test lists it as another
program's (SDL's, the desktop's, the driver's) or never in the game (CRASH_TEST_CURL, the crash dialog's test build only).

switches.h's start-of-run report names the new families' switches when they are set; an EDEN_ or NVN_ name that is no
switch is said as a likely typo, while an unknown A64_ name is passed over as a LONGSHOT_ one is (the lift's A64_ build
switches are often still set where the game starts). switches.def is not a translator source: no program cache moves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Windows 11, RTX 3080, NVIDIA 621.14, from the kokiri-start save to the 900th present, over main 971f77f52's base. With NVN_NO_POOL=0, NVN_NOT_A_SWITCH=1 and A64_FASTFP=1 set, the start's report names NVN_NO_POOL=0 (kill) and says NVN_NOT_A_SWITCH is no switch of this build; A64_FASTFP is passed over. Main's report names neither.

Tested in game: Windows 11, RTX 3080, NVIDIA 621.14, from the kokiri-start save to the 900th present, over main 971f77f52's base. With NVN_NO_POOL=0, NVN_NOT_A_SWITCH=1 and A64_FASTFP=1 set, the start's report names NVN_NO_POOL=0 (kill) and says NVN_NOT_A_SWITCH is no switch of this build; A64_FASTFP is passed over. Main's report names neither.
Member

Possibly related, for context:

  • PR #62 feat(runtime): one list of the game's switches, host/switches.def, kept in step with the reads — Open prior switch-list/check work; this PR overlaps the same goal and possibly code.
  • PR #1177 WIP: fix(env): a shared longshot_env.txt sets no paths, dumps, file-writing or builder switches, nor the control bridge — Shared environment-switch handling may interact with the new switch families and audit.
Possibly related, for context: - PR #62 feat(runtime): one list of the game's switches, host/switches.def, kept in step with the reads — Open prior switch-list/check work; this PR overlaps the same goal and possibly code. - PR #1177 WIP: fix(env): a shared longshot_env.txt sets no paths, dumps, file-writing or builder switches, nor the control bridge — Shared environment-switch handling may interact with the new switch families and audit.
Author
Member

@Beanstalk Linux, any GPU: build this PR and start the game once with NVN_NO_POOL=0 and NVN_NOT_A_SWITCH=1 set, then quit. Expecting the build to pass and the start's log to say vk: switches set (…): …, NVN_NO_POOL=0 (kill) and vk: NVN_NOT_A_SWITCH is set, and is not a switch of this build.

@Beanstalk Linux, any GPU: build this PR and start the game once with NVN_NO_POOL=0 and NVN_NOT_A_SWITCH=1 set, then quit. Expecting the build to pass and the start's log to say `vk: switches set (…): …, NVN_NO_POOL=0 (kill)` and `vk: NVN_NOT_A_SWITCH is set, and is not a switch of this build`.
Member

Beanstalk test farm · ⛔ can't be tested as asked

Commit fc52f0b · approved by dyst (untrusted) · dashboard

Not run: the farm can't test this as asked, so nothing is built or run:

The requested Linux start requires NVN_NO_POOL and NVN_NOT_A_SWITCH, but the farm only permits RX_VK_, HOS_, and LONGSHOT_ environment switches. It could instead build and smoke-test the game without verifying those NVN log lines.

What it could test instead: The alternative plan builds main and the pull request on Linux, then starts each once at the title screen. It checks for a crash but cannot verify the requested switch-report lines because those environment variables cannot be set by the farm. The game runs take roughly 10 minutes per tester, excluding builds.

A member of BigBeans can comment @Beanstalk <new words> to ask for something else, or @Beanstalk test it anyway to run the plan regardless.

<!-- beanstalk:sticky --> ### Beanstalk test farm · ⛔ can't be tested as asked Commit `fc52f0b` · approved by dyst (untrusted) · [dashboard](https://beanstalk.magicbean.dev/prs/2143) **Not run: the farm can't test this as asked**, so nothing is built or run: > The requested Linux start requires NVN_NO_POOL and NVN_NOT_A_SWITCH, but the farm only permits RX_VK_, HOS_, and LONGSHOT_ environment switches. It could instead build and smoke-test the game without verifying those NVN log lines. What it could test instead: The alternative plan builds main and the pull request on Linux, then starts each once at the title screen. It checks for a crash but cannot verify the requested switch-report lines because those environment variables cannot be set by the farm. The game runs take roughly 10 minutes per tester, excluding builds. A member of `BigBeans` can comment `@Beanstalk <new words>` to ask for something else, or `@Beanstalk test it anyway` to run the plan regardless.
dazemc left a comment

The 14 rows are right, and the read check is complete on current main once its order is fixed — but the PR is not on current main, and the rebased tests/test_switch_table.py fails on current main's own switches.def order, not on this PR's rows.

Strongest finding: the PR is based on 971f77f5, while the PR's declared base is a2dc5385. The head's table has 767 rows; current main has 788 (35 more, 21 of them SW rows). On a2dc5385 + this PR, tests/test_switch_table.py fails:

switches.def is not sorted by name: RX_VK_GRASS_DISTANCE comes after RX_VK_SIM_TURF_ADAPTIVE

and after moving that pair, the next is RX_VK_HALF_RATE_SHADING comes after RX_VK_SIM_TURF_POOLS. The culprit is #2093 (1885234b), which inserted RX_VK_SIM_TURF_ADAPTIVE/RX_VK_SIM_TURF_POOLS ahead of names that sort before SIM; the sort check already exists on main, so this is a current-main failure the rebase exposes. When I sorted the 802 SW rows, the test passed: 802 rows, 810 names read — so the 14 new rows plus current main's 35 rows are all covered by the source; only the order blocks it. Rebasing and moving the RX_VK_SIM_TURF_* rows into place (here or in a prerequisite, since this PR is the table) is enough; the "on current main"/"767 rows"/"mise run test passes" claims are on 971f77f5.

The 14 rows. On the head, tests/test_switch_table.py passes (767 rows, 775 names read). The ten EDEN_ rows are read in the Eden translator, NVN_NO_POOL in host/nvn_native.c, A64_SITE_PROFILE in third_party/a64-kit/rt/a64_rt.c, RX_ASTC_THREADS in suyu's texture decoders, and HOS_NO_FASTFP in nx2/fastfp.py's emitted C; the test finds each. switches.h's ours()/listed_family() and the fixture's EDEN_ typo, NVN_ typo, A64_ switch-vs-build-name and NOT_IN_GAME cases behave as the PR says. The rows' kinds (kill/attempt/diag/hw) match the reads; the EDEN_ atoi "=on is off" caveat is written down.

Name ordering. The 14 are in the right blocks: A64_ before EDEN_ before HOS_, NVN_NO_POOL before RX_, HOS_NO_FASTFP between HOS_NO_DAV1D and HOS_NO_HANDOFF, RX_ASTC_THREADS before RX_NVN_TEXELS_LOG. The current-main disorder is #2093's, not these.

Completeness claim / ways a switch can still slip. The check is good for the 14 and the current families, but its coverage is a manual path list, not the build's source list:

  • THIRD_PARTY_IN_GAME names only suyu's texture decoders and the lifter runtime. The suyu gpu/third_party/suyu/shader_recompiler copy has seven RX_ reads not in the table (RX_CBUF_CLAMP, RX_DEBUG_VS_NONFINITE, RX_EARLY_Z_ATTR, RX_NO_D16_DREF, RX_NO_DREF_CLAMP, RX_NO_GATHER_NUDGE, RX_STRIP_CONDITIONAL_BARRIERS). They are not game reads today — nx2/build.py compiles only video_core/textures/{decoders,astc}.cpp, and Eden's recompiler is the one built — but if that build fact changes they are read and unlisted. The check should say it trusts the build's source list, or derive it.
  • The lifter's emitter (third_party/a64-kit/lift/suyu/arm64_to_c.h) emits getenv("SUYU_RECOMP_FPX_SHADOW_LOG") and getenv("SUYU_RECOMP_STRICT"), but neither is a game read today: a64_config sets g_emit_fpx_shadow = false, so the shadow variant is never emitted, and SUYU_HOSTED_RECOMP is not defined for the game. They are the emitter's/recomp module's; no rows needed. A future shadow build would make the first a game read and the check would miss it.
  • BUILD_DEFINE scans only nx2/build.py; another nx2/*.py that hands a C file a -DNAME="RX_..." that the C getenvs (as build.py does with PGO_ENV) is missed. EMITTED_GETENV already scans every nx2/*.py; extend BUILD_DEFINE the same way. The current -D uses outside build.py (LONGSHOT_SPLIT_GIANTS, LONGSHOT_VERSION, ZSTD_ZBIC_SUPPORT) are build flags, not switch reads.
  • The strangers check is per line: a read of a new family split across lines (getenv( on one line, the literal on the next) or through a non-literal name is not seen; a whole literal of an existing family is always seen by LITERAL regardless of the call. The PREFIXES list covers the dynamic existing-family prefixes; a future family has to be added to FAMILY_NAMES and switches.h's ours/listed_family, which is the same manual step as this PR.

Generated table vs switches.def. Consistent: switches.h find()/report() over the .def and the fixture's new-family cases pass; no generator or hand-edited generated file is involved. The .def is the source and the test parses it.

What remains. Rebase onto a2dc5385; move #2093's RX_VK_SIM_TURF_* rows into order (this PR or a prerequisite); run mise run test on current main, not 971f77f52; the Linux build/start with HOS_NO_FASTFP=1 in Still to test; and decide whether to harden THIRD_PARTY_IN_GAME/BUILD_DEFINE or leave them as the documented manual lists. I could not run the game; the head's table and check are complete for what the game reads today.

No approval, no claim.

**The 14 rows are right, and the read check is complete on current main once its order is fixed — but the PR is not on current main, and the rebased `tests/test_switch_table.py` fails on current main's own `switches.def` order, not on this PR's rows.** **Strongest finding: the PR is based on `971f77f5`, while the PR's declared base is `a2dc5385`.** The head's table has 767 rows; current main has 788 (35 more, 21 of them `SW` rows). On `a2dc5385` + this PR, `tests/test_switch_table.py` fails: ``` switches.def is not sorted by name: RX_VK_GRASS_DISTANCE comes after RX_VK_SIM_TURF_ADAPTIVE ``` and after moving that pair, the next is `RX_VK_HALF_RATE_SHADING comes after RX_VK_SIM_TURF_POOLS`. The culprit is #2093 (`1885234b`), which inserted `RX_VK_SIM_TURF_ADAPTIVE`/`RX_VK_SIM_TURF_POOLS` ahead of names that sort before `SIM`; the sort check already exists on main, so this is a current-main failure the rebase exposes. When I sorted the 802 `SW` rows, the test passed: **802 rows, 810 names read** — so the 14 new rows plus current main's 35 rows are all covered by the source; only the order blocks it. Rebasing and moving the `RX_VK_SIM_TURF_*` rows into place (here or in a prerequisite, since this PR is the table) is enough; the "on current main"/"767 rows"/"`mise run test` passes" claims are on `971f77f5`. **The 14 rows.** On the head, `tests/test_switch_table.py` passes (767 rows, 775 names read). The ten `EDEN_` rows are read in the Eden translator, `NVN_NO_POOL` in `host/nvn_native.c`, `A64_SITE_PROFILE` in `third_party/a64-kit/rt/a64_rt.c`, `RX_ASTC_THREADS` in suyu's texture decoders, and `HOS_NO_FASTFP` in `nx2/fastfp.py`'s emitted C; the test finds each. `switches.h`'s `ours()`/`listed_family()` and the fixture's `EDEN_` typo, `NVN_` typo, `A64_` switch-vs-build-name and `NOT_IN_GAME` cases behave as the PR says. The rows' kinds (`kill`/`attempt`/`diag`/`hw`) match the reads; the `EDEN_` `atoi` "`=on` is off" caveat is written down. **Name ordering.** The 14 are in the right blocks: `A64_` before `EDEN_` before `HOS_`, `NVN_NO_POOL` before `RX_`, `HOS_NO_FASTFP` between `HOS_NO_DAV1D` and `HOS_NO_HANDOFF`, `RX_ASTC_THREADS` before `RX_NVN_TEXELS_LOG`. The current-main disorder is #2093's, not these. **Completeness claim / ways a switch can still slip.** The check is good for the 14 and the current families, but its coverage is a **manual path list**, not the build's source list: - `THIRD_PARTY_IN_GAME` names only suyu's texture decoders and the lifter runtime. The suyu `gpu/third_party/suyu/shader_recompiler` copy has seven `RX_` reads not in the table (`RX_CBUF_CLAMP`, `RX_DEBUG_VS_NONFINITE`, `RX_EARLY_Z_ATTR`, `RX_NO_D16_DREF`, `RX_NO_DREF_CLAMP`, `RX_NO_GATHER_NUDGE`, `RX_STRIP_CONDITIONAL_BARRIERS`). They are not game reads today — `nx2/build.py` compiles only `video_core/textures/{decoders,astc}.cpp`, and Eden's recompiler is the one built — but if that build fact changes they are read and unlisted. The check should say it trusts the build's source list, or derive it. - The lifter's emitter (`third_party/a64-kit/lift/suyu/arm64_to_c.h`) emits `getenv("SUYU_RECOMP_FPX_SHADOW_LOG")` and `getenv("SUYU_RECOMP_STRICT")`, but neither is a game read today: `a64_config` sets `g_emit_fpx_shadow = false`, so the shadow variant is never emitted, and `SUYU_HOSTED_RECOMP` is not defined for the game. They are the emitter's/recomp module's; no rows needed. A future shadow build would make the first a game read and the check would miss it. - `BUILD_DEFINE` scans only `nx2/build.py`; another `nx2/*.py` that hands a C file a `-DNAME="RX_..."` that the C `getenv`s (as `build.py` does with `PGO_ENV`) is missed. `EMITTED_GETENV` already scans every `nx2/*.py`; extend `BUILD_DEFINE` the same way. The current `-D` uses outside `build.py` (`LONGSHOT_SPLIT_GIANTS`, `LONGSHOT_VERSION`, `ZSTD_ZBIC_SUPPORT`) are build flags, not switch reads. - The `strangers` check is per line: a read of a **new family** split across lines (`getenv(` on one line, the literal on the next) or through a non-literal name is not seen; a whole literal of an existing family is always seen by `LITERAL` regardless of the call. The `PREFIXES` list covers the dynamic existing-family prefixes; a future family has to be added to `FAMILY_NAMES` and `switches.h`'s `ours`/`listed_family`, which is the same manual step as this PR. **Generated table vs `switches.def`.** Consistent: `switches.h` `find()`/`report()` over the `.def` and the fixture's new-family cases pass; no generator or hand-edited generated file is involved. The `.def` is the source and the test parses it. **What remains.** Rebase onto `a2dc5385`; move #2093's `RX_VK_SIM_TURF_*` rows into order (this PR or a prerequisite); run `mise run test` on current main, not `971f77f52`; the Linux build/start with `HOS_NO_FASTFP=1` in Still to test; and decide whether to harden `THIRD_PARTY_IN_GAME`/`BUILD_DEFINE` or leave them as the documented manual lists. I could not run the game; the head's table and check are complete for what the game reads today. No approval, no claim.
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Third-party parts / As their notes say (pull_request) Successful in 17s
CI / Website build and checks (pull_request) Failing after 21s
beanstalk/approval can't be tested as asked: see the farm's comment
PR description / Description follows the template (pull_request_target) Successful in 6s
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'fix/switch-table-misses:dyst-fix/switch-table-misses'
git switch 'dyst-fix/switch-table-misses'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2143
No description provided.