62
62
#include " scene/resources/3d/world_3d.h"
63
63
#include " servers/physics_server_3d.h"
64
64
#endif // _3D_DISABLED
65
+ #include " modules/godot_tracy/tracy/public/tracy/Tracy.hpp"
65
66
#include " window.h"
66
67
#include < stdio.h>
67
68
#include < stdlib.h>
@@ -486,7 +487,10 @@ bool SceneTree::physics_process(double p_time) {
486
487
487
488
call_group (SNAME (" _picking_viewports" ), SNAME (" _process_picking" ));
488
489
489
- _process (true );
490
+ {
491
+ ZoneScopedN (" SceneTree::_process (Physics)" );
492
+ _process (true );
493
+ }
490
494
491
495
_flush_ugc ();
492
496
MessageQueue::get_singleton ()->flush (); // small little hack
@@ -511,19 +515,26 @@ bool SceneTree::process(double p_time) {
511
515
process_time = p_time;
512
516
513
517
if (multiplayer_poll) {
518
+ ZoneScopedN (" SceneTree::process::multiplayer_poll" );
514
519
multiplayer->poll ();
515
520
for (KeyValue<NodePath, Ref<MultiplayerAPI>> &E : custom_multiplayers) {
516
521
E.value ->poll ();
517
522
}
518
523
}
519
524
520
- emit_signal (SNAME (" process_frame" ));
525
+ {
526
+ ZoneScopedN (" SceneTree::signal::process_frame" );
527
+ emit_signal (SNAME (" process_frame" ));
528
+ }
521
529
522
530
MessageQueue::get_singleton ()->flush (); // small little hack
523
531
524
532
flush_transform_notifications ();
525
533
526
- _process (false );
534
+ {
535
+ ZoneScopedN (" SceneTree::_process" );
536
+ _process (false );
537
+ }
527
538
528
539
_flush_ugc ();
529
540
MessageQueue::get_singleton ()->flush (); // small little hack
@@ -919,11 +930,13 @@ void SceneTree::_process_group(ProcessGroup *p_group, bool p_physics) {
919
930
920
931
if (p_physics) {
921
932
if (p_group->physics_node_order_dirty ) {
933
+ ZoneScopedN (" SceneTree::_process_group Physics Node Sort" );
922
934
nodes.sort_custom <Node::ComparatorWithPhysicsPriority>();
923
935
p_group->physics_node_order_dirty = false ;
924
936
}
925
937
} else {
926
938
if (p_group->node_order_dirty ) {
939
+ ZoneScopedN (" SceneTree::_process_group Node Sort" );
927
940
nodes.sort_custom <Node::ComparatorWithPriority>();
928
941
p_group->node_order_dirty = false ;
929
942
}
@@ -935,31 +948,34 @@ void SceneTree::_process_group(ProcessGroup *p_group, bool p_physics) {
935
948
uint32_t node_count = nodes_copy.size ();
936
949
Node **nodes_ptr = (Node **)nodes_copy.ptr (); // Force cast, pointer will not change.
937
950
938
- for (uint32_t i = 0 ; i < node_count; i++) {
939
- Node *n = nodes_ptr[i];
940
- if (nodes_removed_on_group_call.has (n)) {
941
- // Node may have been removed during process, skip it.
942
- // Keep in mind removals can only happen on the main thread.
943
- continue ;
944
- }
945
-
946
- if (!n->can_process () || !n->is_inside_tree ()) {
947
- continue ;
948
- }
949
-
950
- if (p_physics) {
951
- if (n->is_physics_processing_internal ()) {
952
- n->notification (Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
953
- }
954
- if (n->is_physics_processing ()) {
955
- n->notification (Node::NOTIFICATION_PHYSICS_PROCESS);
951
+ {
952
+ ZoneScopedN (" SceneTree::_process_group Process" );
953
+ for (uint32_t i = 0 ; i < node_count; i++) {
954
+ Node *n = nodes_ptr[i];
955
+ if (nodes_removed_on_group_call.has (n)) {
956
+ // Node may have been removed during process, skip it.
957
+ // Keep in mind removals can only happen on the main thread.
958
+ continue ;
956
959
}
957
- } else {
958
- if (n->is_processing_internal ()) {
959
- n-> notification (Node::NOTIFICATION_INTERNAL_PROCESS) ;
960
+
961
+ if (! n->can_process () || !n-> is_inside_tree ()) {
962
+ continue ;
960
963
}
961
- if (n->is_processing ()) {
962
- n->notification (Node::NOTIFICATION_PROCESS);
964
+
965
+ if (p_physics) {
966
+ if (n->is_physics_processing_internal ()) {
967
+ n->notification (Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
968
+ }
969
+ if (n->is_physics_processing ()) {
970
+ n->notification (Node::NOTIFICATION_PHYSICS_PROCESS);
971
+ }
972
+ } else {
973
+ if (n->is_processing_internal ()) {
974
+ n->notification (Node::NOTIFICATION_INTERNAL_PROCESS);
975
+ }
976
+ if (n->is_processing ()) {
977
+ n->notification (Node::NOTIFICATION_PROCESS);
978
+ }
963
979
}
964
980
}
965
981
}
@@ -968,6 +984,7 @@ void SceneTree::_process_group(ProcessGroup *p_group, bool p_physics) {
968
984
}
969
985
970
986
void SceneTree::_process_groups_thread (uint32_t p_index, bool p_physics) {
987
+ ZoneScopedN (" SceneTree::_process_groups_thread" );
971
988
Node::current_process_thread_group = local_process_group_cache[p_index]->owner ;
972
989
_process_group (local_process_group_cache[p_index], p_physics);
973
990
Node::current_process_thread_group = nullptr ;
@@ -1036,6 +1053,7 @@ void SceneTree::_process(bool p_physics) {
1036
1053
if (using_threads) {
1037
1054
local_process_group_cache.push_back (process_groups[j]);
1038
1055
} else {
1056
+ ZoneScopedN (" SceneTree::_process_group" );
1039
1057
_process_group (process_groups[j], p_physics);
1040
1058
}
1041
1059
}
0 commit comments