From 0decbc5c497abe452a3cefbde5ade5dbb44c93f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wang=20Xin-yu=20=28=E7=8E=8B=E6=98=95=E5=AE=87=29?= Date: Tue, 22 Mar 2016 16:51:53 +0800 Subject: [PATCH] glcontext/wgl: try wglCreateContextAttribsARB even not gl3 core profile https://bugzilla.gnome.org/show_bug.cgi?id=764018 --- gst-libs/gst/gl/win32/gstglcontext_wgl.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/gst-libs/gst/gl/win32/gstglcontext_wgl.c b/gst-libs/gst/gl/win32/gstglcontext_wgl.c index 6fd7dd1..0961e40 100644 --- a/gst-libs/gst/gl/win32/gstglcontext_wgl.c +++ b/gst-libs/gst/gl/win32/gstglcontext_wgl.c @@ -223,23 +223,35 @@ gst_gl_context_wgl_create_context (GstGLContext * context, } if (!context_wgl->wgl_context) { - context_wgl->wgl_context = wglCreateContext (device); - if (!context_wgl->wgl_context) { - g_set_error (error, GST_GL_CONTEXT_ERROR, - GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, - "Failed to create WGL context 0x%x", (unsigned int) GetLastError ()); - goto failure; + if (context_wgl->priv->wglCreateContextAttribsARB && external_gl_context) { + context_wgl->wgl_context = + context_wgl->priv->wglCreateContextAttribsARB (device, + external_gl_context, 0); } - if (external_gl_context) { - if (!wglShareLists (external_gl_context, context_wgl->wgl_context)) { + + if (!context_wgl->wgl_context) { + + context_wgl->wgl_context = wglCreateContext (device); + + if (!context_wgl->wgl_context) { g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, - "failed to share contexts through wglShareLists 0x%x", + "Failed to create WGL context 0x%x", (unsigned int) GetLastError ()); goto failure; } + + if (external_gl_context) { + if (!wglShareLists (external_gl_context, context_wgl->wgl_context)) { + g_set_error (error, GST_GL_CONTEXT_ERROR, + GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, + "failed to share contexts through wglShareLists 0x%x", + (unsigned int) GetLastError ()); + goto failure; + } + } } context_wgl->priv->context_api = GST_GL_API_OPENGL; -- 2.7.4