glcontext: wgl: Implement check_feature vfunc

There are several WGL specific extenstions such as WGL_NV_DX_interop.
Currently we have no WGL specific extension support and
this commit is also only for debugging purpose.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/947>
This commit is contained in:
Seungha Yang 2020-11-28 04:14:14 +09:00 committed by GStreamer Merge Bot
parent 5aa836848e
commit a62af4ff27

View file

@ -37,8 +37,10 @@
struct _GstGLContextWGLPrivate struct _GstGLContextWGLPrivate
{ {
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB; PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
GstGLAPI context_api; GstGLAPI context_api;
const gchar *wgl_exts;
}; };
#define GST_CAT_DEFAULT gst_gl_context_debug #define GST_CAT_DEFAULT gst_gl_context_debug
@ -59,6 +61,8 @@ static void gst_gl_context_wgl_destroy_context (GstGLContext * context);
GstGLAPI gst_gl_context_wgl_get_gl_api (GstGLContext * context); GstGLAPI gst_gl_context_wgl_get_gl_api (GstGLContext * context);
static GstGLPlatform gst_gl_context_wgl_get_gl_platform (GstGLContext * static GstGLPlatform gst_gl_context_wgl_get_gl_platform (GstGLContext *
context); context);
static gboolean gst_gl_context_wgl_check_feature (GstGLContext * context,
const gchar * feature);
static void static void
gst_gl_context_wgl_class_init (GstGLContextWGLClass * klass) gst_gl_context_wgl_class_init (GstGLContextWGLClass * klass)
@ -82,6 +86,8 @@ gst_gl_context_wgl_class_init (GstGLContextWGLClass * klass)
context_class->get_gl_api = GST_DEBUG_FUNCPTR (gst_gl_context_wgl_get_gl_api); context_class->get_gl_api = GST_DEBUG_FUNCPTR (gst_gl_context_wgl_get_gl_api);
context_class->get_gl_platform = context_class->get_gl_platform =
GST_DEBUG_FUNCPTR (gst_gl_context_wgl_get_gl_platform); GST_DEBUG_FUNCPTR (gst_gl_context_wgl_get_gl_platform);
context_class->check_feature =
GST_DEBUG_FUNCPTR (gst_gl_context_wgl_check_feature);
} }
static void static void
@ -189,11 +195,22 @@ gst_gl_context_wgl_create_context (GstGLContext * context,
context_wgl->priv->wglCreateContextAttribsARB = context_wgl->priv->wglCreateContextAttribsARB =
(PFNWGLCREATECONTEXTATTRIBSARBPROC) (PFNWGLCREATECONTEXTATTRIBSARBPROC)
wglGetProcAddress ("wglCreateContextAttribsARB"); wglGetProcAddress ("wglCreateContextAttribsARB");
context_wgl->priv->wglGetExtensionsStringARB =
(PFNWGLGETEXTENSIONSSTRINGARBPROC)
wglGetProcAddress ("wglGetExtensionsStringARB");
wglMakeCurrent (device, 0); wglMakeCurrent (device, 0);
wglDeleteContext (trampoline); wglDeleteContext (trampoline);
trampoline = NULL; trampoline = NULL;
if (context_wgl->priv->wglGetExtensionsStringARB) {
context_wgl->priv->wgl_exts =
context_wgl->priv->wglGetExtensionsStringARB (device);
GST_DEBUG_OBJECT (context, "Available WGL extensions %s",
GST_STR_NULL (context_wgl->priv->wgl_exts));
}
if (context_wgl->priv->wglCreateContextAttribsARB != NULL if (context_wgl->priv->wglCreateContextAttribsARB != NULL
&& gl_api & GST_GL_API_OPENGL3) { && gl_api & GST_GL_API_OPENGL3) {
gint i; gint i;
@ -395,6 +412,14 @@ gst_gl_context_wgl_get_gl_platform (GstGLContext * context)
return GST_GL_PLATFORM_WGL; return GST_GL_PLATFORM_WGL;
} }
static gboolean
gst_gl_context_wgl_check_feature (GstGLContext * context, const gchar * feature)
{
GstGLContextWGL *context_wgl = GST_GL_CONTEXT_WGL (context);
return gst_gl_check_extension (feature, context_wgl->priv->wgl_exts);
}
gpointer gpointer
gst_gl_context_wgl_get_proc_address (GstGLAPI gl_api, const gchar * name) gst_gl_context_wgl_get_proc_address (GstGLAPI gl_api, const gchar * name)
{ {