View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004865||The Dark Mod||Graphics||public||15.07.2018 03:57||08.03.2019 06:47|
|Product Version||TDM 2.06|
|Target Version||TDM 2.08||Fixed in Version|
|Summary||0004865: Improve the way how FPS cap works (uncapped FPS)|
|Description||This issue is only about uncapped FPS mode.|
Right now we limit frames on about 125 FPS. It seems that the way it works now means that 6 ms pause is added to each frame, even if FPS is lower than the cap.
It is worth looking for improvement.
|Tags||No tags attached.|
|related to||0004696||resolved||stgatilov||At high FPS player footsteps don't always play|
|related to||0004493||resolved||duzenko||Some physics events have changed in 2.05 due to faster fps|
|related to||0003684||new||Investigate GPL Renderer Improvements|
|related to||0004514||resolved||stgatilov||Game runs sluggish randomly|
Note: the original reason to limit FPS was the related issue 0004696.
So when working this issue, make sure to test that issue thoroughly.
I was wrong in that it's adding 6 ms to each frame.
It's just that it's sleeping one additional ms due to Windows Sleep() precision, so max FPS is right now 1000 / 7 = ~ 140.
I suggest changing the hard-coded delay from 6000 to 4000 microseconds in idSessionLocal::Frame.
I imagine it will result in 200 max fps.
If you still want the 166 fps, then the delay should be 5000.
Things to test include:
The delay was initially 4000 us.
But it turned out to be not enough.
|Can we put this under a cvar?|
Yes, of course we can. There were even some suggestions.
But cvar needs a reliable default, and this should be chosen conservatively =)
By the way, if we are talking about the code after Cabalistic's patch, then the following spin lock gives be precisely 200 FPS:
static int64_t prevUsec = INT64_MIN;
while (Sys_GetTimeMicroseconds() - prevUsec < 5000)
prevUsec = Sys_GetTimeMicroseconds();
|The current code might produce the same 200 FPS with 4000microseconds wait.|
|To my knowledge, the last part of this discussion was concluded "Too risky for 2.07". As such I am moving this to 2.08|
While fixing related issue 0004514, the FPS limit was removed in rev 8035 by Cabalistic's patch.
I have reapplied the limit in rev 8036 using the busywait approach described above.
UPDATE: The max FPS limit was buggy, leading to infinite loop.
Commits 8039 and 8040 fix this.
Experimentally, the FPS limit is still quantized to 142 / 166 / 200 / 250 / 333 / 500 FPS. While Sleep(1) is removed, the frame still takes integer number of milliseconds on average.
The current default of 166 means that most likely real FPS limit will be 142, which seems good enough even for 144 Hz monitors.
|Cabalistic, do you have anything to do in this issue?|
|15.07.2018 03:57||stgatilov||New Issue|
|15.07.2018 03:57||stgatilov||Relationship added||related to 0004696|
|15.07.2018 03:58||stgatilov||Note Added: 0010680|
|15.07.2018 05:38||duzenko||Note Added: 0010681|
|15.07.2018 05:38||duzenko||Note Edited: 0010681||View Revisions|
|15.07.2018 05:39||duzenko||Note Edited: 0010681||View Revisions|
|15.07.2018 05:40||duzenko||Note Edited: 0010681||View Revisions|
|15.07.2018 05:44||duzenko||Note Added: 0010682|
|15.07.2018 05:44||duzenko||Relationship added||related to 0004493|
|15.07.2018 07:48||stgatilov||Note Added: 0010683|
|15.07.2018 09:52||duzenko||Note Added: 0010684|
|15.07.2018 09:52||duzenko||Note Edited: 0010681||View Revisions|
|15.07.2018 11:21||stgatilov||Note Added: 0010685|
|16.07.2018 02:35||stgatilov||Summary||Improve the way how FPS cap works (unfixed tic) => Improve the way how FPS cap works (uncapped FPS)|
|16.07.2018 05:35||duzenko||Note Added: 0010688|
|11.12.2018 06:18||nbohr1more||Note Added: 0010879|
|11.12.2018 06:18||nbohr1more||Target Version||TDM 2.07 => TDM 2.08|
|11.12.2018 06:18||nbohr1more||Assigned To||=> cabalistic|
|11.12.2018 06:18||nbohr1more||Status||new => acknowledged|
|20.12.2018 16:31||nbohr1more||Relationship added||related to 0003684|
|04.03.2019 16:33||stgatilov||Relationship added||related to 0004514|
|06.03.2019 15:21||stgatilov||Note Added: 0011673|
|06.03.2019 15:24||stgatilov||Note Added: 0011674|
|06.03.2019 15:25||stgatilov||Note Added: 0011675|
|06.03.2019 15:25||stgatilov||Status||acknowledged => feedback|
|08.03.2019 06:47||stgatilov||Note Edited: 0011673||View Revisions|