How to set XrFrameState::shouldRender to true in xrWaitFrame?

When I use openxr to write a program and connect the oculus headset to render the display, the warning of No rendered appears, and I can’t see any pictures in the headset.

After consulting The OpenXR Specification, I found it mentioned:

The application should check whether xrWaitFrame returns an XrFrameState with shouldRender set to true before rendering a given frame to determine whether that frame will be visible to the user.

shouldRender is XR_TRUE if the application should render its layers as normal and submit them to xrEndFrame. When this value is XR_FALSE, the application should avoid heavy GPU work where possible, for example by skipping layer rendering and then omitting those layers when calling xrEndFrame.

I guess this may be the reason. But I don’t know why XrFrameState::shouldRender is set to false, and I want to know how to set it to true.

I would appreciate it if I could get an answer.

This sounds like a question you want to ask Oculus developer support rather than this forum if you want better support.

Also just to check: have you tried wearing the headset? The Quest display goes to sleep if you don’t wear it, and I could see the OpenXR runtime telling you to not render frame if the display is sleeping.

Thank you for your reply.

I wore headset during the test, not because the device was dormant.

I will continue to look for answers at Oculus developer support.

Just to clarify: shouldRender is purely information from the runtime to the OpenXR application. It tells the application that whatever it submits will not be shown in the headset. There is no way for an OpenXR application to directly modify this.

The spec gives those examples:

For any frame where shouldRender is XR_FALSE, the application should avoid heavy GPU work for that frame, for example by not rendering its layers. This typically happens when the application is transitioning into or out of a running session, or when some system UI is fully covering the application at the moment. 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.

So if you’re positive that the runtime has your application in the XR_SESSION_STATE_VISIBLE or XR_SESSION_STATE_FOCUSED state and there is nothing else running that potentially could block the view of your OpenXR application, it would indeed be a question best asked to Oculus.

General tips:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.