gl/context: add check_gl_version

This commit is contained in:
Matthew Waters 2014-05-29 20:35:48 +10:00 committed by Tim-Philipp Müller
parent 2ee94d606c
commit babef3069b
2 changed files with 32 additions and 0 deletions

View file

@ -1041,6 +1041,37 @@ gst_gl_context_get_gl_version (GstGLContext * context, gint * maj, gint * min)
*min = context->priv->gl_minor; *min = context->priv->gl_minor;
} }
/**
* gst_gl_context_check_gl_version:
* @context: a #GstGLContext
* @api: api type required
* @maj: major version required
* @min: minor version required
*
* Returns: whether OpenGL context implements the required api and specified
* version.
*/
gboolean
gst_gl_context_check_gl_version (GstGLContext * context, GstGLAPI api,
gint maj, gint min)
{
g_return_if_fail (GST_GL_IS_CONTEXT (context));
if (maj > context->priv->gl_major)
return FALSE;
if ((gst_gl_context_get_gl_api (context) & api) == GST_GL_API_NONE)
return FALSE;
if (maj < context->priv->gl_major)
return TRUE;
if (min > context->priv->gl_minor)
return FALSE;
return TRUE;
}
/** /**
* gst_gl_context_check_feature: * gst_gl_context_check_feature:
* @context: a #GstGLContext * @context: a #GstGLContext

View file

@ -135,6 +135,7 @@ gboolean gst_gl_context_set_window (GstGLContext *context, GstGLWindow *win
GstGLWindow * gst_gl_context_get_window (GstGLContext *context); GstGLWindow * gst_gl_context_get_window (GstGLContext *context);
void gst_gl_context_get_gl_version (GstGLContext *context, gint *maj, gint *min); void gst_gl_context_get_gl_version (GstGLContext *context, gint *maj, gint *min);
gboolean gst_gl_context_check_gl_version (GstGLContext * context, GstGLAPI api, gint maj, gint min);
gboolean gst_gl_context_check_feature (GstGLContext *context, const gchar *feature); gboolean gst_gl_context_check_feature (GstGLContext *context, const gchar *feature);
/* FIXME: remove */ /* FIXME: remove */