Request GLES 3.0 context and fallback to 2.0 if not available.

This commit is contained in:
Deve 2016-08-22 20:05:36 +02:00
parent ed5a957a64
commit 7f4d815dde

View File

@ -123,13 +123,6 @@ namespace video
EGL_NONE, 0 EGL_NONE, 0
#endif #endif
}; };
EGLint contextAttrib[] =
{
#ifdef EGL_VERSION_1_3
EGL_CONTEXT_CLIENT_VERSION, 2,
#endif
EGL_NONE, 0
};
EGLConfig config; EGLConfig config;
EGLint num_configs; EGLint num_configs;
@ -242,11 +235,41 @@ namespace video
eglBindAPI(EGL_OPENGL_ES_API); eglBindAPI(EGL_OPENGL_ES_API);
#endif #endif
os::Printer::log("Creating EglContext..."); os::Printer::log("Creating EglContext...");
EglContext = eglCreateContext(EglDisplay, config, EGL_NO_CONTEXT, contextAttrib); EglContext = EGL_NO_CONTEXT;
if (!Params.ForceLegacyDevice)
{
os::Printer::log("Trying to create Context for OpenGL-ES3.");
EGLint contextAttrib[] =
{
#ifdef EGL_VERSION_1_3
EGL_CONTEXT_CLIENT_VERSION, 3,
#endif
EGL_NONE, 0
};
EglContext = eglCreateContext(EglDisplay, config, EGL_NO_CONTEXT, contextAttrib);
}
if (EGL_NO_CONTEXT == EglContext) if (EGL_NO_CONTEXT == EglContext)
{ {
os::Printer::log("FAILED\n"); os::Printer::log("Trying to create Context for OpenGL-ES2.");
os::Printer::log("Could not create Context for OpenGL-ES2 display.");
EGLint contextAttrib[] =
{
#ifdef EGL_VERSION_1_3
EGL_CONTEXT_CLIENT_VERSION, 2,
#endif
EGL_NONE, 0
};
EglContext = eglCreateContext(EglDisplay, config, EGL_NO_CONTEXT, contextAttrib);
if (EGL_NO_CONTEXT == EglContext)
{
os::Printer::log("FAILED\n");
os::Printer::log("Could not create Context for OpenGL-ES2 display.");
}
} }
eglMakeCurrent(EglDisplay, EglSurface, EglSurface, EglContext); eglMakeCurrent(EglDisplay, EglSurface, EglSurface, EglContext);