From 9600fd5dde1f85b7dd2dd8558d52ff86b18651e7 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 9 Jan 2020 22:20:00 +0100 Subject: [PATCH] Enable Vsync via Compositor by default This feature was added in #33414 but it was disabled by default. Now that it got some testing, it's probably safe to enable it by default. --- core/bind/core_bind.cpp | 2 +- doc/classes/OS.xml | 3 ++- doc/classes/ProjectSettings.xml | 2 +- main/main.cpp | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 0eacffeb884..4586dc6d141 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1393,7 +1393,7 @@ void _OS::_bind_methods() { ADD_PROPERTY_DEFAULT("current_screen", 0); ADD_PROPERTY_DEFAULT("exit_code", 0); ADD_PROPERTY_DEFAULT("vsync_enabled", true); - ADD_PROPERTY_DEFAULT("vsync_via_compositor", false); + ADD_PROPERTY_DEFAULT("vsync_via_compositor", true); ADD_PROPERTY_DEFAULT("low_processor_usage_mode", false); ADD_PROPERTY_DEFAULT("low_processor_usage_mode_sleep_usec", 6900); ADD_PROPERTY_DEFAULT("keep_screen_on", true); diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 71d0c1a6fe9..3550ef6b5fc 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -937,8 +937,9 @@ If [code]true[/code], vertical synchronization (Vsync) is enabled. - + If [code]true[/code] and [code]vsync_enabled[/code] is true, the operating system's window compositor will be used for vsync when the compositor is enabled and the game is in windowed mode. + [b]Note:[/b] This property is only implemented on Windows. If [code]true[/code], removes the window frame. diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 126f11a4ede..1bc43dc9642 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -437,7 +437,7 @@ If [code]true[/code], enables vertical synchronization. This eliminates tearing that may appear in moving scenes, at the cost of higher input latency and stuttering at lower framerates. If [code]false[/code], vertical synchronization will be disabled, however, many platforms will enforce it regardless (such as mobile platforms and HTML5). - + If [code]Use Vsync[/code] is enabled and this setting is [code]true[/code], enables vertical synchronization via the operating system's window compositor when in windowed mode and the compositor is enabled. This will prevent stutter in certain situations. (Windows only.) diff --git a/main/main.cpp b/main/main.cpp index c29a5a0aa67..4371da78263 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1028,7 +1028,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph // window compositor ("--enable-vsync-via-compositor" or // "--disable-vsync-via-compositor") was present then it overrides the // project setting. - video_mode.vsync_via_compositor = GLOBAL_DEF("display/window/vsync/vsync_via_compositor", false); + video_mode.vsync_via_compositor = GLOBAL_DEF("display/window/vsync/vsync_via_compositor", true); } OS::get_singleton()->_vsync_via_compositor = video_mode.vsync_via_compositor;