forked from organicmaps/organicmaps
[iphone] fixed initialization on iphone.
This commit is contained in:
parent
efa5249318
commit
2a859dfefd
5 changed files with 40 additions and 24 deletions
|
@ -97,8 +97,14 @@
|
|||
rmParams.m_rtFormat = fmt;
|
||||
|
||||
renderPolicy = CreateRenderPolicy(videoTimer, false, rmParams, renderContext);
|
||||
|
||||
// check for error
|
||||
if (renderPolicy == 0)
|
||||
{
|
||||
/// terminate program (though this situation is unreal :) )
|
||||
}
|
||||
|
||||
frameBuffer = renderPolicy->GetDrawer()->screen()->frameBuffer();
|
||||
|
||||
framework->SetRenderPolicy(renderPolicy);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,7 @@ RenderPolicy::RenderPolicy(shared_ptr<yg::gl::RenderContext> const & primaryRC,
|
|||
m_doForceUpdate(false)
|
||||
{
|
||||
yg::gl::InitExtensions();
|
||||
if (!yg::gl::CheckExtensionSupport())
|
||||
throw std::exception();
|
||||
yg::gl::CheckExtensionSupport();
|
||||
}
|
||||
|
||||
m2::RectI const RenderPolicy::OnSize(int w, int h)
|
||||
|
@ -136,29 +135,36 @@ RenderPolicy * CreateRenderPolicy(VideoTimer * videoTimer,
|
|||
yg::ResourceManager::Params const & rmParams,
|
||||
shared_ptr<yg::gl::RenderContext> const & primaryRC)
|
||||
{
|
||||
bool benchmarkingEnabled = false;
|
||||
Settings::Get("IsBenchmarking", benchmarkingEnabled);
|
||||
|
||||
if (benchmarkingEnabled)
|
||||
try
|
||||
{
|
||||
bool isBenchmarkingMT = false;
|
||||
Settings::Get("IsBenchmarkingMT", isBenchmarkingMT);
|
||||
bool benchmarkingEnabled = false;
|
||||
Settings::Get("IsBenchmarking", benchmarkingEnabled);
|
||||
|
||||
if (isBenchmarkingMT)
|
||||
return new BenchmarkTilingRenderPolicyMT(videoTimer, useDefaultFB, rmParams, primaryRC);
|
||||
if (benchmarkingEnabled)
|
||||
{
|
||||
bool isBenchmarkingMT = false;
|
||||
Settings::Get("IsBenchmarkingMT", isBenchmarkingMT);
|
||||
|
||||
if (isBenchmarkingMT)
|
||||
return new BenchmarkTilingRenderPolicyMT(videoTimer, useDefaultFB, rmParams, primaryRC);
|
||||
else
|
||||
return new BenchmarkRenderPolicyMT(videoTimer, useDefaultFB, rmParams, primaryRC);
|
||||
}
|
||||
else
|
||||
return new BenchmarkRenderPolicyMT(videoTimer, useDefaultFB, rmParams, primaryRC);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
#ifdef OMIM_OS_ANDROID
|
||||
return new PartialRenderPolicy(videoTimer, useDefaultFB, rmParams, primaryRC);
|
||||
return new PartialRenderPolicy(videoTimer, useDefaultFB, rmParams, primaryRC);
|
||||
#endif
|
||||
#ifdef OMIM_OS_IPHONE
|
||||
return new RenderPolicyMT(videoTimer, useDefaultFB, rmParams, primaryRC);
|
||||
return new RenderPolicyMT(videoTimer, useDefaultFB, rmParams, primaryRC);
|
||||
#endif
|
||||
#ifdef OMIM_OS_DESKTOP
|
||||
return new RenderPolicyMT(videoTimer, useDefaultFB, rmParams, primaryRC);
|
||||
return new RenderPolicyMT(videoTimer, useDefaultFB, rmParams, primaryRC);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
catch (yg::gl::platform_unsupported const &)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,10 +67,10 @@ namespace yg
|
|||
|
||||
bool g_doDeleteOnDestroy = true;
|
||||
|
||||
bool CheckExtensionSupport()
|
||||
void CheckExtensionSupport()
|
||||
{
|
||||
/// this functionality must be supported
|
||||
return (g_isFramebufferSupported && g_isRenderbufferSupported);
|
||||
if (!(g_isFramebufferSupported && g_isRenderbufferSupported))
|
||||
throw platform_unsupported();
|
||||
}
|
||||
|
||||
void LogError(char const * err, my::SrcPoint const & srcPt)
|
||||
|
|
|
@ -104,10 +104,14 @@ namespace yg
|
|||
void DumpGLInformation();
|
||||
|
||||
/// return false to terminate program
|
||||
bool CheckExtensionSupport();
|
||||
/// @throws platform_unsupported - is the platform we are running on is unsupported.
|
||||
void CheckExtensionSupport();
|
||||
|
||||
struct platform_unsupported{};
|
||||
|
||||
void CheckError(my::SrcPoint const & srcPt);
|
||||
void CheckEGLError(my::SrcPoint const & srcPt);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace yg
|
|||
glMapBufferFn = &glMapBufferOES;
|
||||
glUnmapBufferFn = &glUnmapBufferOES;
|
||||
|
||||
g_isFramebufferSupported = true;
|
||||
g_isFramebufferSupported = HasExtension("GL_OES_framebuffer_object");
|
||||
|
||||
glBindFramebufferFn = &glBindFramebufferOES;
|
||||
glFramebufferTexture2DFn = &glFramebufferTexture2DOES;
|
||||
|
@ -55,7 +55,7 @@ namespace yg
|
|||
glDeleteFramebuffersFn = &glDeleteFramebuffersOES;
|
||||
glCheckFramebufferStatusFn = &glCheckFramebufferStatusOES;
|
||||
|
||||
g_isRenderbufferSupported = true;
|
||||
g_isRenderbufferSupported = g_isFramebufferSupported;
|
||||
|
||||
glGenRenderbuffersFn = &glGenRenderbuffersOES;
|
||||
glDeleteRenderbuffersFn = &glDeleteRenderbuffersOES;
|
||||
|
|
Loading…
Add table
Reference in a new issue