Skip to content

Commit

Permalink
OpenXR: Fix VD fix not working after recent VD updates
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 20, 2023
1 parent 8103c28 commit 628686e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/mods/vr/runtimes/OpenXR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,7 @@ XrResult OpenXR::end_frame(const std::vector<XrCompositionLayerBaseHeader*>& qua
// Dummy projection layers for Virtual Desktop. If we don't do this, timewarp does not work correctly on VD.
// the reasoning from ggodin (VD dev) is that VD composites all layers using the top layer's pose (apparently)
// I am actually not sure why this fixes the issue, but it does. and even makes the SteamVR overlay work completely fine.
const auto should_push_dummy = this->push_dummy_projection == true && !pipelined_stage_views.empty();
const auto should_push_dummy = this->push_dummy_projection == true && !pipelined_stage_views.empty() && this->ever_submitted == true;

XrCompositionLayerProjection dummy_projection_layer{XR_TYPE_COMPOSITION_LAYER_PROJECTION};
std::array<XrCompositionLayerProjectionView, 2> dummy_projection_layer_views{};
Expand Down Expand Up @@ -1790,6 +1790,8 @@ XrResult OpenXR::end_frame(const std::vector<XrCompositionLayerBaseHeader*>& qua
spdlog::error("[VR] xrEndFrame time: submitted: {} vs frame_state: {}", frame_end_info.displayTime, this->frame_state.predictedDisplayTime);
spdlog::error("[VR] display time diff: {}", frame_end_info.displayTime - this->frame_state.predictedDisplayTime);
}
} else {
this->ever_submitted = true;
}

this->frame_began = false;
Expand Down
3 changes: 2 additions & 1 deletion src/mods/vr/runtimes/OpenXR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ struct OpenXR final : public VRRuntime {

const ModSlider::Ptr resolution_scale{ ModSlider::create("OpenXR_ResolutionScale", 0.1f, 5.0f, 1.0f) };
bool push_dummy_projection{ false };

bool ever_submitted{false};

Mod::ValueList options{
*resolution_scale,
};
Expand Down

0 comments on commit 628686e

Please sign in to comment.