1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Merge pull request #52314 from lawnjelly/four_delta_smooth

Add frame delta smoothing option (4.x)
This commit is contained in:
Rémi Verschelde
2023-05-17 11:25:03 +02:00
9 changed files with 385 additions and 0 deletions

View File

@@ -470,6 +470,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --disable-render-loop Disable render loop so rendering only occurs when called explicitly from script.\n");
OS::get_singleton()->print(" --disable-crash-handler Disable crash handler when supported by the platform code.\n");
OS::get_singleton()->print(" --fixed-fps <fps> Force a fixed number of frames per second. This setting disables real-time synchronization.\n");
OS::get_singleton()->print(" --delta-smoothing <enable> Enable or disable frame delta smoothing ['enable', 'disable'].\n");
OS::get_singleton()->print(" --print-fps Print the frames per second to the stdout.\n");
OS::get_singleton()->print("\n");
@@ -794,6 +795,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Vector<String> breakpoints;
bool use_custom_res = true;
bool force_res = false;
bool delta_smoothing_override = false;
String default_renderer = "";
String default_renderer_mobile = "";
@@ -1003,6 +1005,29 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing tablet driver argument, aborting.\n");
goto error;
}
} else if (I->get() == "--delta-smoothing") {
if (I->next()) {
String string = I->next()->get();
bool recognised = false;
if (string == "enable") {
OS::get_singleton()->set_delta_smoothing(true);
delta_smoothing_override = true;
recognised = true;
}
if (string == "disable") {
OS::get_singleton()->set_delta_smoothing(false);
delta_smoothing_override = false;
recognised = true;
}
if (!recognised) {
OS::get_singleton()->print("Delta-smoothing argument not recognised, aborting.\n");
goto error;
}
N = I->next()->next();
} else {
OS::get_singleton()->print("Missing delta-smoothing argument, aborting.\n");
goto error;
}
} else if (I->get() == "--single-window") { // force single window
single_window = true;
@@ -1930,6 +1955,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(
GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "0,33200,1,or_greater"), 6900)); // Roughly 144 FPS
GLOBAL_DEF("application/run/delta_smoothing", true);
if (!delta_smoothing_override) {
OS::get_singleton()->set_delta_smoothing(GLOBAL_GET("application/run/delta_smoothing"));
}
GLOBAL_DEF("display/window/ios/allow_high_refresh_rate", true);
GLOBAL_DEF("display/window/ios/hide_home_indicator", true);
GLOBAL_DEF("display/window/ios/hide_status_bar", true);