|
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(); |
@@ -2239,11 +2241,15 @@ bool OpenXRAPI::process() { |
2239 | 2241 | return false; |
2240 | 2242 | } |
2241 | 2243 |
|
| 2244 | + GodotProfileZone("OpenXRAPI::process"); |
| 2245 | + GodotProfileZoneGroupedFirst(_profile_zone, "xrWaitFrame"); |
| 2246 | + |
2242 | 2247 | // We call xrWaitFrame as early as possible, this will allow OpenXR to get |
2243 | 2248 | // proper timing info between this point, and when we're ready to start rendering. |
2244 | 2249 | // As the name suggests, OpenXR can pause the thread to minimize the time between |
2245 | 2250 | // retrieving tracking data and using that tracking data to render. |
2246 | 2251 | // OpenXR thus works best if rendering is performed on a separate thread. |
| 2252 | + |
2247 | 2253 | void *frame_wait_info_next_pointer = nullptr; |
2248 | 2254 | for (OpenXRExtensionWrapper *extension : frame_info_extensions) { |
2249 | 2255 | void *np = extension->set_frame_wait_info_and_get_next_pointer(frame_wait_info_next_pointer); |
@@ -2277,20 +2283,24 @@ bool OpenXRAPI::process() { |
2277 | 2283 | frame_state.predictedDisplayPeriod = 0; |
2278 | 2284 | } |
2279 | 2285 |
|
| 2286 | + GodotProfileZoneGrouped(_profile_zone, "set_render_display_info"); |
2280 | 2287 | set_render_display_info(frame_state.predictedDisplayTime, frame_state.shouldRender); |
2281 | 2288 |
|
2282 | 2289 | // This is before setup_play_space() to ensure that it happens on the frame after |
2283 | 2290 | // the play space has been created. |
2284 | 2291 | if (unlikely(local_floor_emulation.should_reset_floor_height && !play_space_is_dirty)) { |
| 2292 | + GodotProfileZoneGrouped(_profile_zone, "reset_emulated_floor_height"); |
2285 | 2293 | reset_emulated_floor_height(); |
2286 | 2294 | local_floor_emulation.should_reset_floor_height = false; |
2287 | 2295 | } |
2288 | 2296 |
|
2289 | 2297 | if (unlikely(play_space_is_dirty)) { |
| 2298 | + GodotProfileZoneGrouped(_profile_zone, "setup_play_space"); |
2290 | 2299 | setup_play_space(); |
2291 | 2300 | play_space_is_dirty = false; |
2292 | 2301 | } |
2293 | 2302 |
|
| 2303 | + GodotProfileZoneGrouped(_profile_zone, "extension wrappers on_process"); |
2294 | 2304 | for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) { |
2295 | 2305 | wrapper->on_process(); |
2296 | 2306 | } |
|
0 commit comments