Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool HMDState::ConfigureRendering(ovrEyeRenderDesc eyeRenderDescOut[2],
- const ovrFovPort eyeFovIn[2],
- const ovrRenderAPIConfig* apiConfig,
- unsigned distortionCaps)
- {
- ThreadChecker::Scope checkScope(&RenderAPIThreadChecker, "ovrHmd_ConfigureRendering");
- // null -> shut down.
- if (!apiConfig)
- {
- if (pHSWDisplay)
- {
- pHSWDisplay->Shutdown();
- pHSWDisplay.Clear();
- }
- if (pRenderer)
- pRenderer.Clear();
- RenderingConfigured = false;
- return true;
- }
- if (pRenderer &&
- (apiConfig->Header.API != pRenderer->GetRenderAPI()))
- {
- // Shutdown old renderer.
- if (pHSWDisplay)
- {
- pHSWDisplay->Shutdown();
- pHSWDisplay.Clear();
- }
- if (pRenderer)
- pRenderer.Clear();
- }
- distortionCaps = distortionCaps & pHmdDesc->DistortionCaps;
- // Step 1: do basic setup configuration
- RenderState.EnabledHmdCaps = EnabledHmdCaps; // This is a copy... Any cleaner way?
- RenderState.DistortionCaps = distortionCaps;
- RenderState.EyeRenderDesc[0] = RenderState.CalcRenderDesc(ovrEye_Left, eyeFovIn[0]);
- RenderState.EyeRenderDesc[1] = RenderState.CalcRenderDesc(ovrEye_Right, eyeFovIn[1]);
- eyeRenderDescOut[0] = RenderState.EyeRenderDesc[0];
- eyeRenderDescOut[1] = RenderState.EyeRenderDesc[1];
- TimeManager.ResetFrameTiming(0,
- (EnabledHmdCaps & ovrHmdCap_DynamicPrediction) ? true : false,
- true);
- LastFrameTimeSeconds = 0.0f;
- // Set RenderingConfigured early to avoid ASSERTs in renderer initialization.
- RenderingConfigured = true;
- if (!pRenderer)
- {
- pRenderer = *DistortionRenderer::APICreateRegistry
- [apiConfig->Header.API](pHmdDesc, TimeManager, RenderState);
- }
- if (!pRenderer ||
- !pRenderer->Initialize(apiConfig))
- {
- RenderingConfigured = false;
- return false;
- }
- // Setup the Health and Safety Warning display system.
- if(pHSWDisplay && (pHSWDisplay->GetRenderAPIType() != apiConfig->Header.API)) // If we need to reconstruct the HSWDisplay for a different graphics API type, delete the existing display.
- {
- pHSWDisplay->Shutdown();
- pHSWDisplay.Clear();
- }
- if(!pHSWDisplay) // Use * below because that for of operator= causes it to inherit the refcount the factory gave the object.
- {
- pHSWDisplay = *OVR::CAPI::HSWDisplay::Factory(apiConfig->Header.API, pHmdDesc, RenderState);
- pHSWDisplay->Enable(pProfile->GetBoolValue("HSW", true));
- }
- if (pHSWDisplay)
- pHSWDisplay->Initialize(apiConfig); // This is potentially re-initializing it with a new config.
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement