glcontext: Add internal get_clipped_version function

It is useful for backends to get user set preferences while
ensuring the correctness of the result, which will be always
greater or equal than the minimum version provided
This commit is contained in:
Pablo Correa Gómez 2022-05-30 20:14:53 +02:00
parent 6bc3ecbe56
commit 8d175801d7
No known key found for this signature in database
GPG Key ID: 7A342565FF635F79
2 changed files with 23 additions and 0 deletions

View File

@ -1113,6 +1113,24 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
else
min = default_minor;
void
gdk_gl_context_get_clipped_version (GdkGLContext *context,
int min_major,
int min_minor,
int *major,
int *minor)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
int maj = min_major, min = min_minor;
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
if (priv->major > maj || (priv->major == maj && priv->minor > min))
{
maj = priv->major;
min = priv->minor;
}
if (major != NULL)
*major = maj;
if (minor != NULL)

View File

@ -117,6 +117,11 @@ gboolean gdk_gl_context_check_version (GdkGLContext
int required_gl_minor,
int required_gles_major,
int required_gles_minor);
void gdk_gl_context_get_clipped_version (GdkGLContext *context,
int min_major,
int min_minor,
int *major,
int *minor);
gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context);
void gdk_gl_context_push_debug_group (GdkGLContext *context,