diff options
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/rendering_server_default.cpp | 9 | ||||
-rw-r--r-- | servers/rendering/rendering_server_default.h | 4 | ||||
-rw-r--r-- | servers/rendering/rendering_server_wrap_mt.h | 4 | ||||
-rw-r--r-- | servers/rendering_server.cpp | 3 | ||||
-rw-r--r-- | servers/rendering_server.h | 2 |
5 files changed, 22 insertions, 0 deletions
diff --git a/servers/rendering/rendering_server_default.cpp b/servers/rendering/rendering_server_default.cpp index 8c7c25c19b..da6c3ef6f4 100644 --- a/servers/rendering/rendering_server_default.cpp +++ b/servers/rendering/rendering_server_default.cpp @@ -101,11 +101,16 @@ void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) { TIMESTAMP_BEGIN() + uint64_t time_usec = OS::get_singleton()->get_ticks_usec(); + RSG::scene->update(); //update scenes stuff before updating instances + frame_setup_time = double(OS::get_singleton()->get_ticks_usec() - time_usec) / 1000.0; + RSG::storage->update_particles(); //need to be done after instances are updated (colliders and particle transforms), and colliders are rendered RSG::scene->render_probes(); + RSG::viewport->draw_viewports(); RSG::canvas_render->update(); @@ -159,6 +164,10 @@ void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) { frame_profile_frame = RSG::storage->get_captured_timestamps_frame(); } +float RenderingServerDefault::get_frame_setup_time_cpu() const { + return frame_setup_time; +} + void RenderingServerDefault::sync() { } diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h index 11220dcf79..922cf08f3b 100644 --- a/servers/rendering/rendering_server_default.h +++ b/servers/rendering/rendering_server_default.h @@ -72,6 +72,8 @@ class RenderingServerDefault : public RenderingServer { uint64_t frame_profile_frame; Vector<FrameProfileArea> frame_profile; + float frame_setup_time = 0; + public: //if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed() //#define DEBUG_CHANGES @@ -845,6 +847,8 @@ public: /* TESTING */ + virtual float get_frame_setup_time_cpu() const; + virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true); virtual void set_default_clear_color(const Color &p_color); diff --git a/servers/rendering/rendering_server_wrap_mt.h b/servers/rendering/rendering_server_wrap_mt.h index ec71178dae..1e6c3b8f71 100644 --- a/servers/rendering/rendering_server_wrap_mt.h +++ b/servers/rendering/rendering_server_wrap_mt.h @@ -776,6 +776,10 @@ public: return rendering_server->get_frame_profile(); } + virtual float get_frame_setup_time_cpu() const { + return rendering_server->get_frame_setup_time_cpu(); + } + virtual void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) { rendering_server->sdfgi_set_debug_probe_select(p_position, p_dir); } diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 4dcb7aa79c..73e382a5ba 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -1817,6 +1817,9 @@ void RenderingServer::_bind_methods() { ClassDB::bind_method(D_METHOD("is_render_loop_enabled"), &RenderingServer::is_render_loop_enabled); ClassDB::bind_method(D_METHOD("set_render_loop_enabled", "enabled"), &RenderingServer::set_render_loop_enabled); + + ClassDB::bind_method(D_METHOD("get_frame_setup_time_cpu"), &RenderingServer::get_frame_setup_time_cpu); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_loop_enabled"), "set_render_loop_enabled", "is_render_loop_enabled"); BIND_CONSTANT(NO_INDEX_ARRAY); diff --git a/servers/rendering_server.h b/servers/rendering_server.h index 4dc4f332fa..f403264a96 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -1409,6 +1409,8 @@ public: virtual Vector<FrameProfileArea> get_frame_profile() = 0; virtual uint64_t get_frame_profile_frame() = 0; + virtual float get_frame_setup_time_cpu() const = 0; + /* TESTING */ virtual RID get_test_cube() = 0; |