OpenXR - Code cleanup

This commit is contained in:
Lubos committed 2023-06-26 17:26:56 +02:00
1 parent f46c29fde3
commit a6709c70e0
2 files changed
+6 -18

No files matched your search

+1 -10
View File
@@ -323,17 +323,8 @@ void ovrFramebuffer_Acquire(ovrFramebuffer* frameBuffer) {
XrSwapchainImageWaitInfo waitInfo;
waitInfo.type = XR_TYPE_SWAPCHAIN_IMAGE_WAIT_INFO;
waitInfo.next = NULL;
waitInfo.timeout = 1000000; /* timeout in nanoseconds */
waitInfo.timeout = XR_INFINITE_DURATION;
XrResult res = xrWaitSwapchainImage(frameBuffer->ColorSwapChain.Handle, &waitInfo);
int i = 0;
while ((res != XR_SUCCESS) && (i < 10)) {
res = xrWaitSwapchainImage(frameBuffer->ColorSwapChain.Handle, &waitInfo);
i++;
ALOGV(
" Retry xrWaitSwapchainImage %d times due to XR_TIMEOUT_EXPIRED (duration %f micro seconds)",
i,
waitInfo.timeout * (1E-9));
}
frameBuffer->Acquired = res == XR_SUCCESS;
ovrFramebuffer_SetCurrent(frameBuffer);
+5 -8
View File
@@ -327,7 +327,11 @@ bool VR_InitFrame( engine_t* engine ) {
projectionCapacityInput,
&projectionCountOutput,
projections));
//
if ((viewState.viewStateFlags & XR_VIEW_STATE_POSITION_VALID_BIT) == 0 ||
(viewState.viewStateFlags & XR_VIEW_STATE_ORIENTATION_VALID_BIT) == 0) {
return false; // There is no valid tracking poses for the views.
}
fov = {};
for (int eye = 0; eye < ovrMaxNumEyes; eye++) {
@@ -486,14 +490,7 @@ void VR_FinishFrame( engine_t* engine ) {
endFrameInfo.environmentBlendMode = XR_ENVIRONMENT_BLEND_MODE_OPAQUE;
endFrameInfo.layerCount = engine->appState.LayerCount;
endFrameInfo.layers = layers;
OXR(xrEndFrame(engine->appState.Session, &endFrameInfo));
int instances = engine->appState.Renderer.Multiview ? 1 : ovrMaxNumEyes;
for (int i = 0; i < instances; i++) {
ovrFramebuffer* frameBuffer = &engine->appState.Renderer.FrameBuffer[instances];
frameBuffer->TextureSwapChainIndex++;
frameBuffer->TextureSwapChainIndex %= frameBuffer->TextureSwapChainLength;
}
}
int VR_GetConfig( VRConfig config ) {