fix(vk): the switch table has a row for each switch the source reads again, and a removed switch is no longer read #1527
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1527
Loading…
Reference in a new issue
No description provided.
Delete branch "mooki/Longshot:fix/switch-table-rows"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: fix · Risk: low · Tested on: Linux, RTX 4090, NVIDIA 615.78.08 (in the game to the title, windowless; game-free checks; a Windows cross-build, never run) · Needs: none
TL;DR
The check that keeps the switch table and the source in step has failed on main since #1150 merged, and two more pull requests have added to it: eight names disagree. Seven switches are read but have no row in the table, and one removed switch is still read. This PR adds the seven rows and stops reading the removed one, so a run that sets it gets what the table already says. The check fails on main and passes here, and the suite gives main's failures and no others. I started the game to the title with the removed switch set: the start says it is gone and nothing else changes.
Breakdown
Why
python -I -B tests/test_switch_table.pyholds the table (gpu/vk/switches.def) and the source to each other: everyRX_,HOS_andLONGSHOT_name the source reads has a row, and a removed name is read nowhere. On main @a35130c0it fails with eight lines. It passed on the commit before #1150 (0680a4062) and fails at #1150 (e332a5243), at #280 (6d949cf95) and at #1235 (e9478ed60), checked at each: #1150 added two of the lines, #280 five more and #1235 one.All three pull requests were opened before the table existed (#1300, merged 2026-11-17 01:36) and merged after it. #1150's last rebase (onto main
6438c2ef) was not built or run, as its thread says, which is how a read of a switch #1309 had removed got through. The suite fails many names on every PC (34 on main here), so a new one is easy to read as one of main's own: #280's thread says "fails the same 43 tests as that main on this PC".tests/test_invalidate_quick.pywas failing for the same reason: it readsinvalidateingpu/vk/vk_replay.cppand expects a condition #1309 deleted together with the switch.The issue tracker was searched for the table, its check and each of the eight names (open and closed): nothing is open about this. Twelve open pull requests change
gpu/vk/switches.deffor their own switches; none of them adds, removes or changes one of these eight names, ortests/test_invalidate_quick.py.How to reproduce
Seen on: Linux, RTX 4090 (the check needs no GPU); g++ 16.2.1, Python 3.12.16
Settings and switches: defaults
Steps: at main @
a35130c0, runpython -I -B tests/test_switch_table.py, thenpython -I -B tests/test_invalidate_quick.pyExpected:
ok: ... switches ...from the first,PASS: invalidate_quick's sources ...from the secondActual: the first prints
FAIL: the switch table and the source disagree:and eight lines; the second stops withValueError: substring not foundat its line 55What changed
The table gets a row for each of the seven switches, and the one switch the table calls removed is no longer read. Two commits, each of which stands alone.
invalidate_quickingpu/vk/vk_replay.cppno longer readsRX_VK_INVALIDATE_WAIT(its condition and its two lines of log and comment). That switch madeinvalidatecatch the replay up for every range; #1309 deleted that read and made the name aGONErow ("it does nothing"), and #1150's fast path kept declining for it. Nothing ininvalidatedepends on the name now, so the fast path has no reason to.tests/test_invalidate_quick.pydrops itsquick-waitcase and the switch from its list, and readsinvalidate's texture branch as it is now (itstex_pages_anyreturn, without thealways#1309 removed). Every other assertion and case stays.gpu/vk/switches.defgetsRX_VK_INVALIDATE_QUICK(kill),HOS_VSYNC_YIELD(kill),HOS_SWITCH2(kill, Windows),HOS_NFP_SEARCH,HOS_NFP_TRACEandHOS_SWITCH2_RUMBLE_TEST(diag) andLONGSHOT_NFC_DIR(player), each sorted in its place with what the game does unset and what setting it does, taken from the code and from the rowsdocs/development.mdalready has.Measurements
Nothing to measure: a run that sets no switch does what it did, and the one removed condition reads a switch the table says does nothing.
Flags and settings
This PR adds table rows for seven switches that already exist and stops reading one that was removed; no switch changes its default.
RX_VK_INVALIDATE_QUICK=0still gives the core up at every invalidateRX_VK_INVALIDATE_QUICK=0 (kill)and the invalidates line saysoffRX_VK_INVALIDATE_WAITGONErow)onHOS_VSYNC_YIELDHOS_SWITCH2=0leaves a Switch 2 Pro Controller over USB to a bridge program (Windows)HOS_SWITCH2_RUMBLE_TESTHOS_NFP_SEARCHHOS_NFP_TRACELONGSHOT_NFC_DIRTesting
Tested: in the game first, then game-free; Linux (Omarchy, g++ 16.2.1, Python 3.12.16), RTX 4090, NVIDIA 615.78.08, at head
61ddd5322(on main @a35130c0).RX_VK_VRAM_MB=9000, a fresh profile; buildv3.0.0-rc.7-66-g61ddd5322 (source b5119521), made through the idle queue and the full-build lock over the finished work folder of main310e7c9d, whose lift inputs and HLE set equal this head's: 106 of 522 units new, 63 s; the driver and pipeline caches copied as they were from another worker's warm copy of that main, whose game was running at that moment; the log shows the program cache loaded:47867 program keys kept). Three starts of 200 s each, to the title screen (the last picture of each is the title; each ended at its wall, exit 124, withfatal=0 crash=0 devlost=0 kernel=0 nvrm=0, and 0 kernel driver lines (kmemsysDoCacheOp,NVRM: Xid) over the whole window, 19:55 to 20:06):vk: switches set (10): HOS_HEADLESS=1 (diag), RX_VK_VRAM_MB=9000 (hw), ...with no line saying a switch is gone or unknown, andvk: invalidates with nothing to wait for keep their virtual core: on.RX_VK_INVALIDATE_QUICK=0 RX_VK_INVALIDATE_WAIT=1:vk: RX_VK_INVALIDATE_WAIT is set, and is no longer a switch (since 2026-11-16): it does nothing: the catch-up is only for ranges that may hold a GPU-written texture, thenvk: switches set (11): ... RX_VK_INVALIDATE_QUICK=0 (kill) ..., andvk: invalidates with nothing to wait for keep their virtual core: off (RX_VK_INVALIDATE_QUICK=0 or invalidate's logs).RX_VK_INVALIDATE_WAIT=1alone (the one run that shows the removed read's effect): the same line for the removed switch, and the invalidates line sayson. On main, by its source, this run's line would sayoff.The frame counts in the runs' summaries are not measurements (another game was on the card). The fast path's counts line (
vk: invalidates since the last readbacks line) did not appear: it comes after 3000 readbacks, and a start to the title has none.gpu/vk/vk_replay.cppwas among the new units, and the 66 host units were all compiled new. Never run on Windows or Wine.python -I -B tests/test_switch_table.py: on main @a35130c0it fails with eight lines (RX_VK_INVALIDATE_QUICKand the other six read with no row,RX_VK_INVALIDATE_WAITremoved and still read); here it printsok: 691 switches (diag 285, tune 105, kill 108, attempt 81, hw 61, player 51), 139 removed, 699 names read.python -I -B tests/test_invalidate_quick.py: on main it stops withValueError: substring not foundat its line 55; here its eight cases and the source reading all printPASS.python -I -B tests/run_all.py --jobs 6through the PC's idle queue, this branch against main, both run on main @a6c8ed57(the branch was rebased once more ontoa35130c0afterwards, which changed an AppImage script and its check only; the two checks above were run again on it): here 641 passed, 32 failed, 95 skipped; main 639 passed, 34 failed, 95 skipped. The two that fail on main and pass here aretest_switch_tableandtest_invalidate_quick. The 32 that fail on both are not new: test_bug_report_defaults, test_compute_warm_apart, test_cpu_report, test_crt_options, test_damage_debug_menu, test_dev_packs, test_display_startup_failure, test_dlss_feature_size, test_failed_compile_keeps_objects, test_guest_imported, test_hud_layout_row, test_invalidate_vcore, test_libc_hooks, test_linux_preflight, test_linux_pressure, test_linux_update, test_log_open_failure, test_mirror_budget, test_missing_nup, test_mods_size_table, test_pending_guest_import, test_pipeline_play_cache, test_present_thread, test_profiling_mode, test_psychov35_fsr3_fg, test_readback_timeout_source, test_run_all_changed, test_slow_frames, test_target_image_pool, test_upscaler_rows, test_vcore_escape, test_walk_key.Not tested: Windows runs: the cross-build links, but nothing was started on Windows or Wine, and the two Switch 2 controller rows describe Windows-only code, from reading it. The six host rows (
HOS_NFP_SEARCH,HOS_NFP_TRACE,HOS_SWITCH2,HOS_SWITCH2_RUMBLE_TEST,HOS_VSYNC_YIELD,LONGSHOT_NFC_DIR) were not set in any run: only their table text is new. The fast path taken in play, and any speed: not run, and not claimed.Must be tested:
Risks
What could break: a run that sets
RX_VK_INVALIDATE_WAIT=1now keeps the virtual core at an invalidate with nothing to wait for, as a run without it does; its table row already says it does nothing, and it was never a switch to ship. Nothing else reads the table's text at run time except the start's list of what a run has set.Turning it off: revert the commit;
RX_VK_INVALIDATE_QUICK=0turns the fast path itself off, as before.Compatibility: Nothing changes: no saves, options file, shader or pipeline cache, vk ABI or builder tool is touched.
Issues
See #1150, #1309, #1300, #280 and #1235.
Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why.
in Risks.
main(main @a35130c01, where the game run was made; it merges with main @4b68c42bewithout a conflict).python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.tests/that reads changed source updated in this PR, not weakened.New on this forge; not opened on GitHub.
WIP: fix(vk): the switch table has a row for each switch the source reads again, and a removed switch is no longer readto fix(vk): the switch table has a row for each switch the source reads again, and a removed switch is no longer readOut of WIP: the Windows llvm-mingw cross-build of this head (
61ddd5322) links the renderer DLL and the game executable with 0 warnings (521 units,gpu/vk/vk_replay.cppamong the 106 rebuilt); nothing was started on Windows. The box and Testing say so, and every box is now true.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.