Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
10 changes: 10 additions & 0 deletions modules/openxr/openxr_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -2239,11 +2241,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);
Expand Down Expand Up @@ -2277,20 +2283,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();
}
Expand Down