GPU: prevent concurrent frame waits from consuming the same tick (#244) #281
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!281
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-281"
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?
@adritoyalser on GitHub · 2026-11-24 23:11 UTC · original
adritoyalser:fix/flip-wait-race→main· +108 −19 · 1 files · 2 commits · openFixes #244.
Summary
crates/victory-gpu/src/frame.rs(wait), check the previous value returned bylast(kind).fetch_max(tick, Ordering::AcqRel)so only one waiter can claim a given tick.tick(or a later one), recomputenext_tick(kind)and retry against the caller's originaldeadline(started.checked_add(limit)), so retries never extend the requested timeout.diagnostics,PaceUsand theframe waitdebug log now record actualstarted.elapsed()across any retry iterations rather than the single-attemptwait.min(limit).frame::tests:concurrent_flip_waits_consume_distinct_ticks: two barrier-synchronizedFLIPwaits both returnS_OKand advanceLAST[2]by at least 2.concurrent_flip_retry_does_not_extend_timeout: two barrier-synchronizedFLIPwaits with a 200 ms interval (started after both threads align at the first barrier) and 285 ms timeout produce exactly oneS_OKand oneTIMEOUTwithLAST[2]advancing by 1.Verification
cargo test -q -p victory-gpu --lib --locked frame::tests(3 passed, 0 failed)cargo clippy -q -p victory-gpu --all-targets --locked -- -D warnings(0 warnings)cargo clippy -q -p victory-gpu --all-targets --all-features --locked -- -D warnings(0 warnings)@adritoyalser on GitHub · 2026-11-24 23:21 UTC · original
Thanks for the thorough review @ErRusso! Addressed all points:
concurrent_flip_retry_does_not_extend_timeoutto a 200 ms interval / 285 ms timeout and movedset_intervalinside the first barrier phase so thread-spawn delay cannot eat into the first tick window.tickto_tickand droppedlet _ = tick;.PaceUsintentionally records actual elapsed time (started.elapsed()) across retries.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.