Add frame delta smoothing option (4.x)

Frame deltas are currently measured by querying the OS timer each frame. This is subject to random error. Frame delta smoothing instead filters the delta read from the OS by replacing it with the refresh rate delta wherever possible.

This PR also contains code to estimate the refresh rate based on the input deltas, without reading the refresh rate from the host OS.

The delta_smooth_enabled setting can also be modified at runtime through OS::, and there is also now a command line setting to override the project setting.
This commit is contained in:
lawnjelly
2021-09-01 15:47:12 +01:00
parent ffd32a244b
commit 7925670f81
9 changed files with 385 additions and 0 deletions

View File

@ -151,6 +151,14 @@ int OS::get_low_processor_usage_mode_sleep_usec() const {
return low_processor_usage_mode_sleep_usec;
}
void OS::set_delta_smoothing(bool p_enabled) {
_delta_smoothing_enabled = p_enabled;
}
bool OS::is_delta_smoothing_enabled() const {
return _delta_smoothing_enabled;
}
String OS::get_executable_path() const {
return _execpath;
}