Skip to content

Commit

Permalink
VDXR: Fix standing origin getting flung into the middle of nowhere
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jan 31, 2024
1 parent 1fa2715 commit 0341611
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/mods/vr/runtimes/OpenXR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,28 @@ VRRuntime::Error OpenXR::update_poses() {

uint32_t view_count{};

const auto display_time = this->frame_state.predictedDisplayTime + (XrDuration)(this->frame_state.predictedDisplayPeriod * this->prediction_scale);
// Only signal that we got the first valid pose if the display time becomes a sane value
if (!this->got_first_valid_poses) {
// Seen on VDXR
if (this->frame_state.predictedDisplayTime <= this->frame_state.predictedDisplayPeriod) {
spdlog::info("[VR] Frame state predicted display time is less than predicted display period!");
return VRRuntime::Error::SUCCESS;
}

// Seen on VDXR. If for some reason the above if statement doesn't work, this will catch it.
if (this->frame_state.predictedDisplayTime == 11111111) {
spdlog::info("[VR] Frame state predicted display time is 11111111!");
return VRRuntime::Error::SUCCESS;
}
}

if (display_time <= 1000) {
if (this->frame_state.predictedDisplayTime <= 1000) {
spdlog::info("[VR] Frame state predicted display time is less than 1000!");
return VRRuntime::Error::SUCCESS;
}

const auto display_time = this->frame_state.predictedDisplayTime + (XrDuration)(this->frame_state.predictedDisplayPeriod * this->prediction_scale);

XrViewLocateInfo view_locate_info{XR_TYPE_VIEW_LOCATE_INFO};
view_locate_info.viewConfigurationType = this->view_config;
view_locate_info.displayTime = display_time;
Expand Down

0 comments on commit 0341611

Please sign in to comment.