diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 8 | ||||
-rw-r--r-- | main/performance.cpp | 40 | ||||
-rw-r--r-- | main/performance.h | 8 |
3 files changed, 51 insertions, 5 deletions
diff --git a/main/main.cpp b/main/main.cpp index 68e518ae3d..deffb3a632 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1350,7 +1350,7 @@ bool Main::start() { String stretch_mode = GLOBAL_DEF("display/window/stretch/mode", "disabled"); String stretch_aspect = GLOBAL_DEF("display/window/stretch/aspect", "ignore"); Size2i stretch_size = Size2(GLOBAL_DEF("display/window/size/width", 0), GLOBAL_DEF("display/window/size/height", 0)); - int stretch_shrink = GLOBAL_DEF("display/window/stretch/shrink", 1); + real_t stretch_shrink = GLOBAL_DEF("display/window/stretch/shrink", 1.0f); SceneTree::StretchMode sml_sm = SceneTree::STRETCH_MODE_DISABLED; if (stretch_mode == "2d") @@ -1633,7 +1633,7 @@ bool Main::iteration() { while (time_accum > frame_slice) { - uint64_t fixed_begin = OS::get_singleton()->get_ticks_usec(); + uint64_t physics_begin = OS::get_singleton()->get_ticks_usec(); PhysicsServer::get_singleton()->sync(); PhysicsServer::get_singleton()->flush_queries(); @@ -1656,8 +1656,8 @@ bool Main::iteration() { time_accum -= frame_slice; message_queue->flush(); - physics_process_ticks = MAX(physics_process_ticks, OS::get_singleton()->get_ticks_usec() - fixed_begin); // keep the largest one for reference - physics_process_max = MAX(OS::get_singleton()->get_ticks_usec() - fixed_begin, physics_process_max); + 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); iters++; Engine::get_singleton()->_physics_frames++; } diff --git a/main/performance.cpp b/main/performance.cpp index 0f3383c4a8..39b42e803c 100644 --- a/main/performance.cpp +++ b/main/performance.cpp @@ -57,10 +57,10 @@ void Performance::_bind_methods() { BIND_ENUM_CONSTANT(RENDER_SHADER_CHANGES_IN_FRAME); BIND_ENUM_CONSTANT(RENDER_SURFACE_CHANGES_IN_FRAME); BIND_ENUM_CONSTANT(RENDER_DRAW_CALLS_IN_FRAME); - BIND_ENUM_CONSTANT(RENDER_USAGE_VIDEO_MEM_TOTAL); BIND_ENUM_CONSTANT(RENDER_VIDEO_MEM_USED); BIND_ENUM_CONSTANT(RENDER_TEXTURE_MEM_USED); BIND_ENUM_CONSTANT(RENDER_VERTEX_MEM_USED); + BIND_ENUM_CONSTANT(RENDER_USAGE_VIDEO_MEM_TOTAL); BIND_ENUM_CONSTANT(PHYSICS_2D_ACTIVE_OBJECTS); BIND_ENUM_CONSTANT(PHYSICS_2D_COLLISION_PAIRS); BIND_ENUM_CONSTANT(PHYSICS_2D_ISLAND_COUNT); @@ -153,6 +153,44 @@ float Performance::get_monitor(Monitor p_monitor) const { return 0; } +Performance::MonitorType Performance::get_monitor_type(Monitor p_monitor) const { + ERR_FAIL_INDEX_V(p_monitor, MONITOR_MAX, MONITOR_TYPE_QUANTITY); + // ugly + static const MonitorType types[MONITOR_MAX] = { + + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_TIME, + MONITOR_TYPE_TIME, + MONITOR_TYPE_MEMORY, + MONITOR_TYPE_MEMORY, + MONITOR_TYPE_MEMORY, + MONITOR_TYPE_MEMORY, + MONITOR_TYPE_MEMORY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_MEMORY, + MONITOR_TYPE_MEMORY, + MONITOR_TYPE_MEMORY, + MONITOR_TYPE_MEMORY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_QUANTITY, + + }; + + return types[p_monitor]; +} + void Performance::set_process_time(float p_pt) { _process_time = p_pt; diff --git a/main/performance.h b/main/performance.h index 900e6434b7..21fbd7a1d2 100644 --- a/main/performance.h +++ b/main/performance.h @@ -79,9 +79,17 @@ public: MONITOR_MAX }; + enum MonitorType { + MONITOR_TYPE_QUANTITY, + MONITOR_TYPE_MEMORY, + MONITOR_TYPE_TIME + }; + float get_monitor(Monitor p_monitor) const; String get_monitor_name(Monitor p_monitor) const; + MonitorType get_monitor_type(Monitor p_monitor) const; + void set_process_time(float p_pt); void set_physics_process_time(float p_pt); |