a menu row can keep a lock reason the renderer no longer has: the row reads capabilities live, the fact that resends it is a 250 ms sample #3277
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot#3277
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
A row's caps-derived state is read from the renderer live, while the fact that decides whether to send it again is a sample up to 250 ms old. A caps state that appears and goes away inside one window is therefore displayed and never taken back.
Found while reviewing #3223, not in the game. Nothing here contradicts that change: it is about the window #3208 put around the caps read (#3208).
The two sides, on main
The row's own content asks the renderer each time it is built:
game/crates/api/src/services/settings_host.rs:650:let caps = link::capabilities();in the row build:878thelockedtext,:847an upscaler choice's why,:552the slider's ceiling,:581what is pickable,:892a choice row's option countThe fact that re-sends watched rows is a cached sample:
:1357:f[Fact::CapsState as usize] = caps_hashes().1:215-227:caps_hashes()keeps the renderer's answer forCAPS_EVERY_NS,:257: 250_000_000game/crates/api/src/services/settings_push.rs:269:moved.contains(&Fact::CapsState)is what dirties every watched row:211-219:watchremembers the row's json exactly as it was readWhat that difference allows
Sample 1 takes state A. The renderer moves to B. A mod reads a row: it is built with B (live), and
watchremembers B's json. The renderer returns to A. Sample 2 takes state A, soFact::CapsStatedid not move, the row is not dirty, and nothing is sent: the row keeps B's lock text, or B's hint, or a ceiling from B, until some unrelated fact moves. No setting is involved, so nothing else corrects it either: a settings change marks its own row and its dependents throughdeps(settings_push.rs:271-273), which is why this only bites a caps state that changes without a setting change.The sampling window itself is not wrong; it is what stopped
fill_capabilitieshashing every list on the main thread at every frame. The mismatch is that the row and the fact are read at different times.What I have not established
No instance seen in the game, and I could not look for one where it is easiest:
dlss_fg_mostand the vendor upscalers are all off on an AMD Deck. It needs a caps state that moves without moving a setting or one of the lists (:242-250hashes the counts and contents of sizes, monitors, gpus, langs, ids, reshade files, outputs, mics, aspects and nfc tags), and I did not find one: the case is that the code permits a read between two samples, and the review of #3223 raised it. Treat the consequence as "the code allows this", not "a player reported this".Shape of a fix, if the shape is right
caps_hashes()keeps the snapshot along with its two hashes, and the row build reads that snapshot instead of callinglink::capabilities()again: a row's state and the fact that re-sends it then come from the same renderer answer, and the window only costs staleness (a change seen up to 250 ms late), never a state no sample ever made. That also lowers the number ofcapabilities()calls per pass, which two existing tests already hold down ("expected <= 1 capabilities() call for 51 textWhen values",settings_host.rs:2539, and:2553), so it goes with the grain of the code rather than against it.A game-free test that would pin it, on the fake renderer: set the caps state to B, read a watched row (it takes B), set it back to A, tick past one window, and assert the row is pushed again with A's lock text. Today the two samples are both A,
moveddoes not containFact::CapsState, and nothing is sent.Happy to write that test against main and see what it says, or to leave it to whoever owns the caps path.
@omgitsgela I'd like to take this one, unless you've already started on the test: say so and I'll step back.
Plan, as the issue lays it out: first a game-free test on the fake renderer (caps state B, read a watched row, back to A, tick past
CAPS_EVERY_NS, expect the row pushed again with A's text), checked to fail on main. Then the fix:caps_hashes()keeps the snapshot with its two hashes, and the row build insettings_host.rsreads that snapshot instead of callinglink::capabilities()again. The existing "<= 1 capabilities() call" tests stay green. Then a run in the game on an RTX 4090 (Windows): the Graphics tab's DLSS / frame generation rows still lock and unlock as the renderer changes.Go ahead, I have not started it, and nothing of mine touches this: my two changes today were #3223 and #3275, and this one only came out of the review I ran over the first of them.
Things that may save you a search, all verified on main at
688d47e:settings_host.rs:650(let caps = link::capabilities();); then:878thelockedtext,:847an upscaler choice's why,:552top_infor the ceiling,:581not_pickable,:892the option count. And elsewhere in the same file:385list_choices,:936,:1057,:1470each ask again. So a snapshot threaded through one pass has more than one caller to catch.capabilities()count tests you want to stay green are:2539(51textWhenvalues, <= 1 call) and:2553(4choicesFromvalues, <= 1 call), so the code already leans your way.caps_hashes():215-227withKEPT: Mutex<(i64, u64, i64)>(the stamp, the lists hash, the state hash),CAPS_EVERY_NS:257, used at:1357, whereFact::CapsStateis set, and consumed atsettings_push.rs:269, where it dirties every watched row;watchat:211-219is what remembers the json to compare against. Holding the snapshot means theKEPTtuple grows by aLsCapabilities, which is the part I would have wanted a maintainer's eye on: it is a C-shaped struct (game/crates/host-sys/src/settings_link.rs:130-175), fixed-size arrays, so it should be cheap to keep, but I have not tried it.caps_hashes()re-asks every call whenhost_sys::FAKE, and the tests set caps fields per test (renderer_reasons.rs:84,settings_host.rs:2211), so a cache that also feeds the row build could make existing tests see a stale snapshot. That is probably where a first attempt fails, and it is a good place to design rather than debug.frame_generation/frame_generation_byand the multiplier, since that is wheredlss_fg_mostand the lock both move; and I can run a pinned test request of yours on a Deck LCD afterwards if a no-change-from-main check is worth having.Shout if you want the Deck side of anything, and it is yours otherwise.