KhronosGroup / KhronosGroup/OpenXR-Docs

Correct time to call xrBeginFrame is unclear

Open
#36 3 comments 2 reactions 0 assignees View on GitHub
clarification synced to gitlab
Dominant language
Python
Stars
181
Forks
74
PR merge metrics
No merged PRs in 30d

Description

The spec says:

> Applications should call xrBeginFrame right before executing any graphics device work for a given frame

"graphics device work" is not well defined. For Vulkan, the most plausible interpretation is that it should be called immediately prior to the first `vkQueueSubmit` related to rendering the frame. However, another interpretation might be to call it before beginning to record command buffers.

[The reference guide](https://www.khronos.org/files/openxr-10-reference-guide.pdf) further confuses matters by specifying that `xrBeginFrame` be called immediately after `xrWaitFrame`, but this seems unlikely to be correct, as it would tend to include significant CPU work. Further, if that were the intended pattern there would be no point to having a separate function call. It also clearly sequences it prior to the swapchain image acquire/wait operations, which are certainly not GPU work for the current frame and may block the thread.

My understanding is that `xrBeginFrame`'s purpose is to improve a runtime's ability to reason about the time required by an application to render a frame. If applications aren't calling it at a consistent time with regard to other operations, that purpose will be defeated, so specific language should be added defining *precisely* when `xrBeginFrame` should be called with regard to per-frame CPU work, GPU work (with a clearer definition of its own), and other OpenXR calls, and the reference guide updated to match.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the quoted OpenXR specification text and the linked reference guide, comparing their ordering of xrWaitFrame, xrBeginFrame, swapchain operations, and rendering work. Done means the specification defines precisely when xrBeginFrame should be called, clarifies graphics device work, and the reference guide matches that wording.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.