diff --git a/main/main.cpp b/main/main.cpp index 026e85d8bb1..5727a27262f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -4759,9 +4759,11 @@ bool Main::iteration() { // process all our active interfaces #ifndef XR_DISABLED + GodotProfileZoneGrouped(_profile_zone, "xr_server->_process"); XRServer::get_singleton()->_process(); #endif // XR_DISABLED + GodotProfileZoneGrouped(_profile_zone, "physics"); for (int iters = 0; iters < advance.physics_steps; ++iters) { GodotProfileZone("Physics Step"); GodotProfileZoneGroupedFirst(_physics_zone, "setup"); diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index 70ad0e03f3c..9032f2ed2a6 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -36,6 +36,7 @@ #include "core/config/engine.h" #include "core/config/project_settings.h" #include "core/os/memory.h" +#include "core/profiling/profiling.h" #include "core/version.h" #include "openxr_platform_inc.h" @@ -170,6 +171,7 @@ void OpenXRAPI::OpenXRSwapChainInfo::free() { } bool OpenXRAPI::OpenXRSwapChainInfo::acquire(bool &p_should_render) { + GodotProfileZone("OpenXR: acquire swapchain"); ERR_FAIL_COND_V(image_acquired, true); // This was not released when it should be, error out and reuse... OpenXRAPI *openxr_api = OpenXRAPI::get_singleton(); @@ -2260,11 +2262,15 @@ bool OpenXRAPI::process() { return false; } + GodotProfileZone("OpenXRAPI::process"); + GodotProfileZoneGroupedFirst(_profile_zone, "xrWaitFrame"); + // We call xrWaitFrame as early as possible, this will allow OpenXR to get // proper timing info between this point, and when we're ready to start rendering. // As the name suggests, OpenXR can pause the thread to minimize the time between // retrieving tracking data and using that tracking data to render. // OpenXR thus works best if rendering is performed on a separate thread. + void *frame_wait_info_next_pointer = nullptr; for (OpenXRExtensionWrapper *extension : frame_info_extensions) { void *np = extension->set_frame_wait_info_and_get_next_pointer(frame_wait_info_next_pointer); @@ -2298,20 +2304,24 @@ bool OpenXRAPI::process() { frame_state.predictedDisplayPeriod = 0; } + GodotProfileZoneGrouped(_profile_zone, "set_render_display_info"); set_render_display_info(frame_state.predictedDisplayTime, frame_state.shouldRender); // This is before setup_play_space() to ensure that it happens on the frame after // the play space has been created. if (unlikely(local_floor_emulation.should_reset_floor_height && !play_space_is_dirty)) { + GodotProfileZoneGrouped(_profile_zone, "reset_emulated_floor_height"); reset_emulated_floor_height(); local_floor_emulation.should_reset_floor_height = false; } if (unlikely(play_space_is_dirty)) { + GodotProfileZoneGrouped(_profile_zone, "setup_play_space"); setup_play_space(); play_space_is_dirty = false; } + GodotProfileZoneGrouped(_profile_zone, "extension wrappers on_process"); for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) { wrapper->on_process(); }