summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2023-04-25 22:45:34 +0200
committerBenjamin Otte <otte@redhat.com>2023-04-27 02:13:32 +0200
commit7c7a3d67ca89c6a85401166b345f88bd3ed2becd (patch)
treebc49f402277b282f2b0def61752ee0f3c24fa6ed /gdk
parentd33b82249befb596c8adfba81202d5f8552c8939 (diff)
downloadgtk+-7c7a3d67ca89c6a85401166b345f88bd3ed2becd.tar.gz
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.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdkglcontext.c13
1 files changed, 5 insertions, 8 deletions
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,