You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-20 14:45:44 +00:00
Merge pull request #112893 from dsnopek/openxr-profiling
OpenXR: Add profiling macro for process, `xrWaitFrame()` and acquiring swapchain
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user