Fix: TargetFrameRate setter used stale value and ignored vsync#88
Open
AshishT112203 wants to merge 1 commit into
Open
Fix: TargetFrameRate setter used stale value and ignored vsync#88AshishT112203 wants to merge 1 commit into
AshishT112203 wants to merge 1 commit into
Conversation
…yingFoool#59) Two distinct bugs in the FPS settings path: Bug A — TargetFrameRate setter read S_TargetFrameRate before storing the new value, so the limiter target was always one step behind the slider. Rewrote the setter to store value first, use Math.Max for parity with InitalizeFPSThings, and respect UncappedFPS. Bug B — InitalizeFPSThings explicitly disabled the rate limiter when vsync was on, trusting vsync alone to cap FPS. On setups where vsync silently fails to cap (G-Sync / FreeSync / certain windowed configs) this leaves FPS uncapped at startup — closes TheFlyingFoool#59. Made the rate limiter a safety net: enabled whenever UncappedFPS && TargetFrameRate >= 60, regardless of vsync. UseVSync setter updated to match so the two apply paths stay consistent. Updated the V-Sync menu description to reflect the new semantics (and fixed the "Verticaly" typo).
a0a35cb to
57fe511
Compare
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.
Closes #59.
Two distinct bugs in the FPS settings path:
Bug A —
TargetFrameRatesetter used a stale backing-field valueThe setter assigned
Program.main.DrawRateLimiterTarget = S_TargetFrameRatebefore storing the newvalueintoS_TargetFrameRate, so the limiter target was always one step behind the slider. Also unconditionally setUseDrawRateLimiter = true, ignoring vsync. Rewrote to storevaluefirst, useMath.Max(S_TargetFrameRate, 60)for parity withInitalizeFPSThings(), and respectUncappedFPS.Bug B — Rate limiter disabled at startup when vsync is on
InitalizeFPSThings()setUseDrawRateLimiter = !UseVSync && UncappedFPS && TargetFrameRate >= 60— explicitly disabling the limiter when vsync is on, trusting vsync alone to cap FPS. On the reporter's setup (and likely many others — adaptive sync / G-Sync / FreeSync / certain windowed configs), vsync silently fails to actually cap and the user sees 3000+ FPS at startup.The reporter's existing workaround — "nudge the slider 240 → 180 → 240" — works precisely because the buggy
TargetFrameRatesetter force-enabled the rate limiter. We make the rate limiter a safety net on the load path too: enabled wheneverUncappedFPS && TargetFrameRate >= 60, regardless of vsync.UseVSyncsetter updated to match so the three apply paths (UseVSyncsetter,TargetFrameRatesetter,InitalizeFPSThings) all use the same calculation.Also updated the V-Sync menu description (which said it "overrides FPS Target") and fixed the "Verticaly" typo while there.
Test plan
FPS Target = 240, restart with V-Sync ON → cap holds at 240 (was 3000+)FPS Target = 240, restart with V-Sync OFF → cap holds at 240FPS Target = 0, restart → uncapped (limiter disabled)FPS Target = 240 → 180 → 240live without restart → cap follows slider exactly each step