Merge pull request #104851 from Ivorforce/tracy

Add `profiler` option to `SCons` builds, with support for `tracy` and `perfetto`.
This commit is contained in:
Thaddeus Crews
2025-11-12 11:24:15 -06:00
25 changed files with 375 additions and 1 deletions

View File

@@ -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();

View File

@@ -32,6 +32,7 @@
#import "godot_application.h"
#include "core/profiling/profiling.h"
#include "main/main.h"
#if defined(SANITIZERS_ENABLED)
@@ -39,6 +40,8 @@
#endif
int main(int argc, char **argv) {
godot_init_profiler();
#if defined(VULKAN_ENABLED)
setenv("MVK_CONFIG_FULL_IMAGE_VIEW_SWIZZLE", "1", 1); // MoltenVK - enable full component swizzling support.
setenv("MVK_CONFIG_SWAPCHAIN_MIN_MAG_FILTER_USE_NEAREST", "0", 1); // MoltenVK - use linear surface scaling. TODO: remove when full DPI scaling is implemented.

View File

@@ -41,6 +41,7 @@
#include "core/crypto/crypto_core.h"
#include "core/io/file_access.h"
#include "core/os/main_loop.h"
#include "core/profiling/profiling.h"
#include "core/version_generated.gen.h"
#include "drivers/apple/os_log_logger.h"
#include "main/main.h"
@@ -1080,6 +1081,8 @@ static void handle_interrupt(int sig) {
}
void OS_MacOS_NSApp::start_main() {
godot_init_profiler();
Error err;
@autoreleasepool {
err = Main::setup(execpath, argc, argv);
@@ -1103,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) {
@@ -1276,6 +1282,9 @@ void OS_MacOS_Embedded::run() {
while (true) {
@autoreleasepool {
@try {
GodotProfileFrameMark;
GodotProfileZone("macOS embedded main loop");
ds->process_events();
#ifdef SDL_ENABLED