mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Add some important profiling hooks.
This commit is contained in:
parent
e80194e31f
commit
c3747884da
14 changed files with 118 additions and 10 deletions
|
|
@ -42,6 +42,7 @@
|
|||
#include "core/extension/gdextension_manager.h"
|
||||
#include "core/io/xml_parser.h"
|
||||
#include "core/os/main_loop.h"
|
||||
#include "core/profiling/profiling.h"
|
||||
#include "drivers/unix/dir_access_unix.h"
|
||||
#include "drivers/unix/file_access_unix.h"
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
|
@ -356,6 +357,8 @@ void OS_Android::main_loop_begin() {
|
|||
}
|
||||
|
||||
bool OS_Android::main_loop_iterate(bool *r_should_swap_buffers) {
|
||||
GodotProfileFrameMark;
|
||||
GodotProfileZone("OS_Android::main_loop_iterate");
|
||||
if (!main_loop) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#ifdef SDL_ENABLED
|
||||
#include "drivers/sdl/joypad_sdl.h"
|
||||
#endif
|
||||
#include "core/profiling/profiling.h"
|
||||
#include "main/main.h"
|
||||
#include "servers/display/display_server.h"
|
||||
#include "servers/rendering/rendering_server.h"
|
||||
|
|
@ -970,6 +971,8 @@ String OS_LinuxBSD::get_system_dir(SystemDir p_dir, bool p_shared_storage) const
|
|||
}
|
||||
|
||||
void OS_LinuxBSD::run() {
|
||||
GodotProfileFrameMark;
|
||||
GodotProfileZone("OS_LinuxBSD::run");
|
||||
if (!main_loop) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#import "godot_window.h"
|
||||
#import "key_mapping_macos.h"
|
||||
|
||||
#include "core/profiling/profiling.h"
|
||||
#include "main/main.h"
|
||||
|
||||
@implementation GodotContentLayerDelegate
|
||||
|
|
@ -56,6 +57,9 @@
|
|||
- (void)displayLayer:(CALayer *)layer {
|
||||
DisplayServerMacOS *ds = (DisplayServerMacOS *)DisplayServer::get_singleton();
|
||||
if (OS::get_singleton()->get_main_loop() && ds->get_is_resizing() && need_redraw) {
|
||||
GodotProfileFrameMark;
|
||||
GodotProfileZone("[GodotContentLayerDelegate displayLayer]");
|
||||
|
||||
Main::force_redraw();
|
||||
if (!Main::is_iterating()) { // Avoid cyclic loop.
|
||||
Main::iteration();
|
||||
|
|
|
|||
|
|
@ -1106,6 +1106,9 @@ void OS_MacOS_NSApp::start_main() {
|
|||
pre_wait_observer = CFRunLoopObserverCreateWithHandler(kCFAllocatorDefault, kCFRunLoopBeforeWaiting, true, 0, ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
|
||||
@autoreleasepool {
|
||||
@try {
|
||||
GodotProfileFrameMark;
|
||||
GodotProfileZone("macOS main loop");
|
||||
|
||||
if (ds_mac) {
|
||||
ds_mac->_process_events(false);
|
||||
} else if (ds) {
|
||||
|
|
@ -1279,6 +1282,9 @@ void OS_MacOS_Embedded::run() {
|
|||
while (true) {
|
||||
@autoreleasepool {
|
||||
@try {
|
||||
GodotProfileFrameMark;
|
||||
GodotProfileZone("macOS embedded main loop");
|
||||
|
||||
ds->process_events();
|
||||
|
||||
#ifdef SDL_ENABLED
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "core/debugger/engine_debugger.h"
|
||||
#include "core/io/file_access.h"
|
||||
#include "core/os/main_loop.h"
|
||||
#include "core/profiling/profiling.h"
|
||||
#include "drivers/unix/dir_access_unix.h"
|
||||
#include "drivers/unix/file_access_unix.h"
|
||||
#include "main/main.h"
|
||||
|
|
@ -79,6 +80,8 @@ void OS_Web::fs_sync_callback() {
|
|||
}
|
||||
|
||||
bool OS_Web::main_loop_iterate() {
|
||||
GodotProfileFrameMark;
|
||||
GodotProfileZone("OS_Web::main_loop_iterate");
|
||||
if (is_userfs_persistent() && idb_needs_sync && !idb_is_syncing) {
|
||||
idb_is_syncing = true;
|
||||
idb_needs_sync = false;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "core/debugger/script_debugger.h"
|
||||
#include "core/io/marshalls.h"
|
||||
#include "core/os/main_loop.h"
|
||||
#include "core/profiling/profiling.h"
|
||||
#include "core/version_generated.gen.h"
|
||||
#include "drivers/windows/dir_access_windows.h"
|
||||
#include "drivers/windows/file_access_windows.h"
|
||||
|
|
@ -2329,6 +2330,8 @@ void OS_Windows::run() {
|
|||
main_loop->initialize();
|
||||
|
||||
while (true) {
|
||||
GodotProfileFrameMark;
|
||||
GodotProfileZone("OS_Windows::run");
|
||||
DisplayServer::get_singleton()->process_events(); // get rid of pending events
|
||||
if (Main::iteration()) {
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue