|
36 | 36 | #include "core/config/engine.h" |
37 | 37 | #include "core/config/project_settings.h" |
38 | 38 | #include "core/os/memory.h" |
| 39 | +#include "core/profiling/profiling.h" |
39 | 40 | #include "core/version.h" |
40 | 41 |
|
41 | 42 | #include "openxr_platform_inc.h" |
@@ -170,6 +171,7 @@ void OpenXRAPI::OpenXRSwapChainInfo::free() { |
170 | 171 | } |
171 | 172 |
|
172 | 173 | bool OpenXRAPI::OpenXRSwapChainInfo::acquire(bool &p_should_render) { |
| 174 | + GodotProfileZone("OpenXR: acquire swapchain"); |
173 | 175 | ERR_FAIL_COND_V(image_acquired, true); // This was not released when it should be, error out and reuse... |
174 | 176 |
|
175 | 177 | OpenXRAPI *openxr_api = OpenXRAPI::get_singleton(); |
@@ -2260,11 +2262,15 @@ bool OpenXRAPI::process() { |
2260 | 2262 | return false; |
2261 | 2263 | } |
2262 | 2264 |
|
| 2265 | + GodotProfileZone("OpenXRAPI::process"); |
| 2266 | + GodotProfileZoneGroupedFirst(_profile_zone, "xrWaitFrame"); |
| 2267 | + |
2263 | 2268 | // We call xrWaitFrame as early as possible, this will allow OpenXR to get |
2264 | 2269 | // proper timing info between this point, and when we're ready to start rendering. |
2265 | 2270 | // As the name suggests, OpenXR can pause the thread to minimize the time between |
2266 | 2271 | // retrieving tracking data and using that tracking data to render. |
2267 | 2272 | // OpenXR thus works best if rendering is performed on a separate thread. |
| 2273 | + |
2268 | 2274 | void *frame_wait_info_next_pointer = nullptr; |
2269 | 2275 | for (OpenXRExtensionWrapper *extension : frame_info_extensions) { |
2270 | 2276 | void *np = extension->set_frame_wait_info_and_get_next_pointer(frame_wait_info_next_pointer); |
@@ -2298,20 +2304,24 @@ bool OpenXRAPI::process() { |
2298 | 2304 | frame_state.predictedDisplayPeriod = 0; |
2299 | 2305 | } |
2300 | 2306 |
|
| 2307 | + GodotProfileZoneGrouped(_profile_zone, "set_render_display_info"); |
2301 | 2308 | set_render_display_info(frame_state.predictedDisplayTime, frame_state.shouldRender); |
2302 | 2309 |
|
2303 | 2310 | // This is before setup_play_space() to ensure that it happens on the frame after |
2304 | 2311 | // the play space has been created. |
2305 | 2312 | if (unlikely(local_floor_emulation.should_reset_floor_height && !play_space_is_dirty)) { |
| 2313 | + GodotProfileZoneGrouped(_profile_zone, "reset_emulated_floor_height"); |
2306 | 2314 | reset_emulated_floor_height(); |
2307 | 2315 | local_floor_emulation.should_reset_floor_height = false; |
2308 | 2316 | } |
2309 | 2317 |
|
2310 | 2318 | if (unlikely(play_space_is_dirty)) { |
| 2319 | + GodotProfileZoneGrouped(_profile_zone, "setup_play_space"); |
2311 | 2320 | setup_play_space(); |
2312 | 2321 | play_space_is_dirty = false; |
2313 | 2322 | } |
2314 | 2323 |
|
| 2324 | + GodotProfileZoneGrouped(_profile_zone, "extension wrappers on_process"); |
2315 | 2325 | for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) { |
2316 | 2326 | wrapper->on_process(); |
2317 | 2327 | } |
|
0 commit comments