From: Benjamin Otte Date: Tue, 25 Apr 2023 20:45:34 +0000 (+0200) Subject: glcontext: assert all contexts set the version on realize() X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~366^2~6 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7c7a3d67ca89c6a85401166b345f88bd3ed2becd;p=gtk4.git glcontext: assert all contexts set the version on realize() Now that all contexts do that, insist that they keep doing it. And because they keep doing it, we can support querying the GL version from gdk_gl_context_get_version() without requiring the context to be made current. --- diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 294e58e555..9d06a3c266 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -1485,7 +1485,11 @@ gdk_gl_context_realize (GdkGLContext *context, priv->api = GDK_GL_CONTEXT_GET_CLASS (context)->realize (context, error); if (priv->api) - g_object_notify_by_pspec (G_OBJECT (context), properties[PROP_API]); + { + g_assert (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (0, 0))); + + g_object_notify_by_pspec (G_OBJECT (context), properties[PROP_API]); + } return priv->api; } @@ -1511,9 +1515,6 @@ gdk_gl_context_check_extensions (GdkGLContext *context) if (priv->extensions_checked) return; - if (!gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (0, 0))) - gdk_gl_version_init_epoxy (&priv->gl_version); - priv->has_debug_output = epoxy_has_gl_extension ("GL_ARB_debug_output") || epoxy_has_gl_extension ("GL_KHR_debug"); @@ -1693,10 +1694,6 @@ gdk_gl_context_get_shared_context (GdkGLContext *context) * Retrieves the OpenGL version of the @context. * * The @context must be realized prior to calling this function. - * - * If the @context has never been made current, the version cannot - * be known and it will return 0 for both @major and @minor. - * */ void gdk_gl_context_get_version (GdkGLContext *context,