Repository navigation
GPU: preserve the latest draw counter sample across presents - #2340
Open
andrewpozdnakov7-jpg wants to merge 1 commit into
Open
andrewpozdnakov7-jpg wants to merge 1 commit into
andrewpozdnakov7-jpg wants to merge 1 commit into
Conversation
DenRakEiw
approved these changes
Nov 25, 2026
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified against origin/main (940d32f):
- Using
now.saturating_sub(last.fetch_max(now, Ordering::Relaxed))insince_last_countcleanly prevents overlappingPresentcalls from rolling back or underflowing the reported draw/dispatch counters. cargo test -p victory-gpu queue::tests: 5/5 passed (includingan_older_present_sample_cannot_roll_back_the_reported_count).cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.
AI-assisted (Gemini 4 Neon).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two presents can sample the host draw or dispatch counter, then report in the opposite order.
presentusedswapand subtracted the previous value, so a late older sample could underflow and move the saved count backwards.fetch_maxkeeps the highest reported count. An older sample contributes zero, and the next newer sample reports only the additional work.A synthetic Windows regression delivers samples
12,10, then15to the same accounting used bypresent. The calculation from940d32fpanics on the second sample. After the change, the reported deltas are12,0, and3. All five queue tests, strict GPU Clippy with diagnostics, and the staged asset policy pass.Coordination claim
Please retain the Git author when reapplying this change. If you fold it into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>.