MCPcopy Create free account
hub / github.com/comaps/comaps / OnContextCreate

Method OnContextCreate

libs/drape_frontend/frontend_renderer.cpp:2320–2376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2318}
2319
2320void FrontendRenderer::OnContextCreate()
2321{
2322 TRACE_SECTION("[drape] OnContextCreate (FrontendRenderer)");
2323 LOG(LINFO, ("On context create."));
2324
2325 m_context = make_ref(m_contextFactory->GetDrawContext());
2326 m_contextFactory->WaitForInitialization(m_context.get());
2327
2328 m_context->MakeCurrent();
2329
2330 m_context->Init(m_apiVersion);
2331
2332 // Render empty frame here to avoid black initialization screen.
2333 RenderEmptyFrame();
2334
2335 dp::SupportManager::Instance().Init(m_context);
2336
2337 m_gpuProgramManager = make_unique_dp<gpu::ProgramManager>();
2338 m_gpuProgramManager->Init(m_context);
2339
2340 dp::AlphaBlendingState::Apply(m_context);
2341
2342 m_debugRectRenderer = make_unique_dp<DebugRectRenderer>(
2343 m_context, m_gpuProgramManager->GetProgram(gpu::Program::DebugRect), m_gpuProgramManager->GetParamsSetter());
2344 m_debugRectRenderer->SetEnabled(m_isDebugRectRenderingEnabled);
2345
2346 m_overlayTree->SetDebugRectRenderer(make_ref(m_debugRectRenderer));
2347 m_overlayTree->SetVisualScale(VisualParams::Instance().GetVisualScale());
2348
2349 // Resources recovering.
2350 m_screenQuadRenderer = make_unique_dp<ScreenQuadRenderer>(m_context);
2351
2352 m_postprocessRenderer->Init(m_context, [this]()
2353 {
2354 CHECK(m_context != nullptr, ());
2355 if (!m_context->Validate())
2356 return false;
2357 m_context->SetFramebuffer(nullptr /* default */);
2358 return true;
2359 }, [this](ScreenBase const & modelView) { PreRender3dLayer(modelView); });
2360
2361#ifndef OMIM_OS_IPHONE_SIMULATOR
2362 for (auto const & effect : m_enabledOnStartEffects)
2363 m_postprocessRenderer->SetEffectEnabled(m_context, effect, true /* enabled */);
2364 m_enabledOnStartEffects.clear();
2365
2366 if (dp::SupportManager::Instance().IsAntialiasingEnabledByDefault() || m_screenshotMode)
2367 m_postprocessRenderer->SetEffectEnabled(m_context, PostprocessRenderer::Antialiasing, true);
2368#endif
2369
2370 m_buildingsFramebuffer =
2371 make_unique_dp<dp::Framebuffer>(dp::TextureFormat::RGBA8, true /* depthEnabled */, false /* stencilEnabled */);
2372 m_buildingsFramebuffer->SetFramebufferFallback([this]()
2373 { return m_postprocessRenderer->OnFramebufferFallback(m_context); });
2374
2375 m_transitBackground = make_unique_dp<ScreenQuadRenderer>(m_context);
2376}
2377

Callers

nothing calls this directly

Calls 15

make_refFunction · 0.85
ApplyFunction · 0.85
GetParamsSetterMethod · 0.80
SetDebugRectRendererMethod · 0.80
GetVisualScaleMethod · 0.80
SetEffectEnabledMethod · 0.80
OnFramebufferFallbackMethod · 0.80
getMethod · 0.65
GetDrawContextMethod · 0.45
WaitForInitializationMethod · 0.45

Tested by

no test coverage detected