mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 13:05:57 +00:00
Make the frame limit a setting: 30, 60, 120, 144 or the monitor's refresh rate
TOTK_FPS_LIMIT (fps_limit in totk.ini, live, menu row on the Game tab) replaces the 30/60 choice of TOTK_FPS60. The pacer holds frames to the limit in nanoseconds instead of 60 Hz ticks; the real-time step has no lower bound, so game speed stays 1.000 above 60. `display` follows the exact refresh rate of the window's monitor (QueryDisplayConfig), measured again when the window moves or the display mode changes. A limit of 30 switches the patch set fps60 off as before; unset, the older fps60 = 0 still means 30. Above 60 needs the real-time step and is marked experimental. The vsync event stays at 60 Hz: on 1.4.3 the title runs at 144 fps with it, so the game does not wait for it each frame. Field on machine A: 69-88 fps, CPU-bound (GPU 3.4 ms per frame). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cdecd014f6
commit
b1cbbb93a6
12 files changed
+155
-38
No files matched your search
@@ -633,13 +633,12 @@ NVN_API(nvnWindowSetCrop) {
|
||||
// ---------- Present pacing
|
||||
// The vsync thread ticks at a fixed 60 Hz whatever the monitor does, so one game frame lasts `interval` ticks. With
|
||||
// the real-time frame step (frame_rate.c) game speed does not depend on the interval, so a frame is shown when it is
|
||||
// ready, at most at the frame limit (60 or 30 per second): holding it to the 2nd or 3rd tick would only add latency
|
||||
// and 50 ms frames.
|
||||
// ready, at most at the frame limit (TOTK_FPS_LIMIT: 30 to 360 per second or the monitor's rate): holding it to the
|
||||
// 2nd or 3rd tick would only add latency and 50 ms frames.
|
||||
#define VSYNC_HZ 60ull
|
||||
static uint64_t present_period(const win_t *o) {
|
||||
uint64_t ticks = frame_step_realtime() ? (uint64_t)frame_step_cap_ticks()
|
||||
: o->interval > 0 ? (uint64_t)o->interval : 1ull;
|
||||
return ticks * 1000000000ull / VSYNC_HZ;
|
||||
if (frame_step_realtime()) return frame_step_cap_ns();
|
||||
return (o->interval > 0 ? (uint64_t)o->interval : 1ull) * 1000000000ull / VSYNC_HZ;
|
||||
}
|
||||
|
||||
// MacNativeGames nvn_pace.h: the present slot is the previous slot plus one period. Early: wait for the slot. Late by
|
||||
|
||||
Reference in new issue
Block a user