5 The Use of Pico OpenXR Play Boundary¶
The use of the play boundary requires to set a synchronous semaphore gsIndex by extension, so that the HMD sensor can correspond to the camera sensor.
For this part, Pico provides an extension XR_PICO_view_state_ext_enable
that needs to be turned on when xrCreateInstance
is called.
By passing the declared instance address of the XrViewStatePICOEXT
to the next pointer of viewState and calling xrLocateViews
, the synchronous semaphore gsIndex will be returned.
Then, at xrEndFrame
, it will be passed in by extension. The sample code is as follows. Please refer to the HelloXR Sample for details.
Getting gsIndex :
int mGsIndex;
XrViewStatePICOEXT xrViewStatePICOEXT;
XrViewState viewState{XR_TYPE_VIEW_STATE};
viewState.next = (void*)&xrViewStatePICOEXT;
xrLocateViews(mSession, &viewLocateInfo, &viewState, viewCapacityInput, &viewCountOutput, mViews.data());
mGsIndex = xrViewStatePICOEXT.gsIndex;
Passing in gsIndex :
XrFrameEndInfoEXT xrFrameEndInfoEXT;
xrFrameEndInfoEXT.useHeadposeExt = 1;
xrFrameEndInfoEXT.gsIndex = mGsIndex ;
frameEndInfo.next = (void*)&xrFrameEndInfoEXT;
xrEndFrame(mSession, &frameEndInfo);
Synchronization can be achieved with the above code, and the play boundary can be used normally.
Note: At present, when using the play boundary, it is necessary to ensure that the layer
is submitted all the time.