mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 01:02:19 +00:00
gl/eagl: try getting a gles3 context
Fallback to a gles2 context if that fails
This commit is contained in:
parent
46cf23b0a1
commit
de5f87e72b
1 changed files with 16 additions and 5 deletions
|
@ -219,18 +219,29 @@ gst_gl_context_eagl_create_context (GstGLContext * context, GstGLAPI gl_api,
|
||||||
{
|
{
|
||||||
GstGLContextEagl *context_eagl = GST_GL_CONTEXT_EAGL (context);
|
GstGLContextEagl *context_eagl = GST_GL_CONTEXT_EAGL (context);
|
||||||
GstGLContextEaglPrivate *priv = context_eagl->priv;
|
GstGLContextEaglPrivate *priv = context_eagl->priv;
|
||||||
|
EAGLSharegroup *share_group;
|
||||||
|
|
||||||
if (other_context) {
|
if (other_context) {
|
||||||
EAGLContext *external_gl_context = (EAGLContext *)
|
EAGLContext *external_gl_context = (EAGLContext *)
|
||||||
gst_gl_context_get_gl_context (other_context);
|
gst_gl_context_get_gl_context (other_context);
|
||||||
EAGLSharegroup *share_group = [external_gl_context sharegroup];
|
share_group = [external_gl_context sharegroup];
|
||||||
|
|
||||||
priv->eagl_context = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES2 sharegroup:share_group];
|
|
||||||
[share_group release];
|
|
||||||
} else {
|
} else {
|
||||||
priv->eagl_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
share_group = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv->eagl_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3 sharegroup:share_group];
|
||||||
|
if (!priv->eagl_context) {
|
||||||
|
priv->eagl_context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2 sharegroup:share_group];
|
||||||
|
}
|
||||||
|
if (!priv->eagl_context) {
|
||||||
|
g_set_error (GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_CREATE_CONTEXT,
|
||||||
|
"Failed to create OpenGL ES context");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (share_group)
|
||||||
|
[share_group release];
|
||||||
|
|
||||||
priv->eagl_layer = NULL;
|
priv->eagl_layer = NULL;
|
||||||
priv->framebuffer = 0;
|
priv->framebuffer = 0;
|
||||||
priv->color_renderbuffer = 0;
|
priv->color_renderbuffer = 0;
|
||||||
|
|
Loading…
Reference in a new issue