summaryrefslogtreecommitdiffstats
path: root/core/config/engine.cpp
diff options
context:
space:
mode:
authorMatias N. Goldberg <dark_sylinc@yahoo.com.ar>2024-05-05 19:15:56 -0300
committerMatias N. Goldberg <dark_sylinc@yahoo.com.ar>2024-10-28 18:55:37 -0300
commitaaa0e2fddfead4a31afddc07a26cd6af0c19dacd (patch)
treefeb59f7fe37d206a354ef2108b498d0ae2ec3633 /core/config/engine.cpp
parent92e51fca7247c932f95a1662aefc28aca96e8de6 (diff)
downloadredot-engine-aaa0e2fddfead4a31afddc07a26cd6af0c19dacd.tar.gz
Add Swappy & Pre-Transformed Swapchain
- Adds Swappy for Android for stable frame pacing - Implements pre-transformed Swapchain so that Godot's compositor is in charge of rotating the screen instead of Android's compositor (performance optimization for phones that don't have HW rotator) ============================ The work was performed by collaboration of TheForge and Google. I am merely splitting it up into smaller PRs and cleaning it up. Changes from original PR: - Removed "display/window/frame_pacing/android/target_frame_rate" option to use Engine::get_max_fps instead. - Target framerate can be changed at runtime using Engine::set_max_fps. - Swappy is enabled by default. - Added documentation. - enable_auto_swap setting is replaced with swappy_mode.
Diffstat (limited to 'core/config/engine.cpp')
-rw-r--r--core/config/engine.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index d77c913314..ed8e406224 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -36,6 +36,7 @@
#include "core/license.gen.h"
#include "core/variant/typed_array.h"
#include "core/version.h"
+#include "servers/rendering/rendering_device.h"
void Engine::set_physics_ticks_per_second(int p_ips) {
ERR_FAIL_COND_MSG(p_ips <= 0, "Engine iterations per second must be greater than 0.");
@@ -68,6 +69,11 @@ double Engine::get_physics_jitter_fix() const {
void Engine::set_max_fps(int p_fps) {
_max_fps = p_fps > 0 ? p_fps : 0;
+
+ RenderingDevice *rd = RenderingDevice::get_singleton();
+ if (rd) {
+ rd->_set_max_fps(_max_fps);
+ }
}
int Engine::get_max_fps() const {