public void Dispose() { preparedFrame?.Dispose(); framePreparer.Dispose(); standardSamplers.Dispose(); hiddenAreaMeshes.Dispose(); OpenVR.Shutdown(); immediateContext.Dispose(); companionWindow.Dispose(); shaderCache.Dispose(); device.Dispose(); }
private void DoFrame() { OpenVR.Compositor.WaitGetPoses(poses, gamePoses); timeKeeper.AdvanceFrame(); PumpVREvents(); KickoffFramePreparation(); immediateContext.WithEvent("VRApp::Prework", () => { preparedFrame.DoPrework(device.ImmediateContext, poses); }); SubmitEye(EVREye.Eye_Left, preparedFrame); SubmitEye(EVREye.Eye_Right, preparedFrame); if (companionWindow.HasIndependentCamera) { Matrix companionViewTransform = companionWindow.GetViewTransform(); Matrix companionWindowProjectionMatrix = companionWindow.GetDesiredProjectionMatrix(); immediateContext.WithEvent("VRApp::RenderCompanionView", () => { RenderView(preparedFrame, null, companionViewTransform, companionWindowProjectionMatrix); }); } companionWindow.Display( mostRecentRenderTexture, mostRecentProjectionTransform, () => preparedFrame.DrawCompanionWindowUi(device.ImmediateContext)); preparedFrame.DoPostwork(device.ImmediateContext); OpenVR.Compositor.PostPresentHandoff(); preparedFrame.Dispose(); preparedFrame = asyncFramePreparer.FinishPreparingFrame(); }