Skip to content

Commit

Permalink
openxr: call xrBeginFrame even if shouldRender == true
Browse files Browse the repository at this point in the history
```
As long as the session is running, the application should keep running
the frame loop to maintain the frame synchronization to the runtime, even
if this requires calling xrEndFrame with all layers omitted.
```

In OpenXRDevice::end_frame() we return early after calling xrEndFrame with
0 layers submitted if shouldRender is false.
This early return still requires us to have called xrBeginFrame.
  • Loading branch information
ChristophHaag committed Jan 27, 2022
1 parent a2ed5ca commit 5560652
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions drivers/openxr/openxr_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1660,17 +1660,19 @@ void OpenXRDevice::pre_render() {
#endif
}

if (frame_state.shouldRender) {
// let's start our frame..
XrFrameBeginInfo frame_begin_info = {
XR_TYPE_FRAME_BEGIN_INFO, // type
nullptr // next
};
result = xrBeginFrame(session, &frame_begin_info);
if (XR_FAILED(result)) {
print_line("OpenXR: failed to being frame [", get_error_string(result), "]");
return;
}
if (!frame_state.shouldRender) {
// TODO: Tell godot not do render VR to save resources.
}

// let's start our frame..
XrFrameBeginInfo frame_begin_info = {
XR_TYPE_FRAME_BEGIN_INFO, // type
nullptr // next
};
result = xrBeginFrame(session, &frame_begin_info);
if (XR_FAILED(result)) {
print_line("OpenXR: failed to being frame [", get_error_string(result), "]");
return;
}
}

Expand Down

0 comments on commit 5560652

Please sign in to comment.