GPU: honour scheduled frame-event offsets #321
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/321"
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?
Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T02:16:45Z.
What
Frame events were treated as happening exactly on the tick:
schedule()discarded the offset the title supplied. This stores the offset per event
kind (origin, vblank, flip) and places each wait at that point within the
next free tick. Offsets of a whole tick or more move the event into a later
tick, and the once-per-tick rule still applies. This is part of the plan's
frame-pacing work for the world path.
It overlaps the
next_tickarea touched by PR #174, which fixes a separaterace in the same function. The two should be reconciled before merging.
An AI tool wrote part of this change.
Tested
cargo test --workspacewith PR #112's Linux build fix applied locally (not part of this PR): 166 passed, 0 failed, 3 ignored. Three frame tests cover offsets within and across ticks and the scheduling call.cargo check --target x86_64-pc-windows-gnu --workspace --testspasses. No Windows host here.cargo xtask policypasses (150 files ok). No game files or data from them were added.Checklist
cargo xtask policypasses. No game files or data from them were added.Imported from Marvisak/VIctory. Originally posted by r4tedx on 2026-11-24T03:30:15Z.
Review note with a small repro (built on
maind2a4bae). With a 1 ms period and a 0.3 ms offset, asking for the next event at 1.1 ms returns(2, 1200000): the event of tick 2, 1.2 ms away. The event of tick 1 at 1.3 ms is still ahead at that moment (0.2 ms away) and is skipped; I expected(1, 200000). It looks likeevent_afteradvances to the next tick before considering the current tick's offset.mainhas no offset handling at all, so this is not a regression, but a title pacing itself by these events would miss one event per period whenever it asks between a tick and that tick's offset.From a synthetic test only; I have no copy of the title.
Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T07:30:03Z.
Rebased on current main. Fixed event_after so a pending event in the current tick is no longer skipped: it steps to the next tick only once the offset instant has passed. Added your 1.1 ms / 0.3 ms case as a regression. New head
3ff5566.Imported from Marvisak/VIctory. Originally posted by akimfomin on 2026-11-24T11:53:45Z.
PortBridge linked this work to Continued #402. I ran the three existing
frame.rstests from3ff5566in a standalone native Windows harness (Rust 1.100.0). All three passed.I also replayed r4tedx’s case through the Continued
FramePaceratd743662: period 1,000 µs, call at 1,100 µs, offset 300 µs. It was pending at 1,299 µs and returned token 1 at 1,300 µs, matching the corrected VIctory timing. Continued rejects an offset of a full period, while #321 carries offsets across ticks. The sub-period case is a shared regression the teams can compare. This is a synthetic timing check. AI-assisted with Codex.Originally posted by @akimfomin in https://github.com/Marvisak/VIctory/issues/321#issuecomment-7130689676
Follow-up on combining #321 with #174. I tested Quat3rnion's scheduling at
d674d9e2together with AndyLatimer's tick reservation at882664e1. A three-way merge fromd2a4baegives two conflicts innext_tick. The resolution keepsevent_afterand reserves its chosen tick under the existing clock lock only when the delay fits the timeout.All five standalone
frame.rstests passed on native Windows with Rust 1.100.0, in 40 runs with default test threading and 20 with four threads. At elapsed 11 s with a 10 s period and a 3 s offset, a zero-timeout call leaves tick 101 pending. Two eligible waits then reserve 101 and 102. Removing either the offset or the reservation breaks that test. The tests that modify shared state use a test-only lock. This is a synthetic CPU module check.Core of the checked change against
d674d9e2PortBridge case PB-0008. AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:31:17Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-gpu/src/frame.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T03:34:00Z.
Review: COMMENTED
Tested PR head directly on Windows 11 x64 (Rust 1.98.1 MSVC):
cargo test -p victory-gpu --lib frame::— 3 passed, 0 failedcargo clippy -p victory-gpu --all-targets— 1 warning:warning: value assigned to 'at' is never readcargo xtask policy— okCONFLICTINGwithorigin/main(940d32f). Please rebase ontomainand clear the unused assignment warning onat.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T19:41:07Z.
Independent CPU-only verification on Windows / Rust 1.100.0 / MSVC.
0e0013d731cb93f8c9ed12a0b46622d994befc82, merge base63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-gpu --lib -- frame::tests::events_happen_at_their_offset_within_the_tick --exact --test-threads=1 --quiettest result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 232 filtered out, exit 0.git grep -F -c events_happen_at_their_offset_within_the_tick 63bcca43 -- .→ exit 1 / 0 hits (test genuinely new); present on PR head.git diff --check 63bcca43 HEAD→ exit 0.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.