Skip to content

Commit

Permalink
Merge pull request #81536 from BastiaanOlij/fix_openxr_not_running_er…
Browse files Browse the repository at this point in the history
…ror_spam

OpenXR: Fix error spam if session hasn't started yet
  • Loading branch information
YuriSizov committed Sep 14, 2023
2 parents 721cac4 + b1548e8 commit ded1393
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions modules/openxr/openxr_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,9 @@ Size2 OpenXRAPI::get_recommended_target_size() {
XRPose::TrackingConfidence OpenXRAPI::get_head_center(Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity) {
XrResult result;

ERR_FAIL_COND_V(!running, XRPose::XR_TRACKING_CONFIDENCE_NONE);
if (!running) {
return XRPose::XR_TRACKING_CONFIDENCE_NONE;
}

// xrWaitFrame not run yet
if (frame_state.predictedDisplayTime == 0) {
Expand Down Expand Up @@ -1487,7 +1489,9 @@ XRPose::TrackingConfidence OpenXRAPI::get_head_center(Transform3D &r_transform,
}

bool OpenXRAPI::get_view_transform(uint32_t p_view, Transform3D &r_transform) {
ERR_FAIL_COND_V(!running, false);
if (!running) {
return false;
}

// xrWaitFrame not run yet
if (frame_state.predictedDisplayTime == 0) {
Expand All @@ -1506,9 +1510,12 @@ bool OpenXRAPI::get_view_transform(uint32_t p_view, Transform3D &r_transform) {
}

bool OpenXRAPI::get_view_projection(uint32_t p_view, double p_z_near, double p_z_far, Projection &p_camera_matrix) {
ERR_FAIL_COND_V(!running, false);
ERR_FAIL_NULL_V(graphics_extension, false);

if (!running) {
return false;
}

// xrWaitFrame not run yet
if (frame_state.predictedDisplayTime == 0) {
return false;
Expand Down

0 comments on commit ded1393

Please sign in to comment.