Repository navigation
icd_shim: spend generation leftover as a rate, not a ratio of whole frames - #71
Merged
Merged
Conversation
… frames The eight rows of `limits()` already match docs/10's table, so the ceiling was right and the divergence was one step later: `generate_per_source` floored `generate / acquire` to whole frames per source, which turned every ceiling below one frame per source into zero. At 60 Hz, cap 40, ×2 the panel leaves 20 generated against 40 source frames -- one every other source frame -- and the flooring produced none. So frame generation did nothing at any cap above half the refresh while the panel still had room, which is not what the table's total column promises. Measured on Nova at 120 Hz, cap 70, ×2: `cap=70 acquire=70 generate=70`, and the leftover `120 - 70 = 50` was reachable in principle and unreachable in fact. `generate_batch(m, &mut credit)` carries the remainder across source frames in units of one source frame, so a rate that is not a whole frame per source is still spent: cap 70 on 120 Hz yields 50 generated over 70 source frames, cap 40 on 60 Hz yields 0,1,0,1,..., and the multiplier's `m - 1` remains the per-frame bound. The credit lives on `GnSwapchain`, one per swapchain, since it is the swapchain's stream being spaced. Tests are rewritten rather than deleted: the one that pinned the flooring as intended behaviour now asserts the leftover is spent (`20` over `40`, `0` only above the panel), and two new ones pin the 0,1,0,1 sequence and the cap-70 case. docs/10's paragraph about the leftover is corrected with it. 130 tests pass; clippy clean with -D warnings.
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.
What this is
Generation's leftover is a rate, not a ratio of whole frames. The eight rows of
limits()already matchdocs/10's table, so the ceiling was never wrong — the divergence was one step later:generate_per_sourceflooredgenerate / acquireto whole frames per source, and every ceiling below one frame per source became zero.The floor ate the leftover
At 60 Hz, cap 40, ×2 the panel leaves 20 generated against 40 source frames — one every other source frame — and the flooring produced none. So frame generation did nothing at any cap above half the refresh, while the panel still had room. That is not what the table's total column promises.
Measured on Nova at 120 Hz, cap 70, ×2:
cap=70 acquire=70 generate=70, so the leftover120 − 70 = 50was reachable in principle and unreachable in fact.The change
generate_batch(m, &mut credit)carries the remainder across source frames in units of one source frame, so a rate that is not a whole frame per source is still spent. The multiplier'sm − 1stays the per-frame bound. The credit lives onGnSwapchain, one per swapchain, since it is that stream being spaced.docs/10's paragraph about the leftover says it floors to none and generation therefore does nothing above half the refresh; that is corrected in the same change.Verified
cargo clippy --all-targets -D warningsclean.0,1,0,1,…sequence and cap 70 on 120 Hz yielding 50 in 70.