summaryrefslogtreecommitdiff
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/main/main.cpp b/main/main.cpp
index f899894642..6764332f16 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1352,6 +1352,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
PROPERTY_HINT_RANGE, "0,1000,1"));
GLOBAL_DEF("debug/settings/stdout/print_fps", false);
+ GLOBAL_DEF("debug/settings/stdout/print_gpu_profile", false);
GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false);
if (!OS::get_singleton()->_verbose_stdout) { // Not manually overridden.
@@ -1591,7 +1592,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
rendering_server->init();
rendering_server->set_render_loop_enabled(!disable_render_loop);
- if (profile_gpu) {
+ if (profile_gpu || (!editor && bool(GLOBAL_GET("debug/settings/stdout/print_gpu_profile")))) {
rendering_server->set_print_gpu_profile(true);
}
@@ -1734,6 +1735,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
Input *id = Input::get_singleton();
if (id) {
+ agile_input_event_flushing = GLOBAL_DEF("input_devices/buffering/agile_event_flushing", false);
+
if (bool(GLOBAL_DEF("input_devices/pointing/emulate_touch_from_mouse", false)) &&
!(editor || project_manager)) {
bool found_touchscreen = false;
@@ -2441,6 +2444,7 @@ uint32_t Main::frames = 0;
uint32_t Main::frame = 0;
bool Main::force_redraw_requested = false;
int Main::iterating = 0;
+bool Main::agile_input_event_flushing = false;
bool Main::is_iterating() {
return iterating > 0;
@@ -2490,9 +2494,13 @@ bool Main::iteration() {
bool exit = false;
- Engine::get_singleton()->_in_physics = true;
-
for (int iters = 0; iters < advance.physics_steps; ++iters) {
+ if (Input::get_singleton()->is_using_input_buffering() && agile_input_event_flushing) {
+ Input::get_singleton()->flush_buffered_events();
+ }
+
+ Engine::get_singleton()->_in_physics = true;
+
uint64_t physics_begin = OS::get_singleton()->get_ticks_usec();
PhysicsServer3D::get_singleton()->sync();
@@ -2521,9 +2529,13 @@ bool Main::iteration() {
physics_process_ticks = MAX(physics_process_ticks, OS::get_singleton()->get_ticks_usec() - physics_begin); // keep the largest one for reference
physics_process_max = MAX(OS::get_singleton()->get_ticks_usec() - physics_begin, physics_process_max);
Engine::get_singleton()->_physics_frames++;
+
+ Engine::get_singleton()->_in_physics = false;
}
- Engine::get_singleton()->_in_physics = false;
+ if (Input::get_singleton()->is_using_input_buffering() && agile_input_event_flushing) {
+ Input::get_singleton()->flush_buffered_events();
+ }
uint64_t process_begin = OS::get_singleton()->get_ticks_usec();
@@ -2586,6 +2598,11 @@ bool Main::iteration() {
iterating--;
+ // Needed for OSs using input buffering regardless accumulation (like Android)
+ if (Input::get_singleton()->is_using_input_buffering() && !agile_input_event_flushing) {
+ Input::get_singleton()->flush_buffered_events();
+ }
+
if (fixed_fps != -1) {
return exit;
}