Add API to get frame setup time on CPU
Needed for benchmarks
This commit is contained in:
parent
169159c8aa
commit
7219f37cb5
|
@ -101,11 +101,16 @@ void RenderingServerDefault::draw(bool p_swap_buffers, double frame_step) {
|
||||||
|
|
||||||
TIMESTAMP_BEGIN()
|
TIMESTAMP_BEGIN()
|
||||||
|
|
||||||
|
uint64_t time_usec = OS::get_singleton()->get_ticks_usec();
|
||||||
|
|
||||||
RSG::scene->update(); //update scenes stuff before updating instances
|
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::storage->update_particles(); //need to be done after instances are updated (colliders and particle transforms), and colliders are rendered
|
||||||
|
|
||||||
RSG::scene->render_probes();
|
RSG::scene->render_probes();
|
||||||
|
|
||||||
RSG::viewport->draw_viewports();
|
RSG::viewport->draw_viewports();
|
||||||
RSG::canvas_render->update();
|
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();
|
frame_profile_frame = RSG::storage->get_captured_timestamps_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float RenderingServerDefault::get_frame_setup_time_cpu() const {
|
||||||
|
return frame_setup_time;
|
||||||
|
}
|
||||||
|
|
||||||
void RenderingServerDefault::sync() {
|
void RenderingServerDefault::sync() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,8 @@ class RenderingServerDefault : public RenderingServer {
|
||||||
uint64_t frame_profile_frame;
|
uint64_t frame_profile_frame;
|
||||||
Vector<FrameProfileArea> frame_profile;
|
Vector<FrameProfileArea> frame_profile;
|
||||||
|
|
||||||
|
float frame_setup_time = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed()
|
//if editor is redrawing when it shouldn't, enable this and put a breakpoint in _changes_changed()
|
||||||
//#define DEBUG_CHANGES
|
//#define DEBUG_CHANGES
|
||||||
|
@ -845,6 +847,8 @@ public:
|
||||||
|
|
||||||
/* TESTING */
|
/* 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_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);
|
virtual void set_default_clear_color(const Color &p_color);
|
||||||
|
|
||||||
|
|
|
@ -776,6 +776,10 @@ public:
|
||||||
return rendering_server->get_frame_profile();
|
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) {
|
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);
|
rendering_server->sdfgi_set_debug_probe_select(p_position, p_dir);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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("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("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");
|
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "render_loop_enabled"), "set_render_loop_enabled", "is_render_loop_enabled");
|
||||||
|
|
||||||
BIND_CONSTANT(NO_INDEX_ARRAY);
|
BIND_CONSTANT(NO_INDEX_ARRAY);
|
||||||
|
|
|
@ -1409,6 +1409,8 @@ public:
|
||||||
virtual Vector<FrameProfileArea> get_frame_profile() = 0;
|
virtual Vector<FrameProfileArea> get_frame_profile() = 0;
|
||||||
virtual uint64_t get_frame_profile_frame() = 0;
|
virtual uint64_t get_frame_profile_frame() = 0;
|
||||||
|
|
||||||
|
virtual float get_frame_setup_time_cpu() const = 0;
|
||||||
|
|
||||||
/* TESTING */
|
/* TESTING */
|
||||||
|
|
||||||
virtual RID get_test_cube() = 0;
|
virtual RID get_test_cube() = 0;
|
||||||
|
|
Loading…
Reference in New Issue