mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
egl: fallback to a non-debug context if a debug one fails
The text for EGL_KHR_create_context added the possiblity for ES contexts to ask for a debug context however that has not been fully realized by all implementations. Fallback to a non-debug context when the implementation errors.
This commit is contained in:
parent
30591d664c
commit
f6930bc0b4
1 changed files with 21 additions and 4 deletions
|
@ -328,6 +328,8 @@ gst_gl_context_egl_create_context (GstGLContext * context,
|
|||
goto failure;
|
||||
}
|
||||
|
||||
egl_exts = eglQueryString (egl->egl_display, EGL_EXTENSIONS);
|
||||
|
||||
GST_DEBUG ("about to create gl context\n");
|
||||
|
||||
if (egl->gl_api & GST_GL_API_GLES2) {
|
||||
|
@ -335,8 +337,10 @@ gst_gl_context_egl_create_context (GstGLContext * context,
|
|||
context_attrib[i++] = 2;
|
||||
}
|
||||
#if !defined(GST_DISABLE_GST_DEBUG)
|
||||
context_attrib[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attrib[i++] = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||
if (gst_gl_check_extension ("EGL_KHR_create_context", egl_exts)) {
|
||||
context_attrib[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attrib[i++] = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||
}
|
||||
#endif
|
||||
context_attrib[i++] = EGL_NONE;
|
||||
|
||||
|
@ -344,6 +348,21 @@ gst_gl_context_egl_create_context (GstGLContext * context,
|
|||
eglCreateContext (egl->egl_display, egl->egl_config,
|
||||
(EGLContext) external_gl_context, context_attrib);
|
||||
|
||||
if (egl->egl_context == EGL_NO_CONTEXT && egl->gl_api & GST_GL_API_GLES2
|
||||
&& eglGetError () != EGL_SUCCESS) {
|
||||
/* try without EGL_CONTEXT_FLAGS flags as it was added to
|
||||
* EGL_KHR_create_context for gles contexts */
|
||||
int i;
|
||||
for (i = 0; i < G_N_ELEMENTS (context_attrib); i++) {
|
||||
if (context_attrib[i] == EGL_CONTEXT_FLAGS_KHR ||
|
||||
context_attrib[i] == EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR)
|
||||
context_attrib[i] = EGL_NONE;
|
||||
}
|
||||
egl->egl_context =
|
||||
eglCreateContext (egl->egl_display, egl->egl_config,
|
||||
(EGLContext) external_gl_context, context_attrib);
|
||||
}
|
||||
|
||||
if (egl->egl_context != EGL_NO_CONTEXT) {
|
||||
GST_INFO ("gl context created: %" G_GUINTPTR_FORMAT,
|
||||
(guintptr) egl->egl_context);
|
||||
|
@ -355,8 +374,6 @@ gst_gl_context_egl_create_context (GstGLContext * context,
|
|||
goto failure;
|
||||
}
|
||||
|
||||
egl_exts = eglQueryString (egl->egl_display, EGL_EXTENSIONS);
|
||||
|
||||
if (other_context == NULL) {
|
||||
/* FIXME do we want a window vfunc ? */
|
||||
#if GST_GL_HAVE_WINDOW_X11
|
||||
|
|
Loading…
Reference in a new issue