Repository navigation
GPU: honour scheduled frame-event offsets - #321
Quat3rnion wants to merge 2 commits into
Conversation
|
Review note with a small repro (built on
From a synthetic test only; I have no copy of the title. |
event_after always advanced to the next tick before considering the offset, so a wait between a tick and its offset skipped that tick's still-pending event. Step to the next tick only once its scheduled instant has passed. Addresses the review note on Marvisak#321.
87800db to
3ff5566
Compare
|
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. |
|
PortBridge linked this work to Continued #402. I ran the three existing I also replayed r4tedx’s case through the Continued Originally posted by @akimfomin in #321 (comment) Follow-up on combining #321 with #174. I tested Quat3rnion's scheduling at All five standalone Core of the checked change against d674d9e-fn next_tick(kind: u32) -> (u64, Duration) {
+fn next_tick(kind: u32, limit: Duration) -> (u64, Duration) {
@@ after event_after, with the clock lock still held
- (tick, Duration::from_nanos(delay.min(u64::MAX as u128) as u64))
+ let wait = Duration::from_nanos(delay.min(u64::MAX as u128) as u64);
+ if wait <= limit {
+ last(kind).fetch_max(tick, Ordering::Relaxed);
+ }
+ (tick, wait)
@@ wait: calculate the timeout first
- let (tick, wait) = next_tick(kind);
let limit = Duration::from_millis(u64::from(timeout_ms));
+ let (tick, wait) = next_tick(kind, limit);
@@ successful wait after sleeping
- last(kind).fetch_max(tick, Ordering::Relaxed);PortBridge case PB-0008. AI-assisted with Codex. |
event_after always advanced to the next tick before considering the offset, so a wait between a tick and its offset skipped that tick's still-pending event. Step to the next tick only once its scheduled instant has passed. Addresses the review note on Marvisak#321.
3ff5566 to
d674d9e
Compare
|
Automated triage for the maintainers. Needs rebase. This pull request conflicts with Generated by Claude Code |
DenRakEiw
left a comment
There was a problem hiding this comment.
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— ok- Merge status: Currently
CONFLICTINGwithorigin/main(940d32f). Please rebase ontomainand clear the unused assignment warning onat.
AI-assisted (Gemini 4 Neon).
Frame events were treated as happening exactly on the tick; schedule() discarded the offset. Store the offset per event kind and place waits at that point within the next free tick, keeping the once-per-tick rule. Add deterministic tests for offsets spanning a tick and for the scheduling call.
event_after always advanced to the next tick before considering the offset, so a wait between a tick and its offset skipped that tick's still-pending event. Step to the next tick only once its scheduled instant has passed. Addresses the review note on Marvisak#321.
d674d9e to
0e0013d
Compare
|
Independent CPU-only verification on Windows / Rust 1.100.0 / MSVC.
|
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 Build: Linux workspace, contributor setup and CI #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.