summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-09-20 17:58:06 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-11 12:01:26 +0100
commit123ee5995c989d7c2f0bb320fe94ef1702a48c13 (patch)
tree97855b3218f56dcaaeb5e737bf1a919f28ac36db /scene
parentdc32083681a770e9d7e332c5beed30b52c793752 (diff)
Visual GPU profiler and related profiling support in Vulkan.
Diffstat (limited to 'scene')
-rw-r--r--scene/debugger/script_debugger_remote.cpp41
-rw-r--r--scene/debugger/script_debugger_remote.h3
2 files changed, 39 insertions, 5 deletions
diff --git a/scene/debugger/script_debugger_remote.cpp b/scene/debugger/script_debugger_remote.cpp
index 0a075df060..3608a11ed7 100644
--- a/scene/debugger/script_debugger_remote.cpp
+++ b/scene/debugger/script_debugger_remote.cpp
@@ -805,14 +805,22 @@ void ScriptDebuggerRemote::_poll_events() {
profiling = false;
_send_profiling_data(false);
print_line("PROFILING END!");
+ } else if (command == "start_visual_profiling") {
+
+ visual_profiling = true;
+ VS::get_singleton()->set_frame_profiling_enabled(true);
+ } else if (command == "stop_visual_profiling") {
+
+ visual_profiling = false;
+ VS::get_singleton()->set_frame_profiling_enabled(false);
} else if (command == "start_network_profiling") {
+ network_profiling = true;
multiplayer->profiling_start();
- profiling_network = true;
} else if (command == "stop_network_profiling") {
+ network_profiling = false;
multiplayer->profiling_end();
- profiling_network = false;
} else if (command == "override_camera_2D:set") {
bool enforce = cmd[1];
@@ -985,6 +993,30 @@ void ScriptDebuggerRemote::idle_poll() {
packet_peer_stream->put_var(arr);
}
}
+ if (visual_profiling) {
+ Vector<VS::FrameProfileArea> profile_areas = VS::get_singleton()->get_frame_profile();
+ if (profile_areas.size()) {
+ PoolVector<String> area_names;
+ PoolVector<real_t> area_times;
+ area_names.resize(profile_areas.size());
+ area_times.resize(profile_areas.size() * 2);
+ {
+ PoolVector<String>::Write area_namesw = area_names.write();
+ PoolVector<real_t>::Write area_timesw = area_times.write();
+
+ for (int i = 0; i < profile_areas.size(); i++) {
+ area_namesw[i] = profile_areas[i].name;
+ area_timesw[i * 2 + 0] = profile_areas[i].cpu_msec;
+ area_timesw[i * 2 + 1] = profile_areas[i].gpu_msec;
+ }
+ }
+ packet_peer_stream->put_var("visual_profile");
+ packet_peer_stream->put_var(3);
+ packet_peer_stream->put_var(VS::get_singleton()->get_frame_profile_frame());
+ packet_peer_stream->put_var(area_names);
+ packet_peer_stream->put_var(area_times);
+ }
+ }
if (profiling) {
@@ -996,7 +1028,7 @@ void ScriptDebuggerRemote::idle_poll() {
}
}
- if (profiling_network) {
+ if (network_profiling) {
uint64_t pt = OS::get_singleton()->get_ticks_msec();
if (pt - last_net_bandwidth_time > 200) {
last_net_bandwidth_time = pt;
@@ -1229,7 +1261,8 @@ ScriptDebuggerRemote::ResourceUsageFunc ScriptDebuggerRemote::resource_usage_fun
ScriptDebuggerRemote::ScriptDebuggerRemote() :
profiling(false),
- profiling_network(false),
+ visual_profiling(false),
+ network_profiling(false),
max_frame_functions(16),
skip_profile_frame(false),
reload_all_scripts(false),
diff --git a/scene/debugger/script_debugger_remote.h b/scene/debugger/script_debugger_remote.h
index 2c0dccdaf7..ae44bf9ca2 100644
--- a/scene/debugger/script_debugger_remote.h
+++ b/scene/debugger/script_debugger_remote.h
@@ -62,7 +62,8 @@ class ScriptDebuggerRemote : public ScriptDebugger {
float frame_time, idle_time, physics_time, physics_frame_time;
bool profiling;
- bool profiling_network;
+ bool visual_profiling;
+ bool network_profiling;
int max_frame_functions;
bool skip_profile_frame;
bool reload_all_scripts;